Selector.selectedKeys() random ordering vs. fairness

All Sun's selector implementations are based on SelectorImpl, which keeps selectedKeys in a classic HashSet with a random order of elements.
Now, suppose I insist on processing the incoming requests in the exact order as they were received, to ensure fairness. The classic mechanism for ensuring fairness are threads, but this a single-thread solution, and even with threads, it would be more fair to dispatch firstly-received requests first.
So far the only solution seems to be a dirty (should I say dodgy) replace (via reflection) of the aforementioned HashSet with a LinkedHashSet. (tested on Linux/epoll, works)
If you know of any other solution please let me know.

Hi, thanks for replying to both of my comments. (the other thread: http://forum.java.sun.com/thread.jspa?threadID=407203&tstart=0 )
These two issues are correlated so I will sum it up here, as the other thread is old and in a wrong forum.
I'm getting the following results:
1. only a single OP_ACCEPT is signalled in any given select() operation
2. OP_READs are grouped to a single select(), no matter what time intervals they came in
Tested on Windows (sun.nio.ch.WindowsSelectorImpl) and Linux (sun.nio.ch.EPollSelectorImpl).
The accepts are fired inside of 100ms (linux) and 50ms (windows). The reads are split into 3 groups separated by 5 second wait.
I'm attaching my test program. The two tests are separated and must be manually switched on.
import java.net.InetSocketAddress;
import java.net.Socket;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.util.Iterator;
public class test2 {
     public static void main(String[] args) throws Exception {
          server server = new server();
          server.bind();
          int test = 1;
          p("running test " + test);
          if(test == 1) { //test the partitioning of read events into more select() operations
               client cc[] = new client[30];
               for(int i = 0; i < cc.length; i++) {
                    cc[i] = new client("" + i);
                    cc.connect_to_server();
               while(server.process_a_single_loop()); //process all the accepts
               for(int i = 0; i < cc.length; i++) { //send requests in 3 groups separated by 2 waits
                    cc[i].send_data_to_server("hello");
                    if(i == 9 || i == 19) {
                         p("waiting 5 sec");
                         Thread.sleep(5000L);
               while(server.process_a_single_loop()); //now process the reads
               p("done");
          if(test == 2) { //test the grouping of more accept events into a single select() operation
               connect_thread tt[] = new connect_thread[30];
               client cc[] = new client[30];
               for(int i = 0; i < cc.length; i++) {
                    cc[i] = new client("" + i); //create new clients
                    tt[i] = new connect_thread(cc[i]); //create connector threads
               //now quick-start the threads
               long max = 0L, start = System.currentTimeMillis();
               for(int i = 0; i < tt.length; i++)
                    tt[i].start();
               Thread.sleep(1000L); //let the dust settle
               for(int i = 0; i < tt.length; i++) { //gather client connect time statistics
                    if(max < tt[i].finished)
                         max = tt[i].finished;
               p("all connections happened inside of " + (max - start) + " ms");
               while(server.process_a_single_loop()); //now process the accepts
               p("done");
          server.unbind();
     static class connect_thread extends Thread {
          client c;
          long finished;
          connect_thread(client c) {
               this.c = c;
          public void run() {
               try {
                    c.connect_to_server();
                    finished = System.currentTimeMillis();
               catch(Exception e) {
                    e.printStackTrace();
     static void p(Object o) {
          System.out.println(o);
     static class server {
          ServerSocketChannel server_chan;
          Selector server_selector;
          int loop;
          void bind() throws Exception {
               server_chan = ServerSocketChannel.open();
               server_selector = Selector.open();
               server_chan.socket().bind(new InetSocketAddress (8401));
               server_chan.configureBlocking(false);
               server_chan.register(server_selector, SelectionKey.OP_ACCEPT);
               p("Used selector implementation: " + server_selector.getClass().getName());
          boolean process_a_single_loop() throws Exception {
               boolean anything_done = false;
               loop++;
               p("server - processing loop " + loop);
               server_selector.selectNow();
               Iterator<SelectionKey> it = server_selector.selectedKeys().iterator();
               while(it.hasNext()) {
                    anything_done = true;
                    SelectionKey key = it.next();
                    if(key.isAcceptable()) {
                         ServerSocketChannel server = (ServerSocketChannel) key.channel();
                         SocketChannel channel = server.accept();
                         channel.configureBlocking(false);
                         channel.register(server_selector, SelectionKey.OP_READ, channel);
                         p("server - accepted a new connection");
                    if(key.isReadable()) {
                         anything_done = true;
                         SocketChannel channel = (SocketChannel) key.attachment();
                         ByteBuffer bb = ByteBuffer.wrap(new byte[10000]);
                         channel.read(bb);
                         bb.flip();
                         String s = new String(bb.array(), bb.position(), bb.limit() - bb.position(), "UTF-16");
                         p("server - received data: " + s);
                    it.remove();
               return anything_done;
          void unbind() throws Exception {
               server_chan.close();
     static class client {
          String id;
          Socket socket;
          client(String id) throws Exception {
               this.id = id;
          void connect_to_server() throws Exception {
               socket = new Socket();
               //s.setTcpNoDelay(true);
               socket.connect(new InetSocketAddress("localhost", 8401));
          void send_data_to_server(String data) throws Exception {
               String buf = "hello from " + s() + ": " + data; // + "\n";
               socket.getOutputStream().write(buf.getBytes("UTF-16"));
          String s() {
               return "client[" + id + "]";
I think I can solve this "unfairness" problem by having a dedicated thread constantly transferring any new events from the selector to my own queue - the select() would be called frequently enough to get the events properly ordered.

Similar Messages

  • Music tracks playing in random order!

    I am seeing a problem whereby album and/or playlist tracks are being played in random order. The problem is affecting both my iPhone and ipod Nano and seemed to start fairly simultaneously onboth devices. This isn't like using Shuffle - after listening to 1 or 2 tracks in an album or playlist random tracks are being played from elsewhere in my music library. The problem doesn't occur when listening to albums or playlists on my Macbook. I'm running iTunes 8.0.2 on my Macbook.
    Appreciate any advice from anyone that may have seen a similar problem!

    Does sound like Shuffle to me. Even if you are not hitting the Shuffle (words at top of playlist), if you ever did, what that really did is just turn shuffle on.
    Go play any song. Then tap center screen on the album. Another set of controls appears near top. Repeat, Progress and Shuffle. Blue is on, white is off.

  • Random order recordset

    i'm trying to do something that i would think would be fairly simple, and am actually surprised its not a standard dreamweaver selection possibility...
    i'm retrieving a recordset, and i want to return it to the user in a random order.  but i only have the option of ascending, or descending.
    i want to display 1 record per page, for however many pages are in the recordset, but i want them to display in a random order... and differently random each time the first page loads.
    any input would be greatly appreciated.  please speak to me as if i were a child. i'm very new to dynamic development.
    by the way, i'm using PHP/MySQL.
    thanks!
    jamie

    thanks, that sort of works.
    i'm showing 1 result per page though, and instead of showing all the results from the recordset randomly spread throughout the pages, it chooses a new random record for each page.
    so i can be viewing the first record, which IS being pulled randomly as it should, but when i click to go to the next page, it picks an all new record, and therefore repeats previous records, skips others entirely, etc.
    i'm out of my scope of knowledge here obviously. attached is the code for my page in case anyone cares to give it a look.
    thanks!
    <?php require_once('Connections/mZamboni.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $currentPage = $_SERVER["PHP_SELF"];
    $maxRows_RS_cards = 1;
    $pageNum_RS_cards = 0;
    if (isset($_GET['pageNum_RS_cards'])) {
      $pageNum_RS_cards = $_GET['pageNum_RS_cards'];
    $startRow_RS_cards = $pageNum_RS_cards * $maxRows_RS_cards;
    $colname_RS_cards = "-1";
    if (isset($_GET['set_id'])) {
      $colname_RS_cards = $_GET['set_id'];
    mysql_select_db($database_mZamboni, $mZamboni);
    $query_RS_cards = sprintf("SELECT * FROM cards WHERE set_id = %s ORDER BY RAND() ", GetSQLValueString($colname_RS_cards, "int"));
    $query_limit_RS_cards = sprintf("%s LIMIT %d, %d", $query_RS_cards, $startRow_RS_cards, $maxRows_RS_cards);
    $RS_cards = mysql_query($query_limit_RS_cards, $mZamboni) or die(mysql_error());
    $row_RS_cards = mysql_fetch_assoc($RS_cards);
    if (isset($_GET['totalRows_RS_cards'])) {
      $totalRows_RS_cards = $_GET['totalRows_RS_cards'];
    } else {
      $all_RS_cards = mysql_query($query_RS_cards);
      $totalRows_RS_cards = mysql_num_rows($all_RS_cards);
    $totalPages_RS_cards = ceil($totalRows_RS_cards/$maxRows_RS_cards)-1;
    $queryString_RS_cards = "";
    if (!empty($_SERVER['QUERY_STRING'])) {
      $params = explode("&", $_SERVER['QUERY_STRING']);
      $newParams = array();
      foreach ($params as $param) {
        if (stristr($param, "pageNum_RS_cards") == false &&
            stristr($param, "totalRows_RS_cards") == false) {
          array_push($newParams, $param);
      if (count($newParams) != 0) {
        $queryString_RS_cards = "&" . htmlentities(implode("&", $newParams));
    $queryString_RS_cards = sprintf("&totalRows_RS_cards=%d%s", $totalRows_RS_cards, $queryString_RS_cards);
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Untitled Document</title>
    </head>
    <body>
    <?php do { ?>
      <p><?php echo $row_RS_cards['id']; ?></p>
      <?php } while ($row_RS_cards = mysql_fetch_assoc($RS_cards)); ?>
      <table border="0">
        <tr>
          <td><?php if ($pageNum_RS_cards > 0) { // Show if not first page ?>
              <a href="<?php printf("%s?pageNum_RS_cards=%d%s", $currentPage, 0, $queryString_RS_cards); ?>"><img src="images/First.gif" /></a>
              <?php } // Show if not first page ?></td>
          <td><?php if ($pageNum_RS_cards > 0) { // Show if not first page ?>
              <a href="<?php printf("%s?pageNum_RS_cards=%d%s", $currentPage, max(0, $pageNum_RS_cards - 1), $queryString_RS_cards); ?>"><img src="images/Previous.gif" /></a>
              <?php } // Show if not first page ?></td>
          <td><?php if ($pageNum_RS_cards < $totalPages_RS_cards) { // Show if not last page ?>
              <a href="<?php printf("%s?pageNum_RS_cards=%d%s", $currentPage, min($totalPages_RS_cards, $pageNum_RS_cards + 1), $queryString_RS_cards); ?>"><img src="images/Next.gif" /></a>
              <?php } // Show if not last page ?></td>
          <td><?php if ($pageNum_RS_cards < $totalPages_RS_cards) { // Show if not last page ?>
              <a href="<?php printf("%s?pageNum_RS_cards=%d%s", $currentPage, $totalPages_RS_cards, $queryString_RS_cards); ?>"><img src="images/Last.gif" /></a>
              <?php } // Show if not last page ?></td>
        </tr>
      </table>
    </body>
    </html>
    <?php
    mysql_free_result($RS_cards);
    ?>

  • HOW DO I KEEP AN ARRAYLIST IN RANDOM ORDER AFTER EXITING THE SUB ROUTINE CONTAINING IT

    PLEASE HELP!I am trying to go from VB4 which I loved to VB2010 which I find somewhat more challenging. I’ve searched the web for help and have adapted the following to my project. This code does
    rotate randomly through every card in the deck and displays unique cards until all have been drawn. BUT I want to draw one card
    only from the first “hat” of Boy’s names; then draw the second card from the second “hat” of Girl’s names and repeat this process until all cards in both decks have been drawn. How do I get the TextBox (OR any
    MsgBox) to display JUST ONE unique random card at a time so I can exit that deck and go to the next deck?
    On my form, I have two TextBoxes (to display the names (as drawn), two buttons (to re-load each deck once exhausted) and one command (&End)control (to end the process). I created two ArraysLists
    (to hold the Boys names and Girls names separately) and two ArrayLists to hold the cards for the random decks when created in code.
    I can
    NOT get this code to draw random UNIQUE names once I exit the deck. I have tried to ReDim the deck; randomly pull a card from the second (temp) deck, etc
    NOTHING seems to work.
    WHY does my deck lose randomness once I exit it?
    How can I fix it? I don’t understand this. Below is the code for the "hat" with the 10 girl's names.
    Also, when I don't loop through all the cards, I usually get "An Out of Index exception was not handled" error. Hope someone can help me with this problem. It seems like this should
    be easy BUT I'm baffled. Thank you for any help.
    Imports System.Collections.Generic
    Public Class Form1
    Dim Count As Integer
    Dim Rcard As New ArrayList
    Dim Dcard As New ArrayList
    Dim NewRDeck As New ArrayList
    Dim NewDDeck As New ArrayList
    Dim temp_Rnum As Integer
    Dim temp_Dnum As Integer
    Dim MyRand As New Random()
    Public Sub Rcards_Click(sender As Object, e As System.EventArgs) Handles Rcards.Click
    While Rcard.Count > 0
    Dim temp_Rnum As Integer = Int(MyRand.Next(Rcard.Count))
    NewRDeck(temp_Rnum) = Rcard(temp_Rnum)
    Rem Check that the ArrayLists work correctly and display properly
    MsgBox(Rcard(temp_Rnum), , "New random card selected is: ")
    Console.WriteLine(Rcard(temp_Rnum))
    Rcard.Text = (Rcard(temp_Rnum))
    REM Now remove the Rcard with the random number generated so it can't be drawn again
    Rcard.RemoveAt(temp_Rnum)
    End While
    REM When all 10 cards have been picked, alert player to re-load deck if desired.
    MsgBox("No new cards left in deck; please Re-Load the cards. Thank you.")
    EndSub
    End Class

    Hi Acamar,
    Thank you for such a fast response. Sorry if my text wasn't clear. I'm really struggling with creating unique random elements in Collections in VB2010 and feel I understand ArrayLists better than some of the other Collection types.The code works perfectly
    and generates unique random cards until the original deck is exhausted. Then it prompts the user to re-load the original deck so it can be reused if needed. But I need to draw one card only and exit the deck. Then when I click on the TextBox again, I want
    that deck to be in the same random order - just minus any cards I have already drawn and thrown away.  Thanks again for your help.
    Here's the rest of the code for just the girl's "hats" of names, if it helps:
    Private Sub btnShuffleRCards_Click(sender
    As System.Object, e
    As System.EventArgs)
    Handles btnShuffleRCards.Click
    Dim j As
    Integer
    For j = 1 To 10
    NewRDeck.Add(j)
    Next j
    Randomize()
    REM Create original Deck with names for the girls.
    Rcard.Add("1 HELEN”)
    Rcard.Add("2 OLIVIA")
    Rcard.Add("3 <st1:city w:st="on"><st1:place w:st="on">ALICE</st1:place></st1:city>")
    Rcard.Add("4 VALERIE")
    Rcard.Add("5 DONNA")
    Rcard.Add("6 ZELDA")
    Rcard.Add("7 MARGARIE")
    Rcard.Add("8 <st1:city w:st="on"><st1:place w:st="on">NANCY</st1:place></st1:city>")
    Rcard.Add("9 WANDA")
    Rcard.Add("10 IRENE")
    End Sub

  • HT1399 As I have added pocast shows to my itunes podcast list it is in a random order.  How do I alphabetize my list of podcasts.  Can I manually arrange them in an order of my choosing.  Thanks

    As I have added podcast subscriptions to my itunes podcast list on the far left menu window the list is in a random order.  How do I aphabetize the podcast list ?   Can I arrange them manually ?

    I have about 500 bookmarks ..   and they are arranged within 60 folders.  I would like to see them in chronological order as before, because now to find a bookmark is a hard task.
    thanks for your suggestion, anyway.

  • When I listen to music on Apple TV 2 my pictures from iPhoto come in, but always the same album (which I nevr asked for), always in random order and always in a different format. How can I control what is going on and choose the album myself.

    When I listen to music on Apple TV 2 my pictures from iPhoto come in aafter about ten minutes, but always the same album (which I never asked for), always in random order and always in a different format. How can I choose a different album myself and control the order and format?

    Thank you Winston for a helpful response and for reminding me of something which I found nearly a year ago and then lost (in my mind) because I did not use it. I am grateful for a correct answer but it still only achieves part of what I wanted.
    I can now choose my photos, decide how long they stay on screen and choose one of a variety of presentations. Two things I still can't do.
    One is to get it to play the photos in the chronological order in which I have carefully set them in an album; it still tends to be random and repetitive. The other is that I cannot get any of them them to saty on screen for more than about 20 seconds. I guess this is all due to the way Apple TV is constructed.
    But still thanks, nevertheless.
    Alec

  • How can I make a playlist play on my iPod in random order?

    I have made a playlist on my computer in iTunes. The songs are now in alphabetical order by song title, and when they play on my iPod they play in that same alphabetical order.
    Is there a way that I can make the songs in the playlist play in some other order? Preferably, just a random order?
    Or, is there a way that I can arrange them in iTunes that is not in alphabetical order and have them stay in that non-alphabetical order?
    Thanks!

    Just go to Settings, Shuffle, then turn it to Songs. The songs will stay in the same order in the playlist, but they'll switch it up.

  • In downloading my Events from iPhoto on my Mac to my iPad Air, the Events arrive in the proper order but not showing the Key Photo.  At the same time, the Events arrive in iPhoto on the iPad in totally random order but showing the Key Photo.Why?

    In downloading my Events from iPhoto on my Mac to my Ipad Air, the Events arrive in Photos in the correct order but not showing the Key photo. At the same time, the Events arrive in iPhoto in a totally random order but with the Key phto showing. Why? of course and is there a way to shift the order in Iphoto and get a Key photo in Photos?

    HHi, thank you for the reply. I have checked my iPad and iPhone and neither has iCloud Photo Library (Beta) enabled. Turned off in both. Photostream is turned on.
    i tried to sort it out  by dragging all the photos to Events on the Mac and then deleting them from iCloud - (left hand side of iPhoto under the section 'Shared'). the photos now show up in Events. I did force quit but the issue remains. The message reads ' photos are bing imported to the library. Please wait for import to complete.'
    i can't empty iPhoto trash either. The message read "Delete error. Please wait for import to complete.'
    WHen I was moving the photos to the Events I always had a message about duplicates - to the effect that the photos already existed, did I want to import them? I clicked on Yes, import all duplicates. But when it showed the images - duplicates side by side - one showed the photo and the other was blank.
    I really don't know what to do! And I don't know how to handle my iOS devices. Is it to do with the large number of photos? Any help, advice appreciated.

  • IPhone 3G displaying emails in random order / not displaying some at all

    My iPhone is displaying emails in random order - mainly oldest first at the moment. Since I can't set viewing preferences I would like to know how to get iPhone mail back to normal behaviour. For some reason it is not displaying emails from 5 December to 30 November as well.
    I have deleted my .mac mail account and re-instated it to no avail.
    I should add that my mac.com webmail is behaving similarly strangely. Instead of displaying emails by most recent first it decided to display them by oldest first.
    Since I have not done anything differently and this behaviour came out of the blue I am pretty puzzled.
    Mail.app on my Powerbook works fine btw.

    First try Resetting it: Hold down the home and sleep button, ignore the red OFF slider, wait for the Apple logo then let go.
    If that does not work, Restore your iPhone in iTunes from your backup.
    If that still does not fix it, Restore your iPhone and a new phone (not from backup) and see how it works. If it is doing fine you have a app you are using that is probably causing your problem. Load them one and a time until the problems recur and you will have found the one that is a problem.

  • Importing .dv clips from hard drive -- clips imported in random order

    I use Firewire DTE drives with my camera when filming. Previously I could connect the drives to my computer via firewire and then import the clips into iMovie HD and the clips would go into the clip sorter in chronological order.
    As of about two weeks ago my clips have started showing up in the clip sorter in completely random order. My projects are typically about 400 clips, so going through and getting them in order takes forever.
    Any ideas?

    See attached discussion:
    http://discussions.apple.com/thread.jspa?messageID=8997363&#8997363
    Instead of renaming them manually you can use a program such as namemangler: http://www.manytricks.com/namemangler/ to change the names at a batch

  • Since I upgraded to IOS5, my Smart Playlists are in a random order. Since I use it for listening to Talking Books this makes it useless. How can I control the order of a Smart Playlist?

    Since I upgraded to IOS5, my Smart Playlists are in a random order. Since I use it for listening to Talking Books this makes it useless. How can I control the order of a Smart Playlist?

    It may be best to recreate the folder and the smart playlists from scratch.
    tt2

  • Photo Albums in Random Order

    I have recently moved from Aperture to Lightroom because Apple are no longer going to develop Aperture. Needless to say I have to create new photo albums to be able to view on ATV, which I've done.
    Now when I point iTunes to the folders of albums they appear in chronological order in iTunes (my files are names by year/month - album name   e.g.. 2014/08 - Vacation)
    When I view the photo album list on ATV they are in a random order. Does anyone know a work around that I am not seeing. I do remember some years ago this happened and then an update happened and it seemed to rectify it. And yes my ATV's are up to date.
    Any help would be appreciated.

    Welcome to the Apple Community.
    Before going into any depth about this have you checked that you aren't simply using the shuffle option in the slideshow settings.

  • HT4236 what determins order photos are transferred, photos have been numbered and appear in the correct order on the laptop but transfer in a random order in some albums

    Can anyone assist witth the following query
    What determins order photos are transferred, my photos have been numbered and appear in the correct order on the laptop but transfer in a random order in some albums irrespective of title or date taken.
    Can i alter any setting to ensure photos will transfer in a logical order to track the history of the events in any particular album folder.

    Thanks for this, I have checked the dates in case the camera settings had been lost unfortunatly in this instance all pics are dated in correct order but not transferred in date order, or date modified order, or is the date config based on US date atyle?

  • Safari 6.1 sends files in random order to flash uploaders?

    Here are two demo sites of popular flash uploaders where you can easily recreate the issue.
    http://img.hompee.com/fupload/simpledemo/
    http://www.uploadify.com/demos/
    If you upload 2 or more files you expect them to be uploaded in the order in which they display in Finder. This is the case for all versions of Safari apart from 6.1. Safari 6.1 sends the files in a random order. I have had 30+ reports about this. I don't have Safari 6.1. I accessed a clients computer and its bizzare. Safari 7 doesn't have this issue. Neither does Safari 6.05.
    Has anyone else experienced this problem? Does anyone know of any fixes or news of a fix?

    Hello,
    There are no files like that in that folder (com.apple.safari).  They all have long numbers with .jpeg or .png at the end.  That's what I meant by I cannot find any files like those mentioned in all the helps I read today.  BTW-it's still crashing - no particular pattern to it at all.
    The only two things I have downloaded recently is a new version of Flash and a Mac-driven update to Office.
    Thank you very much for your attempt to help us.
    J.

  • How do I make a random order of songs in iTunes?

    it's been a long time since I have made a playlist in iTunes and I know see that creating a playlist with a random order seems no longer possible. No, I DO NOT want to shuffle on my iPod because I have other playlists that I want o segregate from the one I am dealing with. I can't stand the new iTunes and it is very frustrating. I am sure Steve Jobs would be screaming if he were alive. Apple used to be the INTUITIVE computer. No longer so. Sell your stock. Quick.

    and then they will be sorted in the correct order.

Maybe you are looking for