$check = FALSE; while ($check==FALSE) { $this->TWO_set = rand ( 1, 4); if ($this->ONE_set < 5 ) { if ($this->TWO_set != $this->ONE_set) { $check=TRUE; } } else { if ($this->ONE_set < 9 ) { if ($this->TWO_set != ($this->ONE_set-4)) { $check=TRUE; } } else { if (($this->TWO_set == 2) & ($this->TWO_set == 3)) { $check=TRUE; } if (($this->ONE_set == 9) & ($this->TWO_set != 1)) { $check=TRUE; } if (($this->ONE_set == 10) & ($this->TWO_set != 4)){ $check=TRUE; } } } }
labelElement.onmouseout = function(){ LabelMouseOutHandler(this); }; [...] function LabelMouseOutHandler(object){ var obj = $("#"+object.id); if(obj.hasClass( "hover")){ obj.removeClass('hover'); } }
/* This is a method <--- JESUS * * @returns {type} <--- eh. can be passed as being lazy... */
Creamy Goodness wrote: » believe it or not, there's programmers out there that have and will never come across localisation :eek:
DublinWriter wrote: » "But if you know the values, then you can try writing case condition on the dataitem.. like when '120' then 'one hundred twenty'"
lil_lisa wrote: » That hurts my brain...
Maximus Alexander wrote: » But, like, it's not wrong. :pac:
NeutralHandle wrote: » It would increase how much the computer has to do to compare strings significantly, and it would not always be desirable behaviour from a functional point of view. If you want to do case-neutral string comparison just use something like this: string1.ToUpper().Equals(string2.ToUpper)
awec wrote: » Don't use ToUpper to get rid of casing issues. This will break functionality in some locales like Turkish (the Turkish "i" problem). There is probably a way to do it properly in Java. In .NET you'd tell it to use the Invariant Culture, and to compare case-insensitive you'd do an Ordinal Ignore Case comparison.
croo wrote: » That's interesting, I'd not heard of the Turkish "i" problem. I'm not aware if Java has a culturally aware equals but I've tended towards string.equalsIgnoreCase() myself. From reading the linked api I suspect that it just does an upper or lower case internally so it probably is not much better. Perhaps this is what we're supposed to be using!?
awec wrote: » Yea it's pretty high profile. A lot of people think they can ignore it just because they don't localize their app into Turkish language, but the bug affects the Turkish locale and locale != language. That is why .NET (and presumably java) has two culture properties: 1. CurrentCulture - this is the locale. It dictates things like date format, number format, and character case conversion. 2. CurrentUICulture - this dictates what language the UI appears in. It's perfectly normal for example for someone who is from Germany to want to see the UI in English, but have their calendar format, date format etc in their native German format. This is especially common among developers because English is usually the language of code.
croo wrote: » I found it interesting because I work (well more worked these days I don't make much contributions) on an open source Business Application and while I know there are plenty of English speaking users there are also many many more people using it through German, Spanish & Portuguese (it's popular in Brazil) there are many also using it via non-Latin alphabet based languages (Persian, Thai, some Greek and I did see some screen shots of a Japanese version). Nobody ever raised this issue with me, so I wonder now is it a problem people using other languages just "put up with" or did the non-English speakers just fix the problem and I simply never noticed. I'll have to have a look in the code... when I get a chance.
bpmurray wrote: » The Turkish i is just one of the many problems you'll run into in localization. You mentioned Thai - how do you do word breaks with that? There are no spaces or other indications. That's why you need to assume the worst - all text should be Unicode (preferably UTF-16) inside the program (text in the UI or in files can be something else), always use library functions to move to the next boundary, i.e. character, word, sentence, line, etc., to compare characters and strings, in fact to do anything with text.
bpmurray wrote: » And, of course, there are the real locale items, such as data/time formats, currencies, first day of the week, weekend days, etc.
croo wrote: » Well, in Adempiere's case the UI is all defined in something we call the Application Dictionary rather than in the java code itself. I don't speak Thai myself but I was aware that some have translated the UI
bpmurray wrote: » And never, ever combine pieces of a string to make a phrase: ["there are " + count " cows in the field"] != [count + " cows are in the field"] (assume that they're the ways different languages say the same thing), so you have to use "there are %d cows in the field" so that the string can be changed but retain the usage. Oh, this localization stuff has so many gotchas.
// if you change submit label I'll break your legs => change it on InvoiceController > create_log too ;)
PrzemoF wrote: » It should be in the thread "Genius at work" not "Coding Horror" ;-)
Capt'n Midnight wrote: » I found this on the interwebs. xx: OK, so, our build engineer has left for another company. The dude was literally living inside the terminal. You know, that type of a guy who loves Vim, creates diagrams in Dot and writes wiki-posts in Markdown... If something - anything - requires more than 90 seconds of his time, he writes a script to automate that. xxx: So we're sitting here, looking through his, uhm, "legacy" xxx: You're gonna love this xxx: smack-my-bitch-up.sh - sends a text message "late at work" to his wife (apparently). Automatically picks reasons from an array of strings, randomly. Runs inside a cron-job. The job fires if there are active SSH-sessions on the server after 9pm with his login. xxx: kumar-asshole.sh - scans the inbox for emails from "Kumar" (a DBA at our clients). Looks for keywords like "help", "trouble", "sorry" etc. If keywords are found - the script SSHes into the clients server and rolls back the staging database to the latest backup. Then sends a reply "no worries mate, be careful next time". xxx: hangover.sh - another cron-job that is set to specific dates. Sends automated emails like "not feeling well/gonna work from home" etc. Adds a random "reason" from another predefined array of strings. Fires if there are no interactive sessions on the server at 8:45am. xxx: (and the oscar goes to) ****ingcoffee.sh - this one waits exactly 17 seconds (!), then opens an SSH session to our coffee-machine (we had no frikin idea the coffee machine is on the network, runs linux and has SSHD up and running) and sends some weird gibberish to it. Looks binary. Turns out this thing starts brewing a mid-sized half-caf latte and waits another 24 (!) seconds before pouring it into a cup. The timing is exactly how long it takes to walk to the machine from the dudes desk.
Ant695 wrote: » Saw that on reddit this morning. That guy is a genius. No time wasted at all.
Labarbapostiza wrote: » A slight reverse.....Horror with Coders Me a support role over the phone, getting a bad response from a customer with my baby steps. "...Stop speaking to me like I'm a child.....I have 20 years experience as a network programmer" "...Okay then.....Telnet onto the device" "........Telnet?........Ah, um, what's Tel...How do I do that" I was holding a pen at the time ......And I wanted to drive it through my eyeball and into my skull to end my suffering.
Labarbapostiza wrote: » I have 20 years experience as a network programme