list

Delphi: Save TList of objects in text file

In Delphi I have the following classes: type TSong = class(TObject) private FArtist: String; FTitle: String; procedure SetArtist(Artist: String); procedure SetTitle(Title: String); public property Artist: String read FArtist Write SetArtist; property Title: String read FTitle Write SetTitle; constructor...

Trying to use std::list in objective-c program

I'm trying to use a std::list in my objective-c program and having run-time issues. I have (edit for brevity) #import <list> ... @interface Foo { std::list<Bar *> *myList; } ... @implementation Foo -(void)loopList { myList = new std::list<Bar *>; for (std::list<Bar *>::iterator ii; ii != myList->end(); ++ii) ...

unexpected list appearing in python loop

I am new to python and have the following piece of test code featuring a nested loop and I'm getting some unexpected lists generated: import pybel import math import openbabel search = ["CCC","CCCC"] matches = [] #n = 0 #b = 0 print search for n in search: print "n=",n smarts = pybel.Smarts(n) allmol = ...

How can I stop PHP from replacing the variable everytime the form is updated?

Basic question - I have a text area with a submit button that is linked to the variable $ListItem. Further down the page I want to print $ListItem in a <li> and everytime something new is entered in the text area, I want to assign it a new variable ($ListItem2 perhaps?) and then print it below the previous one. With my current code, ...

how to put a pin_ptr into a generic list?

I've got a managed C++ method that takes as a parameter a list of String^ the method needs to populate an unmanaged structure with pointers to the memory in the String^ extracting the WCHAR* is simple enough with PtrToStringChars however I dont know the number of pin_ptr's to allocate at design time I'd like to add the pinned ptr to ...

Anybody knows any third party tool to synchronize lists shema between two SharePoint portals?

I am working on SharePoint development field, and I am suffering from updating the production servers with the latest changes on the development server. Anybody knows any third party tool that synchronizes the changes between two SharePoint portals. I am using WSS 3.0 Thanks in advance for your help. ...

Why use an array to implement a "list" instead of a hash table?

Consider an array versus a hashtable where the keys are just the integral indexes of a list. Their average-case insertion, lookup, and removal big-O bounds are all O(1) constant time. I understand that you may get some low-level wins in cache locality with an array, and there is a marginal (mostly-constant) overhead to the hashtable ope...

Optimized Generic List Split

Read the edit below for more information. I have some code below that I use to split a generic list of Object when the item is of a certain type. public static IEnumerable<object>[] Split(this IEnumerable<object> tokens, TokenType type) { List<List<object>> t = new List<List<object>>(); int currentT = 0; ...

how to retrieve the elements in list without using foreach in C#?

i like to know how to retrieve the elements from the list without using foreach.Thanks ...

How to add several classes to ul list

How can I add severeal classes to ul list? I dont want to add it to every li items but jsut some of them. ...

Trouble using 'foreach' with a generic list

I have not until now tried to use a foreach clause in a generic list. The compile error I get is: foreach statement cannot operate on variables of type 'DMS.OrderNodeList' because 'DMS.OrderNodeList' does not contain a public definition for 'GetEnumerator' Any suggestions what to do next? Thanks, ...

JGoodies list binding

Does the JGoodies list binding support binding list contents to a list object in the model? I know I can add listeners to the list model and domain model and coordinate changes between the two fairly easily, but I wasn't sure if JGoodies would do that. I could only find list binding that dealt with list selection events. ...

Extending a list of lists in Python?

I might be missing something about the intended behavior of list extend, but why does the following happen? x = [[],[]] y = [[]] * 2 print x # [[],[]] print y # [[],[]] print x == y # True x[0].extend([1]) y[0].extend([1]) print x # [[1],[]], which is what I'd expect print y # [[1],[1]], wtf? I would guess that t...

Type List vs type ArrayList in Java

(1) List<?> myList = new ArrayList<?>(); (2) ArrayList<?> myList = new ArrayList<?>(); I understand that with (1), implementations of the List interface can be swapped. It seems that (1) is typically used in an application regardless of need (myself I always use this). I am wondering if anyone uses (2)? Also, how often (and can I p...

F# Split list into sublists based on comparison of adjacent elements

I've found this question on hubFS, but that handles a splitting criteria based on individual elements. I'd like to split based on a comparison of adjacent elements, so the type would look like this: val split = ('T -> 'T -> bool) -> 'T list -> 'T list list Currently, I am trying to start from Don's imperative solution, but I can't work...

A list vs. tuple situation in Python

Is there a situation where the use of a list leads to an error, and you must use a tuple instead? I know something about the properties of both tuples and lists, but not enough to find out the answer to this question. If the question would be the other way around, it would be that lists can be adjusted but tuples don't. ...

Removing empty items from a list (Python)

I'm reading a file in Python that isn't well formatted, values are separated by multiple spaces and some tabs too so the lists returned has a lot of empty items, how do I remove/avoid those? This is my current code: import re f = open('myfile.txt','r') for line in f.readlines(): if re.search(r'\bDeposit', line): print l...

Adding an entry to a python tuple

I have a list of tuples representing x,y points. I also have a list of values for each of these points. How do I combine them into a list of lists (i.e one entry for each point [x,y,val]) or a list of tuples? Thanks ...

How to order a TimeZone list in .NET?

I have an ASP.NET web application that requires users to select their appropriate time zone so that it can correctly show local times for events. In creating a simple approach for selecting the time zone, I started by just using the values from TimeZoneInfo.GetSystemTimeZones(), and showing that list. The only problem with this is ...

List.Contains returns false, even though it seems it should return true

Sub pageload() Handles Me.Load Dim bom As New List(Of Car) Dim car1 As New Car With {.Name = "Pea", .Year = 2} Dim car2 As New Car With {.Name = "Pea", .Year = 2} bom.Add(car1) MsgBox(bom.Contains(car2)) End Sub WHY??? I mean the object has the exactly same data, so why does it say it is not contained? ...