Why is it such a pain to use java in a country that uses commas as decimal?

Why is it such a pain to use java in a country that uses commas as decimal separator?
A few weeks back I've asked here about the keypad decimal key. For some reason, java doesn't map the decimal key to a comma on the Portuguese (Portugal) keyboard layout. I've got no answer and I ended up using a custom plainDocument on the JTextFields to replace all points with commas.
Now, I've just spent the whole morning trying to store and use decimal numbers properly. For some reason, a Double/Float .valueOf method (or the corresponding parse method) simply ignores the locale in use and uses US defaults when parsing the string. I can't parse anything with commas in those methods and I should, as it is the decimal separator for the system and default locale being used by java.
First of all, I shouldn't be expected to perform replacements on every single operation that comes with a comma and I obviously can't be expected to program my own locale checking to decide what decimal separator to use in each final system. Second, is there any way to work with numbers seamlessly, without having to know the locale of the end user?
I'm sorry if this is all my fault for doing something completly wrong, I'm new to java and I did search around to no avail. I'm really frustrated with what seems to be a complete lack of support in java for locales other than the US one.

Good old Cobol has the "DECIMAL-POINT IS COMMA" clause... And isn't it great? :)
Second, is there any way to work with numbers seamlessly, without having to know the locale of the end user?Consider "123.456". In some locales, this number is one hundred twenty-three thousand, four hundred fifty-six. In other locales it is one hundred twenty-three and four hundred fifty-size thousandths. How will you be able to determine which, without a locale?That's not what I've meant. Java should know the locale and behave accordingly. I don't have to know the locale of the end user since it might vary greatly. My point is that if strings are flying around with commas and if comma is the decimal separator on the end user's machine, any method aimed at parsing a numeric value out of a string should regard commas as such. I'm constantly replacing dots with commas and vice versa which could cause trouble if a different locale is used.
And I mean that as a rant. Given my inexperience with Java, there might be good reasons for such a behaviour as baftos argued. What I'm really interested is in finding the proper way to deal with this issue.
Have you tried the NumberFormat.parse? I will now.
Edited by: Smigh on Apr 9, 2008 9:21 AM

