• Buddy (unregistered) in reply to Procedural
    Procedural:
    I am sore today because I learned of the death of one of the cofounders, and looked upon their legacy and saw it wasted by greed, poor ethics and ineptitude. I wish we were all prouder of our profession, even when doing work that is either technically hard or a tough institutional sell, that's all.

    (Bye H.G.)

    My condolences.

    It's not only greed, poor ethics and ineptitude, but simply advances in technology. What once represented hours of work to craft and optimize to squeeze every last byte and cycle can be rendered obsolete in a year, now even the concept of optimizing is becoming obsolete. I don't really lament the changes; in many ways it's much easier and transparent to convert ideas into working code. Who knows where this will lead, will we eventually not need computer languages at all?

  • ExOttoyuhr (unregistered)

    No one's ever going to see it at this point, but for bitstrings in Caché (the main MUMPS descendant at this point):

    http://docs.intersystems.com/cache20101/csp/docbook/DocBook.UI.Page.cls?KEY=RCOS_fbit

  • Chris H (unregistered) in reply to Justin
    Justin:
    highphilosopher:
    Anon:
    I think some day I heard that TRWTF was PHP...

    You can write some pretty elegant code in PHP. The real problem is that it has such a low learning curve that almost any idiot with a keyboard can write code in PHP.

    Captcha: iusto -- Kinda like gusto, but more selfish.

    Like VBA!

    Except that PHP is better documented, fairly upwards compatible, has clear function names, is not object obsessed, and has a supportive user community.

    Oops, I bit. You won.

  • Chris H (unregistered) in reply to frits
    frits:
    SilentRunner:
    THERE ARE GOOD REASONS for putting a string of 1s and 0s into the source of a program.

    I don't know many "real" programmers who think it's OK to routinely expand data by a factor of 4 or 8.

    That's not always wrong, see SilentRunners comment.

    frits:
    I also don't know many "real" programmers (or EEs for that matter) who don't know how to convert a hexidecimal character to it's binary nibble representation in their head.
    A clear "true scotsman".
  • TS (unregistered)

    Worst. Code. Ever.

    IMHO the problem is not that it's plain stupid but that it combines an abundance of powerful tools in the worst possible combination. You can't make that stuff up really.

  • Hamish (unregistered) in reply to TS

    +1

    III especially like this:

    ... } else if($i==47 or $i==48 or $i==49){ $iii=0; for($ii=50;$ii<52;$ii++) ...

    (Captcha "odjo".. dyslexic ninja training ground?)

  • (cs)

    This is so bad its LOL brilliant!

  • (cs)

    a boolean array, or even an integer array

    The real WTF is that the poster thinks an integer array is more compact than a char array. Even most booleans are word sized and not as efficient as a char array (assuming a c/c++ implementation that is).

  • Contra17 (unregistered)

    OK so this is not a good example, but I contend that there are cases where string ops can be more efficient than integer ops.

    Logic that can be computed via L-Systems, where string mutations are defined by simple grammars, is one such case.

  • Herby (unregistered)

    After reading this and all the comments, all I can say is "Where would you like the tactictal nuclear strike?". My answer would be "Right here in this code!".

    These should be removed "with extreme predijuce". The sooner the better!

  • RBoy (unregistered) in reply to Procedural
    Procedural:
    RBoy:
    procedural:
    (A different) Mike:
    Procedural:
    Mike:
    I stopped reading halfway down. If I had a job that involved this code, my next words would be "I quit".

    Ah, the generic throwaway comment; how appreciated.

    Two things:

    1. Hmmm, no you wouldn't; I'm sure it sounds great to say it at the brewery with the boys (or muttering on the sofa at night in front of the telly), but in reality, no you wouldn't.

    2. If you did you wouldn't be worth employing anyway; this code needs refactoring. Do you not consider refactoring part of your job ? Do you only take jobs to fix and improve code that is already good ? Perhaps you can't reengineer your way out of a few lines of code ? What good are you to a project then ?

    I propose that we relabel all the "I'd quit" posters that pollute every single darn story as incompetent and lazy prima donnas. Take up gardening or something.

    At least the original poster only wasted 2 seconds of our lives with his comment. That's a lot less time than I wasted reading your overwrought and totally unnecessary over-analysis of it. Just something for you to consider next time you're thinking of rebutting a useless comment with a considerably longer useless comment.

    Nah, definitely the same Mike. Go back to work.

    I doubt it, as I think you are quite the twit as well.

    Of course, only a prima donna would think that there's only one person in the world who doesn't agree with you.

    Well, if I am the only one who is annoyed at the repeated and demeaning statement that we developers should have the work ethic of a stoned slob, then so be it. It unnerves me to no end. If you had pride in your work and profession, it would annoy you as well. You disagree ? It's your right; and your brand.

    There's a difference between having a good work ethic, and throwing yourself on a funeral pyre.

    Me, I try to avoid doing work that requires asbestos underpants.

  • David V. Corbin (unregistered) in reply to ceiswyn
    ceiswyn:
    Dilbert:
    MUMPS, now called Cache is NOT a limited and perverted language

    It is, however, named after a disease. Gotta wonder about that, really.

    Considering that the original purpose was to allow non-programmers in the medical field to access and maintain data, the name is appropriate.

    When the language was first introduced [I fondly remember working with it back in the 1970's on a DEC PDP-8] it offered an excellent solution to a real world situation.

    I wonder what percentage of the people responding were even born in 1972, let alone doing serious programming <sigh>.

  • Anon (unregistered) in reply to Tom Woolf
    Tom Woolf:
    Or, as Scott Adams put it: http://dilbert.com/dyn/str_strip/000000000/00000000/0000000/000000/20000/3000/700/23765/23765.strip.gif
    Considering today's article, giving this link as an illustration is pretty funny. ;D
  • RBoy (unregistered) in reply to Procedural
    Procedural:
    luis.espinal:
    Procedural:
    Mike:
    I stopped reading halfway down. If I had a job that involved this code, my next words would be "I quit".

    Ah, the generic throwaway comment; how appreciated.

    Two things:

    1. Hmmm, no you wouldn't; I'm sure it sounds great to say it at the brewery with the boys (or muttering on the sofa at night in front of the telly), but in reality, no you wouldn't.

    Hmmm, gotta disagree with you here. You are assuming everyone is in a position where quitting is not an option (surprise! some do have that option.) Also, you seem to believe refactoring is something that you can simply do to any code base. Wrong.

    Software development is much more than code writing. It is a creative and business and engineering process. From experience, you have to have a heck of good co-worker and management support to tackle that kind of crap (.ie. good org inheriting or supporting uber-crap legacy.) There you have an ethical reason to plow away.

    Also, from experience (sadly and painfully so), if that kind of code is the active product of a team and organization, chances are that they are equally convoluted and inept (or more so). Under those conditions, quitting is a sane alternative. Here, you do not have an ethical reason to do so, and only a moron would stay there stagnant.

    Furthermore, there is a type of code (and people behind it) for which "I quit" is the only sensible solution. The 2nd law of thermodynamics applies to software as well. Not knowing anything else, that code looks like a good candidate for throwing your hands up.

    Procedural:
    2. If you did you wouldn't be worth employing anyway; this code needs refactoring.

    Not all code needs/deserves refactoring. This is a known fact in software. Refactoring is not a magic keyword that can turn all things wretched into usable things, not without costs. Refactoring is done when it is tactically/strategically sound, when the cost/gain ratio of its incremental application is acceptable. You need to have an underlying architecture and design that can be exploited and improved upon with re-factoring.

    Chances are, that code snippet is representative of an entire system. Attempting to refactoring it is akin to putting neosporin on a melanoma.

    Procedural:
    Do you not consider refactoring part of your job ? Do you only take jobs to fix and improve code that is already good ? Perhaps you can't reengineer your way out of a few lines of code ? What good are you to a project then ?

    The first three questions are gratuitous ad hominems and strawmen. You took someone light-hearted comment ("I quit"), twisted it into an argument he didn't make ("I don't believe in refactoring"), constructed a counter-argument ("re-factoring is important"), and then used it to hit the man with you e-weewee ("re-factoring good, u sux") with which to implicitly state your l33t hax0r status...

    ... how does that work for you?

    The fourth question gives me the impression you are simply projecting or are out trying to prove something.

    Procedural:
    I propose that we relabel all the "I'd quit" posters that pollute every single darn story as incompetent and lazy prima donnas. Take up gardening or something.

    I propose we create custom labels that read "I project my own baggage (calling people prima dones in the process), I build strawman arguments, and I like to lecture people about refactoring even though I don't quite understand the conditions in which it is applicable." How about that?

    Yup, you are right; there is a lot of baggage being projected today. I used to work at this place I loved. The two owners were fantastic people; one a great PM, one a very creative and deeply knowledgeable developer. They had been a unit for years and years. This was their business; no venture capital, no loans, just growing through cash flow. That's a rarity nowadays. The product was awesome. It had grown a bit spaghetti-like over time but everyone chipped in when demand grew to stabilize the codebase, refactor it, and make it so it would be able to evolve through subsequent code generations. We all chipped in; long hours, downright courageous attacks of huge slabs of code, no budget. It was hard work but some of the best work I've ever seen done. The product was eventually taken over by another company who replaced the original team by a bunch of code-patchers who messed up the product pretty badly, preferring an "I quit"/"let's delay good coding"/"it was like that when I came in"/"sell that patch to management"/"take no initiative" mentality to continuing on good principles and code (given, as you mentioned, the proper costs).

    I've been in the dev biz for 31 years; I am starting to know people who reach retirement and pass away. Sometimes the people who take over their code threat it like it is their own adopted baby, respect it, make it grow, yet rebuilt it in better form as necessary. But often slobby short-termers show up and turn great code into bad. I hope that all the code we've written will pass on as legacy, as the start of something much bigger and better in the future, reengineered, transcoded, refactored if you will, yet relentlessly improved upon. This matters. People before us were not all dumb, and their work wasn't just "man-hours". It was real work, real love, real craft, real intelligence being stretched and worked upon. So when I see people who look at a few hundred lines of code and presume that this is such a hard challenge that they do not feel up to it (or up to selling the task on its value above and around them), it scares the hell out of me. It's okay when it happens once in a while but lately the "I quit" routine has been the punchline or amongst the first unchallenged comments in a long series of posts. It is just as major a statement of mediocrity as the WTF itself. I contrast this attitude to that of the great coders I know, young and old, and I wonder if there's enough of them to make up for the others.

    Here the code above could be anything; it could be a local issue caused by a new developer tasked with moving old green-screen code to a new environment. It doesn't mean that the whole code is bad; it may have taken a dip with that person for whatever reason (lack of available talent, rush to market, etc.), but beyond the surface crud could be a sound structure. Or it could be genuinely representative of terrible code throughout. Who knows. We don't see the whole story. The commenter also didn't, but the response was unmistakably biased towards mediocrity, and this is what I responded to.

    I am sore today because I learned of the death of one of the cofounders, and looked upon their legacy and saw it wasted by greed, poor ethics and ineptitude. I wish we were all prouder of our profession, even when doing work that is either technically hard or a tough institutional sell, that's all.

    (Bye H.G.)

    That's a lovely story, and you tell it so well.

  • (cs) in reply to Procedural
    Procedural:
    RBoy:
    procedural:
    (A different) Mike:
    Procedural:
    Mike:
    I stopped reading halfway down. If I had a job that involved this code, my next words would be "I quit".

    Ah, the generic throwaway comment; how appreciated.

    Two things:

    1. Hmmm, no you wouldn't; I'm sure it sounds great to say it at the brewery with the boys (or muttering on the sofa at night in front of the telly), but in reality, no you wouldn't.

    2. If you did you wouldn't be worth employing anyway; this code needs refactoring. Do you not consider refactoring part of your job ? Do you only take jobs to fix and improve code that is already good ? Perhaps you can't reengineer your way out of a few lines of code ? What good are you to a project then ?

    I propose that we relabel all the "I'd quit" posters that pollute every single darn story as incompetent and lazy prima donnas. Take up gardening or something.

    At least the original poster only wasted 2 seconds of our lives with his comment. That's a lot less time than I wasted reading your overwrought and totally unnecessary over-analysis of it. Just something for you to consider next time you're thinking of rebutting a useless comment with a considerably longer useless comment.

    Nah, definitely the same Mike. Go back to work.

    I doubt it, as I think you are quite the twit as well.

    Of course, only a prima donna would think that there's only one person in the world who doesn't agree with you.

    Well, if I am the only one who is annoyed at the repeated and demeaning statement that we developers should have the work ethic of a stoned slob, then so be it. It unnerves me to no end. If you had pride in your work and profession, it would annoy you as well. You disagree ? It's your right; and your brand.

    ...says the guy posting on a humor forum during working hours.

  • Larry (unregistered) in reply to somedude
    somedude:
    That CD will go in to the alarm clock.
    Ahh, you kids and your crazy inventions. Back in my day the CD player didn't tell time, the clock didn't play CDs, and my phone didn't have a root shell!
  • Rick Lime (unregistered)

    There once was a man from 1100110011001000001001100110011 Who put all his cats in a 0110011001000001110001100110011 When things became 01100001000001 He went back to the 01000101000001 And put everything else in the 1001100110010000010101100110011!

  • Adam (unregistered) in reply to Mike

    I had much the same thought.

  • Adam (unregistered) in reply to Mike
    Mike:
    I stopped reading halfway down. If I had a job that involved this code, my next words would be "I quit".

    Oops, I was replying to this comment.

  • David V. Corbin (unregistered) in reply to Procedural

    [quote user="Procedural]I propose that we relabel all the "I'd quit" posters that pollute every single darn story as incompetent and lazy prima donnas. Take up gardening or something.[/quote]

    I tend to agree. About 6 months ago I interviewed a candidate (I provide this as a service for a number of clients). Things were going reasonably well..not outstanding, but not horrible.

    The person then started talking about on-line "technical forums" and provided his handle/avatar for a number of sites (including The Daily WTF). I did some background checks, and confirmed my findings were the actual posts of the client. So many were "bitch and moan" (as well as profane) that the candidate was eliminated from consideration.

    Captcha: vindico - what happened to this candidate....

  • (cs)

    I think my brain wants to vomit through my eyes.

  • (cs)

    I'm guessing that MAYBE these bit strings were used to manually lay out the bits in a simple binary (two-color) bitmap image. Someone generates a text file with 0s and 1s to represent the off and on bits of an image. The text file is then read in and the strings are converted into bit patterns.

    I did something like this way back in the DOS days when there simply weren't any tools for designing bit map images.

  • _ (unregistered) in reply to OzPeter

    Theoretically every flag should have its own column. At least, if you want to have a good schema.

  • Kef Schecter (unregistered)
    Now, unless such a string is part of some classroom assignment where the goal is to programmatically convert Based 2 to Base 10 — or, perhaps, existing in some highly-limited and/or perverted language like MUMPS — there is never a good reason for it to exist in a program.

    Yeah! 'Cause real programs never use bitmasks. (Yeah, I know C and C++ don't allow binary constants, but some languages do.)

    I also don't know many "real" programmers (or EEs for that matter) who don't know how to convert a hexidecimal character to it's binary nibble representation in their head.

    I can do it but sometimes it's still easier to read them in binary form. We could choose to always use identifiers like 'x' and 'y' and manually convert them in our heads to what they represent, but that doesn't make it a good idea!

  • Jupiter (unregistered)

    Oh my god, that 81 character string is a product catalog!

    $ProductsController = new ProductsController; $arr = $ProductsController->getProducts($dbo, $sql, $_GET); $smarty->assign('results_tpl', 1); if(count($arr['catalog_arr'])>0) { $smarty->assign('catalog_arr', $arr['catalog_arr']); }

    It's a good thing catalogs dont change frequently! (heh)

  • Ben (unregistered) in reply to ARMed but harmless
    Seriously, if code becomes sentinent and starts to expand itself, the result will look exactly like this.

    Kind of like Terminator, only we're being hunted by killer robots that take twelve hours to figure out how to walk across a room.

  • Stiggy (unregistered) in reply to jjs
    jjs:
    tristique:
    jjs:
    Zylon:
    <comment redcated>
    <reply redacted>
    <defense of original poster's comment redacted>
    <scathing rebuttal and suggestion that defender's mother is a whore redacted>
    <cliched suggestion that the comments on this thread are TRWTF redacted>
  • Rich (unregistered) in reply to KittyKat

    Don't worry Bender... There's no such thing as "two".

    (waddia mean "Prove I'm not a robot"? bite my shiny metal...)

  • Loveknuckle (unregistered) in reply to Procedural
    Procedural:
    luis.espinal:
    Procedural:
    Mike:
    I stopped reading halfway down. If I had a job that involved this code, my next words would be "I quit".

    Ah, the generic throwaway comment; how appreciated.

    Two things:

    1. Hmmm, no you wouldn't; I'm sure it sounds great to say it at the brewery with the boys (or muttering on the sofa at night in front of the telly), but in reality, no you wouldn't.

    Hmmm, gotta disagree with you here. You are assuming everyone is in a position where quitting is not an option (surprise! some do have that option.) Also, you seem to believe refactoring is something that you can simply do to any code base. Wrong.

    Software development is much more than code writing. It is a creative and business and engineering process. From experience, you have to have a heck of good co-worker and management support to tackle that kind of crap (.ie. good org inheriting or supporting uber-crap legacy.) There you have an ethical reason to plow away.

    Also, from experience (sadly and painfully so), if that kind of code is the active product of a team and organization, chances are that they are equally convoluted and inept (or more so). Under those conditions, quitting is a sane alternative. Here, you do not have an ethical reason to do so, and only a moron would stay there stagnant.

    Furthermore, there is a type of code (and people behind it) for which "I quit" is the only sensible solution. The 2nd law of thermodynamics applies to software as well. Not knowing anything else, that code looks like a good candidate for throwing your hands up.

    Procedural:
    2. If you did you wouldn't be worth employing anyway; this code needs refactoring.

    Not all code needs/deserves refactoring. This is a known fact in software. Refactoring is not a magic keyword that can turn all things wretched into usable things, not without costs. Refactoring is done when it is tactically/strategically sound, when the cost/gain ratio of its incremental application is acceptable. You need to have an underlying architecture and design that can be exploited and improved upon with re-factoring.

    Chances are, that code snippet is representative of an entire system. Attempting to refactoring it is akin to putting neosporin on a melanoma.

    Procedural:
    Do you not consider refactoring part of your job ? Do you only take jobs to fix and improve code that is already good ? Perhaps you can't reengineer your way out of a few lines of code ? What good are you to a project then ?

    The first three questions are gratuitous ad hominems and strawmen. You took someone light-hearted comment ("I quit"), twisted it into an argument he didn't make ("I don't believe in refactoring"), constructed a counter-argument ("re-factoring is important"), and then used it to hit the man with you e-weewee ("re-factoring good, u sux") with which to implicitly state your l33t hax0r status...

    ... how does that work for you?

    The fourth question gives me the impression you are simply projecting or are out trying to prove something.

    Procedural:
    I propose that we relabel all the "I'd quit" posters that pollute every single darn story as incompetent and lazy prima donnas. Take up gardening or something.

    I propose we create custom labels that read "I project my own baggage (calling people prima dones in the process), I build strawman arguments, and I like to lecture people about refactoring even though I don't quite understand the conditions in which it is applicable." How about that?

    Yup, you are right; there is a lot of baggage being projected today. I used to work at this place I loved. The two owners were fantastic people; one a great PM, one a very creative and deeply knowledgeable developer. They had been a unit for years and years. This was their business; no venture capital, no loans, just growing through cash flow. That's a rarity nowadays. The product was awesome. It had grown a bit spaghetti-like over time but everyone chipped in when demand grew to stabilize the codebase, refactor it, and make it so it would be able to evolve through subsequent code generations. We all chipped in; long hours, downright courageous attacks of huge slabs of code, no budget. It was hard work but some of the best work I've ever seen done. The product was eventually taken over by another company who replaced the original team by a bunch of code-patchers who messed up the product pretty badly, preferring an "I quit"/"let's delay good coding"/"it was like that when I came in"/"sell that patch to management"/"take no initiative" mentality to continuing on good principles and code (given, as you mentioned, the proper costs).

    I've been in the dev biz for 31 years; I am starting to know people who reach retirement and pass away. Sometimes the people who take over their code threat it like it is their own adopted baby, respect it, make it grow, yet rebuilt it in better form as necessary. But often slobby short-termers show up and turn great code into bad. I hope that all the code we've written will pass on as legacy, as the start of something much bigger and better in the future, reengineered, transcoded, refactored if you will, yet relentlessly improved upon. This matters. People before us were not all dumb, and their work wasn't just "man-hours". It was real work, real love, real craft, real intelligence being stretched and worked upon. So when I see people who look at a few hundred lines of code and presume that this is such a hard challenge that they do not feel up to it (or up to selling the task on its value above and around them), it scares the hell out of me. It's okay when it happens once in a while but lately the "I quit" routine has been the punchline or amongst the first unchallenged comments in a long series of posts. It is just as major a statement of mediocrity as the WTF itself. I contrast this attitude to that of the great coders I know, young and old, and I wonder if there's enough of them to make up for the others.

    Here the code above could be anything; it could be a local issue caused by a new developer tasked with moving old green-screen code to a new environment. It doesn't mean that the whole code is bad; it may have taken a dip with that person for whatever reason (lack of available talent, rush to market, etc.), but beyond the surface crud could be a sound structure. Or it could be genuinely representative of terrible code throughout. Who knows. We don't see the whole story. The commenter also didn't, but the response was unmistakably biased towards mediocrity, and this is what I responded to.

    I am sore today because I learned of the death of one of the cofounders, and looked upon their legacy and saw it wasted by greed, poor ethics and ineptitude. I wish we were all prouder of our profession, even when doing work that is either technically hard or a tough institutional sell, that's all.

    (Bye H.G.)

    I completely agree with you. We need more programmers who care.

  • embeddedprogrammer (unregistered)

    at the risk of sounding like a tedious troll repeating tired old memes...

    I personally think that down at the more sensible sizes of bit field, e.g. an 8 bit or 16 bit register in a microcontroller, it's far far more human readable to specify bytes in your source in binary representation, I say this because it's a real pain if you have to work out what un-setting bit n in a given byte will result in every five minutes.

    that said, there's no excuse to ever /store/ the value that way, that's just mental. If your database needs to be human readable/able to be manually edited regularly, then you're Doing It Wrong

  • Kempeth (unregistered)

    The keyword in such a case is "refactoring"...

    Meaning: Find work in a different software factory as soon as possible.

  • iMalc (unregistered) in reply to Kempeth
    Alex:
    Consider "0010000000100000". It's a string filled with nothing but "1" and "0" characters. Now, unless such a string is part of some classroom assignment where the goal is to programmatically convert Based 2 to Base 10 — or, perhaps, existing in some highly-limited and/or perverted language like MUMPS — there is never a good reason for it to exist in a program.
    That's not entirely true. I've encountered a situation where this was undoubtedly the best choice. No of course it wasn't anything ridiculous such as storing it in a database! It was for encoding/decoding data read off 125KHz technology proximity cards. Sure, the data could be read into an array of bytes, but that doesn't allow you to easily remove every 5th bit for example (which was one step it had to do), or to easily calculate the parity of the first or last 13 bits, or to track the exact length of the data as it goes through the various stages since it isn't a multiple of 8 at every step. This made for extremely simple coding and very easy debugging. When speed is not an issue (there was most definitly no point in shaving a few milliseconds off how long it took to display the data) then this is techinque is very sensible. In the cases where one needs to output the resulting 1's and 0's for debugging, rather than interpreting bits of it as decimal numbers, it is also very very useful.

    As for this story: OMG WHY!!!

  • diodor (unregistered) in reply to Leo

    Im going blind....

  • Marc (unregistered) in reply to OzPeter
    OzPeter:
    The alternatives would have been to split the value up into multiple columns, which then creates the issue of trying to ensure that the columns are assembled in the correct order when you are doing a query.

    Of course I bet that there may have been another way to encode the information so you didn't have to jump through all of these hoops.

    The real WTF is that multiple field values were encoded into a single database column. This both prevents indexing of the individual values, and ALWAYS results in convoluted code to query it, and as such is a practice that should be avoided.

    If your database table has too many columns, something is wrong with your information analysis and the normalization of your database.

    This "other way" of encoding the information you speak of is by splitting up the values into several records, which then may be queried by a (human-readable, if you wish) key.

    Sure, it will be slow - but when indexed, it will run circles around a query requiring executing dozens of regular expressions per record. Also, you may then query the table by simply issuing something like

    SELECT booleantable.keyvalue FROM redacted_table_name left join booleantable on (redacted_table_name.mainkey=booleantable.mainkey) where booleantable.keyvalue='warranty_expired';

    It's also much more readable than getting the 43rd character from the boolean field.

  • U. N. Owen (unregistered)

    Perhaps their design philosophy was: "Don't sweat it, it's only ones and zeros."

  • SoftlayerSucks (unregistered)

    haHAHAHA.

    When I saw the code, I acted on instinct and skipped it all. I don't know what that guy wanted to do but I know what I would leave in his database if I had to accidentally erase it.

    001100011010100011110001111000110111000010100011110100011101 111101001111110110101000001011100010110100110011111000001001 101010101011000101011111110000010100101010110010011001111110 011010111111110111111100000101100101100011100000010101111111 011101000010101110101011000010010010111011110111110100001101 110100100001100111110000101001110111010000110100110011100011 001100111010101000000011101110010111010100100111110011011011 110000100111010101011110110001010100011010101000001011001111 101101111011010010010110100011001011011100001011110010101101 101010010011101100011101000001000110011101110110110101011001 101101011001110010110011011101100001100011001111100110000110 010110001110011100001000111000101001011000110010000010101000 011111010000000001000110000100110001000010111011101011000011 000110101111010101111110000011000101110111111000110000011110 011110100000100101110010001000110111110110001110111100011000 010000001110000101100001101000010110011000001010010011010000 100100011110111011000011110111101100010111101010011010101000 010010111101101101011110010101111001111100111011010010100001 110010111000101000011000010011101011010100000111000110000110 010011011100010011101101010100010001001100110010010010000110 000010100101001011101111100010011000011011110010011100110100

  • jcb (unregistered) in reply to frits

    That would have to be 0 terminated binary strings, then!

  • (cs)

    Wonderful ^^ They invented involontary obfuscation...

    And btw : who is this Akismet keeping me from posting ? THIS IS NOT SPAM ! Hmmm... wait... is it ? oO

  • Chris H (unregistered) in reply to David V. Corbin
    David V. Corbin:
    Procedural:
    I propose that we relabel all the "I'd quit" posters that pollute every single darn story as incompetent and lazy prima donnas. Take up gardening or something.
    [...] About 6 months ago I interviewed a candidate ([...]the actual posts of the client. So many were "bitch and moan" (as well as profane) that the candidate was eliminated from consideration.

    hurray! bring justice to the trolls :)

    I use this nickname on fora I rarely visit. I have 1 for atheist-fora, and 1 for technical fora. This way I can choose which nick to 'brag' with.

  • (cs) in reply to Chris H
    Chris H:
    frits:
    SilentRunner:
    THERE ARE GOOD REASONS for putting a string of 1s and 0s into the source of a program.

    I don't know many "real" programmers who think it's OK to routinely expand data by a factor of 4 or 8.

    That's not always wrong, see SilentRunners comment.

    Who said always wrong? Anyway, assertion does not equal proof.

    Chris H:
    frits:
    I also don't know many "real" programmers (or EEs for that matter) who don't know how to convert a hexidecimal character to it's binary nibble representation in their head.
    A clear "true scotsman".

    Clearly. Now relay that to the OP.

  • Mikolaj (unregistered)

    Hey, what? They use MVC, controller, view templates. It's enterprisey bussiness logic after all!

  • mike5 (unregistered) in reply to da Doctah
    da Doctah:
    David Hamilton:
    David Hamilton:
    Just because you can do it that way doesn't mean that you should.
    Actually, a quick glance at the code shows the data is clearly structured into a number of groups of pairs of data:
    77-81 and 01-14
    15-20 and 21-24
    43-45 and 46
    47-49 and 50-51
    52-53 and 54-55
    56-57 and 58-59
    plus 25-41 used in the query
    In other words: That data could (and should) have been broken up into several data columns to make it supportable.
    Seriously? Your first response on seeing this was "I just need to normalize it"?
    Plus, why didn't he think of this when he was writing it originally :-p
  • Iffy (unregistered)

    Reading this on my RSS reader that displayed no newlines whatsoever in that code...

    I have lost the will to live.

  • RBoy (unregistered) in reply to David V. Corbin
    David V. Corbin:
    The person then started talking about on-line "technical forums" and provided his handle/avatar for a number of sites (including The Daily WTF). I did some background checks, and confirmed my findings were the actual posts of the client. So many were "bitch and moan" (as well as profane) that the candidate was eliminated from consideration.

    Captcha: vindico - what happened to this candidate....

    Well, that was just stupid of him in the first place, regardless of the quality of posts. Some people just don't understand the value of having a personal life separate from a professional life. Some people are just ludus with how much they share online.

  • (cs)

    I thought I saw a 2! <shudders>

  • Silvermink (unregistered)

    That code sample makes me regret having eyes.

  • Steve (unregistered)

    I've had to deal with a binary string before, more than once. I would venture to guess that anyone who has never done so, either doesn't have that much experience yet or has a lot of control over their working environment. But maybe I'm just being pessimistic.

  • Anonymous MUMPS Programmer (unregistered)
    Consider "0010000000100000". It's a string filled with nothing but "1" and "0" characters. Now, unless such a string is part of some classroom assignment where the goal is to programmatically convert Based 2 to Base 10 — or, perhaps, existing in some highly-limited and/or perverted language like MUMPS — there is never a good reason for it to exist in a program.

    Here's the inevitable answer for converting 'based' 2 to base 10 in Caché ObjectScript, the most popular MUMPS out there:

    binarytodec(binary)
     new decimal, currentDigit, position
     if binary="" {
    	 quit ""
     }
     set currentDigit=1
     set decimal = 0
     set position = $length(binary)
     while (position>0) {
            if $extract(binary,position)=1 {
                    set decimal = decimal + currentDigit
                    }
            set position = position - 1
            set currentDigit = currentDigit + currentDigit
            }
     quit decimal
    

    Wow, now that's horrible, unreadable code. Whoever could even try to figure out what that does. I'm sure that any C or PHP version of the same code written by the worst programmer in the world must be much more readable by default...

  • L Ron's Cupboard (unregistered)

    a WTF written in PHP. never seen that before.

  • Gareth Goodman (unregistered) in reply to L Ron's Cupboard

    Now I've seen it I can't UNsee it, can I ? (reaches for revolver)

Leave a comment on “1's and 0's”

Log In or post as a guest

Replying to comment #:

« Return to Article