while

objective c: if something has something in it - do something

I want to do this: while(theString (does not have) @"this string" (in it)) { do something } ...

setTimeout stalls while loop

I set up a slide show (Slideshow()) using setTimeout, and it works fine. I need to limit the slide show to 3 repeats, but when I add a while loop (Count()) it it prints Test 1 and stalls function SlideShow() { setTimeout("document.write('Test 1')", 1500); setTimeout("document.write('Test 2')", 3000); setTimeout("document.write('...

What is the difference between infinite while loops and for loops?

I see the different conventions used in many books I had read, where you would create infinite loops with either loop structure such as: while() foo(); for(;;) foo(); But really, what are the differences I should know about? which one is better? ...

nested SQL Stored proc while not looping

I am trying to generate a set of rows for a matrix but the @xcolcount only does on loop staying at zero while the inner loop does what it needs to: Declare @xColCount int Declare @yRowCount int set @xColCount = 0 set @yRowCount = 0 WHILE (@xColCount < @widthCol) BEGIN WHILE (@yRowCount < @heightRow) BEGIN -- do the i...

Wrong or Right ? While loops.

Heya guys, now ive never done this method before and i just tried it to see if it would work and it works like a dream. Usually people tend to do this way. $tags = array(); while($row = $statement->FetchObject()) { $tags[] = $row; } but would it be faster or just less code if i done it this way. $tags = array(); while($tags[] =...

getting null value for particular column, while loading the object.

I have an entity bean which is made using Hibernate annotation. @Entity @org.hibernate.annotations.Entity(dynamicInsert=true,dynamicUpdate=true) @Table(name="[tbDDE]") public class DElement implements Serializable{ @Column(name = "[ID]", nullable = false, unique=true, updatable=false, insertable=false) @GeneratedValue(strateg...

How can I exit a while with a key ? [Python]

Possible Duplicate: How can I make a while True break if certain key is pressed? [Python] I have this code: def enterCategory(): time.sleep(0.2) if entercount == 1: mouseMove(*position[5]) while win32gui.GetCursorInfo()[1] != 65567: mouseMove(*position[5]) mouseMove(*position[4]...

Problem with While Loop in PHP

Any suggestion of whats wrong with my WHILE Loop? <?php include('header.php'); $manage = "current_page_item"; include('nav.php'); include('sidebar.php'); ?> <div class="primary"> <br/> <?php $userId = $_GET['id']; echo "<div class=\"item_list\">"; $sql = "SELECT * FROM user...

PHP While Loop Help

Here is my while loop. Any suggestions? <?php error_reporting(E_ALL); ini_set("display_errors", "on"); include('header.php'); $search = "current_page_item"; include('nav.php'); include('sidebar.php'); ?> <div class="primary"> <br/> <?php $userId = $_GET['id']; echo "<div class=\"item_list\">"; $sql = "SELECT * FROM user ...

Variable out of scope when entering a while loop in php

I have a problem when trying to populate an array in php. It seems that once I enter a while loop with a mysql_fetch_assoc method I cannot populate my array. I've included the code below. $params = $_REQUEST['params']; $arr["status"]="ok"; $projects=array(); $files=array(); $titles=array(); $query = 'SELECT p.id as pid, f.f...

Python runs a if-case that it should not!

I have this code: def random_answerlist(self): self.li = [] self.winning_button = random.randint(0, 3) i = 0 while i < 20 and len(self.li) is not 4: if i == self.winning_button: self.li.append(self.flags[self.current_flag][0]) else: new_value = self.random_value() if se...

drawing a simple triangle with a while loop

Back learning after silly life issues derailed me! I decided to switch my learning material and I'm now working through Accelerated C++. Chapter 2, Exercise 5: Write a set of "*" characters so that they form a square, a rectangle, and a triangle. I tried but just couldn't get the triangle down exactly. A quick google found the followi...

Runtime Error : RunTime Error : map/set iterators incompatible

void Manager::Simulate(Military* military, Shalishut* shalishut,char* args[]){ Simulation* simulation = Simulation::GetInstance(); Time* time = Time::GetInstance(); multimap<int,Task*>::const_iterator itTasks; itTasks = simulation->GetTasks().begin(); while(itTasks != simulation->GetTasks().end()){ while (itTa...

Why isn't my script processing all the elements in the array?

The following code is a test to test what I have already done with my new found knoledge of threads. #!/usr/bin/perl use strict; use warnings; use threads; use threads::shared; use URI; use URI::http; use File::Basename; use DBI; use HTML::Parser; use LWP::Simple; require LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(10); $...

Trying to create multiple folders with VBScript

I need to create A set of empty folders, starting at 10, going to 180. This is the script I'm trying to use, but it just creates 10, and nothing else. Option Explicit Dim objFSO, objFolder, strDirectory, i strDirectory = "\path\to\main\folder" Set objFSO = CreateObject("Scripting.FileSystemObject") i = 180 While i < 180 Set objFold...

PHP: Loop function for every 50 items

Situation: Got 160 ids in array, need to build xml requests, in sets of max 50 and submit each set separately. Problem: How to loop the function and continue with ID 51?function doBatch($ids) Simplified Code: function doBatch($ids) { $start = "<feed>"; foreach($ids as $id) { $add .= '<entry>'$id.'</entry>'; }...

Converting while to generator 3.4 times slow down

What is happening? Can somebody explain me what happens here, I changed in tight loop: ## j=i ## while j < ls - 1 and len(wordlist[j]) > lc: j+=1 j = next(j for j in range(i,ls) if len(wordlist[j]) <= lc) The commented while version ran the whole program: 625 ms, the next generator version ran the wh...

While Question in Blackjack

Making a simple Java code for Blackjack and need some advice. OK I am trying to make this loop and stop when I say "stay" any suggestions?? while ( name4.equals("stay") ) { System.out.print( "Would you like to hit or stay? " ); String name4 = keyboard.next(); total2 = total+number4; number4 = random.nextInt(9)+2; ...

Running mysql inside a while loop

I have a while loop of a mysql call but I also am trying to run another mysql query inside of the while loop but it is only doing it once. I can not figure it out. Here is my code: $sql = "SELECT * FROM widget_layout WHERE module_id=".mysql_real_escape_string($id)." AND state='".mysql_real_escape_string($page)."' AND position=".mysql_r...

TBXML While Problem

Hey everbody, I'm getting some trouble with TBXML and While. I'm trying to parse a couple of nodes of XML. My XML is this: <teste> 1 2 3 But when I set while, my app just crashes. itemsList = [[NSMutableArray alloc] init]; TBXML * tbxml = [[TBXML tbxmlWithURL:[NSURL URLWithString:@"http://localhost/dev/http/tes...