sorting

Performance regarding return type for LINQ query compatible with automatic sorting

Hi! this isn't really an issue, but more of a concern that I would appreciate some input on please. Winforms C# .net3.5[sp1] Visual Studio 2008 using Linq2Sql (more specifically PLINQO...which is fantastic btw!). I have a resultset returning +/- 19000 rows of data (with about 80bytes of data per row) and opted to push the data retrieva...

AS3 sortOn woes

Hi all, I have an Array called alarmQueue. I'm pushing a new arrays in to it with the contents [hours:int, minutes:int, seconds:int] and I'd like to use alarmQueue.sortOn() to sort the queue of alarms Ascending but I'm having problems getting my head around the logic. // the function to push the alarm in to a queue public function setAl...

Silverlight 3 - Add a value converter for the SortMemberPath property of a data grid column header

Hello everyone, I created a DataGrid, that utilizes customized data cells using the DataGridTemplateColumn.CellTemplate directive. I placed a textblock inside with the Text field using a Binding to one of the ItemSource members. As the content of that member differs between "Green", "Yellow" and "Red". Everything works fine. The Foregro...

XSLT, sort and group by year-date

Hello Regarding Umbraco XSLT version 1. I have aprox. 150 news items in XML. Lets say like this (all is pseudocode until I get more familiar with this xml/xslt): <news> <data alias=date>2008-10-20</data> </news> <news> <data alias=date>2009-11-25</data> </news><news> <data alias=date>2009-11-20</data> </news> etc. etc.... I wo...

PHP Array sorting

Question: Array ( [1257984000] => 2009-11-11 19:00:00 [1258416000] => 2009-11-16 19:00:00 [1258722000] => 2009-11-20 08:00:00 [1258394400] => 2009-11-16 13:00:00 ) This is my array. I want to sort based on the array number( ie. 1257984000,1258416000 etc). Coding Used: function cmp($a, $b) { if ($a == $b) { r...

can any 1 explain me the use of index_of_min in the below function used for selection sort..?

void selectionSort(int array[], int n) { for(int x=0; x is this function written correct..? ...

Sort a CSV by date in Python

Hi! I'm trying to sort a CSV file and I want the items sorted by date in reverse order: newest first. def SortCsvByField( filename, fieldNo, sep = ',' ): records = [line.split(sep) for line in file(filename)] As far as that it's pretty easy, but how do I compare dates? ...

How do I search for a String in an array of Strings using binarySearch or another method?

using binarySearch never returns the right index =/ int j = Arrays.binarySearch(keys,key); where keys is type String[] and key is type String I read something about needing to sort the Array but how do I even do that if that is the case? I wish #java was smarter =/ <-- read:simpler Given all this I really just need to know: How d...

Difficult array sort order

I have an array like this: array( 0 => array("src" => "foo-21.gif"), 1 => array("src" => "bar-short.gif"), 2 => array("src" => "baz-1.gif"), 3 => array("src" => "whatever.gif"), 4 => array("src" => "some-long.gif"), 5 => array("src" => "xyz.gif"), ); The value in the src element can be anything. However t...

Cancellable Sort in .NET ?

Hi I'm using ListView in VirtualMode to show extremely big number of rows, millions of rows. The data of the rows stored in a Generic List. Now i want implement a sort feature, that will sort the List by some Comparer. The problem is that for now, an average single sort takes around 30 seconds, and during this time the user cannot do ...

MATLAB Sorting by custom condition

I have an array of 2D Cartesian points in MATLAB and I'd like to sort them so that putting them into plot would create a polygon with no line overlaps. (NB. I'm not actually going to plot in MATLAB, I just need to sort them in that manner) I'm thinking of writing a loop that would find the polar coordinate system's 'theta' for a vector...

List of 'most popular' posts (based on # of views) — Wordpress

I'd like to show a list of most popular posts sorted by number of views. I'd like to show small thumbnails (the same image(s) used in the posts just resized to fit) on left, and excerpt on right. So the formatting would look like: [#1 Post Title] [80x80 thumbnail] [excerpt, limit to x chars] [#2 Post Title] [80x80 thumbnail] [excerpt,...

Displaying list of categories and tags in Wordpress

I'd like to display a list of categories and tags, that are picked manually. So I'd pre-define what categories and tags are to be shown. So there'd two blocks in the sidebar: Major Categories - category 1 - category 2 - category 3 ... upto 7 and Tags: Quick Links - tag 1 - tag 2 - tag 3 ... upto 20 ...

How do I order this list in Python?

[(u'we', 'PRP'), (u'saw', 'VBD'), (u'you', 'PRP'), (u'bruh', 'VBP'), (u'.', '.')] I want to order this alphabetically, by "PRP, VBD, PRP, and VBP" It's not the traditional sort, right? ...

custom sorting order in a table

I have a table with a list of user names, how do I implement a custom sort order for the following scenarios. create table User (name varchar(255)) e.g. User {John, Sam, Mike} the order could be re-arranged in the UI using the Up / Down buttons to {Sam, John, Mike} or {Sam, Mike, John} Do I need to add a separate column to the table...

How to unit test the sorting of a std::vector

I have never used unit testing before, so I'm giving CxxTest a go. I wrote a test to check if a function correctly sorts a std::vector. First I made sure the test failed when the vector wasn't sorted, and then as a sanity check I tested whether std::sort worked (it did, of course). So far, so good. Then I started writing my own sorting ...

which sorting method is most suitable for parallel processing?

I am now looking at my old school assignment and want to find the solution of a question. Here is the question: Which sorting method is most suitable for parallel processing? Bubble sort Quick sort Merge sort Selection sort I guess quick sort (or merge sort?) is the answer. Am I correct? ...

Sorting Core Data with Predicate to eliminate duplicates

I have an Event database loaded into Core Data that has duplicate Event titles. This has been made so the database can provide unique information for each day of the event. Eg fluctuations in pricing on each date. I now need to remove the duplicate event titles from a list that will be displayed as table view with NSFetchRequest and NS...

Linq To Sql - Changing Sort Order At Run-Time with well known static typing

This is not another question about 'How Can I Sort Dynamically (based on an arbitrary user provided field)?' The question is -- how can I change sort order when I know the potential sorts in advance? (And thus avoid reflection / custom Expression building typically associated with truly dynamic sorting.) Take for instance this subquery...

php find oldest file in a folder

Hey, I need a PHP script that will find the date of the oldest file in a folder. Right now, I am iterateing over every file and comparing it's Date Modified to the previous file and keeping the oldest date stored. Is there a less disk/memory intensive way to do this? There are about 300k files in the folder. If I open the wolder in Wi...