for-loop

How to rename files in a for loop in Perl

Hi, I am running a Perl script and try to accomplish renaming files as below.. I have a list of *.ru.jp files in a folder with other non related files. I would like to rename with a number which I have got as a counter variable. In Bash,I would do as ... for i in $(ls *.ru.jp); do x=${i%%.*}; mv $i "$x"t"$counter".ru.jp ;done E.g...

How to debug PHP with netbeans and Xdebug in Windows?

Hi All, I have installed PHP using wamp server in Windows and I have give the entry for Xdebug in php.ini And Debugging not working in netbeans. How to solve this? Thanks ...

What does it mean when the first "for" parameter is blank?

I have been looking through some code and I have seen several examples where the first element of a for cycle is omitted. An example: for ( ; hole*2 <= currentSize; hole = child) What does this mean? Thanks. ...

Can you place a complex condition into a for loop?

while (status) for (int i = 0; i < 3; i++) Is the following syntactically correct: for (int i = 0; i < 3; i++ && status) I am trying to have the for loop break early if status is true. ...

When should I use a Map instead of a For Loop?

This is relating to the following: (In Python Code) for i in object: doSomething(i) versus map(doSomething, object) Both are easy to understand, and short, but is there any speed difference? Now, if doSomething had a return value we needed to check it would be returned as a list from map, and in the for loop we could either ...

Problem with for loop iterations over data from a queue

I'm having a problem reading and processing data from my server. I've spent hours debugging this and it seems as though the problem has nothing to do with the server but is really just an issue with one of my for loops. Its difficult to explain this without actually seeing the data from the server, but I'll do my best to explain this. B...

Slow Loop Execution In VB.NET 2003

I fill data in C1FLEXGRID from DataTable using for...each loop with DataRow and DataRowCollection but it gives output very slow. How can I solve it. ...

PHP - For loop only returns last variable in array

I have a strange problem where a for loop in PHP only returns the last item in my array. The array is created with SimpleXML from an XML file. The code should return this: <tags><tag value="Tag1" /><tag value="Tag2" /><tag value="Tag3" /></tags> But instead I just get: <tags><tag value="Tag3" /></tags> So it ignores all but the l...

Why doesn't Perl's for() go through all of the elements in my array?

Have a perl brain-teaser: my @l = ('a', 'b', 'c'); for (@l) { my $n = 1; print shift @l while (@l and $n --> 0); print "\n"; } What's it print? Should be a, b, and c, right? But oh wait actually there's a bug somewhere, it only prints a and b. Probably just some stupid off-by-one, should be easy to solve, right? Ok so mak...

Mailto Script in php

Hi I am new to Php.. i want to know how mailto script works in php .. and can any one pls provide a script for that.. ...

loop through all rows and columns of a gridview using C#

I have a grid view which contains 10 rows and 3 columns.. Now i want to loop through all rows and all columns of the gridview and want to add them to a datatable.. DataRow row; int rowscount = gv.Rows.Count; int columnscount = gv.Columns.Count; for (int i = 0; i < rowscount; i++) { for (int j = 0; j < columnscoun...

batch list all .xls files in folder

Hi, I have following batch files to list all the excel files in my folder: for /r %%i In (*.xls) DO echo %%i However, this will also include all excel files in subfolders of my current folder. How can I prevent that? I only want the files in the folder itself, not the subfolder. ...

AS3: Whats determines the order of: for..in

OK I am looping through the properties in an object like so: private var _propsList:Object = {'Type':'product_type' ,'Kind':'product_type_sub' ,'Stone':'primary_stone' ,'Stone Color':'primary_stone_sub' ,'Metal':'metal_type' ...

Loop though IList, but with for loop, not for each

I have a IList of objects. They are of type NHibernate.Examples.QuickStart.User. There is also an EmailAddress public string property. Now I can loop through that list with a for each loop. Is it possible to loop through a Ilist with a simple for loop? Because simply treating the IList as an array doesn't seem to work... System.Colle...

What does for(;;) mean in C#

I see the following code for (;;) { //body... } What does it mean? ...

Javascript: Using setTimeout in For...In Loop

Here's my issue. I have this function to test proxy servers. function crawl() { var oldstatus = document.getElementById('status').innerHTML; document.getElementById('status').innerHTML = oldstatus + "Crawler Started...<br />"; var url = document.getElementById('url').value; var proxys = document.getElementById('proxys')....

Is it possible to use the for loop counter in VB to change the variables being referenced each time?

We have a project that needs to gather survey data. On one particular page of the website, there are 21 questions each with a scale of 1-5 where the user selects one radio button for each question in the table. The survey is being coded in VB.NET. The data submits to an SQL database. All the radio buttons are similarly named, so only th...

Python: delete item in a list using a for-loop

Hello. I have an array with subjects and every subject has connected time. I want to compare every subjects in the list. If there are two of the same subjects, I want to add the times of both subjects, and also want to delete the second subject information (subject-name and time). But If I delete the item, the list become shorter, and I ...

Javascript: Can't stop the setTimeout

I'm working on a proxy server checker and have the following code to start the requests at intervals of roughly 5 seconds using the setTimeout function; function check() { var url = document.getElementById('url').value; var proxys = document.getElementById('proxys').value.replace(/\n/g,','); ...

Episode 77 - links instead of a for loop

In episode 77 Joel and Jeff were discussing using links instead of a for loop. I looked in Stack Overflow, Google, and Wikipedia but couldn't find any reference to a links construct. The closest thing I could find was a self referencing linked list which would presumably loop indefinitely. Is links a feature of the Links programming l...