Sorting lists

I'm trying to sort a set of 4 lists that depend on each other. I'm using a bubble-sort to do this. I sort one list and when I need to swap items I also swap the corresponding items in the other three lists to keep them all synced.
So far I've only done this using a set of short lists. I've calculated that in order to sort the entire data-set using my bubble-sort will require about 20hrs (roughly 8000 items in each list).
I've looked into Database Events but it doesn't seem to have a sort function. I found a quick-sort routine on the web, but the code lacks comments and thus makes no sense to me.
Anybody know of a faster way to sort?
Message was edited by: Mausy

Hello
You may try a flavour of merge sort handler, which is stable (i.e. preserves original order of items with the same key) and has N * log N complexity in both average and the worst case.
(Quick sort is not stable and has N * N complexity in the worst case.)
Notes about the script.
In brief,
0) given a list of keys (= kk) and a list of values (= aa);
1) create a list of indices (= ii) to identify each value in original aa;
2) transpose {kk, ii} and build a list (= xx) of which element is {kk's item j, ii's item j} for i from 1 to count kk;
3) sort xx by its element's first item;
4) transpose xx and get sorted kk and sorted ii by key;
5) bulid sorted value list (= aa1) by extracting items from aa by using sorted indices sequentially.
(You can build sorted value list from other value list by using the same sorted indices sequentialy)
There're three essential handlers: cmp(), msort() and transpose().
The cmp() is comparator for msort() and cmp(x, y) returns true iff element x and y are out of order.
The msort() is non-recursive merge sort handler. (I made it non-recursive to avoid stack-overflow in AppleScript)
The transpose() is 2d-array transposer.
Hope you get the picture.
Good luck,
H
--SCRIPT
test()
on test()
script o
property kk : {} -- key list
property ii : {} -- index list
property aa : {} -- value list
property aa1 : {} -- value list sorted by key
set h to 100 -- test list size
-- make key list
repeat with i from 1 to h
set end of my kk to random number from 0 to (h div 2)
end repeat
set kk0 to kk's contents -- save original key list
-- make index list
repeat with i from 1 to count my kk
set end of my ii to i
end repeat
-- make value list
repeat with i from 1 to count my kk
set end of my aa to "a" & i
end repeat
-- sort list of (key & index) pair by key
set xx to transpose({kk, ii}) -- transpose
msort(xx, my cmp) -- sort
set {kk, ii} to transpose(xx) -- transpose back
-- retrieve values by sorted indices
repeat with i in my ii
set end of my aa1 to my aa's item i
end repeat
return {original_keys:kk0, sorted_keys:kk, sortedindices_bykey:ii, sortedvalues_bykey:aa1}
end script
tell o to run
end test
on cmp(x, y) -- comparator for msort handler
(* sort in ascending order of 1st item of list element *)
return x's item 1 > y's item 1
end cmp
on cmp(y, x) -- comparator for msort handler
(* sort in descending order of 1st item of list element *)
return x's item 1 > y's item 1
end cmp
on msort(aa, cmp_) -- v1.2f1
Basic non-recursive merge sort handler
having list sorted in place in ascending order.
list aa : list to be sorted in place
handler cmp_ : comparator
* cmp(x, y) must return true iff list element x and y are out of order.
script o
property xx : aa -- to be sorted in place
property xxl : count my xx
property yy : {}
property cmp : cmp_
on merge(p, q, r)
property xx: source list -- [*1]
integer p, q, r : absolute indices to specify range to be merged such that
xx's items p thru r is the target range,
xx's items p thru (q-1) is the first sublist already sorted (in ascending order) and
xx's items q thru r is the second sublist already sorted (in ascending order).
(p < q <= r)
Notes
[1] It assumes that xx[p, q-1] and xx[q, r] have been already sorted (p < q <= r).
Also xx is modified in place.
local i, j, k, xp, xr, yi, yj, ix, jx
if r - p = 1 then
set xp to my xx's item p
set xr to my xx's item r
if my cmp(xp, xr) then
set my xx's item p to xr
set my xx's item r to xp
end if
return -- exit
end if
if my cmp(my xx's item (q - 1), my xx's item q) then
else -- xx[p, q-1] & xx[q, r] are already sorted
return
end if
set yy to my xx's items p thru r -- working copy for comparison
set ix to q - p
set jx to r - p + 1
set i to 1
set j to q - p + 1
set k to p
set yi to my yy's item i
set yj to my yy's item j
repeat
if my cmp(yi, yj) then
set my xx's item k to yj
set j to j + 1
set k to k + 1
if j > jx then
set my xx's item k to yi
set i to i + 1
set k to k + 1
repeat until k > r
set my xx's item k to my yy's item i
set i to i + 1
set k to k + 1
end repeat
return
end if
set yj to my yy's item j
else
set my xx's item k to yi
set i to i + 1
set k to k + 1
if i > ix then
set my xx's item k to yj
set j to j + 1
set k to k + 1
repeat until k > r
set my xx's item k to my yy's item j
set j to j + 1
set k to k + 1
end repeat
return
end if
set yi to my yy's item i
end if
end repeat
end merge
on cmp(x, y)
(* default comparator for sort in ascending order (used if cmp_ = {}) *)
return x > y
end cmp
local d, i, j
if xxl ≤ 1 then return
if cmp_ = {} then set my cmp to cmp
set d to 2
repeat until d > xxl
repeat with i from 1 to (xxl - d + 1) by d
my merge(i, i + d div 2, i + d - 1)
end repeat
set i to i + d
set j to i + d div 2
if j ≤ xxl then my merge(i, j, xxl)
set d to d * 2
end repeat
if i ≤ xxl then my merge(1, i, xxl)
end script
tell o to run
end msort
on transpose(dd)
list dd: two dimentional array. e.g. {{11, 12}, {21, 22}, {31, 32}}
return list: transposed array. e.g. {{11, 21, 31}, {12, 22, 32}}
extra e.g.
{{1, 2, 3}} -> {{1}, {2}, {3}} [or {1, 2, 3} -> {{1, 2, 3}} -> {{1}, {2}, {3}}],
{{1}, {2}, {3}} -> {{1, 2, 3}}
script o
property aa : dd
property xx : {}
property yy : {}
local n
if my aa is {} then return {}
if my aa's item 1's class is not list then set my aa to {my aa} -- as (1,n) array
set n to my aa's item 1's length
repeat with a in my aa
if (count a) is not n then error "lists' lengths mismatch" number 8008
end repeat
repeat with i from 1 to n
set my xx to {}
repeat with a in my aa
set end of my xx to a's item i
end repeat
set end of my yy to my xx
end repeat
return my yy's contents
end script
tell o to run
end transpose
--END OF SCRIPT
Message was edited by: Hiroto

