iterating

Sorted Dictionary in C#

Is there any way I can iterate backwards (in reverse) through a SortedDictionary in c#? Or is there a way to define the SortedDictionary in descending order to begin with? ...

Strategy for Crowd Sourcing and Iterative Development

Hi all, I've recently gotten involved with a web-based crowd sourcing project. I have two main issues, both with several subquestions. Any insight into any of these questions would be greatly appreciated. 1) Do you guys recommend going through a closed beta testing period? Or encourage as many people as you can to use the site? ...

Iterate over pairs in a list (circular fashion) in Python

The problem is easy, I want to iterate over each element of the list and the next one in pairs (wrapping the last one with the first). I've thought about two unpythonic ways of doing it: def pairs(lst): n = len(lst) for i in range(n): yield lst[i],lst[(i+1)%n] and: def pairs(lst): return zip(lst,lst[1:]+[lst[0]])...

Manually iterating a line of a file | bash

I realize I could do this in any other language - but with Bash - I've looked far and wide and could not find the answer. I need to manually increase $line in a script: Example: for line in `cat file` do foo() foo_loop(condition) { do_something_to_line($line) } done If you notice, every time the foo_loop iterates, $line stay...

Iterating over arrays in haskell

My problem is that I need to iterate over array and calculate some value depend on every element. I was looking for some fold-like function for arrays, but standard library seems to be very useless with arrays. Or i'm missing something? The other solution may be 'binding' array to a list. Binding mean that I don't want to copy that arra...

looping through set of elements in jquery

Hi, $('form td .hint p') this jquery selector returns back a list [p,p,p,p,p,p]. I would like to know what's the best way to loop through each of those, check their css values, and do something if the css value = something I want. I have this function to show and hide a tooltip, but I only want one tooltip to be shown at a time. While ...

Fastest way to iterate through an NSArray with objects and keys

Hello, I have an NSArray called 'objects' below with arrayCount = 1000. It takes about 10 secs to iterate through this array. Does anyone have a faster method of iterating through this array? Thanks! for (int i = 0; i <= arrayCount; i++) { event.latitude = [[[objects valueForKey:@"CLatitude"] objectAtIndex:i] floatValue]; event.lon...

Iterating Over Params Hash

I'm having an extremely frustrating time getting some images to upload. They are obviously being uploaded as rack/multipart but the way that I'm iterating over my params hash must be causing the problem. I could REALLY use some help, so I can stop pulling out my hair. So I've got a params hash that looks like this: Parameters: {"commi...

Iterating over a map.

In this question I'm not asking how to do it but HOW IS IT DONE. I'm trying (as an excersise) implement simple map and although I do not have problems with implementing links and they behavior (how to find next place to insert new link etc.) I'm stuck with the problem how to implement iterating over a map. When you think about it and loo...

Grails iterating through database tables

As I'm a bit new to grails, I'm wondering how I can iterate through the current data i have saved in the database to check if the information already exists. For instance, lets say I have a domain class for Books and I create an action that automatically adds more books but I want to check if the book.title already exists so I don't add...