list

Why wont my column sort in a winforms .NET datagrid?

I have a WinForms .NET datagrid whose data source is a List<cLineItem> called lines. cLineItem is very simple class with properties like units (int), description (string) and unit amount (float). In code, i populate the list of lines and then set the data source: dataGridView1.DataSource = lines; This correctly populates the grid, ho...

Combining 2 lists in python

I have 2 lists each of equal size and am interested to combine these two lists and write it into a file. alist=[1,2,3,5] blist=[2,3,4,5] --the resulting list should be like [(1,2), (2,3), (3,4), (5,5)] After that i want that to be written it to a file. How can i accomplish this? ...

algorithm for list identification and parsing

I have data which in theory is a list, but historically has been input by the user as a free form text field. Now I need to separate each item of the list so that each element can be analysed. Simplified examples of my data as input by users: one, two, three, four, five one. two. three, four. five. "I start with one, then do two, ma...

Need help with CSS based absolute positioned UL alignment (dropdown effect)

Hey folks, I'm trying to a language switching system in this website. The idea is to have a SPAN which upon hover displays a dropdown box (UL based) that contains a list of available languages. Here's a snapshot of the effect I'm trying to achieve. The dropdown box is actually an unordered list that is hidden by default. Upon hov...

Dynamically decompose list into variables in Python

I have 2 dimensional list created at runtime (the number of entries in either dimension is unknown). For example: long_list = [ [2, 3, 6], [3, 7, 9] ] I want to iterate through it by getting the ith entry from each list inside the long_list: for entry in long_list.iter(): #entry will be [2, 3] then [3, 7] then [6, 9] I know tha...

Quicker ways to search a C# List<String>

I currently have a list called regkey and a string called line_to_delete, which I obviously want to delete from the list. At the moment I'm searching through one element of the list at a time creating substrings as line_to_delete only represents part of the line that I want to delete but is uniquely identifiable within the list. Anyway ...

Fastest Way To Remove Duplicates In Lists Python

I have two very large lists and to loop through it once takes at least a second and I need to do it 200,000 times. What's the fastest way to remove duplicates in two lists to form one? ...

Tcl for getting ASCII code for every character in a string

I need to get the ASCII character for every character in a string. Actually its every character in a (small) file. The following first 3 lines successfully pull all a file's contents into a string (per this recipe): set fp [open "store_order_create_ddl.sql" r] set data [read $fp] close $fp I believe I am correctly discerning the ASC...

Comparing elements in a list in Python's for -loop

What is wrong in the method end in the code? The method end returns always 1 although it should return 0 with the current data. # return 1 if the sum of four consecutive elements equal the sum over other sum of the other three sums # else return 0 # Eg the current sums "35 34 34 34" should return 0 data = "2|15|14|4|12|6|7|9|8|10|...

Sharepoint - A feature creating a list with a workflow : Possible?

I've exported a list definition with Sharepoint Solution Generator. This list is associated with a workflow. If I search for the name of my workflow in the generated "schema.xml" file, I find XML that looks like this : <Field DisplayName="publicationWorkflow" Type="WorkflowStatus" Required="FALSE" ID="{2a2504e5-5ad0-4a9f-8bf4-15ca29e49e...

Linked list Recursion

Hi everyone. So, I was reading about linked lists and recursion. I just wanted to know why can't I use recursion in a method that is static void? Also, I was wondering in Java in the linked list recursion, why you can use static void in printing or search for the nodes. Thank you. ...

Performant intersection and distinct element extraction?

I have a line like the following in my code: potentialCollisionsX.Intersect(potentialCollisionsY).Distinct().ToList(); Which, through profiling, i have determined that it is eating approximately 56 percent of my time. I need to figure out how to provide a efficient implementation. I tried List<Extent> probableCollisions = ne...

Converting Python Dictionary to List

I'm trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict['Capital']="London" dict['Food']="Fish&Chips" dict['2012']="Olympics" #lists temp = [] dictList = [] #My attempt: for key, value in dict.iteritems(): aKey = key aValue = value temp.append(aKey)...

Python: How much space does each element of a list take?

I need a very large list, and am trying to figure out how big I can make it so that it still fits in 1-2GB of RAM. I am using the CPython implementation, on 64 bit (x86_64). Edit: thanks to bua's answer, I have filled in some of the more concrete answers. What is the space (memory) usage of (in bytes): the list itself sys.getsizeof(...

Sorting Lists of List of Dictionaries

I've just read in a file that is something like: name: john, jane car: db9, m5 food: pizza, lasagne Each of these rows (names, car, food) are in order of who owns what. Therefore John owns the car 'DB9' and his favourite food is 'Pizza'. Likewise with Jane, her car is an 'M5' and her favourite food is 'Lasagne'. I effectively have: ...

How do I prevent a line break occurring before an unordered list?

My web-app framework renders form errors for each field in an unordered list <UL> immediately following the invalid field. My problem is that I haven't been able to style things so that the error(s) are listed on the same line with the form field. A line break is instead rendered before the <UL>. This is the html that I'm trying to styl...

Is there a safe way in Scala to transpose a List of unequal-length Lists?

Given the following List: val l = List(List(1, 2, 3), List(4, 5), List(6, 7, 8)) If I try to transpose it, Scala will throw the following error: scala> List.transpose(l) java.util.NoSuchElementException: head of empty list at scala.Nil$.head(List.scala:1365) at scala.Nil$.head(List.scala:1362) at scala.List$$anonfun$trans...

Store large lists of data in iPhone app so they are available to the UI

Hi A bit cryptic, which is also what drives me to start a thread in here, I simply can't find the words to Google the challenge. Im building an app that will have 2 search views that displays 1400 and 16000 possible choices. It is plain lists, no relational or otherwise spanning data. As far as I can figure out I have 3 possibilities:...

Removing duplicates from a list with "priority"

Given a collection of records like this: string ID1; string ID2; string Data1; string Data2; // : string DataN Initially Data1..N are null, and can pretty much be ignored for this question. ID1 & ID2 both uniquely identify the record. All records will have an ID2; some will also have an ID1. Given an ID2, there is a (time-consuming...

Access List items in hidden "Forms" folder using Lists.GetListItems

Is it possible to access the list items in the (hidden) "Forms" subfolder of a document library using the Lists.GetListItems web service method? I need to set the content type of uploaded document templates using Lists.UpdateListItems, otherwise, document created from these templates will have the 'Document' content type and not the cont...