Different sort behaviour

Hello,
can anyone tell me the cause ?
when i run the code below with -Duser.language=tr JVM environment, it works expected well. But when i run it with -Duser.language=en JVM environment then some words sorted wrongly?
I've used collator for correct turkish sorting, and this corrects some sorting problems. But this time we have some problems on accent chacacters depends on JVM user.language environment. What causes this, and how can a solve this?
Thanks,
mustafa
output of -Duser.language=en //wrong one
[Çam
Can
Candar
Övünç
Özakat
Özcan
Özcan
Özcan
Özdemir
Özer
Sagun
Şahin
Sarıtaş
Seklice
Şengül]
output of -Duser.language=tr //correct one
[Can
Candar
Çam
Övünç
Özakat
Özcan
Özcan
Özcan
Özdemir
Özer
Sagun
Sarıtaş
Seklice
Şahin
Şengül]
The code:
import java.text.Collator;
import java.text.ParseException;
import java.text.RuleBasedCollator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
public class kollator {
      * @param args
     static Collator collator=Collator.getInstance(new Locale("tr", "TR"));
     static final Comparator<String> MYCOMPARATOR = new Comparator<String>() {
          public int compare(String s1, String s2) {
            return collator.getInstance().compare(s1, s2);
     public static void main(String[] args) {
          String[] strs={
                    "Can",
                    "Candar",
                    "Çam",
                    "Övünç",
                    "Özakat",
                    "Özcan",
                    "Özcan",
                    "Özcan",
                    "Özdemir",
                    "Özer",
                    "Sagun",
                    "&#350;ahin",
                    "Sar&#305;ta&#351;",
                    "Seklice",
                    "&#350;engül",
        List l=Arrays.asList(strs);
        Collections.sort(l, MYCOMPARATOR);
        System.out.println(l.toString().replaceAll(",", "\n"));
}Edited by: yorukoglu on May 15, 2009 1:17 AM

Well, I don't know much abuot collation and internationalisation (being English the world is already in my language!), but...
In your custom comparator, it would appear that you are calling the static getInstance() method through the collator instance (you can have Eclipse and maybe other IDEs warn you about this because it almost always represents a bug). So you're making a new instance without passing in a Locale. And I guess this sorting according to your user.language setting.

Similar Messages

  • Export using a different sort

    Hello Gurus,
    I need to create an Export using a different sort order than the Core.SortOrder.  I think I can set up a couple of new properties - one for the Sort Property (SORT_B) and one to collect the sort values (using the SORT data type).  I'm not sure how to call it in the Export.  So... how do I use a different sort order when creating the export.
    Many thanks in advance for your insights!

    By default DRM sorts hierarchy either alphabetically or numerically and this is by default, you can disable this by creating one derived property.
    Example:
    I have action script to add nodes as shown below
    Name           NodeId
    Country          1
        India           2
        Japan        3
        America     4
    If i build the hierarchy, it looks
    Node              Node ID
    Country              1
        America         4
        India              2
        Japan            3
    in alphabetical order.
    you can create one derived property PropValue(Core.ID) and select type as "sort" then assign this property to Default Hierarchy sort then the result will be in the format you expected.

  • Exporting from Lightroom 1.3: Different sort order than defined in Grid view

    Just did an export from Lightroom 1.3 and ended up with a the wrong export order.
    Here is what I did.
    1. Create a collection
    2. Drag the pictures I want to export into that collection
    3. Select: Sort: Import order (In lightroom grid view - the sort order was correct)
    4. Export from Lightroom with "Userdefined name - sequence"
    The result is a total different sort order than I can see in the Lightroom Grid view.
    Very annoying.
    Any ideas?
    Also - in the new export dialog there seems to be no option anymore to CHANGE a user-defined export like in the previous version. What do you do if you want to change something?
    Overwrite with the same name?
    Remove old export and add the new one changed?
    greetings
    gfisch

    Are you seeing this only in Lightroom? They are not 'still in the parent, Germany folder.' only visible their if you have 'Include Photos from Subitems' checked in the Menu/Library of Library.
    Uncheck that you you will only see them in their correct folders.
    Don
    Don Ricklin, MacBook 2Ghz Duo 2 Core running 10.5.1 & Win XP, Pentax *ist D
    See LR Links list at my
    Blog for related sites.

  • Default Sorting behaviour of Oracle 9i in 11g along with group by clause

    Hi,
    We have recently migrated from 9i to 11g. The reports from application comes in a jumbled fashion. Later we understood when there is a group by clause in the query, the recordset will be sorted by default in 9i and this feature is not available in 11g. Do anyone faced the same issue and resolved at the DB level.
    Only alternate we found is the change in code with addittional order by clause which will take a long time to complete and roll out the same.
    If anyone has got any immediate solution, please let me know.
    Thx in advance.
    Sheen

    Hi,
    A group by can sort (depending on the method of grouping) but it isn't necessary. If you want to sort the output you need the ORDER BY clause. There are different group by mechanismes between 9i and 11g. 10g introduced HASH GROUP BY where in 9i only the SORT GROUP BY existed. The latter gives a sorted set, the first not.
    if you want the same behaviour you can use "_gby_hash_aggregation_enabled parameter" = false, which disables the hash group by.
    Have also a look at the support document "'Group By' Does Not Guarantee a Sort Without Order By Clause In 10g and Above [ID 345048.1]".
    Herald ten Dam
    http://htendam.wordpress.com

  • Different X behaviour between Solaris 2.6 and 8

    Hi,
    We have recently upgraded a development box to Solaris 8 from 2.6. We have recompiled (same compiler) an application with no changes... and we get different behaviour. There are two problems that we are tracking so far:
    1. Buttons don't seem to be responding to their callbacks so we never leave our modal event loops.
    2. It looks like we're getting truckloads of X expose events causing lost of flicker on every dialog. The CPU is maxing out the whole time, redrawing windows takes forever after hiding it, etc. It seems to be mainly text boxes, but I can't be sure.
    We've copied a binary compiled on 2.6 onto the box and it runs fine so it seems. Is anyone aware of any issues/patches around this area, or any other info we can get to assist tracking down where the exposes are coming from.
    Thanks,
    Rhys

    Progress!
    If I compile with -DMOTIF12_HEADERS and then link with -lMrm12 (which resolves to libMrm.so.3 instead of libMrm.so.4 )and -lXm12 (which resolves to libXm.so.3 instead of libXm.so.4) my application behaves as expected.
    So it would seem that something has changed in Motif that my application does not like, or we were aleays doing something wrong and it just got worse, or... any ideas on where I can start hunting for such a beast?
    Thanks,
    Rhys
    Moazam,
    Just rebuilt using 6U2 both with and without -compat=4
    and it still exhibits the same behaviour... lots of
    expose events, flicker all over the place, high CPU
    usage (its around 60% and Xsun is around 30%).
    Any further ideas?
    Rhys
    To my knowledge, 4.2 is not supported on Solaris 8.
    You should try compiling your code with Forte
    Developer 6.2, and if you need, you can use the
    -compat flags.
    -Moazam

  • Report Queries are using different sort order

    Hello,
    my enviroment is
    Apex 3.1.2
    Apache Web Server
    OC4J Apache FOP
    i have 4 Source queries in one Report Query (shared components --> report queries)
    This 4 Source queries have to be executed in a specific order, for instance my data in
    DATA>
         <ROWSET1>
              <ROWSET1_ROW>
    <query1>AABBCC<\query2>
              <\ROWSET1_ROW>
    <ROWSET2>
              <ROWSET2_ROW>
    <query2>XXYYZZ<\query2>
              <\ROWSET2_ROW>
    content always the same rows.
    Apex is doing some strange things here. Sometimes my queries are executed in a different sequence.
    So the output is like
    DATA>
         <ROWSET1>
              <ROWSET1_ROW>
    <query2>XXYYZZ<\query2>
              <\ROWSET1_ROW>
    <ROWSET2>
              <ROWSET2_ROW>
    <query1>AABBCC<\query1>
              <\ROWSET2_ROW>
    How can i fix the sequence of my source queries??
    Any help is welcome!!
    bye
    Volker Strasser

    I found the solution.
    Anychart seems to have a problem with null values!
    The corrupted sorting only occured for a specific set of search criteria and a specific day. At this day some values have been null.
    I added a "nvl( [...], 0) for every value.
    No I get a correct sort order.

  • Different user behaviour.

    Now a days i am experiancing a different behaviour of the sdn.
    I can able to access some other user data through my account.
    When i logged in to the sdn after some time (few sessions) i can directly see that i have logged in to other user account.
    like when i logged in the message appeared at the top left is welcome xyz.
    after that it is getting changed to welcome pqr
    and i can access pqr's account.
    Why is this happening.
    Mr.Chowdary

    Hello Mr.Chowdary,
    Please try clearing your cached pages and cookies. If you continue experiencing this problem after doing this, take a screen shot of this (where you see another user's name) and send the screen shot as a JPEG file attachment on an email to [email protected] I will receive it there and forwarded it to our operations group for further investigation.
    Kind Regards,
    David

  • Different sort for Z10 contacts and phone contacts

    Hi, I need my contacts sorted by last name, rather than the first name default. I changed the sort order in the standrad contact list and this worked as expected. But: In the phone contact list, sorting is still by first name - and I found no setting to change the sort order. I'd expect that the contact list is sorted identically in both contexts, but seems not to be. Any idea? Thanks!

    Hello,
    I too noticed some challenges with PUSH and Contact/Calendar sync (in my case, with Hotmail/Outlook.com via active sync). I found that it was better to turn off PUSH and instead let it manually synchronize at my chosen interval. Since I use a different provider for email, changing that doesn't affect my configuration for email, and that continues to PUSH via that account.
    We are all hoping that this issue, and all others, get resolved in future OS updates. But for now, I recommend defeating PUSH and instead configuring for interval-based synchronization.
    Good luck!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Different sorting in ListView

    Hi!
    I have got an app with two pivot pages that displays a list of flowernames in Norwegian and in Latin. How do I get to sort the ListViews in the two PivotItems differently? In the first PivotItem I would like to sort by the name column and in the second
    PivotItem I would like to sort by the Subtitle column.
    Thanks, Sigurd F
    <Pivot x:Uid="AppTitle" Title="*Flores" >
    <PivotItem x:Uid="PivotNorwegian" Header="*Norsk namn" DataContext="{Binding Groups}">
    <ListView
    ItemsSource="{Binding}"
    IsItemClickEnabled="True"
    ItemClick="GroupSection_ItemClick"
    ContinuumNavigationTransitionInfo.ExitElementContainer="True">
    <ListView.ItemTemplate>
    <DataTemplate>
    <StackPanel Margin="0,0,0,5">
    <TextBlock Text="{Binding Title}" Style="{ThemeResource ListViewItemTextBlockStyle}"/>
    </StackPanel>
    </DataTemplate>
    </ListView.ItemTemplate>
    </ListView>
    </PivotItem>
    <PivotItem x:Uid="PivotLatin" Header="*Latinsk namn" DataContext="{Binding Groups}">
    <ListView
    ItemsSource="{Binding}"
    IsItemClickEnabled="True"
    ItemClick="GroupSection_ItemClick"
    ContinuumNavigationTransitionInfo.ExitElementContainer="True">
    <ListView.ItemTemplate>
    <DataTemplate>
    <StackPanel Margin="0,0,0,5">
    <TextBlock Text="{Binding Subtitle}" Style="{ThemeResource ListViewItemTextBlockStyle}" />
    </StackPanel>
    </DataTemplate>
    </ListView.ItemTemplate>
    </ListView>
    </PivotItem>

    Hi Sigurd F,
    Based on your description, I can see that both of your two ListViews have bound to a same DataContext in the xaml, then I will recommend you do the binding in the .cs code to let sort the ListView become easily. The following is a simple example about
    how to sort the two ListViews by the first letter of the name column or Subtitle column, please try to check it:
    First I have defined the following class for data binding:
    public class test
    public string name { get; set; }
    public string Title { get; set; }
    public string Subtitle { get; set; }
    Aftet that we can use the List OrderBy method to sort the ListView by the first letter of the name column or Subtitle column:
    List<test> MyList = new List<test>();
    MyList.Add(new test() { name = "aa", Title = "vv", Subtitle = "rr" });
    MyList.Add(new test() { name = "bb", Title = "dd", Subtitle = "aa" });
    List<test> MyList1 = MyList.OrderBy<test, string>(Item => Item.name.Substring(0)).ToList();
    MyListView1.ItemsSource = MyList1;
    List<test> MyList2 = MyList.OrderBy<test, string>(Item => Item.Subtitle.Substring(0)).ToList();
    MyListView2.ItemsSource = MyList2;
    Best Regards,
    Amy Peng
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Configure different sleep behaviour for AC Adapter/Battery?

    Hello,
    quick and easy (I hope) question: is there a way to configure a different behaviour for system sleep depending on current power source?
    I'd like to prevent system sleeping while on AC adapter while leaving it enabled while on battery.
    Thx
    William

    Hello Capt,
    my fault: I forgot to mention I'm trying to get different behaviour on lid close event.
    Thx for you  answer by the way
    William

  • Different query behaviour (index or no index use) between sql and pl/sql

    Hi All,
    I have a query inside a cursor in a procedure, let's say:
    cursor c_emp (b_dept_no in number)
    is
    select *
    from emp
    where dept_no = b_dep_no;
    There is an non unique index on dept_no.
    In this procedure i first loop through another cursor which gets the dept_no and with this dept_no i go into a for loop for the c_emp cursor.
    When i run this procedure i see that the explain plan of above query gives me a Full table Scan on EMP, eventhough there is a index on dept_no and there are 1.3 million records in the em table. When i take the above query and explain it seperately, it uses the index on dept_no.
    I have rebuild/analyzed the tables and indexes, nothing seems to work. Even hints in the procedure cursor are not helping at all.
    I'm using Oracle Database 10.2.0.1.0 and have never seen such behaviour before.
    Anyone an idea what is going on here?
    Kind regards,
    Dave

    Hoi Rob,
    it's like i have three tables. The first i have to get data from for my output, then for every record of table one there are one or more records in table 2 and table 3.
    I had to create a xml file and it looks like this:
    <Table1 Record 1>
    <Name>...</Name>
    etc...
    <Table2 Record 1>
    </Table2 Record 1>
    <Table2 Record 2>
    </Table2 Record 2>
    <Table3 Record 1>
    </Table3 Record 1>
    <Table3 Record 2>
    </Table3 Record 2>
    <Table1 Record 2>
    etc.etc.etc.
    So that's why i programmed:
    for r_1 in c_table1 loop
    for r_2 in c_table2(r_1.dept_no) loop
    end loop;
    for r_3 in c_table3(r_1.dept_no) loop
    end loop;
    end loop;
    And when i look at the first record,
    it has 2 records in table2 en 16 records in table3. So nothing huge.
    For now i'm unable to trace the session. I will try to post the tkprof later.
    Kind regards,
    Dave

  • Different Swing behaviour in Windows & Linux

    Hi ,
    I have an IDEFIX Application(J2ee) whose Client is built on Java Swing.
    Addtionally this application had to invoke an 3rd party Software.
    On invoking the 3rd party Software from this application & on load
    of the 3rd party Software.The Swing Behavior of the client
    of IDEFIX Application behaves in a different way . for Eg : the
    Disabled buttons are not visible ,enterlly the view becomes somewhat
    differrnt & distorted.
    IDEFIX Application invokes the 3rd party s\w through a Thread.
    But The main problem is that it works properly in Linux ,
    The problem arises in Windows system.
    If any body has the solution Please tell
    Regards,
    Sajeev

    The glitchs happen when I run the code in windows. First off when I press the quit button in linux the actionlistener picks up that I hit the quit button and makes a new instance of QuitPopup which simply sets itself to visible. I'm using the default layout manager and on linux the popup window simply comes up in a seperate JFrame and I can click the buttons on it etc..
    In Windows, using the same code when I press the quit button I see the QuitPopup instance come up but it is like it is drawn ontop of the first JFrame. There is no border and the buttons inside of the QuitPopUp() JFrame don't work. When you move your mouse over them the buttons in the original JFrame appear to "come through" and erase the pop-up's graphics.
    For borders on the first JFrame I'm using a no-border full-screen JFrame. For the popup I'm using the default border.
    I'm using the default font on both.
    Also For the fullscreen JFrame in the background I'm using layeredPanes ontop of the JFrame. I have placed buttons inside of the layeredPanes and when I click on them the image I have set for the rollovericon action keeps flashing after I click on it. NOTE: the flashing buttons ONLY happens in windows.
    Do you think trying a different layout manager rather than the default would work better?

  • Strange sorting behaviour with Collator

    Hi all, I'm sorting a list of Icelandic words using a Collator and I am getting rather peculiar results (the locale is is_IS, using jdk1.6.0_20).
    List<String> list = Arrays.asList(
            "Veiðifélag Hörðudalsár",
            "Veiðifélagið Búrfell (Hólmkelsá)",
            "Veiðifélag Hvammsár",
            "Veiðifélag Jökulsár á Dal",
            "Veiðifélagið Skrauma",
            "Veiðifélag Kiðafellsár",
            "Veiðifélagið Kolka");
    Collections.sort(list, Collator.getInstance());Resulting list (incorrectly sorted, with the three 'Veiðifélagið...' items appearing in the middle):
    Veiðifélag Hvammsár
    Veiðifélag Hörðudalsár
    Veiðifélagið Búrfell (Hólmkelsá)
    Veiðifélagið Kolka
    Veiðifélagið Skrauma
    Veiðifélag Jökulsár á Dal
    Veiðifélag Kiðafellsár
    Collections.sort(list);Resulting list (correctly sorted):
    Veiðifélag Hvammsár
    Veiðifélag Hörðudalsár
    Veiðifélag Jökulsár á Dal
    Veiðifélag Kiðafellsár
    Veiðifélagið Búrfell (Hólmkelsá)
    Veiðifélagið Kolka
    Veiðifélagið Skrauma
    I'm having a hard time seeing anything logical about this. I've tried playing with (as opposed to learning about/understanding) the strenght/decomposition properties of the Collator instance but that doesn't seem to have any effect.
    I feel like I'm totally misunderstanding something here, can anyone help me point out what that is?

    That's pretty much all the code, as I'm just using the default Collator returned by Collator.getInstance(), my assumption is that it should sort correctly according to the current locale (is).
    public class Test {
      public static void main(String[] args) throws Exception {
        List<String> list = Arrays.asList(
                "Veiðifélag Hörðudalsár",
                "Veiðifélagið Búrfell (Hólmkelsá)",
                "Veiðifélag Hvammsár",
                "Veiðifélag Jökulsár á Dal",
                "Veiðifélagið Skrauma",
                "Veiðifélag Kiðafellsár",
                "Veiðifélagið Kolka");
        final Collator collator = Collator.getInstance();
        Collections.sort(list, collator);
        //print list contents... incorrect result
        Collections.sort(list);
        //print list contents... correct result
    }

  • Optical Audio in Vista 32-bit : Different/Wrong behaviour in iMac & MacBook

    Hi,
    I've installed Boot Camp a long time ago, but couldn't subscribe to these Apple forums for an unknown reason... well I've finally managed to.
    About my questions, I've searched on the web but couldn't find a precise answer, or it was just not exactly my problem that I would find. So here are the problems :
    *iMac (Late 2006)* : I cannot get sound from my Logitech Z5500 that are plugged via a TOSlink adapter, the optical way. It's just not working at all, while it's working flawlessly in OS X Leopard. The only workaround I have is to remove the adapter from the audio plug, so my iMac produces its sound from its own speakers... They're good, but you know, I don't wanna do that.
    *MacBook (Late 2008)* : The optical audio plug is constantly red, meaning that the system forces the sound to be optical, while I don't have anything plugged it. Keep in mind that it works flawlessly, once again, in OS X Leopard. I heard about "the toothpick, the q-tip and the match" trick in the plug, but you see, I tried it, and it's seriously not the problem, because it wouldn't work in OS X. I also noted that by plugging my Z5500 speakers with their adapter in my MacBook, no sound would come out of the speakers. Strange or normal?
    So basically, both of my computer have different problems related to optical audio, and I can't get them to produce any sound.
    Can anyone shed some light on this? (not red please...)
    Thanks in advance!
    - Dave

    Arg, I didn't really mean to post this in "Installation & Storage"...
    Oh well, I believe we could say I didn't succeed in installing the sound devices properly :-\

  • Would these 2 different Sorting methods makes a difference in performance?

    Hi I'm using vs2012.
    My page is loading up slow.  I was wondering if there is a performance difference to these 2 Sort methods?  The sorted collection is then bind to a gridview control in my web page.
    List<UserPrincipal> users = new List<UserPrincipal>();
    users.OrderBy(x => x.SamAccountName).ToList(); 
    and 
    users.Sort(delegate(UserPrincipal a, UserPrincipal b) { return string.Compare(a.SamAccountName, b.SamAccountName); });
    Thank you.
    Thank you

    First, thanks everyone for your help and input.
    I checked the vm that I use as a web server.  In the Windows task manager, the cpu shows 1% usage and 8GB of ram only 1.6 GB are used.  
    I step through program many times but never notice any sticky spot so I did it again this time looking out for possible performance issue.  It turns out that the Sorting loc steps right through with no delay.  Setting a few break points to measure
    where the performance problem could be at my local development PC finds NADA!  First break points set at the Page_Load event and then more break points at some other major code block and they all just step right through with no problem.  
    It does take almost 5 seconds for VS to hit the first BP, at Page_Load event.  Is this normal?  Any other tool that I can use to find out what's causing the slow page load from the web server?
    Thank you.
    Thank you

Maybe you are looking for

  • Movies from iMac 27 do not show up on macbook air

    I have 24 home-made movie that show up on my main computer, iMac 27, two iPads and and iPhone5. However, I am baffled how to get the same movies to show up on my Macbook Air. I've tried Sharing the Library, turning Sharing off and on on both compuete

  • Can't see brand new iPod Nano in Windows!!!

    I just bought a brand new iPod Nano (2nd Gen) for my daughter for Christmas, and right out of the box it would not be recognized by Windows XP or iTunes -- even though another iPod Nano (1st Gen) that we own did connect. It was charging though. I use

  • Quicktime launches, appears in taskbar but nothing on desktop

    Each time I launch QTPro, it appears in the taskbar but there is no application open on the desktop. When I right click the taskbar icon, there is no option (grayed out) for Restore or Maximize, just Close and Move. When I select Move, I get the 4 ar

  • How do I Update my Apple ID that is saved in my iphone

    how do I update my Apple ID that is saved in my iphone to my new ID i just created? It is always prepopulated with my previous appleid and won't allow me to enter anything except a password.

  • Want to get Run By from CI_INFOOBJECTS

    Developed a Java SDK web application. In report details page have three columns SI_KIND , SI_CREATION_TIME ,  SI_NAME want to add one more column Run By. How to get it. Thanks in Advance