list

.NET - Return a List<CustomSerializableObject> from a webservice

Is it a good idea to try and return a strongly typed List of custom objects from a webservice? Any pitfalls I should know about? [WebMethod] public List<CustomSerializableObject> GetList() { List<CustomSerializableObject> listToReturn = new List<CustomSerializableObject>(); listToReturn.Add(new CustomSerializableObject()); ...

Problem creating N*N*N list in Python

I'm trying to create a 3-dimensional N*N*N list in Python, like such: n=3 l = [[[0,]*n]*n]*n Unfortunately, this does not seem to properly "clone" the list, as I thought it would: >>> l [[[0, 0, 0], [0, 0, 0], [0, 0, 0]], [[0, 0, 0], [0, 0, 0], [0, 0, 0]], [[0, 0, 0], [0, 0, 0], [0, 0, 0]]] >>> l[0][0][0]=1 >>> l [[[1, 0, 0], [1, 0, ...

List of dictionaries, in a dictionary - in Python

I have a case where I need to construct following structure programmatically (yes I am aware of .setdefault and defaultdict but I can not get what I want) I basically need a dictionary, with a dictionary of dictionaries created within the loop. At the beginning the structure is completely blank. structure sample (please note, I want to...

List Types bypassing ReadOnly Properties?

When using custom classes with read-only properties that are of type List or similar (ie, ObservableCollection), it is still possible to 'get' the variable and call an Add() method on it to alter the content. Is there a way to stop this (without creating huge overloads of the List class) on 'external' access, or is it 'best practice' t...

How do I use this information in Python? I don't know how to use this data-type.

According to the NLTK book, I first apply the grammar, and parse it. grammar = r""" NP: {<DT|PP\$>?<JJ>*<NN>} {<NNP>+} """ cp = nltk.RegexpParser(grammar) chunked_sent = cp.parse(sentence) When I print chunked_sent, I get this: (S i/PRP use/VBP to/TO work/VB with/IN you/PRP a...

Android Contact List.

Can anyone shed a light on how to get contact list from android?. I just want to get the same list as in the dialer app. But im getting a lots of contacts that are not on the dialer list with the code below. ContentResolver cr = getContentResolver(); Cursor cursor = cr.query(Contacts.People.CONTENT_URI, null, null, null, Contacts.Con...

Prolog List Question

I'm trying to understand lists in prolog when I stumbpled over this problem: there's a predicate mergeandmap/2 that should basically do this: mergeandmap([[a1,...,an],...,[z1,...,zm]],[x1...xn]) %----------list 1------------ -list 2-- List 2 consits of letters (for example [a,b,c]). List 1 consits of several lists with s...

How do I create a reversed ordered list of years?

I want to create a list in html that has reversed ordered, non-consecutive years instead of numbers. It should look like this: 2009 Item 7. 2007 Item 6. 2006 Item 5. 2004 Item 4. 2003 Item 3. 2002 Item 2. 2000 Item 1. I have code that works for reverse ordering number lists: ol { margin-left: 0; padding-left: 1em; text-in...

Common algorithm for std::list and std::map?

I have a class of interest (call it X). I have a std::list<X*> (call it L). I have a function (call it F). F(L) returns a subset of L (a std::list<X*>) according to an algorithm that examines the internal state of each X in the list. I'm adding to my application a std::map<int,X*> (call it M), and I need to define F(M) to operate in ...

SharePoint 2007 search query related to attachments in a list

Can sharepoint search work for list item attachments. I have a custom list where I am loading attachments. Can SharePoint search through the content of the attachment. ...

Is there a lightweight library to do draggable+sortable lists inside greasemonkey scripts?

I'm writing a GreaseMonkey script, as part of which I'd like to sort a list by dragging its items. I'm using mootools, but the component for sortable lists doesn't work in the GM sandboxed environment. Can you recommend a smallish library/piece of code to do list sorting in the most lightweight fashion? I want it to be independant of any...

WCF XML and Serialization with List

I have a basic WCF service that takes some xml. Some of the xml is a list like so: <Root> <Products> <Product> <SKU>1234</SKU> <Price>2533</Price> <ProductName>Brown Shows</ProductName> <Quantity>1</Quantity> </Product> <Product> <SKU>345345</SKU> ...

array vs vector vs list

I am maintaining a fixed-length table of 10 entries. Each item is a structure of like 4 fields. There will be insert, update and delete operations, specified by numeric position. I am wondering which is the best data structure to use to maintain this table of information: array - insert/delete takes linear time due to shifting; update ...

Type of List to Store Multipe Data Types

So my problem is that I've written a function that takes two Doubles, two Int, and a Calendar object on Android (Java). I believe the class provided to allow it to run in a separate thread, AsyncTask, accepts only one type of Object (but allows multiple) as an argument so I figured I might be able to put it in a List or a LinkedList or s...

Python: Import a file and convert to a list

I need help with importing a file and converting each line into a list. An example of the file would look like: p wfgh 1111 11111 111111 287 48 0 65626 -1818 0 4654 21512 02020 0 The first line beginning with p is a header and the rest are clauses. Each clause line must begin with a series of at least two integers and finish with a z...

GetGenericTypeDefinition returning false when looking for IEnumerable<T> in List<T>

Following this question, why does enumerable in this: Type type = typeof(List<string>); bool enumerable = (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(IEnumerable<>)); return false? Edit 1 As the above doesn't work, what would be the best way to determine if a class implements IEnumerable? ...

SQL Query to compare

Hi, I am working on an Access database and in it I need to extract several reports. For one of them I need to compare two lists of numbers, List1 and List2(I get both from separate queries) and display only those numbers that are in List1 but not in List2. Can anyone help please? Thank you. ...

Python: list problems

I've read in a text file and converted each line into a list. using this script: l = [s.strip().split() for s in open("cluster2.wcnf").readlines()] How would i go about : the file it opens is dynamic rather than static? i.e. the user chooses the file to open. Select specific lines to read after it has been converted to a list. assi...

transform a select list into a ul list

I am trying to clone a select list into a standard ul list for enhanced javascript select box manipulation/styling. Basically, if I do this: $("#calendar select option").clone().appendTo("#test"); i get the following html <ul id="test"> <option>All Types</option> <option>Installation</option> <option>Music</option> <option>Performing ...

Python: List to integers

I have read a file in and converted each line into a list. A sample of the list looks like: ['15', '2', '0'], ['63', '3', '445', '456' '0'], ['23', '4', '0'] i want to retrieve the first number from each list and convert it to and integer so when i carry out the type function i.e. type(x) <type 'int'> is returned Also when i print ...