sorting

Flex ArrayCollection bubble item up or down by one position

I have an ArrayCollection where I want to be able to bubble items up or down by one position. What is the best way to do this? ...

How can I sort one table by a column in another in MySQL?

Say I have a table named items: id int(11) ... tag int(11) And another table named tags: id int(11) name varchar(255) The tag column in items is an index into the tags table. How can I select some rows from the items table and sort the results by the name column in tags? ...

Sort ArrayList alphabetically

I'm trying to find all permutations of a string and sort them alphabetically. This is what I have so far: public class permutations { public static void main(String args[]) { Scanner s = new Scanner(System.in); System.out.print("Enter String: "); String chars = s.next(); findPerm...

Sorting Listbox in Silverlight (Sketchflow)

I have a Listbox with multiple columns and bound to a data source (XML) as shown below. <ListBox x:Name="lstBox1" Background="#FFC5EFFD" Margin="7,50,10,15" ItemTemplate="{StaticResource ItemsPanelTemplate1}" ItemsSource="{Binding BPICollection}" BorderThickness="0"/> I'm trying to figure out how to sort a particular column in the li...

Implement Partial sorted query in sql server 2005

I have to show records in such a way that some selected records should come first. After this, another records come in sorted manner from the same table. For example, If I select state having stateID = 5 then the corresponding record should come first. after this another records should come in sorted manner. For this, I tried union but...

Javascript sorting listbox works unless in a table IE8

I have a function that, when the user selects one or more items, it moves those items to the top of the list box (still selected) and scrolls to the top so they're visible. It works in all major browsers that I've tested. The problem comes when I have this function sort a listbox inside of a table cell. When I do that and use IE8, it ...

jQuery: Sort div's according to content of different sub divs

I'm trying to create a somewhat complex sorting feature which neither uses divs nor lists. Unfortunately two hours of googling didn't help me. Here is the basic setup of my HTML: <div id="all_elements"> <!-- one element --> <div class="element"> <div cla...

How to get values of an array in the alphabetical order?

I have an array of strings plus one additional string. I want to use this string and values of array to get a set of string. Then I want to order the set of string alphabetically and extract the string which is the first in the list. What is the easiest way to do it in Java? ADDED: I wanted to do it this way: List<String> playersList ...

How can I get a first element from a sorted list?

I used Collections.sort(playersList); to sort a List. So, I think playersList is sorted now. But how can I get the first element of the list? playersList[0] does not work. ...

MySQL Order By Symbol Preference

I was wondering if there was a way to make alphanumeric characters have a higher order of preference than symbols when doing an ORDER BY. I.E. 'a' to come before '(' There are many ways round this, but I'd prefer the most elegant db approach. ...

How can I sort a Perl array of array of hashes?

@aoaoh; $aoaoh[0][0]{21} = 31; $aoaoh[0][0]{22} = 31; $aoaoh[0][0]{23} = 17; for $k (0 .. $#aoaoh) { for $i(0.. $#aoaoh) { for $val (keys %{$aoaoh[$i][$k]}) { print "$val=$aoaoh[$i][$k]{$val}\n"; } } } The output is: 22=31 21=31 23=17 but i expect it to be 21=31 22=31 ...

How do i sort by: most viewed, most commented, most popular, best rating, etc?

Pretty basic question.. I kno.., I just don't know how its done. I see it everywhere. I want to be able to sort out my content in my websites by most viewed, most commented, most popular, best rating, etc...with a drop down list, check box, etc... but I don't know how "sort by" works? Which scripting language should it be written in? Ja...

How can I maintain a sorted hash in Perl?

@aoh =( { 3 => 15, 4 => 8, 5 => 9, }, { 3 => 11, 4 => 25, 5 => 6, }, { 3 => 5, 4 => 18, 5 => 5, }, { 0 => 16, 1 => 11, 2 => 7, }, { 0 => 21, 1 => 13, 2 => 31, }, { ...

Diff XML matched by specific attribute

I've got XML-data generated by a tool which I want to diff against data created earlier by the same tool. The problem is that the tool might reorder elements within the XML-data and thus I need some way to tell the diff tool to base its match on one or more attributes of the elements. I've got access to Beyond Compare 2 but haven't been ...

comparison of sorting algorithms

When do we prefer a) bucket sort, and b) radix sort over comparison sorts like bubble sort insertion sort selection sort merge sort quick sort? ...

How to get values after dictionary sorting by values with linq

hey, I've a dictionary, which i sorted by value with linq, how can i get those sorted value from the sorted result i get that's what i did so far Dictionary<char, int> lettersAcurr = new Dictionary<char, int>();//sort by int value var sortedDict = (from entry in lettersAcurr orderby entry.Value descending select entry); during the ...

I Need to Sort a Custom AutoCompleteStringCollection

I am writing a custom control that has a textbox. Inside the control I have a class that implements the AutoCompleteStringCollection so I can keep a Guid id with each string. This allows me to add autocomplete to a textbox but relate the selected text back to the database through the id. I want to add a property for forcing a selection f...

How can I sort an array, yet exclude certain elements (to be kept at the same position in the array)

This will be implemented in Javascript (jQuery) but I suppose the method could be used in any language. I have an array of items and I need to perform a sort. However there are some items in the array that have to be kept in the same position (same index). The array in question is build from a list of <li> elements and I'm using .data(...

Array Unique in two dimensional array in PHP

Hi I have an array that looks like this : Array ( [0] => Array ( [x] => 01 [y] => 244 ) [1] => Array ( [x] => 02 [y] => 244 ) [2] => Array ( [x] => 03 [y] => 244 ) [3] => Array ( [x] => 04 [y] => 243 ) [4] => Array ( [x] => 05 [y] => 243 ) [5] => Array ( [x] => 05 [y] => 244 ) [6] => Array ( [x] => 06 [y] => 242 ) [7] => Array ( [x] =>...

problem with AddSort method

Hi Could you let me know what the proboem is with sorting in this code? It doesn't work. My xml: CONTRACTS --CONTRACT ---SUPPLIER ---COMMODITIES ----COMMODITY -----COMODDITYNAME My code: Dim myString As StringBuilder = New StringBuilder(200) Dim xdoc As New XPathDocument("local_xml.xml") Dim nav As XPathNavigator ...