loops

problem with delayed loops

I'm having a nightmare trying to get some quotes to loop with a delay. I have created the following code: function loopquotes(){ var items = $('.comment').size(); var randomNum = Math.floor(Math.random()*items+1); $(".comment:nth-child("+randomNum+")").fadeIn('slow').delay(5000); $(".comment:nth-child("+randomNum+")").fadeOut('mediu...

Linq comparing two list - learning linq

Hi I recently started learning LINQ. Bsically to understand this technology better I try to rewrite some of my previous programs using LINQ. I mean I try to replace foreach methods etc with linq queries. Today I encounterd a problem. I have a list of objects element List<Element> elementList public class Element { priv...

Do loops and while loops

When I type in the word "Andrea" the program crashes. I am guessing, but I think it's because I am inside the loop and it doesn't know when to stop. If I am correct can you tell me how to get out of the loop. when I put a break in it tells me there is no loop to end. private void button1_Click(object sender, EventArgs e) { ...

Depending on what the user choose with determine the out put

If the user enters A it works then they enter B it works and it works if they enter E it also works but if they then enter A to start over the program closes. const double COMMRATE = 0.10; const double COMMRATE = 0.10; string inputstring; char response; Console.Write("Do you want to Calculate Sales A or B or E..."); inputstring ...

What are the practical differences between while(true) and for(;;)?

I personally use while(true) for endless loops, but I've seen examples online that use for(;;). Practically speaking, are there any differences between the two, or is it just a stylistic thing? ...

for loop chcek previous ID and skip iteration if needed

I have this code, <?php foreach($information as $info) : ?> <option selected="no" value="<?php echo $info['grade_id'];?>" id="<?php echo $info['grade_id'];?>"> <?php echo $info['grade_desc'];?> </option> <?php endforeach; ?> Basically what this does is spit of some options for a select menu, however someti...

Quartz Composer: switch video inputs with mouse.

Hello. Scenario: two Quicktime movie inputs, one plays on loop unless user clicks left mouse button, in which case second movie plays until the end, then first movie plays. Logically I can see it using a conditional. If number = 1, loop movie 1. If mouse click, number = 2, movie 2 plays. At end of play, number = 1, loop movie 1. Wh...

jQuery : loop through nested objects

Hello, I would like to loop trough nested objects. here is my code : var defaults = { toolTips: { printVersion: { toolTip1: { link_s: '#mm_tooltip1_link', tooltip_s: '#mm_tooltip1' }, toolTip2: { link_s: '#mm_tooltip2_link', t...

loop for these iterations

I am trying to loop the below iteration, the code is below and i will try and break it down aswell. <?php function intr($LoanRequired, $TermMonths, $MonthlyPayment, $rate) { $intr= $LoanRequired * pow((1 + $rate), $TermMonths) + $MonthlyPayment * ((pow((1 + $rate), $TermMonths) - 1) / $rate); return $intr; } $x0=0...

How to loop on field names of a class

I have got a class which contains more then 150 fields. i need the name of fields (not value) in an array. because its very hard and not a good approach to write 150 fields name (which can be incremented or decremented in count according to requirement change) manually in code. i need help to get loop through names for field or get lis...

how to substitute a for loop in R with an optimized function (lapply?)

I've a data frame with time events on each row. In one row I've have the events types of sender (typeid=1) and on the other the events of the receiver (typeid=2). I want to calculate the delay between sender and receiver (time difference). My data is organized in a data.frame, as the following snapshot shows: dd[1:10,] timeid va...

Looping variable names in fortran 90

Hi, I have a large amount of arrays of different dimensions. However, I name them with a sequential order, say var1, var2, and so on. In order to read them, I would be interested in looping over them in something like: do i=1,n read(1,*) var<i> enddo Of course, since the arrays are of different dimensions, I cannot simply add a ...

Increasing number part of UIImageView variable in a for loop ?

Hi all, I have a three UIImageView variables called myPicture1, myPicture2 and myPicture3. In a for loop I am trying to increase the number at the end of myPicture by 1 so that I can assign a random image to each of the three variables. Here is the code below : for (i=0; i<3; i++) { int g = arc4random() % 19; NSString *imagename = [...

Dynamic Radio Button Group in Coldfusion

The user will input their Id number then the accounts tied to this Id number will be presented(radio buttons) . They could have 1 or even 10 accounts returned(radio buttons). I need to have them update their account to a Y, N. The account Id is what makes up the radio groups. Now I need to know who to loop through these radio buttons to ...

Python: Iterate a certain number of times without storing the iteration number anywhere

Hello... I was wondering if it is possible to perform a certain number of operations without storing the loop iteration number anywhere. For instance, let's say I want to print two "hello" messages on the console. Right now I know I can do: for i in range(2): print "hello" but then the "i" variable is going to take the values 0 ...

Process other application activity in long loop

I have a long running loop in an unfortunately large excel file that I'm scripting over. I seem to remember a keyword you could put in a loop statement that would cause the program to sort of temporarily "pause" the loop and process other application input, like...mouse movement, screen redraws and such. This might be a leftover memory ...

Toggle Posts in wordpress using jquery

I am trying to do something I have not seen before in wordpress. Basically, when you arrive at the blog, a title, thumbnail and an excerpt is displayed. When a toggle button is pushed, the post should slide down to reveal the content. (<?php the_content(); ?>) Here is my Jquery: $(document).ready(function() { $('span.play a')...

Simplify/Neatify this two-way loop?

I've got my wires crossed somewhere (or I had not enough sleep). I need a two-way loop, and my current code is just plain ugly. Problem: I am running along a linear datastructre using an index. I have an starting index, lets say 120. I want to run alternating into both directions. Example: 120,121,119,122,118,123,117,... I have a sto...

[C++] - GetDIBits and loop through pixels using X, Y

I'm grabbing a portion of the screen and scanning through the pixels for a certain color range. I looked at MSDN's Capturing an Image example and know how to use the functions. I can get the bits into an array, but I'm not sure how to do it in such a way that I can loop through it as I would an image. A pseudo-example (which I'm sure i...

Problem with While Loop in PHP

Any suggestion of whats wrong with my WHILE Loop? <?php include('header.php'); $manage = "current_page_item"; include('nav.php'); include('sidebar.php'); ?> <div class="primary"> <br/> <?php $userId = $_GET['id']; echo "<div class=\"item_list\">"; $sql = "SELECT * FROM user...