ordering

List ordering - Extension method not firing!

Hi All, I am trying to sort a List like this: public void Example() { string target = "hello"; List<string> myStings = new List<string>(); myStings.Add("babab"); myStings.Add("Helll"); myStings.Add("atest"); myStings.OrderBy(each => Distance(each, target)); } public int Distance(string stringA, string string...

Asp.Net Sql Auto-Increment for Wall Post

I have a table that contains three columns. "UserId" type-nvarchar "PostAuthorId" type-nvarchar "Post" type-text This table will contain "wall" posts like in facebook for each user's page. I am going to use a gridview on each user's page to display the posts. The issue is I want to display them with the latest(most current) post bein...

How can I order a list by number of matches after filtering by Search Terms in C#?

I have a Filter Method in my User Class, that takes in a list of Users and a string of search terms. Currently, the FindAll predicate splits the terms on spaces then returns a match if any of the searchable properties contain any part of the terms. public static List<User> FilterBySearchTerms( List<User> usersToFilter, string searchTerm...

C#: Is it possible to return an IOrderedEnumerable<T>?

Is it possible to return an IOrderedEnumerable<T> from a method without using the OrderBy or OrderByDescending methods on an IEnumerable<T>? Im guessing perhaps not... but... maybe I am wrong? Reason: Mostly curiosity. It just kind of hit me when making this answer on returning digits in a number. And my method would return the digit...

Persist and rearrange the order of Core Data records

I followed the Core Data tutorial at http://macresearch.org/cocoa-scientists-part-xxiii-itunes-ifying-core-data-app The finished application displays data in an NSTableView. Is the ordering of the data persistent as well? And is there a way that you can allow drag and drop rearrangements to the order of the records? I am thinking ab...

Sorted list difference

Hello. I have the following problem. I have a set of elements that I can sort by a certain algorithm A . The sorting is good, but very expensive. There is also an algorithm B that can approximate the result of A. It is much faster, but the ordering will not be exactly the same. Taking the output of A as a 'golden standard' I need to ...

SSIS Data Flow changes order of records

I thought I asked a similar question in http://stackoverflow.com/questions/462071/sql-order-by-and-left-outer-join-doesnt-have-correct-order, but this is slightly different. I am getting data from another SQL-Server 2005 database, using SSIS, and a standard data flow. The records that I get are in a different order than in the source t...

Ordering a list of dictionaries in python

I've got a python list of dictionaries: mylist = [ {'id':0, 'weight':10, 'factor':1, 'meta':'ABC'}, {'id':1, 'weight':5, 'factor':1, 'meta':'ABC'}, {'id':2, 'weight':5, 'factor':2, 'meta':'ABC'}, {'id':3, 'weight':1, 'factor':1, 'meta':'ABC'} ] Whats the most efficient/cleanest way to order that list by weight then factor (numericaly)...

Strings and file

Hello, Suppose this is my list of languages. aList = ['Python','C','C++','Java'] How can i write to a file like : Python : ... C : ... C++ : ... Java : ... I have used rjust() to achieve this. Without it how can i do ? Here i have done manually. I want to avoid that,ie; it shuould be ordered automati...

hibernate OneToMany List ordering persisting but reversing?!

so I have a persistent entity that has a @OneToMany list of another entity and I need the list order to be able to be edited by the user, which works wonderfully, I can completely re-order the java List in memory and when I save() the object, the order of links in the linking table DOES change... however, it changes to the reverse order ...

Change Order of columns

I am using gridView. I have 4 auto generated columns and 1 generated by my self. Now the column which i have generated is displayed first and then the auto generated columns. I want to display auto generated columns first then my generated column. ...

Ordering fields inside Inlines in Django Admin

I have a ManyToMany relationship setup with intermediary objects in Django. Any ideas how I can order the < select >s in the Inlines that show up for the intermediary objects? ...

CSS divs don't stack in proper vertical order

I have two divs. I want one with id "hor_rule" to appear beneath the other with id "header". I was under the impression that this should happen automatically. I must be making some silly error. --- The HTML file --- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd...

MYSQL - generating subset sequence in a table

Hi, I have the following table Id Value 1 3 1 12 1 67 2 7 2 99 5 30 5 33 5 4 5 87 5 12 5 1 I'd like to update it to have this table. Id UniqueIdBySubSet Value 1 1 3 1 2 12 1 3 67 2 1 7 2 ...

MySQL Sort By 2 Columns

I have a table which holds information on television programs and I want to order it by Seasons and then by episodes. Heres a basic view of what I have +---+--------+---------+ |id | Season | Episode | +---+--------+---------+ | 1 | 1 | 1 | +---+--------+---------+ | 1 | 1 | 2 | +---+--------+---------+ | 1 | 2 ...

Output ordering in Oracle 10g

Helo, I am using oracle 10g and the output coming when SELECT command is in a zig zag format. How I can arrange coulumns in correct order? Is there any command? ...

Does an STL map always give the same ordering when iterating from begin() to end()?

It appears to from my simple testing but I'm wondering if this is guaranteed? Are there conditions where the ordering will be not be guaranteed? Edit: The case I'm particularly interested in is if I populate a map with a large number of entries, will the order of the itertator be the same across multiple runs of my executable? What if ...

Is json_decode in PHP guaranteed to preserve ordering of elements when returning an array?

You can pass a boolean to json_decode to return an array instead of an object json_decode('{"foo", "bar", "baz"}', true); // array(0 => 'foo', 1 => 'bar', 2 => 'baz') My question is this. When parsing object literals, does this guarantee that the ordering of the items will be preserved? I know JSON object properties aren't ordered,...

Clustered composite primary key sort order on the date column

We have a sales table that contains about 88.5m rows of data and has a composite primary key listed below, it also has a few additional columns with informational data: RevenueCentreID int(Asc) DateOfSale smaldatetime(Asc) SaleItemID int(Asc) SaleTypeID, int(Asc) All four the above columns also has its own un-clustered index sorted i...

Ordering a list of objects by another object's property in C#

We have a system that is based around Events that Users are invited to [UserInvite]. Currently, I have a page that lists all the Users invited to an Event; they can be sorted by various properties, such as Surname [ascending and descending]. All fine and dandy, but now I'm required to additionally sort by a UserInvite property: DateEdit...