loops

Pipe R commands and results from within a for loop to a file

We want to log the commands and results of a R script into a text report file. The pipe into the text file works well with sink(), but not within a for loop. The script is called with source("myscript.r",echo=TRUE) We need the loop to extract all rows of a data.frame consecutively into a vector and do some vector based analysis with ...

JavaScript - Loop within a function to alt color table rows

I have a query building form built in php. The results of the query are returned and placed in two different tables one above the other. (table id's are results, and results2) Each record returned builds two tables to display its data. (Soon to be three) I'm using the following code to change the class tags of my 's to provide alterna...

Episode 77 - links instead of a for loop

In episode 77 Joel and Jeff were discussing using links instead of a for loop. I looked in Stack Overflow, Google, and Wikipedia but couldn't find any reference to a links construct. The closest thing I could find was a self referencing linked list which would presumably loop indefinitely. Is links a feature of the Links programming l...

Application not entering Fast Enumeration loop

after much debugging, I have determined that this code is ignoring the fast enumeration loop and blindly jumping to the end: -(void)loadOutAnnotations { NSLog(@"entering Annotation enumeration Loop"); iProspectFresno_LiteAppDelegate *appDelegate =(iProspectFresno_LiteAppDelegate *)[[UIApplication sharedApplication] delegate]; ...

PHP: Changing the query variables during the while loop

I was hoping to change one of the variables of a query, from inside the while loop, is it possible to do this? EG. $query = mysql_query('SELECT column1, column2 FROM table1 WHERE column1 = "'.$variable.'";', $conn); while ($data = mysql_fetch_assoc($query)) { if($data['column2'] == 'original') { $variable = 'altered'; } ...

C++ test if input is an double/char

I am trying to get input from the user and need to know a way to have the program recognize that the input was or was not a double/char this is what i have right now... but when you type an incorrect type of input 1) the double test one just loops infinatly 2) the char one won't stop looping even with the correct imput int m...

stopping dll loop

I have a multi-thread C# application that uses some recursive functions in a dll. The problem that I have is how to cleanly stop the recursive functions. The recursive functions are used to traverse our SCADA system's hierarchical 'SCADA Object' data. Traversing the data takes a long time (10s of minutes) depending on the size of our ...

Good input validation loop using cin - C++

Hi there, I'm in my second OOP class, and my first class was taught in C#, so I'm new to C++ and currently I am practicing input validation using cin. So here's my question: Is this loop I constructed a pretty good way of validating input? Or is there a more common/accepted way of doing it? Thanks! Code: int taxableIncome; int error...

All array possibilities

I have pascal code (programming language actually doesn't mean anything): box[1] := 14; box[2] := 2; box[3] := 4; box[4] := 5; box[5] := 6; box[6] := 8; I want to get all possibilities. For instance, box[1] = box[6], then box[6] = box[1]. Yes, I can write it by my hand, but I guess I can make it more clever, by loop. Any ...

How can I loop in 2D grid decision tree in C#?

I have a list of objects I must set a property based on two criteria the 2D grid looks like this: Property 2\Property 1 B<80 80<B<100 100<B<120 B>120 A < 100 None Red Orange Orange 100 < A < 120 None Red Orange Green 120 < A <...

Infinite loop on combination of RewriteRules

So I'm setting up SVN on my home server (Ubuntu 9.1), and want the ability to view any changes made to my CodeIgniter app immediately. So, my working copy lives in /home/myname/environments/development/appname. My Vhost is accessible at dev.appname.myname.ca, and the config looks like this: DocumentRoot /home/myname/environments/deve...

Reverse loop inside a loop with same list

num = list(str(1234567)) for n1 in num: print n1 for n2 in reversed(num): print '\t', n2 On each iteration, it prints the first digit from the first loop and all 7 from the reverse loop. How can I print not all digits but only the last (i.e first) digit from reverse loop? Thanks ...

Java, replacement for infinite loops?

I am making a program that shows cellular growth through an array. I have gotten it so when I press the start button, the array updates every 10 seconds in a while(true){} loop. The problem with that is I want to be able to stop the loop by pressing the pause button, but while in the loop, it wont let me use any of the controls. I need s...

XSL Looping: how to loop where node name increments

How would one loop thru a set of nodes, where the node name has a numeric number and the number increments as in a series? ex: <nodes> <node1> <node2> ... <node10> </nodes> ...

Parallel while Loops in Python

Hi, I'm pretty new to Python, and programming in general and I'm creating a virtual pet style game for my little sister. Is it possible to run 2 while loops parallel to each other in python? eg: while 1: input_event_1 = gui.buttonbox( msg = 'Hello, what would you like to do with your Potato Head?', title = 'Main Scr...

Delphi loop speed question

Is there a faster way? I basically need to add AA-ZZ to thousands of records at a time. Just a list of 35 items takes quite a while to complete muchless a list of a thousand. procedure Tmainform.btnSeederClick(Sender: TObject); var ch,ch2:char; i:integer; slist1, slist2:TStrings; begin slist1:= TStringList.Create; slist2:...

Check whether a value is present in a column or not in sql server 2005

Hai guys, I have a table with a column named Is_Deleted and my query is select Is_Deleted from Stock where Stock.Mat_Id=1 Now i have to write a condition to check whether all values are 1 else i have to terminate my loop.. How it can be done? any suggestions... ...

Assembler task - min and max values of the array..

Hi. I've encountered problems with assembler code. I'm a newbie to assembler, so it seems difficult for me to solve it myself. The task is: "To find minimal and maximal elements of the array." All I've already done is searching for maximal element. I can't find out, how to make check for the minimal element and where I should put suc...

How to implement with java loop ?

Possible Duplicate: LOOP in JAVA ??? Hi everyone I have this file : CREATE MRED:NAME=MRED:0,MICR=0-0,CRC=TRUE,CODE=HDB3,NUA=FALSE,BER=E10_3,BAF=0,LREDUNEQ=SIMPLEXB,L1CTS=<NULL>,LOWBER=E10_6,REMAL=<NULL>,WMOD=SINGLE_TRUNK; CREATE MRED:NAME=MRED:1,MICR=0-1,CRC=TRUE,CODE=HDB3,NUA=FALSE,BER=E10_3,BAF=0,LREDUNEQ=SIMPLEXA,L1CTS=<NULL...

Bourne Shell For i in (seq)

I want to write a loop in bourne shell which iterates a specific set of numbers. Normally I would use seq for i in `seq 1 10 15 20` #do stuff loop But seemingly on this Solaris box seq does not exist. Can anyone help by providing another solution to iterating a list of numbers? Thanks, Chris ...