order

JavaScript: How to reverse order=[] arrays from last to first?

My js code does POST order.php?order[]=1&order[]=2&order[]=3&order[]=4&order[]=5&&action=update How to reverse it to order.php?order[]=5&order[]=4&order[]=3&order[]=2&order[]=1&&action=update ? JavaScript: order=[]; //var reversed = $(this).sortable("serialize").split("&").reverse().join("&"); //var order = reversed + '&action=update'; ...

python destructuring-bind dictionary contents

Hi, I am trying to 'destructure' a dictionary and associate values with variables names after its keys. Something like params = {'a':1,'b':2} a,b = params.values() but since dictionaries are not ordered, there is no guarantee that params.values() will return values in the order of (a,b). Is there a nice way to do this? Thanks ...

Can I guarantee insertion order of IEnumerables over WCF?

If I have a WCF service which accepts an IEnumerable as a parameter to a function, is the order that I look up the elements guaranteed to be the same as they were added to the collection? (Or at least the same order they were sent across the wire?) If not, is there a way that I can guarantee the order, such as defining it in the service...

How to Maintain order of insertion using collections

I want to add a key,value pair into a hashtable (or any other collection) but have to maintain insertion order. How can I do this? Like I'll add 1 as key "one" as value, 2 as key and "two" as value. The output should be ordered as: 1:one 2:two ...

is there a List implementation (in Java) that supports insertion with shifting?

Suppose I have a List with the elements 4,7,9,17,24 and I want to insert 11 but to keep them ordered. So I'd like to do something like list.add(3, 11), and to get the following list: 4,7,9,11,17,24 but if I do that I get the 17 replaced by 11. Can you help? ...

static initialization order fiasco

I was reading about SIOF from a book and it gave an example : //file1.cpp extern int y; int x=y+1; //file2.cpp extern int x; int y=x+1; Now My question is : In above code..will following things happen ? 1. while compiling file1.cpp, compiler leaves y as it is i.e doesn't allocate storage for it. 2. compiler allocates storage for ...

Create ordering in a MySQL table without using a number (because then it's hard to put something in between)

I have a long list of items (say, a few million items) in a mysql table, let's call it mytable and it has the field mytable.itemid. The items are given an order, and can be re=ordered by the user by drag and drop. If I add a field called mytable.order and just put numbers in them, it creates problems: what if I want to move an item betw...

Perl, foreach order

Does Perl's foreach loop operator require that the list items be presented in order? For example my @a=(1,2,3); foreach my $item (@a) { print $item; } will always print 1 2 3? I suspect so, but I can't find it documented. ...

Rearrange items in ListBox

Hey, I have a ListBox with a number of ListBoxItem objects. What is the best way to allow users to rearrange the items by dragging and dropping? Do I have to use StackPanels instead? Thanks for any suggestions ...

Mysql - return last 3 results in table

Hi, i was wondering if there was an easy way with just an sql statement to return the last three results in the table but in that order i.e. if there are a hundered results it would return in the order of 98, 99, 100 not simply ordering by id DESC and limit 3 which would return in order 100, 99, 98 Any help much appreciated. p.s. in th...

Order displayed results by id in php

Hi there! A webpage displays results from a table in a MySQL database and then order's them using; $quey1="select * FROM tbname ORDER BY id DESC"; "id" uses auto_increment. I have deleted some of the id's. <- Is this why the ordering isn't working? How can I fix this? Thanks in advance! ...

Ordered List of Keyvaluepairs?

Is there an collection in .net that allows the storing KeyValuePair<string, string> that keeps the order of inserting? OrderedDictionary looked promising, but seems to be rather lacking. Now I'm looking into IOrderedEnumerable>, but I can't seem to find any implementation except for ISortedDictionary, but that's not what I want. No sorti...

random order within mysql order by case

My query selects results correctly using ORDER BY CASE. I would like to randomize the results within EACH case. i.e. ORDER BY CASE WHEN apples (randomize) THEN 1 WHEN pears (randomize) THEN 2, etc. So my results are still ordered by each case but within the results PER case they are random, each time the query is run. ...

Python Module Initialization Order?

Hi, I am a Python newbie coming from a C++ background. While I know it's not Pythonic to try to find a matching concept using my old C++ knowledge, I think this question is still a general question to ask: Under C++, there is a well known problem called global/static variable initialization order fiasco, due to C++'s inability to decid...

Determine data type of a column in SQLite

I'm working on an Android App where the user has different options for sorting the displayed data that comes from the database. Currently my orderBy string that I pass to Androids query() method looks like this: "LOWER("+columnName+") ASC" The problem with this is that if the data type in the column specified by columnName is integer,...

Android Market, Order Cancellation Reason - You cancelled this order.

A couple of weeks ago i uploaded one of App which happens to be a widget. But from the time i uploaded it i have seen lots of cancellation. The only reason google gives me is this: You cancelled this order. Reason: Other (describe below) Message sent to customer: Cancellation requested from phone. I cant get heads or tail of it... Wat...

Iterating JavaScript object properties and arrays with for..in when ordering is important

This has been an age old question and I am aware of the usual reasons for not using for..in or perhaps even objects when any sort of ordering is needed, but I recently came across this article from MDC on the delete operator. Cross-browser issues Although ECMAScript makes iteration order of objects implementation-dependent, it may app...

Secondary Order in Heap::Simple

How do I define a secondary ordering to the Heap::Simple interface in Perl? ...

Need guidance regarding the correct flow of my PHP MVC Framework

I'm creating a PHP web application framework (MVC). I'd rather not use external libraries or components (as I want this to be purely my work for now) Can you tell me some tips/guidance for what each of my files should be responsible for doing? Such as, what should be handled by the Framework script and what should be handled by an Appli...

SQL Ordering by Date but Maintain Foreign Key Groupings

Let's say I have an item table with columns id (PK), parent_id (FK), name, and date. I also have an item_parent table with columns id (PK) and name. Items can belong to the same parent, or an item can have no parent (parent_id can be null). I am trying to construct a SQL query to select all items ordered by date (DESC), keeping all item...