sorting

How do I force jQuery tablesorter to always sort a column in one direction?

I have a sorted table of results for a sporting event. When I click a header, I want to sort from best to worst, always. I don't want it to reverse when I click again. In some cases the "best" is the shortest amount of time, and other case the "best" is the largest amount (i.e. most weight, longest distance). I have had little luck s...

Java problem: Need a sorted JList to represent a database table

I've found a sample for a sorted JList, but my application is powered by an embedded H2 database so I'm wondering if there isn't a better way to implement this with that in mind. Especially considering the table in question could become enormously large, and duplicating all that data in a JList's list model seems to kinda defeat the poi...

How to use the System.LINQ.Dynamic assembly w/ IEnumerable(Of T)

I'm trying to take the final solution from Phil Haack here and sort using his killer LINQ query but instead of using data context like he is, I want to query against IEnumerable(Of T) ... not having any luck. Public Function DynamicGridData(ByVal sidx As String, ByVal sord As String, ByVal page As Integer, ByVal rows As Integer) As Acti...

Sort combobox values alphabetically

I have a combobox in a userform for excel. What is the easiest way to sort it alphabetically? The values for it are hardcoded in vba and new ones are just added to the bottom so they are not in any kind of order already. The userform is currently being used so that our users can import data from our database into excel. The combobox ...

Is there an easy way of sorting a plist (array of dictionaries) by key value?

I need to reorder a plist (an array of dictonaries) by Key value. In this example content I'd like to order by the value for the key Name (Matt, Joe): <dict> <key>Name</key> <string>Matt</string> <key>Details</key> <string>Me</string> </dict> <dict> <key>Name</key> <string>Joe</string> <key>Details</key> ...

Looking for a sort algorithm with as few as possible compare operations.

I want to sort items where the comparison is performed by humans: Pictures Priority of work items ... For these tasks the number of comparisons is the limiting factor for performance. What is the minimum number of comparisons needed (I assume > N for N items)? Which algorithm guarantees this minimum number? ...

Sort Generic list on two or more values

We have a generic List(Of Product) that must be sorted on two or more properties of the Product class. The product class has the properties "Popular" numeric (asc), "Clicked" numeric (desc), "Name" string (asc). In order of naming the properties we want the list to sort. How can it be sort with an lamba statement? If have found to sort...

Re-sort orders to improve warehouse efficiency

I am trying to optimize how orders are filled at my work. Right now, an employee just grabs the latest 16 orders(sometimes 14 or 18) and fills them. I am trying to change it so that instead of simply going by the latest list of orders, that it orders them so each batch has order in similar locations. But I can't figure out how I should...

Sorted gridview selects wrong row

Hi.. I have a gridview (actually a SPgridview) And i made the columnname clickable so the users can sort the rows using the data. And that works fine. The problem occurs when users try to select a row after they sorted the data. I can see that the gridview kinda "forgets" how the rows were sorted and selects the row that was at the cl...

Performing a manual sort on an Array

I'm using OpusScript, which is very similar to Javascript. I need to sort an Array by two properties of the objects within it. The object type of the array is 'ScoreEntity', with the properties Score and Time. I need the highest score at the 0 index of the array and vise versa, with the faster time overriding matching scores. I've bee...

PHP: Sort data from nested sets

We're currently building a website with a categorized MySQL table containing various competences, and we noticed that the nested set model would be optimized for this. Although, we've got a pretty serious problem - the nested set model doesn't allow any sorting, and we really need that possibility. I'd like the output data to be array(id...

c++ sort with structs

Hi, I am having a hard time with this problem which requires a sort of customer names, customer ids, and finally amount due. I have the whole program figured, but cannot figure out the last prototype needed to do the sorting. i have a struct called Customers, and i will provide the int main() part also. I just need any help to gt started...

PHP: Sort an array

I've got an array with data from a MySQL table in nested set model I'd like to get sorted, not only alphabetical but also with the child nodes directly after the parent node. Example - array to be sorted (before the sorting): Array ( [0] => Array ( [id] => 1 [name] => Kompetenser [parent] ...

JQuery TableSorter Comma-Digit Parser not working

Here's my problem, I am currently using the JQuery Table Sorter and I found a Comma-Digit parser on the web. The problem I am having is it doesn't seem to be working. So here is what the column is sorted as: 4,666 141,666 293 341,666 346 461,676 This should be sorted as 293 346 4,666 141,666 341,666 461,676 The parser I am usi...

switch structures with structs and arrays?

I had an earlier question about organizing some inputs by name, ID, and then Amount. Now that I have figured out how to get them organized, I need to have 3 outputs; the first by name, the second by ID, and the last by amount. can i use case and switch statements? Every time i tried to, all three outputs were by name. this is what i hav...

How do I add options to a DropDownList using jQuery (ordered)?

This question is similar to this one http://stackoverflow.com/questions/317095/how-do-i-add-options-to-a-dropdownlist-using-jquery but I would like to add it in an ordered fashion. The example in the other question just adds it to the end of the list. The code is as follows: var myOptions = { 1: "Test" 2: "Another" }; $.each...

Sorting an array of objects in Ruby by object attribute

Hi, I have an array of objects in ruby on rails. I want to sort this array by an attribute of the object. Is it possible? ...

How can I sort numbers lexicographically?

Here is the scenario. I am given an array 'A' of integers. The size of the array is not fixed. The function that I am supposed to write may be called once with an array of just a few integers while another time, it might even contain thousands of integers. Additionally, each integer need not contain the same number of digits. I am supp...

Sort and display directory list alphabetically using opendir() in php

Hi there, php noob here - I've cobbled together this script to display a list of images from a folder with opendir, but I can't work out how (or where) to sort the array alphabetically <?php // opens images folder if ($handle = opendir('Images')) { while (false !== ($file = readdir($handle))) { // strips files extensions $crap = ar...

Merging 8 sorted lists in c++, which algorithm should I use

I have 8 sorted lists that I need to merge into 1 sorted list. I don't know the best way to do this. I was thinking of the following: void merge_lists_inplace(list<int>& l1, const list<int>& l2) { list<int>::iterator end_it = l1.end(); --end_it; copy(l2.begin(), l2.end(), back_inserter(l1)); ++end_it; inplace_merge(l...