Tuesday, 15 May 2012

ruby on rails - Git - Heroku deploy app that is composed of a couple of git repos -


Recently I have created a rail app for local business that they like this app so much that they Some other local businesses interested in the version of their own have found.

Here's the problem that I'm unsure about how to fix the main business logic behind the app for these new and future customers (about 80% of the code). While each customer can get their own stylesheets along with their own static pages.

Ive thought of multi-tenancy, but these people are ripe enough to honestly find it easier to create an app function as they have DB stored customer preferences (maybe I'm wrong here) Contrary to the creation, want.

I would like to configure this application so that I can make changes to the main business logic without overwriting a specific part of the client, maybe the site has only client specific content in making a second repo.

How can I configure this App / GIT repo so that I can not create a group of parallel repos?

road.


CORS filter gives 403 in POST only in Chrome -


I have followed the configuration in Tomcat. I receive a 403 error when requesting a post from remote machine to my local machine browser. I use EASYUI JQuery components, and they work fine on IE10 + and Firefox! Only Chrome is complaining about it. Can anyone have Hep?

  & lt; Filter & gt; & Lt; Filter-name & gt; CorsFilter & lt; / Filter-name & gt; & Lt; Filter range & gt; Org.apache.catalina.filters.CorsFilter & lt; / Filter range & gt; & Lt; / Filter & gt; & Lt; Filter-mapping & gt; & Lt; Filter-name & gt; CorsFilter & lt; / Filter-name & gt; & Lt; URL pattern & gt; / * & Lt; / URL pattern & gt; & Lt; / Filter-mapping & gt;  

The same problem was sending a JSON object through POST, and clear As a setting, a JSON content type header:

var config = {headers: {'Content-Type': 'application / json'}}; $ Http.post (url, config) .success ...

It seems Chrome is unable to detect content types and Firefox automatically.


xcode - Swift Code Improvement -


I'm quite new in Swift and Xcode 6 and have just created an app. Now I am trying to improve my code and I know that there is a way to reduce this code, I do not know how

  button1.layer.cornerRadius = 10 button1.layer .borderWidth = 1 Button 1.layer.borderColor = UIColor.whiteColor (). CGColor Button 2.layer.cornerRadius = 10 button2.layer.borderWidth = 1 button2. Layer.Bidder Corral = UiKolor. White collar () CGColor Button 3 Layer Corner Radius = 10 Button 3. Layer Bitter Wide = 1 Button 3. Layer.Bidder Corral = UiKolor. White collar () CGSelar Button 4 Layer Corner Redes = 10 Button 4. Layer .borderWidth = 1 button4.layer.borderColor = UIColor.whiteColor (). CGColor button5.layer.cornerRadius = 10 button 5.layer.borderWidth = 1 button 5.layer.borderColor = UIColor.whiteColor (). CGColor  

You can create an array of all buttons, and then make a loop through them. You can.


smartface.io - Smartface webview doesn't plays youtube videos -


Can anyone help me for this? I can not play any video on my app

I have created a web app that contains YouTube videos but Android app video is not played.

Video objects of Smartphone App Studio can run video files directly.

If you specify the YouTube link, then if you do not know the correct video path then this will not work.

But, to show you YouTube videos and pages, you suggest using the WebVi component.


Python's Subprocess removing Mysql columns and spacing -


Specifically, I am using:

  Python 2.4.3 (# 1, 24 May 2008, 13:47:28) [GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2  

I get a raw result of a mysql query Trying column names and boundaries are running the command here:

  [root @ machine ~] # mysql -u root -e 'show database;' + -------------------- + + | Database | + -------------------- + + | DBA | | DBB | | DBC | + -------------------- +  

I have a problem in python accumulating this value in a variable: Import Subtitled cmd_array = ["mysql", "-u", "root", "-e", "show database"] p = subprocess.open (cmd_array) raw_data = p. Communicate () [0] # console output: # + -------------------- + # database | # + -------------------- + # DBA | #dbb | #dbc # + -------------------- + # # raw_data None P = Sub-process POPIN (CMD_ARE, stdout = subprocess.PIPE) rawData = p.communicate () [0] print raw data #console output: # database #dba #dbb #dbc # # raw data "database \ ndbA \ ndbb \ nndbC"

What is the best way to print beautiful version of mysql output in a python variable?

You -t :

  P = check_output (["mysql", "- u", "root", "-t", "- e", 'show database' '']) print (p) + --------- ----------- + | Database | + -------------------- + + | Information_schema | | Mysql | | Performance_schema | | World | + -------------------- +  

You also use check_output to store the output can do.


swift - Filling an array with core data attributes -


I am trying to fill my array.

  var weight = []  

with attributes from an NSManaged object. My main data connection is like a client & lt; - >> Assessment I have a 'weight' attribute within the assessment and I would like to fill my head with these arrays which are the string. My variables:

  var Customer: Customer! = Zero  

Successfully retrieves the specific client I have selected, but I do not know how to fill my array with the values ​​named 'Weight' as the assessment property of that particular customer. I have just found that ...

  client.assessment.count  

which successfully shows me the number of client assessments, but

My managed object classes for clients and assessments are as follows:

Client.swift

  Import Imported Foundation CoreData @OzJEC (Client) Class Client: NSM Object {@NSManaged var Rating: NSS}}  

Assessment. Swift

  import foundation imported codedata @ Is settled (Assessment) Class Assessment: Ansmanej object {@NSManaged var weight: string @ NMS manager var Client: Client}  

Does anyone How do I know?

Update: Screenshot of error found with @Wen's answer. Enter image details here

You can use KVC to gain weight in the set:

  Different weight: NSSE! = Client.assessment.valueForKey ("weight")  

And after that you can sort the item or request all the objects.


excel - VBA troubleshoot, copy one cell in one workbook to another cell in another workbook based on two criteria -


I have two workbooks, which is my main observation and the other that is a copy of the trim of my main workbook, which The collaborator uses the people listed on our shared list to write notes based on their contacts.

I want to copy the notes of my colleagues in an appropriate column, by checking to see people's names and IDs. the same. So, I have to make sure that notes for Mike Smith, # 12 should be copied to their line and there should not be a line for Mike Smith # 77.

My idea was to do two loops, which goes through each row of the main sheet and then for that special main sheet row, through all the note sheet rows, the names and the names of the matches Find out, and when both of them get a match, copies of notes in that row in the note sheet, the main sheet in the appropriate column.

Here's what I have:

  Private sub-command button (1_Click) as slow jbBook in the workbook dim x as integer dim I set the integer jbBook = (I, 5) = jbBook.Worksheets (1). For cells (x, 5) (= C: \ ... \ Noteworkbook.xslx) = for I = 2 to 200 x = 2 to 200 Then if the cell (i, 16) = jbBook.Worksheets (1). Cell (x, 16) then cell (i, 52) = jbBook.Worksheets (1) .mail (i, 34) next x next i jbBook.Close last sub  

I believe this problem was S:

  if the cell (i, 5) = jbBook Worksheets (1) (X, 5) then  

try to change it

  if ActiveWorkbook.Cells (i, 5) = jbBook.Worksheets (1). X, 5) then  

I believe that the unreferenced cell () is giving the error that you definitely have to change all of them.

If you can think / break on different lines, just for readability.


ios - Locking scene to a sprite node swift xcode -


Basically, I want to move the character (player) and want to follow the "camera" or the scene in the world. The problem is that a camera node is not created in Apple / Xcode, and if I try to move the scene, then I get an error saying something under the influence of "SKScene". I just do not want to take the background and lock the player around in the place because I want to be able to implement the forces for the player node. I went to the website of Apple's Advanced Sean Processing page and followed the example but it does not work. I should cover with a nudge in the right direction!

code:

