Hi all,
I have a list of QTreeWidgetItems (with children) in a QTreeWidget. I do not use a model for my data.
From another window in my application the user can navigate thru the same set of data (viewed differently) and the QTreeWidget in the first window then highlights that specific row by setting the background colour.
However, wh...
Here's a very simple way to build an suffix array from a string in python:
def sort_offsets(a, b):
return cmp(content[a:], content[b:])
content = "foobar baz foo"
suffix_array.sort(cmp=sort_offsets)
print suffix_array
[6, 10, 4, 8, 3, 7, 11, 0, 13, 2, 12, 1, 5, 9]
However, "content[a:]" makes a copy of content, which becomes very...
I have an ASP.NET web application that requires users to select their appropriate time zone so that it can correctly show local times for events.
In creating a simple approach for selecting the time zone, I started by just using the values from TimeZoneInfo.GetSystemTimeZones(), and showing that list.
The only problem with this is ...
Hello,
I am using an AdvancedDataGrid to display hierarchical data. My data is an ArrayCollection of custom objects, which have a bunch of simple properties and one property containing a list of childelements.
I am binding this ArrayCollection as a source of HierarchicalData to the dataProvider property of the ADG.
Here is the proble...
I did look at usort, but am still a little confused...
Here is what the $myobject object looks like:
Array
(
[0] => stdClass Object
(
[tid] => 13
[vid] => 4
)
[1] => stdClass Object
(
[tid] => 10
[vid] => 4
)
[2] => stdClass Object
(...
I have an NSArray as follows:
NSArray *directoryContent = [[NSFileManager defaultManager] directoryContentsAtPath:filePath];
The files at filePath are:
11.thm, 12.thm, 13.thm,...,Text_21.thm, Text_22.thm, Text_23.thm,...
I would like to sort the NSArray in the order:
13.thm, 12.thm, 11.thm,..., Text_23.thm, Text_22.thm, Te...
I currently have a long list which is being sorted using a lambda function f. I then choose a random element from the first five elements. Something like:
f = lambda x: some_function_of(x, local_variable)
my_list.sort(key=f)
foo = choice(my_list[:4])
This is a bottleneck in my program, according to the profiler. How can I speed things...
I have a text file with lines like this:
2010-02-18 11:46:46.1287 bla
2010-02-18 11:46:46.1333 foo
2010-02-18 11:46:46.1333 bar
2010-02-18 11:46:46.1467 bla
A simple sort would swap lines 2 and 3 (bar comes before foo), but I would like to keep lines (that have the same date/time) in their original order.
How can I do this in Python?...
I have an Android app where users can add items to a list, and I'd like them to be able to re-order the items in the list however they want (as opposed to just offering them different sort orders). It's easy enough to add a position setting for the items (they come from the DB) but what kind of UI elements are available for the user to i...
Hi,
Whats the best way to implement an N way merge for N sorted files?
Lets say I have 9 sorted files with 10 records each? How do I merge these files to create a big file with 90 sorted records?
...
A list of sorted and rotated element is given. Elements are either sorted in ascending or descending order. For example - I've list of sorted elements as follows
10,12,14,16,18,20,51,53,54,59
Now this list is rotated by X number of times and then it looks as follows.
51,53,54,59,10,12,14,16,18,20
If you want to insert an element in...
I am new to iphone development .I have mutable array recent in which the values such as title,date,url and summary are stored as " object for key".The keys are myurl,mudate,mytitle,mysummary.I want to sort that mutable array in reference to date and print all the values according to that..How can i achieve that?Please help me out.Thanks....
I populate a DataTable, then sort the DefaultView of that DataTable. When I set the DataTable as the source for my report, the sort doesn't work. In case it helps, here is the code (GetData returns a valid DataTable):
Dim dt As DataTable = a.GetData(Parm1, Parm2, Parm3)
If rbtSortByField1.Checked Then
dt.DefaultView.Sor...
We have a list of titles, some of which start with numbers (e.g. 5 Ways to Make Widgets). We would like to sort this as if it were "Five Ways..." without changing the title. We know that some movie places do this, but I can't find info online on how to do it. Any ideas?
...
I am looking to randomly shuffle a list/array using a key. I want to be able to repeat the same random order using the key.
So I will randomly generate a numeric key from say 1 to 20 then use that key to try and randomly shuffle the list.
I first tried just using the key to keep iterating through my list, decrementing the key until=0,...
I am new to iphone development .I am trying to sort a NSMutable array with reference to the date which is saved as object for the key "pubDate".After parsing the url i am saving the date as date format in an array"myPubDate".
(void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{
//NSLog(@"found characters: %@", string)...
I am new to iphone development.I am sorting an mutable array.
For sorting
NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"pubDate" ascending:NO];
[recent sortUsingDescriptors:[NSArray arrayWithObjects:descriptor, nil]];
recent1 = [recent sortedArrayUsingDescriptors:descriptor];
[descriptor release];
I am gett...
I have an array of objects in javascript, each of which in turn has an array:
{
category: [
{ name: "Cat1", elements : [
{ name: name, id: id } ]
},
{ name: "Cat2", elements : [
{ name: name, id: id },
{ name: name, id: id },
{ name: name, id: id } ]
...
I've got a 'classic' table which has table heads with field names in it:
There are a lot of ways to display an sorting indicator in a table:
Upwards and downwards triangles after the active field name
Making field names of the active field bold/underlined
Change the color of the active field
What's considered the best method to in...
I have an asp:ListView control on an ASP.NET page. It is bound to an EntityDataSource which is setup this way:
<asp:EntityDataSource ID="EntityDataSourceOrders" runat="server"
ConnectionString="name=EntitiesContext"
DefaultContainerName="EntitiesContext" EntitySetName="SOrder"
Include="Address"
EnableD...