sorting

What is the preferred technique to convert an object's properties to a sorted list of tuples?

I'm working with an open-source library and they define a class like so: class Provider(object): """ Defines for each of the supported providers """ DUMMY = 0 EC2 = 1 EC2_EU = 2 RACKSPACE = 3 SLICEHOST = 4 GOGRID = 5 VPSNET = 6 LINODE = 7 VCLOUD = 8 RIMUHOSTING = 9 I need to take the propert...

Sorting arrays numerically

I have a PHP array that I need to sort. I have included the example array below. I need to put the top 10 number of URLS plus their perspective counts in a different array. I know I could run into problem if there aren't 10 top matches ... if that happens then a random matching would be fine. Any suggestions? I have tried sort(myarra...

Asp.Net Hierarchical Grid, Frozen Header and Export to excel - need expert suggestion

Here's a link to the Dashboard page that I'm trying to built (image of the old implementation) So, basically the Grid needs the following features: Parent-child cascading (only 1 level) - the yellow row are parent Grid which expand-collapse (simple js trick). The whole Grid needs to have a 'frozen' header. As you can see in the image...

Sorting DataTable-columns

I have a datatable something like this: | Col1 | Col6 | Col3 | Col43 | Col0 | --------------------------------------------------- RowA | 1 | 6 | 54 | 4 | 123 | As you see, the Cols are not sorted by their numbers. That is what I want it to look like after the "magic": | Col0 | Col1 | Col3...

Default list of Django built-in middleware

Django comes with a list of built-in middleware, but if one wants to use all (or most) of them, he has to work through tons of docs in order to get the right sorting in the settings.py file. Is there an optimal default order of all built-in Django 1.1 middleware classes? I.e., something to copy'n'paste into settings.py: MIDDLEWARE_CLAS...

SSRS Tablix Sorting w/Row & Column Group

My matrix has a row group (QuestionText) and a Column Group (AnswerText). It looks like this: [AnswerText] [QuestionText] [AnswerCount] My Data looks like this: QuestionText AnswerText AnswerCount Question 1 Yes 2 Question 1 No 1 Question 2 Yes 3 Question 2 ...

Datagrid cannot sort on some fields - object, object subfield, base type

When using the Silverlight DataGrid with an IList derived data source it is possible to click a column to sort by it, assuming the CanUserSortColumns/CanUserSort properties are not false. However I'm finding some edge cases cannot be sorted by - the values are shown, but clicking the column has no effect. The first edge cases would see...

Short Circuiting sort

I understand that: head (map (2**) [1..999999]) Will only actually evaluate 2**1, and none of the rest, but the book I am reading says that: head (sort somelist) Will only need to find the smallest item in the list, because that is all that is used. How does this work? As far as I can tell, this would be impossible with the sorting...

Check the sortedness Of An Array

I need an Algorithm which is used to find the N-element randomly-ordered integer array is either already sorted or not. ...

Using jQuery range slider with TableSorter

I recently scrapped a project that utilized a few different jQuery technologies. After deciding to use Tablesorter (or any other sorting method), I found that I simply had to use it. I have a list of data and am in need of finding a method to sort it. There is a catch: it needs to also include the range slider. I have a table with ea...

Refresh GroupCollection of an AdvancedDatagrid - the sorted Arraycollection gets Randomized

I have an AdvancedDatagrid which gets populated by an ArrayCollection. I ordered the ArrayCollection by date (one of its properties), so it shows from past to future. The thing is, if I refresh the GroupingCollection (for immediate display in the datagrid) After the Sorting of the ArrayCollection, the ordering of the dates in the ArrayC...

Sort blank entries to bottom of LINQ query.

I am trying to sort a LINQ to SQL query based on two fields. The first field is occasionally null which automatically sorts to the top of an ascending query. Is there any way to make the null entries sort to the bottom? Here is an example: From x in SampleDataContext.Event _ Order By x.Date, x.Sequence_Number _ Select x.Date, x.Seq...

Sorting and i18n in Database

I have the following data in my db: ID Name Region 100 Sam North 101 Dam South 102 Wesson East ... ... ... Now, the region will be different in different languages. I want the Sorting to happen right, based on the display value rather than the internal value. Any Ideas? (And yeah, sorting in memory using Java is ...

What is the best way to search for an item in a sorted list in javascript?

I have an ordered list of integers, and would like to search through them. What is the fastest way to do this? Is this the fastest it will work? Or can we optimise it because it is ordered? Array.prototype.Contains = function(value) { for (var index = 0; index < this.length; index++) { if (value == this[index]) { ...

which type of sorting is used in the function sort()?

Can anyone please tell me that which type of sorting technique (bubble, insertion, selection, quick, merge, count...) is implemented in the std::sort() function defined in the <algorithm> header file in C++? ...

Are there settings in Crystal Reports that modify sort order of data sources?

I'm working with Crystal Reports in VB.NET in Visual Studio 2005. I have a List(Of Stuff) that I've sorted according to one of the object's members. I've verified in the debugger that the list is sorted correctly. When I define my list as the data source, as in rptDetails.Subreports.Item("rptSubReport").SetDataSource(theListOfStuff) ...

Is selection sort an efficient algorithm?

I know it's a quadratric time algorithm, but how does it compare to other sorting algorithms, such as QuickSort or Bubble Sort? ...

How to sort NSMutableArray using sortedArrayUsingDescriptors ?

Hi, I have a question about sorting NSMutableArray. I can use sortedArrayUsingDescriptors: method to sort an array with objects. For example I have an NSMutableArray of places where I have an attribute frequency (int value) and I want to sort descending on frequency but I don't now if I how to use it correctly. What do I put as a k...

How do I get LINQ to order according to culture?

Say I've got a list of strings with Swedish words: banan, äpple, apelsin, druva Now I want to get this list ordered (keep in mind that this is a very simplified version of the real query): var result = from f in fruits // The list mentioned above orderby f select f This will give me: apelsin, äpple, banan, d...

C# highest string

This seems so trivial but I'm not finding an answer with Google. I'm after a high value for a string for a semaphore at the end of a sorted list of strings. It seems to me that char.highest.ToString() should do it--but this compares low, not high. Obviously it's not truly possible to create a highest possible string because it would a...