list

How can I get XStream to output Scala lists nicely? Can I write a custom converter?

This code: println(new XStream.toXML(List(1,2,3))) produces this XML: <scala.coloncolon serialization="custom"> <unserializable-parents/> <scala.coloncolon> <int>1</int> <int>2</int> <int>3</int> <scala.ListSerializeEnd/> </scala.coloncolon> </scala.coloncolon> Instead I'd like this: <list> <int>1</int> <...

Groovy on Grails list - not working?

Removing an element from a list isn't working, which doesn't make any sense. Am I missing some special semantics peculiar to dealing with a Grails domain object list? In controller: def userCreate = { def workgroupInstance = new Workgroup() workgroupInstance.manager = authUserDomain flash.message = User.list().toString() ...

C# 2.0 - List processing

In C# 3.0 for ,Removiing duplicates I can use int[] ints={1,1,2,34,5,6,7,5,11,13}; List<int> integes = new List<int>(); List<int> filter = new List<int>(); integes.AddRange(ints); filter = integes.Distinct().ToList(); filter.ForEach((i)=> { Console.WriteLine(i); }); Is similar shortcut method ...

What is the best List implementation for Large lists in java

Hi, I have to create a large list of n elements (could be up to 100,000). each element in the list is an integer equivalent to the index of the list. After this I have to call Collections.shuffle on this list. My question is, which list implementation (either java collections or apache collections) should be used. My gut feeling is Ar...

Python: Fast extraction of intersections among all possible 2-combinations in a large number of lists

I have a dataset of ca. 9K lists of variable length (1 to 100K elements). I need to calculate the length of the intersection of all possible 2-list combinations in this dataset. Note that elements in each list are unique so they can be stored as sets in python. What is the most efficient way to perform this in python? Edit I forgot to ...

Whats a quick way to convert an IEnumerable<Foo> to List<Foo> in C# 2.0?

we all know the slow way: foreach.. ...

How to quickly find a sharepoint document library by id?

Given the SPList.ID and a site collection (or an SPWeb with subwebs), how do I quickly find the document library with the given ID? I can recursively enumerate through all webs and perform a web.Lists[guid] on each one of them, but there might be thousands of subwebs in my case, and I'm looking for a realtime solution. If there is no ...

Traversing an unordered list using jQuery

This should be an easy one, but I'm not finding much online: I have an unordered list <ul>, with a few list items underneath it <li>, and I'd like to address each one in the list, and act on it. How can I do this using jQuery? Thanks. ...

Scheme - how do I modify an individual element in a list?

If I have a list of 0's, how would I modify, for example, the 16th 0 in the list? ...

Java Queue Merge, Beginner

I'm trying to write a method that will take in two Queues (pre-sorted Linked Lists) and return the merged, in ascending order, resulting Queue object. I pasted the Queue class, the merge method starts 1/2 way down. I'm having trouble calling merge, this is how I am trying to call it from my main method, can anyone help with this call ...

C#: Bind TextBox to SelectedValue

I have a List<> of objects that I have bound to a ListBox. I then want to bind properties of the SelectedValue to various TextBoxes. The behavior is very screwy though. When binding the Name (a string) that is used as the DisplayMember for the ListBox, it doesn't update the ListBox and if I try to refresh the binding on the TextChanged ...

jQuery scrolling UL with hidden overflow

I have a UL with LI's set to display horizontally. The UL has a fixed width and it's set to hide the overflow. This is so I can display my images, which are to be used in a gallery, neatly. It works and looks nice. I want to, however, use jQuery to scroll the contents of the UL rather than set the overflow property to auto and be presen...

Getting the dataItem after DataBound from ListView/DataGrid (any list) in ASP.Net

I have a list (ListView) which which displays a lot of information, and what I want to do is get the DataItem after its DataBounded, ie on the ItemCommand event. I know I can just store the keys in the DataKey, but I need to store a lot more info than keys. The information comes from various external sources and I only need to save t...

Adding Lists Elements to 'Mega List'

Let's say I have a list somewhere called majorPowers which contain these two lists: axis=["germany","italy","japan"] allies=["russia","uk","us"] I'd like to insert each of the elements of these lists, into a new mega-list. I'm currently doing this: >>> temp = [] >>> temp = [ww2.append(t) for t in majorPowers] >>>ww2 [['germany','ital...

How to find the position of an element in a list , in Python?

for s in stocks_list: print s how do I know what "position" s is in? So that I can do stocks_list[4] in the future? ...

How do I do a "for each" , starting at a certain index of a list (Python)?

Suppose I have this list: thelist = ['apple','orange','banana','grapes'] for fruit in thelist: This would go through all the fruits. However, what if I wanted to start at orange? Instead of starting at apple? Sure, I could do "if ...continue", but there must be a better way? ...

Readonly wrapper of a LinkedList. HowTo?

Hello. .NET v2 When the List has a very useful (4 me) method AsReadOnly() the LinkedList does not have such a method. Is there a way to "quickly" interface an internal LinkedList to read only from the external code? ...

Conditional counting in Python

Hello there, not sure this was asked before, but I couldn't find an obvious answer. I'm trying to count the number of elements in a list that are equal to a certain value. The problem is that these elements are not of a built-in type. So if I have class A: def __init__(self, a, b): self.a = a self.b = b stuff = [] ...

searching and listing WPF resource dictionaries in a folder

I'm making a WPF application that is going to have multiple skins branded in by our build system. Ideally we would like the application to list off the skins available as some builds will have one to many skins. At runtime is there a way to enumerate all the Resource Dictionaries in a specific folder? I want to avoid hard coding the ...

Reorder files and folders

Hi, I got a list of files and folders using dirent & stat in C, but they are not in the order I want. I want it will list the directories first then files. Ex: . .. [dir1] [dir2] [file1] [file2] Is there a way to do this with dirent? Or I dont want to manually order the output list. Thanks. ...