Similar Messages

  • Problem sorting list with virtual layout = false (and also with true)

    Hi,
    I've a problem sorting a list... or better... I've a problem showing the sorted list ;-)
    I've a list of xml item. The list is shown with an item renderer.
    my needs: a button to refresh data and a button to sort data.
    useVirtualLayout = false
    -> refresh works correctly, sort does not affect the view (even if the list is sorted correctly when printed with trace)
    useVirtualLayout = true
    -> sort works correctly, refresh reverse the list each time I press it (even if the list remain the same when printed with trace)
    does any one have an idea?
    thank you!!
    MXML
    <s:List dataProvider="{xmlListCollection}" width="100%" itemRenderer="myRenderer" minHeight="0" id="test" useVirtualLayout="false" >
    <s:layout>
      <s:VerticalLayout clipAndEnableScrolling="true"/>
    </s:layout>
    </s:List>
    XML example
    <unit sortField1="First Floor" sortField2="7">
      <employee>
        <id>3040684</id>
        <name>PIFFARETTI Vasco</name>
        <birthdate>20.05.1983</birthdate>
        <beginDate>2012-02-25 08:55:00</beginDate>
        <endDate>9999-12-31 00:00:00</endDate>
        <annotation/>
      </employee>
    </unit>

    You can tell when the scroll position has changed by handling the propertyChange event coming from the DataGroup:
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   creationComplete="list1.dataGroup.addEventListener('propertyChange', handle)">
        <fx:Script>
            <![CDATA[
                import mx.events.PropertyChangeEvent;
                private function handle(e:PropertyChangeEvent):void {
                    if (e.property == 'verticalScrollPosition'){
                        trace('vsp changed');               
                    if (e.property == 'horizontalScrollPosition'){
                        trace('hsp changed');               
            ]]>
        </fx:Script>
        <s:List id="list1" width="100" height="50">
            <s:layout>
                <s:VerticalLayout />
            </s:layout>
            <s:dataProvider>
                <s:ArrayList>
                    <fx:String>0</fx:String>
                    <fx:String>1</fx:String>
                    <fx:String>2</fx:String>
                    <fx:String>3</fx:String>
                    <fx:String>4</fx:String>
                    <fx:String>5</fx:String>
                    <fx:String>6</fx:String>
                    <fx:String>7</fx:String>
                </s:ArrayList>
            </s:dataProvider>
        </s:List>
    </s:Application>
    You might also want to read and consider voting for http://bugs.adobe.com/jira/browse/SDK-21357

  • Address Book sorting list print

    I noticed today a strange behaviour of the print function in Mac Os X Mountain Lion Address Book.
    I have to print the entire contacts list.
    I ckecked the "Sort by Last Name" in preferences, and on the video everithing is as expected.
    So I tried to print ad with my big surprise all the contacts are totally mixed!
    I can't find any sort rule! Just one contact after another!
    At the moment I thought that I made a mistake in some settings.
    I checked the entire print window and I havent found any option to set the sorting list preference.
    Maybe is very well hidden........
    Can anybody help?

    https://discussions.apple.com/message/19330865
    Hope this helps.

  • Two sorted lists after adding a new contact

    I got a new N73 (actually by Softbank Japan 705NK, language set to English), synchronized it to Outlook, so I had a couple of contacts in the contact list of my phone. They were all correctly sorted.
    When I now added new contacts to the phone (not via Outlook, but directly inside the phone), I got a second sorted contact list before the existing one, i.e. all new contacts are not automatically inserted into the existing list of contacts, but a second list of contacts (which is sorted again) is generated. So now I have two sorted lists followed by each other, first the contacts inserted via the phone, second the contacts synchronized via Outlook/Nokia PC Suite.
    Did anyone experience this problem? How can I get one sorted list instead of two lists?

    My thinking about deleting from the phone after synch-ing the contacts to Outlook was indeed that if you don't remove them, the synch won't see any reason to update them on the phone.
    Your point about sync deleting them is a good one, which is one reason I thought you might have to remove all contacts from the phone before synching back.
    Either way, I'd take a backup before you try anything
    Message Edited by patc on 18-Jan-2008 12:43 PM

  • S_ALR_87012176 - AR,  Customer Evaluation with OI Sorted List

    Hi,
    Can someone tell how to read S_ALR_87012176 - Customer Evaluation with OI Sorted List in AR. What do the old, ovd and omt mean.
    Thanks,
    Ram

    This is a standard report.
    Enter the Customer range and Company Code.
    You can change the open item at key date forward, back or keep it as today.
    You then need to make any other selections.
    In terms of the output it is determined by the summarization levels. use the Information icon "I" to see the settings.
    Lastly you can change the bucket view by changing the days overdue groupings.
    Here is the information:
    The program displays the following payment history information:
    Sales figures such as annual sales and authorized deductions. This data is available in the system and only issued by this program.
    Information on whether the customer is a net payer or a cash discount payer. This information is displayed in the field "Type".
    The type of payer is determined by means of the payment volume:
    A net payer is a customer who usually exhausts the payment term and does not take any cash discounts.
    A cash discount payer is a customer who usually makes use of the cash discount deduction.
    Days in arrears. The average days in arrears are determined as follows:
    For each of the last five periods in which payments took place, the payment amount from each period is multiplied by the average days in arrears from each period. The results are added together and then divided by the total of the payments from the periods.
    The days in arrears are thus weighted with the payment amount.
    Last payment period. The period and the year (for example, 5 93) are displayed.
    In addition to analyzing payment history, this program evaluates customer open items. It structures the items it selects using a time schedule that you can define as you like, and displays them according to business area.
    The criteria you can choose for this analysis are as follows:
    Aging schedule for open items by due date for net payment
    Displayed next to "Net"
    Calculation: Due date for net payment - key date
    Due date forecast using the first cash discount days
    Displayed next to "Dsc"
    Calculation: Baseline date for payment + cash discount days 1 - key                                                                   date
    Probability of payment based on the weighted incoming payments in the past
    Displayed next to "Pay"
    Calculation: Baseline date for pmnt + cash disc.days 1 + average days                                                            in arrears
    Days overdue of items that are due
    Displayed next to "Ovd"
    Calculation: Key date - due date for net payment
    Examples of the open item analysis
    The item used in these examples contains the following data:
    Document date   04/01/1992
    Baseline date for payment   04/05/1992
    Terms of payment   8 days 5% / 14 days 2% / 21 days net
    Key date   04/15/1992
    The due date for net payment of this item is determined as follows:
    Baseline date for payment + net days
    The sorted list for this item would appear as follows:
    The (*) indicates in which column in the sorted list the item would appear for the different evaluations.
    Due date for net payment
    Due date for net payment - key date = number of days until the due                                        date for net payment
    04/26                    - 04/15    = 11 days
    Display in the list:
    I    1    I    2    I     3    I     4     I    5    I    6    I -
    I         I from  1 I from 11 I from 21 I from 31 I from 41 I I to  0   I to   10 I to   20 I to   30 I to   40 I         I -
    Explanation of column 1:
    Items displayed here are overdue.
    Explanation of column 6:
    Items displayed here are due in 41 days or more.
    Cash discount 1 due date
    Baseline date for payment + cash discount days-1 - key date
    04/05                     + 8                    - 04/15    = -2 days
    Display in the list:
    I    1    I    2    I     3    I     4     I    5    I    6    I -
    I         I from  1 I from 11 I from 21 I from 31 I from 41 I I to  0   I to   10 I to   20 I to   30 I to   40 I         I -
    Explanation of column 1:
    Items displayed here are overdue for the first cash discount.
    Explanation of column 6:
    Items displayed here are due in 41 or more days for the first cash discount.
    Forecast of incoming payments
    Baseline date for payt + cash disc.days 1 - key date + days in                                                          arrears
    04/05                  + 8                - 04/15    + 25    = 23 days
    Display in the list
    I    1    I    2    I     3    I     4     I    5    I    6    I -
    I         I from  1 I from 11 I from 21 I from 31 I from 41 I I to  0   I to   10 I to   20 I to   30 I to   40 I         I -
    Explanation of column 1:
    Items displayed here are overdue as regards cash discount 1.
    Explanation for column 6:
    Items displayed here are due in 41 or more days for the first cash discount.
    Days overdue
    Key date - due date for net payment
    04/15    - 04/26                  = -11 days
    Display in the list:
    I    1    I    2    I     3    I     4     I    5    I    6    I -
    I         I from  1 I from 11 I from 21 I from 31 I from 41 I I to  0   I to   10 I to   20 I to   30 I to   40 I         I -
    Explanation of column 1:
    Items displayed in this column are open but not yet due.
    Explanation of column 6:
    Items displayed here have been overdue for 41 or more days.
    Note
    The analysis types "Net", "Dsc", "Pay" are a future time frame for forecasting incoming payments. "Ovd" is the time frame for the past for analyzing overdue items.
    To estimate the probability of incoming payments, you should always request a sorted list by due date, cash discount days 1, and incoming payments forecast. Normally, the cash discount days 1 due date shows the earliest incoming payment, the latest due date and for the forecast of incoming payments the probable time of the incoming payment.

  • Getting a non sorted list of members

    I am trying to copy data from one set of products to another for 2 entities. Entity1 uses Map1 products whilst Entity 2 uses Map2 My sample Product dimension structure is as follows:-
    Product
    |_ProdA
    |_ProdB
    |_ProdC
    |_ProdE
    |_ProdF
    |_Map1
    |_ProdA (shared)
    |_ProdB (Shared)
    |_ProdC (Shared)
    |_Map2
    |_ProdA (shared)
    |_ProdF (shared)
    |_ProdE (shared)
    The mapping is defined by the position of the shared products in Map1 and Map2 eg Prod A maps to ProdA, Prod B maps to Prod F etc
    I have used the MDSHIFT function but I cannot get an unsorted member list (@RELATIVE etc sorts the retrieved member list and also removes duplicates).
    Is there another way to copy data from Map1 to Map2?
    Thanks

    i'm trying to generate a sorted list of integers but
    there is a restriction that these sorted randomed
    generated integers must be uniformaly distribued
    within the range of numbers needed for example (1
    -1000)??does any body know how can we generate random
    numbers and at the same time sorted with uniform
    distribution??
    i have thought about an idea like starting from 1 for
    example and and then let the difference between each
    two numbers is random within 1 to 10 then adding this
    random integer to the last number generated and soo
    on .. but i don't feel it is efficient as maybe the
    random difference would be 1 each time . so i will
    never get a uniformly sorted list .. any ideas or
    suggestions ,please??My guess is that you generate the numbers first, then sort them. If you use the pseudorandom number generator, Random, will generate numbers with a roughly uniform distribution. You have to do some work to it if you want some other type of distribution.

  • How to get sublists off a sorted list

    I'm using Arrays.sort(Object[], Comparator) to help sort some
    of my objects. However, I now have a need to create sublists
    off of a sorted list
    For example when I sort by last name ...
    SubList1: Clark, Stanley
    SubList1: Goodyear, Nancy
    Goodyear, Elvis
    Are there any Java APIs or some other techniques available to
    do this?
    I was thinking of using a Observer/Observable interface to notify
    a change in comparison key which could then be used to create
    sublists.
    Thanks in advance
    PJ

    java.util.List has a method subList

  • Unchecked invocation sort(list) error... please help.

    this is the code I have problems with...
    List contacts = Contact.search(searchParameters,
                                  toContactTypeArray(
                                            contactSearchForm.getSelectedSearchLocations(),
                                            contactSearchForm.getContactTypeLocationDisplay()));
                             //todo alphabetize
                        Collections.sort(contacts);
    the contact search was working fine until I added a sort to the code... now I get this message :
    Type safety: Unchecked invocation sort(List) of the generic method sort(List<T>) of type
    Collections
    I am just taking over this project and It apears that the person before me used myEclipse to generate much of the code... I am having a hard time getting arround certain things like this.
    Thanks for your help folks! Bryce.

    Basically from what I read, your list needs to implement the Comparable class, and the elements in the list must all be comparable to each other (i.e. all strings, or all doubles, or all integers, or all a specific type of class or may have the same base class, etc.) If it's a custom list, try this (replace myContactTypeList with whatever your list class is named.)
    List<myContactTypeList> contacts = Contact.search(searchParameters,
    toContactTypeArray(
    contactSearchForm.getSelectedSearchLocations(),
    contactSearchForm.getContactTypeLocationDisplay()));
    //todo alphabetize
    Collections.sort(contacts);
    You will pretty much always get a warning with generics. But, if you happen to do a clone of an ArrayList at any point, do this instead (it removes the warning, and should work...code hasn't been tested):
    Iterator i = myOriginalList.iterator();
    Double value; while((value = (Double) i.next()) != null) { DataList.add(value); }

  • Sort list of objects and Comparator.

    Hi. I have a problem with list sorting. There is a class with fields like these id (Long), number (String), operator (String), server (String) port (Integer). I have to sort list of these objects in accordance with the conditions specified by the user.
    Conditions for sorting:
    1. In the first account of the full compliance of the server name and port value (Object Gateway) specifed by the user.
    2. When the server name is correct and the port is different from the standard, then the objects should be placed in ascending order of the port.
    3. If the server name does not match the model, the order of the objects must reflect the declining value of a parameter port. If the list contains objects of the same port and different name, the order does not matter.
    How should Comparator looks like?

    Ok, this is the solution ;]
    public class GatewayComparator implements Comparator<Gateway> {
        private String server;
        private Integer port;
        public GatewayComparator(String server, Integer port){
            this.server = server;
            this.port = port;
        public int compare(Gateway o1, Gateway o2) {
            int result = 0;
            if (o1.getServer().equals(this.server)) {
                result = -1;
            if (o2.getServer().equals(this.server)) {
                result = 1;
            if (o1.getServer().equals(this.server) && o2.getServer().equals(this.server)) {
                if (o1.getPort().equals(this.port)) {
                    result = -1;
                if (o2.getPort().equals(this.port)) {
                    result = 1;
                } else if (!o1.getPort().equals(this.port) && !o2.getPort().equals(this.port)) {
                    result = o1.getPort().compareTo(o2.getPort());
            } else if (!o1.getServer().equals(this.server) && !o2.getServer().equals(this.server)) {
                if (o1.getPort() > o2.getPort()) {
                    result = -1;
                } else if (o1.getPort() < o2.getPort()) {
                    result = 1;
                } else {
                    result = 0;
            return result;
    }

  • Insertion an object into a sorted list

    Hello
    I have got class MySortedList which encloses List object.
    class MySortedList {
    private List list = new LinkedList();
    public add(Object obj, Comparator cmp) {
    Who knows how the add(Object, Comparator) method can be realized better?
    All comments...

    Why am I using the LinkedList?
    It is not in principle. I can change this to
    ArrayList, for example.
    It is depend on what do I use MySortedList class for.
    Can you suggest to use something else?LinkedLists are going to be the slowest way to do this. Even calling contains is slow. You have a sorted list but you have to iterate over all the preceeding elements to get at an element even though you know where it is.
    There is also a problem with the general design. someone can call the method once with one Comparator and then again with a completely different comparator. For example, if you add 5 elements with a String comparator that sorts them alphabetically and then with a Comparator that sorts them in reverse alphabetically you could end up with a list like:
    z, c, d, e, f, g
    then you call it with t and the firs comparator and get:
    t, z, d, r, f, g
    It's then no longer in order with respect to either comparator and the whole thing is broken. You need to set the Comparator in the constructor.
    Use an ArrayList and the code becomes:
    public synchronized void add(Object obj)
            int index = Collections.binarySearch(list, obj, comparator);
            if (index == list.size()) list.add(obj);
            else if (index < 0) list.add((index * -1) - 1, obj);
    }

  • Searching Sorted List

    I'm trying to write a method that searches a sorted list using compareTo() rather than equals(), as follows:
    public static <T extends Comparable<T>> T find(final T instance, final List<T> list) {
       T result = null;
       for (final T entry : list) {
          final int comparison = entry.compareTo(instance);
         if (comparison < 0) {
            continue;
            if (comparison > 0) {
               break;
         result = entry;
         break;
       return result;
    }I have two classes, A & B:
    Class A implements Comparable<A>
    Class B extends AI don't understand why this won't compile:
    List<B> list;
    B item;
    final B result = find(item, list);The error message reads like this:
    Bound mismatch: The generic method find(T, List<T>) ... is not applicable for the arguments (B, List<B>).
    The inferred type B is not a valid substitute for the bounded parameter <T extends Comparable<T>>Is this just a syntax error on my part, or is not possible to do what I'm attempting? Or is there a standard Collections class that already does this? I looked at Collections.binarySearch(), but I need to use compareTo() rather than equals() to determine a match.

    It looks like you are writing a linear search version of the Collections.binarySearch.
    [http://download.oracle.com/javase/6/docs/api/java/util/Collections.html#binarySearch%28java.util.List,%20T%29]
    You will note it has been declared
    public static <T> int binarySearch(List<? extends Comparable<? super T>> list, T key)

  • Is there a way to get a handle on Sorted list of a SortableModel

    I'm using adf table based on SortableModel. Sorting works fine when i click on a table column which is enabled for sorting.But is it possible to access the sorted list or rows in the bean code.
    myTableModel.getWrappedData() only gives the actual list not the sorted ones.
    How do i get the handle on sorted list. i'm using 10.1.3
    Thanks,
    Senthil

    Hi,
    here's how it should work
    for (int i=0; i<sModel.getRowCount(); i++)
    sModel.setRowIndex(i);
    System.out.println("i:"+i+" data:"+sModel.getRowData());
    Frank

  • Name Sort -List View- Not Displaying  As Expected

    If I create several folders inside a main folder that is sorted by name - ascending - I get odd results in terms of the sort order - it seems to be dependent upon the length of the string - or actual numeric real numer (4444 is bigger than 888) in addition to the alphabetical aspects - especially when dealing with numbers only. For example - this is the order I get with the following folder names:
    1
    7
    8
    77
    888
    4444
    11111
    Q: What is a logic behind this odd sorting order? is there any way to control it? I would prefer that it would be more alphabetical - for example anything that starts with the number one would be together like:
    1
    11111
    4444
    7
    77
    8
    888 ..... this type of thing etc.....

    Thanks for the info Malcolm & Tom.
    From: How Finder lists items that are sorted by name (Mac OS X)
    Location: http://docs.info.apple.com/article.html?artnum=300989
    Note: If you select all these items in the Finder window (Command-A), copy their names to the Clipboard (Command-C), and then paste them into a text document (or email), they will appear in a slightly different order.
    Q: What is the logic behind this 'slightly different order'?

  • How to sort lists

    Having just bought my first Mac I find that simple steps like sorting a list don't work the same way as on my Windows XP PC (right click on mouse). Can anyone tell me how to sort a list such as my (imported) favourites?
    willjm

    Once you figure out the sorting issue, see these:
    Switching from Windows to Mac OS X,
    Basic Tutorials on using a Mac,
    Mac 101: Mac Essentials,
    Anatomy of a Mac,
    MacFixIt Tutorials,
    MacTips, and
    Switching to the Mac: The Missing Manual, Snow Leopard Edition.
    Additionally, *Texas Mac Man* recommends:
    Quick Assist.
    Welcome to the Switch To A Mac Guides,
    Take Control E-books, and
    A guide for switching to a Mac.

  • Sort list items according to predifined order

    hi all,
    I wonder is there any way to sort the items of a list
    according to a predefined order (e.g., 2,3,1)?
    Many thanks

    As far as I know the only predefined sort order is
    alphabetic. You could write a function using
    list.addAt(position,value) to add new items in the proper location
    and maintain the sort order yourself. This might involve a lot of
    looping through the target list, depends on how complex your sort
    rules are.
    I had a project where I needed to keep a list of file names
    sorted by rules other than alphabetic. I actually used a big lookup
    table (case statement) to append letters to the beginning of each
    name just before adding them to the list, the letters were stripped
    off when data was retrieved from the list. This trick allowed me to
    use list.sort() to maintain the sort order. It’s an ugly
    solution and I’m not proud of it, but it got the job done.

Maybe you are looking for

  • Firm or Trade-Off Zone Indicator not set

    Hi I have created the scheduling agreement and run the MRP by this the schedule lines are generated but the system has not set Firm or Trade-Off Zone Indicator how do I go head? IS there any customization/master data required to set the this indicato

  • Can I run Tiger and Leopard on the same computer

    Hi folks. I've been meaning to install Leopard for ages but have never got round to it (I bought the retail box when it first came out). I have upgraded my RAM to 2GB and my hard drive to 320GB with no problems. My upgraded hard drive has been partit

  • Lion IMAP account - Sent messages are not sync

    Hi all, this question is not strictly related to Lion, as this "problem" sussist even in the old Leopard, however I was believing it woul have been fixed with the new version. I've my Mac Book Pro with all my email configured as IMAP. This is great,

  • Firefox is not launching in one user account (just does not react at all) although it works fine in another account on the same laptop

    Have been running Firefox without problem in both my own and my child's account on my laptop. Today, although Firefox still works normally in my own account, it does not launch at all in my child's account. Clicking on either the short cut or via All

  • Format specifiers for spreadsheet to string

    I have used the format specifiers many times before with no problems but this one has stumped me.  I scan a delimited spreadsheet string and convert it to string array.  I then write to a string table.  I would like the format to be X.XXE+N.   I have