• gman (unregistered)

    the wtf is you don't have to close the connection when using using - that and the funny comment.

  • Augue (unregistered)

    Well, Paul's explanation is incomplete, and this makes it wrong.

    Yes, Excel plays with the "$" in the sheet names.

    No, there is no direct need to remove those "$", because the used computer language provides something like "if" and some string operations that would allow to test for "$"s and react accordigly.

    But if we expect zero or more "$"s at the right place, we can as well remove all currently contained "$"s, how many there might be anyway, and place the correct amount on our own - which allows to adjust the sheet name in one line of code instead a bunch of if-then-else constructs.

  • Nibh (unregistered) in reply to gman
    gman:
    the wtf is you don't have to close the connection when using using - that and the funny comment.

    Removing a file while you still are accessing it will work well for UN*X and Linux, but usually caues trouble under MS Windows.

  • Patrick Chasco (PBC) (unregistered) in reply to Anon

    He's not a programmer anymore. Instead now he rages at our network service providers. It can be rather amusing, though unfortunately they've moved him farther away from people so I don't get to hear it. I think they wanted to reduce collateral damage when he inevitably goes thermonuclear.

  • macmac (unregistered) in reply to Nibh
    Nibh:
    gman:
    the wtf is you don't have to close the connection when using using - that and the funny comment.

    Removing a file while you still are accessing it will work well for UN*X and Linux, but usually caues trouble under MS Windows.

    You have no idea what you are talking about, do you?

  • Randy (unregistered)

    Yeah, it is a well established fact that a certain large and aggressively dominant software company is founded on, composed entirely of, and produces nothing but pure unmitigated evil.

    If you don't know that already, you may have an excuse if you fall into one of these categories:

    1. Innocent child never used computer.
    2. Non technical mind never used anything but one OS.
    3. Technical, but obsessed like an autistic person on the products of a single vendor because once you figured out the option to enable teh shiny on your buttons you thought you were a rock star and stopped learning. Never really designed anything; just snapped together other people's code.
    4. Mental affliction renders you incapable of remembering past abuses and noticing a pattern.
  • Jerry (unregistered) in reply to Nibh
    Nibh:
    Removing a file while you still are accessing it will work well for UN*X and Linux, but usually caues trouble under MS Windows.
    Which is why Windows still has to be rebooted after trivial software patches, something *nix got right oh, what, 3 decades ago now? And Windows still hasn't caught up.
  • Anoldhacker (unregistered) in reply to Randy
    Randy:
    Yeah, it is a well established fact that a certain large and aggressively dominant software company is founded on, composed entirely of, and produces nothing but pure unmitigated evil.

    If you don't know that already, you may have an excuse if you fall into one of these categories:

    1. Innocent child never used computer.
    2. Non technical mind never used anything but one OS.
    3. Technical, but obsessed like an autistic person on the products of a single vendor because once you figured out the option to enable teh shiny on your buttons you thought you were a rock star and stopped learning. Never really designed anything; just snapped together other people's code.
    4. Mental affliction renders you incapable of remembering past abuses and noticing a pattern.

    Thread won. Everyone go home.

  • (cs) in reply to macmac
    macmac:
    Nibh:
    gman:
    the wtf is you don't have to close the connection when using using - that and the funny comment.

    Removing a file while you still are accessing it will work well for UN*X and Linux, but usually caues trouble under MS Windows.

    You have no idea what you are talking about, do you?

    I know what he is talking about. A filename or path is in UNIX is just an alias to the file. If you open the file to use that creates another "reference" to the file.

    A file is only deleted physically when there are no links (other than symbolic ones which don't count) or open file handles on it.

    You can write a new file there (with the old name) but the old file is still there whilst it is in use.

  • (cs)

    Just in case anyone is sceptical about Microsoft products being a never ending stream of broken APIs: remember Internet Explorer 6.

  • macmac (unregistered) in reply to warmachine
    warmachine:
    Just in case anyone is sceptical about Microsoft products being a never ending stream of broken APIs: remember Internet Explorer 6.

    The browser people kept using for 12 years, then complained it wasn't compliant with current standards.

  • Jack (unregistered) in reply to Randy
    Randy:
    Yeah, it is a well established fact that a certain large and aggressively dominant software company is founded on, composed entirely of, and produces nothing but pure unmitigated evil.

    If you don't know that already, you may have an excuse if you fall into one of these categories:

    1. Innocent child never used computer.
    2. Non technical mind never used anything but one OS.
    3. Technical, but obsessed like an autistic person on the products of a single vendor because once you figured out the option to enable teh shiny on your buttons you thought you were a rock star and stopped learning. Never really designed anything; just snapped together other people's code.
    4. Mental affliction renders you incapable of remembering past abuses and noticing a pattern.
    To the lawyers who even now are drafting up a nice lawsuit, before you appear in court angrily shouting "it is obvious he is describing us perfectly" consider that he might have been taking about Oracle.
  • Ralph (unregistered) in reply to macmac
    macmac:
    warmachine:
    Just in case anyone is sceptical about Microsoft products being a never ending stream of broken APIs: remember Internet Explorer 6.

    The browser people kept using for 12 years, then complained it wasn't compliant with current standards.

    or any other standards at any time during those 12 years, unless you define standard as "everyone else has to do it the way we do it, even though there is no document or rational design behind our way, and if you do figure out how we do it we'll sue you for intellectual property crimes."

  • (cs) in reply to AP²
    AP²:
    But it's Microsoft; what do you expect? If their programmers were any good they'd be working at Google.

    Ouch! So true it hurts.

  • (cs)

    I'm not saying you should never use Microsoft, or that you should never write components that will only run on Microsoft.

    But a company should not have the attitude of "Microsoft shop" meaning that they will never consider using a different operating system for anything, even if it happens to be more appropriate for the purpose. Or that it isn't preferable to write your systems in a more open, portable way just in case in the future a better operating system appears for the purpose of running it and you want to port...

    Write for Microsoft-only if doing so will mean a far quicker development time / lower development cost than doing otherwise.

  • AP² (unregistered) in reply to macmac
    macmac:
    warmachine:
    Just in case anyone is sceptical about Microsoft products being a never ending stream of broken APIs: remember Internet Explorer 6.

    The browser people kept using for 12 years, then complained it wasn't compliant with current standards.

    IE6 wasn't compliant when it came out. Then more than five years passed until IE7 was released.

  • (cs) in reply to Tom
    Tom:
    THe real WTF is that he is using Jet Engine instead of a a library that can better handle these work arounds such as NPOI. At least 40% of my job is knowing what other libraries and code bases are out there so that when I run into a problem, I'm not reinventing the wheel every time.
    And if he doesn't know which libraries exist, he could start one rather than having to duplicate this code all over the place.
  • (cs)

    Excel has another "feature" where it can't reliably detect the encoding of a .csv file, so if that CSV is utf8 encoded, but the field headers contain only ascii, it barfs and screws it all up, forcing you to perform a bunch of extra steps to import it correctly.

  • (cs)

    Where's the WTF? Oh, I'm actually supposed to READ the comments! I guess it's really true that more things make us say WTF than just code...

  • (cs) in reply to warmachine
    warmachine:
    After a few months, I gave up and tried to generate RTF documents. Fine for simple formatting but anything more sophisticated and documentation was lacking. For example, the syntax of fields was defined but no fields were named, even for today's date. RTF was a poorly documented, alternative Word format, not a document exchange format, and the only way understand the format was to reverse engineer it by loading documents into Word and seeing what it did.
    And you didn't bother just opening up the MFC SDK sample called "WordPad"? Or did I miss something? (OK, so I only looked briefly at the WordPad sample, and may have missed that it was, for example, an incomplete RTF reader/writer or something equally (bad word).)
  • Chris (unregistered) in reply to ubersoldat
    ubersoldat:
    AP²:
    But it's Microsoft; what do you expect? If their programmers were any good they'd be working at Google.

    Ouch! So true it hurts.

    Let's be specific here, if they were any good they'd be working on Google's search engine. Quite frankly most of Google's other products are also full of fail.

  • Chris (unregistered)

    The only WTF I see is that the code and comments were posted on TDWTF at all.

    Nothing to see here.

  • Shinobu (unregistered) in reply to Jerry

    Jerry, please read Windows Can but Won't. Also, I've had to work with, or more appropriately against, Excel and it's a steaming pile of crap. Methods that don't do what they say, methods that work differently in different versions for no obvious reason, methods that sometimes crash for no reason... I've even been in the situation where everything worked in Office 2003 but after we migrated to Office 2007 a method sometimes didn't do anything without any error message whatsoever. The only solution that sort of worked was to call the method in a loop with DoEvents and check if the requested modifications were made.

  • (cs) in reply to Sarten X
    Sarten X:
    Rodnas:
    Well he did comment the code. Unfortuanly, it takes less time to read the code and figure out what is does, than reading the comment. And THAT my friends is NOT best practices. </troll>
    What the code does is obvious. Why it does what it does is not so obvious, so the comment is vital to preventing future regressions. The comedic tone and hyperbole are also vital for improving morale.

    Besides... it's unlikely anyone will ever take the time to read the comment unless there's already a bug, and they're going back over old code.

    I'm kind of on the fence with this. Comments that explain the theory of something like this are fine; actually needed.

    But it's like Paul was running for political office or something and couldn't say with 20 words what 2,000 words would do; and not only that, but while describing the problem, he had to cast aspersions on his opponent.

    Definitely a politician.

    And knowing how competent all politicians are ...

  • foxyshadis (unregistered)

    Wow, who knew that Blakeyrat would end up on TDWTF main page?

  • (cs)

    The comments make sense

    // Why am I doing something WTF'y here? 
    // Surely this is WTF'y code? 
    // Well actually no, the API / system I am using is WTF'y and requires this stupid hack
    

    someone who sees the comment will understand why the WTF code is there.

  • Jerry (unregistered) in reply to Shinobu
    Shinobu:
    Jerry, please read Windows Can but Won't.
    And that's why there are things called APIs that don't change when you are just patching a buffer overflow.

    Which entirely sidesteps the question of why "we can totally demolish your system" buffer overflows etc. are being manufactured in the first place, so many that they still need to be patched at the 10-year average rate of several per month.

  • El Ka-Ben (unregistered)

    I always thought the source code for Excel was one of those myths... that the core was still some hand-tweaked assembly that Microsoft had inherited way back when they bought it.

    Yeah, I don't know where I heard it.

  • (cs) in reply to Randy
    Randy:
    Yeah, it is a well established fact that a certain large and aggressively dominant software company is founded on, composed entirely of, and produces nothing but pure unmitigated evil.
    What? This isn't an Apple story.
  • JimFin (unregistered) in reply to Rodnas
    Rodnas:
    Well he did comment the code. Unfortuanly, it takes less time to read the code and figure out what is does, than reading the comment. And THAT my friends is NOT best practices. </troll>
    If you want to know what the code does, read the code & run it. Comments just would explain the obvious, and usually do it poorly, too.

    But why the code does what it does? That, my friend, is never in the code. That is where the comments come in.

  • Paul Sympathizer (unregistered)

    I feel your pain, Paul. I feel your pain.

  • Some Random Texan (unregistered) in reply to Patrick Chasco (PBC)
    Patrick Chasco (PBC):
    Please, guys. Stop pumping up Paul's ego. I actually have to work with this guy.

    Then come up with a legit WTF about his work. Other than ranting about his thorough efforts to reduce the complexity of Microsoft APIs.

    If his ego makes him WTF something, that's one thing, but if his ego is just annoying you, maybe you're not that great?

    CAPTCHA letatio - French for le'tatio or "the tattler".

  • Cujo (unregistered)

    I'd love to see what was left out of the original comments.

    I've found comments like "left in because the fat pig/fat bitch insisted on it" and much worse.

  • danny (unregistered)

    like others I don't see the wtf. The only wtf maybe is that he should be doing a check on the last character to see if it is a $ then add one of it isn't instead of doing a global replace. And who hasn't been frustrated working hours trying to solve a stupid bug? He just vented his frustration in his comment instead of to someone else.. Honestly it is pretty hilarious and I would love to come across comments like that.. descriptive and funny.

  • poogles (unregistered) in reply to Randy

    OMG I'm a 3! Please help!!

  • Mike (unregistered) in reply to Bob

    What? You aren't one of those people the subscribe to psychobabble without any formal proof of correctness are you? ARRRHH I am so mad :) At least I'm not so stupid to think that way otherwise I'd be wrong like you.

    You make a good point skilled techies have their preferences and they often verge on religion. What would you rather have a bunch of people that aren't passionate about the tech they use and the systems they build?

    "We are going to use .Net/Java/Cocoa (pick one) to build a SOA/direct access/ORM data model to present a website/App/desktop program for linux/windows/Mac. We don't really care much which one because we all know version 2.0 is going to be as oh hum as v1 was."

  • Mike (unregistered) in reply to danny

    In C# for example (~ don't have compiler handy)

    wsheet = wsheet.TrimEnd('$').Append('$');

    Would cover both causes assuming there aren't multiple "$" on the end of the line without even needing to use a conditional.

  • F (unregistered) in reply to warmachine
    warmachine:
    Just in case anyone is sceptical about Microsoft products being a never ending stream of broken APIs: remember Internet Explorer 6.

    I've spent years trying to forget it. And just when I'd succeeded, you come along. Bastard.

  • (cs) in reply to Nagesh
    Nagesh:
    I'm willing to consider it a minor WTF that Paul's solution was to do global search-and-replaces over the entire string, when, according to his comments, the problem was only about by certain magic characters appearing (or not appearing) at the far end of the string.

    When A) the characters can't appear elsewhere in the string anyway and B) .Replace is shorter and easier to understand than doing stuff with .Length and indexes, I don't see the problem.

  • Klimax (unregistered)

    Global solution cannon on local problem is WTF. Paul is WTF.

    Sorry WTFers...

  • Anonymous (unregistered)

    "Anyone who has worked with a database in a professional capacity for more than 20 minutes should have a list of at least 10 reasons why Excel is a monster. These probably include:

    1. The way it butchers postal codes that start with a leading zero, like the town I grew up in (Granby, MA 01033 USA)

    2. Dates of any kind

    3. Serial numbers that have leading 0's (see #1)

    4. The JET database driver for Excel. One large WTF.

    5. SQL Server Integration Services Excel datasource. WTF squared.

    6. The f-ing "just put an apostrophe" workaround. WTF.

    7. a. The equally effective "format as text before you paste" workaround. Gives the illusion of working, only to break later.

    8. Save as CSV, then reopen the CSV in Excel. Lots of magical things happen there.

    9. While on the topic, CSV files, which are a whole WTF on their own.

    10. The Jet database driver's "type guess rows" registry entry. WTF factorial.

    The root of all this: Excel makes things that look like tables, and tables are useful for data. There is no other program that is as widespread AND makes things that look like tables, so people use Excel to make tables of data. And it's in fact really, really bad at that. It was designed for ad-hoc numerical analysis and got appropriated as a database loading and reporting tool.

    I think it's actually damaged the GNP of whole nations, this Excel program. It'd be interesting to know how badly."

  • (cs) in reply to Lupe
    Lupe:
    TRETF is
        File.Delete(sourceFileName);
    What if the Load fails? The source file will still be deleted, and you're left with something more than a missing '$' to explain away.

    What failure mode do you imagine for this that doesn't involve an exception being thrown?

  • Patrick Chasco (PBC) (unregistered) in reply to Some Random Texan
    Some Random Texan:
    Patrick Chasco (PBC):
    Please, guys. Stop pumping up Paul's ego. I actually have to work with this guy.

    Then come up with a legit WTF about his work. Other than ranting about his thorough efforts to reduce the complexity of Microsoft APIs.

    If his ego makes him WTF something, that's one thing, but if his ego is just annoying you, maybe you're not that great?

    CAPTCHA letatio - French for le'tatio or "the tattler".

    Three things. First: I didn't submit this code. Another employee did. Two: I was kidding and he knows it. Third: I actually am pretty great!

  • Botia (unregistered)

    I like Microsoft, but I have to agree with Paul. His coding looks good and he works around the $#*@ that is Excel.

  • John (unregistered) in reply to Jerome Eteve
    Jerome Eteve:
    That's actually a piece of comment that adds valuable information for future developers. Well, except the humorous bits :). Not really a CodeSOD

    From here: Code Snippet Of the Day (CodeSOD) features interesting and usually incorrect code snippets taken from actual production code in a commercial and/or open source software projects.

  • gastonci (unregistered) in reply to Lupe

    My thoughts exactly.

    that and removing all those '$' before adding them, instead of just checking if they are there.

  • Derp (unregistered) in reply to John
    John:
    Jerome Eteve:
    That's actually a piece of comment that adds valuable information for future developers. Well, except the humorous bits :). Not really a CodeSOD

    From here: Code Snippet Of the Day (CodeSOD) features interesting and usually incorrect code snippets taken from actual production code in a commercial and/or open source software projects.

    Seems like a valuable entry because the comment rage is pretty funny, imo.

  • C-Derb (unregistered) in reply to Jack
    Jack:
    Randy:
    Yeah, it is a well established fact that a certain large and aggressively dominant software company is founded on, composed entirely of, and produces nothing but pure unmitigated evil.

    If you don't know that already, you may have an excuse if you fall into one of these categories:

    1. Innocent child never used computer.
    2. Non technical mind never used anything but one OS.
    3. Technical, but obsessed like an autistic person on the products of a single vendor because once you figured out the option to enable teh shiny on your buttons you thought you were a rock star and stopped learning. Never really designed anything; just snapped together other people's code.
    4. Mental affliction renders you incapable of remembering past abuses and noticing a pattern.
    To the lawyers who even now are drafting up a nice lawsuit, before you appear in court angrily shouting "it is obvious he is describing us perfectly" consider that he might have been taking about Oracle.
    +1
  • Spewin Coffee (unregistered)

    TRWTF is the use of Microsoft Excel spreadsheets as a database.

    "That's what Microsoft Access is for!"

  • (cs) in reply to Smug Unix User
    Smug Unix User:
    Purple prose in code Words of truth slice the demons Excel king of evil
    True. And Word is its queen. I had to write COM interop with word and it had to use visual basic commands in a string. It also had to work in different versions of Word in text that had mixed writing order. The horror.

Leave a comment on “Not Good Enough for Paul”

Log In or post as a guest

Replying to comment #:

« Return to Article