- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
That's kinda sad.
Admin
Another post about that Europe place. If they don't speak English then how do you expect them to understand the correct usage of commas and decimal points. I do understand that those Europe people probably need the comma between the dollars and the cents because they probably need a small pause between the dollars and the cents to sing a few lines from "The Final Countdown".
Admin
I like the fact that any other character than dot or comma will lead to a run-time error (I've seen the apostrophe used as a decimal separator in some places). For the rest, I find this code very considerate and respectful to other cultures and not a total waste of CPU cycles at all.
Admin
As a Dutchman myself, I can verify that this is the absolute truth, and it happens, interestingly, every time I go shopping and pay with US dollars.
Admin
there are 2 comments!
Admin
I can't think of any reason to use a string. I mean, he/she obviously brought currentValue in as a decimal, so why not just set maxValue as a decimal as well, it's already essentially a constant. Or assign it a value in a bundle dependent on the language in use on the machine. Then you wouldn't have to worry about whether or not a comma or decimal was there.
captcha: Dreadlocks. ya man.
Admin
That's why every programmer should first learn low-level languages, and exercise himself in manipulating integers, floats, fixed points numbers and strings, converting one type to another in assembly. That's the kind of mistake you make if you have no clue about how variables are stored in memory. So he thought numbers need to be localized before comparisons.
Joel Polsky regularly writes about that matter. This programmer must be proficient in writing "Shlemiel the painter's algorithms"
http://www.joelonsoftware.com/articles/fog0000000319.html
Admin
The Real WTF is that "System.Globalization" uses United States-centric spelling!
Admin
Reminds me of where i work.... We have a asp.net website and one of my coworkers thought it would be a good idea to split a date from the datasource with a method he has written himself. Unfortunately, i have a browser with english as default language and the website's language was set to "autosensing", so the whole app crashed...
Admin
On topic, though, once I saw that it was a post about decimal/comma issues I just knew the poor bastard was storing the number as a string and then converting it back. And sure enough.
People who can't use Google amaze me sometimes.
Admin
I may be missing something, but why are globalization settings set by CurrentThread? Are they worried one thread might be in a different country than another?
Admin
Absolutely, what with this new fangled web thing...
Admin
For no reason other than it makes me laugh:
"What" ain't no country I ever heard of. Do they speak English in "What"? English, mf, do you speak it? </PulpFictionQuote>
Admin
Uch, different decimal signs... One of the greater annoyances when working with Microsoft apps (which says quite a lot!). Try importing numbers you've just exported from a European version of Excel into Access, or writing Access queries - you need to use American style in all VBA code and (I believe) queries, but everything else, including its output, uses European style. Gaah! Especially when you use an American version of these programs, and your users have a Dutch version... Causes some "interesting" errors...
Admin
m is for moron
Admin
Bizarrely, iTunes had just decided to start playing The Final Countdown when I clicked through to the comments.
Admin
A parable about globalization:
My last company had all their firmware engineers in France. They decided to lay off everyone in France and build a firmware engineering group in house in California.* Unfortunately for them, the firmware was written half in assembly, and all the function names were in French! HA HA!
Admin
Just in case the original poster was actually looking for some useful feedback, and in case the comments of Brit didn't give it:
The thing is that you shouldn't have to worry about the culture of your numeric constants, given that your program's source code doesn't get reinterpreted at runtime... though that would be more fun!
Admin
Well, here's a capthca for you guys that I bet none of you thought of: In Arabic, the comma is actually the decimal separator. Meaning that 9.5 is written as 9,5 - simply because the dot represents the zero number. To make it easier for you to understand, the funniest part is that Arab people do not use the Arabic numbers, we use Hindi numbers. In Hindi number, the zero is represented as a dot: 1000 = 1... 1000.5 = |...,O (yes, five looks more like an O in Hindi - and one is just a straight line. They're still represented as 1 and 5 in your integer though)
When applying regional settings and setting the regional settings to any Arabic country, this will be active immediately in Windows.
Admin
Needs a tri-bool!
Admin
Needs a tri-bool!
Admin
Gaah - what gives with the double posts? The forum used to prevent that from happening. Alex?
Admin
... In Soviet Russia, threads run YOU!!!!
Admin
i had a nice WTFish experience on ebay a couple years ago.
in switzerland, we use of course the correct decimal and thousends separators. one thousdand two hundred and thirty four point five is written 1'234.5
i wanted to spend some swiss francs (you know.. just like dollars.. but different) on an cheap item and entered 8.50 or something.
problem is: ebay seem not to have made a difference between switzerland and germany where the notation 1.234,5 is used.
so my offer for some cheap sunglasses was 'correctly' recognised as 8.500 swiss francs. after all i did enter a thousand separator so i must have meant 8.500 :)
Admin
I just don't like commas used in place of dots, but it may have more to do about stuff I read translated in Spain (instead of locally in Mexico) and getting all terms ugly (like "ordenador" instead of "computadora" or even uglier "translations"). One of the giveaways was the inverted use for commas and dots.
BTW, I had one of those format conversion snafu's in my old job. Someone complained that SAP R/3 was barfing on the input.
Turns out the regional settings for that particular PC were set to Spain, but R/3 works with the dot-separator mode. Copy-pasting that Excel output gave everything in the comma-separated mode...
Admin
Nonsense. Hindi 0 does not look like a dot, nor does 5 look like O. http://www.anu.edu.au/asianstudies/hindi/tech/ANU_Hind_layout.png
Admin
You, Moron!! The same way you don't fucking use the bloody metrical system (inches... measured from a King's hand... ha!) we use diverse decimal separators. And also use something different from you: the BRAIN!
BTW, start mocking other nations when yours get something like a decent history... At least, our forefathers weren't outcasts come from England's jails ¬¬
(captcha: darwin.... and guys like this not being at darwinawards.com ¬¬)
Admin
captcha: onomatopoeia ... the disease those people suffer from
Admin
Heh, here in Mexico we use the Metric System ... and dots for decimal separation. I prefer dots for separation, but it is basically because that's how I was thought to do.
Oh yeah, and the metric system rules!! At least I don't have to learn wacky unit equivalencies (12 inches are a feet? huh?) Everything in the metric system is ... well... metric. (Base 10).
Admin
Maybe you need to look here: http://en.wikipedia.org/wiki/Arabic_numerals#Evolution_of_symbols
I should have been more percise - Arabic-Indic numerals in what's used in everyday's life in all 22 Arab countries.
Admin
Are you trying to make sense here? You completely missed the joke about the band 'Europe' and made yourself look like a jingoistic moron. I think you'd fit in well with the American attitutde you purport to detest.
That's Australia.
Admin
Maybe you need to look here: http://en.wikipedia.org/wiki/Arabic_numerals#Evolution_of_symbols
I should have been more percise - Arabic-Indic numerals in what's used in everyday's life in all 22 Arab countries.
That being said - you can see clearly in this image http://www.datacal.com/products/arabic-keyboards_l.htm that the dot cannot be used as a separator in Arabic-Indic numerals since it is really the zero number.
Admin
That always makes me laugh.
Admin
The real WTF is that your using ITunes! blah blah
Admin
Where's the WTF here? This is the only locale-safe way to write a range comparison. What if there's this little nation somewhere, where < is used instead of > and viceversa?
Oh, and before someone jumps up the gun and calls me a moron: http://en.wikipedia.org/wiki/Sarcasm
Admin
It's even worse when one country changes to DST and the other one doesn't. Then you get some really interesting threading issues.
Admin
The religious nuts the English pushed off Plymouth docks, went to America. Where else do they worship a Turkey?
Admin
The parent poster will kindly note that we did NOT take Benjamin Franklin's suggestion of the wild turkey as our national emblem.
Admin
Absolutely! Here in Finland I always sing 80's hits when I pay the groceries with, yes, dollars and cents, not euros. Just today when I was at the local store where they sell food and "Final Countdown" cd's I decided to sing "I just died in you arms tonight" between dollars and cents. Good thing there was a comma between them. If it were a period, I'd go bonkers.
Admin
There are lots of reasons not to use the Metric system, the first of which being that there's too many units that no one actually uses. For example, the decimeter. No one actually uses the decimeter. It's there, of course, because it has to be there, but nobody uses it. Common usage is millimeter, centimeter (although I see 0.3cm and the like all the time), the meter, and the kilometer.
When was the last time you saw something listed in megameters? You just don't--which leads to a lot of confusion on the part of people trying to convert to metric. ("Why are there all these names I have to learn but will never, ever use?")
And, when you get right down to it, what's so weird about making a unit of length based on any arbitrary thing you happen to like? After all, the original definition of the meter was 1/10,000,000 of the distance from the equator to the north pole through Paris (through Paris!). That's right, ladies and germs, the unit of straight-line measurement was determined as 1/10,000,000 of a particular arc! (Those wacky French!)
Now it's a bit better defined (distance travelled by light in a perfect vacuum in 1/c seconds), but it's still arbitrary.
Learning the Imperial system isn't that difficult, either--really little more difficult than learning an alphabet. Since I have training in the sciences, I know both the Imperial and Metric systems--which I believe, under your qualifications, means I have a brain. Maybe more of a brain than you Metric-only goons.
It could happen.
Admin
//s
Admin
lol. (joke mode on) oh, yeah. We in Europe so boringly sticked to the IS measuring system, measuring length in meters and kilometers instead of the more fuzzy inches, yards, miles; measuring capacity in litres instead of the unconvertible uk gallons and us gallons... You know leave us a bit of fun in changing your 1.540 ways of measuring things... (/joke mode off)
no flames please :)
Admin
I think you need to include an explaination of why the code in question is a wtf in each case.
knowing c# I can tell that the code should have dimensioned maxValue as decimal and then relied on maxValue.toString() to apply the correct culture settings on output (presumably its written to a page at some point.
But I am often confused by the c and other language ones, so i guess its reasonable that poeple dont get this one.
Admin
I like Joel's writing, but he gets facts wrong. He says Pascal "fixed" C strings by storing the length, but in fact Pascal predated C by 8 years.
Admin
Actually this is common. Consider running a German application on an English operating system. The system locale and the thread locale will not match.
For extra fun, imagine that the German application is using UI components from the OS. If that UI component chooses its string resources based on the OS locale instead of the thread locale, you'll get a language mismatch. I've had to deal with exactly this issue before.
Admin
It's always fun when someone starts to defend the imperial system.
You gave exactly no reason against the metric system and you gave exactly no reason for the imperial system.
The only advantage of the imperial system in countries like the U.S. is that you guys already know it.
Admin
It's always fun when someone starts to defend the imperial system.
You gave exactly no reason against the metric system and you gave exactly no reason for the imperial system.
The only advantage of the imperial system in countries like the U.S. is that you guys already know it.
Admin
Yes, you should have been more precise. The Wikipedia link clearly shows that Hindi 0 doesn't look like a dot and that Hindi 5 does not look like an O. If you had said Arabic-Indic at the very outset, there would have been no argument from me.
captcha: poindexter
Admin
Admin
You can blame MS for this problem with percision. In order to display the numberals in Arabic-Indic, you need to choose Hindi numberals in Windows. If you choose Arabic, you get latin numerals - I was pretty much using the same pattern in this discussion.