loops

Removing Special Characters and bulk renaming

Hello, I am trying to make a shell script to remove special characters, like {}()!,' etc. So far I have referenced a past question I asked here, however I get a strange error message: -bash-3.2$ ./test2.sh ./test2.sh: line 7: unexpected EOF while looking for matching `"' ./test2.sh: line 10: syntax error: unexpected end of file test2....

While loop, doesn't seem to do anything?

Hi there i'm trying to make a function in C++ that takes a number, i, and decides if it is a prime number or not by running through a loop to find it's multiples, and then makes sure it isn't prime through a series of test. However, it seems the loop isn't even being run through. I've told it to output no matter where in the loop it is, ...

Looping over ul li's using jQuery and storing current nav item

Hi, I am looping over the first set of li a tags in my UL and getting the height so that I can deliver a different background image if the a > span > span text wraps across two or three lines. I need to be able to store these specific buttons in an array, so that when I mouse over them, the current span with double line text receives a...

Using JavaScript (jQuery), how can I cycle through all 'a' tags on a page, one at a time, and assign an individual style to each?

Let me try to explain... Lets say I have the following 'a' tags on a page: <a href="img1.jpg" class="myClass" alt="0,0,600,200"></a> <a href="img2.jpg" class="myClass" alt="200,0,600,75"></a> <a href="img3.jpg" class="myClass" alt="275,0,600,200"></a> <a href="img4.jpg" class="myClass" alt="475,0,600,50"></a> <a href="img5.jpg" class="m...

RecursiveIteratorIterator last child

I iterate through a multidimensional array with RecursiveIteratorIterator and would like to be able to know if the current element is the last child of it's depth. I thought about this: $iterator = new RecursiveIteratorIterator($array, RecursiveIteratorIterator::SELF_FIRST); foreach ($iterator as $val) { $next = clone $iterator;...

Loop issue on treeview

Hi, This maybe something really simple but I got a really strange issue where a loop i have written to populate menu items to a treeview is not displaying childnode id. The data it is pulling is in the following format on the sql. OptionID OptionText displayOrder parentOptionID optionDeleted 226 test me...

js render loop that breaks once a condition is met

How do I set up a setInterval render loop that breaks, once a condition is met? ...

C# getting all colors from Color

I want to make a ComboBox filled with all the colors from System.Drawing.Color But I can't seem to collect all the colors from that collection I've already tried using a foreach to do the job like this: foreach (Color clr in Color) { } But all I get is an error. So how can I loop trough all the colors? Any help will be ...

Trying to create multiple folders with VBScript

I need to create A set of empty folders, starting at 10, going to 180. This is the script I'm trying to use, but it just creates 10, and nothing else. Option Explicit Dim objFSO, objFolder, strDirectory, i strDirectory = "\path\to\main\folder" Set objFSO = CreateObject("Scripting.FileSystemObject") i = 180 While i < 180 Set objFold...

Bash echo all array members when array is referenced as a variable in a loop

The "echo" below is failing and I am too retarded to figure out why. I am simply trying to echo all of the array members in my loop. #!/bin/bash foo=bar1,bar2 for i in ${foo//,/" "} do declare -a ${i}='(null null null null)' echo ${i[*]} done Thanks for any help! ...

Why does this go into an infinite loop?

Hi, I'm a teacher, and yesterday a student wrote the following code: public class Tests { public static void main(String[] args) throws Exception { int x = 0; while(x<3) { x = x++; System.out.println(x); } } } we know he should have writen just x++ or x=x+1, but on x = x++; it s...

Qt:how to give a delay in loop execution

hello, In my application I want that when a loop is being executed,each time the control transfers to the loop,each execution must be delayed with a particular time.Can anyone tell me how can i do this? Thank you. ...

Question on consequences of a very large loop

When looping through a very large language (say in C# 1.0), which is, for example, 5,000,000 loop iterations, what problems may this cause (performance/GC etc). This is only for the loop body. ...

Javascript, setTimeout in while() loop / race condition

Hi all, I am thinked to try to synchronizing two scripts (own firefox extension and greasemonkey's unsafeWindow.VARIABLE); In extension: window.ISS_NEED_SEND = 0; window.SENDWHAT = 0; while ... { if (window.ISS_NEED_SEND === 1) { writeFile(window.SENDWHAT); // safe synchronous call. window.ISS_NEED_SEND = 0; } In Greasemonkey:...

python app gets stuck on shuffle and loop

I am working on this small little piece in python and when I run it, It never gets past the print 'c' line and is stuck on the while loop. What am I doing wrong? link to text file: http://downloads.sourceforge.net/wordlist/12dicts-5.0.zip enter code here import sys import random inp = open('5desk.txt', 'r') lis = inp.readlines() inp.cl...

C++ - Window Message loop is freezing

I have this class here that I made based on another one I had. It is supposed to handle the whole creating windows and stuff, but it seems to be getting into a hang now. The older version used to work fine, I don't know WHAT I may have forgotten to add to this one that might be causing it to hang like this. This is the message loop: ...

n coins. Which is fake?

Possible Duplicate: Algorithm to find minimum number of weighings required to find defective ball from a set of n balls We have n coins. One of them is fake, which is heavier or lighter (we don't know). We have scales with 2 plates. How can we get the fake coin in p moves? Can you give me a hand for writing such a program? No...

Why does this go into an infinite loop?

Okay, so I'm trying to create a list of he folders, and sub-folders and their files, but right now it doesn't print anything, and seems to be going into an infinite loop. Any idea why? //infinate loop start for(int j = 0; j < (int) dirs[i].folders.size(); j++){ dirs.push_back(Directory(dirs[i].folders[j])); ...

How to unit-test an event loop?

Hi there, I'm programming an HTTP proxy in Python (transparent proxy for request/response monitoring). But as a TDD adopter, I'm starting the project with HTTP inputs that should be caught by a TCP server. But, as any server, it must run within an event loop, so that it can listen in a specific port. Well, since starting the event loop...

Help with For Loop. Values repeating

$teams = array(1, 2, 3, 4, 5, 6, 7, 8); $game1 = array(2, 4, 6, 8); $game2 = array(); if teams[x] is not in game1 then insert into game2 for($i = 0; $i < count($teams); $i++){ for($j = 0; $j < count($game1); $j++){ if($teams[$i] == $game1[$j]){ break; } else { array_push($game2, $teams[$i]);...