sorting

SQL for sorting boolean column as true, null, false

My table has three boolean fields: f1, f2, f3. If I do SELECT * FROM table ORDER BY f1, f2, f3 the records will be sorted by these fields in the order false, true, null. I wish to order them with null in between true and false: the correct order should be true, null, false. I am using PostgreSQL. ...

How to sort NSMutableArray of NSMutableDictionary?

I have NSMutableArray of NSMutableDictionary(NSString objects). One of NSString object is actually a date, and i need to sort NSMutableArray based on that date and I don't want it to sort dates as strings. How can i make it? ...

Organizing a random list of objects in Python.

So I have a list that I want to convert to a list that contains a list for each group of objects. ie ['objA.attr1', 'objC', 'objA.attr55', 'objB.attr4'] would return [['objA.attr1', 'objA.attr55'], ['objC'], ['objB.attr4']] currently this is what I use: givenList = ['a.attr1', 'b', 'a.attr55', 'c.attr4'] trgList = [] objNames = [] ...

How to break this string and sort on version number

I have an ASP app that has a string array as such (there are much more than this): 7.5.0.17 Date: 05_03_10 7.5.0.18 Date: 05_03_10 7.5.0.19 Date: 05_04_10 7.5.0.2 Date: 02_19_10 7.5.0.20 Date: 05_06_10 7.5.0.3 Date: 02_26_10 7.5.0.4 Date: 03_02_10 7.5.0.5 Date: 03_08_10 7.5.0.6 Date: 03_12_10 7.5....

How to sort objects in a many-to-many relationship in ruby on rails?

I've been trying to deal with this problem for a couple of hours now and haven't been able to come up with a clean solution. It seems I'm not too good with rails... Anyway, I have the following: In code: class Article < ActiveRecord::Base has_many :line_aspects has_many :aspects, :through => :line_aspects #plus a 'name' field ...

How to sort Grid view on the basis of particular column?

Hi, I want to sort Grid View on the basis of paticular column. For example: Now i want to sort above table in such a way that all Developers should come first. Thanx ...

JAVA or JAVA SCRIPT OR Idoc SCRIPT alphabetical sort

I have the following task: All items within categories should be sorted alphabetically except for Examples. Special characters and numbers should be displayed before letters. I'm facing with a problem. Most of standard sort functions and plugins are being used the ASCII table. In this table the following symbols: ~,},{ etc. have the in...

Getting Serial Port Information in C#

I have some code that loads the serial ports into a combo-box: List<String> tList = new List<String>(); comboBoxComPort.Items.Clear(); foreach (string s in SerialPort.GetPortNames()) { tList.Add(s); } tList.Sort(); comboBoxComPort.Items.Add("Select COM port..."); comboBoxComPort.Items....

How to use Comparator in Java to sort

I learned how to use the comparable but I'm having difficulty with the Comparator. I am having a error in my code: Exception in thread "main" java.lang.ClassCastException: New.People cannot be cast to java.lang.Comparable at java.util.Arrays.mergeSort(Unknown Source) at java.util.Arrays.sort(Unknown Source) at java.util.Collections....

Partial sorting algorithm

Hello, Say I have 50 million features, each feature comes from disk. At the beggining of my program, I handle each feature and depending on some conditions, I apply some modifications to some. A this point in my program, I am reading a feature from disk, processing it, and writing it back, because well I don't have enough ram to open ...

How do I find the .max of an attribute value among a group of different Models?

Hi, everyone: I am also open to just straight-up refactoring what I'm finding to be pretty repetitive, but to give a baseline of how it's working.... I have for every contact a Campaign, which has_many of three types of Models: Email, Call, and Letter. When an Email (Call or Letter) has been executed for a specific contact, I have a C...

Suitable GUI for sorting rows at database level and/or WYSIWYG level?

Consider an Explorer-like list view with a number of columns. The data is fetched from a database, and the rows can be sorted by clicking the column headers. When you click column A, you expect the fetched data to be sorted by A - at the database level ("ORDER BY" at the selected column). However, sometimes it is desirable to sort the d...

What's the fastest way to search a very long list of words for a match in actionscript 3?

So I have a list of words (the entire English dictionary). For a word matching game, when a player moves a piece I need to check the entire dictionary to see if the the word that the player made exists in the dictionary. I need to do this as quickly as possible. simply iterating through the dictionary is way too slow. What is the quic...

What's the easiest way to sort an EF4 EntityCollection<T>?

I'd love to add some sorting to an EntityCollection that is bound to an ItemsControl (in xaml). I'd also like to do it as simply as possible. It appears that this is not possible. If I wrap the collection in a "sorted" version of the collection property within the Entity I lose collection change notifications. I can't use a Collectio...

How to do a natural sort on an NSArray?

I've got an array of objects, and I need them sorted by their "title" key. It's currently working, though it's using an ASCII sort instead of a natural sort. The titles are filenames, so they look like this: file1 file2 file3 ... file10 file11 file12 I'm getting, as you would expect: file1 file10 file11 file12 file2 file3 ... Doe...

How do i search through and sort a collection of li's using jquery?

Hi, i got some li's that i'd like to sort and search through using jquery. I've found http://plugins.jquery.com/project/TinySort to sort things and http://stackoverflow.com/questions/1428645/search-through-a-big-list-fast-with-jquery to search through the li's. Is there a good plugin that can handle both things (search+sort) or is the...

Sorting mysql array value after string chars swapped from fetched DB data.

I want to sort one column fetched from mysql DB, and stored in an array. After fetching I am doing below steps. DB Fetching fields array in row format. ->Field1, Field2, Field3, Field4, Field5 From that fields array One columns data [Field3], swapping string keywords. eg. AB013, DB131, RS001 should become: 013AB, 131DB, 001RS N...

Ignoring 'A' and 'The' when sorting with XSLT

I would like to have a list sorted ignoring any initial definite/indefinite articles 'the' and 'a'. For instance: The Comedy of Errors Hamlet A Midsummer Night's Dream Twelfth Night The Winter's Tale I think perhaps in XSLT 2.0 this could be achieved along the lines of: <xsl:template match="/"> <xsl:for-each select="play"/> <x...

Pros and cons of sorting data in DB?

Let's assume I have a table with field of type VARCHAR. And I need to get data from that table sorted alphabetically by that field. What is the best way (for performance): add order by field to the SQL-query or sort the data when it's already fetched? I'm using Java (with Hibernate), but I can't tell anything about DB engine. It could...

Problem with Oracle/SQL ORDER BY Statement

Hi, i have the following content inside an varchar2 column: 10.1.2.3 10.2.3.4 8.3.4.1 8.3.2.1 4.2.1.3 4.3.2.1 9.3.1.2 When i query the database i need an result ordered: 4.... 8.... 9.... 10... the NLS_SORT parameter is set to german, an simple "order by COLUMN DESC/ASC" is not working like excepted. It return...