loops

Replace Infinite loop in Flex

Hello, I want to access a webservice:getMonitorData() , on creationcomplete and returns an array, in an infinite loop so that the getIndex0.text is updated each time. Flex is not able to handle an infinite loop and gives a timeout error 1502. If I run the for loop until i<2000 or so it works fine. How can replace the loop so that my w...

how does a non-blocking event loop work?

Twisted has a "non-blocking" event loop. I understand what a blocking event loop does (sort of, from the Wikipedia page) but can't figure out how a non-blocking one does. ...

Execute stored procedure for each record in table

I have two tables that need to be updated, Master and Identifiers: Master --MasterID (PK) --ModifiedDate --ModifiedBy Identifiers --IdentifierID --MasterID (FK to Master) --Identifier --IdentifierType --ModifiedDate --ModifiedBy The Master table's sole reason for existence is to tie different Identifiers to a single person. I receive...

Escaping an infinite loop without terminating the browser.

Is there a way to escape a loop like the one below without closing the browser by terminating it process? WARNING: Don't run the code below. Running this code will throw your browser in an infinite loop of alerts. <html><body onload="while(true)alert('Hello')"></body></html> ...

Why doesn't this jQuery animation loop infinitely?

I have a jQuery animation that positively refuses to loop. It will play through the animation once and then quit. Here it is: http://stackoverflow.quickmediasolutions.com/stackad/fancy.html Here is the relevant section of code: function DoAgain() { $('#block').stop().css('marginLeft','0px'); var width = ($('#block').width()) /...

what programming languages support labels with break and continue statments ?

I recently read about labelled statments in java and the ability to specify a label with the break and continue statements. What other languages support this sort of syntax ? ...

How to avoid cursor in sql server? also want to avoid while loop

Hi All, I have two tables in my database, 1st one contains a couple of sentences, like 'I like apples and bananas', 2nd one contains key word, like 'apple' & 'orange'. I want to create a sql statements or usp to list all the colomns in the 1st table with the keywords in the 2nd one. How can I achieve that without using cursors? Would a...

javascript appending in a for loop not working but alering is.

I am trying to append to a string in a for loop. I can alert each value bieng looped but i cant append for some reason: <html> <head> <script type="text/javascript" language="javascript"> function doIt(){ var styleSheet = document.styleSheets[0]; var css=""; ...

Slowing down some Javascript

I have a large list of instructions that I need executed sequentially but slowly. One every ten milliseconds or so. I'm thinking about a queue type data structure but am unsure how to proceed. ...

What is a practical difference between a loop and recursion

I am currently working in PHP, so this example will be in PHP, but the question applies to multiple languages. I am working on this project with a fiend of mine, and as always we were held up by a big problem. Now we both went home, couldn't solve the problem. That night we both found the solution, only I used a loop to tackle the probl...

Do Perl loop labels count as a GOTO?

Generally, it is good practice to avoid GOTOs. Keeping that in mind I've been having a debate with a coworker over this topic. Consider the following code: Line: while( <> ) { next Line if (insert logic); } Does using a loop label count as a goto? Here is what perlsyn in perldoc has to say: Here's how a C progra...

VB.NET concatenation problem

I have this line of code which I want to concatenate -or at least solve the loop problem... test = 1 - ("0." & thisnumber(0) & thisnumber(1) & thisnumber(2)) I want this to have a loop in it... -Increasing thisnumber() Until it gets to about 500, Can some implement a loop into this? Or suggest a way... Thanks a lot.. James :) ...

System.OutOfMemoryException being thrown

I am getting a system.outofmemory exception in my code: While r1.Read() menu1id = r1("id") db.AddInParameter(command2, "@menu1id", DbType.Int32, menu1id) r2 = db.ExecuteReader(command2) command2.Parameters.Clear() menu1heading = r1("Headi...

Passing an identical message to multiple ObjC classes

I have multiple classes, all of which I want to send an identical message to. To be clearer: I want to send doX:withClass: with the same parameters to a number of classes. Perhaps code would make it clearer: + (void)doX:(NSString *)blah { [Utility doX:blah withClass:[Foo class]]; [Utility doX:blah withClass:[Bar class]]; ...

JavaScript: Passing changing parameters to a callback

Now here's a fun problem. I have an object array as the following: objRequests = [ { url: "/cgi-bin/script1.cgi", dest: "#div1" }, { url: "/cgi-bin/script1.cgi", dest: "#div2" } ]; Now, I iterate through these objects to load some information from the server at particular addresses using jQuery's $....

How can I reduce the loop structure in the following code?

$a=array(array(1,0,0),array(1,0,0),array(1,0,0),array(1,0,0),array(1,0,0),array(1,0,0),array(1,0,0),array(1,0,0),array(1,0,0),array(1,0,0),array(1,0,0), array(1,0,0),array(1,0,0),array(1,0,0),array(1,0,0)); $rest=array(array(0,0,0),array(0,0,0),array(0,0,0),array(0,0,0),array(0,0,0),array(0,0,0),array(0,0,0),array(0,0,0),array(0,0,0),ar...

Output data from this dataclass

Please can someone help with which controls / method to use to get data out of this class into nested lists, i.e parent, child, grandchild, greatgrandchild? When I run: Dim menu As New MenuBuilder Response.Write(menu.BuildMenu().ToString) I only get the top level links and none of the child levels Thanks. Public Class MenuB...

Win32: My Application freezes while the user resizes the window

Hi ! I write a win32 application. I implemented the message loop myself like this: bool programcontinue = true; while(programcontinue) { while (PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&Msg); DispatchMessage(&Msg); ...

Best Loop Idiom for special casing the last element

I run into this case a lot of times when doing simple text processing and print statements where I am looping over a collection and I want to special case the last element (for example every normal element will be comma separated except for the last case). Is there some best practice idiom or elegant form that doesn't require duplicatin...

How to loop through checked list box you accessed through the windows controls?

Dear reader, I would like to loop through a checked list box and see which values are returned. That's no problem, I know I can do it with: if(myCheckedListBox.CheckedItems.Count != 0) { string s = ""; for(int i = 0; i <= myCheckedListBox.CheckedItems.Count - 1 ; i++) { s = s + "Checked Item " + (i+1).ToString() + " = " ...