| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Page 5 | Next » |
|
The biggest WTF is of course that a space was added after the {. This means the JSON was created manually, instead of using one of the myriad available functions to do exactly that.
|
|
By all natural laws of computing, a weakly typed language like javascript should have been extinct the minute it came out of the door.
|
Re: JavaScript JSON Parsing
2011-12-22 09:10
•
by
Lolozaurus
(unregistered)
|
Yeah, because in other languages you can't manually parse a (non)standard response string. And this is what strong/weak types are all about, isn't, mr Logic ? |
|
This code smells worse that a Lemnian Woman.
|
|
Yeah, because using eval() is widely recommended... *cough*
|
|
The real WTF is that it's the shortest day of the year, north of the 50th parallel, right in the middle of winter, and I'm sitting here with the window wide open, sweating like a Pee Eye Jee ...
|
|
TRWTF is using "/{2}" in a RegExp to find "//".
W{1}T{1}F{1} |
Re: JavaScript JSON Parsing
2011-12-22 09:26
•
by
Kh3pra
(unregistered)
|
why? |
|
I pity the poor, maligned space character. It is generally treated as insignificant in a world of otherwise significant characters.
I salute you, little friend! |
|
Yay, Esperanto mentioned on thedailywtf!
As JoMo says, "Lernu Esperanton nun!" Captcha: valetudo (everything goes) |
Re: JavaScript JSON Parsing
2011-12-22 09:34
•
by
vt_mruhlin
(unregistered)
|
I'm not sure you can jump to that conclusion. Suppose you want to dump the JSON string into a log file in a readable format before responding. You'd want to encode the original JSON blob in pretty format, with newlines and indentation. But when it comes time to go over the wire, you want to minify it, and maybe your minifier isn't perfect. |
Re: JavaScript JSON Parsing
2011-12-22 09:34
•
by
Anonymoose
(unregistered)
|
|
In JSON parsing, it's okay, however almost all modern browsers (Chrome 7?+ Safari 5+ FF 4+ Opera 10.50+ IE9+) all expose a global JSON object that has "stringify" and "parse" methods.
You're supposed to do a couple of quick/dirty regex's to verify integrity but those are for old browsers only. It's okay to use eval in this context or to just use the function constructor with return (i.e. (new Function("return "+JSONDATA)() ) |
Re: JavaScript JSON Parsing
2011-12-22 09:35
•
by
PedanticCurmudgeon
|
TRWTF is that you're posting here on your day off. |
(actually, it's the 1st day of Winter) Be grateful... you could be North of the 50th parallel on the vernal equinox (1st day of spring), with the window frozen shut and afraid that if you go out side an important part of your body might freeze and snap off. |
|
TRWTF is the claim that “no one's really heard of ASN.1”
|
Re: JavaScript JSON Parsing
2011-12-22 09:51
•
by
Thomas
(unregistered)
|
No, it might as well mean that they decided to use a different library, the lib was updated, or a config parameter was changed. |
|
The real WTF is no "Frist". What's with you guys?
|
|
Come on people: the real WTF is Javascript.
|
|
TRWTF is of course:
"No data interchange format is perfect. ASN.1 (Abstract Syntax Notation One) is probably the closest (it's by far the most flexible and comprehensive)" ASN.1 close to perfect? |
|
TRWTF is the idea that ASN.1 is the perfect data interchange format. Firstly, it's binary, and being textual is important. But secondly, ASN.1 parsers have a history of nasty buffer overflows. Perhaps this was partly down to the implementation languages, but it doesn't suggest that it's an easy-to-parse format...
|
I live smack dab on the 60th, and neither the winter solstice nor the vernal equinox bother me much. |
|
TRWTF is praising ASN.1. ASN.1 is the most needlessly convoluted "standard" data exchange format ever created.
You know how the SQL "standard" is so big that there are absolutely zero fully conforming implementations? ASN.1 is the same thing. Besides its complexity, it also dictates worthless small details but leaves big issues unresolved. The only possible way someone could implement ASN.1 without losing his sanity is implementing only enough to interact with whatever legacy system that uses it then stop immediately when it starts to "barely work" (that's the best you can achieve with ASN.1 anyway). |
|
It depends if this really is a WTF, or simply a small bug in a regex. If this were the only line of JSON that my entire application would ever encounter, I'd might be tempted to avoid adding a dependency to a JSON parser and just use a regex to parse it as well. If the application has to deal with JSON all over the place, however, use a JSON library instead.
|
|
"JSON (JavaScript Object Notation) has been gaining favor"
That's the understatement of the day. From my experience, at least. XML has a huge overhead, on documents large and small, and is less readable than JSON (not that human readability was actually a design consideration). Also, "TRWTF is Javascript?" What language were you planning on using for your client side browser scripting again? I mean, it's not my field. I work on server-side, and I don't particularly like Java, but it's hardly a WTF to work with it, especially in this context. |
Re: JavaScript JSON Parsing
2011-12-22 10:18
•
by
No one
(unregistered)
|
|
I haven't heard of it... not really |
Doesn't that depend on the encoding rules used? |
Re: JavaScript JSON Parsing
2011-12-22 10:19
•
by
No one
(unregistered)
|
I haven't heard of it... not really. |
Re: JavaScript JSON Parsing
2011-12-22 10:19
•
by
imgx64
(unregistered)
|
CoffeeScript? Dash? Java/GWT? Sure, they all compile to JavaScript behind the scenes, but by that reasoning, all programming languages are the same as assembly. |
Re: JavaScript JSON Parsing
2011-12-22 10:24
•
by
Don
(unregistered)
|
TRWTF is spelling out the letter "G" using a "J". |
Re: JavaScript JSON Parsing
2011-12-22 10:39
•
by
Nag-Geoff
(unregistered)
|
|
Yeah, curry does that to me too!
|
Anyone want to open a book on how many people will explain the difference between JS and Java? |
Re: JavaScript JSON Parsing
2011-12-22 10:51
•
by
lesle
(unregistered)
|
Cross Quarter, Solstice and Equinox dates & times (cearth's position relative to seasonal cusps) http://www.archaeoastronomy.com/myclock.shtml |
Re: JavaScript JSON Parsing
2011-12-22 10:53
•
by
Jerry
(unregistered)
|
He thought he saw a female. |
Re: JavaScript JSON Parsing
2011-12-22 10:53
•
by
Dogbrags
(unregistered)
|
DO a google search for the whitespace language. In whitespace, a space character is a first-class citizen. |
Re: JavaScript JSON Parsing
2011-12-22 10:57
•
by
Ralph
(unregistered)
|
High speed automatic weaponry, aimed at anyone who thinks they deserve to take control of my computer. |
Not sure if trolling or stupid. If not trolling, then I'll assume by your statement that you don't run ANY software not written by anyone other than yourself. |
Re: JavaScript JSON Parsing
2011-12-22 11:06
•
by
Greased Up Monkey
(unregistered)
|
Chrome has Extensions. Mozilla Firefox has the Greasemonkey Plug-In Both allow you to write Javascript that will be run on pages you specify. Between this an No Script, you can assert 100% control over every bit of client side browser scripting that runs on your computer. And you don't even need to reload. |
The solstice is midwinter. Winter's only one day long where you live? |
|
Others have said this, but it bears repeating. The part of this that had me smacking my head in disbelief is the claim that ASN.1 is anywere near perfect.
|
Re: JavaScript JSON Parsing
2011-12-22 11:29
•
by
TrailerParkJihad
|
^ and my water came out of my face-breathing holes, you owe me a dry shirt. |
|
The real "The real WTF" is the redirect url: "http://initrode-global.com/auth/login.do?cmd=auth-success"
What does it matter if the javascript breaks some day? You can just type in that url yourself. |
Re: JavaScript JSON Parsing
2011-12-22 11:36
•
by
Bobby Tables
(unregistered)
|
Not sure if troll, or just stupid. But the winter solstice is the 1st day of winter. http://en.wikipedia.org/wiki/Winter_solstice |
Re: JavaScript JSON Parsing
2011-12-22 11:36
•
by
Ralph
(unregistered)
|
So you're asserting that software written by professional developers employed by reputable vendors, or peer-reviewed by established distribution mechanisms, installed and configured by an administrator after ensuring current backups, has the same threat model as software automatically loaded and run in real time, written by amateur anonymous random asshats half a world away? Now let's discuss who's stupid, since you seem to consider that a productive way to frame a debate. |
That WHOOOSH sound... can you hear it? |
Re: JavaScript JSON Parsing
2011-12-22 11:38
•
by
Ricky
(unregistered)
|
No, no! What is it? A jet? Superman? |
You are, if you believe that all locally installed software falls in the "reputable" category, and that all web software falls in the "amateur" category. You also seem to be assuming a corporate IT environment, for some gonzo reason. |
Re: JavaScript JSON Parsing
2011-12-22 11:42
•
by
TrailerParkJihad
|
Except he didn't say "all locally installed software is reputable" or that "all web software is amateur", those are conclusions you extrapolated on your own, and are in no way even alluded to in what he said. So no, it's still you. |
Re: JavaScript JSON Parsing
2011-12-22 11:46
•
by
Kempeth
(unregistered)
|
Nope. Can you? |
Re: JavaScript JSON Parsing
2011-12-22 11:50
•
by
TheCPUWizard
|
You have heard of ASN.1..... therefore you are really no one! <grin> [A healyth and happy holiday season to all!] |
Re: JavaScript JSON Parsing
2011-12-22 11:50
•
by
Please - no more variables/functions names foo and bar
(unregistered)
|
|
To quote a book by O'Reilly or regular expressions...
A programmer is trying to solve a problem. She says, "I know, I will use regular expressions.". Now she has two problems. |
| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Page 5 | Next » |