order

Java, how to add a "comparator" class to increase code reusability

Preface: I'm posting this on behalf of a friend (who's apparently to shy to post it himself), I browsed through the related questions and I didn't seem to find any duplicate.. But do note that I don't know Java at all so I apologize in advance if this is a duplicate! This is part of the code: public class ElencoEsami implements Compara...

SQL to have one specific record at the top, all others below

Hey all, I am trying to put together a query that will display one specific record (found by the record's primary ID) at the top, and display all other records below it, sorted by date (I have "date_added" as one of the fields in the table, in addition to primary ID). I could do this with a UNION (first select would locate the record I...

Ordering a hash to xml: Rails

I'm building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml ...

Most efficient way to order a list by a preset random.

I have a online PHP system where users vote different awards for their friends, however I am finding that the awards in the middle of the page and at the bottom get less votes overall. I would prefer this to be evenly distributed so came up with ordering the list of awards by random to make it different each time you load the page. This...

.net c# order management library

I have the need for sql based library that will allow me to create products, order items, orders, etc to support e-commerce on a .net mvc site. Does anybody have a suggestion as to where I can purchase a library like this or should I write it myself? Thanks, Chris ...

Sort flat list, group by parents

I have a flat list of pages in a mySQL Table. ID | Tab index | Page Name | parent Pages can be children of another page, specified by the "parent" property. The whole list is sorted using the "Tab index" int column. Can anybody think of a way to query this list so that Items are ordered by Tabindex Items that are children of a...

Are equal timeouts executed in order in Javascript?

Suppose I do setTimeout(foo, 0); ... setTimeout(bar, 0); Can I be sure foo will begin executing before bar? What if instead of 0 I use a timeout of 1, 10, or 100 for bar? Simple experiments show that in the case of equal timeout values the timeout targets are executed in the same order as the setTimeouts themselves, but is it safe...

Hibernate: ORDER BY using Criteria API

Hi guys, When I write a HQL query Query q = session.createQuery("SELECT cat from Cat as cat ORDER BY cat.mother.kind.value"); return q.list(); Everything is fine. However, when I write a Criteria Criteria c = session.createCriteria(Cat.class); c.addOrder(Order.asc("mother.kind.value")); return c.list(); I get an exception org.hibe...

Getting list in order, mapped by join table

I have two entities that have a many-to-many relationship; they are mapped with annotations @ManyToMany and @JoinTable. In the database join table I also have "order" column which would indicate in which order B entities are listed in A. (The ordering of Bs is specific for each A). How can I get Hibernate to order list according to the ...

Sort order of C# for each loop

I was wondering about the order that a foreach loop in C# loops through a System.Collections.Generic.List object. I found another question about the same topic, but I do not feel that it answers my question to my satisfaction. Someone states that no order is defined. But as someone else states, the order it traverses an array is fixed ...

jquery - change table-like items order

Hi, I have a set of divs table-like (with rows and cols), to display a soccer table. Now, I need to be able to order that table according to the key chosen, without refreshing the page and avoiding using ajax. Being more specific, I need to catch the values inside each "columm" refeering to the key chosen and re-order the table. I us...

SQL: Sorting By Email Domain Name

What is the shortest and/or efficient SQL statement to sort a table with a column of email address by it's DOMAIN name fragment? That's essentially ignoring whatever is before "@" in the email addresses and case-insensitive. Let's ignore the internationalized domain names for this one. Target at: mySQL, MSSQL, Oracle Sample data from...

JAXB Compiler and Attribute Order

I would like to control the attribute order in .java files generated by the JAXB compiler. I'm aware that attribute order is not important for xml validation. The order is important for textual comparison of marshalled xml in a regression test environment. The order of attributes in a file directly affects the order of the attribute...

How do I alphabetically sort a generic List(Of String) in VB.NET?

I've created and populated a generic list of strings like this: Dim MyList As New List(Of String) MyList.Add("Beta") MyList.Add("Echo") MyList.Add("Charlie") MyList.Add("Alpha") MyList.Add("Delta") Now I want to order it. ...

In which order should user messages (comments/chat) be displayed?

A typical chat widget will have a log of messages displayed in chronological order with the most recent message at the bottom. An input field is usually displayed below the log. Comment systems, like those on YouTube, seem to vary. Some display most recent comments up top, while some display most recent comments at the bottom. The lo...

How to make a sorting button on access?

Hi, sorry my english. I don´t speak it very well. Well, I'm developing an Access DB and I'd like do implement 2 buttons that, when clicked down, sort my subform "SUBForm1" according to parameters: asceding alphabetic order by NAME and one another ascending by Month. Is that possible? I´d be glad for every answer. Thank's ...

Ordering and grouping in php/MySQL

I have a table with user_id and lap_time and I'm running the following query: SELECT `Lap`.`id`, `Lap`.`user_id`, `Lap`.`lap_time` FROM `laps` AS `Lap` WHERE `Lap`.`lap_time` < 57370 GROUP BY `Lap`.`user_id` ORDER BY `Lap`.`lap_time` ASC I am trying to get the all the laps that are quicker than X but only unique users. The query ...

How do I get LINQ to order according to culture?

Say I've got a list of strings with Swedish words: banan, äpple, apelsin, druva Now I want to get this list ordered (keep in mind that this is a very simplified version of the real query): var result = from f in fruits // The list mentioned above orderby f select f This will give me: apelsin, äpple, banan, d...

Python dictionary, keep keys/values in same order as declared

Hi, new to Python and had a question about dictionaries. I have a dictionary that I declared in a particular order and want to keep it in that order all the time. The keys/values can't really be kept in order based on their value, I just want it in the order that I declared it. So if I have the dictionary: d = {'ac':33, 'gw':20, 'ap':1...

Customised Ordering in SQL

Hi, I have a SQL query like SELECT column1,column2 FROM table1 WHERE column1 IN('q1','q2','q3') The results are shown in the order: q1 q2 q3 If I change the query to SELECT column1,column2 FROM table1 WHERE column1 IN('q3','q1','q2') Still the order remains same. How to achieve this ordering in the sql statement? Help!! ...