- 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
Admin
What disturbs me is the parameter name: "datas". Since "data" is already the plural of "datum", what is datas? Some kind of fourth dimensional measurement?
Admin
Come on guys... I suspect most of the syntax stuff re Ben's solution stems from annonymization (just guessing here, but Jake is not a Java programmer, so some inconsistencies might have crept in?)
Admin
Alex, have you hired TopCod3r?
Admin
As a computer programmer, trained to write code, it pisses me off when EEs are writing code. I pull out resistors and start getting all stabby with them.
Admin
Admin
Admin
If you have a form that collects user data and a form that collects financial data, then you must be collecting datas.
Admin
I actually have a B.S in Software Engineering. It pisses me off that now anyone that codes is called a "Software Engineer" when they have no training in engineering princepals. My job for the last few years is to take an organic developer-loved application and turn it into a engineered product by using methodical development processes and keeping track of the project using metrics.
If your trying to build hardware than a EE degree is probably a good idea, but your wasting time if you want to build software, you would be better off with regular CS, Software Engineering, or Systems Engineering.
I've thought about going back to school to get my masters in either Systems Engineering or Industrial Engineering have any of you WTFers' gone this route?
Admin
+1
No reason to have a finally block if you're just parsing a string. I guess a good rule of thumb is, if your finally block is empty, your finally block is unnecessary.
Admin
It drives me nuts to see someone use a try-catch to figure out if a string is formatted correctly before parsing.
I can't remember how many times i've have to modify people's code from:
try { DateTime parasedDate = DateTime.Parse(someString); } catch { return null; // Or Give some specific message }
To:
DateTime parsedDate; if(! DateTime.TryParse(someString, out parsedDate)) { return null; // Or Give some specific message }
Try the TryParse. It's you efficent friend.
Admin
I agree with some of the points in the discussion, but however, when it comes to parsing only in one locale, there might be a good reason for it. For example, if you have many devices deployed in the field, and they always generated english xml files, you can still use your english xml files while having an international friendly visual interface. I'm not saying I condone the no error checking, etc, but there is actually several cases I can think of to force parsing in one locale.
Admin
[quote user="anon"][quote user="PAG"]Computers run on electricity, so anyone who is an electrical engineer should understand how computers work.[/quote]
Yah, they're called COMPUTER engineers. Not all electrical engineers work on computers. DOH!
Admin
I agree. I've run into some serious problems with not even local-specific but time zone specific data. The programmer before me on a project wanted to display some times relative to the client, so he took the time from the client vs. using the server's time or sticking to GMT for db storage.
Which was fine untill people started to show up to events hours before or after they started, then there was no way to programatically figure out the correct timezone for events already in the system.
Not to mention that the "Time" field in the DB was a nvarchar with values such as 3:00, 3pm, 3:00 PM, 12 noon, midnight, etc.
Admin
Admin
WTF are 'princepals'?
Admin
Yes, and before toilet paper was invented, using grass was a typical way of wiping your ass.
Admin
We were talking about the times where an (idiot) developer looks at a warning, doesn't know what it means, and then suppresses it away into the cornfield, then wonders why months later the code mysteriously fails.
Duh.
Admin
Try parsing the fact that this is Java, not C#.
:)
Admin
and social, and economic, and foreign policy relations, and etc etc etc etc <ad naseum>
Admin
The WTF would be any self respecting C/C++ introducing an unnecessary local variable to avoid a valid use case for goto. goto is not evil, it can just be used to do evil things.
Admin
The guy probably has some sort of latin background.
Admin
I offer as the citation the election results of 2004.
Admin
Admin
Hallelujah. In the mean time use JODA.
And the given solution is shit.
Some general points:
Admin
There is a reason that warnings are warnings and not errors. You admit yourself that there are cases when warnings should legitimately be suppressed, and yet in the next breath you go back to your inane generalization that they should all be treated as errors (unless you're not "professional"). You sound like a middle manager somewhere enforcing a company policy.
Admin
Admin
Nothing wrong with that - if you're trying a bunch of formats (sort of dodgy to begin with), you expect a fair number of parse exceptions. If we're going to return the first hit, though, just return from the inner loop.
Admin
Justification? Sure - warnings are usually errors, so treat them as such until proven otherwise. The fact that you can't deal with the concept of a rule of thumb and need in spelled out explicitly implies that you're sort of deficient on the soft side of things.
Admin
Honestly, sometimes this kind of problem is a documentation problem. It might be that DateFormat.parse() is well documented -- but someone wanting to create a Date is looking in the Date class. If the Date class documentation (especially the deprecated Date(string) constructor) contains a comment to look at DateFormat.parse(), and DateFormat.parse() contains suitable sample code, then chances are that this kind of code doesn't get written.
Although in this case, the documentation actually does the right thing, so this particular WTF is still WTF-worthy :-)
Admin
Just do a literature search. Most good literature books on how to write good software (including that classic, "Writing Solid Code") recommends to treat warnings as errors, and only when you can't write warning-free code (but you've convinced yourself that the warning is unavoidable) should you suppress it in that particular instance.
Admin
Ah, yes, the infamous Y2K/M2K/D2K problem (or Y2K/D2K/M2K as it was known in some parts of the world)
Admin
TryParse did not exist in .NET 1.1 and earlier. I'd love to use TryParse but we still haven't upgraded here.
Of course, TryParse basically just wraps your parse call in a try/catch, meaning you're still paying the exception cost, you just don't ever see it.
--Benanov
Admin
Actually, you're incorrect. TryParse does not wrap Parse in a try/catch block. The reverse is actually the case. DateTime.Parse wraps DateTime.TryParse with a check to see if the parse failed, throwing if the TryParse failed.
Admin
I second that. As Einstein said, "Everything should be made as simple as possible, but not simpler."
Admin
Have you never heard of SpectateSwamp?
Admin
If you're doing some revenue-generating operation, why would you throw out the whole thing if you retrieved the information you want, but with a warning? Sorry, you're wrong, professionals don't treat all warnings as errors. They log all warnings, and then handle specific warnings on a case-by-case basis, depending on whether it's a show-stopping situation. And then they make a business decision on whether previously unencountered warning situations should break the entire operation, or if they too should simply be logged. Then, they monitor the logs, especially during the test and beta phases. That's what professionals do. They don't naively throw out any and every result because there was a non-critical warning.
Admin
Seriously. That's got to be TRWTF of today.
Admin
I know a couple of EEs and a chemist or two, as well, who can not only program but can actually compose a grammatically correct sentence.
Sheesh.
Admin
Give the kid a break. Why do you need to create a date format object every time the method is called? I guess your code has it's own WTF, but I have to say, I really appreciate the fact that you showed your fix. Most are afraid of doing that and I understand why - their code probably has ten times more WTFs than the original.
Captcha: transverbero Aare we still posting captchas?
Admin
Friends of the son of a monarch. DUUUUUUUUH......
Admin
no no no no. This is obviously a Star Trek: The Next Generation reference! Remember the time that Data tried to interface directly with the Enterprise computer systems and then Worf and Troi get stuck in the Holodeck and all the bad guys look like Data? (Oh come on, don't act like you don't. You know exactly what I'm talking about.) That episode was titled "A Fistful of Datas."
Come on, I know I'm not the only one who had that episode pop into their head when they saw "datas." Right? ...right?
Admin
Collecting Datas sound very borgish, even tough I just know of a single Data. But maybe I'm wrong.
Admin
Revenue generating compile cycles? What are you on and where can I get some?
Admin
This is java - you probably create one DF per format (that's what the class is for) the first time, then reference them on subsequent calls.
Admin
Admin
Have you ever considered that some people might not be native English speakers? Does the fact that someone types "your" instead of "you're" change the logic of their statement in any way? If you can't figure out what someone means because of a few simple mistakes, you need some flexibility in your way of thinking and shit-loads of common sense. I'm sure you're an awful and lonely person because it must be incredibly difficult for someone to be near you as you keep correcting everything they say and you always pay attention to the contents of their message instead of the actual meaning. Regarding your "friends" (sorry, but imaginary ones don't count, so we need the quotes around that word) I'd like to say that if something is possible it's not also necessary. I don't need a degree in English to be able to do my job properly. I'm a fat and lazy programmer which means that you MUST also become like that, just because it's possible. Forget everything else that you're doing, throw your children in the trash can, eat your dog and kill your spouse with a corkscrew so that they can leave you alone enough time to become fat and lazy. Some people actually have something better to do than just get another degree so they can bitch to everyone about how lame their English sk1llz0rz are. I'm sure that word hurt you. I'm sure it hurt bad and you will feel it for the rest of your life.
We don't have a language compiler and I really don't see why everyone MUST be able to type perfect English in order to stop being considered The Idiot of The Universe by some dumb ass nazi. </troll>
Sorry about this, but a bit of rant is necessary from time to time, in order to put people back in their cages and make them remember what this place is all about - turning the worst mistakes in the world in something a bit more pleasurable by having a few laughs with other peoples from around the world. (The last one was intentional because I know that to language-obsessed freaks it REALLY hurts to read that word typed like that)
Admin
Well, clearly you are NOT an engineer...
Br,Mike5
Admin
TRWTF is that "deprecation" is the correct spelling.
Admin
But that's the only time left you GET to use a GOTO in C++. When those situations come up, I happily embrace my GOTO friend to solve the problem.