list

Listing Files With CheckBoxes (C# / WinForms)

I want a way to list files in a directory and putting a check box beside each one of them so I can select some of them and perform operations with each selected file, what's the best way to do this? ...

Generic list manipulation function in C?

What is a generic list manipulation function in C? (I saw this when I was going through some materials.) What is the difference between this function and a function which can accept elements of any kind? Are they same...? How can we implement them individually if they are not same? ...

Storing and updating lists in Python dictionaries: why does this happen?

Hello, I have a list of data that looks like the following: // timestep,x_position,y_position 0,4,7 0,2,7 0,9,5 0,6,7 1,2,5 1,4,7 1,9,0 1,6,8 ... and I want to make this look like: 0, (4,7), (2,7), (9,5), (6,7) 1, (2,5), (4,7), (9,0), (6.8) My plan was to use a dictionary, where the value of t is the key for the dictionary, and t...

How can I replace empty elements in an array with "OTHER"?

My list (@degree) is built from a SQL command. The NVL command in the SQL isn't working, neither are tests such as: if (@degree[$i] == "") if (@degree[$i] == " ") if (@degree[$i] == '') if (@degree[$i] == -1) if (@degree[$i] == 0) if (@degree[$i] == ()) if (@degree[$i] == undef) $i is a counter variable in a for loop. Basically it goe...

List iterator not incrementable error message in C++

Hi there, As a newbie I'm trying to implement a sorting function in C++, using the list-class. However, running the code I get the error that the list iterator is not incrementable... However it seems very unlikely as it should be incrementable! code: void shuffle (list<int> &list1) { list<int> smaller; list<int> larger; ...

Back to basics; for-loops, arrays/vectors/lists, and optimization

I was working on some code recently and came across a method that had 3 for-loops that worked on 2 different arrays. Basically, what was happening was a foreach loop would walk through a vector and convert a DateTime from an object, and then another foreach loop would convert a long value from an object. Each of these loops would store...

How do I insert a DOM element in an ordered list (in Dojo)?

I'm trying to make an AJAXy submission and have the resulting partial be inserted into my list at the proper place. I can think of a few options, but none is terribly good: Option 1: Return JSON, do rendering in Javascript. That seems like the wrong place to render this, especially since the list itself is rendered in my application s...

Flex List control more than a String ?

Hi flexers, I have a list control where i want to show a string (thats fine) but a colored square as well. Imagine i have a "add player" button a text input with a color picker. I want to see the color + player name in the List. How could i do this ? [Bindable] public var data:ArrayCollection = new ArrayCollection(); <mx:List id="...

How to access the Index Of A Generic.List By Reflection??

ok, ive a class and i pass an object as property. the object that i pass is a List<X> in my class im trying to access the Object index by reflection BUT I CAN'T!!! Example: this class works i just wrote down the part i want to show you and i need help. class MyClass { private object _recordSet; public object RecordSet {...

Good algorithm for combining items from N lists into one with balanced distribution?

Let's say I have the three following lists A1 A2 A3 B1 B2 C1 C2 C3 C4 C5 I'd like to combine them into a single list, with the items from each list as evenly distributed as possible sorta like this: C1 A1 C2 B1 C3 A2 C4 B2 A3 C5 I'm using .NET 3.5/C# but I'm looking more for how to approach it then specific code. EDIT: I need ...

List.Add seems to be duplicating entries. What's wrong?

I have a class like this: public class myClass { public List<myOtherClass> anewlist = new List<myOtherClass>; public void addToList(myOtherClass tmp) { anewList.Add(tmp); } } So I call "addToList" a hundred times, each adding a unique item to the list. I've tested my items to show that before I run the "addToList" metho...

Creating a list of objects in Python

Hi, I'm trying to create a Python script that opens several databases and compares their contents. In the process of creating that script, I've run into a problem in creating a list whose contents are objects that I've created. I've simplified the program to its bare bones for this posting. First I create a new class, create a new ins...

Formatting a data structure into a comma-separated list of arguments

Hi, I need to convert a list (or a dict) into a comma-separated list for passing to another language. Is there a nicer way of doing this than: result = '' args = ['a', 'b', 'c', 'd'] i = 0 for arg in args: if i != 0: result += arg else: result += arg + ', ' i += 1 result = 'function (' + result + ') ...

Refer to a html List item object properly in javascript for Event Registration

I would like to know how I can refer to a list item object if I had for example the following html list <div id="subdiv_2"> <div id="subdiv_3"> <ul> <li><a href="">Item1</a></li> <li><a href="">Item2</a></li> <li><a href="">Item3</a></li> </ul> </div> </div> How is it possible to register an onclick ...

SharePoint A-Z groupby in CAML

Hi I'm using the content query web part and have exported it to a webpart file to allow me to change the queryoverride and groupby elements. I want to group the results alphabetically, so I thought that I can maybe use a function to grab the first letter of the title of the list items and then group by this, it might do the trick. Prob...

Find the most occuring number in a List<int>

Is there a quick and nice way with lambda expressions? ...

C# List<> GroupBy 2 Values

I'm using C# on Framework 3.5. I'm looking to quickly group a Generic List<> by two properties. For the sake of this example lets say I have a List of an Order type with properties of CustomerId, ProductId, and ProductCount. How would I get the sum of ProductCounts grouped by CustomerId and ProductId using a lambda expression? ...

Python - get position in list

I am iterating over a list and I want to print out the index of the item if it meets a certain condition. How would I do this? Example: testlist = [1,2,3,5,3,1,2,1,6] for item in testlist: if item == 1: print position ...

Collections with events - is there a better choice than BindingList(of T)?

I needed a generic collection or list that can fire an event when an item is added or removed. I discovered that BindingList(of T) has events for this and wired up a quick proof of concept that worked fine. Of course, this doesn't feel like the most educated choice; BindingList is overkill for what I'm doing. Are there any simpler col...

Extending std::list

I need to use lists for my program and needed to decide if I use std::vector or std::list. The problem with vector is that there is no remove method and with list that there is no operator []. So I decided to write my own class extending std::list and overloading the [] operator. My code looks like this: #include <list> template <clas...