• ray10k (unregistered)

    Looks to me like the original developer had a hammer, and some notion of other tools existing but no interest to actually find those tools.

  • ray10k (unregistered)

    Also, Remy? You put the closing tag of the Cornify link after the span.

  • beef (unregistered)

    Hey, I'm a PLC programmer... Keep your stereotypes to yourself.

  • I'm not a robot (unregistered)
    But there’s no possibly way to check if a certain digit is 1 or not
    I hope you're being sarcastic there. It's hard to tell on the internet.
  • (nodebb)

    Remy, it sure does get easier than this.

  • bvs23bkv33 (unregistered)

    00000110th

  • Kees (unregistered)

    This looks like C# to me ('var ...') which I am not familiar with, but I bet you that

    var value = data.ToString();
    

    actually returns a base 10 representation, not the base 2 that the programmer was looking for...

  • (nodebb)

    “it’s on fire, put it out!”?

    I'd suppose rather “it’s on fire, keep it halfway down!”

  • SplinyJoe (unregistered)

    Ohh, great way to store a number up to 1023 in a 32-bit signed integer field!!

  • (nodebb) in reply to ray10k

    Most likely.

    Maybe someone who started his programming carreer in the previous millennium with shell batch files, HyperTalk, or something similar where everything actually is a string.

  • Paul Neumann (unregistered)

    “it’s on fire, put it out”

    Funny, that's the third time I've heard that today :(

  • DQ (unregistered)

    We didn't start the fire
    It was always burning
    Since the world's been turning
    We didn't start the fire
    No we didn't light it
    But we tried to fight it
    (if we're allowed)

  • (nodebb)

    Holy WTF, Batman!

  • tbo (unregistered) in reply to I'm not a robot

    Not as written.

    If you have a bitmask of 9, you probably mean 0b00001001, but converting 9 to a string is going to be '9', so then you pad that out to '00000009', and check to see if there's a 1 somewhere. There isn't.

    Sure, you'll find 1s if the number is 11 or 1 or 18 or 31, but... not necessarily where you're expecting them.

  • (nodebb)

    I've usually heard the Baader-Meinhof Phenomenon referred to more colloquially as the Balalaika Effect. But now that I look for it, the only reference I can find on the web to that usage, is someone pointing someone to an essay including the phenomenon (apparently something on Social Dynamism by William Green), and I can't find the essay nor even any other reference to it! Anybody? Bueller?

  • Joel B. (unregistered)

    The Baader-Meinhof Phenomenon? I thought it was called reticular perception?

    The real WTF is management not letting developers fix horrendous code like this. Currently in a situation like that. "We don't have time to build it right, but we do have time to build it twice."

  • LCrawford (unregistered) in reply to tbo

    If you have a bitmask of 9, you probably mean 0b00001001, but converting 9 to a string is going to be '9',

    However the function has an unexpected usage pattern of first converting to decimal 1001, then calling DecodeBitmask() . The error-prone, unusual, and misleading convention is the real WTF.

  • I'm not a robot (unregistered) in reply to LCrawford

    Yes. Further, my point is that if you have an integer, it is in fact possible to check whether a particular decimal digit is 1 without converting the number to a string, but I can't tell whether the author realises that.

  • (nodebb)

    It's just binary coded binary with a 0x30 offset.

  • ooOOooGa (unregistered) in reply to I'm not a robot

    OK. Now I am curious.

    If I have an integer value such as 0d8124, I can tell by looking at the string representation in decimal "8124" that there is a '1' in position 2 (assuming 0-based indexing).

    However, the computer is looking at the binary representation of the integer 0b1111110111100. If I wanted to check for a '1' in position 2 of the decimal representation without actually converting it to the string "8124", what would that code look like? Perhaps something with the integer 0d100 (0b1100100)?

  • I'm not a robot (unregistered) in reply to ooOOooGa

    (8124 / 100) % 10 (assuming a language where "/" does integer division, adjust if necessary)

  • spadgas (unregistered) in reply to ooOOooGa

    um. how about (num / 100) % 10?

  • Zenith (unregistered) in reply to Joel B.

    My first real job out of college had a permissions system like this. First column of the user table was the account name and further down was a "binary" string of (you hoped) 1s and 0s. This was FoxPro so I don't judge it too harshly. And one advantage it did have over an INT was that a non-technical user could flip the "bits" if they had to.

  • Peano (unregistered) in reply to ooOOooGa

    If that were impossible, how could the library functions to convert numbers to strings exist?

    Example already shown by the one who is not a robot.

  • (nodebb) in reply to kbielefe

    More like an inversion of the more usual "Binary Coded Decimal": "Decimal Coded Binary". Uses one decimal digit per bit.

  • Dave (unregistered) in reply to Joel B.

    Germany went through a mass panic about BM. To tell extent that many BMW 2002 drivers (whose cars were a favourite of BM) had bumper stickers that said 'I am not a member of BM'.

  • (nodebb)

    Excessive facepalm. Now the back of my head hurts.

  • Donald Knuth (unregistered) in reply to Dave_Aronson

    Hi Buddy - here you go: https://science.howstuffworks.com/life/inside-the-mind/human-brain/baader-meinhof-phenomenon.htm

    Also see 'Frequency Illusion' here: https://en.wikipedia.org/wiki/List_of_cognitive_biases

  • Rogierian (unregistered) in reply to Dave_Aronson

    "The illusion in which a word, a name, or other thing that has recently come to one's attention suddenly seems to appear with improbable frequency shortly afterwards (not to be confused with the recency illusion or selection bias). This illusion is sometimes referred to as the Baader-Meinhof phenomenon" (Wikipedia) also https://science.howstuffworks.com/life/inside-the-mind/human-brain/baader-meinhof-phenomenon.htm

  • PHPLite (unregistered)

    Unfortunately, the software is so fragile and unreliable that no one is willing to let the developers make any changes beyond “it’s on fire, put it out”.

    Stop everything. Add unit tests.

    In the long term you will minimize the time to deliver new features and fix bugs.

  • Friedrice the Great (unregistered) in reply to Joel B.

    "We don't have time to do it right, but we always have time to re-do it."

  • hamstray (unregistered) in reply to ray10k

    actually, seems like he went out of his way to find more complicated tools to do the job.

  • Anon (unregistered)

    No, no, no! This is enterprise code, you see? Why would the programmer lower himself to bitwise operations?

    The company can later sell an update promising improved performance. This is of course assuming that they will ever find out these string operations make the program slow in the first place.

  • ooOOooGa (unregistered) in reply to Peano

    Ah. I didn't say it was impossible. I said that I didn't know how to do it and was curious.

    Try not to pick on a guy too much for actually trying to correct his ignorance ;)

  • Peano (unregistered) in reply to ooOOooGa

    Sorry if you felt that! I seem to have started seeing sarcasm even when absent. I read "OK, Now I am curious" as "Let's see how this person shoots themselves in their foot!"

Leave a comment on “Return of the Mask”

Log In or post as a guest

Replying to comment #496222:

« Return to Article