loops

looping through DOM / mootools sortables

I can't seem to get a handle on my list of sortables. They are a list of list elements, each with a form inside, which I need to get the values from. Sortables.implement({ serialize: function(){ var serial = []; this.list.getChildren().each(function(el, i){ serial[i] = el.getProperty('id'); }, t...

for loop in vb.net add a counter to existing string

i hae a for loop which goes like this - for i = 0 as integer to 100 result &= "Name" & sqldr("name") result &= "Lastname" & sqldr("lastname") result &= "dob" & sqldr("dob") next the sqldr is the sql datareader (not important here) i want my end result to be Name1 = Sam Lastname1 = Davis dob1 = 01/01/1966 Name2 = ... Na...

Implementing Loops from Pseudocode

Hi everyone, I was wondering if anyone could suggest to me how to implement this loop in the following pseudocode: 8: loop 9: while f[0] = 0 do 10: for i = 1 to N do 11: f[i ¡ 1] = f[i] 12: c[N + 1 - i] = c[N - i] 13: end for 14: f[N] = 0 15: c[0] = 0 16: k = k + 1 17: end while 18: if deg(f) = 0 then 19: go...

In Excel's VB, how do i create a routine that would constantly run in the background?

I am making a primitive database in Excel and need a routine to run in the background constantly. I will be able to fill in the actual actions it needs to do, but I don't know how to make something run independent of a key press or some sort of Macro. If someone can give me an example of code that runs independently which I can simply fi...

calculating column totals in multiple tables using

I'm a relative newb with jQuery but I've managed in the past to cobble together a few simple scripts. I've got a new challenge and I know I'm 'in the zone but I need some help. I have an html page, with numerous tables in this format: <table class="tableClass" id="tableID"> <col class="date" /> <col class="reference" /> <col clas...

Memory leak during repeated lucene query searches?

Hi all, Basically, I simply want to do many searches on a given lucene index. Therefore, I made a class Data with final 'analyzer', 'reader', 'searcher' and 'parser' fields, (all properly initialized in the constructor). The class also provides a 'search' method to search the index. This is all shown in the code below. The problem is...

While loop never ends

I'm working with bash and I'm trying to do something like this: A=1 while [ $A=1 ]; do read line echo $line | grep test >/dev/null A=$? echo $A done This script never ends even when the grep finishes successfully and A is set to 0. What am I missing here? Below is a sample of the output. $ ./test.sh asdf 1 te...

Can PHP SimpleXML be used for this task?

I'm looking to run some kind of loop on some optional XML data. Nodes would potentially look like this: <link1> <url>http://www.bleh.com&lt;/url&gt; <text>Click here</text> </link1> <link2> <url>bleh.com</url> <text>Click here</text> </link2> What would be the best method to determine if these nodes exist and parse them according...

Getting Null exception error in loop. Trying to debug.

Im having some problems parsing a string to a textbox type, im using the code in a diffrent form in the program and its working fine, but when im tying the same two lines here i get a null exception the two lines of intrest is string txbName = "br" + bruker + "txt" + 'B' + o; txtBCont = (TextBox)Controls[txbName]; new info Greg p...

display results on the go in php ?

i have a for loop that will loop through a set of page in php. for ($count=0;$count<=$curr;$count=$count + 10) { if ($find==1) { $result = "file.php?count=$count"; }else { $result = "file2.php?count=$count"; } $match = file_get_contents($result)...

Java Enhanced For Loop

How would I write the following for loop using an enhanced for loop> int [] info = {1,2,3,4,5,6,7,8,9,10}; int i; for (i = 0; i < info.length; i++) { if ((i+1) % 10 == 0) System.out.println(info[i]); else System.out.println(info[i] + ", "); } ...

Add ListBox items from Dataset

hi there, I have this C# code. j = myAccountDataset.Tables["AccountsTables"].Rows.Count; for (i = 0; i <= (j - 1); i++ ) { listAccountList.Items.Add(myAccountDataset.Tables[0].Rows[i][1]); } this.listAccountList.SelectedIndex = 0; the idea is to ite...

jQuery - How can I continue an animation while the mouse hovers over an element?

I need a way to perform some kind of 'whileonmouseover' function to continue an animation while the mouse overs over an element... For example, given this function: $(document).ready(function() { function doAlert() { alert(1); } $('#button').hover(function() { doAlert(); }); }); The alert will...

Equally divide resultset into groups, with cursor or not?

I'm building a race administration system, with drivers and race heats. I need to divide, lets say, 13 drivers into groups of maximum 6 per group. It's not possible since the result will be 2.2 groups, wich is impossible, 3 groups is required. Smaller groups than 6 is allowed, so I decide to divide 13 by 3 to accomplish the follwing di...

Loop through name/values of an object to replace html in unique div's using jQuery

Hi there, I'm using the following code: $.each($dataObj, function(index, value) { $(index).html(value); }); Which of course does not work since $(index) is not a valid syntax. Each index in the object corresponds to a a unique div-id on the webpage, so what I want to do is to replace the html in all of the div-id's listed i...

PHP parse directory and subdirectories for file paths and names of only jpg image types

I am looking to modify this php code to do a recursive "search for and display image" on a single, known, directory with an unknown amount of sub-directories. Here's the code I have that scans a single directory and echoes the files out to html: <?php foreach(glob('./img/*.jpg') as $filename) { echo '<img src="'.$fil...

How to Break out of multiple loops at once in C#?

What if I have nested loops, and I want to break out of all of them at once? while (true) { // ... while (shouldCont) { // ... while (shouldGo) { // ... if (timeToStop) { break; // break out of everything? } } } } In PHP, break takes an argument...

How to loop through table cells with jQuery and send the data to database

What's the best method for looping through a table, grabbing all the data in the cells, but skipping the <th>? Do I put the data in an array? ...

Going mad with infinite loop and RewriteCond, need help.

I want to redirect users to my home page if they enter any URL not starting with 'en' or 'fr'. I've spent hours trying to make this work but this proves too tough for my fragile newbie brain. Currently, if I try to go to http://mysite.com/fr/produits/ Firefox tells me that the redirect will never complete. Here's what I want: http:/...

C# foreach loop with key value

In PHP I can use a foreach loop such that I have access to both the key and value for example: foreach($array as $key => $value) I have the following code: Regex regex = new Regex(pattern); MatchCollection mc = regex.Matches(haystack); for (int i = 0; i < mc.Count; i++) { GroupCollection gc = mc[i].Groups; Dictionary<string...