sorting

Wpf Listview performance with filter and sort enabled

Hi All, I have WPF listview, with around 1000 records in it. I am doing on the fly filtering of listview items, that is as user types in to text box control, it matches items with text box content and filter items in to listview. So far filtering was working fine and it was pretty fast. Recently I have implemented custom sort on this ...

How to sort a JSON array ?

I read in the following JSON object using ajax and store the object as an array: var homes = [ {"h_id":"3", "city":"Dallas", "state":"TX", "zip":"75201", "price":"162500"}, {"h_id":"4", "city":"Bevery Hills", "state":"CA", "zip":"90210", "price":"319250"}, {"h_id":"5", "city":"...

Sorting of 2D array rows in jquery

Hi folks, I have a table which have to sort with expanding and collapsing of row groups. Because this i am using 2D array. The way of DOM selection or some other regions its execution time is bad. I appreciate your response. Table image $.each(myData, function(index, row) { $.each(row, function(index1, row2) { row2.sortKe...

C equivalent to Arrays.sort from Java - qsort? (How do i find the nature of its implementation)

Hi All, I'm fairly new to the C programming language but I know that it is not standardized in the same way as Java. When performing a comparisson of the runtime of a algorithm, to keep the analysis fair, I need to call a method similar to Java's Array.sort(int []). void qsort(void *base, size_t nmemb, size_t size, int (*compar)(cons...

Sorting UTF-8 strings in RoR

I am trying to figure out a 'proper' way of sorting UTF-8 strings in Ruby on Rails. In my application, I have a select box that is populated with countries. As my application is localized, each existing locale has a countries.yml file that relates a country's id to the localized name for that country. I can't sort the strings manually i...

Sorting Hash of Hashes by value (and return the hash, not an array)

I have the following hash: user = { 'user' => { 'title' => {'weight' => 1, .... } 'body' => {'weight' => 4, ....} .... .... } } Is is possible to get the User sorted by the weight key of its child hashes? I looked in the Hash.sort, but it looks like it returns array rather than my original hash sorted. ...

Sort a "sorted" array

Suppose given an array of size n, with sorted values. In iteration i, a new random-generated value is given, and inserted into the end of the array. The array is then resorted, and discard the least value item. After iteration n, the retained array will contain the largest value items. For example, in Java syntax, it will be somet...

Sorting by column name string

I have an observable collection. I want to use linq to sort it. I have the propertyname of the property I want to sort (as a string) for my type. What is the best/fastest way to do this? Different propertyname strings will be passed into the function ...

How can I sort XML entries with LibXML and Perl?

I'm parsing an XML file with LibXML and need to sort the entries by date. Each entry has two date fields, one for when the entry was published and one for when it was updated. <?xml version="1.0" encoding="utf-8"?> ... <entry> <published>2009-04-10T18:51:04.696+02:00</published> <updated>2009-05-30T14:48:27.853+03:00</updated> <ti...

Sorting modified preorder traversal mysql tree

Hey, I've implemented a tree in a mysql table using: http://dev.mysql.com/tech-resources/articles/hierarchical-data.html This is the method where you have a table like: +-------------+----------------------+-----+-----+ | category_id | name | lft | rgt | +-------------+----------------------+-----+-----+ | 1 ...

Best way to make WPF ListView/GridView sort on column-header clicking?

There are lots of solutions on the internet attempting to fill this seemingly very-basic omission from WPF. I'm really confused as to what would be the "best" way. For example... I want there to be little up/down arrows in the column header to indicate sort direction. There are apparently like 3 different ways to do this, some using code...

MySQL: Sort GROUP_CONCAT values

In short: Is there any way to sort the values in a GROUP_CONCAT statement? Query: GROUP_CONCAT((SELECT GROUP_CONCAT(parent.name SEPARATOR " &raquo; ") FROM test_competence AS node, test_competence AS parent WHERE node.lft BETWEEN parent.lft AND parent.rgt AND node.id = l.competence AND parent.id != 1 ORDER BY parent.lft) SEPAR...

Live sorting of JTable

I've figured out how to get a JTable to be sorted properly, but I can't figure out how to get it to automatically update the sort order when a table cell is changed. Right now, I have this (admittedly long) code, mostly based on that in the Java Tutorial's How to Use Tables. I've highlighted the changes I've made with // ADDED. In this ...

Sort NSFileManager Results

Hi Everyone: I am wondering how to get a NSFileManager listing to display the results in the order that the Finder sorts them. By default, this code: NSFileManager *fileManager = [[NSFileManager alloc] init]; NSError *foundErrors = nil; NSArray *contentsOfDockDirectory = [fileManager contentsOfDirectoryAtPath:@"/Users/me/Desktop err...

What sorting technique will you use?

If you have 65536 random English words with length 1-32 per word that you need to count for appearance and sort based on dictionary or appearance rank, how do you structure the data and what sorting technique would you use to process it the fastest? ...

How to order find results on value from either of 2 columns? (which ones depends) (Rails)

Hi, Total noob question. Would greatly appreciate any pointers. I have a rails model that includes 2 possible values for a concept, e.g., distance (a value from a GPS file and an edited value). It's possible to have a value in either column (just file or just manual), both (manual overwrites file in this case), or neither: distance-f...

A question on python sorting efficiency

Alright so I am making a commandline based implementation of a website search feature. The website has a list of all the links I need in alphabetical order. Usage would be something like ./find.py LinkThatStartsWithB So it would navigate to the webpage associated with the letter B. My questions is what is the most efficient/smartes...

Subsonic-Paging-Order problem

I have a datagrid where I am using the custom paging option (ref: http://subsonicproject.com/querying/webcast-using-paging/) in the Subsonic framework. I also have a dropdown that filters the data by State. This is added to the query through the addwhere call. the data is ordered by state ASC and then city ASC. the data seems to be...

Selection Sort - Index of Min/Max

I was looking through the selection sort algorithm on cprogramming.com and I think I found an error in the implementation. If you work through the algorithm, there's a variable called "index_of_min" which I believe should be "index_of_max" (since when I tested it, it was sorting largest to smallest). Thinking that it was a typo or a mi...

sort with lexicographic order

I see the results from the following code, but I don't understand exactly how the or knows what to do in the following sort example: use Data::Dumper; $animals{'man'}{'name'} = 'paul'; $animals{'man'}{'legs'} = 2; $animals{'cheeta'}{'name'} = 'mike'; $animals{'cheeta'}{'legs'} = 3; $animals{'zebra'}{'name'} = 'steve'; $animals{'zebra...