list

C# Sort list, Logical Compare

hello all , i have the following problem I have a list with strings for example (100_1, 100_2 .... , 100_10) I sort the list with following code extraImgsRaw.Sort((photo1, photo2) => photo1.CompareTo(photo2)); the result of this is : 100_1, 100_10, 100_2, 100_3 and so on the result that I want is a logical compare like 100_1, 100_2 ...

Traversing unordered lists using Javascript/Jquery

Lets say I have an unordered nested list: <ul> <li>Item a1</li> <li>Item a2</li> <li>Item a3</li> <ul> <li>Item b1</li> <li>Item b2</li> <li>Item b3</li> <ul> <li>Item c1</li> <li>Item c2</li> <li>Item c3</li> ...

jQuery: issue on onclick of "LI"

hi friends, i've a problem with jquery: on click of "li" function, various ie versions are acting differently.. here is the html code. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <meta http-equiv="Conte...

string or list substitution in Python

hi all... how would I go about taking a string ("h1", "h2", "h3, "h4") And substituting these values with numbers 1, 2, 3, 4? Correspondingly, how I would I preform the same operation but on a list instead? Thanks in advance... ...

Dashcode Lists in Firefox

I have a list in dashcode where I update a parameter for the datasource and tell the list to reload. The code is fully functional when view from Safari but the reload command does not appear to work when the same page is viewed in Firefox. The code I am using to update my data source is: dataSource.setValueForKeyPath("keyboard/build/", ...

What's a quick way to convert a List<List<string>> to string[][]?

.ToArray doesn't do it ...

[Haskell] Error "No instance for (Num [t])" in Collatz function

I am new to Haskell, and programming in general. I am trying to define a function which generates the sequence of Collatz numbers from n. I have: collatz n = (collatz' n) : 1 where collatz' n = (takeWhile (>1) (collatz'' n)) where collatz'' n = n : collatz'' (collatz''' n) where collatz''' 1 = 1 ...

using LINQ in C# to convert a List<string> to a List<char>

I have a list of strings in C#, and want to create a list of unique characters that are in the strings in the list, using LINQ. I have so far worked out how to turn the List into a List, but I can't work out how to get the LINQ to go further than that. What I have so far is as follows: List<string> dictionary = new List<string>(someAr...

Jquery - Immediate children

Hello, I have a structure like this: <ul id="mycustomid"> <li><a>Item A</a> <ul class="children"> <li><a>Child1 of A</a> <ul class="children"> <li><a>Grandchild of A</a> <ul class="children"> <li><a>Grand Grand child of A</a></li> ...

Unable to create a Collection Type Dependency Property

I'm trying to create a custom list which features a List of objects. Though when this is set both in the Xaml and the code behind I get a "Incorrect markup error". Below is how I'm settings up the PropertyKey and Property. private static readonly DependencyPropertyKey ItemSourcePropertyKey = DependencyProperty.RegisterReadOnly( ...

Test if lists share any items in python

I want to check if any of the items in one list are present in another list. I can do it simply with the code below, but I suspect there might be a library function to do this. If not, is there a more pythonic method of achieving the same result. In [78]: a = [1, 2, 3, 4, 5] In [79]: b = [8, 7, 6] In [80]: c = [8, 7, 6, 5] In [81...

linq group by and list

i have function public List<string > UserList() { var q = from i in _dataContext.PageStat group i by new { i.UserName } into ii select new { ii.Key.UserName }; } how can i return List ? ...

Most Efficient way to calculate Frequency of values in a Python list?

I am looking for a fast and efficient way to calculate the frequency of list items in python: list = ['a','b','a','b', ......] I want a frequency counter which would give me an output like this: [ ('a', 10),('b', 8) ...] The items should be arranged in descending order of frequency as shown above. ...

ListView won't show up anymore

Hi all, I use the following main.xml for my app. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/toplinear"> <LinearLayout xmlns:android="http://schemas.android.co...

CAR and CDR of a list in Scheme

Hi all, I am confused as to how car and cdr work on lists. Here is an example of what I have tried: (define sample (read)) (display sample) (display (car sample)) (display (cdr sample)) (display (car (cadr sample))) (display (cdr (cdr sample))) On entering the value '(A B C D E F), here is what I get: '(a b c d e f) quote ((a b c d...

how to show chinese word , not unicode word.

this is my code: from whoosh.analysis import RegexAnalyzer rex = RegexAnalyzer(re.compile(ur"([\u4e00-\u9fa5])|(\w+(\.?\w+)*)")) a=[(token.text) for token in rex(u"hi 中 000 中文测试中文 there 3.141 big-time under_score")] self.render_template('index.html',{'a':a}) and it show this on the web page: [u'hi', u'\u4e2d', u'000', u'...

Adding an element to List in Scheme

Hi All, Below is my code which takes a car element of a list(carVal) and an list(initialized to empty) as parameters. I want to append the element to the list but the same is not working. (define populateValues (lambda (carVal currVal) (append currVal(list carVal )) (display currVal))) The display shows empty list all...

Jquery tree traversal - Nested Unordered list elements to JSON

Okay, Now I have an unordered list here: <ul id="mycustomid"> <li><a href="url of Item A" title="sometitle">Item A</a> <ul class="children"> <li><a href="url of Child1 of A" title="sometitle">Child1 of A</a> <ul class="children"> <li><a href="url of Grandchild of A" title="sometitle...

Flattening mixed lists in Python (containing iterables and noniterables)

Possible Duplicate: Flatten (an irregular) list of lists in Python How would I go about flattening a list in Python that contains both iterables and noniterables, such as [1, [2, 3, 4], 5, [6]]? The result should be [1,2,3,4,5,6], and lists of lists of lists (etc.) are certain never to occur. I have tried using itertools.chai...

Sort list in a list of lists F#

Hello guys, I'm trying to sort each Position (which is a list) in a Position list. Currently I'm doint like this: type Position = Position of list<int * Piece> and my function: let SortPositionList positionList : Position list = let rec loop list = match (list: Position list) with | [] -> [] | hd::tl -> [List.sortBy(f...