ordering

Out of order messages possible with transactional queues in MSMQ?

I'm new to messaging and a little unclear as to whether it is possible for MSMQ to deliver out-of-order messages for transactional queues. I suppose it must be because if a message is not processed correctly (and since we will be using multiple "competing consumers"), then other consumers could continue to process messages while the fail...

Django: Ordering by the first value of a tuple

I have a 7-tuple of tuples as such: POSSIBILITIES = ((1, "Something"), (2, "Something else"), ...) Now I have an IntegerField with choices in a model with the possibilities listed above. class Something(models.Model): class Meta: ordering = "...?" something = models.IntegerField(choices=POSSIBILITIE...

SQL reordering Priority row-by-row

I posted an earlier version of this question last week, but after further consideration I realized the situation is a bit more complicated than first described, and I could use some further help: My SQL table has 3 fields that impact my problem: "Priority" as real, Start_Date as datetime, and Furnace_Name as varchar(10). As the user add...

Updating Order field in SQL

We're required to add Ordering to our EventVenue table, which we've done by adding an int field to store the EventVenue's placing in the order. The ordering is based upon the parent Event's ID and the Event's VenueGrouping. If the VenueGrouping is false the EventVenues will be ordered sequentially. However, if true, the EventVenues for ...

How to convert floating-point to unsigned variable ?

Hi everyone, Could someone please help me with byte ordering regarding floating point variables? Actually the code is working correctly on Solaris, but not on Windows Xp. Here is a piece example of my code: .... int x_snd=1; float y_snd=1.13; struct { int xx_snd; float yy_snd; } data_snd; int x_rec; float y_rec; ...

Is LINQ to XML's XElement ordered?

When I use LINQ to XML, is the order of the elements and attributes written out to text guaranteed to be the same order as how I added the XElement and XAttribute objects? Similarly, when I read in an XML document, is it traversed in the same order as it appears in the XML? ...

Maintain ordering of characters if there is no id (SQL Server 2005)

I have the following Chars A C W B J M How can I insert some sequential numbers so that after insertion of the numbers the order of characters will not change? I mean if I use row_number(), the output Character order is changing like select ROW_NUMBER() over(order by chars) as id, t.* from @t t Output: id chars 1 A 2 B ...

Is it possible to order_by with a callable?

DUPLICATE: http://stackoverflow.com/questions/981375/using-a-django-custom-model-method-property-in-orderby I have two models; one that stores posts and another that stores votes made on those posts, related using a ForeignKey field. Each vote is stored as a separate record since I need to track the user and datetime that the vote was...

Why linux sort is not giving me desired results?

I have a file a.csv with contents similar to below a,b,c a ,aa, a a b, c, f a , b, c a b a b a,a,a a,a,a a aa ,a , t I am trying to sort it by using sort -k1 -t, a.csv But it is giving following results a,a,a a ,aa, a a aa ,a , t a b a b a,a,a a , b, c a,b,c a b, c, f Which is not the actual sort on 1st column. What am I doin...

How to order 1,2,3 not 1, 10, 11, 12 in mySQL

The following code outputs in order of 1, 10, 11, 12 of id. I want to make it 1,2,3,4... Could anyone tell me what I should do please. $Q = $this->db->query('SELECT P.*, C.Name AS CatName FROM products AS P LEFT JOIN categories C ON C.id = P.category_id'); Thanks in advance. ...

Ordering Groups of Rows by Single Row Criteria in MySQL?

Suppose that I have a database table that contains information on cities across the United States. My display shows information first grouped by State, then County, and finally by City something like below: Alabama Autauga County city 1 city 2 etc Baldwin County city 1 city 2 etc County etc Alaska Alaska county 1 city 1 alaska cou...

SQL ORDER by `no` with NULLs at the end

Hi! I have got a MySql query that orders me results by no column (int, can be null). Simple example: SELECT * FROM table ORDER BY no ASC I would like to get a resultset sorted like 1, 2, 3, 10, 52, 66, NULL, NULL, NULL but I get NULL, NULL, NULL, 1, 2, 3, 10, 52, 66 Is it possible with SQL query ? ...

Custom sort-order with SQL-Server and .NET Entity-Framework

Hello! I have a table I store contacts and their phones. Contact: ContactId (int, PK), FirstName (varchar), LastName (varchar) Phone: PhoneId (int, PK), ContactId(int FK), Number (varchar), SortOrder (tinyint) I want that under each contact, the user should be able to maintain the priority of the phones, meaning that the SortOrder co...

C# Given a desired order need a space efficient list reordering or sorting

My objective is: Given a list of entries, and a desired ordering, rearrange the list of entries according to this ordering. The list will be very large, so space efficiency is important. Ex: List<Entry> data = ReadDataFromSomeWhere(); // data => [a, b, c]; List<int> ordering = RandomPermutation(data.Count); // ordering => [2, 1, 3]; da...

Dynamically change display orders of data in ColdFusion

Using ColdFusion, I'm trying to setup a menu and menu items application where you can change the order of the menu and also the menu items within the menu. I've found something relative, but it's not completely helping, http://wil-linssen.com/musings/entry/extending-the-jquery-sortable-with-ajax-mysql. So if you view the demo there, th...

How do you specify node result order using XPath?

I have the following XML, which is generated by a 3rd-party library: <PhoneNumbers> <PhoneNumber Key="1">123-456-7890</PhoneNumber> <PhoneNumber Key="2">234-567-8901</PhoneNumber> <PhoneNumber Key="3">345-678-9012</PhoneNumber> </PhoneNumbers> The issue is that I should not depend on the values of the Key attribute (a) appe...

MySQL Orderby a number, Nulls last

Hi, Currently I am doing a very basic OrderBy in my statement. SELECT * FROM tablename WHERE visible=1 ORDER BY position ASC, id DESC The problem with this is that NULL entries for 'position' are treated as 0. Therefore all entries with position as NULL appear before those with 1,2,3,4. eg: NULL, NULL, NULL, 1, 2, 3, 4 Is there a w...

MySQL Orderby a number, Empty Strings (or 0's) Last

Hi, Just asked a question pretty similar to this one... Currently I am doing a very basic OrderBy in my statement. SELECT * FROM tablename WHERE visible=1 ORDER BY position ASC, id DESC The problem with this is that empty string entries for 'position' are treated as 0. Therefore all entries with position as empty string appear befor...

A clean algorithm for sorting a objects according to defined dependencies?

Given a list of classes inheriting from this base: class Plugin(object): run_after_plugins = () run_before_plugins = () ...and the following rules: Plugins can provide a list of plugins that they must run after. Plugins can provide a list of plugins that they must run before. The list of plugins may or may not contain all pl...

jQuery.sortable. change the order by JS

How can I change the order of a list once applied by JS "jQuery.sortable". For example: <ul id="mylist"> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> </ul> var x_sortable_list = $("mylist").sortable(); then, assuming this to work: x_sortable_list.changeOrder([ {item:1, newOrder:2 }, {item:2, newOrder:1 }, {it...