sorting

Asp.net: How to sort a dropdown having duplicates?

Hi Guys, I have a dropdown in which we add certain items after the dropdown is bound by data from the db, hence the need to sort the dropdown arises. So i need to sort a dropdown which can have duplicates. What is the best way of doing this? ...

OrderBy ThenBy in F#

Hello, Is there any function in F# similar to LINQ fluent syntax for sorting by multiple expressions: myList.OrderBy(fun x->x.Something).ThenBy(fun x->x.SomethingElse) I'd love something like: myList |> Seq.sort_by(fun x->x.Something) |> Seq.then_by(fun x->x.SomethingElse) Thx ...

How can I sort Perl hashes whose values are array references?

Hey I was just wondering if there is a cool "one liner" that would sort my hash holding array references. So I have a bunch of key/values in my hash something like: $DataBase{$key} = \@value; However I would like to sort the hash by the array[0] element. Then loop through 'em. I had this to begin with: foreach my $key (sort {$DataBa...

In Windows, what's the most efficient way to compare two files and return just the records missing in the second file that were originally present in the first file?

At regular intervals we are receiving CSV files from an external source that we have little control over. These files are complete sets of current records; however, any records that have been deleted since the previous are not present. We would like to compare the two files and create a separate file of deleted records so we can do som...

Natural sorting algorithm in PHP with support for Unicode?

Is it possible to sort an array with Unicode / UTF-8 characters in PHP using a natural order algorithm? For example (the order in this array is correctly ordered): $array = array ( 0 => 'Agile', 1 => 'Ágile', 2 => 'Àgile', 3 => 'Âgile', 4 => 'Ägile', 5 => 'Ãgile', 6 => 'Test', ); If I try with asort($array)...

What's a bubble sort?

What is a bubble sort? Can someone help me? Edit- See also this earlier question: What is a Bubble Sort good for? Although very similar, "What is a bubble sort?" is a more fundamental question and is therefore still useful for beginners to programming. ...

Controlling the sort order of a list from an admin UI

Hi I have a list of data that users are able to control the sort order of. It looks something like this Apples /\ \/ Oranges /\ \/ pears /\ \/ banana /\ \/ Pineapples /\ \/ etc /\ \/ the /\ and \/ are meant to be up and down arrows When the user clicks up i want to retrieve the current sort order and ta...

What is the best freeware / open source Log File Viewer with a filter and sort option?

I saw the posting about the Best Tail Log Viewer, but it does not support filtering or sorting of custom column names. I've been testing out the Kiwi Syslogd, and you have to pay for the ability to sort and filter. Does anyone know of a log viewing software tool that also supports filtering and sorting? ...

OAuth - lexicographical byte value ordering in c#

I have written an Service Provider implementation for OAuth and one of the Devs found a bug in the way the implementation was ordering query parameters. I totally missed the lexicographical ordering requirement in the OAuth spec and was just doing a basic string sort on the name value parameters Given the following URI request from the...

Sort lexicographically?

I am working on integrating with the Photobucket API and I came across this in their api docs: "Sort the parameters by name lexographically [sic] (byte ordering, the standard sorting, not natural or case insensitive). If the parameters have the same name, then sort by the value." What does that mean? How do I sort something...

What sort function is used in NSArray?

This is really a three-part question, but I've answered the first question myself: I'm working on the iPhone, with many objects (up to 200) on the screen. Each object needs to look if it's overlapping other objects, and act accordingly. My original naive implementation was for each object to run through the list of each other object t...

Sorting gridviews and sortexpression

Hi I am using a gridview and have have to set a sort expression, I am using: <asp:TemplateField HeaderText="Order Name" SortExpression="OrderId"> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# OrderName(((DataLayer.Car)Container.DataItem).OrderId) %>' /> </ItemTemplate>...

Sort a singly Linked list

The structure of the linked list is head.item = the number you want to sort head.next = the next item The only catch is that I need the singly linked list to sorted in constant space. ...

How to sort a part of an array with int64 indicies in C#?

The .Net framework has an Array.Sort overload that allows one to specify the starting and ending indicies for the sort to act upon. However these parameters are only 32 bit. So I don't see a way to sort a part of a large array when the indicies that describe the sort range can only be specified using a 64-bit number. I suppose I could...

Do Cocoa NSSortDescriptors belong in the model or the controller?

Would NSSortDescriptor subclasses be placed in the Model or the Controller layer? Since they are primarily for display and business logic, it seems to make sense to put them in the Controller layer. But it also makes sense that models should know how to sort themselves. ...

Sorting a Crystal Reports 2008 Cross-tab in two directions

I have a table that shows a list of doctors, facilities, and charges. I set up a Cross-tab Report in Crystal Reports 2008, putting the doctors on the rows, the facilities on the columns, and the sum of the charges (and a couple of related numbers) as the summary fields. When I did this same report in Excel, I had no trouble sorting by s...

Sort a list of objects by using their attributes in Ruby

I have a list of Fruit structs called basket. Each Fruit struct has a name (a string) and a calories (an integer). I would like to sort basket so that: The Fruits with the highest calories appear first. For example, a fruit with 500 calories appears before a fruit with 400 calories. If two Fruits have equal calories, the Fruit whose na...

Sorting and Paging in MDX Query (MS Analysis Services)

I built an MDX query, to retrieve specific articles from an OLAP Cube. Basically it returns articles below a specific article-category node that are produced by a specific manufacturer: SELECT NON EMPTY ( Hierarchize ( { DrilldownLevel ( { [T DAT Article].[Ar ID].[All] } ) } ) ) DIMENSION PROPERTIES PAR...

Which Algorithm Does Ruby's Sort method use?

When I sort an Array using the native sort method, which algorithm does RUBY decide to use? Is it data-dependant (i.e If the data is small it uses X algorithm else uses Y algorithm)? Is it a stable sort? What is the average time complexity? ...

How to get RedGate Data Compare to consider sort order?

I am using SQL-Server 2005. I have a dev and prod database that have essentially the same data in them. When I do a compare with RedGate SQL Data Compare 5, it says that only 4 records differ. However, when I open up the tables and view them, they are in a completely different sort order. Neither table has an index or anything forcin...