- 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
Smaller-than and greater-than operators? Who needs those?!
TRWTF is only half-working syntax highlighting.
Admin
Or nots. I assume this is Javascript - I wonder what would happen to the rest of the code if I used a five digit year?
Admin
FTFA
Admin
I wonder how an exception called
CodeUnreachableException
is supposed to be used...Admin
I'd normally describe throwing
CodeUnreachableException
as a form of assertion failure.Discourse Bug: Here I am, looking at the vertical-position misindicator and the text above the reply box. I am replying to post 5, you know, with the vertical position misindicated as 3 of 3.
Discourse Bug: What's with one star around a chunk of text being italic? Who the fuck thought that was a good idea? Can I have him shot?
Admin
Admin
You're making my head hurt. Or maybe that's just the PHP talking. I've seen placement students do much, much worse though.
Admin
Of course, you could use type hinting since version 5.<CBA to google it> in which case it should be fine.
Then again... Unicode...
Filed under: Look ma, I broke Discurse again!
Admin
What's the world coming to when a guy can't craft a contrived example of PHP's lack of transitivity in its non-typesafe equality operator without facing the Spanish inquisition?
Admin
This is TDWTF. Welcome to die.
Admin
Simple:
Admin
Filed under: oops wrong thread
Admin
That gives me an idea: We could translate php to lojban!
Nah, actually, just do the British version: http://www.addedbytes.com/blog/if-php-were-british/
Hey! Translate Go to lojban. Maybe @ben_lubar could start the project.
Admin
Admin
What do you suppose CheckKey() would do with 0xAC?
And actually that's an interesting consideration for programming language specific syntax, since different languages do non-decimal numbers differently. See http://en.wikipedia.org/wiki/Hexadecimal
dave (who used to tell people his age in Hex, until earlier this year when he turned 3A...)
Admin
Did the same until 1A hit. Sigh.
Admin
No, I don't remember which film it was, but I do remember the cinema - the one that (in 1987!) was in Shopper's World in Framingham, Mass. (The alert among you will note that I remember where it was but not which chain it was...)
EDIT: It was Shoppers' World, not Shopper's World, although the latter is on the site formerly occupied by the former.
Admin
I can work it out just fine. On my last birthday I turned 40. Now ten more years till 4A. Maybe I can say I turned '@'.
Admin
Used to get that all the time while trying to buy alcohol or cigarettes. One time even as I clearly just walked out of the car, from the driver's seat, with keys in hand (Note: Legal age for everything is 18 here). These days I have a goatee, but if I shaved I'm pretty sure they'd ask me again.
It's not the working out bit, it's messing with people by saying a seemingly lower number. But the letter mess it up, so they either figure it out immediately, or, more frequently, look at you with a blank stare.
Admin
Not that age could reach the number, but say something is 9F years old, it would be 'ninety eff'. What do you call it next year, without confusing it with a number half as much?
Admin
I used to work in a store that sold alcohol and I had someone claim that they'd just turned up to the store in their car, but had no car keys nor any form of driving licence (if they had done so, they would at least have the credit-card sized driving licence in Europe which they should have had on them)
Admin
I am sad that fewer people are posting here and everyone must be discoursing.
Admin
I've been to Framingham many times, don't think it's ever been that boring.
Admin
I had the licence with me. And other forms of ID. The point is I stopped and exited my car in plain sight of the seller (it was a news stand on a parking lot basically).
That, and I bought stuff there almost daily.
Admin
Admin
Yeah, that's not smart, unless they didn't see you or know you...
Admin
I had a friend who got carded well after 0X28. One day a bouncer said, "If you're 40, I'm buying!". He flipped his government (Civil Service) ID on the counter, and started ordering top shelf stuff.
And I remember Shoppers World when it had that kinda modernist/flying saucer look to it.
dave
Admin
No-one expects the Spanish inquisition. Or something along those lines ;)
Admin
Suck it, @blakeyrat.
Admin
When people ask my age I tell them I recently celebrated the 22nd anniversary of my 21st birthday.
Admin
21 with lots of experience?
Admin
AAAAAA oh. AAA Aaa aaa oh. ;-)
Admin
Hmm, 34th anniversary of my 21st birthday, 30th anniversary of my 25th birthday, 25th anniversary of my 30th birthday. No, none of them sound good.
Filed under: I'm old.
Admin
0x16th anniversary of your 0x21st birthday.
FTFY
Admin
That if statement in the last piece of code made my head implode. In future, no TDWTF before coffee in the morning.
Admin
This would bring me back to PHP after all these years. Quick, someone create an Imperial C++ Preprocessor to counteract!
Admin
I don't think so. The code does not show an alert for year 02014. Only people who lived in early mediaeval era might object to it.
Admin
You could use the third sample in today's article.
Admin
I was curious about what exactly the condition was here:
If ! takes precedence over - which takes precedence over == and < which take precedence over || (these rules are used in JS, not sure about what language this was) -- then this simplifies to:
And with de Morgan's law:
So its testing if an index has looped all the way through an array which is 3 or more elements. Basically "if it's the last one and the list is long enough, clear the background color." Is that what was intended? I have no idea.
Admin
Check for example April May June (which in this case is not the name of a person!).
More than 50% of the articles had about 100 comments or more. In June all the articles plagued with disaster had only half of that, most of them only 30 comments or less.
In July the disdain caused readers to flee the site.
Did nobody tell Jeff Atwood that dis has negative connotations?
Which, in the case of discourse, means it's aptly named.
Admin
Admin
Admin
Admin
No. That's stupid. "Things that shouldn't ever happen" are fatal errors: things that result in your code blowing up and failing miserably. There is nothing wrong with taking exception to bad data that a user has input. That is what exceptions are designed for: things that shouldn't happen if everything is done correctly, but which can be caught and recovered from without causing the user any undue stress.
TRWTF would be if your "my user is an idiot and entered bad input" exception causes your program to crash and burn (or display some obscure error message that doesn't tell the user what he did wrong).
Admin
True, although I don't think Framingham has changed much in 30 years. I tended to spend more time next door in Natick.
Admin
Re that numeric-format-validation code -- to be perfectly honest, that's almost exactly how I'd do it. Every time I've tried to "roll my own," I've ended up in a hideous tangle of trying to anticipate all the possible ways of writing a "number" -- "d" or "d.dd" or "0.dd" or ".dd" or "{any of those}{e or E}dd" or who knows what-all else. Why go through all that head-and-heartache when the OS or RTL writers already did all that, years ago? The only tricks then are to find the right function, and find out how to distinguish success from failure. Since most of the world seems still to derive from C/Unix conventions established in the 1960s, it's not uncommon for a string-to-number conversion function to return 0 as its error value; I guess you're supposed to be able to just know that the string you passed "wasn't zero, at least," even if you don't know what else it might have been. Clearly, the only reliable way for the conversion function to return "failure" is by taking action that can't possibly be misinterpreted as a valid number. One way would be to make the function take a second argument, by reference (hence writable-for-return), that acted as a flag for whatever error conditions were discovered in the bowels of the conversion algorithm -- but when has there ever existed a string-to-integer conversion function with such a forethoughtful signature? None that I've ever seen! The best behavior I have seen is -- you guessed it -- for the conversion function to throw an exception when conversion fails. Then the code that calls the conversion function can handle the exception and take appropriate action (such as coloring the input field, at the cost only of calling the conversion function every time the field content changes, which used to be considered expensive back in the good ol' days) based on clearly unambiguous knowledge of whether the string was, or was not, "a number."
As to the nature of the exception, I can even understand using "UnreachableException." You would want something that couldn't easily be confused with any other exception, and maybe you don't know about (or there aren't, in your framework/platform of enforced choice) numeric-conversion-specific exceptions. I personally have had a HELL of a time getting OS/RTL-provided exceptions to work at all; rarely is there any documentation of what header file has to be included, or how to throw or catch them, or what arguments their constructors take, or what information can be extracted from them once caught, etc. etc. etc. About the only thing you CAN do is throw something as bland and generic, but unique, as you possibly can, and do your best to recognize it when it comes.
In short, I see absolutely nothing wrong with the conversion function that's being ridiculed here.