for-loop

iteration in latex

Hi, I would like to use some iteration control flow to simplify the following latex code \begin{sidewaystable} \caption{A glance of images} \centering \begin{tabular}{| c ||c| c| c |c| c|| c |c| c|c|c| } \hline \backslashbox{Theme}{Class} &\multicolumn{5}{|c|}{Class 0} & \multicolumn{5}{|c|}{Class 1} \\ ...

Question about variable definitions in functions.

Hi. #include <stdio.h> main() { int a; for(a=1; a<=4 && printf("%d ",a); a++) { int a; static int b=a; printf("%d ",(a++)-b); } getchar(); getchar(); } In this code, the printout is 1 0 2 1 3 2 4 3. I understand why the int a; part works differently than the int a which was defined ou...

writing to a dataframe from a for-loop in R

I'm trying to write from a loop to a data frame in R, for example a loop like this> for (i in 1:20) { print(c(i+i,i*i,i/1))} and to write each line of 3 values to a data frame with three columns, so that each iteration takes on a new row. I've tried using matrix, with ncol=3 and filled by rows, but only get the last item from the loop...

forloop and table in latex

Hi, Here is the latex code for my table: \begin{table}{| c || c | c | c || c | c | c | } \caption{Examples of the concepts. \label{tab:conceptsimgs}}\\ \hline \backslashbox{Concept}{Class} &\multicolumn{3}{|c||}{Negative Class} & \multicolumn{3}{|c|}{Positive Class} \\ \hline \forloop{themenumber}{1}{\value{the...

Openid for app domain

Hi i tried to enter into third party website using my google apps username & password. For that i used URL as https://www.google.com/accounts/o8/site-xrds?hd=mydomain.com. I used this URL in stack overflow which directs to my domain's login after i sign in it returns "Unable to login with your openid provider Errorr occured while sendin...

use boolean value for loop

So technically a boolean is True (1) or False(0)...how can I use a boolean in a loop? so if FYEProcessing is False, run this loop one time, if FYEProcessing is true, run it twice: for (Integer i=0; i<FYEProcessing; ++i){ CreatePaymentRecords(TermDates, FYEProcessing); } ...

How to creat Alphabetical search for each category in Magento

Hello, I am newbee for Magento i want to create alphabetical search for each category in magento is there any way to do this? Example : For Categories Like: Men's - Women's In womens Page There some section in Middle of page or sidebar where all the Alphabets like # & A-Z if visitor click on A so all product start with A under womens ...

int, short, byte performance in back-to-back for-loops

(background: http://stackoverflow.com/questions/1097467/why-should-i-use-int-instead-of-a-byte-or-short-in-c) To satisfy my own curiosity about the pros and cons of using the "appropriate size" integer vs the "optimized" integer i wrote the following code which reinforced what I previously held true about int performance in .Net (and wh...

Is it possible to make a for on a NSDictionary object?

Hi, the question explains it all. For instance, if I have a NSDictionary like this first = ("a", "b", "c"), second = ("d", "e", "f") third = ("g", "h", "i") And I'd like to loop on them to make some operations. Is it possible? Thanks ...

C optimization breaks algorithm

I am programming an algorithm that contains 4 nested for loops. The problem is at at each level a pointer is updated. The innermost loop only uses 1 of the pointers. The algorithm does a complicated count. When I include a debugging statement that logs the combination of the indexes and the results of the count I get the correct answ...

What is The Loop Variable After a For Loop in Delphi?

In Delphi, consider var i: integer; begin for i := 0 to N do begin { Code } end; One might think that i = N after the for loop, but does the Delphi compiler guarantee this? Can one make the assumption that the loop variable is equal to its last value inside the loop, after a Delphi if loop? Update After trying a few si...

Scala downwards or decreasing for loop?

In scala, you often use an iterator to do a for loop in an increasing order like: for(i <- 1 to 10){ code } How would you do it so it goes from 10 to 1? I guess 10 to 1 gives an empty iterator (like usual range mathematics)? I made a scala script which solves it by calling reverse on the iterator, but it's not nice in my opinion, is ...

For-loops in Python

What is the best way of doing this in Python? for (v = n / 2 - 1; v >= 0; v--) I actually tried Google first, but as far as I can see the only solution would be to use while. ...

C - is it possible to decrement the max value of a for loop from within the for loop?

for example: void decrement(int counter) { counter--; } int counter = 20; for (int i = 0; i < counter; i++) { for (int j = 0; j < counter, j++) { decrement(counter); } } ideally, what i'd like to see is the counter var being decremented every time the for loop is run, so that it runs fewer than 20 iterations. but ...

Ruby: Is it possible to have a for loop that increases more than one at a time?

For example: for(int i = 0; i < 100; i += 2) I could use a while loop or check if i % 2 == 0, but I was wondering if there wasn't a way to do it with the for loop. I could also use for(int i = 0; i < 50; i++) and multiply i by 2, but that doesn't seem right either. I'm just wondering if there is a simple, straightforward way to do it. ...

How to replace for-loops with a functional statement in C#?

A colleague once said that God is killing a kitten every time I write a for-loop. When asked how to avoid for-loops, his answer was to use a functional language. However, if you are stuck with a non-functional language, say C#, what techniques are there to avoid for-loops or to get rid of them by refactoring? With lambda expressions and...

Range-based for statement definition redundancy

Looking at n3092, in §6.5.4 we find the equivalency for a range-based for loop. It then goes on to say what __begin and __end are equal to. It differentiates between arrays and other types, and I find this redundant (aka confusing). It says for arrays types that __begin and __end are what you expect: a pointer to the first and a pointer...

Insert Query for table

How to add data from one table to another table with new data in sql ...

Rails - Displaying Large Set of Data in a Table / Start new column after X rows

Hi, I trying to display a large set of checkboxes in my rails app and didnt knwo the syntax for displaying like 15 rows then after starting a new column. I have a model with about 120 entries. Currently, I have it being displayed in the view as.... <% for interest in Interest.find(:all) %> <%= check_box_tag Blah Blah Blah %> <%= inter...

Multiple counters in a single for loop : Python

Is it possible in Python to run multiple counters in a single for loop as in C/C++? I would want something like -- for i,j in x,range(0,len(x)): I know Python interpretes this differently and why, but I would need to run two loop counters concurrently in a single for...? Thanks, Sayan ...