loops

google maps call within a For Loop not returning distance

Hi, I am calling google maps within a for loop in my javascript as I have mulitple routes that need to be costed separately based on distances. Everything works great except that the distance is only returned for one of the routes. I have a feeling that it is something to do with the way I have the items declared within the ajax call ...

Fade between looped background images using jQuery

I'm trying to get the background image of a legacy div (by which I mean it already has a background image, which I cannot control & thus have to initially over-write) to smoothly fade between new images indefinitely. Here's what I have so far: var images = [ "/images/home/19041085158.jpg", "/images/home/19041085513.jpg", "/images/hom...

Allowed Values list in drupal CCK Fields

Hello, I'm basically looking to simply print out each of the allowed values in a CCK field.. i know the allowed values are stored inside a text field within the table: 'content_node_field'. the values are then stored within 'global_settings' I'm looking to somehow print out each individual allowed value using a PHP loop. however wit...

Parsing a loop with ANTLR

Hello, I want to parser a simple matlab-like for-loop, using ANTLR. The loop is like : for i=1:8 y(i) = a(i) + i; end I want to parse the loop and parse 8 times the y(i) = a(i) + i statement, in order to do some actions on each statement. My rule is as follows (actions are described in C#) : forloop @init { string ...

Loop with a while

Very basic question.. but I'm missing the point.. I have this data on my table: ID SITEID SECTION 1 1 posts 2 2 posts 3 1 aboutme 4 1 contact 5 2 questions The output is an array. I can't change it. I want to make this output on php with a single for loop with that array: <h1> sections for site 1 </h1>...

VB working with SQL DB - end of row count, keeps looping

I'm adding to a combo box an ID and a name that I'm pulling from a database. My problem is that for some reason my loop doesn't end once it reaches the end of the records in the database table. Here's my code: For intcount = 0 To dtOrders.Rows.Count - 1 cmbSearch.Items.Add(dtOrders.Rows(intcount)("EmployeeID").ToString & " "...

Looping through the days of the week inside of C# TimeSpan Class

Hi, I'm trying to loop through EACH DAYof the WEEK between 2 time periods DateTime start = new DateTime(2010, 1, 1); DateTime end = new DateTime(2011, 12, 12); I have managed to get the number of days between these dates using the following code TimeSpan range = (end - start); turn out to be 710. I am now looking to get ...

matching an element's class to another element's ID, or *part* of another element's ID

hello again Such a simple concept but I'm struggling to express it ... apologies in advance for my verbosity. I have a container div with a class, e.g., ; I want to use that class to do two things: add a class (e.g., 'active') to the nav element whose ID matches the class of div#container (e.g., #nav-primary li# apples) add the same...

jQuery ajax inside a loop problem

Hello, This js loop script always get the last value of ui_item inside a jquery ajax funciton. How can a catch the correct value of each iteration? for (var i = 0; i <= split_files_cb_value_holder.length - 1; i++){ var split_values = split_files_cb_value_holder[i].split(':'); ui_item = split_files_cb_value_holder[i]; $.aj...

Efficiency of manually written loops vs operator overloads (C++)

Hi all, in the program I'm working on I have 3-element arrays, which I use as mathematical vectors for all intents and purposes. Through the course of writing my code, I was tempted to just roll my own Vector class with simple +, -, *, /, etc overloads so I can simplify statements like: for (int i = 0; i < 3; i++) r[i] = r1[i] - r...

Grouping Months of a particular Time span together using DateTime.

public static string TimeLine2(this HtmlHelper helper, string myString2) { StringBuilder myString3 = new StringBuilder(); DateTime start = new DateTime(2010, 1, 1); DateTime end = new DateTime(2011, 12, 12); myString3.Append("<table>"); myString3.Append("<tr>"); for (DateTime date = start; date <= end;...

php foreach getting values from an array

I am having trouble accessing the values in an array, the array looks like this, Array ( [0] => Array ( [id] => 1661 [code] => 849651318 [job_status] => 4 [looking_for] => Lorem ipsum [keywords_education] => Derby University [sector_id_csv] => 10,21,9,...

Loops in ada and the implementation

Below is a piece of code shown and doubts are regarding the implementation of loops C := character'last; --'// SO code colorizer hack I := 1; K : loop Done := C = character'first; --' Count2 := I; Exit K when Done; C := ...

Can I use "map" as a substitute for "for each"/"for in"?

For a little while now javascript has the "map" function to loop over arrays. It appears possible to use it as a 'foreach' operator for example: fruitbowl.map(function(fruit){ ... do stuff with fruit }) Is this better or worse than saying for(var i in fruitbowl){ ... do stuff with fruitbowl[i]...

AJAX call in a continuously loop?

Hi, I want to create some kind of AJAX script or call that continuously will check a MySQL database if any new messages has arrived. When there is a new message in the database, the AJAX script should invoke a kind of alert box or message box. I’m not quite a AJAX expert (yet anyway) and have Googled around to find a solution but I’m h...

jquery for each function

I have added a show more or less function to a div - this all works fine however now i need to only allow this functionality if a element is over a certain height in this case. there are numerous classes of the same so i need to do the check on each element. although i am having problems getting it to work see code below : $(document)....

Looking for a jQuery plugin that scrolls HTML content continuously on mouseover and in a loop

I've looked at a lot of various jQuery plugins that I thought I could tweak to get working the way I want but so far have been unsuccessful. I'm not sure if there is a plugin out there that meets these requirements or if I should just write my own (although I'm a bit of a novice!). The requirements: Scroll HTML containers left/right ...

How can I reset addAttributeToFilter in Magento searches

I'm having problems getting the addAttributeToFilter function within a loop to behave in Magento. I have test data in my store to support searches for all of the following data; $attributeSelections=array( array('size' => 44, 'color' => 67, 'manufacturer' => 17), array('size' => 43, 'color' => 69, 'manufacturer' ...

Alternative to Nested Loop For Comparison

I'm currently writing a program that needs to compare each file in an ArrayList of variable size. Right now, the way I'm doing this is through a nested code loop: if(tempList.size()>1){ for(int i=0;i<=tempList.size()-1;i++) //Nested loops. I should feel dirty? for(int j=i+1;j<=tempL...

ASM programming, how to use loop?

Hello. Im first time here.I am a college student. I've created a simple program by using assembly language. And im wondering if i can use loop method to run it almost samething as what it does below the program i posted. and im also eager to find someome who i can talk through MSN messanger so i can ask you questions right away.(if possi...