sorting

How to sort images into folders, based on resolution?

Background: I've got a folder full of saved desktop pictures. I'd like to put them into folders, based on their resolution - 1024x768, etc. Creating the folders on the fly is a bonus. Currently, the images are all in a folder, but some of them are in sub-folders. I can merge them by hand, if that makes things easier. I'm using Mac O...

Reverse sort a BindingList<T>

I have a custom class that inherits from BindingList(T) that I am binding to a DataGrid. However, the DataGrid is being populated from the top down and I want it populated from the bottom up. So the bottom item is index 0 rather then the top item. How can I change my BindingList(T) so that the DataGrid reads it in reverse? ...

PHP "Warning: usort() [function.usort]: Invalid comparison function" on sorting

i have following data as an associative array array 'abc' => array 'label' => string 'abc' (length=3) 'weight' => float 3 'wsx' => array 'label' => string 'wsx' (length=3) 'weight' => float 1 'qay' => array 'label' => string 'qay' (length=3) 'weight' => float 1 'http://test.com'...

php for creating library sort titles

I use the following in mysql to get titles in libray sort, e.g. The Godfather is sorted as Godfather. SELECT apnumber, aptitle, IF( aptitle LIKE 'The %', SUBSTRING( aptitle, 5 ) , IF( aptitle LIKE 'A %', SUBSTRING( aptitle, 3 ) , IF( aptitle LIKE 'An %', SUBSTRING( aptitle, 4 ) , aptitle ) ) ) AS sorttitle etc... What's the most effici...

Core Data Sorting on a Calculated field

Hi, I am using iPhone OS 3.0 Core Data and the NSFetchedTResultsController. All is great except i have an issue with sorting the data. I have an event object that has a start date, it also has a relationship to another event. How can i sort the events based on the start date or the start date on the related event. What is the best...

std::sort and binary '=' operator issue with a C++ struct

Ok... I have this struct and comparison function- struct Edge { char point1; char point2; int weight; bool operator<( const Edge& rhs ) const { return( weight < rhs.weight ); } }; //end Edge bool compareEdge( const Edge& lhs, const Edge& rhs ) { return...

MS ACCESS - Hierachical tree sort

I'm struggling with a sorting problem. I've got a table which is as follows: aspect_id (int) aspect_text (memo) root_id (int) which has as a foreign key a aspect_id I've got a non cyclic tree with the following dummy data: aspect_id aspect_text root_id 1 root null 2 aspect1 1 3 aspect2 ...

Basic Layout problems with WPF ListView

I have a simple List View: <ListView Name="Container" > </ListView> 1) I'd like items to be listed vertically till there's space and then to fill another column (header not needed): 147 258 369 I am adding items programmatically like this - but they display horizontally and then go onto the next row when space runs out: foreach (...

DataGridView Sort

What actually happens internally when the user clicks a column header in a DataGridView? More specifically, if the first click sorts data ascending, how does it sort descending with the next click? Does it just negate the Compare() or CompareTo() result? And which interface does DataGridView use to sort items? ...

SORT Integer Array TAG a STRUCTURE Array (or two)

So the idea is to sort a large STRUCTURE using an element of that structure, for arguments sake Zip Code. To keep it simple lets pretend that there are two arrays, one integer containing the zip codes and two, a larger structure (3k Bytes) array. Sorting the integer array is suitably fast with Quick Sort, but tagging the Structure arr...

DataTable Column with Custom Data Type

I have written my own data type that is then used as the type for a column in a datatable. I am reading XML data from a file. After I call the ReadXML(file) method, all the cells have values except for the cells in the columns with my data type. Is there some operator I need to override so that ReadXML(file) can take the data from the...

Flex Datagrid Query-how to make it sortable

Hi guys.. m using the osflex treegrid component for my project . http://flex2components.sourceforge.net/ Although i am able to use it in my code and populate data,i am not able to get the sort functionality of the treegrid working fine.Why is it ? The demo given in the link above has the sort functionality which works fine ....what may...

SQL Server: sort a column numerically if possible, otherwise alpha

I am working with a table that comes from an external source, and cannot be "cleaned". There is a column which an nvarchar(20) and contains an integer about 95% of the time, but occasionally contains an alpha. I want to use something like select * from sch.tbl order by cast(shouldBeANumber as integer) but this throws an error on the...

Sort by search criteria C# LINQ

I have a LINQ query which searches for a string (using a regex) in multiple fields. I want to sort the results based on in which field the text was found. Currently I have this: var results = from i in passwordData.Tables["PasswordValue"].AsEnumerable() where r.IsMatch(i.Field<String>("Key").Replace(" ","")) || r....

Sorting in gridview is not working

Dear All, I am trying Sorting functionality in Grid view but its not working.Can some body help? Code: private string ConvertSortDirectionToSql(SortDirection sortDirection) { string newSortDirection = String.Empty; switch (sortDirection) { case SortDirection.Ascending: newSortDirection = "ASC"; ...

External sorting of ints with O(N log N) reads and O(N) writes

I'm interested in algorithm which I should use to meet these requirements (topic subj). ...

c# How to sort a sorted list by its value column

Hi, i have a generic sorted list "results" with key = some filename and value = boolean. I would like to sort the list by the boolean entry or value column. does anyone know how i can do this? Thanks! ...

sort dictionary by another dictionary

I've been having a problem with making sorted lists from dictionaries. I have this list list = [ d = {'file_name':'thisfile.flt', 'item_name':'box', 'item_height':'8.7', 'item_width':'10.5', 'item_depth':'2.2', 'texture_file': 'red.jpg'}, d = {'file_name':'thatfile.flt', 'item_name':'teapot', 'item_height':'6.0', 'item_width':'...

How to implement sorting functionality in gridview?

Hi All, I am trying to implement sorting functionality in grid view but its not working.. Code: //enter code here public partial class _Default : System.Web.UI.Page { SqlConnection con; SqlCommand cmd; DataSet ds; SqlDataAdapter da; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Session["myDa...

What's the difference between --general-numeric-sort and --numeric-sort options in gnu sort

sort provides two kinda of numeric sorts. This is from the man page on OS X: -g, --general-numeric-sort compare according to general numerical value -n, --numeric-sort compare according to string numerical value What's the difference? ...