Similar Messages

  • I am unable to change or delete my iCloud ID, it is prompting sign in using an old email address that used to be my Apple ID, others have had this same problem but the answer seems to be to delete the iCloud account but I can't do that.

    I am unable to change or delete my iCloud ID, it is prompting sign in using an old email address that used to be my Apple ID, others have had this same problem but the answer seems to be to delete the iCloud account but I can't do that, because when I select delete account it prompts me to sign in on the old email address which doesn't exist anymore!! Please help!

    Welcome to the Apple community.
    This feature has been introduced to make stolen phones useless to those that have stolen them.
    However it can also arise when the user has changed their Apple ID details with Apple and not made the same changes to their iCloud account/Find My Phone on their device before upgrading to iOS 7.
    The only solution is to change your Apple ID back to its previous state with Apple at My Apple ID, verify the changes, enter the password as requested on your device and then turn off "find my phone".
    You should then change your Apple ID back to its current state, verify it once again, delete the iCloud account from your device and then log back in using your current Apple ID. Finally, turn "find my phone" back on once again.
    This article provides more information about Activation Lock.

  • Does anyone know if I can use verizon on a phone that used to be active on walmart's straight talk plan? I would like to use verizon prepay service.

    Does anyone know if I can use verizon prepay service on a phone that used to be on walmart's straight talk plan? It is not active at all right now.

    Prepaid Bring Your Own Device (BYOD) Program FAQs | Verizon Wireless
    Specifically #5.
    Set Your Location

  • Impact of use XMLEncoder to log transactions that use serialization

    Hi,
    i have an application that uses serialization to communicate between client and server, i want to log this transactions in a xml file using XMLEncoder, using the method:
    public static void log(Object transaction) throws Exception {
            XMLEncoder e = new XMLEncoder(new BufferedOutputStream(new FileOutputStream("log.xml")));
            e.writeObject(transaction);
            e.close();
    }if i put this, how i can check the impact on the system? the XMLEncoder consumes memory to build the XML, then the impact will be only for the garbage collector?
    thanks for any idea.

    A profile would be the best option. NetBeans comes with a free one. There is also OptimizeIt and JProbe. Otherwise you'd have to write a lot of code to get that info.

  • General Question - Why is Oracle such a pain to install on a Windows 2000 server

    IS this by Design? I have to use Oracle for one of my clients and I cant get 8.1.6 , 8.1.7 or 9 to install correctly for anything. Im confused about things like why the database wont start, or it says its started under services but of course its not. I sometimes (like once) can get the management console to come up but I usually have my fingers crossed and grabbing my lucky rabbits foot. Whats up? Am I "oracle challenged" here or do others experience the same issues?
    Any help is welcome.
    thanks in advance.

    Hi!
    This (http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=159333.1) guide on metalink also does the trick.
    Regards Mikael
    I feel your pain. I've probably installed the RDBMS on 25 separate Windows servers in the last 5 years (versions 7.3 through 9.2) as well as iFS, iAS, etc. For a novice, and even a pro, it can be a hair pulling experience. I've virtually given up trying to do upgrades and fortunately I've been able to schedule downtime for those servers requiring upgrades. Even for "clean" machines it isn't always 100% reliable. My experiences installing Oracle on Linux have been harrowing, and it is only for someone that is truely committed. My best advice, is get yourself a true test machine that you can completely redo, and test installing it. For Windows, if an install fails (or if you want to "get rid of an older version of Oracle all together" before you upgrade), then do the following (do not do this on production machine, or with anything that you want to keep, and it is not sanctioned by Oracle, and no warranties what so ever).
    1) De-install all Oracle products using Universal installer.
    2) Remove all Oracle entries from the path statement
    3) Delete all of the files in the Oracle directory. There will be problems with some files in Bin.
    4) Using Regedit delete the software registry keys for Oracle (hkey_local_machine\software\oracle).
    5) Delete any left over entries in the registry for Oracle services (hkey_local_machine\system\CurrentControlSet\Services\Ora*)
    6) Delete all of the oracle files in program files\oracle
    7) Reboot
    8) Delete the files in the oracle directory that couldn't be deleted in step #3 above and #6 (if any)
    Oracle should now be gone, and you should be able to test another installation.

  • Why is it such a pain to create playlists?

    On the mac you can use commandshiftN to create a playlist from a selection, but for some reason there's no shortcut for this on the pc, and it's a pain.
    I transfered all my music to my PC b/c it's better than my aging powerbook, but I was too lazy to take the time to create endless numbers of playlists... but now my iPod is full, so I'm trying to organize everything into playlists, but it's taking forever... is there anyway to automate this? It would be really really really really nice if I could just tell iTunes "take all my albums and create a playlist for each one" rather than have to select -> file -> new playlist from selection 300+ times!!!
    I think I'm getting carpel tunnel, Help!

    That still gives me one giant playlist that is a pain to easily keep track of
    Actually, it's much easier to keep track of.
    Select the playlist then menu View -> Show browser.
    This way you get to see the artist, albums and all the songs instead of a playlist name.
    Select any of these and press Delete to remove from the playlist.
    Drag albums from the library view to the playlist.
    Sync the iPod.
    (Not trying to simply drag this out but it seems what you are trying to is already very simple and will save a lot of work (creating hundreds of playlists). Many people have done very time consuming stuff only to find out they could have done the same with a few mouse clicks becaue they don't know or understand something about iTunes or the iPod.)

  • Why is Mail such a pain?

    I got my MBP back in December. I've been avoiding setting up Mail because of the hassle, and because I wasn't sure I needed to have my MBP get that bogged down in its functions (audio and photo).
    So, anyway...last week, I found I needed to go ahead and set up Mail.
    I can't do squat with it, outside of my .Mac account (how convenient, huh?). My regular ISP, my website host, neither of them can figure out why I'm having so much trouble.
    My .Mac account works flawlessly.
    My ISP account can receive but not send, despite countless attempts to set it up EXACTLY like the Mail accounts on my other computers.
    My godaddy account can't talk to Mail, either, despite me following exact directions.
    It does not matter the directions I follow, the changes I make, or how many attempts I make, the end result is the same: hair-pulling, denials, hours on the phone with tech support. Eventually, alcoholism.
    Why does this have to be brain surgery, every time?
    Seriously...every time I've had to set up a Mail account, I've had innumerable hoops to jump through, just like doing anything on a Windows machine. You have to keep trying all sorts of things, over and over, just to get a modicum of progress.
    It shouldn't be this hard, people. This is among the reasons why we pay the $$ we do for Apple product.

    Well here's a few things to consider...
    • There are a lot of people who let off steam here. Discussion forums tend to enable that, due in part to their very nature, their very design.
    • If the notion of someone letting off steam is going to unnerve you guys that much, then you've got a lot of work ahead of you...this place is rife with it.
    • If discussion forums aren't any place to let off a little steam, then, where? Certainly no where else at Apple.
    • Yes, I'm letting off steam. I'm also asking for some help. If you guys need it spelled out for you, then maybe a "steam-letter-offer" is not where you need to be focusing your energies.
    • Take a look at my post count. There was a time when I had a much higher number--and most of it was being helpful to others--but that was mysteriously dumped in favor of a lower post count from a second computer, hence, the "1" after my name. Regardless, I soldiered on.
    • You'll notice that I rarely visit here. That's because my computers work like they're supposed to, for the most part, and often some of the questions I have are from forgetfulness, because the computers work so well, so I don't often have to deal with an issue.
    Given that because I'm here, at this moment, letting off a little steam about this, means that this has been a recurring problem for too long, and that Apple has been next to no help about it. In other words, it takes a lot for me to get steamed about an Apple product.
    Guess what? We're there.
    I'm not the only one. I won't be the last. Don't pretend it to be otherwise.
    Setting up mail is consistently a hassle. Yes, I'm complaining. Others do it, too.
    There has to be an answer, somewhere, for this. Nitpicking people, over semantics, who are upset really doesn't help the situation.
    So, let's get over the semantics and uppityness, okay? If you really need to do that, there's a long list of people who are much more frequent complainers than I. Looks to me, Mr. Brody, like you were OK with my post until Mr. Kinsella piped up. What does that say?
    Back to the issue...
    Mr. Brody, I don't know any other port numbers than what my ISP and goddady have provided me. I would assume one cannot just start typing any old set of numbers in the field. Is there a generic list of port numbers, somewhere, that people can draw on, or are they provider-specific?
    I am on dial-up. There are no firewalls in place, other than any that might be installed at the provider's end. Once in a great while, I use a wireless broadband connection, with my neighbor's open blessing; being that it's been so politely provided, I don't really take advantage of it very often, save for large files up/downloads. I know I have setup at least one other account on that access, and two on my old employer's wireless access, so I'm at a loss to understand how this attempt is any different than any other...outside of the fact that this is the first time I'm trying to do it on this MBP. In fact, I set up the first account on the MBP--my .mac one--on dial-up in another part of the state.
    In summary, regardless of where I go--wireless here, wireless at old job, dial-up here or dial-up in another part of the state--I cannot set up another mail account (outside of the .Mac one) on this MBP. I've had problems setting up mail before, but never with this many hoops. I've tried every tactic I've tried before, but this time, the software seems to be more stubborn than before.

  • Why is updating such a pain and so confusing

    In my post below you will notice I am currently using 9.1 I downloaded the updates for 9.2.1 and 9.2.2
    I click on the 9.2.1 and I get a start up disk with very confusing instructions. Where is this disk supposed to go and then since this is the 1st fragment of 6 ...what do I do with the others?
    What lies ahead in these fragments remaining in 9.2.1 and what am I going to see in 9.2.2 that will cause a problem.
    It seems llike a very confusing method of updating a computer.. I have been at this for days now and am still not up and running
    Can ANYONE Out there clear this mess up? I hate to keep making posts here but I have no idea where to go from here or what I am supposed to do. Remember I HAVE NEVER DONE THIS BEFORE SO PLEASE BE AS CLEAR AS POSSIBLE
    Thanks
    John

    The reason for the fragments is because back in the days when Mac OS 9 was new, most people had slow dial-up connections, so it was difficult to download a "huge" 82MB updater in one shot. If the connect was broken during download, you had to start all over again. If the download itself was broken into fragments, then a broken connection did not require a complete start-over on the download.
    For future reference, if you need to download again and you have a broadband connection, the download page for the Mac OS 9.2.1 updater has both the multi-part (fragmented) and one-piece downloads.
    http://docs.info.apple.com/article.html?artnum=120030
    If you get the single download, you don't have to deal with the fragments.

  • Unable to use Java in Firefox 16 Extension using Live Connect

    In Firefox 16, java can no longer be accessed using the global instance as per https://bugzilla.mozilla.org/show_bug.cgi?id=748343.
    I have built a custom selenium-ide.xpi (http://seleniumhq.org/download/) which loads up java and runs through my custom framework. To access java I added an addJava.js file, which I included in the selenium-ide-common.xul file calling the java using something like what is found at https://developer.mozilla.org/en-US/docs/Java_in_Firefox_Extensions, however this no longer works.
    Does anyone know how to fix this?
    Thanks in advance, James

    For some reason the below didn't post in the initial post.
    I've tried the following to fix the issue:
    Adding the below to the various .xul files, but each time I try the below I get that appletRef is null:
    <div name="appletDiv">
    <embed id ="cipherDocsApplet" type="application/x-java-applet;version=1.6" code="java.applet.Applet" pluginspage="http://java.com/download/" MAYSCRIPT="true" width="0" height="0" />
    </div>
    var appletRef = document.getElementById("cipherDocsApplet");
    window.java = appletRef.Packages.java;
    The below gives me java_instance.Packages is undefined.
    var java_instance = window.document.createElementNS("http://www.w3.org/1999/xhtml","applet");
    java_instance.setAttribute("id", "adsfund_java_instance");
    java_instance.setAttribute("code", "java.applet.Applet");
    java_instance.setAttribute("width", "0");
    java_instance.setAttribute("height", "0");
    java_instance.setAttribute("flex", "1");
    var div = window.document.createElementNS("http://www.w3.org/1999/xhtml","div");
    var elementToAppendTo = window.document.getElementsByTagName("vbox")[0];
    elementToAppendTo.appendChild(div);
    div.appendChild(java_instance);
    var date = new java_instance.Packages.java.util.Date();
    Finally I tried https://bug748343.bugzilla.mozilla.org/attachment.cgi?id=655062, adding the app element to my main xul file and getting it later, but that also gives me the same error: 'TypetError:app.Packages is undefined.'

  • How can I transfer my old music files to my new iPod using a different computer from that used on the old iPod?

    I got a brand new iPod and wanted to put the music files on my old iPod to the new one. In addition to this I would like to know how to sync my new iPod to a different computer from that of the old one. Is it possible for me to accomplish all this with music rescue?

    Put everything on one computer and sync to that computer.

  • Using safari or any app that uses internet is timing out

    I have backed up my phone, reset my network settings and still it times out with 5 bars and 3g access. what to do.

    To follow up on my previous post. I went to The Apple Store and my wired (ethernet) internet worked perfectly. They checked out the computer with the network utility and everything was fine. I went back home and it was still disconnecting after 3 minutes. I had Comcast come and change my modem and ethernet cord and it still was disconnecting. And of course my old Powerbook G4 sitting next to it works perfectly. Anyone have any ideas? What should I do next. I have Apple Care.

  • Why is shipping to an address other than the billing address such a pain?

    On 11/6, I placed an order for an iPad mini 3 (on Edge). I could not change the shipping address on the order, because I did not have either of the 2 phones on me that are on my account at the time, so I could not receive the "authorization code" via text message.
    After placing the order, I immediately called to see if I could change the shipping address. No problem, they said.
    On Saturday, 11/8, I received an email that they had to "further review" my order, and that I needed to call them within 7 days. I called immediately, accepted the terms and conditions, and again asked her to check (and change) the shipping address, since I knew the device had not shipped. No problem, she said.
    Today, 11/10, I received tracking information. iPad being sent to my old address.
    It's not the end of the world. Annoying, but it's my parents address, not some random old address. However, it's about 100 miles away. I left my billing address there because that's where my bank and credit card billing addresses are as well, since I'm planning on buying a house in the next year or two, I want to wait for that permanent residence before I change my mailing address for important things.
    Today, I ordered a Droid Turbo on my main line. This time, I DID have my phone on me, and I was able to get the authorization code texted to me in order to authorize the address change BEFORE even placing the order. I changed the address to my work address. The "Ship To" address in my email confirmation shows my work address.
    I received tracking information this evening. Phone being sent to my old address.
    ***, Verizon???! I called, and they said they could put in a "redirect request" on both orders, but that it would delay shipping. Well I guess there's no point, because if it's going to delay shipping until next week or longer, I'll get them faster by just going and picking them up this weekend.
    For the iPad, it's whatever - I had to change it after ordering, so even though 2 reps confirmed it would be changed, I wasn't really surprised. But I don't understand why the Droid isn't shipping to the correct address when I changed it prior to completing the order AND it shows the correct "Ship To" address in my email confirmation.
    Argh!! Why is this such a pain??!

    Actually, @SandyS_VZW I might like to have the phone redirected if it's at all possible, though I'm not entirely confident that it will even happen since it did not work with the iPad (even though it hadn't shipped when I changed the address... twice).  There will be someone home at the old address today to receive the iPad when it is delivered, but there will NOT be someone home on Wednesday, when the phone is delivered.
    How can I get the redirect started and ENSURE that it is being delivered to the correct address?  When I called last night regarding the phone, they said there was "no indication or notes" showing that it was to be delivered to a different address, even though that's what is shows on all of my order confirmation emails and everywhere else!

  • Eclipse - Why is it such a popular choice over NetBeans?

    I've been a Java developer for about 5 years, and for the first 2.5 years the only IDE I used was NetBeans. Since then, in practically every other Java job I've had, the developers all seem to prefer Eclipse over NetBeans, and I can't understand why. Moving from NetBeans to Eclipse was painful for me for the following reasons (among others).
    - In Eclipse, you can't point and scroll, you have to click to set focus first. NetBeans is sensitive to your mouse movement, so you can scroll through your package list, then your code editor window, without unnecessary clicking to set the focus to what you're pointing at. It may seem like a small issue until you get used to having it and then go without it. Then it seems like a ridiculous oversight on the part of Eclipse.
    - In Eclipse, if you do a search for usages of the method myObject.toString() (highlight toString(), right-click, References -> Project), it finds all usages of Object.toString() instead of myObject.toString(). So 95% of your search results are totally worthless.
    - Eclipse has a bad habit of getting out of sync with the file system, causing searches to fail until you refresh the workspace. What's that about?
    - Eclipse Search has a bad habit of looking into binary files for results. I'm developing Java code, so I need to search Java code, not .class files!
    - Eclipse annoyingly replaces your source tabs, as opposed to opening new ones, when you open a new source file by double-clicking a search result. If you can navigate the trainwreck layout that is Eclipse Preferences, you might find where you can turn this behavior off.
    - F3 and Shift + F3 represent find next and find previous, practically everywhere else in the world except Eclipse. This is also configurable in Eclipse Preferences, but should be defaulted to this out of the box.
    Of course NetBeans has a few of its own annoyances, I'm not saying it's perfect or anything. But the only way I've seen Eclipse being superior to NetBeans has to do with the SVN plugin, and Eclipse can't even take credit for that. So I just don't understand why so many people seem to be on the Eclipse bandwagon when NetBeans is at least equivalent if not superior in every way as far as I can tell.

    BinaryDigit wrote:
    Thank you. I also noticed that NetBeans is a resource hog compared to Eclipse, so that's one major benefit. Also, Eclipse has a way to do things like automatically define serialVersionUID in several files at once using the Quick Fix feature, but NetBeans doesn't seem to have any such thing. Those are the things I'm asking about - significant differences that would compel someone to prefer Eclipse over NB.Those are minor differences. How on earth is automatically defining the serialVersionUID a significant difference?
    Besides, once you've installed enough plugins, Eclipse is quite the memory hog too.
    kevinaworkman wrote:
    This isn't really the place to post complaints about a particular IDE.Good, because that's not what I'm doing at all. The thread title has a clue if you care to read it.Regardless of the thread title, this will become a useless "which tool is better" discussion. Just like if we were to compare Windows and Linux or say Ruby and Java.
    kevinaworkman wrote:
    Then perhaps you should ask them instead of us?I'm asking people here for reasons, if any, why they prefer Eclipse over NetBeans.All my Java programming co-workers are using Eclipse as far as I know, it's very much a de facto standard (although I assume there are NetBeans houses too, I've just never worked in one). I came to Eclipse from Visual Age 4 Java and NetBeans has never impressed me. Now IntelliJ IDEA, that's another story.
    I'd like to learn more about what the big attraction to Eclipse is. I figure I must be missing something.Well, your story started out as "I've been using NetBeans and Eclipse is different".
    If you don't prefer Eclipse over NetBeans, and would rather pseudo-moderate the forums by trying to dictate what can and cannot be posted here, then kindly go away because I don't need your feedback in that regard.Well nowadays we have the real moderators to keep things calm, so no need to waste your breath by telling us to go away.
    Especially when I've been here 3 years longer than you.Now now, the "registered" date has less meaning than your senseless drivel. It's the post count that determines your rank in here.
    Kayaman wrote:
    Then take your whining elsewhere you whippersnapper.
    Nobody cares that you're not used to using Eclipse.Oh look, another abrasive prick who'd rather make assumptions than respond to the actual question.Don't get your knickers in a twist.

  • How to read a text file using Java

    Guys,
    Good day!
    Please help me how to read a text file using Java and create/convert that text file into XML.
    Thanks and God Bless.
    Regards,
    I-Talk

         public void fileRead(){
                 File aFile =new File("myFile.txt");
             BufferedReader input = null;
             try {
               input = new BufferedReader( new FileReader(aFile) );
               String line = null;
               while (( line = input.readLine()) != null){
             catch (FileNotFoundException ex) {
               ex.printStackTrace();
             catch (IOException ex){
               ex.printStackTrace();
         }This code is to read a text file. But there is no such thing that will convert your text file to xml file. You have to have a defined XML format. Then you can read your data from text files and insert them inside your xml text. Or you may like to read xml tags from text files and insert your own data. The file format of .txt and .xml is far too different.
    cheers
    Mohammed Jubaer Arif.

  • How to create a database using Java?

    Hi there..
    I'm a student who is currently studying IT and was asked to do a project based on database but create using Java.. since i'm a beginner..i was wondering whether is it possible to do that?
    and if it is possible.. can you kindly show me a sample of code on how to start the project...
    thank you
    yours sincerely,
    Shafini

    While duffymo is correct in regard to most major database products, it's my understanding (warning! wild-ass guess coming) that the Hypersonic DB is more "application-centric" and the dynamic creation of databases is part of its design. It's pure Java database software, and therefore is not appropriate for all database projects, in particular those that require extremely high-performance.
    See http://hsqldb.org/
    I've not used it yet (but soon though), and I can't really advise anyone about it.
    However, I'm wondering if you phrased you question in a way that is confusing us. To most of us in casual conversation, a "database" is both (1) a large organized collection of data and (2) the software that is used to organize and access it. However, the phrase "create a database" usually means creating a (1) database (a collection of data) using an already created (2) database software, such as Oracle, MySQL, DB2, HSQDB, etc., etc. If you'r question is, how do a create some new database software using Java, the answer is that this is a very very big and hard thing to do for the general case and probably not something you want to be doing.

Maybe you are looking for

  • Letter of Credit Process in SAP

    Hi Guru's Can any one send me or explain me  the letter of credit process in SAP or sales cycle? please send step by step configuration or documentation on the above process. my mail id is [email protected] Suitable points will be rewarded. thanking

  • ITunes or No iTunes

    This may be a backwards question. I couldn't find any answers by searching the forums, so here goes. I'm looking to buy an iPod or other mp3 player for my nephew. He has some legally purchased and some illegally downloaded mp3s. I've been the good un

  • FLV Players with multiple playlists.

    Both the LA Times http://www.latimes.com and the Chicago Tribune http://www.chicagotribune.com as well as other newspapers have a nifty multi-playlist FLV player on their front page. The Player comes with a playlist that shows thumbnails for a list o

  • Pound sign "£" in emails - using mail

    sending out some emails yesterday, using some figures - tried sending £ symbol however, when people receive the email its not showing up just a question mark... so they not getting lets say £123.00 but ?123.00.. I have checked my language settings an

  • FLV Player rollOut

    Hey - Problem: I have an FLV player that takes up the whole stage area and selected 'autoHide' for the video control skin. Just wondering how to make the video controls hide when the cursor leaves the flash file area (when it has been embedded in an