while

While(1) in constructor or using threads?

Is it recommed to put a while loop, which never ends in a constructor? Or should I use threads to get the same result? Is it good when a constructor never terminates? Or is it more secure to avoid segmentation faults? Hope you understand my bad English.. ...

Java: run code for x seconds?

Hello, I'd like to write a java while loop that will iterate for 15 seconds. One way I thought to do this would be to store the current system time + 15sec and then compare that to the current time in the while loop signature. Is there a better way? Thanks! ...

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> ...

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...

While loop not working

I am inputting this text file into the command line: 800 5 10 800 1 8 800 7 7 810 2 9 845 2 10 850 1 3 first column is time,then priority,then length the output is sorted by time plus the length, and the next item is outputted if the time of the item is less than or equal to the curren...

PHP: letting your own function work with a while loop

Hi i have this code $qVraagGroepenOp = "SELECT * FROM $tabele WHERE $where"; $rVraagGroepenOp = mysql_query ( $qVraagGroepenOp ); $aVraagGroepenOp = mysql_fetch_assoc ( $rVraagGroepenOp ) and i converted that to a fucntion vraagOp("testtable","testtable_ID = $id"); function vraagOp($table,$where) { $qVraagOp = "SELECT * FROM $ta...

PHP: I Can only use this function once (using it in a While loop)

Hi, i got an answer on an older question wich is almost working i have a function: function vraagOp($table,$where) { static $rVraagOp; if(!$rVraagOp){ $qVraagOp = "SELECT * FROM $table WHERE $where"; $rVraagOp = mysql_query( $qVraagOp ); } return mysql_fetch_assoc( $rVraagOp ); } that i want to use li...

PHP - problem with nested mysql_fetch_array() driving me crazy

The MySQL query: SELECT title,alias,parent FROM '._prefix.'categories WHERE (language = \''._language.'\' || language = \'all\') && status = \'published\' ORDER BY rank ASC The Result (from phpMyAdmin): title | alias | parent Home | home | 0 Todo | todo | 0 Multiuser| todo_mu | 21 Modulsys | todo_mo...

Get a $date between start and end dates on a continuous loop

Trying to figure out a way of achieving the following scenario:- The user creates an initial time period e.g. 01/01/2013 to 01/07/2013 and a renewal period e.g. every 1 month. I'm working on a function that will:- Detect whether the date passed in a function (could be any date) falls a period matching the users requirements. For ex...

Categorising a large mysql result with php while?

I'm using the following to grab my large result set from a mysql db: $discresult = 'SELECT t.id, t.subject, t.topicimage, t.topictype, c.user_id, c.disc_id FROM topics AS t LEFT JOIN collections AS c ON t.id=c.disc_id WHERE c.user_id='.$user_id; $userdiscs = $db->query($discresult) or error('Error.', __FILE__, __LINE__, $db->error()); ...

while() and onclick..

Hi. I have this: while( $rowData = @mysql_fetch_assoc($selectRows2) ) { ?> <div id="stemmeto"><a href="#" id="thelink" onclick="window.parent.OpenVote(<? echo $_GET['id']; ?>, '<? echo $rowData['username']; ?>');"> <?php echo $rowData['username']; ?> </a></div> <div id="stemme"> <a href="#" id="thelink" onclick="window.parent.O...

echo/print issue in php while loop

I need a fix for this.here is just part of my code <?php $number = 30; while($number > 0) { $number--; sleep(30); print "$number . Posted<br>"; } ?> The loop process in the loop is actually much bigger, i just put the important stuff. Anyways as you can see it should print 30 posted (wait 30 seconds) 29 Posted (wait 30 seconds...

Looping through a JOIN'ed MySQL Associative Array

Right, so I've got a query that looks like this: $bestof_query = "SELECT * FROM physicians p JOIN (awards a, categories c, awardLevels l) ON (a.id = p.id AND c.id = a.category AND l.id = a.level) ORDER BY a.category, a.level ASC "; $query = mysql_query($bestof_query); while($result = mysql_fetch_array($query)) { extract($result); ech...

Java do while, while

Hello, what behaviour can I expect when I run this code: do while(testA) { // do stuff } while(testB); Will it behave like: do { while(testA) { // do stuff } } while(testB); Or: if(testA) { do { // do stuff } while(testA && testB); } Or something totally unexpected? I ask this question...

Looping though a while statement

Hi I have a sequence of mysql query result resources stored in a array. E.G array([0] => resource [1] => resource ...ect); This code retrieves the first resource in the array: $third_count = "0"; while ($user_result = mysql_fetch_array($user[$third_count])) { print_r($user_result); } $third_count = $third_count +1; I'm just stuck t...

How to make socket.recv(500) not stop a while loop.

I made an IRC bot which uses a while true loop to receive whatever is said. To receive I use recv(500), but that stops the loop if there isn't anything to receive, but i need the loop to continue even if there isn't anything to receive. I need a makeshift timer to continue running. Example code: /A lot of stuff/ timer=0 while 1: ti...

do while loop in C#

Hi I am new to programming in C# can some one give me an example of how to write do while loop in C# EDIT: FYI I am a VB.NET programming trying to make the move to C#, so I do have experience with .NET / VB syntax. Thanks again! ...

Using getchar() in a while loop

#include <stdio.h> main() { int c ; while ((c = getchar()) != EOF) { int isEOF = (c==EOF); printf("is %c EOF: %d ", c, isEOF); } } Why printf() method is called twice on every input char here? If i give a input 'a', I am getting the result like E:\C_workouts>gcc CharIO.c -o CharIO.exe E:\C_workouts>C...

using a While loop to control the value of a keyframe in a timeline in Javafx

i want to create an animation where the ball will move in one of the 4 sectors of a circle randomly.this will happen 5 times.so,i create a while loop(i<5) and call the random function.i then create an if loop and attach some x and y values according to the random fn value.i then create an timeline object inside the while loop and in the ...

Using a Loop to add objects to a list(python)

Hey guys so im trying to use a while loop to add objects to a list. Heres bascially what i want to do: (ill paste actually go after) class x: blah blah choice = raw_input(pick what you want to do) while(choice!=0): if(choice==1): Enter in info for the class: append object to list (A) if(choice==2):...