sorting

How can I show a flat representation of a TreeStore in a TreeView?

Hi! I have a TreeStore with objects that I view and manipulate through a GTK TreeView/TreeModel setup. I also have a TreeView showing a treeModelSort of the treeStore, which I use for sorting on columns like name and date. The problem is, that the sort mechanism only sorts the rootnodes, even if a underlaying childnode has e.g. a date...

Avoiding unnecessary sort in SQL Server GROUP BY?

I have tables of data samples, with a timestamp and some data. Each table has a clustered index on the timestamp, and then a data-specific key. Data samples are not necessarily equidistant. I need to downsample the data in a particular time range in order to draw graphs - say, going from 100,000 rows to N, where N is about 50. While I m...

Custom Sorting Function - of SQL Server

Hi Guys, I have a column in SQL Server 2005 that stores a version number as a string that i would like to sort by. I have been unable to find out how to sort this column, although i am guessing it would be some kind of custom function or compare algorithm. Can anyone point me in the right direction of where to start? I may be googling ...

How to alphabetically sort the values in a many-to-many django-admin box?

Hi, I have a simple model like this one: class Artist(models.Model): surname = models.CharField(max_length=200) name = models.CharField(max_length=200, blank=True) slug = models.SlugField(unique=True) photo = models.ImageField(upload_to='artists', blank=True) bio = models.TextField(blank=True) class Images(models.Model...

Any ready-made implementation of Radix Sort for C#?

Preferrably with any non-virus open source license ...

ArrayList object sorting

Hi, I have to sort ArrayList which consists of objects. Object: ID, Quantity. The ArrayList should be sorted by ID. How to implement this? ItemIdQuantity = new ItemIdQuantity (ID, Quantity); ItemIdQuantity.Sort(); // where must be sorting by ID ...

Merge sort comparison count

I have an assignment where I must output the number of comparisons that are made with the Merge sort algorithm, against an int list[1000] filled with random values (no duplicates). My main question is, have I placed my comparisons++ count incrementer in the correct place. Here is the code I am using int Sort::MergeSort(int* list, int ...

javascript binary search tree implementation

Anyone know of any good examples of a simple BTree implementation in Javascript? I have a bunch of "things" arriving randomly, and want to insert each one efficiently. Ultimately, each new one will get inserted into the DOM based on where it ends up in the tree. I can code this from scratch but would rather not reinvent any wheels. t...

Dynamic GridView

Hi, Straight to the problem:: 1) Creating the 12 gridView objects dynamically inside asp.cs code.These gridviews are bound to array list, not to the dataset.To explain at the code level, all these gridViews are created by the iteration of a loop for 12 times.These are created during runtime not in the static asp file. 2) Now, need to ...

immutable properties of an object in C#

I'm looking for a way to sort a list of object (of any type possible) so that whatever happens to the objects, as long as they are not destructed, the order keeps the same (so the hashCode isn't a good idea because in some classes it's changing over a time), for that reason I was thinking to use the address of the object in the memory bu...

Gridview Sorted Event

Hi, I've very small question that drives me mad :) I've a Gridview (bind from db nothing special there) and I use small function that runs on the griviewrows and sets .Visable to false in case they don't match search criterias. It works fine but when I try to sort the grid view (by clicking on the header) all the "hidden" rows shows up ...

Flex datagrid sorting not preserved across dataprovider changes.

I have a flex datagrid. it is bound to an array collection. if the user sorts on column X it works fine. then, if the user causes the array collection to change, the datagrid forgets that it was sorted on column X. what do I need to do to preserve this sort preference so that the new array data will appear sorted by column X? ...

C: Sorting Methods Analysis

I have alot of different sorting algorithms which all have the following signature: void <METHOD>_sort_ints(int * array, const unsigned int ARRAY_LENGTH); Are there any testing suites for sorting which I could use for the purpose of making empirical comparisons? ...

Table crashes when sorting the data multiple times

I have a tableview with a navigationBar with a segmentedControl on the top of the view. I have set up the segmentedControl with buttons that sort the table by either "FirstName" or "LastName". It works perfectly the first 2-4 of times you press the sorting buttons, but then the app crashes. The debugger and console seem to be of no hel...

qsort crashing program - C

Trying to follow this example. (Section String sorting...) Is there anything obvious that would make this crash in stdlib's qsort.c? I also tried *cstring_cmp* with strncmp specifying 30 chars max, much more than I have. *fileArray[20] seems to be correctly populated with strings. Thanks. char* ptr_fileName; char* fileArray[20];//num...

How is Array#Sort in Ruby so quick?

C# has BitArray, C has bit fields.. I couldn't find an equivalent in the Ruby core. Google showed me a BitField class that Peter Cooper has written for the same. I've been reading Jon Bentley's Programming Pearls and while trying out one of the first examples, which deals with a BitMap sort - I needed a type that is an array of bits. I ...

Natural sort in C - "array of strings, containing numbers and letters"

Looking for a proven to work algorithm for production. Did see this example but not finding much else on the web or in books. i.e. file_10.txt > file_2.txt Thanks. ...

Efficient way to insert a number into a sorted array of numbers?

I have a sorted javascript array, and want to insert one more item into the array such the resulting array remains sorted. I could certainly implement a simple quicksort-style insertion function: var array = [1,2,3,4,5,6,7,8,9]; var element = 3.5; function insert(element, array) { array.splice(locationOf(element, array)+1, 0, element...

sorting a bound ItemsControl in a DataTemplate (XAML only)

Is there a XAML only way to automatically sort the bound items (list of ViewModel object) ItemsControl based on one of the properties of the items. The ItemsControl is part of a DataTemplate. I thought CollectionViewSource would do the trick, but how do I bind the CollectionViewSource to the ItemsControl. The follwoing code dispays nothi...

How to Sort an NSMutableArray of Managed Objects through an object graph

I'm new to Apple's iPhone 3.0 SDK support of Core Data and I'm relatively new to iPhone development. My question is on slightly more "complex" sorting than is covered in the docs. I suspect that I am making an incorrect, fundamental assumption. How can I sort a pre-fetched collection of managed objects by a property contained several l...