loops

In ActionScript 3, how can I pass the current value of an array in a loop to an event listener

Code Example: var gospels : Array = ["john", "mark", "matthew", "paul"]; for each (var book : String in gospels) { var loader : URLLoader = new URLLoader(); loader.load(new URLRequest("http://example.com/" + name)); trace(book) // outputs current value of array loader.addEventListener(Event.COMPLETE, function(e : Event) : voi...

Deleting rows from a table using a loop

Why does my Do Until loop try to run raw.Delete even though raw.EOF is true? If I have an empty table, this crashes. Why? Dim raw As Recordset Set raw = db.OpenRecordset("tblSampleRaw") If raw.RecordCount > 0 Then raw.MoveFirst Do Until raw.EOF raw.MoveFirst raw.Delete Loop End If ...

Back button loop with IFRAMES

In my (school) website we use Iframes to display class blogs (on blogger). This works well EXCEPT if the user then clicks on (say) a photo inside the iframe. Blogger (in this case) then displays the photo in the whole browser window and the back button loops; that is if the back button is hit, the browser (IE, FF, Chrome) stays on the ...

Loops in MATLAB

How many times will the following loop execute? x=-4 while x <8 x=x+3 end Can anyone explain it to me? ...

sql while loop with date counter

I need to do something like this in sql: declare @StartDate varchar(10) declare @EndDate varchar(10) set @StartDate='12/31/2008' set @EndDate='1/11/2009' Declare @date varchar = @StartDate while (@date <= @EndDate) begin -- some statements set @date += 1 -- basically increment by 1 day end How can I do the above correctly in SQL? B...

Using CodeIgniter is it bad practice to load a view in a loop.

I just got started with CodeIgniter and am wondering will it slow things down if I put code like this in a loop. $data['title'] = 'the title'; $data['content'] = 'blah blah blah'; $this->load->view('result', $data); I'm not entirely sure how CodeIgniter handles things, or PHP itself for that matter. For example if I did th...

Run a PHP script every second using CLI

Hello, I have a dedicated server running Cent OS with a Parallel PLESK panel. I need to run a php script every second, that updates my database. These is no alternative way timewise, i have checked every method, it needs to be updated every second. I can find my script using the url: http://www.mysite.com/phpfile.php?key=123, and this ...

"for each" or "every" keywords in Scheme

Is there a for loop or for each loop in Scheme ? I've been searching around and found there is a keyword "every" but the scheme compiler language I'm using does not have this function pre-build in. This is what it suppose to do, it can be find here (define (first-letters sent) (every first sent)) > (first-letters '(here comes the su...

Smarty Section Making the selected Link Bold

Hello, How can i make the selected link from the List below, bold, that you see you are on Page ex. 3 or 5 With this code if you click on a Link you dont know on which page you are. The smarty code looks like this; {section name="sitelinks" start=0 loop=$total->sitelinks} <span class='tag'> <a href='/member/{$campaign->id}?start={$...

How to loop through different movie clips in AS3?

I have five movie clips in my library. I want to load each to the stage with a fade in and fade out. I thought I could just call them into an array, but I can't find how to reference them. I have other clips in the library too so I can't just grab them all. Anyone know how to do this? AS3, please. TIA ...

PHP str_replace with for loop from array

Ok I have a str_replace and what I want to do, is take values from an array, and take the next piece to replace the word "dog" with. So basically I want the $string to read: "The duck ate the cat and the pig ate the chimp" <?php $string = 'The dog ate the cat and the dog ate the chimp'; $array = array('duck','pig'); for($i=0;$i<count($...

Closure in Javascript

I have 100 elements with ids divNum0,...,divNum99. Each when clicked should call doTask with the right parameter. The code below unfortunately does not close i, and hence doTask is called with 100 for all the elements. function doTask(x) {alert(x);} for (var i=0; i<100; ++i) { document.getElementById('divNum'+i).addEventListener('c...

Loops within Switch statement

my switch statement has about ten outcome, but some of them need 1/2 loops to check, so i can't write them within case(condition), so i've tried using more than one default case, is this possible? <?php switch(true) { case 1: break; case 2: break; default: echo "this text is never printed ??"; while(true) { whi...

Checking condition inside a loop

Hi, If "flag" is true I have to perform step no. 1 otherwise skip it. Is there a way out to skip this unnecessary repetitive check within the loop. (As the value of flag is not changing while the execution of the loop) private void method(boolean flag) { while (man > woman) { if (flag) { // Step no. 1 System.ou...

Undirected (Multi) Graph (Hierholzers Algorithm)

I am very stuck with the looping structure for my graph to work out Eulers tour. This is the graph I am drawing, remember it's undirected, so a journey from N1 to N4 is the same as a journey from N4 to N1 (don't mean to be patronizing just trying to increase my chances of help). The way to solve this problem is to find a collection of ...

Loop Until Condition Reached, iPhone

Hi there, I have a problem here... After a button is pressed I want a loop to run until a condition is reached: - (IBAction)buttonclick1 ... if ((value2ForIf - valueForIf) >= 3) { ... I would like a loop to run until ((value2ForIf - valueForIf) >= 3) and then execute the code associated with the IF statement. What I am aiming t...

Integrating a simple web server into a custom main loop in python?

I have an application in python with a custom main loop (I don't believe the details are important). I'd like to integrate a simple non-blocking web server into the application which can introspect the application objects and possibly provide an interface to manipulate them. What's the best way to do this? I'd like to avoid anything tha...

as2 simple for loop not populating textbox.

I have got an xml file that brings text into a flash movie in the form of an array, I need to population some textboxes and want to do this using a for loop. My loop look like this: for(var i=0; i<first_array.length; i++){ this.animation1.text_mc[i].txt[i].htmlText = first_array[i]; } if i hardcode the path, without [i], it...

How to filter a list?

This is a method that should take already assigned users out of a list and keep non-assigned ones in a list. The GuidList has the userId added to it on a button click. The profileList is used to populate a gridView. Here is the code: private VList<VW_profiles> FilterAssigned(VList<VW_profiles> profileList) { VList<VW_profiles> sorted...

Loop through controls in TabControl

I am looking for a way to loop through controls on a particular tab of a tabcontrol. For example, I have a tabcontrol with the following tabs: Cars, Pets, Admin On each of these tabs are several controls to display/edit/save data, etc. On the "Save" button, I would like to loop through the controls for that particular tab to check wh...