list

splitting a string into a list in specman

Supposing I have a string: str = “ab,cd,ef” and I want to split it into a list lst = [“ab”,”cd”,ef”] How can I do it best, assuming that I don’t know ahead of time how many items are in the string? Basically I'm looking for a specman equivalent to Perl's: $str = "ab,cd,ef"; @lst = split /,/, $str; ...

What is the best way to get the last element of a list in python?

I found many different ways of getting the last element from a list in python alist[-1] alist[len(alist) -1] Which is the way you would do this? ...

List.Sort IComparer performance

I'm trying to sort a pair of int arrays (int[] a; int[] b;) If I use Array.Sort(a,b) then the performance is great. However, I'd prefer to use a List<> and load the int pairs in a struct. I can get this to work using Array.Sort() with an overload that provides a simple comparer for the struct but it's about 4 times slower than the Arra...

How do you cast a List of objects from one type to another in Java?

For example, lets say you have two classes: public class TestA {} public class TestB extends TestA{} I have a method that returns a List<TestA> and I would like to cast all the objects in that list to TestB so that I'd end up with List<TestB>. ...

Multi-column CSS lists

Is there a way to do re-flowable, multi-column lists, where the list can have list items of varying heights, using only valid CSS? By re-flowable, I mean that as the user drags the window wider or narrower, the number of columns should automatically adjust when the list items are of fixed width. I've seen the article on A List Apart, bu...

Java: Deriving from a generic List/Collection

Hi folks, I have a little problem understanding the Java language public class PhonebookEntryList extends List<PhonebookEntry> { public PhonebookEntryList(String filename) throws IOException { //loadListFromFilename(filename); } public void saveListToFilename(String filename) throws IOException { //Do som...

Writing Recursive StoredProcedures

Basically what i want in my stored procedure is to return a list of tables, store this list in a variable; i need to go through every item in my list to recursively call this storedprocedure. In the end i need an overall listOfTables built up of this recursion. Any help would be most appreciated ...

How do I create an F# list containing objects with a common superclass?

I have two functions, horizontal and vertical, for laying out controls. They work like this: let verticalList = vertical [new TextBlock(Text = "one"); new TextBlock(Text = "two"); new TextBlock(Text = "three")] Now verticalList is a control that displays the three textblocks ...

How do I handle updating a DataGridView when the bound DataSource goes to empty?

I have a DataGridView to which I've set a list of objects to the DataSource. (I'm in VS 2005 using VB.) I created the DataGridView by creating a Data Source of type AssetIdentifier and dragging that Data Source onto my form. I want to update the DataGridView when the selection in either a combo box or another DataGridView changes. (B...

How to move an unordered list to a new part on a page in JQuery?

Hi Guys, Here's the story. I've got an unordered list inside a div on my page. The code: <div id="move-me"> <ul> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> </ul> </div> The above code is positioned on the left of the page, now what I want to do is, destroy the div and ul elements and be only left ...

Sharepoint Lists.asmx: The request failed with an empty response.

Hello All, I'm writing a very small app to create and test caml querys for sharepoint. While executing the GetListItems method I'm receiving the following exception; System.Net.WebException: "The request failed with an empty response." The service is located on a https address (ssl). I setup the service as follows; result = new List...

IList implementations fall into three categories: read-only, fixed-size, variable-size

What does this mean? I am returning a IList<T> from my business layer and then adding items from the UI, but the app is complaining that it's a fixed-size list. How can I overcome this problem? ...

Using list comprehensions and exceptions?

Okay lets say i have a list, and i want to check if that list exists within another list. I can do that doing this: all(value in some_map for value in required_values) Which works fine, but lets say i want to the raise an exception when a required value is missing, with the value that it is missing. How can i do that using list compre...

looking for suggesions re: accessing data and populating List/arraylist/list

Hello All - I am looking to do something like this: access records in db with a datareader. I won't know how many records will come back - somewhere between 1 and 300 most of the time. The data will look something like this "0023","Eric","Harvest Circle", "Boston" for each record. I wanted to immediately populate something (array, list...

Custom list form using sharepoint object model VS 2008

Is there a way to handle the DropDownSelectedIndexChanged for list item new form. Let say I have a custom list named Temp having Title, Products (which is a DropDownList) and Color Shade (which is a TextBox). When I create a list item I want to select a product from DropDownList and on the selected index changed I want to write the busi...

Getting the list of running applications ordered by last use

I'd like to get the list of running applications in the same order they appear when doing ⌘ + ⇥ I.e. if I use TextEdit, then Preview, then iCal, the order is iCal Preview TextEdit Using [[NSWorkspace sharedWorkspace] launchedApplications] does not work as applications are sorted by launch date/process id. Enumerating with GetNextPr...

SharePoint: How do I create a new list from a list template?

I've created a list template based on an Issue list and it is saved in the List Template Gallery. Now how do I create a new list based on this template? ...

Using Python's list index() method on a list of tuples or objects?

Python's list type has an index() method that takes one parameter and returns the index of the first item in the list matching the parameter. For instance: >>> some_list = ["apple", "pear", "banana", "grape"] >>> some_list.index("pear") 1 >>> some_list.index("grape") 3 Is there a graceful (idiomatic) way to extend this to lists of co...

Lists and MySQL queries

Would it be possible to run a MySQL query pulling the names of locations from a table, inserting them into a dropdown menu and then automatically generating a URL for each one e.g. blablabla.bla/index.php?location=blablabla every time the page loads? Any help is appreciated. ...

If slicing does not create a copy of a list nor does list() how can I get a real copy of my list?

I am trying to modify a list and since my modifications were getting a bit tricky and my list large I took a slice of my list using the following code tempList=origList[0:10] for item in tempList: item[-1].insert(0 , item[1]) del item[1] I did this thinking that all of the modifications to the list would affect tempList object...