• Ouch! (unregistered)

    So their database is an ASCII text file? Run, Forest, run!

  • blabla (unregistered)

    1st?

  • blabla (unregistered) in reply to blabla

    ehm, not really :)

  • Calm Mint (unregistered)

    This type of WTF is so common we need a new name for it.

    Since "XML" stands for Extensible Markup Language, let us consider what's going on here. First, it is not a Language, because they are parsing column positions as if it were an old-school COBOL record. Second, it is not Markup, because the markup is being completely ignored. And most obviously it is not Extensible.

    So after we cross out the things it's not, we're left with "---". Kinda like C++, but headed in the opposite direction. Or maybe "XXX", as in, children under 18 should not be allowed to see this stuff lest it permanently traumatize and scar their impressionable minds.

  • Bri (unregistered)

    It's an "optimization." Much faster to read by data position than to parse.

  • DOA (cs)

    From: JT Klopcic To: HR

    It has become necessary to contact the programmer that is responsible for project xyz. Due to the nature of this project it is imperative that I have his home address as opposed to merely a phone number or an email.

    On a separate note, I'd like to ask whether it would be ok if I borrowed a knife from the kitchen.

    Thank you

  • Ouch! (unregistered) in reply to blabla
    blabla:
    1st?
    <schadenfreude> And I don't even participate in the frost pist game:D </schadenfreude>
  • i_am_socket (unregistered)

    That's some double-plus-wtf?!

  • Cas (unregistered)

    Oh, no - the horror. I got about half way through, then realised what was going on.

    The worst thing?

    I did this once.

    Then I realised, ripped it up and reimplemented it using XML DOM.

  • JayC (unregistered) in reply to DOA
    DOA:
    From: JT Klopcic To: HR

    It has become necessary to contact the programmer that is responsible for project xyz. Due to the nature of this project it is imperative that I have his home address as opposed to merely a phone number or an email.

    On a separate note, I'd like to ask whether it would be ok if I borrowed a knife from the kitchen.

    Thank you

    Nonextensible Markup Language, obviously

  • y0da (unregistered) in reply to Bri
    Comment held for moderation.
  • Dan (unregistered)

    It's not even a WTF. It's an FTW. Fire-That-Wannabe.

  • Major Math (unregistered) in reply to Bri
    Bri:
    It's an "optimization." Much faster to read by data position than to parse.
    And since the cost of the 13 trillion CPU cycles he saved will be eaten up in the first 10 seconds of developer time fixing this, the "optimization" is rated F for classic Fail.
  • Satanicpuppy (cs) in reply to Bri
    Bri:
    It's an "optimization." Much faster to read by data position than to parse.

    Depending on the sort of system that is being used, the data may actually be STORED by data position. Old school databases used to do it that way, where the "record" would have a length of say, 500 characters. And field_1 would be 0->10, field_2 would be 11->16, etc.

  • JayC (unregistered) in reply to JayC
    JayC:
    DOA:
    From: JT Klopcic To: HR

    It has become necessary to contact the programmer that is responsible for project xyz. Due to the nature of this project it is imperative that I have his home address as opposed to merely a phone number or an email.

    On a separate note, I'd like to ask whether it would be ok if I borrowed a knife from the kitchen.

    Thank you

    Nonextensible Markup Language, obviously

    I err...replied to the wrong message, obviously.

  • Major Math (unregistered) in reply to Satanicpuppy
    Satanicpuppy:
    Bri:
    It's an "optimization." Much faster to read by data position than to parse.

    Depending on the sort of system that is being used, the data may actually be STORED by data position. Old school databases used to do it that way, where the "record" would have a length of say, 500 characters. And field_1 would be 0->10, field_2 would be 11->16, etc.

    Maybe you missed the article:
    he took a look at the import file. Thankfully, it was all well-formed XML,
  • Kermos (cs) in reply to JayC
    JayC:
    JayC:
    DOA:
    From: JT Klopcic To: HR

    It has become necessary to contact the programmer that is responsible for project xyz. Due to the nature of this project it is imperative that I have his home address as opposed to merely a phone number or an email.

    On a separate note, I'd like to ask whether it would be ok if I borrowed a knife from the kitchen.

    Thank you

    Nonextensible Markup Language, obviously

    I err...replied to the wrong message, obviously.

    Using a non-extensible comment system, obviously.

  • snoofle (cs)
                                 M E M O
    
    Subject:   The XML Parser
    To:        Development Staff
    From:      The Developer of the Parser
    Effective: Forevermore
    
    I have implemented a highly optimzed XML parser to read in 
    our XML-formatted data. Because of the optimizations, it is
    absolutely imperative that you do not EVER run a formatter
    on the data files!
    
    Thank you for your cooperation.
    
  • snoofle (cs) in reply to Kermos
    Kermos:
    JayC:
    JayC:
    DOA:
    From: JT Klopcic To: HR

    It has become necessary to contact the programmer that is responsible for project xyz. Due to the nature of this project it is imperative that I have his home address as opposed to merely a phone number or an email.

    On a separate note, I'd like to ask whether it would be ok if I borrowed a knife from the kitchen.

    Thank you

    Let's focus on what's important: I miss the Irish Girl!

    Nonextensible Markup Language, obviously

    I err...replied to the wrong message, obviously.

    Using a non-extensible comment system, obviously.

    Let's focus on what's important: bring back the Irish Girl, obviously!

  • Code Dependent (cs) in reply to i_am_socket
    i_am_socket:
    That's some double-plus-wtf?!
    oHeader.FixWTF = Convert.ToDouble(m_Textline.IndexOf("WTF???", 0, 6));
  • Code Dependent (cs) in reply to JayC
    JayC:
    Nonextensible Markup Language, obviously
    Nonsensical Markup Language
  • MRAB (unregistered) in reply to Calm Mint
    Calm Mint:
    This type of WTF is so common we need a new name for it.

    Since "XML" stands for Extensible Markup Language, let us consider what's going on here. First, it is not a Language, because they are parsing column positions as if it were an old-school COBOL record. Second, it is not Markup, because the markup is being completely ignored. And most obviously it is not Extensible.

    So after we cross out the things it's not, we're left with "---". Kinda like C++, but headed in the opposite direction. Or maybe "XXX", as in, children under 18 should not be allowed to see this stuff lest it permanently traumatize and scar their impressionable minds.

    So it's a Non-extensible Non-markup Non-language? That's "NNN".

  • fw (unregistered) in reply to Dan
    Dan:
    It's not even a WTF. It's an FTW. Fire-That-Wannabe.

    W*nker more like

  • Brady Kelly (unregistered) in reply to Ouch!
    Ouch!:
    blabla:
    1st?
    <schadenfreude> And I don't even participate in the frost pist game:D </schadenfreude>
    It's the display of doubt that cost him/her first place.
  • ubersoldat (cs)

    Hahahaha... I love the name on those methods! fixABC? WTF? Uh! And method function names that start with a caps, great!

  • Brady Kelly (unregistered) in reply to Satanicpuppy
    Satanicpuppy:
    Bri:
    It's an "optimization." Much faster to read by data position than to parse.

    Depending on the sort of system that is being used, the data may actually be STORED by data position. Old school databases used to do it that way, where the "record" would have a length of say, 500 characters. And field_1 would be 0->10, field_2 would be 11->16, etc.

    Now there's an award worthy observation.

  • Anon (unregistered)

    Well, at least it doesn't look like it'd be too hard to replace it with something that uses the XML classes provided by the .NET library.

  • Anon (unregistered) in reply to ubersoldat
    ubersoldat:
    And method function names that start with a caps, great!

    Yes, that's the standard in .NET. This is not Java.

  • AdT (unregistered) in reply to Calm Mint

    And then their precious database was destroyed by xmllint --format...

    Calm Mint:
    This type of WTF is so common we need a new name for it.

    What about "ughstensibility"?

  • Code Dependent (cs) in reply to AdT
    AdT:
    And then their precious database was destroyed by xmllint --format...
    Calm Mint:
    This type of WTF is so common we need a new name for it.

    What about "ughstensibility"?

    ...or "ecchstensibility"...

  • @Deprecated (unregistered) in reply to Ouch!

    The REAL WTF is that the coder checks to see if line 2 was properly read, but line one is magically assigned to m_Textline somehow.

    Yes, that is far worse than reading columns from an XML file...

    Oh never mind.

  • SR (unregistered) in reply to snoofle
    snoofle:
                                 M E M O
    

    Subject: The XML Parser To: Development Staff From: The Developer of the Parser Effective: Forevermore

    I have implemented a highly optimzed XML parser to read in our XML-formatted data. Because of the optimizations, it is absolutely imperative that you do not EVER run a formatter on the data files!

    Thank you for your cooperation.

    :oD

    Yikes!

  • Waratah (unregistered)

    I worked with a programmer that did not want to learn how to use a csv library or an xml library, far easier to write code like this. He was the senior programmer in the area.

    Oh yes and he wrote code like this:

    for( int i = 0; array[i] != 0x20 ) { word[i] = array[i]; }

  • Anon (unregistered) in reply to @Deprecated
    Comment held for moderation.
  • N (unregistered)

    This brings back nightmares from my last contract at a large bank. Their inhouse "dsl" was XML based. Sounds good I thought until I got back string out of bounds exceptions etc. Turns out their "parser" was written pretty much like this.

    When I asked why they didn't use a proper XML parser, they looked at me like I was from space, their architects has said that this was much faster and more efficient. Why not just use a csv file, guess that wouldn't have been cutting edge enough lol

  • Zer0 (unregistered) in reply to DOA
    DOA:
    From: JT Klopcic To: HR

    It has become necessary to contact the programmer that is responsible for project xyz. Due to the nature of this project it is imperative that I have his home address as opposed to merely a phone number or an email.

    On a separate note, I'd like to ask whether it would be ok if I borrowed a knife from the kitchen.

    Thank you

    100% WIN. I need to save this as a template, would save me a lot of time.

  • Anonymous Coward (unregistered) in reply to MRAB

    Quite clearly, this method is reading Positions Of Stream, hence POS. Or perhaps POS Of Stream, for a recursive acronym.

  • kastein (cs) in reply to Waratah
    Waratah:
    I worked with a programmer that did not want to learn how to use a csv library or an xml library, far easier to write code like this. He was the senior programmer in the area.

    Oh yes and he wrote code like this:

    for( int i = 0; array[i] != 0x20 ) { word[i] = array[i]; }

    He had something against loop variable incrementing?

  • OzPeter (cs) in reply to fw
    fw:
    Dan:
    It's not even a WTF. It's an FTW. Fire-That-Wannabe.

    W*nker more like

    WTF? who did you think you were going to offend by leaving out the "a"? And given a choice of 5 potential vowels to insert, how stupid do you think people have to be to not find the correct vowel?

  • AdT (unregistered) in reply to kastein
    kastein:
    He had something against loop variable incrementing?

    It's overused anyway. ;)

    I used to write code like this:

    for (pInput = pInputBuffer, pOutput = pOutputBuffer, szRemainingBytes = szBytesToCopy;
         szRemainingBytes; *pOutput++ = *pInput++, --szRemainingBytes);

    until a University tutor pointed out that for loops were invented to make code more readable.

  • configurator (unregistered) in reply to kastein
    kastein:
    Waratah:
    I worked with a programmer that did not want to learn how to use a csv library or an xml library, far easier to write code like this. He was the senior programmer in the area.

    Oh yes and he wrote code like this:

    for( int i = 0; array[i] != 0x20 ) { word[i] = array[i]; }

    He had something against loop variable incrementing?
    No, he just likes infinite loops better.

  • Code Dependent (cs) in reply to OzPeter
    OzPeter:
    fw:
    Dan:
    It's not even a WTF. It's an FTW. Fire-That-Wannabe.
    W*nker more like
    WTF? who did you think you were going to offend by leaving out the "a"? And given a choice of 5 potential vowels to insert, how stupid do you think people have to be to not find the correct vowel?
    Willy Wanker and the chocol... erm... uh... eewww, nevermind.
  • AnotherAnonymous (unregistered) in reply to Code Dependent

    I nominate "insensibility".

  • Charles Babbage (unregistered) in reply to OzPeter

    Winker?

  • Anon (unregistered) in reply to OzPeter
    OzPeter:
    fw:
    Dan:
    It's not even a WTF. It's an FTW. Fire-That-Wannabe.

    W*nker more like

    WTF? who did you think you were going to offend by leaving out the "a"? And given a choice of 5 potential vowels to insert, how stupid do you think people have to be to not find the correct vowel?

    Um, regex much? A '*' matches the preceding character zero or more times. Maybe something like [aeiou] would match your 5 vowel constraint requirement.

  • erat (unregistered) in reply to AdT
    AdT:
    kastein:
    He had something against loop variable incrementing?

    It's overused anyway. ;)

    I used to write code like this:

    for (pInput = pInputBuffer, pOutput = pOutputBuffer, szRemainingBytes = szBytesToCopy;
         szRemainingBytes; *pOutput++ = *pInput++, --szRemainingBytes);

    until a University tutor pointed out that for loops were invented to make code more readable.

    I did those things to my tutors just to see how badly they could fail me sometimes. ;) Most of the time I just got a chuckle and a pat on the shoulder. But one of them almost turned white, and then bright red and I seriously thought he'd pop an eye or something when he saw it. :) then I showed him my serious code. I think he kindof had it in for me from that point. ;) Code was sacred to him. Best teacher I ever had though.

  • el_chavo (unregistered)

    That's not XML data... that's data with an XML overhead! Those "tags" are just comments, lol

  • lolwtf (cs) in reply to OzPeter

    "<comment>WTF!?</comment>".substr(9, 5)

    OzPeter:
    fw:
    Dan:
    It's not even a WTF. It's an FTW. Fire-That-Wannabe.

    W*nker more like

    WTF? who did you think you were going to offend by leaving out the "a"? And given a choice of 5 potential vowels to insert, how stupid do you think people have to be to not find the correct vowel?

    I'm sure he meant winker. Someone who winks.

  • RogerC (cs) in reply to AdT
    AdT:
    kastein:
    He had something against loop variable incrementing?

    It's overused anyway. ;)

    I used to write code like this:

    for (pInput = pInputBuffer, pOutput = pOutputBuffer, szRemainingBytes = szBytesToCopy;
         szRemainingBytes; *pOutput++ = *pInput++, --szRemainingBytes);

    until a University tutor pointed out that for loops were invented to make code more readable.

    Do you have something against memcpy?

  • Thief^ (cs) in reply to RogerC
    RogerC:
    AdT:
    kastein:
    He had something against loop variable incrementing?

    It's overused anyway. ;)

    I used to write code like this:

    for (pInput = pInputBuffer, pOutput = pOutputBuffer, szRemainingBytes = szBytesToCopy;
         szRemainingBytes; *pOutput++ = *pInput++, --szRemainingBytes);

    until a University tutor pointed out that for loops were invented to make code more readable.

    Do you have something against memcpy?

    Especially as memcpy is normally optimized to copy in chunks (e.g. 4 bytes) wherever possible. Though a really good optimiser would be able to replace byte-by-byte copies with a memcpy call.

Leave a comment on “What Could Be Easier Than XML?”

Log In or post as a guest

Replying to comment #:

« Return to Article