sorting

How can I sort a ListBox using pure xaml and no code behind?

I need to sort the strings in a ListBox, but it is bound to the view model by another component via the DataContext. So I can't directly instantiate the view model in xaml, as in this example, which uses the ObjectDataProvider: http://www.galasoft.ch/mydotnet/articles/article-2007081301.aspx in my xaml: <ListBox ItemsSource="{Binding ...

Need javacript sorter (pref. jquery) that doesn't clone elements

So far I've tried Tiny Table Sorter, Tables on Cows, Sorttable, and Yoast's Sortable-table plugin. I have the last one currently installed on a test page here. I finally don't get a conflict w/ the qtip script I'm running on the same page. I understand that the conflicts arrive from a sorter that uses cloned elements. Unfortunately, the...

Bucket sort code help

Hello. I have three questions about the following code; static void funct(int[] list) { final int N = 20; java.util.ArrayList[] buckets = new java.util.ArrayList[N]; for(int i = 0; i< list.length; i++) { int key = list[i]; if(buckets[key] = null) buckets[key].add(list[i]); } int k = 0 for(int i = 0;...

Sort datagridview by row header C#

Hi, I have a datagridview like this one: | foo | bar | baz | ... ------------------------------------------ Name 1 | asd | dsa | sad | ... Name 2 | ... Name 3 | ... ... | ... Name X is in RowHeaderCell and I want to sort this datagridview by name, how can I do that? datagridveiw.Sort() wors only for columns and no...

YUI DataTable Sorting

Hello, I'm using a YUI datatable to create some basic client side sorting for some stats, returned via a web service I've created. Didn't quite want to figure out YUI's ajax datasource stuff, so I'm loading the data in via jquery and addRow()'ing the data. The problem is, all the data is not sorting properly. The string field seems to b...

Custom ORDER BY to ignore 'the'

I'm trying to sort a list of titles, but currently there's a giant block of titles which start with 'The '. I'd like the 'The ' to be ignored, and the sort to work off the second word. Is that possible in SQL, or do I have to do custom work on the front end? For example, current sorting: Airplane Children of Men Full Metal Jacket Pu...

XSLT Custom Sort

Is it possible in XSLT to sort in alphabetical order, with 5 items as "preferred". i.e. given <teams> <team id="142" name="Scotland" /> <team id="110" name="Liverpool" /> <team id="13" name="Manchester United" /> <team id="123" name="England" /> <team id="84" name="Chelsea" /> <team id="295" name="Wales" /> <team id="49" name="Arsenal"...

Loop or sort for layered draw?

Assuming a collection of objects, each of which needs to be drawn at a specific layer, at what point would it (or ever) be better to sort each object by layer rather than looping multiple times and drawing a layer at each pass? More importantly how would you arrive at this conclusion? Bonus points for a sort algorithm you would use if ...

Using stable_sort() to sort doubles as ints

Hello everyone, I have a huge array of ints that I need to sort. The catch here is that each entry in the list has a number of other associated elements in it that need to follow that int around as it gets sorted. I've kind of solved this problem by changing the sorting to sort doubles instead of ints. I've tagged each number before it...

C#/WPF: ListView Sorting: NullReference Exception when sorting double/decimals, but not for strings?

Does anyone know why I'm getting a NullReference Expception at following line: var field = (string)((Binding)((GridViewColumnHeader)e.OriginalSource).Column.DisplayMemberBinding).Path.Path; when using this example: http://www.switchonthecode.com/comment/reply/263/2980 (based on: http://www.switchonthecode.com/tutorials/wpf-tutorial-...

How to sort a dataframe by column(s) in R

I want to sort a dataframe by multiple columns in R. For example, with the data frame below I would like to sort by column z (descending) then by column b (ascending): dd <- data.frame(b = factor(c("Hi", "Med", "Hi", "Low"), levels = c("Low", "Med", "Hi"), ordered = TRUE), x = c("A", "D", "A", "C"), y = c(8, 3, 9, 9), ...

Sort function does not work with function object created on stack?

#include<iostream> #include<vector> #include<algorithm> class Integer { public: int m; Integer(int a):m(a){}; }; class CompareParts { public: bool operator()(const Integer & p1,const Integer & p2) { return p1.m<p2.m; } }obj1; int main() { std::vector<Integer> vecInteger; vecI...

How to sort an array of object by a specific field in C#?

I have this class: public class StatInfo { public string contact; public DateTime date; public string action; } then I have a list of StatInfo, but I'm not sure how to sort it according to the date field. Should I use the sort method? Should I create my own? var _allStatInfo = new List<StatInfo>(); // adding lots of stuff in it...

Sub queries and sorting? (ORDER BY)

So my syntax is apparently correct in all three cases (PostgreSQL isn't grousing about anything) but the results come back in the same order with all three of these queries. Even stranger when I add/remove DESC from any of the following it has no impact either. Is it possible to sort results based on elements of a sub query or not? So...

What kind of sorting is this?

Say I have a list of integers, where each element is a number from 1 to 20. (That's not what I'm trying to sort.) Now, I have an array of "operations", where each operation: Removes certain (known) numbers from the list and Adds certain other (known) numbers to the list and Is unable to handle the list if it contains certain (known) n...

Strategy for locale sensitive sort with pagination

Hi, I work on an application that is deployed on the web. Part of the app is search functions where the result is presented in a sorted list. The application targets users in several countries using different locales (= sorting rules). I need to find a solution for sorting correctly for all users. I currently sort with ORDER BY in my S...

c# multple sorting

I have 3 levels for a PlanSolution 1,2,3 and i need to sort by .levelId initially, and then alphabetically sort the solutions belonging to that level by .name PlanSolution[] planSolutions = wsAccess.GetPlanSolutionsForPlanRisk(planRisk.Id); List<PlanRisk> planSolutionsList = new List<PlanRisk>(planSolutions); ...

SQLite sort by price doesn't work

Hi everyone. I have a column called price and all the values are TEXT so like this: "$26.71". I want to sort this column in descending order but i can't because the column is not defined as INTEGER and it has a "$" character in front of all the values. What should i do in order to make this work?? Thanks. ...

Sort tinytext time from mysql db query with sql or sort the array it produces using PHP

Hey guys - The problem stems from a poorly designed database used to store real estate information. I set up a template for my client to select a weekend and to display the open houses for that weekend. Open house times (ohtime1, ohtime2, ohtime3) are stored as tinytext, with no way of knowing AM or PM. "12:00 - 2:00" and "01:00 - 03:00"...

JQuery Sort And Update Database

I'm trying to present the user with a list of links (properties: Title, url, visible, order). The list will display based upon their order. The user will be able to drag these into the order they want, which will update the records in the database. The user could also click a button that will sort based on the Title of the link (the t...