sorting

mySQL sorts underscore last.

Hi, I have a column in my table that stores a string (it is a text column): varchar(16) latin1_swedish_ci The problem is, when I say "ORDER BY name ASC" it returns words starting with an underscore at the end. This is an example it returned: -a -mmddd2 -z -z3 aaa b c t _a ___- I bet I can use php to sort, but is there an easy way to...

How to sort a NSArray Alphabetically?

I have an array filled with [UIFont familyNames] but they aren't in alphabetical order. How do I do this? ...

Java : How to sort an array of floats in reverse order ?

I use the following lines to sort an array of floats in reverse order, but I got an error message, what's wrong ? float sortedData[]=new float[100]; ... Arrays.sort(sortedData,Collections.reverseOrder()); Error : cannot find symbol symbol : method sort(float[],java.util.Comparator) location: class java.util.Arrays Arrays.s...

how to sort a numeric/ and literal columns in vim

Using vim 6.0. say I'm editing this file sdfsdg dfgdfg 34 12 2 4 45 1 34 5 and I want to sort the second column Thanks ...

GridView AutoGenerateColumns and sorting

Hi, question about gridview sorting in VB.NET: I have a gridview with autogenerate columns = true <asp:GridView ID="GridView1" FooterStyle-BackColor="Aquamarine" AutoGenerateColumns="true" AllowSorting="true" OnSorting="Gridview1_Sorting" AllowPaging="True" PageSize="12" OnRowCreated="GridView1_RowCreated" RowStyle-Wrap="true" ...

Java - Looking for something faster than PriorityQueue

Hi, i'm using java on a big amount of data. [i try to simplify the problem as much as possible] Actually i have a small class (Element) containing an int KEY and a double WEIGHT (with getters&setters). I read a lot of these objects from a file and i have to get the best (most weight) M objects. Actually i'm using a PriorityQueue wi...

Sorting a dataset with a dataview

This code correctly fetches data, and displays it; however, the sort is completely ignroed. DataTable dt = f.Execute().Tables[0]; dt.DefaultView.Sort = summaryColumn; rptInner.DataSource = dt.DefaultView; rptInner.DataBind(); Is there something I can do to force the view to sort itself? (f.Execute() returns a dataset with at table a...

Sorting a JSON object in Javascript

I've been looking for a while and want a way to sort a JSON object like this: { method: 'artist.getInfo', artist: 'Green Day', format: 'json', api_key: 'fa3af76b9396d0091c9c41ebe3c63716' } and sort is alphabetically by name to get: { api_key: 'fa3af76b9396d0091c9c41ebe3c63716', artist: 'Green Day', format:...

PHP readdir and sort

I'm making a little gallery. I want to read the file names off a directory and print the file names below after I've stripped some leading numerals and file extensions. I have two versions of the code. Version 1 doesn't sort $current_dir = "$DOCUMENT_ROOT"."/weddings2/"; $dir = opendir($current_dir); // Open the sucker whil...

How to sort sql result using a pre defined series of rows

i have a table like this one: -------------------------------- id | name -------------------------------- 1 | aa 2 | aa 3 | aa 4 | aa 5 | bb 6 | bb ... one million more ... and i like to obtain an arbitrary number of rows in a pre defined sequence and the other rows ordered by their name. e.g. in another table i have a short seq...

How to sort ListView items when ListView is in VirtualMode?

I realize i have to sort the collection where the ListView gathers the items from: ListView listCollection = new ListView(); But this doesn't seem to work unless the ListView is added as a GUI-control to the form, that in turn makes it very slow to add items to, hence why i have to use VirtualMode on my GUI-ListView in the first place. ...

Sorting a std::map by value before output & destroy

I am aware that map is not prepared to be sorted, its heavily optimized for fast and random key access., and actually doesn't support std::sort. My current problem is that I have a full map<std::string,int> which I'm not going to use anymore, I just need to extract 10 pairs in value(int) order and destroy it. The best thing if it ...

Flex: Sort -- Writing a custom compareFunction?

OK I am sorting an XMLListCollection in alphabetical order. I have one issue tho, If the value is "ALL" I want it to be first in the list. Most cases this happens already but values that are numbers are being sorted before "ALL" ...I want "ALL" to always be the first selection in my dataProvider and then the rest alphabetical. So I am t...

Sorting Records using Foreign Keys

From my question at http://stackoverflow.com/questions/1362426/get-foreign-key-value, I managed to get the desired output...only one last bit remains. I want to sort my records by the year, make, then model in that order. I thought it'd be as simple as Vehicle.objects.all().order_by('common_vehicle') but this doesn't sort anything. ...

When is the spaceship operator used outside a sort?

This is a best practice question. I've only seen the Perl spaceship operator (<=>) used in numeric sort routines. But it seems useful in other situations. I just can't think of a practical use. Can anyone give me an example of when it could be used outside of a Perl sort? ...

Why does string.Compare seem to handle accented characters inconsistently?

If I execute the following statement: string.Compare("mun", "mün", true, CultureInfo.InvariantCulture) The result is '-1', indicating that 'mun' has a lower numeric value than 'mün'. However, if I execute this statement: string.Compare("Muntelier, Schweiz", "München, Deutschland", true, CultureInfo.InvariantCulture) I get '1', ind...

How to format the result set of parent child records?

All, I have a result set coming from several SQL Server tables, and I need to know what the best way to get the sorted records I need would be. I have the following records; a user name and module number as parent records, and then for each of these modules there are multiple sub-module child records. The problem I'm having is that the...

Why is this merge sort implementation not working?

I am missing something embarrassingly basic here in my Merge Sort implementation: # include <math.h> # include <stdio.h> int temp[10]; void merge_sort(int *indices, int x, int z); void m_merge(int *indices, int x, int y, int z); void merge_sort(int *indices, int x, int z ) { int y; if(x<z){ y = (x+z)/...

Remembering the "original" index of elements after sorting

Say, I employ merge sort to sort an array of Integers. Now I need to also remember the positions that elements had in the unsorted array, initially. What would be the best way to do this? A very very naive and space consuming way to do would be to (in C), to maintain each number as a "structure" with another number storing its index: ...

Lost indexes after sorting

Hi, I have to add a color to particular rows of DevExpress gridview. There is an event RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e). It works fine but if I sort the data, good indexes are lost. How to solve this problem? How to access the sorted data because I only can access datasource. Thank you. Here is ...