sorting

Sorting Featured Posts (Wordpress)

I can display posts from featured category like so: query_posts('tag=featured'); ... but is it possible to further sort it using a dropdown/select menu: <select name=""> <option value="reviews">Reviews</option> <option value="articles">Articles</option> <option value="interviews">Interviews</option> </select> ... so when one ...

Objective C - convert array of objects (with date field) into dictionary of arrays (keyed by day of week)

Hello, I have an NSArray of DiaryEntry objects, where each DiaryEntry has an NSDate date_ field. I want to display all of the DiaryEntrys in a table view, grouped by the day of the week, where each group is sorted by date in ascending order. So, I need to take the NSArray, and convert to an NSDictionary of arrays, where the key is the...

Sorting panelgrid JSF

Can we sort values in column of a panelGrid. If yes, can I see an example ...

Decorate-Sort-Undecorate, how to sort an alphabetic field in descending order

I've got a large set of data for which computing the sort key is fairly expensive. What I'd like to do is use the DSU pattern where I take the rows and compute a sort key. An example: Qty Name Supplier Row 1: 50 Widgets IBM Row 2: 48 Thingies Dell Row 3: 99 Googaws IBM To sort by Quantity and Suppl...

xslt sort by two columns, where one is only partial

Hi I have many nodes I wish to sort. - They all have a create date. - Some have an edit date to. (update) Since no ansers I will add an example of en xml document to search <page> <createdate>2010-01-05</createdate> <editdate>2010-01-07</editdate> </page> <page> <createdate>2010-01-06</createdate> <editdate></editdate> (do not ...

NHibernate - Sorting Entities based on Property/Column + how to manage?

I'm writting an ASP.NET MVC e-commerce app using NHibernate and I want the end-user to be able to control the ordering of Product Categories (not just have them appear alphebetically etc.). Normally, I'd add an OrderIndex/Sort column (of type int) to the Category table, and property to the Category domain class. But the problem is in ha...

c# element sort

I have a problem trying to sort a Dictionary<int,Elem>/SortedList<int,Elem> of elements. I have a list of N elements that should appear X times on the list, but if an element is on i index then it cannot reappear on i - 1 or i + 1. I also must respect list limits (elem N is before elem 1 and elem 1 is next to elem N). I have two possi...

Sort by date using acts_as_solr

I have gotten sorting working from my rails application using acts_as_solr for text fields, as seen below with Title. I am having problems getting it to work for date. My model has the following class Article < ActiveRecord::Base acts_as_solr :fields[:title, {:title_s=> :string}, {:created_at_d => :date}] def title_s self.title en...

prototype-based table sort not working on field with input tags (PHP app)

Hi everyone, I'm struggling with a problem on a web-based application I'm working on where I want to sort on all columns of a page. Every column BUT the one that contains INPUT tags (it is a date column that allows AJAX-style edits and has a little calendar pop-up that helps you choose a date. Is there a way to work around this prob...

how do i sort the following array/stdclass object in php?!

how do is sort this object by 'pos' in php? Array ( [0] => stdClass Object ( [str] => Mondays [pos] => 170 ) [1] => stdClass Object ( [str] => Tuesdays [pos] => 299 ) [2] => stdClass Object ( [str] => Wednesdays [pos] => 355 ) [3] => stdClass Object ( [str] => Thursdays [pos] => 469 ) [4] => stdClass Object ( [str] => Fridays [pos] =>...

Haskell sort funtion

Why does Haskell's sort of Data.List ignore the third digit? Prelude>sort ["1","200","234","30"] ["1","200","234","30"] EDIT: Sorry, I did not realized that were string. My fault. ...

Sorting in GWT based on String

I need to sort a List based on MyDto.name in client-side GWT code. Currently I am trying to do this... Collections.sort(_myDtos, new Comparator<MyDto>() { @Override public int compare(MyDto o1, MyDto o2) { return o1.getName().compareTo(o2.getName()); } }); Unfortunately the sorting is not what I was e...

iPhone Obj C -- Sorting a Mutable Array of dictionaries -- display a string but sort by value

I have a NSMutableArray with 30 dictionaries inside of it. Each contains a name and a value. I currently have the names sorted so that the show in a table view alphabetically. However, I'd like to make a UIButton to give the option of STILL DISPLAYING THE NAMES, but ordered by the value. The value doesn't need to be displayed. Also, whe...

Efficient reordering of coordinate pairs (2-tuples) in a list of pairs in Python

I am wanting to zip up a list of entities with a new entity to generate a list of coordinates (2-tuples), but I want to assure that for (i, j) that i < j is always true. However, I am not extremely pleased with my current solutions: from itertools import repeat mems = range(1, 10, 2) mem = 8 def ij(i, j): if i < j: return (i, ...

InsertionSort vs. InsertionSort vs. BinaryInsertionSort

I have a couple of questions concerning different implementations of insertion sort. Implementation 1: public static void insertionSort(int[] a) { for (int i = 1; i < a.length; ++i) { int key = a[i]; int j = i - 1; while (j >= 0 && a[j] > key) { a[j + 1] = a[j]; --j; } ...

Sorting multi-dimentional array by more than one field.

Hi. I have the following data: Array ( [0] => Array ( [filename] => def [filesize] => 4096 [filemtime] => 1264683091 [is_dir] => 1 [is_file] => ) [1] => Array ( [filename] => abc [filesize] => 4096 [filemtime] => 1264683091 [is_dir] => 1 ...

Any idea on how to sort a CompositeCollection?

I have a CompositeCollection that consists of ObservableCollections of two types: Companies and Contacts. Contact has a property FullName while Company has a property Name. I want to apply sorting so the collections are mixed by their types but sorted by their name, example: Itzhak Perlman John Doe Microsoft Sarah Moore StackOverflow W...

Can I pass a parameter to an std::vector sort function?

Consider the class: MyClass { int varA; int varB; }; I have a vector of pointers to MyClass objects: std::vector<MyClass*> Vec; I want to sort the vector according to varA or varB using the same sort function, i.e. : bool SortFunction(const MyClass* obj1, const MyClass* obj2, const short type) { if( type == VARA_ID ) ...

Sorting Listbox Items numerically in VB

Hi, I need to sort the items in a visual basic listbox numerically, that is, I have a collection of numbers I would like to be sorted increasingly. I tried to simply use the listbox's Sorted property, but found that it treated the numbers as if they were strings, that is, it would look at the first digit, then the second, etc. to det...

What is the general syntax of a Unix shell command?

In particular, why is that sometimes the options to some commands are preceded by a + sign and sometimes by a - sign? for example: sort -f sort -nr sort +4n sort +3nr ...