list

Move an item inside a list? [Python]

In python, how do I move an item to a definite index in a list? Thanks in advance for the reply. ...

C# - Generic Lists - Can't Clear and Add all over Again ..

The Problem is .. I have a Set of Lists IDs .. Each one Related to Set of Traffic IDs in the Database .. I wanna Use One List ID for each loop to get that set of TL IDs and store them in a List but in a Class-seem manner ! when I don't add TL_ids.Clear(); at beginning .. all results are added so the final result becomes = Count of all ...

RegEx, colon separated list.

I am trying to match a list of colon separated emails. For the sake of keeping things simple, I am going to leave the email expression out of the mix and match it with any number of characters with no spaces in between them. The following will be matched... somevalues ;somevalues; somevalues; or somevalues; somevalues ...

How can I use LINQ to see if a list<string> contains a string that starts with 'blah'?

I have a List with a few strings in it. I want to see if it contains a a string that starts with 'blah' however, I'm not sure how to use the (this IEnumerable source, value):bool overload of List.Contains. ...

Maintaining a list of Objects on a JSP page

Hi, I have been developing a piece of simulation software using Struts 1.3/JSP. I am trying to find a way to display of list of objects on my JSP page which can be added to/deleted from. I actually have a list of chemical steps, each step has a list of product and reactant species (species is also a java object) This is the Step class...

Is there an event for completing data-rendering in a <s:List> component ?

Say I have a component pulling remote data into its dataGroup. I'd like to call ensureIndexIsVisible as soon as the dataGroup finishes on-screen rendering. But if I do that right after the dataGroup initialization, it throws out an runtime exception. However when I put the ensureIndexIsVisible into a callLater() function then it works...

How do I create a data structure that will be serialized this JSON format in python?

I have a function that accepts a list of date objects and should output the following dictionary in JSON: { "2010":{ "1":{ "id":1, "title":"foo", "postContent":"bar" }, "7":{ "id":2, "title":"foo again", "postContent":"bar baz boo" } }, "2009":{...

Python: Select subset from list based on index set

I have several lists having all the same number of entries (each specifying an object property): property_a = [545., 656., 5.4, 33.] property_b = [ 1.2, 1.3, 2.3, 0.3] ... and list with flags of the same length good_objects = [True, False, False, True] (which could easily be substituted with an equivalent index list: good_indices...

Understanding infix method call and cons operator(::) in Scala

Hello, I'm quite new to Scala programming language, and was trying something out stucked in my mind while I was following the lecture notes at here. I think I couldn't really understand how cons operator works, here are some things I tried: I've created a pseudo-random number generator, then tried to create a list of one random value...

add append update and extend in python

Is there an article or forum discussion or something somewhere that explains why lists use append/extend but sets and dicts use add/update. I frequently find myself converting lists into sets and this difference makes that quite tedious so for my personal sanity I'd like to know what the rationalization is. The need to convert between ...

Creating list of divs by class

I'm not sure whether I should be doing this with jquery or php, but I have a html page with several divs of the same class, but different ids. ie: <div class="something" id="furniture">contents</div> <div class="something" id="lighting">contents</div> <div class="something" id="homewares">contents</div> What I'm looking at doing is cr...

Python List Division/Splitting

Possible Duplicate: How do you split a list into evenly sized chunks in Python? Hello, I'm trying to find a simpler way to do the following: def list_split(list, size): result = [[]] while len(list) > 0: if len(result[-1]) >= size: result.append([]) result[-1].append(list.pop(0)) return result Example usage: ...

Is it breaking Facade design pattern

In HomeCADEngine facade class I have a method "addRoom(room:Room)" and it will add this room to a ArrayList. But is it break facade pattern when we create a room outside facade class and then pass it into addRom() method?? Many thanks ...

Track changes to a sharepoint list item

We are developing a system using SharePoint 2010 Foundataion. We would like to track all changes made to a list. What is the best way to do this? ...

Unique list of items using LINQ

I've been using LINQ for a while now, but seem to be stuck on something with regards to Unique items, I have the folling list: List<Stock> stock = new List<Stock>(); This has the following Properties: string ID , string Type, string Description, example: public class Stock { public string ID { get; set; } public string Type {...

ASP DROP DOWN list, onchage event doesn,t work

if i use onchange=return fn1(), in client side even the fn1 return false it automatically fired the server side onselectedindexchange event,How i can i stop the server side event if the script fn1 return false... ...

How to modify a List<T> of structures in .NET?

Why I am not able to modify List items? struct Foo { public string Name; } Foo foo = new Foo(); foo.Name = "fooNameOne"; List<Foo> foos = new List<Foo>(); foos.Add(foo); // Cannot modify the return value of // 'List<Foo>.this[int]' because it is not a variable //foos[0].Name = "fooNameTwo"; Foo tempFoo = foos[0]; tempFoo.Na...

Need help sorting list of objects by key.

I am unable to get this code to sort a list of objects using either .sort() or sorted(). What am I missing here? P.S. My solution.distance() method could use some cosmetic surgery too if anyone has any suggestions. Thanks! import random import math POPULATION_SIZE = 100 data = [[1, 565.0, 575.0], [2, 25.0, 185.0], ...

Listing And Linking Files

I'm developing a Servlet that should act listing all the files that are on the directory C:\UploadedFiles\CompanyWork on the page and put the link for the files on each one, like this example(using Test.doc as test): <a href="C:\UploadedFiles\CompanyWork\Test.doc">Test.doc</a> But I don't know how to do this, I only know how to get th...

Programmatically selecting item in Dashcode list

Is their a way to programmatically select an item in a dashcode list with having the user click on the list? Something like: var list = document.getElementById("list"); list.select_item(3); ...