• j (unregistered) in reply to Code Dependent

    {0, 1, 404} ?

  • (cs) in reply to Pim
    Pim:
    I question the thoroughness of said program though. Did it only test for 0, 1 and 2? So it would have missed bits with value -1, hm?

    But -1 is a valid bit value on systems where bits are signed - the range is -2^(1-1)..2^(1-1)-1 instead of 0..2^1-1. He should test to make sure they are between BIT_MIN and BIT_MAX.

  • funkyb (unregistered)

    There are exactly 10 types of people in the world. Those who know binary, and those who don't.

  • AC (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.

    suppose you have 0000 1111 = 15 what about 0000 1112 ? I guess that would make it 16? If you can only read bytes, you will read 16 and think it's 0001 0000.

    The whole point of the BitVerifier is to find the unusual case of non-bits, assuming a byte is made out of bits will defeat the purpose of the verification process.

  • Captain Oblivious (unregistered) in reply to Dan
    Dan:
    Bit of Hex:
    FinnGamble:
    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.
    No he's not. He is merely forcing the bits to be one of 0, 1, 2, 4, 8, 16, 32, 64, or 128.
    And to think, I always heard that bits could be 0 or 1. But you just said they can also be 2, 5, 8, 16, 32, 64, or 128?!!? I guess they can also be true, false, yes, no, ok, nah, 42, ...

    Google for "Boolean lattice"

  • (cs) in reply to funkyb
    funkyb:
    There are exactly 10 types of people in the world. Those who know binary, and those who don't ... and those who've heard of ternary.
    FTFY!
  • (cs) in reply to Code Dependent
    Code Dependent:
    RBoy:
    Then how can you afford a shave and a haircut?
    0x10 cents.

    Addendum (2009-02-16 13:52): ...allowing for inflation. Of course, when the barbershop ditty was first written, it would have been 0x0A cents.

    Back when the ditty was first written, you could get four shaves and four haircuts for a dollar, so what you say can only be right if there were (0x0a << 2) cents in a byte.

  • (cs) in reply to Your Name
    Your Name:
    Bits are not addressable?

    Okay, obsolete information time! I guess somebody forgot to tell BFEXTU + friends on the 68020 (and above). Essentially these instructions are able to address the entire[*] memory space as one long sequence of bits.

    [*] "entire" on chips with a 24 bit address bus, less with a 32 bit one.

    It wasn't quite that; they couldn't cross word boundaries IIRC, so you're still addressing memory and extracting subword-sized parts in the general case.

  • (cs) in reply to Captain Oblivious
    Captain Oblivious:
    Dan:
    Bit of Hex:
    FinnGamble:
    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.
    No he's not. He is merely forcing the bits to be one of 0, 1, 2, 4, 8, 16, 32, 64, or 128.
    And to think, I always heard that bits could be 0 or 1. But you just said they can also be 2, 5, 8, 16, 32, 64, or 128?!!? I guess they can also be true, false, yes, no, ok, nah, 42, ...

    Google for "Boolean lattice"

    Or "place-value notation", to give an somewhat more fundamental example.

  • Some Random Guy (unregistered) in reply to Code Dependent

    ... I think this unit has a malfunctioning sarcasm unit.

  • Erik (unregistered) 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?

    Agreed. This story makes no sense. It would make sense if the author wrote a program to hash a file's contents and verify it against a list of pre-determined values. But to read a bit in memory and make sure it's 0 or 1. WTF? That's like checking batteries to make sure they only have positive and negative terminals.

  • (cs) in reply to Craftsman
    Craftsman:
    Code Dependent:
    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}.

    Hah, you haven't been in computers long have you? They are Binary! So ranges are always some multiple of 2: {0, 1, FILE_NOT_FOUND, EOF}

    Hah! You young whippersnappers! Why in my day, we didn't have ones and zeroes! We had to use the lowercase L and uppercase o for our bits!!

  • (cs) in reply to Erik
    Erik:
    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?

    Agreed. This story makes no sense. It would make sense if the author wrote a program to hash a file's contents and verify it against a list of pre-determined values. But to read a bit in memory and make sure it's 0 or 1. WTF? That's like checking batteries to make sure they only have positive and negative terminals.

    He said he was bored.

  • (cs) in reply to DaveK
    DaveK:
    Code Dependent:
    RBoy:
    Then how can you afford a shave and a haircut?
    0x10 cents.

    Addendum (2009-02-16 13:52): ...allowing for inflation. Of course, when the barbershop ditty was first written, it would have been 0x0A cents.

    Back when the ditty was first written, you could get four shaves and four haircuts for a dollar, so what you say can only be right if there were (0x0a << 2) cents in a byte.

    Since the lyrics of the ditty are, "Shave and a haircut... ten cents!", it's perfectly in keeping with the math of the rest of this thread that a shave and haircut cost 25 cents at the time.
  • (cs) in reply to Code Dependent
    Code Dependent:
    DaveK:
    Code Dependent:
    RBoy:
    Then how can you afford a shave and a haircut?
    0x10 cents.

    Addendum (2009-02-16 13:52): ...allowing for inflation. Of course, when the barbershop ditty was first written, it would have been 0x0A cents.

    Back when the ditty was first written, you could get four shaves and four haircuts for a dollar, so what you say can only be right if there were (0x0a << 2) cents in a byte.

    Since the lyrics of the ditty are, "Shave and a haircut... ten cents!"
    Not "back when [it] was first written", they weren't. 10 qatloos for the first poster who knows what the real name of the tune originally was. (Hint: think old money. Then think about the OP we're responding to. Then you'll know why there's four of them to the byte or dollar.)
  • nobody (unregistered) in reply to DaveK
    DaveK:
    Not "back when [it] was first written", they weren't. 10 qatloos for the first poster who knows what the real name of the tune originally was. (Hint: think old money. Then think about the OP we're responding to. Then you'll know why there's four of them to the byte or dollar.)

    two bits.

  • phx (unregistered)

    Yeah this guy will grow up into a beautiful flower that will never fix bugs and code around them. Kinda like these guys:

    http://3laws.wordpress.com/2009/01/19/the-first-rule-of-fail-club-is/

  • obvious (unregistered)

    The problem with the code is that hexadecimal doesn't include "10". 1,2,4,5,6,7,8,9,A,B,C,D,E, and F are the only valid hexadecimal numbers.

  • Sarda (unregistered) in reply to Code Dependent

    I, uh, think that was the point of saying that.

  • (cs)

    Yea; like the program I wrote to search for 8 1/2 bit bytes. ;->

    His code does remind me, however, of a published "craps" program from some years ago that computed... sum = randomGen.nextInt(7) + randomGen.nextInt(7) and then tried again whenever 'sum < 2'.

    The odds in that game were a bit off, making the game quite a bit less fun. :-[

  • knotguy (unregistered) in reply to Craftsman

    [quote user="Craftsman"][quote user="Code Dependent"] Hah, you haven't been in computers long have you? They are Binary! So ranges are always some multiple of 2: {0, 1, FILE_NOT_FOUND, EOF}[/quote]

    Actually, it's {0, 1, don't care} http://en.wikipedia.org/wiki/Content-addressable_memory#Ternary_CAMs

  • Jo Bob (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...
    Where's the Wooden Table(tm)??

    CAPTCHA: uxor - You XOR'd?

  • methinks (unregistered) in reply to Anonymous
    Anonymous:
    Are there really this many people on the site who don't get the bit joke?

    There are only 10 kinds of people - those who get binary numbers and those who don't...

  • Crutcher (unregistered) in reply to Code Dependent

    You are leaving out many valid error values, including: COMPUTER_ON_FIRE, COMPUTER_OFF, CTHULU

  • methinks (unregistered) in reply to funkyb
    funkyb:
    There are exactly 10 types of people in the world. Those who know binary, and those who don't.

    darn, you bet me to it... and I too posted it before reading all other comments... ah, well ... shrug

    ;o)

  • methinks (unregistered) in reply to obvious
    obvious:
    The problem with the code is that hexadecimal doesn't include "10". 1,2,4,5,6,7,8,9,A,B,C,D,E, and F are the only valid hexadecimal numbers.

    You don't say...

    Or perhaps my sarcasm detector needs some serious recalibration...

  • methinks (unregistered) in reply to dunawayc
    dunawayc:
    Craftsman:
    Code Dependent:
    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}.

    Hah, you haven't been in computers long have you? They are Binary! So ranges are always some multiple of 2: {0, 1, FILE_NOT_FOUND, EOF}

    Hah! You young whippersnappers! Why in my day, we didn't have ones and zeroes! We had to use the lowercase L and uppercase o for our bits!!

    I heard they didn't even have bits back then...

  • methinks (unregistered) in reply to Charles
    Charles:
    Don't forget Schrodinger's bit - it can be 1 and 0 and the same time.

    Only if it is locked inside an opaque crate or cell and you haven't opened that yet... and it would not really be 0 and 1 at the same time, but more like "smeared out in equal parts", as Schrödinger put it.

  • Boolean logic (unregistered) in reply to Code Dependent
    The set of possible values for a bit is {0, 1, FILE_NOT_FOUND}

    But naturally it is not { 0, 1, Maybe }

  • J Schalken (unregistered)

    Wait, what exactly does the length of HEX_STRING_VALUES have to do with the length of sb?

    If HEX_STRING_VALUES happened to be the entire alphabet - 26 characters - then each character in sb will have 26 possible values...but sb should still contain exactly 6 of them, because the loop should always be executed exactly 6 times.

    Or is my understanding of the code just plain wrong?

  • The Arrow (unregistered)

    Bender: "Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." Fry: "It was just a dream, Bender. There's no such thing as two."

  • Jimmy Jones (unregistered)

    Did you really need to explain the problem to us?

  • John (unregistered) in reply to My name
    My name:
    The smallest addressable space is the byte.

    Does no one remember the TMS34010?

  • JimmyVile (unregistered) in reply to Mio
    Mio:
    Code Dependent:
    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}.

    Bits are easy. Just try using a std_ulogic: {Uninitialized, Unknown, 0, 1, High Impedence, Weak Signal, Weak Low Signal, Weak High Signal, Don't Care}

    FPGAs are fun!

    Woah, I just got major flashbacks from my gradiuation a few years ago. I had the pleasure of working with the Virtex II (or something like that)

  • m&m (unregistered)

    The real WTF is that people do not learn the basic language features/libraries.

    It's all in the standard 'java.lang' package!

    int UPPER = 16777216;//16 ^ 6;
    double d = Math.random() * UPPER;
    int i = (int) d;
    String s = Integer.toHexString(i);
    

    And to have the same formatting:

    String u = "0x" + s.toUpperCase();
    
  • JimmyVile (unregistered) in reply to m&m
    m&m:
    The real WTF is that people do not learn the basic language features/libraries.

    It's all in the standard 'java.lang' package!

    int UPPER = 16777216;//16 ^ 6;
    double d = Math.random() * UPPER;
    int i = (int) d;
    String s = Integer.toHexString(i);
    

    And to have the same formatting:

    String u = "0x" + s.toUpperCase();
    

    It's all in the standard 'java.lang' package!

    java.lang.Int.MAX_VALUE
    

    or

    Math.Random.nextInt()
    

    /bored //so bored

  • m&m (unregistered)
    It's all in the standard 'java.lang' package!

    java.lang.Int.MAX_VALUE

    or

    Math.Random.nextInt()

    /bored //so bored

    No it is not.

    int UPPER = 16777216;//16 ^ 6;

    is 2 ^ 24 or the upper value to have 6 hex digits. Integer.MAX_VALUE is 2 ^ 31 - 1, which is 0x7FFFFFFF (8 digits)

    //annoyed by bored guy

  • ali (unregistered)

    Of course you can have many elements in your booleans, but the number must be a power of two!

    So {0,1,FILE_NOT_FOUND} is evil and against the law of nature. Just add another 2*FILE_NOT_FOUND+1 elements and you're alright.

    Captcha: illum, just what I need.

  • Theo (unregistered) in reply to nah
    nah:
    Easy to fix. Just do a search and replace. Changing every 10 in the result to A, no need to change the array.

    OMG go parse this string: F107C10

  • nah (unregistered) in reply to Sutherlands
    Sutherlands:
    nah:
    Easy to fix. Just do a search and replace. Changing every 10 in the result to A, no need to change the array.
    His fix is just as valid as this one. His just has more 1s and 0s than you would expect from a random function, and yours would have more As than you would expect from a random function. If you're going to do this from other code, treating this like a black box, you're going to get 5-char strings. If you're instead going to change the code, why not just fix the array?...

    Whooosh

  • IByte (unregistered) in reply to the real wtf fool
    the real wtf fool:
    The code is fun, but WTF kind of application would require a random colour generator anyway?
    I can think of several things. Tabkit comes to mind, for instance (although those colours may have been picked from a restricted palette rather than from the entire colour space).
  • Hans (unregistered) in reply to Dan
    Dan:
    Bit of Hex:
    FinnGamble:
    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.
    No he's not. He is merely forcing the bits to be one of 0, 1, 2, 4, 8, 16, 32, 64, or 128.
    And to think, I always heard that bits could be 0 or 1. But you just said they can also be 2, 5, 8, 16, 32, 64, or 128?!!? I guess they can also be true, false, yes, no, ok, nah, 42, ...

    The correct sequence is 2, 4, 6, 8, motorway...

  • (cs) in reply to Hans
    Hans:
    The correct sequence is 2, 4, 6, 8, motorway...
    Actually, it's "2, 4, 6, 8, who do we appreciate?".

    Just like four shaves and haircuts cost "two bits, four bits, six bits, a dollar; all for the [fill in favorite team here] stand up and holler."

  • (cs) in reply to obvious
    obvious:
    The problem with the code is that hexadecimal doesn't include "10". 1,2,4,5,6,7,8,9,A,B,C,D,E, and F are the only valid hexadecimal numbers.
    Nothing slow about this guy but his name, and that's "Lightning".
  • (cs) in reply to methinks
    methinks:
    dunawayc:
    Craftsman:
    Code Dependent:
    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}.
    Hah, you haven't been in computers long have you? They are Binary! So ranges are always some multiple of 2: {0, 1, FILE_NOT_FOUND, EOF}
    Hah! You young whippersnappers! Why in my day, we didn't have ones and zeroes! We had to use the lowercase L and uppercase o for our bits!!
    I heard they didn't even have bits back then...
    When I was young, we used to use arrays of light switches for bits.
  • Addison (unregistered) in reply to methinks
    methinks:
    obvious:
    The problem with the code is that hexadecimal doesn't include "10". 1,2,4,5,6,7,8,9,A,B,C,D,E, and F are the only valid hexadecimal numbers.

    You don't say...

    Or perhaps my sarcasm detector needs some serious recalibration...

    His name is "Obvious". Recalibration indeed.

  • georgems (unregistered) in reply to Mike

    you forgot the duct tape

  • (cs) in reply to Addison
    Addison:
    methinks:
    obvious:
    The problem with the code is that hexadecimal doesn't include "10". 1,2,4,5,6,7,8,9,A,B,C,D,E, and F are the only valid hexadecimal numbers.

    You don't say...

    Or perhaps my sarcasm detector needs some serious recalibration...

    His name is "Obvious". Recalibration indeed.
    I don't think so. There's no sarcasm in stating a simple fact which is already known by everyone, regardless of what name you use.

    Addendum (2009-02-17 08:26): Of course, it would help his cause slightly if he'd included "3"...

  • (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.

    Let me guess. Your job is probably not computer related, and if it is something computer related, it's something like unpacking the boxes in Best Buy's warehouse so the display shelves can be stocked, and sweeping the floor once the shelves are full. Am I right?

  • (cs)
    I somehow never encountered a file with a "two" bit.
    I am really surprised. Considering Windows is such a "two-bit" Operating System.

Leave a comment on “Some Crazy Reason”

Log In or post as a guest

Replying to comment #244263:

« Return to Article