list

.NET check if two IEnumerable<T> have the same elements

Possible Duplicate: Comparing two collections for equality I need to verify if two IEnumerable<T> lists have the same elements, not necessarily in the same order. I'm targetting .NET 3.5. Here are the tests. The question is, how should HasSameElements() be implemented? var l1 = new[]{1,2,3}; var l2 = new[]{3,1,2}; bool rez...

Dynamic columns based on rows

What I am doing might be really stupid, if so, please correct me, but I am trying to do the following thing: I want to have a list with (for example) the following items: List Addresses -Name -Address -City -Country But, based on their Country, I want to display different columns that I want to record in a List. For instance: Count...

Converting plain text into html style lists using xstl, or grouping elements according to their contents and their positions using xslt

Trying to convert a plain text document into a html document using xslt, I am struggling with unordered lists. I have: <item>some text</item> <item>- a list item</item> <item>- another list item</item> <item>more plain text</item> <item>more and more plain text</item> <item>- yet another list item</item> <item>even more plain text</ite...

Python: Problem with list editing

Simplified version of my code: sequence = [['WT_1', 'AAAAAAAA'], ['WT_2', 'BBBBBBB']] def speciate(sequence): lineage_1 = [] lineage_2 = [] for i in sequence: lineage_1.append(i) for k in sequence: lineage_2.append(k) lineage_1[0][0] = 'L1_A' lineage_1[1][0] = 'L1_B' lineage_2[0][0] = 'L2_A...

Stuck scrolling of a list, using Sencha Touch

What I am trying to do is have a "load more" button at the bottom of a ajax populated list. I have got all the code working with a docked button, but I would now like to have it at the bottom. What is happening is when the listView card is show I see my list but the list won't scroll. It pulls up and down a little but just won't have it...

Scheme List Derangement (Rearrangement of sorts)

im trying to write a function in Scheme where i accept a list and return all the different derangements (look below for definition) as a list of lists derangement: A list where no item is in the same place as the original list ex: '(a b c) -> '(cab) any help is appreciated! ...

Insertion sort debug help

The following C code doesn't work (it just clears the list): /* Takes linkedlist of strings */ static int insertSort (linkedlist *list) { linkedlist sorted; void *data; node *one, *two, *newnode; unsigned int comp, x; removeHeadLL (list, &data); initLL (&sorted); addHeadLL (&sorted, data); while (list->count) { rem...

F# discriminated union picking 0 or 1 from a list

Hi all, Given a mapping program where I map from an array of strings to a discriminated union, I want to select an instance of a particular DU type. I know that there will be 0 or 1 instances. Is there a smarter way to do it than this? type thing = { One:int; Two:int; Three:int} type data = | Alpha of int | Bravo of thing ...

how do I advance to the next item in a nested list? Python

Working with a couple of lists, iterating over each. Here's a code segment: self.links = [] self.iter=iter(self.links) for tgt in self.links: for link in self.mal_list: print(link) if tgt == link: print("Found Suspicious Link: {0}".format(tgt)) self.count += 1 else: self.coun...

Split Python list into several lists based on index

So I've got a string of bytes which represents cubes in three dimensions. The coordinates are ordered like this: [x0y0z0, x0y1z0, x0y2z0, ..., x0y127z0, x0y0z1, x0y1z1, ..., x15y127z15] I'd like to split this into 128 lists, one for each Y coordinate. This code already does that, but I think inefficiently. Is there some way to split t...

print lists in a file in a special format in python

Hi, I have a large list of lists like: X = [['a','b','c','d','e','f'],['c','f','r'],['r','h','l','m'],['v'],['g','j']] each inner list is a sentence and the members of these lists are actually the word of this sentences.I want to write this list in a file such that each sentence(inner list) is in a separate line in the file, and each ...

Setting Focus on a List ItemRenderer with TextArea inside?

I've wrote a custom itemrenderer for a List component (Flex 3.5) which is a VBox with a Label and a TextArea wrapped inside. All works fine so far but I want the TextArea in the first itemrenderer to receive focus so that it instantly becomes editable when tabbing onto the List. Is that possible and if how would I achieve this? I've alr...

CSS single select list example

I am looking for a click based single select list. Instead of the normal drop down list, I want an overlay menu (similar to how we see on facebook when we change privacy settings, the single select list that appears). Is that CSS based or any code examples to creating a similar list? All the lists i found of the net are hover lists not s...

Return a range of elements of each list inside a list of lists

From a list mylist = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] how can I get a new list of lists composed of the first two elements of each "inside" list e.i. newlist = [[1, 2], [4, 5], [7, 8]]? Is there a one-liner that can do this efficiently (for large lists of lists)? ...

jquery doesn't add my list elements to a dynamic injected <ul> list

Hey there I really don't know where the fault is all about. Here is my code: $(document).ready(function(){ $("#folderTree > li").live('click',function(){ var id = $(this).attr("id"); if($('#' + id).hasClass('folderClosed')){ $.ajax({ url: "libs/php/ajax/documents/treeHandler.php", type: "POST", ...

Assigning a value to an element of a slice in Python

This is a simple question about how Python handles data and variables. I've done a lot of experimenting and have Python mostly figured out, except this keeps tripping me up: [edit: I separated and rearranged the examples for clarity] Example 1: >>> a = [[1], 2] >>> a[0:1] [[1]] >>> a[0:1] = [[5]] >>> a [[5], 2] # The assignment worked...

SPARQL get all nodes of transient relation

Is it somehow possible to get the list of nodes connected through a transient relation with SPARQL? I have elements that are connected in this way: ?a g:eastOf ?b ?b g:eastOf ?c ... Not all nodes are connected with each other, because some are further down south. Only when nodes are vertically at the same plain there might be a g:eas...

CSS Positioning - Unordered List

I want to position an unordered list of items on the left-hand side of a menu header (horizontally displayed, not vertically). For example where you see Home, HTML, etc: How do I accomplish this effect with CSS? ...

json.net serializing List but not into an array

I am trying to serialize a class that contains a List of other objects. I am using the json.net library. I am serializing as follows: return Newtonsoft.Json.JsonConvert.SerializeObject(businessObject, Newtonsoft.Json.Formatting.None); The json that is produced does serialize ok, but the List does not seem to be serialized as a json ...

Sort list of names in Python, ignoring numbers?

['7', 'Google', '100T', 'Chrome', '10', 'Python'] I'd like the result to be all numbers at the end and the rest sorted. The numbers need not be sorted. Chrome Google Python 100T 7 10 It's slightly more complicated though, because I sort a dictionary by value. def sortname(k): return get[k]['NAME'] sortedbyname = sorted(get,key=sort...