Search Results

Search found 374 results on 15 pages for 'traverse'.

Page 9/15 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Using eval() in Javascript to unpack the array

    - by gnomixa
    I have an array that I need to unpack. So, from something like var params = new Array(); params.push("var1"); params.push("var2"); I need to have something like "var1", "var2". I tried using eval, but eval() gives me something like var1, var2...i don't want to insert quotes myself as the vars passed can be integers, or other types. I need to pass this to a function, so that's why i can't just traverse the array and shove it into a string. What is the preferred solution here?

    Read the article

  • Array of char *

    - by user353060
    Hello, I am having problems with array pointers. I've looked through Google and my attempts are futile so far. What I would like to do is, I have a char name[256]. I will be 10 of those. Hence, I would need to keep track of each of them by pointers. Trying to create a pointer to them. int main() { char superman[256] = "superman"; char batman[256] = "batman"; char catman[256] = "catman"; char *names[10]; names[0] = superman; names[1] = batman; system("pause"); return 0; } How do I actually traverse an array of pointers?

    Read the article

  • Examining C/C++ Heap memory statistics in gdb

    - by fd
    I'm trying to investigate the state of the C/C++ heap from within gdb on Linux amd64, is there a nice way to do this? One approach I've tried is to "call mallinfo()" but unfortunately I can't then extract the values I want since gdb deal with the return value properly. I'm not easily able to write a function to be compiled into the binary for the process I am attached to, so I can simply implement my own function to extract the values by calling mallinfo() in my own code this way. Is there perhaps a clever trick that will allow me to do this on-the-fly? Another option could be to locate the heap and traverse the malloc headers / free list; I'd appreciate any pointers to where I could start in finding the location and layout of these. I've been trying to Google and read around the problem for about 2 hours and I've learnt some fascinating stuff but still not found what I need.

    Read the article

  • how to get an instance of an XMLEventAllocator?

    - by kostja
    I am trying to follow the recommended way of parsing XML with StAX using sun's Cursor-to-Event Example for Java EE 5. You are supposed to traverse the XML via the Cursor API and allocate an XMLEventusing an XMLEventAllocator when necessary. Awkwardly, sun's own example does not compile (at least not with JDK 1.6, even with 1.5 code compliance). The example tries to instantiate an allocator via new, but the according implementation classes in the JDK are not accessible externally. After reading the JavaDocs and searching the web I have found literally nothing. One could implement the XMLEventAllocator interface from scratch, but it seems really wrong, when there are perfectly good implementations in the JDK, besides not being an expert in StAX makes it difficult to get it right.

    Read the article

  • DropDownList selectedValue not changing display

    - by MemphisDeveloper
    I have a list of controls that I change based on an event. The controls are contained within a table that is created dynamically. I traverse through a set of controls and if it is a RadioButtonList or a DropDownList I do the following: CType(cntrl, ListControl).SelectedValue = val The radio buttons set just fine but the dropdown list doesn't reset. Can anyone tell me why. The initial table is created on the first Page Load and stored in memory. It's values are changed during the eventhandling and reposted to a MasterPage's content holder.

    Read the article

  • javascript traversing table

    - by user234194
    If I have a certain code, How do I traverse or get to the button(i.e type == INPUT) in JavaScript. <td> <div> <script></script> <script></script> <script></script> <input type="button"....../> </div></td> I tried doing: var cell = row.cells[0]; if (cell) { var btn1 = cell.firstChild; alert(btn.tagName.toUpperCase()); this resulted "DIV", and var cell = row.cells[0]; if (cell) { var btn = btn1.firstChild; alert(btn.tagName.toUpperCase()); this resulted "SCRIPT" But doing same (i.e firstChild ) , I could not succeed. Any help is appreciated. Thanks

    Read the article

  • amp is included in url struts tag

    - by lakshmanan
    Hi, In my web application, I use strust2 url tag to pass parameters like id etc., For example, I use a link to delete an entity and I use param to pass the id of the entity to be deleted. And I follow this throughout my web app for adding, editing, deleting an entity. During run time, sometimes, I don't get the params to be stored in my action's bean properties. When I see the link that is generated, I get something like <a href='/projit1/p/discuss/viewDiscussion.action?d=11&amp;amp;amp;projid=11&amp;amp;disid=4'> What are these amps for ? why do they sit in between the action calls (made by link via url tag actions ) ? By the time I traverse back and forth in my web app, I get 10s and 20s of amp sitting in the request URL. What is the problem here ? Please help.

    Read the article

  • MooTools: How to use responseText directly

    - by Johny
    In following example of code, I want to traverse the responseText object which consist the html code came from request_page.php file. In onSuccess event, i want to check whether < Div with id 'ersDiv' has any errors posted in it. new Request.HTML({ url: 'request_page.php', onSuccess: function(responseText, responseXML) { // My expected code to handle responseText object alert(errorMessage); }, onFailure: function() { } }); request_page.php file is like this : <div align='center'><div id='ersDiv'>Page loaded with insufficient data</div></div>

    Read the article

  • Python programming. Accessing Windows rigth click menu options

    - by Zack
    I'm hoping to automate a few tasks at work. One of them being combining and converting power point files to PDFs. I'm a bit of a newbie (I just finished Magus Heitland's Beginning Python), so I'm not entirely sure what I'm specifically asking. On windows, one can select multiple files, right click, and select combine as adobe PDF. I've figured out the 'grouping' of the files I want to convert (I traverse the dir and nest the files inside of a list based on their names), but I'm unsure how to pursue the next step (the rightclick/combine command). Googling has led me to things like win32api, pywinauto, and ctypes. But as I read over what they do my newbieness prevents me from knowing which is the tool I need. Could any one suggest a few good resources or tips?

    Read the article

  • Why is comparing against "end()" iterator legal?

    - by sharptooth
    According to C++ standard (3.7.3.2/4) using (not only dereferencing, but also copying, casting, whatever else) an invalid pointer is undefined behavior (in case of doubt also see this question). Now the typical code to traverse an STL containter looks like this: std::vector<int> toTraverse; //populate the vector for( std::vector<int>::iterator it = toTraverse.begin(); it != toTraverse.end(); ++it ) { //process( *it ); } std::vector::end() is an iterator onto the hypothetic element beyond the last element of the containter. There's no element there, therefore using a pointer through that iterator is undefined behavior. Now how does the != end() work then? I mean in order to do the comparison an iterator needs to be constructed wrapping an invalid address and then that invalid address will have to be used in a comparison which again is undefined behavior. Is such comparison legal and why?

    Read the article

  • problem in `delete-directory` with enabled `delete-by-removing-to-trash`

    - by Andreo
    There is a strange behavior of delete-directory function with enabled flag delete-by-removing-to-trash. It deletes files one by one instead of applying move-file-to-trash to the directory. As a result emacs deletes big directories slowly and there are many files in the trash after deleting, so it is impossible to restore the directory. Example: Directory structure: ddd/ ccc/ 1.txt There are three files in the trash after deleting ddd: trash/ ddd/ ccc/ 1.txt instead of one: trash/ ddd/ It is very slow, because emacs traverse directory recursively. I can't restore deleted directory. What i need is exactly the same behavior as of move-file-to-trash. But it should be transparent (i.e. 'D x' in dired mode). How to solve the problem? As a temporary solution i see the making advice function for `delete-directory'.

    Read the article

  • Accessing XML/PHP with period in tag

    - by LuckyShot
    Hi guys, Quick newbie question here, how do I access totalResults? XML <?xml version="1.0" encoding="UTF-8"?> <OpenSearchDescription> <opensearch:totalResults>1</opensearch:totalResults> <posts> <post> <score>10</score> </post> </posts> </OpenSearchDescription> To access the score I would do this: PHP $xmlObj = simplexml_load_string($theXMLabove); echo $xmlObj->posts->post[0]->score; But none of these work for the totalResults: echo $xmlObj->opensearch:totalResults; echo $xmlObj->opensearch->totalResults; Sorry for asking such a lame question... Documentation on how to traverse XML with PHP is also appreciated :) Thanks!

    Read the article

  • Exclude subexpression from regexec in c++

    - by wyatt
    Suppose I was trying to match the following expression using regex.h in C++, and trying to obtain the subexpressions contained: /^((1|2)|3) (1|2)$/ Suppose it were matched against the string "3 1", the subexpressions would be: "3 1" "3" "1" If, instead it were matched against the string "2 1", the subexpressions would be: "2 1" "2" "2" "1" Which means that, depending on how the first subexpression evaluates, the final one is in a different element in the pmatch array. I realise this particular example is trivial, as I could remove one of the sets of brackets, or grab the last element of the array, but it becomes problematic in more complicated expressions. Suppose all I want are the top-level subexpressions, the ones which aren't subexpressions of other subexpressions. Is there any way to only get them? Or, alternatively, to know how many subexpressions are matched within a subexpression, so that I can traverse the array irrespective of how it evaluates? Thanks

    Read the article

  • Rails ActiveRecord - How to set association save order

    - by Altonymous
    I have a weird relationship that needs to be maintained for legacy processes. I'm trying to figure out how to create the relationship given the new model association. New Relationship Setup Machine has_many MachineReadings has_many Disks has_many DiskReadings Old Relationship Setup Machine has_many MachineReadings has_many DiskReadings has_many Disks The problem is data will come in on the Machine model as nested attributes using the new relationship setup. I need to update the machine_reading_id in the DiskReading model so the old association can continue to be used. I tried doing this via an after_save hook that would traverse back up to the machine and then down to the readings to get the machine_reading.id so I could populate the DiskReading model. However, the associations aren't being saved in the order I would expect. They are saving the Disks & DiskReadings before saving the MachineReadings. So when I go after the machine_reading.id it hasn't been written and thus I am unable to get access to it. For example: #machine_disk_reading.rb after_save :build_old_relationship def build_old_relationship self.machine_reading_id = self.disk.machine.readings.find_by_date_time(self.date_time).id end

    Read the article

  • missing ) in parenthetical

    - by Elgoog
    I'm modifying BSN's Autosuggest script so it will work with codeigniter, the only proble is I cant seem to figure out why it displays "missing ) in parenthetical" says the problem is around else _b.AutoSuggest.prototype.setSuggestions = function (req, input) { if (input != this.fld.value) return false; this.aSug = []; if (this.oP.json) { var jsondata = eval('(' + req.responseText + ')'); for (var i=0;i<jsondata.results.length;i++) { this.aSug.push( { 'id':jsondata.results[i].id, 'value':jsondata.results[i].value, 'info':jsondata.results[i].info } ); } } else { var xml = req.responseXML; // traverse xml // var results = xml.getElementsByTagName('results')[0].childNodes; for (var i=0;i<results.length;i++) { if (results[i].hasChildNodes()) this.aSug.push( { 'id':results[i].getAttribute('id'), 'value':results[i].childNodes[0].nodeValue, 'info':results[i].getAttribute('info') } ); } } this.idAs = "as_"+this.fld.id; this.createList(this.aSug); }; Any help would be appreciated, i'm not very good at JS

    Read the article

  • Java, How to Instance HttpCookie from a String, any convenient ways?

    - by user435657
    Hi all, I have got a cookie string from HTTP response header like the following line: name=value; path=/; domain=.g.cn; expire=... I can parse the above line to key-value pairs, and, also it's easy to set the name and value to HttpCookie instance as this pair comes the first. But how to set the other pairs since I don't know which set-method corresponds to the name of the next name-value pair. Traverse all possible keys a cookie may contian and call the matched set-method, like below snippet? if (key.equalsIgnoreCase("path")) cookie.setPath(value); else if (key.equalsIgnoreCase("domain")) cookie.setDomain(value); That's foolish, any convenient ways? Thanks in advance.

    Read the article

  • Make backup of large site with 100,000+ files/images

    - by niggles
    I tried backing up our site today using the Unix 'cp' command and ended up getting our office blocked out by PLESK - it added my ip to /etc/hosts.deny as it thought I was flooding the server. After Tech support fixed the issue, they suggested I go folder by folder to back it up, but there's about 10,000 folders on the site totaling 1/2 a terabyte, each with multiple sub-folders, so this isn't viable. Basically I want to be able to mirror the domain on another domain we've got set up on the same dedicated server so I can test with live images (the bulk of our content). Any suggestions e.g adding some rules to open_base_dir and getting PHP to recursively copy the folders to the other domain (remember it's on the same dedicated box so it just needs to traverse the directory, not FTP things).

    Read the article

  • Checking validation errors in XMLHttpRequest

    - by egaga
    $.post(actionUrl, serializedForm, function(response) { ... } I need to check whether validation of form succeeded, or not (I don't need to know the exact validation errors). The validation is done by Spring, and I wouldn't like to interfere the process, because there's some annoying dependencies. What would be the best approach? Is there a Spring error object in response, or is it accessible only in server side? I would also like to know if there's is any proper documentation about response in jQuery site? How can I traverse or manipulate it?

    Read the article

  • Storing tree data in Javascript

    - by Ozh
    I need to store data to represent this: Water + Fire = Steam Water + Earth = Mud Mud + Fire = Rock The goal is the following: I have draggable HTML divs, and when <div id="Fire"> and <div id="Mud"> overlap, I add <div id="Rock"> to the screen. Ever played Alchemy on iPhone or Android? Same stuff Right now, the way I'm doing this is a JS object : var stuff = { 'Steam' : { needs: [ 'Water', 'Fire'] }, 'Mud' : { needs: [ 'Water', 'Earth'] }, 'Rock' : { needs: [ 'Mud', 'Fire'] }, // etc... }; and every time a div overlaps with another one, I traverse the object keys and check the 'needs' array. I can deal with that structure but I was wondering if I could do any better? Edit: I should add that I also need to store a few other things, like a short description or an icon name. So typicall I have Steam: { needs: [ array ], desc: "short desc", icon:"steam.png"},

    Read the article

  • Prototype - DOM Traversal with up()

    - by Jason McCreary
    I have the following structure: <form> <div class="content"> ... </div> <div class="action"> <p>Select <a class="select_all" href="?select=1" title="Select All">All</a></p> </div> </form> I am using Prototype's up() to traverse the DOM in order to find the <form> element in respect to the a.select_all. However the following doesn't work: select_link.up('form'); // returns undefined Yet, this does. select_link.up().up().up(); // returns HTMLFormElement Clearly this is an ancestor of a.select_all. The API Docs state Element.up() supports a CSSRule. What am I missing here?

    Read the article

  • Force freeing memory in PHP

    - by DBa
    Hi everybody, in a PHP program, I sequentially read a bunch of files (with file_get_contents), gzdecode them, json_decode the result, analyze the contents, throw the most of it away, and store about 1% in an array. Unfortunately, with each iteration (I traverse over an array containing the filenames), there seems to be some memory lost (according to memory_get_peak_usage, about 2-10 MB each time). I have double- and triplechecked my code, I am not storing unneded data in the loop (and the needed data hardly exceeds about 10MB overall), but I am frequently rewriting (actually, strings in an array). Apparently, PHP does not free the memory correctly, thus using more and more RAM until it hits the limit. Is there any way to do a forced garbage collection? Or, at least, to find out where the memory is used? Thanks in advance, Dmitri

    Read the article

  • Composite pattern in C++ problem

    - by annouk
    Hello! I have to work with an application in C++ similar to a phone book: the class Agenda with an STL list of Contacts.Regarding the contacts hierarchy,there is a base-class named Contact(an abstract one),and the derived classes Friend and Acquaintance(the types of contact). These classes have,for instance, a virtual method called getName,which returns the name of the contact. Now I must implement the Composite pattern by adding another type of contact,Company(being derived from Contact),which also contains a collection of Contacts(an STL list as well),that can be either of the "leaf" type(Friends or Acquaintances),or they can be Companies as well. Therefore,Company is the Compound type. The question is: how and where can I implement an STL find_if to search the contact with a given name(via getName function or suggest me smth else) both among the "leaf"-type Contact and inside the Company collection? In other words,how do I traverse the tree in order to find possible matches there too,using an uniform function definition? I hope I was pretty clear...

    Read the article

  • Raphael how to get last path and last circle, if i have 2 elements in the paper?

    - by 3gwebtrain
    I need to find the last path or circle in a paper, in order to perform further calculations to draw more elements, and calling 'paper.bottom' only gets the last element. Is there any way to get shapes of specific types, e.g. bottom.path, bottom.circle or traverse for the n'th child? I want to avoid using jQuery selectors, as i can't retrieve any properties from those. An example of a paper populated with shapes: var paper = Raphael('paper',500,500); var c1 = paper.circle(100,100,50) var p1 = paper.path("M10 20l70 0") var c2 = paper.circle(200,100,50)

    Read the article

  • execute javascsript for loop alternately forward and backward

    - by Stiff Mittens
    What I'm trying to do is iterate through an array in chunks, alternating the direction of iteration from chunk to chunk. Confused? So am I. For example, if I want to loop thru an array with 25 elements, but I want to do it in this order: 0, 1, 2, 3, 4, 9, 8, 7, 6, 5, 10, 11, 12, 13, 14, 19, 18, 17, 16, 15, 20, 21, 22, 23, 24, what would be the most efficient way of doing this? I'm looking for something scalable because the array I'm working with now is actually 225 elements and I want to traverse it in 15 element chunks, but that may change at some point. So far, the only method I've figured out that actually works is to hard-wire the iteration order into a second array and then iterate through that in the normal way to get the indices for the original array. But that sucks. Any help would be greatly appreciated.

    Read the article

  • Constructing a tree using Python

    - by stealthspy
    I am trying to implement a unranked boolean retrieval. For this, I need to construct a tree and perform a DFS to retrieve documents. I have the leaf nodes but I am having difficulty to construct the tree. Eg: query = OR ( AND (maria sharapova) tennis) Result: OR | | AND tennis | | maria sharapova I traverse the tree using DFS and calculate the boolean equivalent of certain document ids to identify the required document from the corpus. Can someone help me with the design of this using python? I have parsed the query and retrieved the leaf nodes for now.

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15  | Next Page >