for-loop

How can I show four images per row and rows can be of any no with php

Dear Friends I have a Div of Images. <div class="img_team_container"> <div class="img_team_subcontain"> <div class="img_team"><a href="#" class="btn_1" title="Dining"></a></div> </div> </div> My question is that How can I show four images per row and rows can be of any no with php. ...

Using a for statement to create variables from array

I have a set of numbers that I need to pass from a function to a few other functions before it is actually used. I figured an array is a good way to do this, however I can't remember how to do what I want to do. The code looks like this int set1; // variables that hold settings int set2; int set3; cout << "Setting 1"; cin >> set1; cou...

I want a to compare a variable with files in a directory and output the equals

I am making a bash script where I want to find files that are equal to a variable. The equals will then be used. I want to use "mogrify" to shrink a couple of image files that have the same name as the ones i gather from a list (similar to "dpkg -l"). It is not "dpkg -l" I am using but it is similar. My problem is that it prints all the...

How to skip iterations in a for loop in PHP?

I have a list of options (booked seats) from which I want to exclude certain values (e.g., 3, 4, 8 and 19). The code I have for constructing the list is: <?php for ($i=1; $i<=27; $i++) { echo "<option value=$i>$i</option>"; } ?> How do I exclude 3, 4, 8 and 19 from the list? Thanks. ...

is there a loop controlled by time in c++?

Hi, I am wondering if I can loop x times in one minute interval between each loop. for (int x = 10; x > 0; x--) { cout << "BOOM" << endl; } Is there any way I can print boom every one minute? Or there is a better way to do this? Thank you ...

Pagination not working for the json in JqGrid

My pagination is not working when I removed the loadonce:true ...but if I use loadonce:true than my grid is not working. Any idea how can I get my pagination work again. update: this is extension to http://stackoverflow.com/questions/3610173/problem-loading-data-in-details-jqgrid-from-master-grid ...

How to grep a file using search parameters from another file

I am trying to use a file containing IP addresses as the basis for searching through a Cisco firewall configuration file. Normally, I would use something like: for i in $(cat ip.file); do grep $i fw.config; done But doing that returns absolutely nothing. If I put the above script into a file and execute it with the bash -xv flags, e...

Question about the for loop in javascript ?

In the following code why the variable 'a' refer to the index rather than the value ? for (var a in Values) { alert(Values[a]); } ...

What loop is faster, while or for

You can get the same output with for and while loops: WHILE $i = 0; while ($i <= 10){ print $i."\n"; $i++; }; FOR for ($i = 0; $i <= 10; $i++){ print $i."\n"; } But which one is faster? ...

Speed Comparison and suggestion for wise case in Matlab

Case 1: I have a nested for loop to run large realizations and save variables generated through that loop in .mat files, which I can later use in another program. Case 2: I can make the function of the above mentioned loop and call it directly in the other program where I want to use the variables generated by the above loop. The only...

JS for loop issue

Hi all, I've got the below code... var ToggleButtons=new Array(); ToggleButtons[0] = "#Click"; ToggleButtons[1] = "#DoubleClick"; ToggleButtons[2] = "#Drag"; ToggleButtons[3] = "#RightClick"; ToggleButtons[4] = "#MiddleClick"; function SelectButton(id) { var x = 0; for (x = 0; x++; x < ToggleButtons.length) { if (x ==...

Nested For Loops Using List Comprehension

If I had two strings, 'abc' and 'def', I could get all combinations of them using two for loops: for j in s1: for k in s2: print(j, k) However, I would like to be able to do this using list comprehension. I've tried many ways, but have never managed to get it. Does anyone know how to do this? ...

JavaScript for loop is making the UI unresponsive

Hello, I'm making a mailing list script that takes advantage of ajax (async=false) to send emails in chunks. Basically the cycle is this: var i = 0; for(i;i<num_rows;i=i+mxt){ if($("#panic").val()=='1'){ break; } perc = (i*100)/num_rows; startThread(i,perc); } Tha panic value is set by a button, the problem is...

determine if an int is a power of 2 or not in a single line

Possible Duplicate: How to check if a number is a power of 2 I made the following code but its not working.The compiler gives an error that for missing ) and expression syntax error.I would also like to know how will the operators proceed?From left to right or right to left? #include <stdio.h> #include <limits.h> #include <ma...

What is this in html page? How it will support SEO?

<link rev="made" href="mailto:test.com"> ...

How to dynamically update values to arguments in Python loop?

Hello all, Python newbie here: I'm writing a market simulation in Python using Pysage, and want to generate an arbitrary number of agents (either buyers or sellers) using the mgr.register_actor() function, as follows: for name, maxValuation, endowment, id in xrange(5): mgr.register_actor(Buyer(name="buyer001", maxValuation=100, end...

Simple for loop not working.

I've just started learning programming. I'm studying for loops but this program does not work as expected. I want to break the loop when $a is equal to 3 so that I get the output 1 2 but I get 3 as output :( for($a=0;$a<10;++$a) { if($a==3) break print"$a "; } Please help. ...

Python: Nested for loops or "next" statement

I'm a rookie hobbyist and I nest for loops when I write python, like so: dict = { key1: {subkey/value1: value2} ... keyn: {subkeyn/valuen: valuen+1} } for key in dict: for subkey/value in key: do it to it I'm aware of a "next" keyword that would accomplish the same goal in one line (I asked a question abo...

Python - Way to distinguish between item index in a list and item's contents in a FOR loop?

For instance, if I wanted to cycle through a list and perform some operation on all but the final list entry, I could do this: z = [1,2,3,4,2] for item in z: if item != z[-1]: print z.index(item) But instead of getting the output "...0 1 2 3," I'd get "...0 2 3." Is there a way to perform an operation on all but t...

Django, simplest forloop, how? (i=0; i<20; i++)

I just need to generate some test content for my template. Something like: {{ for i < 20 }} <img src="image-{{i}}.jpg " /> {{ endfor }} I have no list, how should I proceed? ...