Search Results

Search found 1214 results on 49 pages for 'jack sparrow'.

Page 25/49 | < Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >

  • binding nested json object value to a form field

    - by Jack
    I am building a dynamic form to edit data in a json object. First, if something like this exists let me know. I would rather not build it but I have searched many times for a tool and have found only tree like structures that require entering quotes. I would be happy to treat all values as strings. This edit functionality is for end users so it needs to be easy an not intimidating. So far I have code that generates nested tables to represent a json object. For each value I display a form field. I would like to bind the form field to the associated nested json value. If I could store a reference to the json value I would build an array of references to each value in a json object tree. I have not found a way to do that with javascript. My last resort approach will be to traverse the table after edits are made. I would rather have dynamic updates but a single submit would be better than nothing. Any ideas? // the json in files nests only a few levels. Here is the format of a simple case, { "researcherid_id":{ "id_key":"researcherid_id", "description":"Use to retrieve bibliometric data", "url_template" :[ { "name": "Author Detail", "url": "http://www.researcherid.com/rid/${key}" } ] } } $.get('file.json',make_json_form); function make_json_form(response) { dataset = $.secureEvalJSON(response); // iterate through the object and generate form field for string values. } // Then after the form is edited I want to display the raw updated json (then I want to save it but that is for another thread) // now I iterate through the form and construct the json object // I would rather have the dataset object var updated on focus out after each edit. function show_json(form_id){ var r = {}; var el = document.getElementById(form_id); table_to_json(r,el,null); $('body').html(formattedJSON(r)); }

    Read the article

  • Constructor and Destructors in C++ [Not a question] [closed]

    - by Jack
    I am using gcc. Please tell me if I am wrong - Lets say I have two classes A & B class A { public: A(){cout<<"A constructor"<<endl;} ~A(){cout<<"A destructor"<<endl;} }; class B:public A { public: B(){cout<<"B constructor"<<endl;} ~B(){cout<<"B destructor"<<endl;} }; 1) The first line in B's constructor should be a call to A's constructor ( I assume compiler automatically inserts it). Also the last line in B's destructor will be a call to A's destructor (compiler does it again). Why was it built this way? 2) When I say A * a = new B(); compiler creates a new B object and checks to see if A is a base class of B and if it is it allows 'a' to point to the newly created object. I guess that is why we don't need any virtual constructors. ( with help from @Tyler McHenry , @Konrad Rudolph) 3) When I write delete a compiler sees that a is an object of type A so it calls A's destructor leading to a problem which is solved by making A's destructor virtual. As user - Little Bobby Tables pointed out to me all destructors have the same name destroy() in memory so we can implement virtual destructors and now the call is made to B's destructor and all is well in C++ land. Please comment.

    Read the article

  • How to implement dynamic queries for MNesia?

    - by Kerem
    I'm trying to implement a function that generates dynamic queries for MNesia. For example, when function is called with these arguments; dyn_query(list, person, [name, age], ["jack", 21]) I want to query MNesia to list items whose name is "jack" and age is 21 in person table. I've tried to implement this by using qlc:q(ListComprehension) and qlc:string_to_handle("ListComprehension"). First failed because of compile errors, compiler didn't let me to use functions instead of ListComprehentions and variables instead of record names like "Item#Table.Member". Second failed, because erl_eval couldn't handle records and throwed exceptions like {undefined_record, person}. Which method should I use? How could i solve these problems? Or should I use a different method? Thanks.

    Read the article

  • taglib with constants functionality?

    - by jack
    I need to use some constants in my JSP. Now I'd like to use this without using scriptlets. (and adding getters is not an option, it's an external jar) Using the search I've seen that some people put them in a map. However I've seen that there's a constants function in the unstandard taglib but that is a few years old and so far I haven't found a maven repository with it. So are there any other taglibs with this functionality?

    Read the article

  • Advanced search page for wordpress

    - by Mighty Jack
    I have a wordpress site thats related to laptops niche. So I have multiple categories like Display(10inch, 13inch, 15inch...), Processor(AMD, Intel), HDD(120GB, 320GB, 500GB...) etc. The usual search is not good. I want to create an advanced search page where user can select from options(drop downs/checkboxes) in these different cats and the corresponding search results are displayed. Any directions about this will be great help (plugins/themes/hacks).

    Read the article

  • ObjectDataSource Insert and Update methods error

    - by Jack
    I m developing asp.net 3.5 project. When I want to Insert with DetailsView this error occured: Error : ObjectDataSource 'ObjectDataSource2' could not find a non-generic method 'AddCity' that has parameters: CITY_NAME. <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" SelectMethod="GetCityByID" UpdateMethod="UpdateCity" InsertMethod="AddCity" TypeName="NOP_CRM.Lib.nop_cities" OldValuesParameterFormatString="original_{0}"> <SelectParameters> <asp:ControlParameter ControlID="GridView1" Name="cityid" PropertyName="SelectedValue" Type="Int32" DefaultValue="1" /> </SelectParameters> <UpdateParameters> <asp:Parameter Name="CITY_NAME" Type="String" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="CITY_NAME" Type="String" /> </InsertParameters> </asp:ObjectDataSource> ... public int AddCity(string cityname) { CITY_NAME = cityname; Insert(); return _CITY_ID; }

    Read the article

  • Match HTML tags in two strings using regex in Python

    - by jack
    I want to verify that the HTML tags present in a source string are also present in a target string. For example: >> source = '<em>Hello</em><label>What's your name</label>' >> verify_target(’<em>Hi</em><label>My name is Jim</label>') True >> verify_target('<label>My name is Jim</label><em>Hi</em>') True >> verify_target('<em>Hi<label>My name is Jim</label></em>') False

    Read the article

  • JavaScript (SVG drawing): Positioning x amount of points in an area

    - by Jack
    I'm using http://raphaeljs.com/ to try and draw multiple small circles. The problem I'm having is that the canvas has a fixed width, and if I want to draw, say, 1000 circles, they don't wrap onto a 'new line' (because you have to specify the xy position of each circle). E.g. I want this: .................................................. to look like this: ............................ ...................... At the moment I'm doing this: for ( var i = 0; i < 1000; i++ ) { var multiplier = i*3; if ( i <= 50 ) { paper.circle((2*multiplier),2,2); } else if ( i >= 51 && i <= 101 ) { paper.circle((2*multiplier) - 304,8,2); } else if ( i >= 152 && i <= 202 ) { paper.circle((2*multiplier) - 910,14,2); } } For reference: circle(x co-ord, y co-ord, radius) This is messy. I have to add an if statement for every new line I want. Must be a better way of doing it..?

    Read the article

  • Run a external program with specified max running time

    - by jack
    I want to execute an external program in each thread of a multi-threaded python program. Let's say max running time is set to 1 second. If started process completes within 1 second, main program capture its output for further processing. If it doesn't finishes in 1 second, main program just terminate it and start another new process. How to implement this?

    Read the article

  • Multithreading in PHP

    - by Jack
    I am working on windows. I am building a twitter application which periodically checks for new tweets as well as allows users to update their status. I have written separate PHP files for reading (reader.php) and writing tweets (writer.php). The only problem is how do I periodically read the tweets. There are a few ways which I can think of - 1) Use a time-based job scheduler (like Cron) to periodically run the reader.php. How do I do this? 2) Use multithreading to run both reader and writer.php and use a timer function in reader.php Suggestions?

    Read the article

  • I am trying to build a list of limitations of all graph algorithms

    - by Jack
    Single Source shortest Path Dijkstra's - directed and undirected - works only for positive edge weights - cycles ?? Bellman Ford - directed - no cycles should exist All source shortest path Floyd Warshall - no info Minimum Spanning Tree ( no info about edge weights or nature of graph or cycles) Kruskal's Prim's - undirected Baruvka's

    Read the article

  • Retrieve names by ratio of their occurance

    - by jjiffer
    Hello, I'm somewhat new to SQL queries, and I'm struggling with this particular problem. Let's say I have query that returns the following 3 records (kept to one column for simplicity): Tom Jack Tom And I want to have those results grouped by the name and also include the fraction (ratio) of the occurrence of that name out of the total records returned. So, the desired result would be (as two columns): Tom | 2/3 Jack | 1/3 How would I go about it? Determining the numerator is pretty easy (I can just use COUNT() and GROUP BY name), but I'm having trouble translating that into a ratio out of the total rows returned. Any help is much appreciated!

    Read the article

  • SDL_ttf and Numbers (int)

    - by jack moore
    int score = 0; char* fixedscore=(char*)score; . . . imgTxt = TTF_RenderText_Solid( font, fixedscore, fColor ); ^^ This doesn't work - looks like fixedscore is empty or doesn't exists. int score = 0; char* fixedscore=(char*)score; . . . imgTxt = TTF_RenderText_Solid( font, "Works fine", fColor ); ^^ Works fine, but... I guess converting int to char* doesn't really work. So how do you print scores in SDL? Oh and one more thing: why is the text so ugly? Any help would be appreciated. Thanks.

    Read the article

  • Sample twitter application

    - by Jack
    I have installed WAMP and running PHP scripts on localhost. I have enabled cURL. Here is my code. <?php function updateTwitter($status) { // Twitter login information $username = 'xxxxx'; $password = 'xxxxx'; // The url of the update function $url = 'http://twitter.com/statuses/update.xml'; // Arguments we are posting to Twitter $postargs = 'status='.urlencode($status); // Will store the response we get from Twitter $responseInfo=array(); // Initialize CURL $ch = curl_init($url); // Tell CURL we are doing a POST curl_setopt($ch, CURLOPT_PROXY,"localhost:80"); curl_setopt ($ch, CURLOPT_POST, true); // Give CURL the arguments in the POST curl_setopt ($ch, CURLOPT_POSTFIELDS, $postargs); // Set the username and password in the CURL call curl_setopt($ch, CURLOPT_USERPWD, $username.':'.$password); // Set some cur flags (not too important) curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_NOBODY, 0); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // execute the CURL call $response = curl_exec($ch); if($response === false) { echo 'Curl error: ' . curl_error($ch); } else { echo 'Operation completed without any errors<br/>'; } // Get information about the response $responseInfo=curl_getinfo($ch); // Close the CURL connection curl_close($ch); // Make sure we received a response from Twitter if(intval($responseInfo['http_code'])==200){ // Display the response from Twitter echo $response; }else{ // Something went wrong echo "Error: " . $responseInfo['http_code']; } curl_close($ch); } updateTwitter("Just finished a sweet tutorial on http://brandontreb.com"); ?> Here's my output Operation completed without any errors Error: 404 Here's what error 404 means 404 Not Found: The URI requested is invalid or the resource requested, such as a user, does not exists. Please help.

    Read the article

  • Adding metadata attributes to MySQL table

    - by Jack
    I would like to add custom attributes to a MySQL table which I can read via php. These attributes are not to interfere with the table itself - they are primarily accessed by php code during code generation time and these attributes HAVE to reside in the DB itself. Something similar in concept to .NET reflection. Does MySQL support anything like this? Thanks.

    Read the article

  • Setting variables in shell script by running commands

    - by rajya vardhan
    >cat /tmp/list1 john jack >cat /tmp/list2 smith taylor It is guaranteed that list1 and list2 will have equal number of lines. f(){ i=1 while read line do var1 = `sed -n '$ip' /tmp/list1` var2 = `sed -n '$ip' /tmp/list2` echo $i,$var1,$var2 i=`expr $i+1` echo $i,$var1,$var2 done < $INFILE } So output of f() should be: 1,john,smith 2,jack,taylor But getting 1,p,p 1+1,p,p If i replace following: var1 = `sed -n '$ip' /tmp/list1` var2 = `sed -n '$ip' /tmp/list2` with this: var1=`head -$i /tmp/vip_list|tail -1` var2=`head -$i /tmp/lb_list|tail -1` Then output: 1,john,smith 1,john,smith Not an expert of shell, so please excuse if sounds childish :)

    Read the article

  • C# XAML get new width and height for Canvas

    - by Jack Navarro
    I have searched through many times but have not seen this before. Probably really simple question but can't wrap my head around it. Wrote a VSTO add-in for Excel that draws a Grid dynamically. Then launches a new window and replaces the contents of the Canvas with the generated Grid. The problem is with printing. When I call the print procedure the canvas.height and canvas.width returned is the old value prior to replacing it with the grid. Sample: string="<Grid Name=\"CanvasGrid\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\">..Lots of stuff..</Grid>"; // Launch new window and replace the Canvas element WpfUserControl newWindow = new WpfUserControl(); newWindow.Show(); //To test MessageBox.Show(myCanvas.ActualWidth.ToString()); //return 894 Grid testGrid = myCanvas.FindName("CanvasGrid") as Grid; MessageBox.Show("Grid " + testGrid.ActualWidth.ToString()); //return 234 StringReader stringReader = new StringReader(LssAllcChrt); XmlReader xmlReader = XmlReader.Create(stringReader); Canvas myCanvas = newWindow.FindName("GrphCnvs") as Canvas; myCanvas.Children.Clear(); myCanvas.Children.Add((UIElement)XamlReader.Load(xmlReader)); //To test MessageBox.Show(myCanvas.ActualWidth.ToString()); //return 894 but should be much larger the Grid spans all three of my screens Grid testGrid = myCanvas.FindName("CanvasGrid") as Grid; MessageBox.Show("Grid " + testGrid.ActualWidth.ToString()); //return 234 but should be much larger the Grid spans all three of my screens //Run code from WpfUserControl.cs after it loads from button click Grid testGrid = canvas.FindName("CanvasGrid") as Grid; MessageBox.Show("Grid " + testGrid.ActualWidth.ToString()); //return 234 but should be much larger the Grid spans all three of my screens So basically I have no way of telling what my new width and height are Any Ideas

    Read the article

  • Django's logout function remove locale settings

    - by jack
    When I use Django's logout function to log out an authenticated user, it switched locale to en_US, the default one. from django.contrib.auth import logout def someview(request): logout(request) return HttpResponseRedirect('/') How to keep user's locale after logged out?

    Read the article

  • Wcf inhereted models

    - by jack london
    [DataContract] Base { [DataMember] public int Id {get;set;} } [DataContract] A : Base { [DataMember] public string Value {get;set;} } [ServiceContract] interface IService { [OperationContract] void SetValue (Base base); } is there a way to use the service like the following style: new Service ().SetValue (new A ());

    Read the article

  • How to set ReceiveBufferSize for UDPClient? or Does it make sense to set? C#

    - by Jack
    Hello all. I am implementing a UDP data transfer thing. I have several questions about UDP buffer. I am using UDPClient to do the UDP send / receive. and my broadband bandwidth is 150KB/s (bytes/s, not bps). I send out a 500B datagram out to 27 hosts 27 hosts send back 10KB datagram back if they receive. So, I should receive 27 responses, right? however, I only get averagely 8 - 12 instead. I then tried to reduce the size of the response down to 500B, yes, I receive all. A thought of mine is that if all 27 hosts send back 10KB response at almost same time, the incoming traffic will be 270KB/s (likely), that exceeds my incoming bandwidth so loss happens. Am I right? But I think even if the incoming traffic exceeds the bandwidth, is the Windows supposed to put the datagram in the buffer and wait for receive? I then suspect that maybe the ReceiveBufferSize of my UdpClient is too small? by default, it is 8092B?? I don't know whether I am all right at these points. Please give me some help.

    Read the article

< Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >