- 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
Now you just have to pray that a failed connection or some other problem returns something other than a null string...
TRRWTF of Lovecraftian proportions is mixing Unix commands and SMB mounts... oh the horror!
Admin
Admin
TRWTF is OSes where you can't change the localization easily.
Run in your preferred locale normally, and when you need to do what either of you described, just "LC_ALL=C my_command". And I'm sure for those keyboard-allergic ones, there's also some clicky-click way to do the same.
Admin
Admin
ls -l foobar.cfg | awk '{print "found the config file!";}'
Then you'll get "found the config file!" if the file has been found, and the ls error msg in case it hasn't.
In the given scenario, you would put "found the config file!" into a string which you can then use in assembling the shell command and also when you check for the result.
Admin
Admin
Because you're English and never set the locale?
Admin
The system command here is SSH, which will return 0 if it connects, no matter what the status of the remote command. Two options: 1- Use File.Exists(), or 2- Copy the file every time
TRWTF: 50 people trying to find a workaround for this code disaster.
Admin
And looking at the various proposed solutions and the flaws pointed out in them, it seems to be an exercise well worth undertaking! :-)
Admin
But isn't this a bit of "requirements defining the implementation"?
The requirement is to check if the config file exists. No reason for that to say implementation must use a shell command.
Admin
Addendum (2013-05-13 10:28): Hmm. OK, I looked at the output of various things on this:
ls itself localises based on the value of $LANG. Cool.
When ls is given a name that doesn't exist, its error message is written in English. All the time.
Back in the day, IBM tools that ran on PCs always used to prefix any error message with a message-specific code (and Visual C++ still does, whence all those C#### error codes...). The justification for this is that while the text of the message is locale-dependent, the code is not. If your compiler / other tool gets itself in a twiddle about the desired language, you can still look for familiar error codes, and you can write detection scripts that parse out the code to find out what happened. If ls / perror printed their messages with such a code, the WTF could be mitigated slightly, because the error code for "No such file or directory" would be an invariant.
Doing it that way is still a WTF, but less so than we originally thought.
Admin
Admin
Admin
Lorne please never write an article again. Thanks
Admin
Admin
Admin
Admin
dick troll is dick
Admin
That was terribly written. Someone needs to pick up a copy of the elements of style and learn the difference between writing for a technical audience and creative writing.
Admin
Admin
Unfortunately the parts of Bill 101 which would involve you being put in stocks and forced to wear a sign that said "ANGLOPHONE" around your neck while passing school children pelt you with manure were overruled by those weasels in the Supreme Court who are obviously trying to destroy Québécois culture.
Admin
The file is on a local machine. But is it accessed as the same user? SSH is one way to get an authenticated connection to a different user. If they use a "control socket" (RTFM ssh), new connections are almost as cheap as running a new local process.
In shell programming, the equivalent of File.Exists() is test -e.
Admin
As the victim of a rather liberal policy on what names are acceptable to pass as the DHCP hostname option, I can tell you that having that assumption violated causes all kinds of interesting behaviors on a wide variety of systems in a wide variety of locations.
It's especially Interesting when the DNS servers have decided to cache that wrong information for several hours after the offending sysadmin has been corrected. And more Interesting when the aforementioned sysadmin has distributed VM images containing this tweak to many users. (Lather, rinse, repeat until the DNS admins get a clue)
Admin
public void ConfigFileExistsOrCreate() { String result = null; remoteCon = SSHConnection("localhost"); faultString = remoteCon.sendCmd("ls -l /random_foo_bar/BlobConfig.Config"); result = remoteCon.sendCmd("ls -l %BlobProfileDirectory%/BlobConfig.Config");
}
Admin
Nah - English is ahead of Esperanto by more than a billion speakers. Plus, in spite of all the letters in use in Europe at the time, Zamenhof had to make up two more that aren't on my keyboard.
b.t.w. For an amusing look at machine translation, paste that exact phrase into google translate. :)
Admin
Admin
The Daily WTF: the Memento edition.
Admin
TRWTF is that this is the most readable Lorne Kates article so far.
Admin
That would be too easy.
Also, this article gave me a headache. Isn't it the code that should do this, and not the writing style?
Admin
Admin
Admin
(Thanks and don't worry)
Admin
For more language fun, when I lived over there, I bought a computer (with Japanese keyboard layout) and installed the US version of WinXP on it. Since I had the US operating system installed, my computer was happy to assume that the keyboard was using the US layout. Not a problem for me since I touch type and thus never actually look at the keyboard anyway, but it was rather confusing to anyone else who tried to use my computer and wondered why the punctuation marks they typed didn't match up to the ones printed on the keyboard.
Admin
I think Esperanto is a lot less kludgy than English. :)
Admin
haha WTF.
Admin
TRWTF is the French definition of "genius":
[image]Admin
Admin
TRWTF are native English speakers that think their language should be the one and only language, just because "our economy is better, we have more nukes and we rulez!"
Prepotent a-holes. For most of them, it might come as a surprise that such "worldwide English importance" dates from very recent times (WWII). Before that and for a long time, it was shudder ... French.
If the point is speaking a single, very simple language that most people can learn with little to no trouble, let's start speaking Esperanto!
Admin
Admin
English über alles!
Admin
You are right! I think we should all use the most spoken language in the world by far! It's the best for everyone.
So now everyone forgets their silly language and speak Chinese!
Seriously, I have seen many chauvinists, but never something so arrogant (and wrong) than English-speaking persons on this subject...
If we want to speak a universal language (Better late than never), we should really avoid ALL natural languages (French, Chinese, English...) beceause they ALL have a stupid grammar with a lot of exceptions. Every new regular language have a grammar more logical, simple and easy to learn.
And most important: They are neutral for everyone. Nearly nobody would want to speak the language of another country, because it would sound like being invaded by them and the sacrifice of a vast part of their culture.
Admin
Awesome. That read like a .net stack trace. Kuddos.
Admin
No, this is typical FUD from the English minority in Quebec. The Quebec government does not prevent people from using an application (or OS) if it's not available in French.
What happens is that if a company is owned by the Quebec government or wants to become a service provider to the Quebec government they have to obtain a certification from the French language protection agency (OQLF) that states that the company has made reasonable efforts to provide its end users with a French computing environment BY DEFAULT (servers are not considered) and that for products that are not available in French the vendor has been informed of the issue (which does not prevent the company from using the product).
For companies that do not provide services to the government the only requirement is that if they put up a sign outside a French version of the text has to be present and has to be at least the same size as any other language on the sign (typically English).
This is done to avoid recreating a situation like Montreal in the 1970s where the majority of the population was speaking French but all the signs and ads were in English to cater to preferences of the wealthy English minority or American tourists.
To this day, 80% of Quebec citizens speak French and while the English minority is often making a lot of noise and FUD they have access to all public services in the language of their choice, which is not the case for most of the French Canadians in the rest of Canada.
Admin
Admin
The people of BC like to have AB as a buffer zone between themselves and the crazy easterners, so far as I can tell.
Admin
Languages, etc...
Remember, the only languages that count are those with an army behind them.
Esperanto, and Ebonics need not apply.
Admin
Why don't we stop using all software until it's all re-written in Haskell?
Admin
Funny that BC people talk about "crazy easterners" given that there are maybe 11 non-asian people left in BC.
Admin
Try using one of the those pesky US keyboards when the OS language is set to proper-English (pretty much an essential in the UK as the £ symbol is missing on Yank keyboards) - that doesn't half confuse people (the missing Alt-Gr (needed for €) and weird return key simply add to the confusion)
Admin
don't forget the lack of import words from tonal languages and having none in your own.
captcha: cogo - the sum of cogito and ergo