iteration

Is there a map without result in python?

Sometimes, I just want to execute a function for a list of entries -- eg.: for x in wowList: installWow(x, 'installed by me') Sometimes I need this stuff for module initialization, so I don't want to have a footprint like x in global namespace. One solution would be to just use map together with lambda: map(lambda x: installWow(x,...

How do I get the current sequence number in an iteration in F#?

Consider the following code to demonstrate the question: let sequence = Seq.initInfinite (fun _ -> "Element") Seq.iter (fun _ -> printf "Element no: ?") sequence Is it in any way possible to get the current sequence number (e.g. its rank) to print? ...

Iterating a JavaScript object's properties using jQuery

Is there a jQuery way to perform iteration over an object's members, such as in: for (var member in obj) { ... } I just don't like this for sticking out from amongst my lovely jQuery notation! ...

How to assign event callbacks iterating an array in javascript (jQuery)

I'm generating an unordered list through javascript (using jQuery). Each listitem must receive its own event listener for the 'click'-event. However, I'm having trouble getting the right callback attached to the right item. A (stripped) code sample might clear things up a bit: for(class_id in classes) { callback = function() { this....

Remove Elements from a HashSet while Iterating

So, if I try to remove elements from a Java HashSet while iterating, I get a ConcurrentModificationException. What is the best way to remove a subset of the elements from a HashSet as in the following example? Set<Integer> set = new HashSet<Integer>(); for(int i = 0; i < 10; i++) set.add(i); // Throws ConcurrentModificationExcept...

Why doesn't Perl's each() iterate through the entire hash the second time?

Hi, I have a simple script trying to learn about hashes in Perl. #!/usr/bin/perl my %set = ( -a => 'aaa', -b => 'bbb', -c => 'ccc', -d => 'ddd', -e => 'eee', -f => 'fff', -g => 'ggg' ); print "Iterate up to ggg...\n"; while ( my ($key, $val) = each %set ) { print "$key -> $val \n"; last if ($val e...

Gallery Iteration

I'm working on an image gallery that looks up all of the images that I have uploaded, and allows me to display them 5 at a time on a single page. The problem is, i'm unsure about how to approach this. I have $_GET['max'], which is supposed to be the top most image to be displayed. $min would be $_GET['max'] - 5. In the event that the...

Finding IterationID in TFS

Hi - we are linking Iterations within TFS to an external system for tracking projects through the entire company. In the past, we were linking using the IterationPath in a TFS Project, but the problem is that people rename these IterationPaths as the projects progress, and the link is lost. So after some research, I'm thinking of doing t...

Iterate over a string 2 (or n) characters at a time in Python

Earlier today I needed to iterate over a string 2 characters at a time for parsing a string formatted like "+c-R+D-E" (there are a few extra letters). I ended up with this, which works, but it looks ugly. I ended up commenting what it was doing because it felt non-obvious. It almost seems pythonic, but not quite. # Might not be exact...

plsql cursor iterating problem

hi everyone, i use oracle demo schema scott to do some plsql test ( the data in that schema are never changed ). i wrote the following program to get the employee number of each department. the problem is, there is just 4 departments but my program output 5 row. i can't find out the reason, anyone can help? great thanks. declare cur...

How to iterate through a list that is being modified?

I have a list of rows from a dataset that I need to iterate through. The problem is that the processing in the iteration may delete one or more rows from the list. Since the list is being modified, I can't use a foreach() loop. But since it is possible some of the deletions may occur at elements BEFORE the one I'm processing, I also ...

Iterative find/replace from a list of tuples in Python

I have a list of tuples, each containing a find/replace value that I would like to apply to a string. What would be the most efficient way to do so? I will be applying this iteratively, so performance is my biggest concern. More concretely, what would the innards of processThis() look like? x = 'find1, find2, find3' y = [('find1', 'rep...

Recursion/iteration troubles, transforming an array of words into phrases

I'm trying to build a list of "phrases" using an array of word lists. I have an array that looks something like this: [ [ 'big', 'small', 'wild' ], [ 'brown', 'black', 'spotted' ], [ 'cat', 'dog' ] ] The first array is the first word in the resulting "phrase", the second array is the second word, and so on. The number of word list...

How do I create a "two pass" package in SSIS to get extra details?

I need to create an SSIS package that will do the following: Connect to Service A and download recent activity records. These records contain an User Id and an activity code. Iterate through the results of the result set from Service A and connect to Service B retrieve additional details for each User Id (name, department, etc.). Put a...

Remove items from a list while iterating in Python

Hi, I'm iterating over a list of tuples in Python, and am attempting to remove them if they meet certain criteria. for tup in somelist: if determine(tup): code_to_remove_tup What should I use in place of code_to_remove_tup? I can't figure out how to remove the item in this fashion. ...

What is the difference between Sprint and Iteration in Scrum and length of each Sprint?

Is there a difference between Sprint and an Iteration or one can have Iterations within a Sprint or Sprint is just the terminology used instead of Iteration in Scrum? It will be helpful if someone can throw some light on this. Suppose there are 4 sprints and you have decided the first sprint will go up to 10 days is it required that oth...

What are estimate points ,Story points and how to measure them in SCRUM?

Lets take an example suppose we got 5 stories A,B and C,D,E. Importance Name Estimate 90 B 70 A 50 C 35 E 10 D The stories are ordered based on their importance(priority) now how you do estimate them? Is it estimated based on size of the feature? If so what does that numeric Value so for exam...

Iterating over Json collection using JQuery iterates over chars of the data string

I am using ASP.MVC 1 to return an IEnumerable of objects (say, Cars): public class Car : Entity<Car> { public virtual string Make { get; set; } public virtual double Length { get; set; } public virtual string Colour { get; set; } } like this: [AcceptVerbs(HttpVerbs.Post)] public JsonResult GetRoutes() { IEnumerable<Ca...

Iterate through "linked list" in one SQL query?

I have a table that looks basically like this: id | redirectid | data where the redirectid is an id to another row. Basically if a row is selected, and it has a redirectid, then the redirectid data should be used in it's place. There may be multiple redirects until redirectid is NULL. Essentially these redirects form a linked list ...

STL queue iteration

I need to iterate over a queue. www.cplusplus.com says: By default, if no container class is specified for a particular queue class, the standard container class template deque is used. So can I somehow get to the queue's underlying deque and iterate over it? Thanks. ...