• First (unregistered)

    First!

  • nah (unregistered)

    Easy to fix. Just do a search and replace. Changing every 10 in the result to A, no need to change the array.

  • StDoodle (unregistered)

    Wow. I find this site entertaining, but often can't follow the coding stuff, as I'm a drafter, not a programmer. When it's immediately obvious to me what's wrong in a code example, you've F'd up big-time!

  • (cs)

    What? You never learnt heptadecimal??!

  • ToHex (unregistered)

    Wow, that's Unicode hex! Multi-byte hex characters!

  • Drew (unregistered)

    Just need to make sure "10" == "A". You could probably do this with another base class, a few interfaces, some operator overloading, some preprocessor commands, a banana...

  • Cats! (unregistered)

    For some crazy reason this comment has 10 words, which doesn't make any sense to me.

  • (cs)

    creating a random number using the stringbuilder? WTF?

    Setting a visible color (okay, buttumption based on naming) using a random? Sure this wasn't some kind of a college exercise?

  • (cs)

    Ah, good old Base 16-and-a-bit

  • Westbury (unregistered) in reply to lauwersw

    I only use heptadecimal when I have a lot of "two" bits come back from my BitVerifier

  • Bosshog (unregistered)

    The goggles, they do nothing!

  • Mike (unregistered) in reply to Drew
    Drew:
    Just need to make sure "10" == "A". You could probably do this with another base class, a few interfaces, some operator overloading, some preprocessor commands, a banana...

    Is this the MacGyver approach to coding? Wouldn't you need a paper clip and a rubber band then too?

  • My name (unregistered)

    One time, out of boredom, I wrote a little utility called BitVerifier. It would loop over a folder and check every bit of each file.

    I'd question it did. The smallest addressable space is the byte.

  • (cs) in reply to My name
    My name:
    > I'd question it did. The smallest addressable space is the byte.

    So? Read a byte and check every bit. What's the problem?

  • (cs)

    making "10" == "A" doesn't solve the problem, because "10" can occur independently (out of "1" + "0") thus creating a "5" char long number. Also, and doing this would also increase the weight of "A" in the random string generation.

  • blub (unregistered) in reply to seconddevil
    seconddevil:
    making "10" == "A" doesn't solve the problem, because "10" can occur independently (out of "1" + "0") thus creating a "5" char long number. Also, and doing this would also increase the weight of "A" in the random string generation.

    No way!?!?!?!?!?1111111

  • (cs) in reply to My name
    My name:
    > One time, out of boredom, I wrote a little utility > called BitVerifier. It would loop over a folder and > check every bit of each file.

    I'd question it did. The smallest addressable space is the byte.

    If a byte was made out of cream-cheese, I'd agree with you. Unfortunately, it's usually made out of bits.

  • Someone (unregistered)

    The real WTF here is that you wrote a utility that looped though files checking if each Bit is a 1 or 0...

    Am I missing something or is that kind of redundant?

  • (cs) in reply to Someone
    Someone:
    The real WTF here is that you wrote a utility that looped though files checking if each *Bit* is a 1 or 0...

    Am I missing something or is that kind of redundant?

    Yes, you are missing something.

  • Harry Carey (unregistered) in reply to Mr B
    Mr B:
    My name:
    > One time, out of boredom, I wrote a little utility > called BitVerifier. It would loop over a folder and > check every bit of each file.

    I'd question it did. The smallest addressable space is the byte.

    If a byte was made out of cream-cheese, I'd agree with you. Unfortunately, it's usually made out of bits.

    But what if it was made of spare ribs? Would ya eat it?

  • (cs) in reply to Mr B
    Mr B:
    Someone:
    The real WTF here is that you wrote a utility that looped though files checking if each *Bit* is a 1 or 0...

    Am I missing something or is that kind of redundant?

    Yes, you are missing something.

    Did you hear the whooosh, Someone?

  • Nigel Tufnel (unregistered)

    I think that there is a Spinal Tap reference lurking in here somewhere. It's better than ordinary hexadecimal it goes to 17. Sort of.

  • (cs) in reply to Bosshog
    Bosshog:
    The goggles, they do nothing!

    Attention! CommentVerifier discovered that your comment does not. Please correct.

  • (cs)

    The code is fun, but WTF kind of application would require a random colour generator anyway?

  • FinnGamble (unregistered) in reply to My name
    My name:
    I'd question it did. The smallest addressable space is the byte.

    Lol n00b.

    int c=fgetc(infile);
    int bit=c/128;
    if(bit!=0 && bit!=1)
      printf("Error! Bit=%d\n",bit);
    bit=c/64;
    if(bit>2)
      bit=bit-2;
    if(bit!=0 && bit!=1)
      printf("Error! Bit=%d\n",bit);
    bit=c/32;
    if(bit>4)
      bit=bit-4;
    if(bit>2)
      bit=bit-2;
    if(bit!=0 && bit!=1)
      printf("Error! Bit=%d\n",bit);
    bit=c/16;
    if(bit>8)
      bit=bit-8;
    if(bit>4)
      bit=bit-4;
    if(bit>2)
      bit=bit-2;
    if(bit!=0 && bit!=1)
      printf("Error! Bit=%d\n",bit);
    bit=c/8;
    if(bit>16)
      bit=bit-16;
    if(bit>8)
      bit=bit-8;
    if(bit>4)
      bit=bit-4;
    if(bit>2)
      bit=bit-2;
    if(bit!=0 && bit!=1)
      printf("Error! Bit=%d\n",bit);
    bit=c/4;
    if(bit>32)
      bit=bit-32;
    if(bit>16)
      bit=bit-16;
    if(bit>8)
      bit=bit-8;
    if(bit>4)
      bit=bit-4;
    if(bit>2)
      bit=bit-2;
    if(bit!=0 && bit!=1)
      printf("Error! Bit=%d\n",bit);
    bit=c/2;
    if(bit>64)
      bit=bit-64;
    if(bit>32)
      bit=bit-32;
    if(bit>16)
      bit=bit-16;
    if(bit>8)
      bit=bit-8;
    if(bit>4)
      bit=bit-4;
    if(bit>2)
      bit=bit-2;
    if(bit!=0 && bit!=1)
      printf("Error! Bit=%d\n",bit);
    bit=c;
    if(bit>128)
      bit=bit-128;
    if(bit>64)
      bit=bit-64;
    if(bit>32)
      bit=bit-32;
    if(bit>16)
      bit=bit-16;
    if(bit>8)
      bit=bit-8;
    if(bit>4)
      bit=bit-4;
    if(bit>2)
      bit=bit-2;
    if(bit!=0 && bit!=1)
      printf("Error! Bit=%d\n",bit);
    

    That's, afaik, the shortest, easiest and most efficient way to get to the integer values of bits in the C programming language.

  • (cs) in reply to Drew
    Drew:
    Just need to make sure "10" == "A". You could probably do this with another base class, a few interfaces, some operator overloading, some preprocessor commands, a banana...
    Don't forget the satanic rituals and goat's blood. You will after all need some thrall's to maintain that hellish nightmare.
  • (cs) in reply to FinnGamble
    FinnGamble:
    My name:
    I'd question it did. The smallest addressable space is the byte.

    Lol n00b.

    int c=fgetc(infile);
    ...
    if(bit!=0 && bit!=1)
      printf("Error! Bit=%d\n",bit);
    

    That's, afaik, the shortest, easiest and most efficient way to get to the integer values of bits in the C programming language.

    If your irony detector hasn't been calibrated for some time, count until 0x10 before replying to this comment...

  • some crazy chap (unregistered) in reply to the real wtf fool
    the real wtf fool:
    Mr B:
    Someone:
    The real WTF here is that you wrote a utility that looped though files checking if each *Bit* is a 1 or 0...

    Am I missing something or is that kind of redundant?

    Yes, you are missing something.

    Did you hear the whooosh, Someone?

    [pseudo] if bit_value == 1 return TRUE elif bit_value == 0 return TRUE [/pseudo]

    CAPTCHA 'nobis', latin for that guy no one much likes (me)

  • Anonymous (unregistered)

    That one I can agree. Definetely a wtf.

  • Lennart (unregistered)

    Seems like a junior programmer, which made a small error and blind stared on it for a while and finally giving up. Can happen. His mentor should help him and both move along.

    Don't tell me nothing like this ever happened to you people.

  • Khôi (unregistered)

    omg! someone found out how scandisk is implemented!

  • Blackice (unregistered) in reply to FinnGamble

    Have you never heard of a loop??

    int c=fgetc(infile);

    for(int mask = 1; i <= 128; i *= 2) { bit = c & mask;

    if(bit!=0 && bit!=1) printf("Error! Bit=%d\n",bit); }

  • Blackice (unregistered) in reply to Blackice

    Err...don't reply before coffee...

    if(bit!=0 && bit!=1)

    // should be

    if(bit!=0 && bit!=mask)

  • My name (unregistered) in reply to Kefer
    Kefer:
    My name:
    > I'd question it did. The smallest addressable space is the byte.

    So? Read a byte and check every bit. What's the problem?

    No a problem per se. But it may as well be stored in ternary on the disk for all you'd know. When you say "check the bits", you don't check physical bits on your physical drive. Nor on any physical memory. Your program semantics include operators that yield ones or zeros. Not the same thing.

    But quite some hair-splitting.

    Alright, I'll get my coat.

  • Love it (unregistered)

    I love it when people can laugh at themselves and even share the joke... I wrote my share of code like that during my early years... code that just doesn't make sense (although I don't think I every tried to find a bit that wasn't 0 or 1).

  • (cs)
    I somehow never encountered a file with a "two" bit.
    Of course not. The set of possible values for a bit is {0, 1, FILE_NOT_FOUND}.
  • FinnGamble (unregistered) in reply to Blackice
    Blackice:
    bit = c & mask;

    AH, but by using the AND operation you will lose data. You are, essentially, forcing the bits to be one or zero.

    Besides, I like the aesthetics of my code better. Each section between the printfs gets progressively longer in an eye-pleasing way.

  • (cs) in reply to My name
    My name:
    Kefer:
    My name:
    > I'd question it did. The smallest addressable space is the byte.

    So? Read a byte and check every bit. What's the problem?

    No a problem per se. But it may as well be stored in ternary on the disk for all you'd know.

    Obviously this has never been encountered in the real world as he clearly stated he had never run into a '2' bit.

  • Lennart (unregistered) in reply to Love it
    Love it:
    I love it when people can laugh at themselves and even share the joke... I wrote my share of code like that during my early years... code that just doesn't make sense (although I don't think I every tried to find a bit that wasn't 0 or 1).

    Indeed. When I look back at the first project I wrote, I kinda have to smile as well. If this was a person with years of experience I'd say it's ok to get him from the project. In this case, where I assume that it's a new kid's mistake, it's silly to keep him away from a project.

  • Anonymous (unregistered)

    Aww, that's the cutest WTF I've seen in a long time. I get annoyed when I see good coders makes stupid mistakes but when you see something like this you realise that the coder didn't even understand a fundamental concept of computer science. It just makes me want to give them a big hug as I tell them that software development is not the right career path for them and kick them out the door.

  • My name (unregistered) in reply to hatterson
    hatterson:
    My name:
    Kefer:
    My name:
    > I'd question it did. The smallest addressable space is the byte.

    So? Read a byte and check every bit. What's the problem?

    No a problem per se. But it may as well be stored in ternary on the disk for all you'd know.

    Obviously this has never been encountered in the real world as he clearly stated he had never run into a '2' bit.

    Well, that's another problem with Jake's report. Obviously in the real world, you'd never run into a '2'. No, you'd simply step on it without noticing. For they are really really tiny wee bits. Even smaller than their cousins bit 1 and bit 0, as the Unified String Theory (at least its UTF-8 variant) teaches us [citation needed].

  • jordanwb (unregistered)

    Why would a bit be something other than 0 or 1?

  • Anonymous (unregistered)

    Are there really this many people on the site who don't get the bit joke?

  • (cs) in reply to jordanwb
    jordanwb:
    Why would a bit be something other than 0 or 1?

    Maybe you're just not sure. As Heisenberg's Uncertainty Principle of Computer Science teaches, the more sure you are of the value of a bit the less sure you are of it's position on the disk

    This was just built to verify that someone didn't get overzealous in finding out exactly where a bit was and force it to abandon a value of 1 or 0 since 50% is too high a chance to know the value of a bit if you're absolutely sure of its position.

  • MainCoder (unregistered) in reply to jordanwb
    jordanwb:
    Why would a bit be something other than 0 or 1?

    You are not the sharpest knife in the drawer are you?

  • JimmyVile (unregistered) in reply to FinnGamble
    FinnGamble:
    My name:
    I'd question it did. The smallest addressable space is the byte.

    Lol n00b. That's, afaik, the shortest, easiest and most efficient way to get to the integer values of bits in the C programming language.

    for (int c = fgetc(infile); c < 1 || c&(-2) > 1; c>>1); 
    if (c > 0) printf("Error! bit with value higher than 1 found!\n");
    
  • JimmyVile (unregistered) in reply to JimmyVile

    Yes I got the joke, I'm just bored waiting for a large compile job.

  • Anonymous (unregistered) in reply to JimmyVile
    JimmyVile:
    Yes I got the joke, I'm just bored waiting for a large compile job.
    Yeah, sure, whatever you say (I'm sure you have to do loads of compiling in the data entry office)...
  • DivineGod (unregistered) in reply to Cats!
    Cats!:
    For some crazy reason this comment has 10 words, which doesn't make any sense to me.

    This has 10 words too.

  • (cs) in reply to DivineGod
    DivineGod:
    This has 10 words too.
    No. This.

Leave a comment on “Some Crazy Reason”

Log In or post as a guest

Replying to comment #:

« Return to Article