loops

Looping through rows in a DataView

The DataView object doesn't have a Rows property like DataTable. How do I loop through the rows of a DataView? ...

creating a loop based on 30 users?

Im creating a application that populates 30 textboxes with values based on the result of a word count. the final version will have 30 words but this test ap i only include 3 of them How wold you go about making this in to a loop? int[] totX = new int[30]; string nav1 = "test1"; string nav2 = "test2"; string nav3 = "t...

How can I access a variable outside a loop when I set in it inside the loop?

I wrote a quick Perl script to query the local DNS servers for an IP address, and I have a variable that needs to be declared within the scope of the loop, but it doesn't seem to be in scope outside of the loop. The compiler is returning the errors Global Symbol "$ipAddr" requires explicit package name Here's the code my $resolver ...

Why doesn't my code append to the string within the loop?

I'm using jQuery, building a table through a loop. I thought the best way of doing this would be to create an array then do $(blah).html(table); var settings_table = '<open the table>'; $.each(settings, function(i, val){ var settings_table = settings_table+'<put stuff in it>'; }); var settings_table = settings_table+'<close it...

Java Hashmap Iteration: Look at two values at once?

I have this loop: for (Map.Entry<Integer, String> entry: collection.entrySet()) { } I'd like to compare entry and the next one after that. How would I do it? ...

Making a for X in Y loop return whatever is returned by the statements it contains

Hi all, The following statement... content_tag(:li, concept.title) ...returns something like: <li>"My big idea"</li> The following method definition, when called, returns the same: def list_of_concepts(part) content_tag(:li, concept.title) end As does... def list_of_concepts(part) content_tag(:li, part.concepts.first.title) ...

Creating a loop that will edit 60 TextBox names?

text box set1 = 1 to 30 = in the query name = br1id to br30id textbox set 2 = 1 to 30 = in the result output i dont understand how to create a loop based on 30 diffrent textbox names? i cant copy paste these lines 30 times editing the textbox names, that wold just look wrong. try { MySqlConnection mysqlCon = new MySqlConnection...

Python Web-Scrape Loop via CSV list of URLs ???

HI, I've got a list of 10 websites in CSV. All of the sites have the same general format, including a large table. I only want the the data in the 7th columns. I am able to extract the html and filter the 7th column data (via RegEx) on an individual basis but I can't figure out how to loop through the CSV. I think I'm close but my script...

What is the advantage of a do-while(false)?

When looking through some code that was handled by another employee, I see a lot of code written in: do{ ... }while(false); What advantage (if any) does this provide? Here is more of a skeleton that is happening in the code: try{ do{ // Set some variables for(...) { if(...) break; // ...

Why does int count jump from 1 to 4 on entering a loop? C++

My "counter" is jumping from 1 to 4 when I enter my loop. Any ideas? Code and output below: static bool harvestLog() { ifstream myFile("LOGS/ex090716.log"); if (myFile.fail()) {cout << "Error opening file";return 1;} else { cout << "File opened... \n"; string line; string field; int cs_uri_stemLocation = 0; int csRefer...

Auto increase php numbers on different lines 0100, 0200 etc.

Right now im running something based on time and including files. This is a long file and seems unnecessary. What I want to do is auto increment the times for the 24 times i call code. current style coding: if($time >= "0000" && $time < "0100") { include("1.php"); } elseif($time >= "0200" && $time < "0300") { include("2.php"); Is th...

Creating Simultaneous Loops in Python

I want to create a loop who has this sense: for i in xrange(0,10): for k in xrange(0,10): z=k+i print z where the output should be 0 2 4 6 8 10 12 14 16 18 ...

How do I create a loop in Access VBA/SQL to select records and output to Excel?

Hello, I need some help on writing some VBA/SQL code into a module in Access, which should do the following: Loop through Table 'Schools', with just one field (SchoolName). Use each value in the first table to select records from Table 'ChildData', with several fields about individual children, including which school they attend (Scho...

Could not get out of python loop ...

I want to get out of loop when there is no data but loop seems to be stopping at recvfrom image='' while 1: data,address=self.socket.recvfrom(512) if data is None:break image=image+data count=count+1 print str(count)+' packets received...' ...

Manually iterating a line of a file | bash

I realize I could do this in any other language - but with Bash - I've looked far and wide and could not find the answer. I need to manually increase $line in a script: Example: for line in `cat file` do foo() foo_loop(condition) { do_something_to_line($line) } done If you notice, every time the foo_loop iterates, $line stay...

javascript loop only applying to every other element

i have the following javascript below after i finish an ajax query all of my images have name="pic" <script type="text/javascript"> function done() { var e = document.getElementsByName("pic"); alert(e.length); for (var i = 0; i < e.length; i++) { cvi_instant.add(e[i], { shadow: 75, shade: 10 }); } } m...

Loop through each row of a range in Excel

This is one of those things that I'm sure there's a built-in function for (and I may well have been told it in the past), but I'm scratching my head to remember it. How do I loop through each row of a multi-column range using Excel VBA? All the tutorials I've been searching up seem only to mention working through a one-dimensional ran...

Alternatives to javascript function-based iteration (e.g. jQuery.each())

I've been watching Google Tech Talks' Speed Up Your Javascript and in talking about loops, the speaker mentions to stay away from function-based iterations such as jQuery.each() (among others, at about 24:05 in the video). He briefly explains why to avoid them which makes sense, but admittedly I don't quite understand what an alternative...

IE does not render changes while javascript script is running

I have a rather long running javascript code which adds a new "div" element to the document. It looks like in IE this change is being rendered only after the script is finished, which is not the case in FF. Any idea how to make it work ? This script is actually supposed to run forever, kind of "main loop". ...

Wordpress : List posts in category on '.com/categoryname' and display post on '.com/categoryname/post-name'

I have a permalink structure of /%catergory%/%postname%/. When I go to blah.com/categoryname I want all posts in that specific category to be listed. When I go to blah.com/categoryname/post-name I want just the specific post to be displayed. I have made a category specific template (category-5.php) and have got as far as... // Display...