list

Create Report from list of objects in .net without saving them in database!

I want to create a report of a list of objects that don't persist in db in VS2008 C#! When I use Crystal Report, I should reference the report to a special Table in DB or an object in Application. But I want to report from a non-persistent list which is a list of objects from a class. ...

Python Sorting Question

Hi, i need to sort the following list of Tuples in Python: ListOfTuples = [('10', '2010 Jan 1;', 'Rapoport AM', 'Role of antiepileptic drugs as preventive agents for migraine', '20030417'), ('21', '2009 Nov;', 'Johannessen SI', 'Antiepilepticdrugs in epilepsy and other disorders--a population-based study of prescriptions', '19679449'),....

Python list, lookup object name, efficiency advice

Suppose I have the following object: class Foo(object): def __init__(self, name=None): self.name = name def __repr__(self): return self.name And a list containing multiple instances, such as: list = [Foo(name='alice'), Foo(name='bob'), Foo(name='charlie')] If I want to find an object with a given name, I could use the ...

How to compare list of X to list of Y in C# by using generics?

I have 2 classes, X and Y. Both classes have same similar property like below. class X { public string T1 { get; set; } public string T2 { get; set; } public string T3 { get; set; } } class Y { public string T1 { get; set; } public string T2 { get; set; } public string T3 { get; set; } public string O1 { ge...

Seg fault vector<vector<list<Object*> > > push_back

I have a 3D vector defined like this... std::vector<std::vector<std::list<Object*> > > m_objectTiles; I have this code... void ObjectManager::AddObject( Object *object ) { m_objects.push_back( object ); m_objectTypes.insert( std::make_pair( ObjectAttorney::GetType( object ), object )); int x = ObjectAttorney::GetTileX( ob...

vb.net For Each loop

I would like to loop through two lists using a For each loop. dim data as list(of pointpairlist) For each recLine in records For Each chan In recLine.channels and d in data d.add( func(chan) ) Next next note: each record line has one sample from each channel recorded. ie each record line is a slice of a 32 sensor recordi...

custom list control in cocoa

Hello, I am trying to get something like in this screenshot in cocoa, I mean a custom list control. Do you know how this kind of things can be done? Thanks in advance for your help, Regards, ...

Speeding up parsing of HUGE lists of dictionaries - Python

Hi folks, I'm using MongoDB an nosql database. Basically as a result of a query I have a list of dicts which themselves contains lists of dictionaries... which I need to work with. Unfortunately dealing with all this data within Python can be brought to a crawl when the data is too much. I have never had to deal with this problem, a...

Python: Unpacking an inner nested tuple/list while still getting its index number

I am familiar with using enumerate(): >>> seq_flat = ('A', 'B', 'C') >>> for num, entry in enumerate(seq_flat): print num, entry 0 A 1 B 2 C I want to be able to do the same for a nested list: >>> seq_nested = (('A', 'Apple'), ('B', 'Boat'), ('C', 'Cat')) I can unpack it with: >>> for letter, word in seq_nested: pr...

ExpandableLists - nullpointer exception When array contains a null value

Hello Gurus, I am using a simple expandable list that is populated by two arrays ( group array for the groups and a multi dimensional children array for the child). The arrays are built dynamically in the program and some group items have more children than others. So I end up defining the highest number as the array size for the multid...

Simple C# List<>: given the primary key, how to find and update a nested object property in a List<>?

Simple IList update question: given the following nested objects, how do you update the deepest nested property given the primary key? public class Recipe { public int RecipeID {get;set;} // PK public string name {get;set;} public IList<RecipeStep> RecipeSteps {get;set;} } public class RecipeStep { public int Recip...

Is there a single regular expression to replace a number in a delimited list?

I have a string that can range from the empty string to an arbitrary list of comma delimited numbers. For example: "1,2,3" Unfortunately as I write the code to remove an element I have a bunch of if statements--mainly to deal if it is the first, last, or only element in the list. I keep thinking there has got to be a better way! For ...

Why tuple is faster than list?

Sorry because this is a noob question. I'm reading Dive into Python, and just read "tuple is faster than list". http://diveintopython3.org/native-datatypes.html#tuples Tuple is immutable, and list is mutable, but I don't quite understand why tuple is faster. Anyone did a performance test on this? Thanks. ...

PHP Assign array to variables

I'm not sure if my memory is wrong, but when I last used PHP (years ago), I vaguely remember doing something like this: $firstVariable, $secondVariable = explode(' ', 'Foo Bar'); Note that the above is incorrect syntax, however in this example it would assign 'Foo' to $firstVariable, and 'Bar' to $secondVariable. What is the correct ...

printing elements in a nice format

Hi, I have a simple, general question regarding a real small issue that bothers me: I'm printing a list of elements on the fly, so I don't have prior knowledge about the number of printed elements. I want a simple format where the elements are separated by a comma (elem1, elem2...) or something similar. Now, if I use a simple loop like: ...

std::swap returns 0xBAADF00D

Hi I'm trying to swap two std::list< dontcare* >::iterators under Visual 2005. Iter it1 = ... ,it2 = ...; // it1 and it2 are ok, not end() or such if(...){ std::swap(it1,it2); } The swap works, but when I leave the if() scope, it1 points to 0xbaadfood. It2 is ok though.I tried several variations, including swap_iter and a hand-ma...

Prolog List Processing

Hello to all, i would like to define a list(List of Bank Customer) from predicate and process the list using some rule. For instance, i have the customer predicate like this customer(peter,bank(maybank),customertype(personal), citizen(malaysian),age(62),credit(50000), income(4500),property(car),bankemployee(no) ). customer(ma...

Compare all items from a Collection with items from another Collection?

Hey, I have this code here: ArrayList arrayList = new ArrayList(); arrayList.add("one"); arrayList.add("two"); arrayList.add("three"); List<DataRow> dataList = GetDataList(some params); Now I want to check if arrayList contains ther elements from dataList. The string is at itemarray[0] in dataList. Is there a nice short code version ...

Sorting all possible combinations

Hi there, i´m trying to sort a list of combinations in a specific way. Consider the numbers 1-6 as teams, if every team can play on time against each other team we got this list as possible matches: 12 23 34 45 56 13 24 35 46 14 25 36 15 26 16 So now what i want is something like "matchdays": 12 13 14 15 ...

detect that an email is sent to a mailing-list

My application sends mails containing an authentication token. The user which receives the mail clicks on a link and is directed to a webpage. The app recognizes him. The problem is that sometimes the mail is sent to a mailing list instead of a personal address. Then several people come on the page and override each others' actions. Th...