list

why doesn't (list1[-1]+=list2.pop(0))+=list2 work in Python?

I have two lists of strings that, in a better world, would be one list. I need to concatenate the lists, but the last element of the first list needs to be concatenated with the first element of the second list. So these guys: list1 = ["bob", "sal"] list2 = ["ly", "nigel"] needs to become out = ["bob", "sally", "nigel"] So this isn...

Struts 2 List Parameter Passing

How do I pass a list of integers using the s:a href and param tags in Struts 2? Example POJO: private List<Integer> myList = new ArrayList<Integer>(); public List<Integer> getMyList() { return myList; } public void setMyList(List<Integer> myList) { this.myList = myList; } Example JSP Page: <s:url id="testUrl" action="testA...

How can I get the Item Renderer that is at the top of the viewport in a Flex Spark List?

I have a Flex Spark List (well it's a Tree to be precise but it renders as a list) and as I'm scrolling through it I want to provide information about the item that is currently at the top of the list in context to the viewport. So this could be the 100th item in the list depending on how far you've scrolled down. ...

Is a std::list empty when it is first constructed - even if it is a member of a class?

I have defined a class that contains a std::list as a member. When I create an object of that class, I expected the std::list to be empty. However, I queried the iterators returned by begin() and end() and found that they were not equal. How can I ensure that my std::list member is empty on initial construction of the object? Here is ...

single list to dictionary

I have this list: single = ['key', 'value', 'key', 'value', 'key', 'value'] What's the best way to create a dictionary from this? Thanks. ...

Searching through lists with Scheme (DrRacket)

So here's my code: (define *graph* (read(open-input-file "starbucks4.sxml"))) (define get-artifacts (lambda (l) (member (list 'opm:artifact) l))) When I type get-artifacts(*graph*) I get an error saying procedure application: expected procedure, given:...(the whole of my file contents) Anyone see what I'm doing wrong? Thanks gu...

Confusing expression in python

If I have the list: lista=[99, True, "Una Lista", [1,3]] What does the following expression mean? mi_var = lista[0:4:2] ...

Using the member function in Scheme

This is my code: (define p (read(open-input-file "starbucks4.sxml"))) (define get-artifacts (lambda (l) (member (list 'opm:artifact) l))) (get-artifacts p) I was told that the member function searches completely throughout a list. In the .sxml document there is a complicated list that has many elements called "opm:artifa...

Iterating over a List of Strings In Java?

I am using OpenCSV to read data from a CSV file and am using some of the sample code from the homepage: CSVReader reader = new CSVReader(new FileReader("stockInfo.csv")); List myEntries = reader.readAll(); And i am now trying to loop through this list and print out each entry. But i cannot seem to figure out the code to perform this. ...

Android - How to sort list

I have a list that i fill with data from a database, and now i want to sort this data by title and date. Im still new to programming for Android, so cant figure out how to do this here, hope someone can help. Here is how the list is filled: public void fillData() { // get all the data from database DBAdapter db = new DBAda...

Scheme Help. Structs Lists and Recursion

(define-struct binding ( let ; a string num ; a number ) ) (define Bind-A (make-binding empty 1)) (define Bind-B (make-binding "A" 2)) (define Bind-C (make-binding "F" 1)) (define Bind-D (make-binding "A" 1)) (define Bind-E (make-binding "C" 1)) (define Bind-F (make-binding "E" 3)) (define Bind-All (list Bind-A Bind-B Bind-...

linq to List problem in C#

I have class Zones with properties and i want add data which i read with linq to this properties. example List<Zones> z = new List<Zones> z.add(new Zones(...)); var allZones = from s in db.Zones select s; How can i add allZones to z generic List? ...

how to merge 2 List<T> with removing duplicate values in C#

I have two lists List that i need to combine and removing duplicate values of both lists A bit hard to explain, so let me show an example of what the code looks like, and what i want as a result, in sample I use int type not ResultadoDeAnalisisFicheroSql class. first_list = [1, 12, 12, 5] second_list = [12, 5, 7, 9, 1] The result of ...

How can I pass a list of object in a SQL Procedure with SQL Server 2008 ?

How can I pass a list of object in a SQL Procedure with SQL Server 2008 ? I want to avoid this : foreach (var item in itemList) { myContext.ExecuteStoreCommand("EXEC MyAtomicProc ... item ...); } I want to do the foreach in a store procedure. How can I pass a c# list of object and execute this procedure in EF : myContext.Execut...

Programmatically adding columns to Sharepoint List Views.

For a project I am working on, I am trying to do the following thing. There's a Sharepoint 2010 environment, with a few Custom Lists created in Visual Studio. I am adding some fields to them using background code in the FeatureActivated function in the EventReceiver. What I am doing there is adding a lookup field to the Sharepoint Lis...

Python: Parsing JSON String List for Each JSON Object

I use the json module and the dumps method to obtain a string which represents a list of json objects : import json jsonstring = json.dumps(data) I would like to iterate over this string to obtain each JSON object as a string. Any suggestions? Thanks in advance. P.S. I have tried the following: for jsonobject in jsonstring: p...

How to remove all objects from List<object> where object.variable exists at least once in any other object.variable2?

I have having trouble figure out how to write this code. I have a list of items, the items all have an ID. There is also another value that we will call otherID. If otherID is zero or null, we will ignore it. However, if otherID contains the ID of another item in the list, I want to remove that item from the list. Example: item1.ID = ...

Convert Dictionary<string,List<foo>> to List<foo> in C# 2.0

Is there any other way to get List<foo> directly from ValueCollection. Current I am using below code Dictionary<string,List<foo>> dic; List<foo> list= new List<foo>(); foreach (List<foo> var in dic.Values) { list.AddRange(var); } OR List<List<foo>> list= new List<List<foo>>(dic.Values); Above convers...

Why is List<T>.IndexOf() a lot faster than List<T>.Contains()?

Hello, I have List which has 150K elements. Average time of work IndexOf() is 4 times lower than Contains(). I tried to use List of int. For List of strings IndexOf is a bit faster. I found only one main difference, it's attribute TargetedPatchingOptOut. MSDN tells: Indicates that the .NET Framework class library method to which th...

'Non-supported field type change' when modifying a feature

So, now that my previous problem was fixed, I was trying to organize the files a little bit. I found out a 'Note' type field (A multi-line textbox) was supposed to be a Multi-Pick User field. So, I decided to change that. I seemed to change everything, but it just doesn't want to change the type. Which is much a good thing to do, seeing...