iteration

WPF DataGrid: How do you iterate in a DataGrid to get rows and columns?

Hello! How can you iterate in the rows and columns of a WPF DataGrid like with a Forms DataGridView in C#? For example, if you have Forms DataGridView you can do something like this: for(int i = 0; i < formsDataGrid1.Rows.Count; i++) { MessageBox.Show(formsDataGrid1.Rows[i].ToString()); for(int j = 0; j < formsDataGrid1.Columns.Cou...

Tree iterator, can you optimize this any further?

As a follow up to my original question about a small piece of this code I decided to ask a follow up to see if you can do better then what we came up with so far. The code below iterates over a binary tree (left/right = child/next ). I do believe there is room for one less conditional in here (the down boolean). The fastest answer wins!...

JQuery .each() callback function doesn't run on each iteration/loop

Here's what should happen. 1. Get the rel attribute of the clicked link 2. For every div with class 'entry': (i)Get its 'left' position (ii) Calculate its outer height (iii)Loop through all instances of 'a.tag_filter'. If it finds the same string in the 'rel' as the one oringinally clicked on then add 1 to 'V' and break out o...

Omaha Hi Hand Evaluator

Hi, currently im trying to port Keith Rule's Texas Holdem Hand Evaluator to Omaha Hi: Texas Holdem Evaluator and Analysis More Analysis Part1 More Analysis Part 2 After thinking more about the algorithm, I found a solution which gives me the right percentages for the hands and everyhting is fine.. But it's really really slow. How c...

JQuery if statement

I've written some JQuery code to iterate over some checkboxes on an ASP.Net web page, and am seeing 2 very strange problems with the if statement embedded in the $.each function. The code is selecting my checkboxes just fine, and as the code iterates through the $.each function I can clearly see that the objValue.checked is true or fals...

Struts forEach tag not iterating through ArrayList

I have some code! The code looks like this: <c:forEach var="element" items="%{serviceList.getServices()}"> <p>Hello!</p> </c:forEach> "serviceList" is a bean, with a method on it called getServices(). getServices() returns an ArrayList, so I naturally assumed that the above code would take the arraylist, and iterate through it...

How can I find all permutations of a string without using recursion?

Can someone help me with this: This is a program to find all the permutations of a string of any length. Need a non-recursive form of the same. ( a C language implementation is preferred) using namespace std; string swtch(string topermute, int x, int y) { string newstring = topermute; newstring[x] = newstring[y]; newstring[y] = t...

Iteration over list slices

Good day function-wizards, I want an algorithm to iterate over list slices. Slices size is set outside the function and can differ. In my mind it is something like: for list_of_x_items in fatherList: foo(list_of_x_items) Is there a way to properly define list_of_x_items or some other way of doing this? Thank you greatly. PS: u...

Basic tree in Python with a Django QuerySet

Here's where I'm exposed as the fraud of a programmer I am. I've never created a data tree. Basically, I have a table with four fields: A, B, C, and D. I need to create a tree of unordered lists based on these fields. Ultimately, it would look something like this: A1 B1 C1 D1 D2 C2 D3 D4 B2 C2 D5 D6 C3 D7 D8 A2 B2 C1...

JQuery checkbox iteration in ASP.Net C#

I'm trying to iterate over checkboxes in an ASP.Net web page, and if any of the checkboxes are checked, then I want to enable the button on the page, but if none are checked, I want to disable the button. I'm working on the sample code below to enable the button, but it isn't working correctly. Any ideas on how to fix it? <html xmln...

JQuery checkbox iteration in ASP.Net C#

I was given the code below to disable a button on an ASP.Net page if none of the checkboxes are checked, and to enable it if any checkboxes get checked. It disables the button fine when the page loads and no boxes are checked, but never hits the $('.cb').change(setButton) code to enable the button when I check one of the checkboxes. An...

Set a default iteration path for a work item type on TFS

Hi, I try to tune my Team Foundation 2005 work items. We have 5 iterations paths in the "Bug" work item type. I would like it to default to a specific value, for example Iterations.Iteration2 I tried to add a DEFAULT rule in the work item type editor but couldn't set the iteration path. How can I do that? ...

How to get index number inside $.click() of jQuery?

$("span.ws_label").click(function() { }) By selector "span.ws_label" there are 5 elements selected, when one of them is clicked, how to know which one actually? EDIT I must get the index or its id,$(this) is no use to me. ...

Using JavaScript/jQuery to generate fixtures

I'm putting together a tool for a colleague which helps to create a nice fixture list. I got about 2/3 through the tool, collecting various data ... and then I hit a brick wall. It's less of a JavaScript problem and more of a maths/processing brainblock. Lets say I have 4 teams, and they all need to play each other at home and away. Usi...

LaTeX: How do I know to stop building (programatically)?

I'm trying to build a continuous builder for my latex document, which calls latex and bibtex the appropriate number of times. It checks the myfile.fls file for all the inputs, so it seems I know what all the inputs are. But how can I tell when to stop iterating? It is enough that none of the inputs change? Note that the input files incl...

Alternatives to javascript function-based iteration (e.g. jQuery.each())

I've been watching Google Tech Talks' Speed Up Your Javascript and in talking about loops, the speaker mentions to stay away from function-based iterations such as jQuery.each() (among others, at about 24:05 in the video). He briefly explains why to avoid them which makes sense, but admittedly I don't quite understand what an alternative...

Iteration planning

We are currently trying some new ways of planning out iteration. Earlier the leaddev decided what features are in an iteration an who (which pair) is going to work on it. Aditionally he made a first guess on how long the feature will take to be implemented. Now we have a team-discussion on each feature during the iteration planning and t...

How to treat the first line of a file differently in Python?

I often need to process large text files containing headers in the first line. The headers are often treated differently to the body of the file, or my processing of the body is dependent on the headers. Either way I need to treat the first line as a special case. I could use simple line iteration and set a flag: headerProcessed = false...

Is iterator.remove() is ROBUST in all cases in java?

As in C++ iterator.remove() is not 100% safe or robust does java guarantees 100% robustness with iterator.remove()? ...

Using Embedded Dictionary for iterative charater replacement

I'm trying to understand an iterative function that that takes a string "12345" and returns all the possible misspellings based upon a dictionary of keys close to each character in the string. outerDic = {} Dict1 = {'1':'2','2':'q'} outerDic['1'] = Dict1 Dict1 = {'1':'1','2':'q','3':'w','4':'3'} outerDic['2'] = Dict1 Dict1 = {'1':'2','2...