list

How to find most common elements of a list?

Hi Given the following list ['Jellicle', 'Cats', 'are', 'black', 'and', 'white,', 'Jellicle', 'Cats', 'are', 'rather', 'small;', 'Jellicle', 'Cats', 'are', 'merry', 'and', 'bright,', 'And', 'pleasant', 'to', 'hear', 'when', 'they', 'caterwaul.', 'Jellicle', 'Cats', 'have', 'cheerful', 'faces,', 'Jellicle', 'Cats', 'have', 'bright', 'bl...

List is being emptied in the middle of a method! Help!

Hi, this has me puzzled - I am no expert on page life cycle but I do not see why this is happening. It may be a simple case of where I declare my list. Here is the code: public partial class feedback : System.Web.UI.Page { List<Module> allModules = new List<Module>(); protected void Page_Load(object sender, EventArgs e) { ...

Lazy List of Prime Numbers

How would one implement a list of prime numbers in Haskell so that they could be retrieved lazily? I am new to Haskell, and would like to learn about practical uses of the lazy evaluation functionality. ...

Python's list comprehensions and other better practices

This relates to a project to convert a 2-way ANOVA program in SAS to Python. I pretty much started trying to learn the language Thursday, so I know I have a lot of room for improvement. If I'm missing something blatantly obvious, by all means, let me know. I haven't got Sage up and running yet, nor numpy, so right now, this is all quit...

Using List of (T) with Lucene.net in vb.net

hello, i want to use an List to store the title, path,... from Documents. I declared the list like this: Dim MyDocuments As New List(Of Document) But i don't really know how to handle the list. i want to use the list instead of an ReDim Array. For i = 0 To results - 1 Step 1 ' forschleife zum durchlaufen der Ergebnisse ...

how to return specific ammount of list entries - c# asp.net mvc

Hello all, for example i have some list with 120 entries. Threads = new List<Thread>(); and i will return to show in my view just 10 of them. I have a properties like, TotalCount, TotalPages, PageSize=10, PageIndex. How can I do that? Take care, Ragims ...

StackOverflow in List(Of T)

I have a program that uses Lucene.net in ASP.NET (VB.NET), when you search a term, results are stored in the Lucene.net data structure "hits". I want to read out the hits into an data structure and work with them, after that I display them in a DataGrid. By searching a term with a lot of results, often (but not always) there is an erro...

Find an element's sibling in a list of elements

Ok, so here's what I've got: I have a list of elements cached in a variable: elementList = $(".list-of-elements-with-this-class"); I also have a dynamically generated element from that list cached in another variable: elementList.click( function() { cachedItem = $(this); } ); What I want to do is locate cachedI...

Python: find sequential change in one member of list pairs, report other

There must be a simpler, more pythonic way of doing this. Given this list of pairs: pp = [('a',1),('b',1),('c',1),('d',2),('e',2)] How do I most easily find the first item in adjacent pairs where the second item changes (here, from 1 to 2). Thus I'm looking for ['c','d']. Assume there will only be one change in pair[1] for the entir...

Need Help In Moving An Item

Hi Guys, I am trying to move an item in a list upward but it is not working the way I want. The element that I select still remains after it has swapped position with the previous elements. I am using Jlist. listTasks is a JLIst and listModel is ListModel For instance if I have 1 2 as a list, after I select 2 and click the up but...

C# List<T> get return a sorted list

What I have is basically: public class Object{ public bool IsObjectValid { set; get; } } public class MyThing{ public List<Object> Objects { set; get; } } What I want to do: public class ObjectsFiltered{ public List<Object> ValidObjects{ get{ var list = LFs.Sort<_LF> where (IsObjectValid == true); ...

WPF: Binding lists in XAML- how can an item know its position in the list?

Given the following XAML code that with a ListControl like behavior: <StackPanel> <ItemsControl Name="_listbox" ItemsSource="{Binding ElementName=_userControl, Path=DataContext}"> <ItemsControl.ItemTemplate> <DataTemplate> <DockPanel> ... ...

Is there a standard way to convert from container<Type1> to container<Type2> ?

I have two classes A and B, and an implicit conversion operator exists to go from one to the other, so that: A a; B b; b = a; // Works Is there a standard way to convert a std::list<A> to a std::list<B> ? (Or even from std::vector<A> to a std::list<B>). I know I can iterate trough to the list and build the second list item by item, b...

Right way to swap x elements in List

I started to learn Scala language and I have a question. How do you think, is it a right way to swap first and last x elements in List in a functional style? def swap(l: List[Any], x: Int) = { val l1 = l.take(x) val l2 = l.slice(x, l.length - x) val l3 = l.takeRight(x) l3 ::: l2 ::: l1 } It doesn't matter what happened if x wo...

What is the best way of representing an immutable list in .NET?

I've recently started using F# for "real work" and rediscovered the beauty of immutable data structures such as the discriminated unions and records in F#. I've also found them to be quite straight forward to use from C#, especially as they don't require any direct dependencies on the F# runtime. However, when it comes to representing li...

Numbers position in <ol> with image only within it

Hi, How can I position the numbers of an ordered list when the only element within it is an image. Exemple : http://i.imgur.com/zyeWc.jpg I would like to have to numbers at the top. Thanks. Code : <ol> <li class="a1-q1"><img src="../musee_recherche/mediums/00123.jpg" alt="" width="418" height="220" /> </li> ...

Is it possible to use a list of untyped generics in C#?

I'm trying the following design without success: abstract class Foo<T> { abstract T Output { get; } } class Bar { List<Foo> Foos; } I would dislike using an array list, because I would have to use unsafe casts to get the type. I'd like Foo to be typed so that "Output" isn't just an object, in which case I'd have to use unsafe...

Order of List using Linq is not the same as sort

I would like to confirm this, I was trying to sort a List of my class using Linq. But it seems the order of the data was not ordering the same way when i used a sort function. Assume that the list contains 4 ComputeItem and all their A are set to 1, the B, C, D of all are set to zero. CASE 1: ItemList = ItemList .OrderByD...

List of most popular programs and their programming language...

Is there any resource for list of most popular (web/desktop/...)programs and their programming languages? ...

Best way in java to merge two lists to one map?

Possible Duplicate: Clearest way to combine two lists into a map (Java)? Given this: List<Integer> integers = new ArrayList<Integer>(); List<String> strings = new ArrayList<String>(); strings.add("One"); strings.add("Two"); strings.add("Three"); integers.add(new Integer(1)); integers.add(new Inte...