loops

Loop a formula in excel VBA

I am trying to loop a formula in Column "D" until Column "B" doesn't have any more data. The formula I am adding to Column "D" is : IF(ISNUMBER(C5),C5,IF(C5<C4,((OFFSET(C5,2,0)-OFFSET(C5,-1,0))*A5/3+OFFSET(C5,-1,0)) ,IF(C5<>C6,((OFFSET(C5,1,0)-OFFSET(C5,-2,0))*(A5/3)+OFFSET(C5,-2,0)),""))) If someone can help me at what I am doing...

Java Loop every minute.

I want to write a loop in Java that firs starts up and goes like this: while (!x){ //wait one minute or two //execute code } I want to do this so that it does not use up system resources. What is actually going on in the code is that it goes to a website and checks to see if something is done, if it is not done, it should wa...

Can a shell loop unzip all the files in a directory?

I've seen loops to unzip all zip files in a directory. However, before I run this, I would rather make sure what I'm about to run will work right: for i in dir; do cd $i; unzip '*.zip'; rm -rf *.zip; cd ..; done Basically I want it to look at the output of "dir" see all the folders, for each directory cd into it, unzip all the zip arc...

javscript smart array loop, need some help here

var _test1 = []; _test1[88] = 'sex'; _test1[1999990] = 'hey'; for(i = 0, length = _test1.length; i < length; i++){ if(_test1[i] == 'hey'){ alert(_test1.length); } } this takes a lot of time, and there are only 2 values. Is there any way to be faster? Or to use another system that index o...

how to change the while loop condition depending on stuff?

by this question what i mean is that if, by example, someone's username is "bob" then the while loop condition will be ($i < 10), and if the username is something else then the while loop condition will be ($i > 10) if($username == "bob") { //make this while loop condition: ($i < 10) // it means: while($i <10){ so stuff} } else { ...

How do I make this loop all children recursively?

I have the following: for (var i = 0; i < children.length; i++){ if(hasClass(children[i], "lbExclude")){ children[i].parentNode.removeChild(children[i]); } }; I would like it to loop through all children's children, etc (not just the top level). I found this line, which seems to do that: for(var m = n.firstChild; m != nu...

javascript watching for variable change via a timer

I have a slide show where every 10 seconds the next image loads. Once an image loads, it waits 10 seconds (setTimeout) and then calls a function which fades it out, then calls the function again to fade in the next image. It repeats indefinitely. This works. However, at times, I'm going to want to over-ride this "function1 call -> paus...

Break nested loop in Django views.py with a function

I have a nested loop that I would like to break out of. After searching this site it seems the best practice is to put the nested loop into a function and use return to break out of it. Is it acceptable to have functions inside the views.py file that are not a view? What is the best practice for the location of this function? Here's the ...

Whats faster in Javascript a bunch of small setInterval loops, or one big one?

Just wondering if its worth it to make a monolithic loop function or just add loops were they're needed. The big loop option would just be a loop of callbacks that are added dynamically with an add function. adding a function would look like this setLoop(function(){ alert('hahaha! I\'m a really annoying loop that bugs you every t...

How to get array identifier in javascript?

Hi, how can I get the indentifier of an associative array (not Array object) in a for loop? like so: var i = 0; for(i=0;i<=myArray;i++) { if(myArray.ident == 'title') alert('The title is ' + myArray['title']); } ...

zsh: command not found: ls

I'm having a rather strange problem with zsh. When I start up my shell, everything - functions, environment vars, aliases, etc. - all work fine. I've created the following function and sourced it in zsh: clean() { path=/tmp for i in ${path}/*; do echo $i done } Running clean in the terminal works as expected, i...

merging and manupulating files in matlab

Is there a way to run a loop through a folder and process like 30 files for a month and give the average,max of each columns and write in one excel sheet or so?? I have 30 files of size [43200 x 30] I ran a different matlab scrip to generate them so the names are easy File_2010_04_01.xls , File_2010_04_02.xls ..... and so on I cannot ...

Iterating arrays in a batch file

I am writing a batch file (I asked a question on SU) to iterate over terminal servers searching for a specific user. So, I got the basic start of what I'm trying to do. Enter a user name Iterate terminal servers Display servers where user is found (they can be found on multiple servers now and again depending on how the connection is l...

Can my loop be optimized any more? (C++)

Below is my innermost loop that's run several thousand times, with input sizes of 20 - 1000 or more. This piece of code takes up 99 - 99.5% of execution time. Is there anything I can do to help squeeze any more performance out of this? I'm not looking to move this code to something like using tree codes (Barnes-Hut), but towards optimi...

Set bounds for markers generated by jQuery table loop?

I have some jQuery code that goes through a table of location results and puts corresponding pins on a map. I am having trouble figuring out how to set the bounds so that when it goes through the loop and generates the markers on the map that it zooms and pans to fit the markers in the view. I've tried implementing code from some similar...

jquery loop to create elements with retained values

Dear all, I recently asked a question about creating elements with jquery. Specifically I needed input boxes created/deleted depending on the value of a particular select box. This was answered quickly with a very nice solution as follows: $('select').change(function() { var num = parseInt($(this).val(), 10); var container = ...

How to get the next row from the Database table?

How to get the next row from the Database table? Such that the row might be incremented row that is if structure has a field called "id" then the row can be id++ or very next incremented row, but it may also b any other id containing row (NOT VERY NEXT) , (because the ids could be deleted from the table). I am using Mysql Database below...

Performance issues with repeatable loops as control part

Hey guys, In my application, i need to show made calls to the user. The user can arrange some filters, according to what they want to see. The problem is that i find it quite hard to filter the calls without losing performance. This is what i am using now : private void ProcessFilterChoice() { _filteredCalls = ServiceConne...

In languages which create a new scope each time in a loop block, a new local copy of the local loop variable is created each time in that new scope?

It seems that in language like C, Java, and Ruby (as opposed to Javascript), a new scope is created for each iteration of a loop block, and the local variable defined for the loop is actually made into a local variable every single time and recorded in this new scope? For example, in Ruby: p RUBY_VERSION $foo = [] (1..5).each do |i| ...

What does for (;;) mean in Perl?

Hello! I was looking though a fellow developers code when I saw this .. for (;;){ .... .... .... } I have never seen ";;" used in a loop. What does this do exactly? ...