(I have removed the pieces of code that are irrelevant)

  class PlayScene: on SKScene cannonRotation = 0.0 bridesmaid remove = false override function didMoveToView (see: SKView) allow {physicsWorld.contactDelegate = self self.anchorPoint = CGPoint (X :, SKPhysicsContactDelegate {world = SKNode () player = SKShapeNode (25 circleOfRadius) 0.5, y : 0.5) self.addChild (world) // adds background to the world // adds the elements of visual player.fillColor = UIColor.whiteColor () player.position = CGPoint (X: CGRectGetMidX (self.frame), Y: CGRectGetMinY (self.frame) + 65 + 25) play er.zPosition = 2 player.physicsBody = SKPhysicsBody (circleOfRadius ?? 25) player.physicsBody .dynamic = true player.physicsBody .restitution = 0.9 player.physicsBody .categoryBitMask = BodyType.player.rawValue // Adds GameScene physicsGround let physics properties = SKPhysicsBody (edgeFromPoint: CGPoint (X: CGRectGetMinX (self.frame), Y: CGRectGetMinY (self.frame) +65), Topoint: CGPoint (X: CGRectGetMaxX (self.frame), Y: CGRectGetMinY (self.frame) + 65)) Self {powerlevel () totalPower = powerReached * playCannon.powerMultiplier self.addChild player.physicsBody .applyImpulse (CGVector (dx? Function touchesEnded (: NSSet, withEvent event UIEvent touches): .physicsBody = physicsGround} override CGFloat (float (TotalPower) * Cosf (float (cannonRotation))), sub: CGFloat (float (TotalPower) * Sinf (float (cannonRotation)) ))) fired = true}  

override Kiasimlet Feksiks, and in that function Call

  self.centerOnNode (player);  

What this does, it calls a function that we will create later and it will send parameters of an escondition and in your case this is the player node. centerOnNee Create a method called to add the following parameters

  func centerOnNode (node: Skeanod) {} ​​ 

The centerOnNode add the following line function code

  var cameraPosition:.? CGPoint = node.scene .convertPoint (node.position, fromNode: node.parent) cameraPosition .x = 0 to PosX = Nodekparent Kpositionkx to quote = node.parent .position.y node.parent .position = CGPointMake (PosX - cameraPosition.x, proverb - cameraPosition.y) ??  

will it will focus the camera on the node and updates its status. Code changed from here


How to get my hashmap to return multiple values to one key in python -


I'm at the end of my intelligence. I'm learning Python from learning PythontheHardWay, I was doing good practice until 39 Use dictionary module with swap I can only get it to work with key, price pairs. I want this module to be able to work with multiple values ​​for each key. There was another question like this, but the answer was not entirely complete, or I could not understand the answer. I want to learn the dragon, but it is really banning me from progress and I need help.

  def (mapped, key, default = none): "" The value is given in a bucket for the given key, or the default "" bucket = mill_bet (one map, key ) I, k, v = get_slot (aMap, key, default = default) for kum in enumerate (bucket): while v: return v # value of back key !!!  

This module does not retrieve the function. I use the list function of Python to list the entire dictionary with several key values. So I know that the values ​​through my set function are:

  def set (aMap, key, value): "" sets the key for the value, Instead of any existing value, "bucket = gets (one map, key) I, k, v = get_slot (one map, key) bucket. Append ((key, value))  

I know that I should get a value list there and then loop through the list if the key should have more than one value

put me in code language There is a hard time doing the bucket in the list for the tuple (K, V) pairs and there should be a list of V in Kashmir.

By now I see only one value and it closes why the loop closes?

Thanks

EDIT: For more clarity, I want to return more than one value if I input more than one value. Hashap (city, 'mh', 'mumbai') hashp .Set (city, 'mh', 'Pune') hashp .Set (city, ' ("% S"% Hashp.

All these values ​​should be excluded.

Keep in mind that the keyword " Back " always eliminates the function (cali) and jumps to the caller, Strong> back can not multiple return keywords using value multiple times "

    1. A list Return to the Tupal (as suggested @ terry-jane-riddy)
  • as applicable Do

    shell - Ansible read after write file operations in playbooks -


    I am working on a project using an angle for which I write a data book to write some data Required and then read data from another file using the same playbook.

    PlayBook will be something like this test1.yml

      --- - Host: Localhost connection: Local Assembled Function: No Action: - Name: Check File Local_Action Writing data for: Shell echo "Data:" {{100 | Random (step = 10)}} & gt; Test.txt - Include: test2.yml  

    and it will need to use test2.yml

      --- - Host: Localhost connection : Local Assemble: No vars_files: - test.txt Action: - Name: Writing data for file local_action: Shell echo "{{data}}" & gt; However,  

    The second playbook is not yet able to read the latest data posted by the PlayBook.

    If I look at the data written in test.txt and result.txt , then they are both different. Is there any way of achieving continuity between the results of Playbook calls ????

    Are those two playbooks separately called? If they are included inside a master playbook, then it will explain it. All Master Playbooks are included before the execution, so Anjali will have already read both the Playbook and vars_file before any of them will not be executed. While playing with the module, you should be able to resolve it with a dual-purpose file.

    If I was wrong with my belief and you are not including Playbook in a parent's playbook: What do you really mean by "different"? Is it completely different data or is this a formatting issue? I suspect that data can not generally be compatible between calls. There is no magic by writing and writing in writing. Doctrine should work


    uml - How to open an uml2 .tex? -


    I'm sorry if this is a very funny question but before yesterday I've always used Texs, Latex, Mattex, all this stuff did not hear. Basically I've cloned a GIT repo, in which the UML documents appear in a .tex file. After Google, it has inspired me to install MacTex, try opening these files. Click on 'TypeSat' which I think is how to create this document, but it gives an error about 'uml2' which is invalid syntax.

    Whether the program or I want to use anything to open the Tex file that has the same content like this:

      \ tikzstyle {uml2} = [fill = rupBody, draw = RupBorder, font = {\ ttfamily},]  

    Is it open to you in a program and visually visually? I think this file will show a UML diagram once opened uml.tex once opened. Or do I have a completely wrong idea? Sorry, if this is extremely amateur, like I said I have never heard of it before yesterday, and Google is not changing much information on it. Any direction will be greatly appreciated.

    You need to install PGF is the easiest to use TexLive once you all You can type the tax file if you install the package. TexShop is a good app for Max.

    Since you have indicated that you have never heard about TeX: Tex is a program written by Donald Knuth, several years ago when the computer was associated with vapor. But it is best that you can find for typing. This is more than mature, crude and 99,99% error. Donald Knuth has been given a gift for every error you received in the code and he has no need to pay for many years. What do you do to make those tax files (Latex is the most famous and to send it to a tex processor, it will create the product (now its PDF and earlier it was some DIV (device independent viewer IIRC).

    Edit I downloaded tikz-uml from here and in the tikz-uml.sty folder where the main .tx source is placed in the header

    To include
      \ usepackage {tikz-uml}  

    Afterwards I was able to compile the source.

    Note: There is a global location for .sty files but it depends on the app you use. Using Google to search for the place but putting .tex near .sty is okay anyway. Seeing the global people is a \ usepackage < / Code> Instructions appear in the first source folder.


    javascript - Jplit reset specific filter(s) -


    Therefore, I am using a plugin to filter a list of flats and send me something to reset Required at point (or more) is a specific filter point, there is no API that we can use to control the plugin externally.

    To reset the code used for the reset button to all the defaults:

      (function () {var d = function (b) {b} . $ Control ("click", function () {b.observer.trigger (b.observer.events.unknownStatusesChanged, [! 0])}), e = function (b) {d (b); return jQuery .extend (this, b)}; jQuery.fn.jplist.ui.controls.Reset = function (B) {new E (B)}; jQuery.fn.jplist.controlTypes.reset = {className: "Reset" , the option: {}}}) ();  

    I have to admit how it does not work perfectly, but I have done a quick test with it:

      jQuery (' # Some-id-button '). ('Click', function () {b.observer.trigger (b.observer.events.unknownStatusesChanged, [! 0])});  

    And it resets all the filters from a particular element.

    The question is, to target specific arguments, some arguments (ID, class) of them?


    php - Retrieving Angularjs Http Post data -


    I am new to angularjs, I am using a user name and user name and password ), But the strange thing is that I'm unable to get data using server $ _POST, instead I can retrieve it via $ _GET From I have other forms like CORS There is no mistake in checking the pains and there is no mistake. A guide would be appreciated thanks.

    Here's my angular factory method:

      app.factory ("loginfact", function ($ http) {this.user = { IsAuthenticated: false, name: "", token: ""} this.makeLoginRequest = function (user, pass) {var req = {method: 'post', url: 'http: // localhost / login / authenticate php', Header: {'content-type': "multipart / form-data"}, parameters: {username: user, password: pass}} $ http (req) .vivet (data) {console.log ("success : "+ Data)}). Error (function (data) {console.log (" error: "+ data)})}} return {makeLoginRequest: this.makeLoginRequest}});  

    Here is my server part:

      & lt; Php header ('accept-charset: UTF-8'); Header ('Connection: Keep-alive'); Header ('content-type: multipart / form-data,'); Header ('access-control-permission-origin: *'); Header ('access-control-app-methods: GET, post'); Header ('access-control-app-headers: approved, content-type'); Header ('Access-Control-Request-Header: X-Requested-Accept, Content-Type'); {{($ _ POST ["user name"] == "test") & amp; Amp; ($ _POST ["password"] == "test")) {echo "{\" id \ ": \" 700 \ ", \" User \ ": {\" uid \ ": \" 123456 \ ", \ "Role \": \ "admin \", \ "name \": \ "waqar \"}} "; Return; } Else {echo "phase1: invalid user name / password"; Return; }} Hold (exception $ e) {echo $ e-> GetMessage (); } Try {$ Request_body = file_get_contents ('php: // input'); $ Data = json_decode ($ request_body); If ($ data-> username == "test" & amp; amp; $ amp; data-> password == "test") {echo "{\" id \ ": \" 700 \ " , \ "User \": {\ "Uid \": \ "123456 \", \ "role \": \ "admin \", \ "name \": \ "void \"}}; return;} Else {Echo "step 2: invalid user name / password"; return;}} hold (exception $ e) {echo $ e-> getMessage (); return;}? & Gt;   < / Div> 

    You can object to parameter data by sending data to query parameter (URL - ? Key1 = value1 & amp; key2 = value2 ) in the header

    You instead of data object:

      var req = {method: 'post', url: 'http: //localhost/login/authenticate.php ', header: {content - type: "multipart / form-data"}, data: {username: user, password: pass}}  

    Check for more information.

    If I understand correctly, in the comments you are asking: Why the parameters were kept in the body of the request instead of URL?

    You can send them to the URL, but you have some drawbacks:

    • The encoding is better in the body than the URL
    • You do
    • It is usually limited by the length of the URL (the system varies but about 2000 characters)
    • It is easy to deceive the URL
    • The system usually saves the URL of their log so that you take the risk of exposing your client's accounts if a law (Note that they will be saved in plain text, even if you encrypt them in the database)
    • Considering the last point, the country is illegal to log sensitive data in some You can.

    ruby - Browser-Based Uploads Using POST -


    I am trying to create client side uploads using POST with AWS signature version 4. According to documents

    When I create a signature on the server side, and me to get an accurate get matching

    However, when I use the page with AWS sign This error is:

    Signature dots notmatch We have calculated the signature of the request, it does not match the signature you provided.

      OpenSSL :: HMAC.hexdigest ( 'SHA256', signing_key (string_to_sign: your keys and signature method   

    This is the code I used check), AWS documentation def signing_key generated String_to_sign) # Step 2 (encoded_policy) # correct date date = extract_encoded_policy_date (encoded_policy) Date = time_adjust (on) # encode algorithm date_key = OpenSSL :: all areas HMAC.digest ( ' SHA256, "Avs4 # {@} Sikret_akses_ke" Detksrftime ( "% d of"% of%)) Det_rijn_ke = Openssl :: Hmaskdaijest ( 'SHA256, Det_ke, @rijn) Det_rijn_srvis_ke = Openssl :: Hamas .digest ('SHA256', date_region_key, @service) sign_key = OpenS SL :: HMAC.digest signing_key end def time_adjust (on) time = Time.parse (date) time ( 'SHA256', date_region_service_key, 'aws4_request') + = Time.utc_offset time.utc end

    After a little searching in the net, I have encountered it. Apply this code and upload successful iv'e

      Signature = OpenSSL :: HMAC.digest (OpenSSL :: Digest :: Digest.new ( 'SHA1'), @secret_access_key, string_to_sign) Base64.encode64 (signed) .gsub ( "\ N "," ")` ` 

    This is short for the client-side code.

    Here is some literature I found useful:

    What is the difference between the two?
    How can I get the first option to work and upload my file? Is the example in AWS page no longer valid?

    After doing a research and by comparison I found out that there is a form of AWS that made me There were some redundant areas in using SHA1.

    After removing the AWSAccessKeyId area from the form and rename a few other areas, I managed to do AWS4 work.

    It has been updated

      & lt; Form id = "myForm" action = "http://yourbucket.s3.amazonaws.com/" method = "post" enctype = "multipart / form-data" & gt; & Lt; Input type = "hidden" id = "key" name = "key" value = "upload / $ {filename}" /> & Lt; Input type = "hidden" id = "acl" name = "acl" value = "YOUR_ACL_OPTION" /> & Lt; Input type = "hidden" name = "success_action_redirect" value = "http://google.com" /> & Lt; Input type = "hidden" id = "type" name = "content-type" value = "MIME_TYPE" /> & Lt; Input type = "hidden" name = "x-amz-meta-uuid" value = "14365123651274" /> & Lt; Input type = "hidden" name = "X-maze-credential" value = "YOUR_CREDENTIALS" /> & Lt; Input type = "hidden" name = "X-maze-algorithm" value = "AWS4-HMAC-SHA 256" /> & Lt; Input type = "hidden" id = "date" name = "x-mz-date" value = "" /> & Lt; Input type = "hidden" name = "x-amz-meta-tag" value = "" /> & Lt; Input type = "hidden" id = "policy" name = "policy" value = "YOUR_POLICY_DOCUMENT_BASE64_ENCODED" /> & Lt; Input type = "hidden" id = "signature" name = "x-amaz-sign" value = "YOUR_CALCULATED_SIGNATURE" /> & Lt; Input name = "file" id = "file" type = "file" /> & Lt; Input id = "btn_submit" class = "btn btn-warning" type = "submit" value = "upload file s3" & gt; & Lt; / Form & gt;  

    c# - Complex cascade deletion with Entity Framework's Code First -


    I am using the entity framework with the first code and I have a problem with the removal of the cascade. Since my model is not small, I need to turn it off, because otherwise the circular has to be deleted, which could not be solved by SQL Server.

      modelbuilder.Conventions.Remove & lt; OneToManyCascadeDeleteConvention & gt; (); ModelBuilder.Conventions.Remove & LT; ManyToManyCascadeDeleteConvention & gt; (); After this, it has been specified manually which organizations should be removed using Fluent API, such as:  
      modelbuilder.Entity & Lt; First & gt; (). HasRequired (x = & gt; x.Second). many of (). WillCascadeOnDelete (true);  

    However, I'm having problems during testing.

    How does the model look here represent the letters A to F institutions and the arrow points to the next unit which should be removed in the series (like a tree, but I explained that where the problem is).

    The problem is that one unit can not be destroyed in the middle because at the end one unit is a foreign key for the unit in the middle. However, both organizations will be destroyed anyway, SQL Server refuses to delete.

    • A - Cascade -> B
    • B - Cascade -> C
    • C - Waterfall -> D
    • C
    • E - Cascade -> F Here's a picture to make it easier to understand:

      When I try to delete the unit "A", I get the following message:

      This DELETE statement Contrary to context reference, \ "FK_dbo.F_dbo.D_Id \"

      This is very annoying, because SQL Server is able to find out Shm should be "D" and "F" both made the request to remove can be removed safely when A.

      How do you solve this problem? Keep in mind that the model is slightly more complicated than this and similar cases get the thought model again. You can assume that there is no circular cached data in the model because such cases are presented manually.

    I do not understand what your last sentence is saying because your problem OK < / Em> is that you have a circular dependency in your model: D -> E -> F -> D

    Since the integrity referred to is always protected There is no way that your delivery can be successful until the circular dependence is there. If it can be broken by excluding FC connection, for example, DIID can be removed in every F line, then it is zero. This will work when the work is finished for the rows affecting the circular.

    Circular dependency is not a good sign of quality design, I urge you to reconsider it.


    xml - Custom EditText Shape Android -


    Trying to create a custom red editing test that takes the background of the slice layout I tried several things but the layout Any ideas I can not make it transparent to use the color background?

    edit text shape

    I tried with: < / P>

      & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Layer-list xmlns: android = "http://schemas.android.com/apk/res/android" & gt; & Lt; Item Android: Droplet = "@ Drable / Red_Bayband" /> -Red & LT; Item Android: Below = "10 DP" Android: Drawable = "@ Drauble / Trans_backfind" Android: Top = "0 DP" /> & Lt; Android: draw = "@ drawen / trans_background" Android: left = "@ dimen / input_line_width" Android: right = "@ dimen / input_line_width" Android: top = "0dp" / & Gt; & Lt; / Layer-list & gt;  

    Ensure @ drawable / trans_background background color code # 00000000

    Note: Color code here is not 6digit number. Its 8 digits, where 1 2 digits are for the ambiguity of the background. It should remove background visibility.


    arrays - Python: parse json list -


    मेरे पास json फ़ाइल है, data.json

      {"नाइट्रोजन": [0.0173, 0, 0, 0, 28.0135], "ऑक्सीजन": [0.0283, 0, 0, 0, 31.9 9 88]}  

    मैंने इस तरह से डेटा पढ़ा :

    <पूर्व> आयात करें जेसन डीईएफ़ read_data (पथ): डेटा के रूप में खुले (मार्ग, 'आरयू') के साथ: गैसों में गैस के लिए गैसों = जेसन.लोड (डेटा): उपज गैस अगर __name__ == '__main__': read_data ('data.json') में पंक्ति के लिए: प्रिंट (पंक्ति)

    यह मुझे देता है

      नाइट्रोजन ऑक्सीजन  

    इसके बजाय मैं सूची में मान कैसे प्राप्त करूं?

    इस तरह से : गैस (गैस), मूल्य (गैस, मान)

      गैस के लिए गैसों = json.load (डेटा), gasses.items () में मान  

    java - Background in black and image in white colour -


    I am converting this project to black and white in color. What I want to do is change the background that it will be black and the image will be white in color .. But most codes which are turning white and white in the image black and background. How can anyone know how to change? I already have a code to black and white that image.

    here Enter image details

    Google is your best friend ....

    In this example you can see that the white turns black and against it / versa
    It also works on all other colors too.

    And this is very fast , because it uses a color matrix, the pixel is not pixel by color change, which the wold would require width * hight operation. This is a single pass !

    [edit]

    I thought that you already had black and white image. If this is not your case, use only the grayscale color matrix in the form of a report in response to the Lalit Popatani. To change the brightness and contrast (after changing the grayscale), try the code found here: Something to help to change the shine and contrast here:


    Send and listen to multiple queues of rabbitMQ using java -


    I have 2 types of queues for each message type - 1. REQUEST_QUEUE - to send message 2. RESPONSE_QUEUE - message To get feedback.

    So if there are 5 message types, then we have 10 queues.

    As a customer, I want to send a message in all the requested queue and I want to hear the response line according to the co-relation ID. To publish a message that I am using the code below:

      public static zero publishing message (string exchange, string routing, string reaction key, list & lt; string & gt; Message list) IOException, exception {ConnectionFactory factory = new ConnectionFactory (); Factory.setHost (Constants.rabbitMQServerProperties.HOST_NAME); Factory.setUsername (Constants.rabbitMQServerProperties.USER_NAME); Factory.setPassword (Constants.rabbitMQServerProperties.PASSWORD); Factory.setport (constants.rabbitMQServerProperties.PORT); Connection connection = factory.New connection (); Channel channel = connection.createChannel (); //System.out.println (channel.isOpen ()); //System.out.println(message); (String Message: Message List) {channel.basicPublish (Exchange, Routing, True, Message Protocol.PERSISTENT_BASIC, message.getBytes ()); } Channel.close (); Connection.close (); System.out.println ("The message has been successfully published! \ N \ n"); Connection con = factory.newConnection (); // Executioner Service Thread Expector = Exporter. Nfix and Thipple (5); // Response queue worker fast = listen to new workers (0, Thread Exclorator, Con. Content channel (), feedback); }  

    On the last line, once I send the message, I am listening to the message queue.

    Worker. Java:

      Public class employees default consumer {string name; Channel channel; String queue; Int processed; Executor Service Executor; Public worker (int prefetch, executives thrad exclater, channel c, string que) throws an exception {super (c); Channel = C; Q = q; Channel.basicQos (prefetch); Channel.basicConsume (queue, wrong, this); Executor = Thread Accelerator; } @ Override Public Wide Handle Delivery (String ConsumerTag, Envelope Envelope, AMQP.Bitic Properties Properties, Byte [] Body) IOException throws {string feedback = new string (body); String routing key = envelope.gateetting (); String contentType = properties.getContentType (); String correlation ID = properties .getCorrelationId (); System.out.println (Q + "response ::" + response); My problems are: 

    1. While listening to the queue, I only need to select my messages which I have presented, I have a list of correlation IDs) and if this is my corrupt ID I do not need to send the message back in the response queue.

    2. Once I get my message, I have to close my connection.

    3. If I am sending messages in one of my 5 queens, my approach to sending is; Is it fair to hear?

    Thanks in advance!


    karma jasmine - testing ui-router stateprovider 'resolve:' values -


    I'm using jasmine + karma to run the following code ... and get the following error:

    <<< Code> required {then: function, hold: function, finally: function} equal 123. Can someone help me to understand why I'm sure of your promise. Thanks 'Strict Use'; Angular Modules ('Example', ['ui.router']). Conflict (function ($ state provider) {$ stateProvider .state ('stateOne', {url: '/ stateOne', solve: {cb: function ($ Q) {var deferred = $ q.defer (); deferred Resolve (123); refund suspended.promis;}}, controller: function ($ radius, CB) {console.log ('in controller', CB);}, TemplateUrl: 'stateOne.html'})}). Run (function ($ template cache) {$ templateCache.put ('stateOne.html', 'this is the content of the template');}); Describe ('main test', function () (first) (function () (module ('example');}) ('basic test', description of the function ($ rootscope)) (this ('state' 'Injection (function $ rootscope, $ state, $ injector, $ compilation) {var config = $ state.get (' stateOne '); Hopefully (config.url) .toEqual (' / stateOne '); $ compilation (' & Lt; div ui-view / & gt; '($ rootsecope); $ rootsecope. $ Digest (); hopefully ($ injector.invoke (config.resolve.cb)). ToEqual (123);})) ;});}); Well, explained this to Nicos with some help (via email), whose blog contains

    I found at :.

    Here is a brief example of how resolution values ​​are tested in ui.router, where the value is $ http.

      Angular Modules ('Example', ['ui.router']) .Feature ('clipboard', function ($ http) {return {get: function (args) {return $ http.get ('/ db / clipboard'); }};}) Config (function ($ state provider) {$ stateProvider .state ('stateOne', {Hull: {cb: function (clipboard)} return clipboard .get ();}}})}}); Describe ('main test', function () (function) (module ('example');}); ('stateon', injection (function ($ state, $ injector, $ httpBackend) {$ httpBackend } ('/ Db / clipboard'). Answer ({a: 1}); $ injector.invoke ($ state.get ('stateOne'). ['Cb']. Then solve (race) {Console} .log ('* res', res.data);}) hold (function (mistake) {console.log ('* err', err);}); $ httpBackend.flush ();}) ); AfterEach (Injection (function ($ httpBackend) {$ httpBackend.verifyNoOutstandingExpectation (); $ httpBackend.verifyNoOutstandingRequest ();})))}};  

    javascript - Switching classes from display:none to visible on click -


    I am reading lots of previous posts but I do not understand how to do this for my special issue .

    I have an image on the left side of my site that has two options, cow and pig. The way I plan to use this part of this page is as a slider. I would like a user to click on this image and roam multiple times in the form of "Cig" and "Pig" and "Pig" as "Cow" several times.

    This selection decides what the background is, the image is used in the other side on the right side of the page. So when I click on the image on the left, I would like to change the display properties to alternate to appear as a cow (and toggle the display: any property from pig to cow).

    Any help would be commendable. I have seen but it does not help me completely

       

    Try adding a click event to each image that hides the image shown Shows more Try it:

      $ (document) .ready (function () {var $ slider1 = $ ('homesplashslider'); var $ slider2 = $ ('homesplashslider2'); $ ('. Cowtoggle ') (function () {$ slider1.show (); $ slider2.hide ();}); $ (' .pigtoggle ') Click (function () {$ slider2.show (); $ Slider1.hide ();});});  

    osx - How to have Gnuplot automatically updating .eps figures on mac? -


    Once I edit and run my gnuplot script on Ubuntu, I have the .psps data open, I can see the new statistic update. However, to see the updated statistics, I must close and open the file on Mac OSX. After looking at updated statistics, how do I run an edited script?

    The problem is that before previewing the .pdf display, and seeing this process file Comes in the way of preview.

    I like Skim Tool to see me. Gnplot or latex If you want to follow it, it will tell you about the change in file for the first time.

    Another solution (less than ideal on Mac), open the file in live , and select Options> View file.

    I would love to hear about the tools in OS X, which it does automatically ...


    Sorting Array in Perl -


    I thought I could do it in the way described below. However, when I sort it like this, the output is hexadecimal value, the string is rather than pointing to "item" in the array @ menu. I want to sort it with "item-name" to get it

      my @ menuu = ({item = & gt; "blazer", price => 100, color = & Gt; "Brown"}, {item = & gt; "jeans", value => 50, color => gt; "blue"}, {item = & gt; "shawl", price => 30, Color = & gt; "red"}, {item = & gt; "suit", value = & gt; 40, color = & gt; "black"}, {item => "top", value = & Gt; 25, color = & gt; "white"},); My @test = sort {item} @ menu; Foreign (@Test) {Print $ _; }  

    prints your print $ _ string value Each hash context, you will get something like HASH (0x1d33524) . You have to print the fields of each hash, which you are interested in.

    In addition, you need a proper comparison expression within the sort block, giving the name of a hash key will not be useful.

      Use strict; Use warnings; My @ menu = ({item = & gt; 'blazer', price => 100, color = & gt; 'brown'}, {item = & gt; 'jeans', value => 50, color = & Gt; Blue '}, {item = & gt; shawl', value = & gt; 30; color = & gt; 'red'}, {item = & gt; 'suit', value = & gt; 40 , Color = & gt; 'black'}, {item = & gt; 'top', price => 25, color = & gt; 'white'}); My @ test = sort {$ a-> gt; {Item} cmp $ b- & gt; {Item}} @ menu; (@Test) {print "@ {$ _} {qw / item value color}} \ n"; Blazer 100 Brown Jeans 50 Blue Shawls 30 Red Suites 40 Black Top 25 White  

    Output

      / Pre >    

    >

      Use strict; Use warnings; My @ menu = ({item = & gt; 'blazer', price => 100, color = & gt; 'brown'}, {item = & gt; 'jeans', value => 50, color = & Gt; Blue '}, {item = & gt; shawl', value = & gt; 30; color = & gt; 'red'}, {item = & gt; 'suit', value = & gt; 40 , Color = & gt; 'black'}, {item = & gt; 'top', price => 25, color = & gt; 'white'}); My @test = type map {$ _- & gt; {Item}} @ menu; Print "$ _ \ n" for print;  

    Output

      Blurzer jeans shawl suit top  

    How to use statusbar in excel vba on mac -


    I am trying to install a progress bar so that I can see if my enterprise is running if I freeze Excel I'm looking at one of the answers, but it's not working.

    Here's what I have:

    set_cell_range = as the last name with the worksheets ("data_history") as an integer = N = 0 to 18 initial_grade_orange.offetset (n, 1) = end_are (n) application for range (find_last_column ("Data_History")). StatSbar = "Progress:" & amp; N & amp; "18" & amp; Format (n / 18, "0%") Next n Application. StatusBar = Wrong End

    Is not it working because I'm on Mac?

    I think you have an application.DisplayStatesbar and it is visible? Try adding DoEvents here:

      .... DoEvents application.StatusBar = "Progress:" & amp; N & amp; "18" & amp; Format (N / 18, "0%") ....  

    actionscript 3 - Modify FileReference.data bytearray before upload not working -


    I have a simple file browser that allows a user to choose a local image, I upload this image I want to manipulate the server before. The problem I am facing is that when I call on fileReference.upload () it uploads the original file instead of the modified biometrater on the user's hard drive. Am I doing something wrong, this is the expected behavior or bug?

    As a very basic test, if I do something like this, I get the original file:

      / / file to load _fileReference.load () in memory Do; // ... file reference on loaded trace (_fileReference.data.length); // 230189 _fileReference.data.clear (); Trace (_fileReference.data.length); // 0 // It has been commented with the next line that I expect a 0 bytes file, or an error or something, but instead it uploads the original file happily //_fileReference.data.writeBytes (MyNewByteArray); _fileReference.upload (myURLRequest);  

    According to this post it should work ...

    Any thoughts were greatly appreciated!

    Cheers, Simon

    carefully Read the reference. It says that the property of the data is read only, that means that you can not convert an image directly before uploading it.

    To change an image, you can use the bitmap to get an example, then change it the way you want and then upload it to your server. / P>


    python - Foreign Key Resource from dynamic field -


    After

    I have an API end point called TrackMinResource , which minimizes data for a music track Returns have been received, in which the main artist of the track was returned as a ArtistMinResource .

      class TrackMinResource (ModelResource): Artist = fields.ForeignKey (ArtistMinResource, 'Artist', complete = true) class Meta: queryset = Track.objects.all (who went the two definitions here) RESOURCE_NAME = "track minutes' fields = [ 'id', 'artist', 'TRACK_NAME' label ',' RELEASE_YEAR 'Release_name'] Include_resource_uri = false cache = SimpleCache (public = true) def dehydration (self Bundle ): bundle.data [ 'full_artist_name'] = bundle.obj.full_artist_name () if bundle.obj.image_url = settings.NO_TRACK_IMAGE: bundle.data [ 'image_url'] = bundle.obj.image_url class ArtistMinResource (ModelResource): class Meta: querygroup = Artist.objects.all () RESOURCE_NAME = "Artists minutes' fields = [the 'id', 'Artist'] cash = SimpleCache (Public = True) def get_resource_uri (self, bundle_or_obj): return '/ API / V 1 / artist /' + str (Bndl_oar_obij. OBZ.) + '/'  

    The pro is Belem, artist on the field track (formerly a ForeignKey ) Is now a model method which has changed the structure of the database to some extent main_artist , but I would like to return the API to the same data as previously performed). For this reason, I get this error:

      {"error": "model" & amp; lt; track: trackname & gt; An empty feature is 'artist' and does not allow a zero value. "}  

    If I remove full = true from the 'artist' area, Add Code> TrackMinResource and instead null = true , I get zero values ​​for the artist field in the returned data.

      bundle.data [ 'artist'] = bundle.obj.main_artist ()   dehydration  are thus assigned Artists Instead of representing  dict  a  ArtistMinResource , get the name of the artist back in JSON (associate  source_uri  S, which I want). 

    Any ideas how to get it in ArtistMinResource s my TrackMinResource ? I can use an ArtistMinResource which came true using the URL endpoint and asks for the ID. Get results from within TrackMinResource

    dehydrate function Is there a function for? Itemprop = "text">

    You can use your ArtistMinResource in dehydration of TrackMinResource (assuming that the main artistist () represents the object that represents your artist minisor):

    < pre> artist_resource = ArtistMinResource () artist_bundle = Artist_resource.build_bundle (obj = bundle.obj.main_artist (), request = request) artist_bundle = artist_resource.full_dehydrate (artist_bundle) artist_json = artist_resource.serialize (request = request, data = Artist_bundle, format = 'application / jason')

    artist_zone is now your full featured artist Should be a person. Apart from this, I am pretty sure that if you pass the request and it has a content-type header population then the format will not be passed.


    c# - Change ItemsControl content from codebehind -


    मेरे पास wpf नियंत्रण TimeLineControl कोड के साथ है:

      .. & lt; आइटमोंकंट्रोल आइटम्स सोर्स = "{बाइनिंग टाइमलाइन इटम्स}" & gt; & LT; ItemsControl.ItemTemplate & gt; & LT; DataTemplate & gt; & Lt; रंग लाइइन: टाइमलाइन इटैम / & gt; & Lt; / DataTemplate & gt; & LT; /ItemsControl.ItemTemplate> & LT; ItemsControl.ItemsPanel & gt; & LT; ItemsPanelTemplate & gt; & Lt; स्टैकपैनेल ओरिएंटेशन = "क्षैतिज" / & gt; & Lt; / ItemsPanelTemplate & gt; & LT; /ItemsControl.ItemsPanel> & Lt; / ItemsControl & gt; ...  

    ColorLine मेरा नेमस्पेस है, TimeLineItem मेरा UserControl है। वर्तमान में मैं ItemsSource को मेरे TimeLineViewModel ( TimeLineControl के लिए ViewModel) में बाध्य करें:

      ... निजी ऑब्ज़्वेशेबल कोलेक्शन & lt; TimeLineItemViewModel & gt; _timeLineItems; सार्वजनिक पर्यवेक्षण योग्यता & lt; टाइमलाइन इटैमव्यू मॉडल & gt; टाइमलाइनइटेम्स {प्राप्त करें {लौटें _timeLineItems; } निजी सेट {if (_timeLineItems == मान) वापसी; _timeLineItems = मूल्य; OnPropertyChanged (() = & gt; टाइमलाइनइटम); }} ...  

    मैं इसे टाइमलाइन आइटम में ItemsControl dynamicaly की संख्या बदलने के लिए उपयोग करता हूं।

    लेकिन मैं इस 2 रिडुडांट व्यू मॉडेल्स ( TimeLineViewModel और TimeLineItemViewModel ) से छुटकारा पाने के लिए चाहता हूं, जहां तक ​​वास्तव में मैं इसका उपयोग केवल 1 मूल्य को नियंत्रित करने के लिए करता हूं: TimeLineItems - मुझे पता है कि यह तर्क भविष्य में जारी रहेगा और परिवर्तन नहीं करेगा।

    इसलिए मुझे अपना टाइमलाइन नियंत्रणाधिकार बिना व्यू मॉडल के रखना चाहते हैं, लेकिन कस्टम निर्भरता प्रॉपर्टी (मुझे लगता है) कोड के पीछे, उस प्रकार का int होगा इसे कॉल AmountOfSectionsProperty पर कॉल करें जब AmountOfSectionsProperty बदल जाएगा, तो यह TimeLineItems में ItemsControl में इसके मान को बदलता है।

    मैं इस संपत्ति को इस तरह लागू करता हूं :

      सार्वजनिक रीडोनली स्टैटिक निर्भरता प्रॉपर्टी AmountOfSectionsProperty = DependencyProperty.Register ("AmountOfSections", typeof (int), टाइपफ (टाइमलाइन नियंत्रण), नया फ्रेमवर्कप्रापर्टीमैटेटाडेटा (1, फ़्रेमवर्कप्रॉपर्टीमैटडेटाओपेशंसएफ़िफर्सपेरेंट मेज़र, AmountOfSectionsChangedCallback, CoerceAmountOfSectionsCallback)); निजी स्टेटिक ऑब्जेक्ट कॉससएरमाउंटऑफ़सेक्शन कॉलबैक (निर्भरता ऑब्जेक्ट निर्भरता ऑब्जेक्ट, ऑब्जेक्ट बेस वैल्यू) {var चालू = (इंट) बेस वैल्यू; यदि (वर्तमान & lt; 1) चालू = 1; यदि (वर्तमान & gt; 24) वर्तमान = 24; वर्तमान वापसी; } निजी स्थिर शून्य AmountOfSectionsChangedCallback (निर्भरता ऑब्जेक्ट निर्भरता ऑब्जेक्ट, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs) {नए NotImplementedException फेंक); } सार्वजनिक प्रवीण राशि का विभाजन ({वापसी (पूर्णांक) प्राप्त करें (अमाउंटफ़ोक्शनप्रॉपर्टी); } सेट {सेट वैल्यू (AmountOfSectionsProperty, value); }}  

    यह 1..24 रेंज में होना चाहिए। लेकिन मैं थोड़े वास्तविक बाइंडिंग के साथ अटक गया - ItemsControl आइटमों की संख्या बदलने के लिए, मेरी कॉलबैक विधि कैसे दिखनी चाहिए?


    C# Casting a Class implementing interface to Class based on type -


    My question is best explained with an example:

      public IPlotModel MyPlotModel; public ??? CastedModel; Public Constructor () {MyPlotModel = New PlotModel (); // It should be intimate with other types I / E: MyPlotModel = new OtherModel (); CastedModel = (MyPlotModel.GetType ()) MyPlotModel; }  

    This is basically what I want. CastedModel should be inserted on the basis of MyPlotModel.

    I have had some success in using Convert. ChangeType () I manage to change the type of CastedModel to the right type, but I can not manage to convert the value of Castedodal to MyPlotModel.

    This is what I have done:

      convert.Change type (Castemodel, Myoplot.Model.Gettype ()); CastedModel = MyPlotModel;  

    But MyPlotModel is still recognized as an interface even though it has been started as a PlotModel.

    Thanks in advance, Alexander.

    It looks like you should use the normal range:

      Public class examples & lt; TPlotModel & gt; Where TPlotModel: IPlotModel, new () {public TPlotModel PlotModel {get; Private set; } Public Example () {this.PlotModel = New TPlotModel (); }}  

    that you can instantiate and use

      var myExample = new example & lt; MyPlotModel & gt; (); MyPlotModel foo = myExample.PlotModel;  

    access token - On WSO2 Implicit flow failing but works for Authorization flow -


    Opening I started learning OpenID Connect. This is a comprehensive learning curve. I am working with WSO 2 for months as my identity server. The identity of the theoretical has also been used with 3 servers, which is a C # based open solution, I have installed a Microsoft client in C # and it works very well with the authorization code grant ("authorization") on WSO2. Then I set the implicit code flow grant ("Implicit"). Access_token looks good again. I have removed it from the javascript page from the "hash" section. However, when I try to use it as a barerer token in the authorization header of the full request for claims, it throws the following error as a response.

    Status code: 500, Regency: 'Internal server error', version: 1.1, content: system. met. Hpp Stream Content, Header:


    : Accept-Encoding
    Connection: Close Date: Mon, 16 Mar 2015 13:14:47 GMT
    Server: WSO2 Server: Carbon Server : Server content-length: 6068 content-type: text / html; Charset = utf-8
    }

    It seems that access_token is incorrect from Implicit.

    If I transpose a copy of access_code from the execution of an authorization execution, in the form of a string, any ideas that it works perfectly will be welcomed.
    I have the authority for authorization and transplantation for both

    Any ideas will be useful.


    How matched tags percentage can be calculated in mysql with php -


    I have 3 tables, the first one is a playlist, there are two other keywords and keywordmaps.

    To use the SQL below to search for the playlist that I share the normal tag I need to get my tag and order in mysql + php even if i I can match the tag count, then I can calculate the percent in php later.

    Tables are; Order playlist, keyword, keyword map

      | Pid | Authorid | Totaltrack | | Baby Words | Experiment | Created | | Kimid | KVID | Plidd |  

    Previous code;

      SELECT p1.pid keywordmap left from the playlist p1 ON kimi.plld = p1.pid where (p2 left from the playlist p2 selected for pdp, the keyword mapps p2 at km2 Pid = km2.plid LEFT JOIN Keywords kws at km2.kwid = kws.kid WHERE p2.pid = 10) plidded by group  

    are desired results;

      | Plid | MatedTag | Percentage | 234 | 23 65 | 363 | 21 | 55 | 19. 18 | 34 91 | 1 | 3  

    So here's the answer. Remaining percentage calculation based on user's total tag count

      select p1.pid, match as COUNT (plid), p1.authorid keymap km to the left Playlist p1 ON km.plD = P1 .pad where in queue ( Connect with selective quiddet from PDP to playlists Keywordsmap2p2.pid = km2.plid on km2 left keyword kws km2.kwid = kws.kid WHERE p2.pid = $ pid) DESC matched by plaid order by group  

    Posting a foreign key using ASP.NET MVC and JQuery autocomplete? -


    I want to know the best practice for posting a foreign key.

    I have this model.

    Public Sector Country {Public Entry ID (Received); Set;} public int details {get; Set;}} Public Class City {Public Entity ID}; Set;} public string description {get; Set;} get public country country; Now in my city, I have to be a dropdown which will not load all the countries in the first load, but I want to do some sort of thing after self-completion, I have seen the method of JQuery to complete it, but I do not know how it is binding in my model.

    Can someone give me some advice?

    see

    You need to provide a view in a text box, such as :

      @ Html.TextBoxFor (m => m.ountry.Id, new {id = "CountryId"})  

    before I'm going any further, I agree that your description attribute probably means name , and in the English language, description Meaning of name is a bit misleading.

    Use of JQuery

    You will need to do two things, first of all, you want to attach completely to your text box:

     < Code> $ ('# Country ID'). Autocomplete ({source: function (request, feedback) {$ .get ('@ GetCountries, "" MyController "), {word: request.term}, function (data) {response ($ .max (data, function (Item) {return {label: item label, value: item.Value}});});}, minlanta: 2})  

    response Function is an autocomplete callback that does a few things.

    This approach works when you have an AutoComplete, but if your page has more than one autocomplete or onlyIf you want to write script, then add it to autocomplete on each input:

      @ Html.TextBoxFor (M => m.Description, new {data-autocomplete- Url = @ Url.Action ("GetCountries", "MyController"})  

    Use of this JQuery:

    $ ('* [Data-Automatic : Full-url] ') .ech (function () {$ (this). Autocomplete ({source: function (request, response) {$ .get ($ (this) .data ("autocomplete-url") Finally, the verb method in your controller is:
       

    Public JsonResult Ge TCities (string word) {var item = reference.committee. Where (x => x.Description.Contains (term)). Select (x = & gt; nEw {label = x.Id, value = x.Description}). Take (10); Jason comes back (item, Jason.}

    where reference is your repository in your case I thought it was a unit framework DbContext < / Code>. . Take () method determines how many values ​​are sent back to the client, keeping this number low can help in response to Jet when auto-complete , But will not return large results sets for short search terms. / P>

    As Have been told, you name verbose to your Verbols should try to make it.


    php - Associative array always returns only 4 result -


    You want to create an associative array for the bottom of the High Query query:

      $ sql = select "s. *, di.dealsimage, ctm.city, l.location, ordered by group_concat (different cm.cuisine scr.cuisine_sequence_for_store) as Cui, group_concat (dISTINCT rtm.restaurant_type order) by srr.rest_type_sequence_for_store stores s.store_id joining s left places left to be as restauranttype include city_master ctm on s.city_id = ctm.city_id L s.location_id = l.location_id left store_cuisine_relation scr = scr.store_id left lamp Joining cuisine_master cm join in on the left scr.cuisine_id = cm.cuisine_id at Sarar join store_resttype_relation include RTM on s.store_id = srr.store_id Arkti.amk Restran_prop_mastr rtm.rest_type_id = srr. rest_type_id left left dcm.deal_cat_id = sdr.deal_cat_id upon by left di.`store_id` = s.store_id which include deals_image di at $ CONDITION1 s.is_active = 1 $ CONDITION2 group s.store_id = sdr.store_id deals_category_master DCM When joining store_dealcat_relation joining the SDR (S.store_id) come by s.store_id Country; "; // echo $ sql; exit; // echo $ sql; exit; $ Sqlex1 = mysqli_query ($ db, $ sql); $ Custom_count = @ mysqli_num_rows ($ sqlex1); // print 28 while ($ result1 = mysqli_fetch_assoc ($ sqlex1)) {$ dataArr = array_push_assoc ($ dataArr, 'store_id', $ result1 [ 'store_id']); $ Detaare = array_push_assoc ($ Detaar, 'store_name', $ result1 [ 'store_name']); $ Detaare = Array_push_assoc ($ Detaar, 'store_logo', $ result1 [ 'store_image_url']); $ Detaaarar = Aarar_pshu_sak ($ ​​Detaar "Sudon_imej, $ results [1 'deals Month']);} // echo count ($ Datair); exit; // echo $ kl; exit; // $ result = array_merge_recursive ($ gpsArr, $ dataArr); function array_push_asso Query ($ array, $ key, $ value) {$ array [$ key] [] = $ value; $ array return;}  

    query returns 28 results, but when I < code> $ dataArr that count to the resonant / it says it is always wrong to print 4? how it can be achieved? thanks in advance

    its function array_push_assoc () make creates an array with 4 key store_id , store_name, store_logo , and deals_image`, and each The key has 28 rows

    Try it out:

      dataArr = array (); While ($ result1 = mysqli_fetch_assoc ($ sqlex1)) {$ dataArr [] = array ( 'store_id' = & gt; $ result1 [ 'store_id'], 'STORE_NAME' = & gt; $ result1 [ 'STORE_NAME'], ' store_logo '= & Gt; $ results [1' Store_image_url '],' Sudon_imej '= & gt; $ results [1' deals Month ']); }  

    This will create an array with 28 associate arrays


    hadoop - Killing an Oozie workflow from java -


    So I'm playing with the OZI Java API, as long as I can not stop the following problem. When trying to run the following Java code:

      OozieClient oc = new OozieClient (OOZIE_URL); Properties Conf = oc.create Configuration (); Conf.setProperty (OozieClient.APP_PATH, PATH_TO_WF); String job id = oc.run (conf); While (oakbybinfo (johid) .getStatus () == Workfljob.stats.prep) {Thread.Sleep (1000); } Oc.kill (JobID);  

    This fails with the following exception:

      E0508: User [?] Is not authorized for the WF job [JOB_ID_GOES_HERE]  

    I have been able to find some related issues on Google, however the people who saw me were only related to the command line OOZI client.

    My main question is that you can run Oozie workflow just by adding another user as Java:

      conf.setProperty ("user.name", "user123 ");  

    Is there anything that can be done with killing the workflow?

    Use AuthOozieClient and set system user.

    OozieClient oc = New AuthOozieClient (OOZIE_URL); System.setProperty ("user.name", userName); Client.kill (jobId);

    Build child model after saving parent in jquery rails -


    In my train app, I have a nested model and I would like to create a child model after parent's creation and this original Like to do this in the 'edit' view of the model. I am using jquery for parent model.

    parent controller

      def can create studio = student.new (student_perm) if the student @dd #### is to make a child model like # here # Student.student_grades.build response_to do | Format | Format.js {render 'edit'} and finally answer. Format.js {Render 'New'} End And End  

    Unfortunately the above code is not working. I also have a build line in the edit but it does not help because the rendering goes directly to the scene

    Update The problem was not the code above, but the code in the view was the code. Thank you for your help though.

    It's possible that just copy it and copy it, but you have a @studate in the second line Used an uppercase 's' on, but using a lowercase on line 3


    javascript - Overriding element.style -


    I am trying to create a responsive web page eg, where the display changes with the screen size

    I have the following HTML:

      & lt; Div class = "responsive_menu" id = "resp_Menu" onClick = "fnResponsiveMenu ()" & gt; & Lt; / Div & gt; & Lt; Div class = "nav_wrapper" & gt; & Lt; Div class = "navigation" id = "navMenu1" & gt; & Lt; A href = "Home.aspx" & gt; Contact us & lt; / A & gt; & Lt; / Div & gt; & Lt; Div class = "navigation" id = "navMenu2" & gt; & Lt; A href = "Home.aspx" & gt; Notification & lt; / A & gt; & Lt; / Div & gt; & Lt; Div class = "navigation" id = "navMenu3" & gt; & Lt; A href = "Home.aspx" & gt; Location details & lt; / A & gt; & Lt; / Div & gt; & Lt; Div class = "navigation" id = "navMenu4" & gt; & Lt; A href = "Home.aspx" & gt; Registration & amp; Payment & lt; / A & gt; & Lt; / Div & gt; & Lt; Div class = "navigation" id = "navMenu5" & gt; & Lt; A href = "Home.aspx" & gt; Agenda & lt; / A & gt; & Lt; / Div & gt; & Lt; Div class = "navigation" id = "navMenu6" & gt; & Lt; A href = "Home.aspx" & gt; Home & lt; / A & gt; & Lt; / Div & gt; & Lt; / Div & gt;  

    and the following in responsive.css:

     . Navigation {width: 100%; Background color: # 3171B7; Border bottom: 1px solid #ffffff; Margin: 0; Change text: uppercase; Font-size: 16px; Height: 40%; Cushion Top: 10px; display none; }  

    and style.css are the following:

      .navigation {float: right; Margin: 30px 0px 1px 0px; Height: 25px; Width: 100px; Display area; }. Navigation A {font-family: Ariel, Helvetica, Sense-Serif; Font-size: 14px; Color: #FFFFFF; Text-decoration: None; Display area; Padding: 0 5px; Height: 30px; }  

    and the following JavaScript:

      var oNavChecker = 0; Function fnResponsiveMenu () {if (oNavChecker == 0) {var oNav1 = document.getElementById ("navMenu1"); ONav1.setAttribute ('style', 'display: inline'); Var oNav2 = document.getElementById ("navMenu2"); ONav2.setAttribute ('style', 'display: inline'); Var oNav3 = document.getElementById ("navMenu3"); ONav3.setAttribute ('style', 'display: inline'); Var oNav4 = document.getElementById ("navMenu4"); ONav4.setAttribute ('style', 'display: inline'); Var oNav5 = document.getElementById ("navMenu5"); ONav5.setAttribute ('style', 'display: inline'); Var oNav6 = document.getElementById ("navMenu6"); ONav6.setAttribute ('style', 'display: inline'); ONavChecker = 1; Return; } If (onchachar == 1) {var oNav1 = document.getElementById ("navMenu1"); ONav1.setAttribute ('style', 'display: none'); Var oNav2 = document.getElementById ("navMenu2"); ONav2.setAttribute ('style', 'display: none'); Var oNav3 = document.getElementById ("navMenu3"); ONav3.setAttribute ('style', 'display: none'); Var oNav4 = document.getElementById ("navMenu4"); ONav4.setAttribute ('style', 'display: none'); Var oNav5 = document.getElementById ("navMenu5"); ONav5.setAttribute ('style', 'display: none'); Var oNav6 = document.getElementById ("navMenu6"); ONav6.setAttribute ('style', 'display: none'); Onchaker = 0; Return; }}  

    All this works well and works as I want.

    My problem is, after the screen is diminished, and then pressed the menu button like <

    then pressed to show the menu for the first time

    Then pressed again to remove it

    Then return to the screen

    Detailed resolution,

    Nowmen will not show anymore.

    I am sure that this is because CSS is being eliminated by javascript eg:

      ONav1.setAttribute ('style', 'display: none ');  

    So how can I solve it and get the style. CSS to override changes implemented by JavaScript?

    If this is not possible, then no alternative might be to get your purpose of making responsive menus?

    I can not comment, enought is not representative, so I will ask it in reply ... < / P>

    Have you read this?

    Once you remove the inline style, the default from your CSS file will be applied again.


    vsts - OpsHub VSOnline Migration Utility failed: Cannot create configuration - Error occured while fetching metdata for Test Suite -


    ophb-014764: The metadata field can not be brought to the destination, the underlying cause: OH- TFS-Connector-0051: Operation Failed Collection Server Error: There was an error fetching metadata for the test suite

    I have been migrating various projects over the past few days . A project is giving me the following error with the last step of "last" during the migration configuration creation process:

      2015-03-16 14: 07: 06958 [1] Error com .opshub .eai.mapper.server.OIMMapper Expression: ophb-014764: Field metadata can not be used for the destination, the underlying cause: OH-TFS-Connector-0051: Operation failed FilledCollection Server Error: Error occurred while doing test suite Difficulty obtaining metadata for: Microsoft.TeamFoundation.Client.Channels.TfsHttpClient On Base.HandleReply (TfsClientOperation operation, TfsMessage message, [] & amp object; Output) (ResultsStoreQuery query Microsoft.TeamFoundation.TestManagement.Client.TestManagementWebService4.QueryTestPlans) on com.opshub.tfs.test.TFSTestSuiteClient.getFieldCollection f Microsoft .TeamFoundation.TestManagement.Client.TestPlanHelper.Query (string queryText) (string EntityName, string ProjectName) on: \ blessing Docs \ Checkout \ OVSMU branch \ OpsHubV2 \ TFSWCFServiceSource \ Service \ Service \ TFSTestSuiteUtility.cs: the line 631 team Project Dash not found. System.ServiceModel.FaultException: com.opshub.eai.mapper.server.OIMMapperException: OpsHub-014,764: Could not be brought farms metadata for the destination, the underlying cause: Oh- TFS- connector -0051: Operation failed getFiledCollection. Server Error: The difficulty in obtaining metdata for Error Test Suite: on Microsoft.TeamFoundation.Client.Channels.TfsHttpClientBase.HandleReply (TfsClientOperation operation, TfsMessage message, [] & amp object; output) Microsoft.TeamFoundation.TestManagement. on Client.TestManagementWebService4.QueryTestPlans (ResultsStoreQuery query) on Microsoft.TeamFoundation.TestManagement.Client.TestPlanHelper.Query (string queryText) (string EntityName, string ProjectName) on com.opshub.tfs.test.TFSTestSuiteClient.getFieldCollection f: \ blessing Docs \ checkout \ OVSMU branch \ OpsHubV2 \ TFSWCFServiceSource \ Service \ Service \ TFSTestSuiteUtility.cs: Reason for line 631: T I did not get project dash. Server stack trace: System.ServiceModel.Channels.ServiceChannel.HandleReply (ProxyOperationRuntime operation, ProxyRpc & amp; RPC) on System.ServiceModel.Channels.ServiceChannel.Call (String action, Boolean oneway, ProxyOperationRuntime operation, Object [] in System [Service] will be available in the system. System service channel in channel.Channel.ServiceCranel Proxy.InvocService (IIME column message call, Proxy Operation Runtimem operation) on System.Service Model.Channel.ServiceCranel ProxyInvoK (IMSEZ Message) Adad was restored to [0]: TFSMigrationUI.ViewModel.MigrationSummeryViewModel.Create: ConfigWorker_Roucher (Object Sender, Runwalker, Component Avent EG) E: \ OVSMUBranch \ TFSMigrationUI \ ViewModel \ MigrationSummeryViewModel.cs: On Win6.6635 on System K line. MS2.In.InternalRealCall.ExceptionWrapper.InternalRealCall (representatives callback object Arges, Int32 numArgs) MS.Internal.Threading .ExceptionFilterHelper.TryCatchWhen (object source, representative method, object Arges, Int32 numArgs, representatives of Holandr)  

    my Have no clue where to start?

    The above error is not wide enough to see where the problem lies. It seemed like something with the test items related to the test.

    Visual Studio Team Services team was something wrong with the construction of the project (but the report did not errors).

    VS after removal team service project, and an empty project went to resolve the issue of up to rebuild.

    I hope it does help someone.


    ip - How can I send a simple HTTP request with a lwIP stack? -



    ip - How can I send a simple HTTP request with a lwIP stack? -

    please move/close if question isn't relevant.

    core: cortex-m4

    microprocessor: ti tm4c1294ncpdt.

    ip stack: lwip 1.4.1

    i using microprocessor info logging, , want send info separate web server via http request in form of:

    http://123.456.789.012:8800/process.php?data1=foo&data2=bar&time=1234568789

    and want processor able see response header (i.e if 200 ok or went wrong) - not have display/recieve actual content.

    lwip has http server microprocessor, i'm after opposite (microprocessor client).

    i not sure how packets correlate request/response headers, i'm not sure how i'm meant send/recieve information.

    this ended beingness pretty simple implement, forgot update question.

    i pretty much followed instructions given on this site, raw/tcp 'documentation'.

    basically, http request encoded in tcp packets, send info php server, sent http request using tcp packets (lwip work).

    the http packet want send looks this:

    head /process.php?data1=12&data2=5 http/1.0

    host: mywebsite.com

    to "translate" text understood http server, have add together "\r\n" carriage return/newline in code. looks this:

    char *string = "head /process.php?data1=12&data2=5 http/1.0\r\nhost: mywebsite.com\r\n\r\n ";

    note end has 2 lots of "\r\n"

    you can utilize or head, because didn't care html site php server returned, used head (it returns 200 ok on success, or different code on failure).

    the lwip raw/tcp works on callbacks. set callback functions, force info want tcp buffer (in case, tcp string specified above), , tell lwip send packet.

    function set tcp connection (this function straight called application every time want send tcp packet):

    void tcp_setup(void) { uint32_t info = 0xdeadbeef; /* create ip */ struct ip_addr ip; ip4_addr(&ip, 110,777,888,999); //ip of php server /* create command block */ testpcb = tcp_new(); //testpcb global struct tcp_pcb // defined lwip /* dummy info pass callbacks*/ tcp_arg(testpcb, &data); /* register callbacks pcb */ tcp_err(testpcb, tcperrorhandler); tcp_recv(testpcb, tcprecvcallback); tcp_sent(testpcb, tcpsendcallback); /* connect */ tcp_connect(testpcb, &ip, 80, connectcallback); }

    once connection php server established, 'connectcallback' function called lwip:

    /* connection established callback, err unused , homecoming 0 */ err_t connectcallback(void *arg, struct tcp_pcb *tpcb, err_t err) { uartprintf("connection established.\n"); uartprintf("now sending packet\n"); tcp_send_packet(); homecoming 0; }

    this function calls actual function tcp_send_packet() sends http request, follows:

    uint32_t tcp_send_packet(void) { char *string = "head /process.php?data1=12&data2=5 http/1.0\r\nhost: mywebsite.com\r\n\r\n "; uint32_t len = strlen(string); /* force buffer */ error = tcp_write(testpcb, string, strlen(string), tcp_write_flag_copy); if (error) { uartprintf("error: code: %d (tcp_send_packet :: tcp_write)\n", error); homecoming 1; } /* send */ error = tcp_output(testpcb); if (error) { uartprintf("error: code: %d (tcp_send_packet :: tcp_output)\n", error); homecoming 1; } homecoming 0; }

    once tcp packet has been sent (this need if want "hope best" , don't care if info sent), php server homecoming tcp packet (with 200 ok, etc. , html code if used instead of head). code can read , verified in next code:

    err_t tcprecvcallback(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err) { uartprintf("data recieved.\n"); if (p == null) { uartprintf("the remote host closed connection.\n"); uartprintf("now i'm closing connection.\n"); tcp_close_con(); homecoming err_abrt; } else { uartprintf("number of pbufs %d\n", pbuf_clen(p)); uartprintf("contents of pbuf %s\n", (char *)p->payload); } homecoming 0; }

    p->payload contains actual "200 ok", etc. information. helps someone.

    i have left out error checking in code above simplify answer.

    http ip embedded packet lwip

    python - List Comprehension for 2-D arrays -



    python - List Comprehension for 2-D arrays -

    i have generate 2-d array list comprehension. 1 way accomplish follows

    size=6 [[0] * size x in range(0, size)]

    however variable x unused here. there way accomplish this? don't want utilize external libraries.

    python allows utilize _ variable name. it's pythonic utilize name unused variables:

    [[0] * size _ in range(0, size)]

    python

    Elasticsearch shard allocation -



    Elasticsearch shard allocation -

    i have 1 es cluster 3 nodes, 1 index, 3 shards , 2 replica per shard.

    for reason, primary shards located on same node:

    node 1: replica 0, replica 1, replica 2 node 2: replica 0, replica 1, replica 2 node 3: primary 0, primary 1, primary 2.

    what should rebalance shards? want have 1 primary shard per 1 node, example:

    node 1: primary 0, replica 1, replica 2 node 2: replica 0, primary 1, replica 2 node 3: replica 0, replica 1, primary 2.

    elasticsearch

    c - Faster than rand()? -



    c - Faster than rand()? -

    i'm working on algorithm needs generate millions of numbers fast possible. found out rand() function of algorithm takes 75% of process time.

    so i'm looking faster. , don't need big range @ all. (i need integer numbers below 1000)

    do know utilize ?

    thanks !

    edit :

    i utilize numbers shuffling groups of less 1000 entities.

    i found out more "fast rand". , there sse version version faster , generates 4 numbers @ time.

    https://software.intel.com/en-us/articles/fast-random-number-generator-on-the-intel-pentiumr-4-processor/

    static unsigned int g_seed; //used seed generator. inline void fast_srand( int seed ) { g_seed = seed; } //fastrand routine returns 1 integer, similar output value range c lib. inline int fastrand() { g_seed = (214013*g_seed+2531011); homecoming (g_seed>>16)&0x7fff; }

    c random

    asp.net - How do I trigger a button click during page_load? -



    asp.net - How do I trigger a button click during page_load? -

    i have few buttons created while loop , stored within placeholder, when created have commandarguments equal unique fields single column of database. when clicked, button's click procedure retrieves info database using button's commandargument determine info display.

    my problem when page loads, want first of these buttons selected default , onclick event triggered. there way within if not page.ispostback, or have resort javascript/jquery?

    here's code far:

    <!doctype html> <%@ page language="vb" debug="true" clienttarget="uplevel" %> <%@ import namespace="system.data.oledb" %> <%@ import namespace="system.data" %> <script runat="server"> dim dbconnection oledbconnection dim dbcommand oledbcommand dim dbreader oledbdatareader dim sqlstring string sub page_load() seek dbconnection = new oledbconnection("provider=microsoft.ace.oledb.12.0;data source=" & server.mappath("mydatabase.accdb")) dbconnection.open() sqlstring = "select distinct type mytable" dbcommand = new oledbcommand(sqlstring, dbconnection) dbreader = dbcommand.executereader() while dbreader.read() dim mybutton button = new button() mybutton.id = dbreader("column2") mybutton.text = dbreader("column2") mybutton.commandargument = dbreader("column2") mybutton.enableviewstate = false addhandler mybutton.command, addressof myclicksub myplaceholder.controls.add(mybutton) end while dbreader.close() dbconnection.close() end seek end sub sub myclicksub(src object, args commandeventargs) seek dbconnection.open() sqlstring = "select * mytable column2 = '" & args.commandargument & "'" dbcommand.commandtext = sqlstring dbreader = dbcommand.executereader() myrepeater.datasource = dbreader myrepeater.databind() dbreader.close() dbconnection.close() end seek end sub </script> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>my page</title> </head> <body> <form runat="server"> <div> <asp:placeholder id="myplaceholder" runat="server" /> <br /> <asp:repeater id="myrepeater" runat="server"> <headertemplate> <table> <tr> <th scope="col">id</th> <th scope="col">foo</th> <th scope="col">bar</th> </tr> </headertemplate> <itemtemplate> <tr> <td><%# eval("column1")%></td> <td><%# eval("column3")%></td> <td><%# eval("column4")%></td> </tr> </itemtemplate> <footertemplate> </table> </footertemplate> </asp:repeater> </div> </form> </body> </html>

    i want first of these buttons selected default

    technically want first record display default. separate concern clicking of button. separate own function:

    sub bindrepeater(byval column2 string) seek dbconnection.open() sqlstring = "select * mytable column2 = '" & column2 & "'" dbcommand.commandtext = sqlstring dbreader = dbcommand.executereader() myrepeater.datasource = dbreader myrepeater.databind() dbreader.close() dbconnection.close() end seek end sub

    then in click handler:

    sub myclicksub(src object, args commandeventargs) bindrepeater(args.commandargument) end sub

    now can phone call same function page_load:

    if not page.ispostback bindrepeater(somevalue) end if

    (where somevalue you. imagine it's first record in info source?)

    also, , this important, info access code wide open sql injection attacks. you'll really want utilize parameterized queries instead.

    asp.net

    ios - Is there an easy way to find all dependencies of a framework? -



    ios - Is there an easy way to find all dependencies of a framework? -

    while writing extensions in swift / categories in objective-c have decide on structured way organize them in xcode project. thought thought take dependencies of different apple frameworks account.

    let's illustration @ mkmapview class of mapkit framework. has property centercoordinate has type cllocationcoordinate2d. , cllocationcoordinate2d belongs corelocation framework. thus mapkit framework depends on corelocation framework.

    (see https://developer.apple.com/library/ios/documentation/mapkit/reference/mkmapview_class/index.html#//apple_ref/occ/instp/mkmapview/centercoordinate)

    i know can browse corresponding header files gather info i'm looking for. quite tedious.

    is there somewhere overview of dependencies of apple frameworks come ios / macos sdks? or more convenient way determine them?

    running otool (i cannot find official manpage) -l alternative on framework binary should give dependencies:

    $ otool -l /path/to/abc.framework/versions/current/abc

    ios xcode osx apple

    python - Replace substrings with elements of a list of tuples -



    python - Replace substrings with elements of a list of tuples -

    i have string such:

    string = """ foobar_tent\n missyamica_ole """

    this list of tuples have:

    t = [("foo","virtue"), ("ole, "allo")]

    i'm trying replace every instance of first element of each tuple sec element of each tuple. result this:

    newstring = """ virtuebar_tent missyamica_allo """"

    i tried doing such, doesn't alter anything.

    newstring = "" a,b in t: newstring = string.replace(a,b)

    you right. main issue doing string.replace each time lastly of replacements in list have worked.

    newstring = string a,b in t: newstring = newstring.replace(a,b)

    python replace tuples

    ios - UITableView from storyboard - init with UITableViewStyleGrouped -



    ios - UITableView from storyboard - init with UITableViewStyleGrouped -

    how initialize uitableviewcontroller have uitableviewstylegrouped when created in storyboard? create grouped table view this:

    - (id)initwithstyle:(uitableviewstyle)style { self = [super initwithstyle: uitableviewstylegrouped]; if (self) { } homecoming self; }

    but realized function not run when create uitableviewcontroller in storyboard. , not see alternative in storyboard set style grouped.

    below screenshot showing alternative set group don't forget select tableview in storyboard.

    ios uitableview storyboard grouped-table initwithstyle

    php - show two or more links to the auto-write files from data in database -



    php - show two or more links to the auto-write files from data in database -

    i learning how auto write new file info in database. , follow tutorial: http://www.9lessons.info/2011/04/seo-friendly-urls-with-php.html

    the tutorial give me want achieve. posted new post database file of publish.php, link of new post/file have posted seen in top of form. auto rewrite url got file of article.php.

    it form:

    <input type="text" name "title"/> <textarea name="body"></teaxtarea> <?php include('db.php'); function string_limit_words($string, $word_limit) { $words = explode(' ', $string); homecoming implode(' ', array_slice($words, 0, $word_limit)); } $blog=''; if($_server["request_method"] == "post") { $title=mysql_real_escape_string($_post['title']); $body=mysql_real_escape_string($_post['body']); $title=htmlentities($title); $body=htmlentities($body); $date=date("y/m/d"); $newtitle=string_limit_words($title, 6); $urltitle=preg_replace('/[^a-z0-9]/i',' ', $newtitle); $newurltitle=str_replace(" ","-",$newtitle); $url=$date.'/'.$newurltitle.'.html'; mysql_query("insert blog(title,body,url) values('$title','$body','$url')"); $blogurl="http://seo.website.com/$url"; } ?>

    blow link new posted file.

    <h2><a href="<?php echo $blogurl; ?>"><?php echo $blogurl; ?></a></h2>

    what want know @ time is, how show links of data/file have posted database.

    i have tried re-create paste line above this:

    <h2><a href="<?php echo $blogurl; ?>"><?php echo $blogurl; ?></a></h2> <h2><a href="<?php echo $blogurl; ?>"><?php echo $blogurl; ?></a></h2>

    however show same 2 links of 1 file info in database, while want shows different link of 2 files, instance: first link show file number 1, , sec link show file number 2 info in database.

    please don't focus database driver of mysql use, still want larn stage.

    .. if understand question correctly - need values , loop through each one. in question looks echoing same values repeatedly.

    (pcode) $query = "select * blog"; $ret = $pdo->do( $query ); $blogurl="http://seo.website.com/"; foreach( $ret $row ) { echo "<h2><a href=" . $blogurl . $row->url . ">" . $row->title . "</a></h2>"; }

    php mysql

    oracle - ORA-00936: missing expression, although there seems to be no missing expression (SQL) -



    oracle - ORA-00936: missing expression, although there seems to be no missing expression (SQL) -

    i'm attempting calculate ratio of 2 sums, 1 of has where clause, decided utilize subqueries:

    select round(100.0*credit.luotot/all.kaikki) cpros (select sum(ordered.totalprice) kaikki ordered) all, (select sum(ordered.totalprice) luotot ordered ordered.paymentby = 'credit') credit

    however, running query throws

    ora-00936: missing look

    and don't understand why.

    all reserved word in oracle. should utilize name isn't, such all_ordered:

    select round(100.0*credit.luotot/all_ordered.kaikki) cpros (select sum(ordered.totalprice) kaikki ordered) all_ordered, (select sum(ordered.totalprice) luotot ordered ordered.paymentby = 'credit') credit

    edit: btw, can accomplish desired result case look won't need utilize subqueries:

    select round(100.0 * sum(totalprice) / sum(case paymentby when 'credit' totalprice else 0 end) cpros ordered

    sql oracle

    c# - Entity Framework Code First 6 - Invalid Operation Exception when i put entity state ? Posible EF Bug? -



    c# - Entity Framework Code First 6 - Invalid Operation Exception when i put entity state ? Posible EF Bug? -

    i have problem entity framework code first 6 working disconnected. problem occurs when want mark entity modified, entity has association properties loaded new instance of dbcontext, more precise source of nail , save.

    public list<venta> get(expression<func<venta, bool>> predicate) { seek { int num = 0; list<venta> ventas = new list<venta>(); using (_context = new mycontext(mycontext.getconnectionstring())) { if (predicate == null) ventas = _context.ventas.include("mesa").include("usuario").include("pago").tolist(); else ventas = _context.ventas.include("mesa").include("usuario").include("pago").where(predicate).tolist(); } //i utilize other repo load related entities usuariorepository userrepo = new usuariorepository(); foreach (venta item in ventas) { item.gettype().getproperty("usuario").setvalue(item, userrepo.get(u => u.id == item.usuarioid).first(), null); } //i utilize other repo load related entities productorepository prodrepo = new productorepository(); foreach (ventaproducto item in ventas.selectmany(vta => vta.detalle).tolist()) { producto p = prodrepo.get(prod => item.productoid == prod.id).first(); item.gettype().getproperty("producto").setvalue(item, p, null); } ventas.foreach(vta => vta.state = domainentitystate.unchanged); homecoming ventas; } grab (exception ex) { throw new exception("error al traer las ventas", ex); } } public override int save(venta venta) { int saves = 0; entitystate state; entitystate stateproducto; //new instance of context without entities in dbset's using (mycontext context = new mycontext(mycontext.getconnectionstring())) { seek { if (venta.isnewentity) //venta nueva { state = entitystate.added; stateproducto = entitystate.modified; } else { state = entitystate.modified; stateproducto = entitystate.modified; } //int usuarios = context.usuarios.local.count; //i 0 //int productos = context.productos.local.count; //i 0 //int ventasproductos = context.ventasproducto.local.count; // 0 venta.usuario = null; if (venta.pago != null) venta.pago.usuario = null; if (venta.pago != null) { entitystate estadopago = context.getentitystate(venta.pago); } //here problem context.setentitystate(venta, state); saves = context.savechanges(); } grab (exception ex) { throw new exception("error al grabar la venta", ex); } } homecoming saves; }

    finally next error ....

    attaching entity of type 'jackie.domain.entities.usuario' failed because entity of same type has same primary key value. can happen when using 'attach' method or setting state of entity 'unchanged' or 'modified' if entities in graph have conflicting key values. may because entities new , have not yet received database-generated key values. in case utilize 'add' method or 'added' entity state track graph , set state of non-new entities 'unchanged' or 'modified' appropriate.

    the unusual if load entities same instance of context not have problem. bug? no longer think of more. give thanks all. made google translator.

    there (at least) 2 usuario properties in object graph - venta.usuario , venta.pago.usuario. attaching venta entity, entity objects in these 2 usuario properties attached unmodified. if these 2 properties hold 2 different instances of usuario class same pk value, when sec attached throw error received. seems quite possible you're loading navigation properties via different instances of context eager loading thrown mix.

    break @ phone call context.setentitystate(venta, state) , see if 2 usuario objects same instance or 2 different instances same pk value(s).

    c# entity-framework ef-code-first code-first

    for loop - data.put() throws IndexOutOfBoundsException -



    for loop - data.put() throws IndexOutOfBoundsException -

    so have code input order , cost specified number of items public class setmenu0 {

    private double price; private int size; private string output; private string priceoutput; arraylist orderlist = new arraylist<string>(); arraylist pricelist = new arraylist<double>(); public setmenu0() { scanner input = new scanner(system.in); system.out.print("enter new order?(y)(n): "); string init = input.nextline(); if(init.equalsignorecase("y")) { system.out.print("enter number of orders: "); size = input.nextint(); for(int = 0; i<=size; i++) { i++; system.out.print("enter order: "); orderlist.add(input.next()); system.out.print("enter price: "); pricelist.add(input.nextdouble()); } } } public arraylist getord() { homecoming orderlist; } public arraylist getpri() { homecoming pricelist; } public int getsize() { homecoming size; }

    }

    now when utilize treemap indexoutofboundsexception here public static void main(string[] args) { //blank workbook xssfworkbook workbook = new xssfworkbook();

    //create blank sheet xssfsheet sheet = workbook.createsheet("food"); setmenu0 set = new setmenu0(); arraylist orderlist = set.getord(); arraylist pricelist = set.getpri(); int size = orderlist.size(); map<string, object[]> info = new treemap<string, object[]>(); data.put("1", new object[]{"order", "price"}); try{ for(int i=0; i<size; i++) { int in = i+2; string linenum = ""+in; data.put(linenum, new object[]{orderlist.get(i), pricelist.get(i)}); } } catch(indexoutofboundsexception e) { system.out.print("problem"); }

    the exception happens when set size 3 upwards.

    your problem might in bit:

    for(int = 0; i<=size; i++) { i++; system.out.print("enter order: "); orderlist.add(input.next()); system.out.print("enter price: "); pricelist.add(input.nextdouble()); }

    try removing i++ loop body.

    for-loop map indexoutofboundsexception treemap