sorting

DataGridView sort based on value of another row

I have a DataGridView (with WinForms) where I'm treating a particular row as a "child" of the row just before it. This means when a user sorts a column, that child row as to stay attached to the parent so it always appears just below it. I'm overriding the SortCompare method to handle this, but I'm not sure just how to do it. Within Sor...

Get a reverse iterator from a forward iterator without knowing the value type

I'm trying to implement some STL-style sorting algorithms. The prototype for std::sort looks something like this (from cplusplus.com): template <class RandomAccessIterator> void sort ( RandomAccessIterator first, RandomAccessIterator last ); The function is generally called like this (although the container type can vary): std::vecto...

How to sort projects in visual studio 2008?

Hi, How can you sort your projects within a solution folder. I have a solution with 3 soltion folders and in there I have several class libraries but they don't seem to be sorted by name but by creation. Is there a way to sort them by name? (from within vs 2008, not by changing the sln manually) Regards, M ...

WPF Toolkit Datagrid Bug

Hi i have a tab control with 2 tabs. the content of each tab is binded to a ListCollectionView and the data template has a grid showing the items. The problem is that if you click on any of the columns to sort, if I select the other tab and return to the first tab the sorting is cleared. Is it a known bug? here is the code: <Window x:...

Median of Medians in Java

I am trying to implement Median of Medians in Java for a method like this: Select(Comparable[] list, int pos, int colSize, int colMed) list is a list of values of which to find a specified position pos is the specified position colSize is the size of the columns that I create in the first stage colMed is the position in those columns...

Sorting a multidimensional array in PHP?

I have this kind of an array array(5) { [0]=> array(5) { [0]=> string(7) "jannala" [1]=> string(10) "2009-11-16" [2]=> string(29) " <p>Jotain mukavaa.</p> " [3]=> int(12) [4]=> int(1270929600) } [1]=> array(5) { [0]=> string(7) "jannala" [1]=> string(10) "2009-...

Java: Sort an unmodifiable list

How would one do this? I have tried creating a new, empty list, then copying unmodifiable list's elements to it, but I'm getting unsupported operation error. Any help is appreciated. ...

Shell Sort problem

Show the result of running Shell Sort on the input 9,8,7,6,5,4,3,2,1 using increments { 1,3,7 }. I have done this part. the result is: 9 8 7 6 5 4 3 2 1 (original) 2 1 7 6 5 4 3 9 8 ( 7-sort ) 2 1 4 3 5 7 6 9 8 ( 3-sort ) 1 2 3 4 5 6 7 8 9 ( 1-sort ) Then the question requires me to determine the running time of Shell Sort using Shel...

Why linux sort is not giving me desired results?

I have a file a.csv with contents similar to below a,b,c a ,aa, a a b, c, f a , b, c a b a b a,a,a a,a,a a aa ,a , t I am trying to sort it by using sort -k1 -t, a.csv But it is giving following results a,a,a a ,aa, a a aa ,a , t a b a b a,a,a a , b, c a,b,c a b, c, f Which is not the actual sort on 1st column. What am I doin...

Quicksort to order array by business key?

Hi, I've an array of objects, the size of which I cannot predict. The contents of the array are model objects with properties of type nsstring and nsnumber. I need to sort the array according to one of the properties, an nsnumber. How would you do it in objective-c/Cocoa? Implement quicksort or some other algorithm (which one)? Any lib...

struct - sorting a c-string with qsort

I'm sorting a bunch of IPs, but for some reason they come in the wrong order. I'm not quite sure where could be the problem. 66.249.71.3 190.148.164.245 207.46.232.182 190.148.164.245 190.148.164.245 202.154.114.253 190.148.164.245 190.148.164.245 66.249.71.3 190.148.164.245 202.154.114.253 Here it is the wa...

How to reverse the default ordering in Mysql?

In Mysql, when you execute a select SQL statement, there is a default ordering if you don't include a sorting clause, how to reverse the default ordering? Just add DESC? ...

MySQL sort by name

Is ir possible to sort a column alphabetically but ignoring certain words like e.g 'The' e.g. A normal query would return string 1 string 3 string 4 the string 2 I would like to return string 1 the string 2 string 3 string 4 Is this possible? EDIT Please note I am looking to replace multiple words like The, A, etc... Can this b...

which is the correct text comparison method for an international application...AnsiCompareText or CompareText?

i'm using delphi 2009 to write an app that uses an Access database. i noticed that MS Access' ORDER BY seems to be sorting international character sets like AnsiCompareText whereas throughout my app, i'm using SysUtils.CompareText( ). Access' (Jet's) ORDER BY results (delphi AnsiCompareText( ) is the same) Nørmork Öster RAM delp...

Sorting by unknown column type in mysql

So I've got a users table; storing things like username, email, etc. I then have a user_settings table. Instead of standard columns like timestamp_logged_in, profile_views, etc., I have it organized as key/value combo. For example, the columns are: user_settings_ID user_ID name value A sample record would be: 82 2 'timestamp_logged_in'...

SQL: Sorting By Email Domain Name

What is the shortest and/or efficient SQL statement to sort a table with a column of email address by it's DOMAIN name fragment? That's essentially ignoring whatever is before "@" in the email addresses and case-insensitive. Let's ignore the internationalized domain names for this one. Target at: mySQL, MSSQL, Oracle Sample data from...

How to enable sorting on a PagedList<T>

Hi there! Im hoping that someone has used the very excellent PagedList from Troy Goode? Im actually using it in a Winforms app, and while it does work, I have lost the ability to sort it. Returning a PagedList, controlling the Page and Size, and binding to a DataGridView is no issue, but my biggest concern is Sorting. Now I have also ...

Why does the call to bsearch() crash the presented program?

Hi, I have an unsorted dictionary file named "dict.txt". I have managed to put the words of the file in an array and the qsort() I use also seems to be working just fine (That is, the array is sorted). The problem arises when I call bsearch(), the program crashes and my question is: Why is this happening? I use gcc to compile and do...

Sorting an ArrayList of Contacts

Ok so I have a been making an addressbook application and have pretty much finished all the key features but I am looking to implement a sort feature in the program. I want to sort an Arraylist which is of a type called Contact (contactArray) which is a separate class which contains four fields; name, home number, mobile number and addr...

How can I do a sort and search using both GET and POST variables?

I am currently using column header's as links that when clicked will sort the results by the column name by adding a get variable to the url. Here is an example: <a href=" <?php // Sorts by order id. If already sorted by order id, then it will change the link to sort descending if(!isset($_GET['sortby']) || $_GET['sortby'] != 'ord...