list

How should I write this string-prefix check so that it's idiomatic Python?

I have a couple of lists of items: specials = ['apple', 'banana', 'cherry', ...] smoothies = ['banana-apple', 'mocha mango', ...] I want to make a new list, special_smoothies, consisting of elements in smoothies that start with the elements in specials. However, if specials is blank, special_smoothies should be identical to smoothies...

How to let users edit list<T> content?

I'm making an aspx page that can edit books. A book is an complex class with lots of properties. I've made an edit page for most of them, however I'm having trouble with showing edit options for my Sellers Proprety. It is an list<Seller> object. Seller is as follows: public class Seller { private string sellerName; private dou...

Using FindAll on a List<List<T>> type

Assuming public class MyClass { public int ID {get; set; } public string Name {get; set; } } and List<MyClass> classList = //populate with MyClass instances of various IDs I can do List<MyClass> result = classList.FindAll(class => class.ID == 123); and that will give me a list of just classes with ID = 123. Works great, l...

linked list elements gone?

I create a linked list dynamically and initialize the first node in main(), and I add to the list every time I spawn a worker process. Before the worker process exits, I print the list. Also, I print the list inside my sigchld signal handler. in main(): head = NULL; tail = NULL; // linked list to keep track of worker process dll_node_t...

How to add age to ageList =[12,13,23]

may be too simple groovy question but....please help i have a list like this: def ageList =[12,13,23] i want to get this: def newAgeList =[age:12,age:13,age:23] could some one help me out? thank you so much! ...

Make dictionary from list with python

I need to transform a list into dictionary as follows. The odd elements has the key, and even number elements has the value. x = (1,'a',2,'b',3,'c') -> {1: 'a', 2: 'b', 3: 'c'} def set(self, val_): i = 0 for val in val_: if i == 0: i = 1 key = val else: ...

Loading a large list of sentences into a MySQL table

I have a large list of phrases / quotes / sentences in a text file. Mixed alphanumeric text, it hasn't been screened for "'s or ''s. Is there an easy way to throw this into a table? ...

groovy, merge two lists : listA is [[Name: mr good, note: good, rating:9], [Name: mr bad, note: bad, rating:5]]

I have two lists: listA: [[Name: mr good, note: good,rating:9], [Name: mr bad, note: bad, rating:5]] listB: [[Name: mr good, note: good,score:77], [Name: mr bad, note: bad, score:12]] I want to get this one listC: [[Name: mr good, note: good,, rating:9, score:77], [Name: mr bad, note: bad, rating:5,score:12]] how could I do it...

Python recursion with list returns None

def foo(a): a.append(1) if len(a) > 10: print a return a else: foo(a) Why this recursive function returns None (see transcript below)? I can't quite understand what I am doing wrong. In [263]: x = [] In [264]: y = foo(x) [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] In [265]: print y None ...

how to create a list in LISP and accepting elements of list from user?

how to create a list in LISP and accepting elements of list from user? ...

How to calculate the occurrences of a list item in Python?

Given an item, how to count its occurrences in a list in Python? ...

c# linq to xml to list

I was wondering if there is a way to get a list of results into a list with linq to xml. If I would have the following xml for example: <?xml version="1.0"?> <Sports xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; <SportPages> <SportPage type="test"> <LinkPag...

ocupation and business type drop down lists

Hi, does anyone know of an API or where I could get hold of data/script to create a <select> drop down lists for occupation and job type? Regards, Phil ...

Adding UIComponent to both Canvas and Tree in Flex 3

I currently am trying to add a custom class which subclasses UIComponent to both a tree and a canvas, but when I try to re-order the tree by dragging I get this error: TypeError: Error #1010: A term is undefined and has no properties. at mx.controls::Tree/get firstVisibleItem()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\co...

Combining lists but getting unique members

I have a bit of a special requirement when combining lists. I will try to illustrate with an example. Lets say I'm working with 2 lists of GamePlayer objects. GamePlayer has a property called LastGamePlayed. A unique GamePlayer is identified through the GamePlayer.ID property. Now I'd like to combine listA and listB into one list, a...

how to increase speed of my execution

i am creating project in c#.net. my execution process is very slow. i also found the reason for that.in one method i copied the values from one list to another.that list consists more 3000values for every row . how can i speed up this process.any body help me for (int i = 0; i < rectTristrip.NofStrips; i++) { ...

GUI Design - Roleselection with two lists, selected roles on the right, or left list?

Hi, image two lists for selecting roles for a new user creation in an administrator frontend. One list has all available roles in it and another has the selected roles in it. Between those lists are buttons to move elements from one list to another. Thus the layout is horizontal with [List] [Buttons] [List]. Now to the question: Should...

Converting array to list in Java

How do I convert an array to a list in Java? I used the Arrays.asList() but the behavior (and signature) somehow changed from 1.4.2 to 1.5.0 and most snippets I found on the web use the 1.4.2 behaviour. For example: int[] spam = new int[] { 1, 2, 3 }; Arrays.asList(spam) on 1.4.2 returns a list containing the elements 1, 2, 3 on 1....

Python: Get items at depth? (set library?)

I have a nested list something like this: PLACES = ( ('CA', 'Canada', ( ('AB', 'Alberta'), ('BC', 'British Columbia' ( ('van', 'Vancouver'), ), ... )), ('US', 'United States', ( ('AL', 'Alabama'), ('AK', 'Alaska'), ... I need to retrieve some data out of i...

How to clone a list in python?

Hello, Java has cloning methods. How can I do it on a list in python? ...