- 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
uh, oh, ALex, what have you done...
Admin
Which just goes to show that side discussion, i.e. changing the subject, is not only to be expected; it is to be welcomed. However, I'm not motivated to go tracking down the "comprise" controversy on my own. If some philanthropic soul wants to post a link to the starting post of the discussion, I'll follow that up for the sake of knowing the inside joke.
Admin
Normally in a | delimited list, you can escape any character using a backslash, just like in c (or most other language) strings, you just have to remember that | is also escaped.
The other format which could be better would be an INI format, using the filename as the heading and then having only three restrictions: no = or whitespace in the key, and no unescaped newlines in the value
Admin
Steve should have given them an XML Schema in XSD, XDR or eved DTD format, then they would have known what exactly he wanted, or maybe even just a spec
By just asking for it as "XML" without defining how exactly he wanted the data, he is as culpable as they are for this one...
Admin
He should have asked to get the data as binary, in which case the data would obviously have contained all relevant information.
Admin
Exactly my thoughts. Crap in, crap out.
Without specifications you never know what to design. They probably spent an week creating a xml wrapper on their system, now if they only had provided a schema.
Just asking for stuff and expecting you to be able to read their minds is just silly and the real WTF here..
Admin
Yes, using XML for what is essentially tabular data...
Admin
Admin
I suspect this is exactly what everyone here, probably rightly, dislikes about using XML in situations like this - there is absolutely no need for such formal specifications in this case, XML is just one among many convenient formats for transmitting structured data.
As I've said before, if they really suffered from acute XML-phobia, they should have offered him the information he needed in an alternative format.
Well, we don't know the details, but the article strongly implies that he gave them at least a partial list of additional fields required, none of which were provided.
Nor is there any suggestion that the providers of the data got back to him and asked for clarification - implementing something so monumentally pointless as this without clear confirmation that it is actually required is, quite frankly, inexcusable.
Admin
OK, fair enough, there is more than one way of formatting such data, XML is neither a panacea, nor should it have a monopoly on use as a data format. Maybe in this case it wouldn't have been the best choice - the INI-style sounds fairly appropriate from what we know of the requirements.
But I was responding to this:
By "efficient", I presume the meaning is that you save a lot of bytes with each response; but unless your service is sending large volumes of data, or to large numbers of users, this is really unlikely to be a problem with modern connectivity.
Easier to code? Maybe; depends how you do it, and in what environment; maybe you have some handy XML-parsing functions to hand that will give you back just what you need. Or maybe you have some INI-parsing functions, or a good enough understanding of regular expressions to handle some agreed delimiting and escaping, etc.
As for quicker to parse, the point about volume applies again - processing power is pretty cheap these days - but granted, using a full-fledged XML parser might produce unnecessary overhead. Although there's no reason you can't make a couple of efficient regexes to parse the XML, just like you would any other form of delimiting and escaping...
Quicker to produce, I just don't buy - for simple data like this, you're just going to be doing simple string manipulation whatever format you produce.
Like I say, maybe XML isn't perfect for this application, but it's certainly not an insane suggestion to get the job done if those are the tools you happen to have lying around.
Admin
On the other hand, you're quoting me whilst I'm changing the subject, ie not buggering on and on and on ... well, not about the proper use of the "C" word.
I assume your problem lies with identifying (Spike) Milligan, the man wot wrote the Goon Show, which in turn propelled Peter Sellers to stardom and foreshadowed things like the Pythons.
Spike and Peter were in the habit of phoning up unsuspecting receptionists at the BBC, where they worked, and asking to get in contact with fictitious individuals with unfortunate names. No mobile phones or pagers in the 1950s, so the hapless and innocent receptionist would resort to yelling over the tannoy:
"Is there a Hugh Jarse in the building?"
I imagine you see the point.
Calling oneself "Huge Jarse" is a crime against a comic genius, in my opinion.
Admin
Looking top-down (and not down-up, which most XML enthusiasts seem to do) at this, there are a series of choices to be made:
(1) Same flavour of system at each end (eg C or Java)? Send it as a struct or as serialised data. (2) Different flavours, same platform (eg Windows)? Send it as a zip file, presumably including the JPEG and an ini-style key=value text file. (3) Incomprehensibly different platforms, at least one of which can't, for some reason, generate or accept either the zip format or the ini format ... no, wait, my head just exploded.
(CSV works perfectly well as an alternative to step 2, btw.)
There is no deep structure evident in the requirements here. There is no business-critical need to validate the "document" (how I love it when XMLers misuse this term. In fact, it's difficult to see how you might usefully validate it. XML certainly wouldn't help at the semantic level.) There is no predefined (XML) format with which the supplier must comply. There is no need for future generations to interoperate, globally, with the protocol.
In short, there is no need for XML at all. Period.
Parsing? Parsing? Don't get me started on XML parsing.
The implicit business needs here are X globs of data, where X is between 3 or 4 and infinity. No structure. No tree. No parsing.
The only tool involved is the tool who wrapped the original format in "XML." That tool might well be lying around. Like a number of XML tools I could name, however, he should be shot in the head and not encouraged to produce abortions like the OP.
Admin
Arguably, all data formats are "serialised data"; that's kind of the point. But yeah, if you're using the same system both ends, use something nicely integrated with that system.
Woah, there! What? Who mentionned anything about ZIP files with images in them?
But XML, for some reason, doesn't; I don't get it.
Oh yeah, I forgot, you can dump an INI-file into memory and instantly access it as a data-structure in your program. No, no need to parse it at all!
We're talking a small stream of data, which needs some agreed, very simple, formatting. A simple XML format - no validation, no fancy definitions, just using key="value", wrapping items in '<type' and '/>', and escaping the handful of characters you've then "reserved" - is pretty much as good as anything else, and you might just happen to have pre-written functions to read and write it. Why does it have to be a big deal?
Admin
All religious headgear is exempt from the "no wearing hats inside" rule of etiquette.
I have no idea how thinking about the case when the "hat" is a yarmulke is supposed to call attention to the "someone you don't know" bit.
Admin
Admin
"Parsing" CSV requires little more than the standard C runtime library. (Wrappers would be nice, but not necessary on a tiny little problem like this.)
Parsing an XML document requires something more heavyweight, and depends upon a third-party library. (Like the C runtime library ain't third-party; I know, I know ...)
I don't disagree that XML would work in this case. I don't see the point of it, but then I don't see the point of translating the text into Pushtun and back. Heck, do whatever plugs the void for you.
I think we'd both agree that the choice of format is a bit of a side-show. Hell, I hate XML, but I've put in bids on a couple of projects to use it. (Maybe if I'd won one of them, I'd love the gnarly little bugger.)
But, three weeks to produce something that could quite literally be done by prepending 18 characters and appending another 3? This is not a requirements issue. This is not a design issue. This is not a parsing issue. This is purely ... <ta-daaah!> a Worse Than Failure issue.
Sorry, I forgot that modern processors are optimised to dump an XML document into memory and instantly access it as a data-structure in your program. My bad.Admin
Calling anybody a nazi, irrespective of race or creed, is exceptionally offensive and in my opinion suggests brain damage of the variety that requires a lobotomy. My mention of specific Jewish headgear was intended as a gentle prod to indicate that, since you don't know who you are gratuitously associating with the Third Reich, you might accidentally be causing somebody real pain and anguish.
The comment to which I replied mentioned hats. Had it mentioned pants/trousers, I could equally well have used lederhosen as an exemplar. Not too many Germans like being called nazis, either.
I assume that you ain't American, because I've never met one who would find it "offensive" to be called a communist. Either (unlikely) they are one, or they'd just find it funny and then break your nose, just to carry on the joke.
Anyway ... what were we talking about?
Admin
Sure, like I say, as long as you don't need any escaping, you're just splitting on ',', or '|', or whatever. As soon as you've got escaping, or quoting and escaping, you're into a few lines of string manipulation, or regexes, or some such.
Why? It's still just string manipulation. You're still just splitting on delimiters and replacing escapes.
Again, wrappers and external libraries might be handy, but you don't need them for "a tiny little problem like this". You've just got to get the data out.
Just because you're sending something in XML format doesn't mean you have to use 5 namespaces, 6 DTDs, and 7 XSLT templates. It's just a format FFS!
Oh, absolutely, I'm not defending the WTF in any way, only XML. And I'm not defending those who claim it as some kind of magic bullet, which somehow solves all problems and supercedes all data formats ever, either, by the way. People make some really stupid claims about XML, and do some really stupid things with it; but at the end of the day, it's a convenient way of presenting a bit of data as a string of characters.
That was a response to your comment about "No structure. No tree. No parsing." I probably misunderstood, but you made it sound like XML needed parsing, but your suggestion (an INI-file) would somehow parse itself.Admin
/p604332/happy.jpg,25462,120,60,I am happy, at least sometimes
Admin
Is the WTF that they're using JPG instead of PNG? ;)
How complete is PNG support in browsers? I know all the current versions can handle it, but at some point IE did not. The last time I worked on a site I was specifically told not to use PNGs. Were they being too cautious?
Admin
While I do love the INI format for trivial tasks, it feels a little bit limited. It has no inherent support for nested or repeating structure. I don't think there's any support for line breaks in the text values either.
XML makes structure a lot more natural, but my complaint about XML is mostly that there are too many ways to structure the tags. Would you write this:
or
or even this?
And why? INI files are even more of a make-up-your-own-format when it comes to finding ways to specify structure. For example, you'd end up with nonsense like:
Without formal structure, you get horribly verbose section names according to your own made-up rules of how to represent structure.
The advantage, to me, of XML is that it just works. It's popular, widely supported and gives you structure automatically in a way that all tools will read. No made-up formats. But if we could replace it with something a little bit more terse, and a little less haphazard in how you're to use it, that would be fine!
Admin
BTW, if we all petitioned Alex, do you think he'd fix his shitty BBCode to HTML conversion? Previewing code tags at a URL not included in my user CSS ruleset reminded me that all code on this site is double-spaced, and code tags, like quote tags, get excessive linespace. The real WTF is replacing Community Server for something that does a worse job than what it replaced :P updates CSS ruleset to include preview pages
Admin
In all fairness - the problem here is that he asked for an XML format.
If he'd asked for the extra information, but not asked for the XML, he might actually have got what he wanted.
And no that does not explain what he got back - but its true :p
Admin
That German version is soo wrong. It is a WTF for itself. I am German but to me the idea of translating error boxes and source code comments is the most ridiculous idea I have come across ever. Please shut this site down for good.
(Captcha is "ewww")
Admin
IE had no alpha transparency support for PNGs until version 7; there were other problems too, but if you use palette-transparency, like with a GIF, it looks basically fine on IE 4 and up. See http://www.libpng.org/pub/png/pngapbr.html for details. [There are also horrible ActiveX workarounds to let you use alpha transparency in IE 5 & 6.]
Of course, if you're only using features also available in GIF, there's not much point - or not since the GIF patents expired, eliminating the legal advantage.
Admin
It appears you missed this in the original post:
A few weeks later they'd come up with this? And you count that as "progress"? You must work for a real true enterprise operation.
Admin
I imagine that this happened:
Team-A developer to Team-B Boss: I would like to have more information about the pictures, such as title, size, tags, and other product information. Maybe you could return this information somehow? In a XML document, maybe?
Team-B boss: I will see what I can do.
Later:
Team-B boss to Team-B developer: They want this to be returned in XML.
Team-B developer: WTF?
boss: this is what they asked. They want this to be returned in XML.
developer: this makes no sense.
boss: just do it.
developer: (mumbles)
Admin
No, the real WTF is continually bitching about the software someone else decided to use for their website. Don't like it? Don't visit the site. Want to visit the site? Quit your bitching.
Besides, Alex wrote the software in question. It seems to work rather well IMO, and is definitely better than any of your work I've seen. :-)
Admin
I don't think that the XML should be considered such a bad idea, when used correctly - it provides a lot of functionality.
Example:
Admin
All I'm saying is that Steve requested data that he 1) definately already has; or 2) can easily acquire (image size). Even asking the vendor meet this request means that Steve is probably on the same level (or worse) as those who "filled" it.
Admin
Usually, maybe. But maybe Steve knew that in this particular case there were nice captions he could use, because he'd seen them in other uses of the same data? Or maybe he was trying to ask if there were?
No, barring the communication problem suggested by Eduardo Habkost suggested above (which actually seems quite plausible) the "spec" was a request for extra information about each image; there is no extra information being returned here. If there was no extra information to give, the correct answer is "sorry, we don't have any information other than what we already give you".
Like I say, a communications screw-up seems pretty likely to me - Steve's request, as relayed, made no sense, and no request for clarification filtered back to him. However badly he worded his request, the biggest WTF in that case is still that they went ahead and implemented it anyway!
Admin
Has anybody considered the possibility that they might be having lots of fun laughing their asses of at how well they pranked the guy who wanted the data in XML?
Captcha: paint - haven't used that in ages.