- 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
The Real WTF is that someone created an ambiguous prefix for octal notation. If he/she had only chosen '0o'.
Oh the huge manatee.
Admin
element can take %inline;, which is defined as:
Let's check out that %special;: See? Images are allowed inside paragraphs. So aOf course, that's HTML 4.01. Let's check out xhtml:
Here, again, images are allowed in paragraphs.Even in the current draft of HTML 5, images are allowed in paragraphs.
Almost correct... you can use images, and you can include form controls. The form itself would have to begin before the , and end after it, but you can place buttons, input forms, select boxes, or textareas within the span. davidhAdmin
What a breathtakingly dumb idea. (And no, past and recent attempts by Adobe and Microsoft to provide just that do not constitute a persuasive counterargument.)
We already have an environment that gives developers complete control over look and feel - GUI OSes like Windows. The whole damn point of the browser is that the user agent does the rendering. You don't know what browser I run, how large I want it to be, or any of my other preferences; don't try to dictate them.
Very few applications need exacting control over the UI. It's almost always better to use flexible presentation. Developers who have a problem with that are welcome to write grotty native apps. Those of us who are smart enough to write decent HTML, CSS, and Javascript that works properly on reasonably-conformant user agents can do without the noise.
Admin
Ah. Funny how a lot of comments diss on C's behavior with "09" as an octal, fail to realize that atoi("09") will give 9 as a result.
The only place where 09 would be "illegal octal" would be if defined as a constant in the code itself, like:
int i = 09;
which the compiler nicely complains about.
Admin
Inferring that a constant is octal is fine. It comes from C. The WTF is all the languages that pick up the C bits (0 for octal, end strings with NUL, etc) and don't give you any way around them. parseInt isn't needed if you're passing it a constant. The WTF is interpreting a variable starting with 0 as octal.
Admin
I see no reason to care what browser you run -- although, since I develop for them, I'm forced to test on a ridiculous number of the things, because compliance to the "standards" is so piss-poor -- and I don't care how large you want it to be (perhaps a resizeable window might help here). As for your other preferences, I'm not a GUI programmer. I just naively assume that you can skin a Windows/Linux/Solaris GUI in pretty much the same way that you can skin a browser via CSS -- although with distinctly more client control over the resultant appearance.
I'm sorry ... what was your point again?
Ah yes. "Reasonably conformant" and "noise." And, indeed, "flexible."Look, we're stuck with this WWW crap. We have to deal with it. This doesn't mean we have to like it. This doesn't mean that we have to plead useless excuses such as "well, it's not really conformant at all, but it's reasonably conformant." (When, otherwise, do you ever use the word "conformant?") This doesn't mean that there aren't "flexible" alternatives. And I'm not even sure what you think "noise" is.
We're stuck with this crap because of Netscape and the original Java team at Sun. Browsers wouldn't be as universal as they are without Netscape. The presentation model wouldn't be as universal as it is without the Java team (who only turned to, ahem, applets, in desperation because otherwise the entire project would have gone down the tubes).
This does not mean that there isn't a better way. It certainly doesn't mean that there wasn't a better way ten years ago.
Admin
"If you guessed 9, you fail"? If you guessed 9, you've been using Javascript for less than 20 minutes. Everybody that writes in Javascript knows about this, it's like posting that "12"+1 is 121 instead of 13.
Admin
Admin
Admin
THIS is a real WTF. If it tries to guess value for a special base (octal) and then it should realize that the base was NOT correctly chosen ! I mean, 8 and 9 make no sense whatsoever in octal ! Translating then 8 and 9 into 0 and 1 is an obvious dead brained error. AT that point the code should think "I was in error, tzhis is not octal, let me try decimal by default" or "oh maybe my guess was wrong, let me throw an exception"...
Admin
An online gambling site I helped to maintain and improve a year ago had this bug too. They just didn't enter the base of the number so when you bet 0900 € on a match you could easily bypass the javascript protection which check if you have enough money. Well, that is a WTF itself but what to say about an application where you can drop the database via the registration form?
Admin
Admin
Admin
That's actually the way Python 3 does it :). And 011 == 11, not 9. There's also a binary prefix (0b1010).
Admin
And Adobe and it's product is yet another WTF
Admin
Only Lotus Notes users can think that JS is not a WTF. They must believe that finally something works better than their crap.
Admin
I think I'll stop ranting now.
Admin
This clearly shows that JS was developed by script kiddies but certainly not serious programmers who could think ahead and a with some standards. But no, it had to be the most illogic behavior there can be.
Admin
Admin
My bank had this same problem in BillPay, their web bill payment system. When I pointed out the problem and the solution to them, they thanked me, and refunded that month's BillPay fee (~$5).
Admin
Any decent javascript validator will/should give a big honking warning when calling parseInt() without a radix parameter. So the real WTF is ignoring the warnings :)
Admin
Seconded. If the writer doesn't know that a zero at the beginning of a number means octal in a lot of C-like languages, he should really study harder. The fact that JavaScript doesn't throw an error does kinda suck, but... seriously. This is actually how a lot of string-to-number functions work - they parse as far as they can and then just give up. The C atoi function does this, for example. parseInt('abc') also returns 0. Is this a WTF?
Admin
No, the author of that codes fails, for not researching the functions they are using properly.
I've been using Javascript for years, and have always done:
parseInt("09", 10);
For base 10 numbers.
Admin
Don't you hate it when a language pulls a fast one on you like that? Like that 09+01 != 10... Who would have guessed.
Admin
ah well, a Browser game i played lately had the same problem: entering how many of the ressources you wanted to transpot allowed you to use 0 and 0x as Prefix so entering you anted to transport 01000 Iron only put 512 in the transporter... Unfortunately is was not exploitable because of sanity checks ("no, 0x1000 is larger than 1000, sorry"), but it showed until you pressed "send" that it would transport 4096 then :)
Admin
I ran into this back in 2006, while I was deployed. The interface I developed let the user, if they wanted the current month and year, just type the day number. "Whaddya mean, 08 JUN 2006 isn't a valid date?!?!"
Admin
Now, pray explain exactly how this is a counter-argument to my main point, which is that the illegitimate spawn of the devil (browsers) are not obviously more customisable or more user-friendly than their illegitimate step-sisteers (desktop GUIs).
Admin
Look, I'm all for accessibility. I'm short-sighted, growing old, acquiring presbyoptery and, to make matters worse, have a family history of glaucoma.
The fact that this "medium" is quickly becoming the centre of our society is, frankly, beside the point. It is a crap medium. It is a badly-designed medium. It is rapidly acquiring so much cruft that your position is probably self-defeating. I'd love to know how the magic of WWW assists the visually-impaired with Ajax, or Flash, or any one of the innumerable plug-ins that are being thrown out to address the design deficiencies of the original "medium."
And yes. You have yet to see a way to turn a Windows-style (by which I assume you mean a Xerox-Parc style) GUI into a decently usable plain text representation. The reason that HTML documents support that is that their renderes are extraordinarily, almost brain-defyingly, clever and can parse the document as an AST.
I really don't know how they do it. And, to address your issue, I really don't know why Microsoft haven't done it, either.
Fact remains, the "medium" is still distinctly below par in technical terms (and don't forget the 95% of people who aren't visually impaired), and as far as I can see is rapidly sinking under its own grotesque weight.
Admin
If no one's noticed so far, the month property of the Date object is calculated on a zero-base. That behavior is expected. It's a attempt to ape Java in JS, I've heard.
Admin
Or simply use +"09". But parseInt with a radix is my preferred way.
The poster is the WTF. This is a case of RTFM.
Admin
Incorrect.
always treats the string argument as a decimal number, regardless of leading zeros.However,
does do some funny things.http://java.sun.com/javase/6/docs/api/java/lang/Integer.html
Admin
No, NaN means something different than "I can't decide what's the number in that string". You get NaN from floating-point arithmetic such as dividing 0 by 0.
Admin
There is only one date format. ISO.
Everything else is wrong.
Admin
Agreed!
http://en.wikipedia.org/wiki/ISO_8601
Admin
Confusing Air with Flex is very common and it's starting to upset me.
Admin
actually, a better way to display divs side by side is to use
or something like that (IE6, Op7). The second thing is to make it work in FF.
Admin
I was working on date widget in C++ some time ago and learned the same "quirk" in C, luckily before the code left my desk. Just try: int month = 0; sscanf("09", "%i", &month); I do not blame the language, though. I should have learned difference between %i and %d years ago.
Admin
Addendum (2008-04-29 09:13): Oh, and the inline-block setting doesn't work in IE6 either. Back to the drawing board, I feel...
Admin
Thank you, Javascript
Thavascript
Admin
The problem isn't that JavaScript uses the 0 prefix to define octal numbers, its that it fails silently. Most languages that I can think of use that behavior (so this is hardly an exception to the standard), and most developers will probably get burned by it at some point. But it becomes easy to deal with when it fails with a syntax error. "09" should evaluate to an error or exception, not 0.
Admin
Incorrect.
is not an integer literal. is, and it should evaluate to the decimal value 11 (unless my math sucks today, which it very well might).Admin
Use something like JsLint - it alerts you if you use parseInt without any base parameter.
Admin
Technically it's 125% increase ( + needs shift key )
Admin
Oh JavaScript how I love thee...
Radix "guessing"... why does it guess?? it should default to 10 and then you put the radix if you want it to find a hex or oct number.
Months indexed from 0... WTF!! Days and years are not indexed from 0 so why are months... consistency would be nice
These 2 JS "design choices" account for a large portion of JS date bugs... Both are "silent" as you don't normally get an error from them.
Admin
Admin
I've had this exact problem, writing my own full featured date picker. Luckily, I was able to figure it out within roughly an hour of researching and testing.
Admin
Just came across this the other day when we had a zero padded number in an application but it was telling the users that the number was invalid.
Count the day lost, you don't learn something. Even if it's annoying.
Admin
lol. parseInt("45468 - Bob Jones") wouldn't work then. Which it is DESIGNED to do.
Admin
Just came across this problem and sussed it out after wasting another few hours of my life! Surely the logical function design would have been for the second parameter of parseInt to default to base ten (as the most commonly used) if it isn't explicit in the function call, rather than have the engine try and 'guess' the intended base?
Mind you: logical javascript? What was I thinking of?