sorting

Python: How to read huge text file into memory

I'm using Python 2.6 on a Mac Mini with 1GB RAM. I want to read in a huge text file $ ls -l links.csv; file links.csv; tail links.csv -rw-r--r-- 1 user user 469904280 30 Nov 22:42 links.csv links.csv: ASCII text, with CRLF line terminators 4757187,59883 4757187,99822 4757187,66546 4757187,638452 4757187,4627959 4757187,312826 475718...

Parallel Sort Algorithm

I'm looking for a simple implementation of a parallelized (multi-threaded) sort algorithm in C# that can operate on List<T> or Arrays, and possibly using Parallel Extensions but that part isn't strictly necessary. Edit: Frank Krueger provides a good answer, however I wish to convert that example to one that doesn't use LINQ. Also note t...

jquery datatable plugin doesn't seem to sort columns with links properly

i have a column that was pure text and the sorting worked fine but when i cahnge the column data to html regular links, the sorting seems quite random and broken. I couldn't find any other documentation on this issue on the site. http://www.datatables.net/usage/features any suggestions? ...

jQuery sorting problem in datatables with anchor tag

I used the jQuery datatable plugin in sort the table data. The sorting works fine if a column contains simple text. If I put any anchor tag condition on a text then the column sorting does not sort properly. I displayed the values in following manner: <td><?php if ($allAptArr[$d][27]['staffinactive'] == 1) { ?> <?=ucwords(str...

XSLT Global count of grouped items

Hi there, I have a set of items which i am grouping using the muenchian method using keys. This is working great however when i try to do things with the first x number of items it is doing it on the x number of items in each group rather than across the whole set of results. How would i get the individual position of each item accros...

problem sorting using member function as comparator

trying to compile the following code I get this compile error, what can I do? ISO C++ forbids taking the address of an unqualified or parenthesized non-static member function to form a pointer to member function. class MyClass { int * arr; // other member variables MyClass() { arr = new int[someSize]; } doCompa...

How can I "zip sort" parallel numpy arrays?

If I have two parallel lists and want to sort them by the order of the elements in the first, it's very easy: >>> a = [2, 3, 1] >>> b = [4, 6, 2] >>> a, b = zip(*sorted(zip(a,b))) >>> print a (1, 2, 3) >>> print b (2, 4, 6) How can I do the same using numpy arrays without unpacking them into conventional Python lists? ...

how to sort in gridview using template fields

The sorting works fine when u fill the gridview using SQL datasource in the aspx page... but now i am using template field and the columns are filled separately in the codebehind and the sorting is not working... my code is <asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="...

How to fill a dataset after getting a gridview?

I have a gridview which has many columns.. the columns are got separately and displayed in a gridview. now i need to sort this gridview but i cannot do that.... i have found a way but i will need to get the gridview in a datatable or a dataset.... is there a a way to do this? DataSet ds= new DataSet(); ds = Gridview1.???? please help...

How do i sort multidimension array in PHP?

I have array like Array ( [608665839] => Array ( [score] => 2 ) [1756044141] => Array ( [score] => 5 ) [523536777] => Array ( [score] => 2 ) ) and I want to sore this array by score. How can I do? ...

Sorting in listview with object data source

Hi i am working in asp.net web application for social networking. i have sued VS2008 and sqlserver 2008[.net 3.5] in this website we user 3-tier architecture. so we passed businessobject to UI. My listview is binded with object data source. now i have to implement sorting in listview. please can anyone suggest me best method to do sort...

how to make modifications in a gridview

i have a gridview table like this... <div> <asp:GridView ID="GridView1" runat="server" AllowSorting="true" OnSorting="TaskGridView_Sorting" > </asp:GridView> </div> i am populating the gridview with 2 arraylists like following DataTable taskTable = new DataTable("TaskList"); taskTable.Columns.Add("File N...

Search provided by Google vs custom results order

Hi, I want to use google custom search on my site - it's indexed anyway, and the search engine Google provides saves me a lot of pain re-implementing the things they alredy have. Only problem I have is - I need the results sorted my way: I got number of articles on my site, each having a 'rank'. And those that match the search query I ...

Map strings to numbers maintaining the lexicographic ordering

I'm looking for an algorithm or function that is able to map a string to a number in such way that the resulting values correspond the lexicographic ordering of strings. Example: "book" -> 50000 "car" -> 60000 "card" -> 65000 "a longer string" -> 15000 "another long string" -> 15500 "awesome" -> 16000 As a function it should be somet...

python, convert a dictionary to a sorted list by value instead of key

I have a collections.defaultdict(int) that I'm building to keep count of how many times a key shows up in a set of data. I later want to be able to sort it (obviously by turning it into a list first) in a descending fashion, ordered with the highest values first. I created my dictionary like the following: adict = defaultdict(int) lat...

Is there a way to 'uniq' by column ?

Hello, i've a .csv file like this : [email protected],2009-11-27 01:05:47.893000000,xx2.net,127.0.0.1 [email protected],2009-11-27 00:58:29.793000000,xx3.net,255.255.255.0 [email protected],2009-11-27 00:58:29.646465785,2x3.net,256.255.255.0 ... I have to remove similar e-mails ( the entire line ) in the file. The problem is how...

Fill list with objects and sort (Newbie)

I'm new to Python, so please forgive me when using wrong terms :) I'd like to have a list of several "objects", each of them having the same numeric attributes (A, B, C). This list should then be sorted by the value of attribute A. In Java I'd define a Class with my attributes as members, implement Sortable to compare A, put them all i...

Sorting technique followed by TreeMap?

Can anyone explain how the data are sorted in a TreeMap automatically when we try to print the data stored in them? ...

Browser back button creating problem

I have a dynamically generated gridview on page with sorting provided in the code behind also. Now i move from page A to page B using a link, this also works fine. But when i press the browser back button and come back to my page A and again try to sort... page A throws an exception... is there a way to program this back button like we ...

How to delete current row with jquery datatable plugin

i have a column with buttons in a table an i am using jwuery datatable plugin. The buttons say "Remove" and the idea is that when you click on that button it deletes the current row in the table. when i call fnDeleteRow it seems to work the first time but no any further time for that row so it looks like its not really deleting the row...