list

AS3 List issues

I'm trying to add a List object to the stage dynamically, but I always get an error when a certain line is called: input.addItem({label:"test",data:"test"}); Error thrown at runtime: TypeError: Error #2007: Parameter child must be non-null. at flash.display::DisplayObjectContainer/addChildAt() at fl.controls::BaseButton/fl.controls:B...

Why is Java's AbstractList's removeRange() method protected?

Does anyone have any idea, why removeRange method in AbstractList (and also in ArrayList) is protected? It looks like a quite well-defined and useful operation, but still, to use it, we're forced to subclass the List implementation. Is there some hidden rationale? Seems quite inexplicable to me. ...

Insert an element in sorted and rotated list

A list of sorted and rotated element is given. Elements are either sorted in ascending or descending order. For example - I've list of sorted elements as follows 10,12,14,16,18,20,51,53,54,59 Now this list is rotated by X number of times and then it looks as follows. 51,53,54,59,10,12,14,16,18,20 If you want to insert an element in...

List minimum in Python with None?

Is there any clever in-built function or something that will return 1 for the min() example below? (I bet there is a solid reason for it not to return anything, but in my particular case I need it to disregard None values really bad!) >>> max([None, 1,2]) 2 >>> min([None, 1,2]) >>> ...

What's the best way to conditionally include an element in a list?

Possible ways: Using push: my @list; push @list, 'foo' if $foo; push @list, 'bar' if $bar; Using the conditional operator: my @list = ( $foo ? 'foo' : (), $bar ? 'bar' : (), ); Using the x!! Boolean list squash operator: my @list = ( ('foo') x!! $foo, ('bar') x!! $bar, ); Wh...

join lists based on common head or tail

What is the fastest way to solve the following I will to join several lists based on common head or tail input = ([5,6,7], [1,2,3], [3,4,5], [8, 9]) output = [1, 2, 3, 4, 5, 6, 7] ...

Create a list from SQL database using HTML/PHP

Im trying to create a drop down list/menu of users from my SQL database table. Could anyone help me with the code please? The code below is just for a normal list with options 1 & 2. How do i make the list retrieve all the items in a specific table using html/php/sql. Sorry im not very experienced with this, thanks in advance. <select n...

Delphi 7: Select certain items of a TList

In Delphi I have an own class which is based on TList. It is TPetList. Every instance of TPetList can have some items of the class TPet. The instance of TPetList is displayed in a TListView component using a for loop. TPet is based on TObject and has the following fields: city age breed Now I have a list of checkboxes where the user...

How to I extract floats from a file in Python?

So, I have a file that looks like this: # 3e98.mtz MR_AUTO with model 200la_.pdb SPACegroup HALL P 2yb #P 1 21 1 SOLU SET RFZ=3.0 TFZ=4.7 PAK=0 LLG=30 SOLU 6DIM ENSE 200la_ EULER 321.997 124.066 234.744 FRAC -0.14681 0.50245 -0.05722 SOLU SET RFZ=3.3 TFZ=4.2 PAK=0 LLG=30 SOLU 6DIM ENSE 200la_ EULER 329.492 34.325 209.775 FRAC 0.70297 0....

How do I handle click event in Spark List control in Flex 4

I have a s:List component. I want to handle a click event to know what list item is selected. I don't see Click event in s:List. Any workarounds? Thanks. ...

Java - changing the value of a raw type variable. Possible?

I'll start by saying I am a Java (/programming) newbie and this is my first question on the website. Just learnt how to make an ordered list in Java using recursive nodes. Everything was easy until I ran into this exercise asking me to write a method that would double whatever value is contained in each node. Here is the code I tried to...

Using list.reverse() on a subset of a list. "NoneType" object is not iterable

So, I'm trying to append to one list the reverse of a subset of another list. For some reason, the interpreter doesn't seem to be liking it. Here's what I'm doing. list1.extend(list2[someInt:someOtherInt].reverse()) Why is this not legit? It seems reasonable to me.. ...

Shuffle List<T>

Hi All I have a list which contains many thousands of FilePath's to locations of audio files, and was wondering which would be the most efficient way to "shuffle" a List? Any help is greatly appreciated :) Thank you ...

Would you use numpy if you were just manipulating a list of binary binary values?

Is there any advantage to using numpy when you're doing a large number of operations on lists of binary values? How about integers within a small range (like just the numbers 1,2, and 3?) ...

Java List generics syntax for primitive types

I want to make a growable array of bytes. I.e a list. In c# would usally do the following syntax List<byte> mylist = new List<byte>(); where as in java this syntax does not work and I have googled around and found the below code List myList = new ArrayList(); but that is not what I want. Any idea's where I am going wrong? ...

C++ STL list vs set

Hi, what of those two is faster for random insertions and deletions? I guess list, having the values as the keys as it is with sets seems to be attractive too though. Is performance similar for iterating over the whole container? Thanks! ...

How can I iterate a list of lists in scala?

hello, I am trying to implement my own generic flatten for list objects which hold lists in scala. At this point I have def myFlatten[T](list: List[List[t]]): List[T] = { for (xs <- list) for (x <- xs) yield x } I am getting message for xs found Unit required list. ...

ASP.NET MVC 2: How to contain List<> ID numbering within a "class" UI template?

Edit: I am trying to bind a single view model object that contains a List to a form so that the post maps back to the same view model object. Is there any code out there that could effectively do this in MVC 2? EditorFor( m => m, "Students", "Students[n]") // wrong but sorta close // the third parameter specifies the ID of the html con...

Seeing if a list exists within another list?

Basically lets say i have: >>> a = [1,3,2,2,2] >>> b = [1,3,2] I want to see if the all the elements in b, exists within a, and in the same order. So for the above example b would exist within a. I am kinda hoping theres a really simple one line answer. ...

how can i convert a list of objects to csv

if i have a list of objects called "Car" public class Car { public string Name; public int Year; public string Model; } and i have a list of List and i want to generate a csv file dynamically from this list ...