- 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
Forty-Two
Admin
--in why.txt- /comment.asp:15 if not comment_id <> 0 then echo "WTF!"
Admin
This is not a comment... NAHT.
Admin
/comment.asp:15 if not comment_id <> 0 then echo !false
Admin
/comment.asp:15 if not comment_id <> abs(0) then echo !false
Admin
I'm not not licking toads.
Admin
why not?
or, in keeping with the double negative in the logic, why not not?
Admin
Admin
I could ask the same thing.
In recently found the following (formatted as is):
Admin
Maybe the answer was in the other 64 bytes.
Admin
" /cart/checkout.asp:15 if not contact_id <> 0 then " Poignant, man. Very poignant.
"...and crawling on the planet's face... some insects called the human race... lost in time... lost in space... and meaning..."
-- Furry cows moo and decompress.
Admin
Neophytes. Clearly they forgot to declare constants for TRUE and FALSE.
Admin
So the WTF of the day is that somebody once wrote a double negative? What about the rest of this guy's code? Is this really substantial?
Admin
This appears to be the result of a find-in-files operation, listing the file, line-number and the line containing the text searched for (possibly "contact_id"?)
Admin
not not not FileNotFound. brilliant!
etc
something about my captcha being relevant at a stretch even though it isn't.
etc
Ok think I have covered it all. No need for you to post that "witty" comment now.
Admin
Aah, yes, I see it!
The correct form would be: if isTrue(not contact_id <> 0) then
Admin
Admin
Oh, c'mon Alex, that was the funniest comment of this motley bunch!
Admin
Admin
Ok, that doesn't bother me as bad... I used to have a habit of things such as: public $inactive; with checks such as if(!$inactive)... which is worse than if(is_true()) { } else { ... } especially if the true condition could be filled in soon. Still not the prettiest, but could be worse
Admin
I actually worked with a guy once who used and advocated the following design pattern:
"for readability".Always wondered how his brain was wired inside, that made him think this was more "readable".
Admin
That looks like COBOL. Better syntax:
!Y
Admin
[quote user="Wyrd"]" /cart/checkout.asp:15 if not contact_id <> 0 then " Poignant, man. Very poignant.
"...and crawling on the planet's face... some insects called the human race... lost in time... lost in space... and meaning..."
Or should I say Dr Von not contact_id...
Admin
That line is an artifact of using grep an misdirecting the output into a file by mistake
Admin
Why ?
Admin
Ours is not to question why, ours is but to code and die.
Admin
Admin
Admin
I think you mean "Not no need for you not to post that not unwitty comment now."
Admin
Admin
Admin
A nice example of Muphry's law there.
Admin
This is not a wtf. It's a koan written by a zen monk. In words: If something is not nothing, then there is nothing.
My brain has sure reached Nirvana after reading it...
Admin
Sometimes (like sombodys example above about !$inactive), it's more intuitive to have a "double negative" (I ain't not talking about no English double negatives, I mean logical: NOT NOT).
But mentally parsing a series of NOT's is hard, that's why I really loved the ruby statement 'unless' wich is essentially an 'if not' but it somehow makes it less taxing on the brain. What I don't like so much about it is that you can't say:
Of course when you need both cases I should reverse it and use an if statement anywy.... but why not?Admin
I see that sort of thing all the time. Originally there was actually something to DO if there was 'some text' (not just if there wasn't) and then there wasn't anymore, and it was easier to just delete that logic and move on than to actually change the terms of the conditional.
Admin
Because it would have cost too much, done too much and the code probably wouldn't have been any easier to maintain and/or the maintenance costs would have been extortionate.
Commented code doesn't make it good code, it just makes it commented.
End Function // This is the end of the function.
^ I see that all the time. Good code should need very VERY sparse commenting, and only when there's a piece of specific business logic that could cause confusion should it be used, such as:
// This is the default <<system>> rounding. return Convert.ToDecimal(Math.Round(Math.Abs(_investmentValue), 2, MidpointRounding.AwayFromZero));
Because they didn't know any better and didn't review the code, this is more a problem with management and the development process than the coder (as usual).
You came in today because they need you to fix the code. If the code worked and was easy to maintain, you'd be out of a job. You should be THANKING the original developer, not cursing them.
As for TRWTF, was that line still in checkout.asp? Did he not realise it was grep output? TRWTF is that we didn't find out what TRWTF was.
Admin
I'm not following. NOT NOT cancels itself out. Might as well say NOT NOT NOT NOT, or NOT NOT NOT NOT NOT NOT. It's all the same, and it all means "True" or "Yes" or "Equals" or whatever you're failing to negate. That's a basic rule of logic: you can add a double negative to any true proposition and not change its truth value at all.
As for "unless", that's actually the sort of thing that makes me homicidal about Ruby. Over and over again they make the decision that it is easier to learn a special piece of syntax than to use a basic construction that exists in almost every programming language.
Admin
beyond the mind the answers wrought why "not why?" and not "why not?" a "geez" illogical find a carefully designed blind spot the file sheds light on oblivion's plot
Admin
You missed the point. It's not like saying:
if (!!someCondition)
He's saying:
if (!inactive)
That's essentially a double negative to humans which is pretty easy to parse.
Also, if you can't understand unless... well it's not like the language forces you to use it. Just turn:
unless ($inactive)
into
if (!$inactive)
and voila.
Admin
I see Alex is still refusing to bury that horrible stillborn neologism of his. What was it, "develop me suction", or something dumb like that?
Admin
Insufficiently Flexible. How about:
if eqBoolean(not contact_id <> 0, TRUE)
?
Admin
Hrm, I've worked on contact-ID dialling and I don't not hate it!
Admin
Admin
Indeed. I find nothing surprising (save perhaps the filename). Even that can probably be explained (other than the .txt bit - although this bloke may not be a UNIX natural). A frustrated programmer debugging might use all sorts of names for temporary files (and this is, after all what this was intended to be, one would think) - "Why" would be quite a natural filename to use when you are getting frustrated that you can't find why your program is misbehaving and you grep for (quite probably also) contact_id to see whether it is being modified elsewhere.
Many people redirect output of grep to a file in case there is a lot - presumably person in question was seeing strange behaviour with the double negative, and was searching for the line to analyse it (and found it too, by the looks).
The only WTF I can see is that someone found it was absolutely baffled by iut, submitted it to TDWTF and had it posted.....
(Of course I may have missed something bleedingly obvious - like the double negative that that this poor chap missed, which clearly caused him {or her} all that grief....)
Admin
Nice.
Admin
What's more, this file has highlighted the problem that presumably the submitter was looking for - the problem with contact_id can be found in the file
at line 15.... I think the question 'why' has been quite successfully answered....I have to agree, the WTF is more with the submitter (and some of the people above :P ) I would say....
Admin
Why (!(not not))...!
Admin
Careful. It is usually true that double negatives "cancel out", but not always. The Howard-Curry isomorphism theorem shows that a computer program can be identified with a "constructive" proof. Double negatives being equivalent to the no-negative version of an expression is NOT in general true for a constructive proof, and specific cases must be proven as such.
Back to slashdot with thee. ;-)
Admin
"Well, uhh, I don’t know where he’s NOT. It wouldn’t be inaccurate to assume that I couldn’t exactly not say that it is or isn’t almost partially incorrect."
"So you do know where he is?"
"On the contrary. I possibly more or less not definitely rejected the idea in no way with any amount of uncertainty that I undeniably do or do not know where he shouldn’t probably be. If that indeed wasn’t where he isn’t. Even if he wasn’t where I knew he was…"
Admin
Ok, I know we should not make fun of students code, but I just have to share that line one of the students I tutored turned in:
if (not_done != false)
it actually took me a while to figure out what he tried to do.. then I took him aside and told him friendly to never ever do anything like this again.