loops

.net - For Each Obj as MyObject in MyArray -- Is this doable without implementing anything?

I'm using VS2008. Is the following OK to do the following VB.NET with a very simple class (see below)? for each CurrentObject as MyObject in MyArray 'access current object next The "simple class": Class MyObject public I as integer end class I seem to remember that something about needing iEnumerable, but my compiler isn't com...

Python Selenium handling Timeout Exceptions with a long list of URLs

Hi, I am using selenium RC to cycle through a long list of URLs, sequentially writing the HTML from each URL to a csv file. Problem: the program frequently exits at various points in list due to URL "Timed out after 30000ms" exceptions. Instead of stopping the program when it hits a URL time-out, I was trying to have the program simply ...

Looping through a column in R

I am using the stats package R and would like to loop through column[x] in all the rows of a dataframe, operate on the data in each cell in the column with a function and pass the result to a new column (with the calculated result in the new column aligned with the data in column[x]) Two problems. 1) I can't get it to work and 2) loop...

java nested while loop using readline

I'm confused. I'm trying to loop though 2 files looking at the first token in every line of the first file and comparing it to the third token of every line of the second file. Here is the logical structure in the form of a nested while loop: BufferedReader reader1 = new BufferedReader(new InputStreamReader(new FileInputStream(fromFile1...

bash loop between two given dates

I'm trying to create a script that will loop through files that have their filenames written in the following format: yyyymmdd.hh.filename. The script is called with: ./loopscript.sh 20091026.00 23 ./loopscript.sh 20091026.11 15 ./loopscript.sh 20091026.09 20091027.17 The need is for the script to check each hour between those two g...

XSLT to transform list into table with columns determined dynamically

I need this XML, <list columns="3"> <item>martin</item> <item>donald</item> <item>whistler</item> <item>mother</item> <item>carl</item> <item>liz</item> <item>cosmo</item> </list> to look like this: <table> <tr> <td>martin</td> <td>donald</td> <td>whistler</td> </tr> <tr> <td>mother</td> <td>ca...

Add / Remove from XMLList while in a loop.

Hi Everyone, I am trying to parse some XML i have retrieved via e4x in an HTTPService. The loop works and for each episode in the list it goes through the loop. However i get the following error when it is trying to append to an XMLList. TypeError: Error #1009: Cannot access a property or method of a null object reference. I am tryin...

Modifying list while iterating

l = range(100) for i in l: print i, print l.pop(0), print l.pop(0) The above python code gives the output quite different from expected. I want to loop over items so that I can skip an item while looping. Please explain. ...

Cancel a timed loop in JavaScript?

I'm trying to setup a function in JavaScript to fade in or fade out some elements on my page. The fade themselves work fine, but my problem occurs when one of them tries to cancel the actions of the other one. //I know this is ugly, I'm just learning JavaScript again and plan to recode it after I learn some more... var fadeOut = false ...

How to test for multiple command line arguments (sys.argv

Hi, I want to test againts multiple command line arguments in a loop > python Read_xls_files.py group1 group2 group3 No this code tests only for the first one (group1). hlo = [] for i in range(len(sh.col_values(8))): if sh.cell(i, 1).value == sys.argv[1]: hlo.append(sh.cell(i, 8).value) How should I modify this that I ca...

Make Ruby loop return "x" images rather than x, the integer

The following returns whatever integer I feed it as a parameter. def space(spacer_count) spacer_count.times do image_tag("24gray/spacer.png", :class => "spacer") end end How do I make it return the desired number of images? E.g., I want space(6) to return six copies of spacer.png, not the number "6". Thanks! ...

Execute Code Segment only if Loop reaches its last cycle (End of Loop)

Where is the most efficient position for a code block, which shall only execute, if a loop has reached its end, without having previously been aborted (via break or return)? The question seems banal, the answer obvious, nevertheless I am insecure! Answer from efficiency/theory professionals very welcome! Provided: "Some Code X" is ...

How do you write these loops in a nicer way in Java?

I have a set of objects I'd like to do some operations on, in the order they're iterated. After that operation gets called on them, I'd like to perform other operations on them. Basically, the code will look sort of like this: for(int i = 0;i < myobj.size();i++) { myobj.at(i).doSomething(); } for(int i = 0;i < myobj.size();i++) { ...

jquery right way to bulk ajax requests

i have list of rows that user select and i want to delete them, one by one and show the result in the end. obviously if i just do simple loop and call each time ajax function, but how can i loop and check which one successed and which one failed and when they are all done? how would you do it? what is proper way of doing the bulk editi...

MATLAB: Calling .m files in a loop

How do I call 3 MATLAB .m files in a loop and display the results in sequence? ...

Using Jquery each loop to display six list items per ul inside a div pulled from a JSON object

Hello all! I am running into problems where I can't seem to display six list items within a ul that is nested within a div. The following is what I have so far: $(function proName(){ $.getJSON("pros", function(data) { /* Parse JSON objects */ jJSON["pro_name"] = (function() { //response = { //values: [], //count: 0 //};...

Is there a "do ... until" in Python?

Possible Duplicate: do-while loop in python? Is there a do until x: ... in Python, or a nice way to implement such a looping construct? ...

How do I loop through all levels of a data structure to extract all data when I don't know how many levels there will be?

I need to extract data from a structure and put it into a list, but I don't know how many levels the structure has. For each level, I can call level.children(), if there are no levels below the current one, it returns [], if there are, it returns [object, object, ...], on each of which I can call children() on again. I need to drill do...

Loop to check time in VB.NET

So I'm kind of new to VB and am just playing around with a little project, I currently need a loop that is constantly checking the systems clock to see if it's equal to a certain time. While Not myTime.Hour = 24 If TimeOfDay = newTime Then nfi.ShowBalloonTip(15) intRandNumb = RandomNumber(1, 15) ...

Replacing Do ... While Loops

I have the following piece of code taken from the PHP manual on the curl_multi_* entries: $active = null; do { $process = curl_multi_exec($curl, $active); } while ($process === CURLM_CALL_MULTI_PERFORM); while (($active >= 1) && ($process === CURLM_OK)) { if (curl_multi_select($curl, 3) != -1) { do { $process = ...