sorting

Exception when sorting NSMutableArray which contains all NSDate objects.

//list has type of NSMutableArray NSSortDescriptor *sortDescriptor = [[[NSSortDescriptor alloc] initWithKey:@"date" ascending:YES] autorelease]; [list sortUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]]; I got this exception: Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<__NSDate 0x5d57980> v...

How to sort posts by views, comments, rating etc wordpress

Guys im in need of a way to sort my posts by views, rating, comments. ive search loads of plugings but their all buggy. i want something like this. ...

datasource of datagridview doesn't change after sorting

well i have a program and i developed it by C# and WPF with Visual Studio 2010 , i have an window that contains a windows form datagridview (because of use of .Net Framework 3.5 for windows 7 support) i want to user can sort data in datagridview in any style that he/she wants and finally he/she can press enter on a cell of datagridview ...

Speeding up parsing of HUGE lists of dictionaries - Python

Hi folks, I'm using MongoDB an nosql database. Basically as a result of a query I have a list of dicts which themselves contains lists of dictionaries... which I need to work with. Unfortunately dealing with all this data within Python can be brought to a crawl when the data is too much. I have never had to deal with this problem, a...

Why is List<>.OrderBy LINQ faster than IComparable+List<>.Sort in Debug mode?

I was interested in whether it would be faster to sort my classes using LINQ, or by implementing the IComparable interface and List.Sort. I was quite surprised when the LINQ code was faster. To do the test, I made a very simple class with the not-so-apt name of TestSort, implementing IComparable. class TestSort: IComparable<TestSort> ...

How to find similar results and sort by similarity?

How do I query for records ordered by similarity? Eg. searching for "Stock Overflow" would return Stack Overflow SharePoint Overflow Math Overflow Politic Overflow VFX Overflow Eg. searching for "LO" would return: pabLO picasso michelangeLO jackson polLOck What I need help with: Using a search engine to index & search a MySQ...

How do I sort a linked list in hql?

Same question as this, only I'd like to do it in Hibernate (using grails if that matters). So the domain class looks like this class LinkedElement { LinkedElement precedingElement String someData } and I'd like to query all elements in their linked order (where the first LinkedElement has null as the precedingElement). Is this po...

Sorting ArrayList of Objects by Object attribute

Hi, I am having an Arraylist of Objects. Those object have an attribute or datatype - 'String'. I need to sort the Arraylist by that string. How to achieve this? ...

wpf set sorting programmatically, so that the header is toggled as sorted

I have a problem in wpf toolkit datagrid. I have a Itemsource whit three columns: FirstName LastName Address in C# Codebehind i set the sort direction and wich column to sort on like this: ICollectionView view = CollectionViewSource.GetDefaultView(dataGrid1.ItemsSource); view.SortDescriptions.Clear(); view.SortDescriptions.Add(new S...

Wordpress: Sort Order by Custom Field Numerically

How Can I sort the custom field data numerically which is stored as string. I can't change it into database. query_posts($query_string. '&orderby=meta_value&meta_key=price&order=DESC' ); This is what I am using but it is sorting it as string as this is stored as string as well. Can anyone tell me how can I convert it into numerically...

Search/sort algorithms - is there a GoF-like listing for them?

I'm a self-taught developer and, quite frankly, am not all that great at figuring out which search or sort algorithm to use in any particular situation. I was just wondering if there was a Design Patterns-esque listing of the common algorithms available out there in the ether for me to bookmark. Something like: Name of algorithm (with...

How do I find the items immediately before and after a specific one in an ordered array, using Ruby on Rails?

I have an array of 'questions' ordered according to their number of votes, and want to show the question immediately before and immediately following the currently-selected question. Let's say the currently-selected question is stored in the variable @question, and I'm showing a list of other questions associated with the same user. Thi...

sorting array of names in php

I have an array of people's names: Array ( [1] => A. Aitken [2] => A. C. Skinner [3] => A. Chen [4] => R. Baxter ) What's the quickest way to sort the array in (alphabetical) order of the surname in php? i.e. to give Array ( [1] => A. Aitken [4] => R. Baxter [3] => A. Chen [2] => A. C. Skinner ) ...

how to sort durations with Qt?

i'm trying to make QSortFilterProxyModel sort items by duration. preconditions: hours and minutes must not have leading zeros if duration is less than an hour, then hours must not be displayed, but only minutes and seconds if duration is less than a minute, then 0 minutes and the corresponding number of seconds must be displayed [0:42...

Sort selected text from Visual Studio context menu

Currently VS has a very useful feature: sort usings (C#). I want the same functionality for any random text, for example - XML nodes in config files. How complex to implement that? VS addin, right? Is it possible to call some VS API which is used for sorting usings? ...

How to find smallest values in AutoFiltered range?

I have a column with two value ranges, specifically 0-30000 and 60000+ from which I need to extract the smallest two values in the 60000 range. The only way I have found so far to to use AutoFilter to produce the subset of the required data to extract. My problem is that the Autofilter function does not return a reference to a range. If...

Sorting+merging lines of multiple files according to a timestamp

Hey everyone. I have multiple text files that represent logging entries which I need to parse later on. Each of the files is up to 1M in size and I have approximately 10 files. Each line has the following format: Timestamp\tData I have to merge all files and sort the entries by the timestamp value. There is no guarantee that the entri...

How can I sort my different height same width thumbnail like that?

I have images with same width but different heights... I have seen that before but i ca't remember where i see... I want to sort my thumbnails like above. so let the fight begin :) ...

Excel VBA Function to Return True or False based on Cell Background Colors in a Range

I keep a spreadsheet of my timeline at work and when I meet and expect to meet certain milestones. The data (dates) is stored left-to-right and each project has it's own row. The milestones are permantely set and occupy Range(O:AA). My data is color coded as Green (Complete), Orange(Deadline), Blue(Not working on), Red(Not applicable). ...

C# Sort List Based on Another List

I have a class that has multiple List<> contained within it. Its basically a table stored with each column as a List<>. Each column does not contain the same type. Each list is also the same length (has the same number of elements). For example: I have 3 List<> objects; one List, two List, and three List. //Not syntactically correc...