list

C# Last Element of List of List

This is probably a really easy question, I want to access the last element of: List<string>[] list = new List<string>[3]; So each list inside has 3 elements but how should I access the last of those lists? ...

Python list subtraction operation

Hi I want to do something similar to this x = [1,2,3,4,5,6,7,8,9,0] x [1, 2, 3, 4, 5, 6, 7, 8, 9, 0] y = [1,3,5,7,9] y [1, 3, 5, 7, 9] y-x which shouel give [2,4,6,8,0] But this is not supported in python list What is the best way of doing it? ...

Trying to load a list into a DataGridView Cell

I'm trying to display an object into a DataGridView using Reflection so far everything works smootly but the problem is that some of the object's properties are Lists. How can I adapt my DataGridView to show a list? public void SetDataSource(PluginBase plugin) { dgvProperties.Rows.Clear(); List<DataGridViewRow> rows = new List<...

[C++] memory leak with std::string when using std::list<std::string>?

I'm working with std::list in my current project. But there is a memory leak somewhere connected with this. So I've tested the problematic code separately: #include <iostream> #include <string> #include <list> class Line { public: Line(); ~Line(); std::string* mString; }; Line::Line() { mString = new std::string("XXXXX...

Pythonic way to convert a list of integers into a string of comma-separated ranges

I have a list of integers which I need to parse into a string of ranges. For example: [0, 1, 2, 3] -> "0-3" [0, 1, 2, 4, 8] -> "0-2,4,8" And so on. I'm still learning more pythonic ways of handling lists, and this one is a bit difficult for me. My latest thought was to create a list of lists which keeps track of paired numbers: ...

Display navigation menu list alphabetically with jquery

Hi guys, I am hoping some smart folks can help me here. I'm out of my depth. I had a wordpress site developed for me a little while ago. I paid the developer for his work, but he never delivered what he promised so I am left to try and fix it. Anyway... The site uses some jquery to activate a drop down menu. When you click on a link cal...

Using synchronized lists

This is my first time using the synchronized keyword, so I am still unsure of how it exactly works. I have a list that I want to be accessed by multiple threads so I do this: players = Collections.synchronizedList(new ArrayList<Player>(maxPlayers)); Now, I want to make sure that I am not calling players.add() at the same time as playe...

How to show the contents of a row as a list, in Android?

I'm creating an Android app, where the user starts out seeing a list of questions. When the user clicks a question, I would like to show him a new clickable list, containing that question and its answer alternatives. My questions reside in rows in the database. The questions live in the first column, while the answer alternatives live i...

push to list in R

OK, this really basic. How do I add an element to a (named) list in R? EDIT when the key name is a varibale for (name in names(list$filenames)) { filename <- list$filenames[[name]] x <- read.table(filename) ret$name <- x # I want name to be interpreted here, not use "name" } ...

Multi-level lists in R

Do I need to initialize each level of a multi-level list in R? l=list() l[["top"]]=list() l[["top"]][["mid"]]=list() l[["top"]][["mid"]][["low_key_1"]]="key_1_val" or is possible to apply some auto-initialization like on perl? ...

[zsh] get list from line-separated output

I want to get a ZSH list from a line-separated output. In my case, from the following command: ssh myhost ls /Applications I tried $(ssh myhost ls /Applications) but that doesn't work (it splits also at spaces). ...

how to check if object already exists in a list

I have a list List<MyObject> myList and i am adding items to a list and i want to check if that object is already in the list. so before i do this: myList.Add(nextObject); i want to see if nextObject is already in the list. the object "MyObject" has a number of properties but comparison is based on matching on two propertie...

How To Paginate A Long Text Post

I'm Creating a website for online reading stories using grails and i'm facing a business problem that if i post a story say 30 pages A4 in the Fckeditor and it had saved will .. the question is how can i display this in a 30 pages with a pagination or something like that.. do anyone have idea cause i'm out of simple ideas and i think ma...

How to bind a TableViewer to a java.util.List in Eclipse RCP

I'm trying to bind a TableViewer to a models = List<ModelObject> , but I don't really get the hang of it. The binding should be possible via master-detail and a databinding context (DataBindingContext), so that I'm able to write the changes of the list (and its elements) to the model only on request (dbc being set to POLICY_ON_REQUES...

Create name of path files from list

I want to create path of files from list. pathList = [['~/workspace'], ['test'], ['*'], ['*A', '*2'], ['*Z?', '*1??'], ['*'], ['*'], ['*'], ['*.*']] and I want [['', '~/workspace', 'test', '*', '*A', '*Z?', '*', '*', '*', '*.*']] [['', '~/workspace', 'test', '*', '*A', '*1??', '*', '*', '*', '*.*']] [['', '~/workspace', 'test', '*'...

Some built-in to pad a list in python

I have a list of size < N and I want to pad it up to the size N with a value. Certainly, I can use something like the following, but I feel that there should be something I missed: >>> N = 5 >>> a = [1] >>> map(lambda x, y: y if x is None else x, a, ['']*N) [1, '', '', '', ''] UPD: Thank you, all. I decided to with the solution of ...

Flex 4 Spark List setting scroll position

Hello! How can I set the scroll position for a Spark List control please? Thank you! ...

RDBMS strategies for storing heirarchical lists? querying/outputting them?

I'd like to store a fair bit of text data with the following structure: 1. Overall Text A 1.1 Subsection Text 1.1.1 Clarification A 1.1.2 Clarification B 1.2 Another Subsection 1.2.1 Don't forget A 1.2.2 Don't forget B 1.2.3 or C! 2. Overall Text B 2.1 getting the idea yet? Section levels would...

Finding the lowest unused unique id in a list

Say there's a list. Each item in the list has a unique id. List [5, 2, 4, 3, 1] When I remove an item from this list, the unique id from the item goes with it. List [5, 2, 3, 1] Now say I want to add another item to the list, and give it the least lowest unique id. What's the easiest way to get the lowest unique id when adding ...

CSS and SQL populated lists.

I'm planning on doing this, but I can't get my head around to if this is completely possible or not. I'm trying to follow this design: http://i37.tinypic.com/28hfpzm.jpg The list on the left is populated by SQL. When clicking on one of these links on the left, the page will change (i.e. something like designers.php?designerID=whatever)...