list

What's the equvalent to .Net ArrayList mutable type in Scala 2.8?

What type in Scala 2.8 can I use to store a list of values? In C# I'd use ArrayList. ...

jquery count li's in top level UL

Hi All, I need to count the amount of LI's in a top level UL. My top level menu has 6 items in it but this could dynamically change. I thought this could work but it is still counting the child li's too :( var numTopNavItems = 0; $("ul.rmHorizontal > li").each(function (i) { numTopNavItems += i; alert("numTopNavItems = " + n...

How to restructurize a List in Haskell?

I have a list like this: (Pseudo notation) (X,...) -> (X,...) -> (X,...) -> ... | | | V V V (Y,...) (Y,...) (Y,...) | | | V V V (Z,...) (Z,...) (Z,...) Type is (Enum a, Bounded a) => [[(a,x)]]. But I need something like this: (X, ... -> .....

How can I create a list of objects of different type in Haskell?

I have these two Haskell data types: data Code = Code_A | Code_B | Code C deriving (Eq,Show) data ListObject = Code | Int I need to make a list that contains ListObjects. That is both integer values and codes ([1,2, Code_A, 3]). I know it should be possible but I just can't figure the syntax for it. Haskell can do some neat ...

Python: compiling regexp problems

I have a interesting problem. I have a list of lists, and I want all except the first element of each list compiled into a regular expression. And then put back into the list. The lists start as strings. The following code doesn't work. It doesn't raise an error, it just doesn't seem to do anything. I think I have identified the problem...

list(y) behavior is "wrong" on first call

I have an iterator with a __len__ method defined. Questions: If you call list(y) and y has a __len__ method defined, then __len__ is called.    1) Why? In my output, you will see that the len(list(y)) is 0 on the first try. If you look at the list output, you will see that on the first call, I receive an empty list, and on the seco...

Modifying multiple Lists inside a function and returning it in Scala

I have a List of type [T] and [B] in scala, with an object e of type E. I want to make a function that accepts those three parameters: def doSomething(t : List[T], b List[B], e : E) { ... } However I realise that List is immutable, and anything passed to a function is considered as val (not var). But I need to modify t and b and ret...

Android: Update single item in list

Hi all, I have a list (ListView) which displays news items. They contain a image, title and some text. The image is loaded in a separate thread (with a queue and all) and when the image is downloaded, I now call notifyDataSetChanged() on the list adapter to update the image. This works, but getView() is getting called way to often now, ...

Display a list of check box in android?

I just want to know what is is called. I wanna make a list of checkbox, when I click on it, it will be checked, and when clicking on the text, It will start other activity. I found on APIDemo but nothing's similar ...

Query a Dictionary of Dictionaries?

Hello, Please can you advise me on how to query a Dictionary of Dictionaries, and/or a Dictionary of List? private Dictionary<string, Dictionary<DateTime, double>> masterDict= new Dictionary<string, Dictionary<DateTime, double>>(); Private Dictionary<string, List<DateTime>> masterList= new Dictionary<string, List<DateTime>>(); I know...

Intrusive list implementation for Java?

Is there any (well implemented) intrusive double linked list class(es) available for Java? Or should I do my own? Boost has it for C++: http://beta.boost.org/doc/libs/1_40_0/doc/html/boost/intrusive/list.html. Intrusive list is a container having (in this case) next and prev pointers within element, so typical list operations like repla...

populate datagridview from a list and edit the list (adding)

I have a List List <string> aList = new List<string>(); aList.Add("A,B"); aList.Add("A,C"); aList.Add("A,D"); aList.Add("A,E"); I have datagridview, and I want to display this list on this datagridview. aDataGridView.DataSouce = aList; // Dosent seems to work. When this is displayed on the datagridview I want the user to add to it ...

Uses of self referencing lists

Hello, I know it is possible to create a self referencing list in languages like Python: >>> my_list = [1,2] >>> my_list.append(my_list) >>> print my_list [1,2,[...]] >>> print my_list[0] 1 >>> print my_list[2] [1,2,[...]] What algorithms benefit from self referencing lists? I cannot think of one. Thanks. ...

how to get datagridView display content of list rather than just length

List A = new List(); A.Add("Apple"); A.Add("Banana"); A.Add("Pineapple"); dataGridView.DataSource = a; Result: is the length of each item in the list rather than Item itself. 5 6 9 How can I make datagridView to display string instead of length. ...

a list of pygame sprites loses its first element, and gains a duplicate of the last

I have a function that loads a sprite sheet, finds a block of sprites, and then puts each individual sprite into a list. Before it appends a sprite into the list, it will blit it onto the screen. Once it's done loading sprites, it will then iterate through the list, blitting each sprite as it goes. The two sets of blits should be iden...

How do I check to see if a list index exists in C#?

I have the following snippet of code: public static List<string> sqlData = new List<string>(); // // lots of code here // if (/* check here to see if the sqlData[whatever] index exists */) { sqlData.Insert(count2, sqlformatted); } else { sqlData.Insert(count2, sqlformatted + sqlData[count2]); } What I want to know is how t...

Trimexcess on List(Of t) in .net

After filling a list with the the needed strings, if the list won't be further appended, should trimexcess be called? ...

RegEx for data between . and {

I am not very good in regex so I'm looking for help. I need to fetch content between . and {. Example: .aaa { } .bbb {} ccc {} ddd {} eee {} I.e. aaa and bbb in a string. This data can change so I want to use a regex for this. Thanks. Spaces are allowed and new lines are allowed. This is a simple text file. ...

Why can I not call the size() method on the execute() method when it returns a List?

Why does this not work? if ((List)query.execute().size() > 0) Since execute() returns a List, I thought I could call the size() method on it? ...

dictionary data structure in R

In R, for example > foo <- list(a=1,b=2,c=3) if I type foo, get $a [1] 1 $b [1] 2 $c [1] 3 How can I look through foo to get a list of 'keys' only, in this case, (a, b, c)? Thanks all ...