for-loop

for loop in vb.net add a counter to existing string

i hae a for loop which goes like this - for i = 0 as integer to 100 result &= "Name" & sqldr("name") result &= "Lastname" & sqldr("lastname") result &= "dob" & sqldr("dob") next the sqldr is the sql datareader (not important here) i want my end result to be Name1 = Sam Lastname1 = Davis dob1 = 01/01/1966 Name2 = ... Na...

for loop for a string variable

this is my code - for i as integer = 0 to rows.count - 1 output &= "Name =" & row(i)("Name") output &= "lastName =" & row(i)("lastName") ... 50 more fields next i need the output to be like this Applicant1Name = MikeApplicant1lastName = ditkaApplicant2Name = TomApplicant2lastName = Brady ... how do i do this without putting th...

Using a "pseudo operator" to distinguish simple repetition from general for loops

I would like to know other people's opinion on the following style of writing a for loop: for (int rep = numberOfReps; rep --> 0 ;) { // do something that you simply want to repeat numberOfReps times } The reason why I invented this style is to distinguish it from the more general case of for loops. I only use this when I need to s...

How to calculate Min and Max values for IEEE Extended Double precision?

I know that the min and values are: 3.362... 10-4932 1.189... 10+4932 and log(2^14)~4932 which gives me the exponential part. But I can't figure out mantissa. ...

Using a for loop to print a pattern in java

I am trying to print out this pattern using a for loop in java but I am kind of stuck. zzzzz azzzz aazzz aaazz aaaaz aaaaa I can print: a aa aaa aaaa aaaaa using: String i = " "; int a = 0; for (i="a";i.length()<=5;i=i+"a") System.out.println(i); and zzzzz zzzz zzz zz z using: String i = " "; for (i=...

How to: Limit a php function to one result

Very quick question, I think the tiredness is getting to me; How would I limit this query so it only gives me one result? Code: function next_prodn_header() { $StartDate = get('start_date'); $timestamp = strtotime($StartDate); $EndDate = get('end_date'); $Now = strtotime(date('d-m-Y')); $Start = strtotime($EndDat...

Java Enhanced For Loop

How would I write the following for loop using an enhanced for loop> int [] info = {1,2,3,4,5,6,7,8,9,10}; int i; for (i = 0; i < info.length; i++) { if ((i+1) % 10 == 0) System.out.println(info[i]); else System.out.println(info[i] + ", "); } ...

Add ListBox items from Dataset

hi there, I have this C# code. j = myAccountDataset.Tables["AccountsTables"].Rows.Count; for (i = 0; i <= (j - 1); i++ ) { listAccountList.Items.Add(myAccountDataset.Tables[0].Rows[i][1]); } this.listAccountList.SelectedIndex = 0; the idea is to ite...

Help me summarize these scripts.

its like pyramid where each object will have 2 object under it for 4 layers. if (myXML.MEMBER[1].@AVAILABILITY=="NO") { circlesArray[0][0].mouseEnabled=false; TweenLite.to(circlesArray[0][0],0.8,{tint:0x333333}); manArray[0][0].mouseEnabled=false; TweenLite.to(manArray[0][0],0,{tint:0x666...

How can I create an empty array in objective C, and assign value into it one by one?

In Java, I can do that : int[] abc = new int[10]; for(int i=0; i<abc.length; i++){ abc[i] = i; } How can I implement similar thing in Objective C? I see some answer using NSMutableArray, wt's different between this and NSArray? ...

Multiple Counter Problem In For Loop

Why is this not valid for( int i = 0, int x = 0; some condition; ++i, ++x ) and this is int i, x; for( i = 0, x = 0; some condition; ++i, ++x ) Thanks ...

Ugly combination of generator expression with for loop

The following appears in my Python 2.6 code: for src, dst in ([s,d] for s in universe for d in universe if s != d): Can I do much better? What I particularly don't like is that I'm in effect specifying the same pair twice, once for the for loop and again for the generator expression. I'm uncertain whether I'd prefer: for src, dst in ...

returning out of for-loop

I'm pretty new at python and I was wondering if this: def func(self, foo): for foo in self.list: if foo.boolfunc(): return True return False is good practice. Can I return out of a loop like the above or should i use a while-loop, like so? def func(self, foo): found = false while(not found & i < len(self.li...

Avoiding nesting two for loops

Hi, Please have a look at the code below: import string from collections import defaultdict first_complex=open( "residue_a_chain_a_b_backup.txt", "r" ) first_complex_lines=first_complex.readlines() first_complex_lines=map( string.strip, first_complex_lines ) first_complex.close() second_complex=open( "residue_a_chain_a_c_backup.txt"...

Better looping, for string manipulation (python)

If i have this code s = 'abcdefghi' for grp in (s[:3],s[3:6],s[6:]): print "'%s'"%(grp) total = calc_total(grp) if (grp==s[:3]): # more code than this p = total + random_value x1 = my_function(p) if (grp==s[3:6]): # more code than this p = total + x1 x2 = my_function(p) ...

How to modify position of children inside loop in AS3

I'm trying to make a dynamic image gallery from and xml. From my tutorials, right now i've got it so it will constantly add the next thumbnail below the other, which is fine, but I'm trying to figure out how to make it that once it reaches a certain y coordinate, it will move the x coordinate over and stack them again. So that rather one...

Explain "speak here" app for loop?

for(LevelMeter *thisMeter in _subLevelMeters){ { xxxxx } I am new to iphone development.I am doing research on voice recording in iphone .I have downloaded the "speak here " sample program from Apple.I came across the above code in the sample program.I cant understand the for loop.LevelMeter is separate class._subLevelMeters is a NSAr...

More efficient solution to loop nesting required

I am trying to compare two files. I will list the two file content: File 1 File 2 "d.complex.1" "d.complex.1" 1 4 5 5 48 47 65 21 d.complex.10 ...

What is the best alternative to calling strlen() in my for loop condition in C?

I've read that it is bad practice to call strlen() in my for loop condition, because this is an O(N) operation. However, when looking at alternatives I see two possible solutions: int len = strlen(somestring); for(int i = 0; i < len; i++) { } or... for(int i = 0; somestring[i] != '\0'; i++) { } Now, the second option seems...

For loop for object?

Hello, I have the next code in javascript. I deleted some unnecessary items because it went to long. var options = { dhcode: true, commands: { bold: { enabled: true, view: true, exec: true, cmd: 'bold', param: null }, italic: { enabl...