sorting

Smalltalk collections.

If I have an array of employees, how can I sorted based on employee last name? ...

Linux: GNU sort does not sort seq

Title sums it up. $ echo `seq 0 10` `seq 5 15` | sort -n 0 1 2 3 4 5 6 7 8 9 10 5 6 7 8 9 10 11 12 13 14 15 Why doesn't this work? Even if I don't use seq: echo '0 1 2 3 4 5 6 7 8 9 10 5 6 7 8 9 10 11 12 13 14 15' | sort -n 0 1 2 3 4 5 6 7 8 9 10 5 6 7 8 9 10 11 12 13 14 15 And even ditching echo directly: $ echo '0 1 2 3 4 5 6...

Linq / lamba expressions

Hi there, Trying something with Linq / Lambda's, but have no idea where to search. I'm working on some simple sorting in an ASP.net GridView. Here's some sample code: IQueryable<User> query = (from c in users select c).AsQueryable<User>(); if (isAscending) { switch (e.SortExpression) { case "Name": query.O...

De-dupe files in BASH

I have a set of, oh 8000 or so files, that I need to de-dupe. The files are essentially lists of numbers delimited by returns: nnnn nnnnn nnnn and I would like to sort and de-dupe the numbers within the files themselves. I can do this manually using sort | uniq or sort -u but I effectively want to overwrite the files. Is there a way ...

jQuery sort function freezing a (previous) show() text

Hi all. I'm sorting a list of species, but sometimes the list is large and it takes several seconds to sort it. Thus, I tried adding a small notice to let our users know there's something running (and they should wait). Please just check this page: http://ibc.lynxeds.com/family/babblers-timaliidae And click on "Sort and Filter [+]". Then...

jQuert sort function performance

I'm sorting a list of <li> elements. I adapted a function on a page that I can't link right now. You can see the live site here. Click on "Sort and Filter" and click any of the Sort by methods (English name, material, status...). All sorts are essentially the same, so CPU time is the same. My jQuery function looks like this: jQuery.fn....

Reverse-sorting a Listview (with Comparer class)

I have a two-column ListView linked to a Datapager. The ListView lists all files of a particular type in a particular directory, so the data source is an ArrayList of type FileInfo. Consequently, I had to create a Comparer class to use in the ArrayList.Sort method. FileInfoComparer.vb: Imports System.IO Friend Class FileInfoDateCompar...

Multiple Sorting on LINQ (nested) method

I have the below LINQ method which gets called from a User Control and dumped straight to a standard DataGridView. My users want it default sorted, first, by DisenrollmentDate and then, Member Name. Right now, with the code below, it sorts by DisenrollmentDate ONLY. BLLCmo.cs public static DataTable GetAllMembers(Guid workerID)...

Randomize a sequence of div elements with jQuery

Hello all, I'm trying to do my frist steps with jQuery but I have some trouble to understand how to find a list of child elements from a div parent element. I'm used to work with ActionScript 2 and ActionScript 3 so i could mistake some concept, like what is the better way to randomize a sequence of div elements with jQuery! I have this...

Can I sort text by its numeric value in Python?

I have dict in Python with keys of the following form: mydict = {'0' : 10, '1' : 23, '2.0' : 321, '2.1' : 3231, '3' : 3, '4.0.0' : 1, '4.0.1' : 10, '5' : 11, # ... etc '10' : 32, '11.0' : 3, '11.1' : 243...

Design an efficient algorithm to sort 5 distinct keys in fewer than 8 comparisons

Design an efficient algorithm to sort 5 distinct - very large - keys less than 8 comparisons in the worst case. You can't use radix sort. ...

PHP Ranking System Array Sort

Hi, I develop a ranking system. I got the following array: [1] => Array ( [botarin - Branding und Kommunikation] => 1 [Raiffeisen Kredit 2 Go] => 2 ) [2] => Array ( [Kindersteckdosen] => 1 [Surf lieber mit bob] => 1 [Lafarge Imageinserate] => 1 [MCG Messecongress Graz Inserat...

What's your solution for free-text search and sort ?

AFAIK,MySQL performs really bad at this, what's your solution? BTW,what's the solution of SO? EDIT Please pay attention that free-text search itself is pretty fast in MySQL, but not the case when the result also needs to be sorted on an attribute! ...

sorting and filtering options in WPF Datagrid?

I installed the most recent WPF toolkit and used the Datagrid controll. The list of items is showing with automaticly generated columns based on my IList as ItemsSource. I was wondering if there is an OOTB way to have filtering/sorting in this grid? A way to click the header to make it sort, or use a dropdown in the header that shows al...

(Ruby) how to return a -1 specifically for a specific comparison

let's say when I'm comparing values in ruby, i have a value in mind that no matter what I want, using sort on that value and anything else returns a -1 (so this value is default sorted as smaller than everything). for example, let's say i want '100' to sort smaller 100% of the time against 99. so that if i'm sorting values in an array, ...

Crafting a Comparator object for sorting generic List<? extends T> using Collections.sort()

I am trying to implement a generic sort utility method for a List of objects of any class that implements MyInterface. Per Java API (http://java.sun.com/javase/6/docs/api/java/util/Collections.html), Collections.sort() method signature is: public static <T> void sort(List<T> list, Comparator<? super T> c) I am not sure if List with a ...

Ignore "The" and "A" when sorting a listview in C#

Currently I am making a mini music player / organizer for myself. However, when using a list view, it sorts alphabetically, and doesn't ignore "The" and "A": A Lot Like Me Adiago For Strings Stay Crunchy The Foresaken Time to Pretend should be: Adiago For Strings The Foresaken A Lot Like Me Stay Crunchy Time To Pretend It's all...

sort function C++ segmentation fault

In this code, for vector size, n >=32767, it gives segmentation fault, but upto 32766, it runs fine. What could be the error? This is full code. #include<cstdio> #include<cstring> #include<cmath> #include<queue> #include<utility> #include<algorithm> #include<sys/time.h> using namespace std; #define MAX 100000 bool compare(pair<int,int>...

Arranging Nodes in A JTree

Hello World, I have a JTree in which the user can drag/drop or re-arrange nodes, upon saving I have to re-arrange the nodes such that File type nodes must appear before Folder type nodes. I don't need to sort the files/folders name. User Tree: -FolderA +FFA1 -FA1 -FA2 -FolderB -FB1 -File1 -File2 +FolderC -File3 ...

Sorting A ListView By Column

Currently I use a custom sorter on the listview, and i can sort the listview each time i click on the FIRST column, but it won't sort by other columns. SortStyle: Variable to determine whether it is Ascending Sort, or Descending. if (e.Column == 0) { if (SortStyle == 0) { List.ListViewItemSorter = customSortDsc; ...