• a (unregistered)

    I like this!

  • Dave (unregistered) in reply to a

    You're the only one, I don't know why I even come here anymore.

    captcha: plaga, this site has caught the plaga

  • Mathias (unregistered)
    "Oh," Andy said, embarrassed. "I see. But what are the chances of that?"
    About one in sixteen, statistically speaking.
  • :) (unregistered)
    article:
    After all of 10 minutes, Jeremy discovered the root of the problem:
    <VB>
    
  • K (unregistered) in reply to Mathias
    Mathias:
    "Oh," Andy said, embarrassed. "I see. But what are the chances of that?"
    About one in sixteen, statistically speaking.

    Actually, it was two characters, so 16^2 = 256.

  • trtwtf (unregistered)

    You keep using the word "unique". I do not think it means what you think it means.

  • Hortical (unregistered) in reply to K
    oblivious pedant:
    Mathias:
    "Oh," Andy said, embarrassed. "I see. But what are the chances of that?"
    About one in sixteen, statistically speaking.

    Actually, [s]it was two characters, so 16^2 = 256.[/s] I type before I think

  • (cs) in reply to K
    K:

    Actually, it was two characters, so 16^2 = 256.

    Troll.

  • No Windoze! (unregistered)

    This couldn't happen in Linux.

  • (cs)
    "...and I'm going to have to spend all afternoon cleaning the mess for just this one duplicate."
    All afternoon? Why? He'd have to be a really slow worker, or a total idiot.
    // Swap two chars of dataset ID 
    // to create processed ID
    Oh.
  • DaveE (unregistered) in reply to K

    he was correct initially. the probability of one char equaling the character that preceded it (no matter the char) is 1 in 16. the probability of both the chars being 'A' (for instance' is 1 in 256.

  • maths (unregistered) in reply to K

    Of which there are 16 combinations where the same digit is repeated, so 16 / 16^2 = 1 /16 = one in sixteen.

  • WC (unregistered) in reply to DaveE

    No, 1 in 256 is the changes of the 2 characters being a certain character.

    The chance that the second character is the same as the first is only 1 in 16.

    Look at it this way: The first character is given to you. You don't need to worry about it, it's already there. The second character is the one we're predicting the probability of.

    A? - 1 in 16 chance that ? is an A B? - 1 in 16 chance that ? is a B

    etc.

  • vindico (unregistered) in reply to WC

    Andy is one of the many dicky wannabe programmers that are out there producing shitty software. There should be a law and a minimum 5-year sentence for stupid programmers.

  • Decius (unregistered) in reply to Mathias

    Actually, it's 1 in 1 for important cases, and 0 for test cases. As in, every time you test it, it works, but every time you use it for something important, it fails.

  • jrh (unregistered)

    So, to fix this they need to go back to where they are creating the DatasetID, check to see if the first 2 characters match and if they do create a new guid until they don't. Amiright?

  • anon (unregistered) in reply to vindico
    vindico:
    Andy is one of the many dicky wannabe programmers that are out there producing shitty software. There should be a law and a minimum 5-year sentence for stupid programmers.

    Need more people designing for quality rather than testing for quality (testing for quality just means it passed your tests)

  • dguthurts (unregistered)

    Identity field anyone?

  • Schnapple (unregistered)

    Not that I mind, but isn't this an old one?

  • Anonymous (unregistered)

    Can we consider that the probability of one Windows programmer not knowing what a GUID is, is also 1 in 16?

    Captcha: genitus. Yeah, a brillant one.

  • pa (unregistered)

    Should have used the ScottGUID instead.

  • (cs) in reply to WC
    WC:
    No, 1 in 256 is the changes of the 2 characters being a certain character.

    The chance that the second character is the same as the first is only 1 in 16.

    Look at it this way: The first character is given to you. You don't need to worry about it, it's already there. The second character is the one we're predicting the probability of.

    A? - 1 in 16 chance that ? is an A B? - 1 in 16 chance that ? is a B

    etc.

    It's fun to ask people the chance of being born on the same day of the week as yourself. Assuming they at least know the bare minimum about odds and multiplication, about 90%* will say 1 in 49.

    Yes, I have a strange definition of fun.

    *number pulled out of my ass.

  • (cs)

    Technically Andy was right in saying "it's bound to happen sooner or later"

    Later just happens to be several universe lifetimes later in this case

  • (cs) in reply to dguthurts
    dguthurts:
    Identity field anyone?

    Nope:

    The WTF:
    The tricky part in all this was that the processing application would never know how many IDs were issued or what IDs had been issued
  • Anon (unregistered)

    For each of the 16 characters, there is a 1/16 * 1/16 chance to have that character repeated.

    Add all those probabilities up (1/256 + 1/256 ..., 16 times) and you get 1/16.

  • Anon (unregistered)

    So, what would the solution be? Append U to GUID to make the unprocessed one, and then replace the first U with P to make the processed one?

  • Synchronos (unregistered) in reply to DaveE
    DaveE:
    the probability of one char equaling the character that preceded it (no matter the char) is 1 in 16.
    WC:
    The chance that the second character is the same as the first is only 1 in 16.
    DaveE:
    the probability of both the chars being 'A' (for instance' is 1 in 256.
    WC:
    No, 1 in 256 is the changes of the 2 characters being a certain character.

    What's the probability of misreading comments on the Internets? Approximately 1 in 1.

  • (cs) in reply to Anon
    Anon:
    So, what would the solution be? Append U to GUID to make the unprocessed one, and then replace the first U with P to make the processed one?

    If you need a different ID for a processed dataset and an unprocessed one then you generate a new GUID.

    Why over complicate things. If your problem is 'I need a new GUID' then just generate a new GUID

  • Lies, Damn Lies and Probability (unregistered) in reply to Anon
    Anon:
    For each of the 16 characters, there is a 1/16 * 1/16 chance to have that character repeated.

    Add all those probabilities up (1/256 + 1/256 ..., 16 times) and you get 1/16.

    For all of you who are confused:

    let's assume that there are only 3 letters in the alphabet - A ,B and C, the options are:

    AA AB AC BA BB BC CA CB CC

    or 3^2 = 9 options. the fact that the second character is identical to the first one is not relevant.

    the code switches the first 2 chars and then appends them in the original order to itself, so that:

    AA = AAAA AB = BAAB AC = CAAC BA = ABBA BB = BBBB BC = CBBC CA = ACCA CB = BCCB CC = CCCC

    you still have the orig 9 options so you get 3^2 alternatives, which gives you a 1/9 chance for each of these.

    the calculation remains n^2 where n is the number of letters in the alphabet.

  • maths (unregistered) in reply to vindico
    vindico:
    Andy is one of the many dicky wannabe programmers that are out there producing shitty software. There should be a law and a minimum 5-year sentence for stupid programmers.

    We wouldn't have a software industry.

  • (cs) in reply to Lies, Damn Lies and Probability
    Lies:
    the code switches the first 2 chars and then appends them in the original order to itself...
    Which code snippet did you read?
  • maths (unregistered) in reply to Lies, Damn Lies and Probability
    Lies:

    AA = AAAA AB = BAAB AC = CAAC BA = ABBA BB = BBBB BC = CBBC CA = ACCA CB = BCCB CC = CCCC

    you still have the orig 9 options so you get 3^2 alternatives, which gives you a 1/9 chance for each of these.

    the calculation remains n^2 where n is the number of letters in the alphabet.

    Sure, a 1 in 9 chance for any given combination, but that's not the question at hand. As your example shows for a three character alphabet, this happens 3 of 9 times, which is 1 in 3.
  • ih8u (unregistered) in reply to Dave
    Dave:
    You're the only one, I don't know why I even come here anymore.

    Translation: I don't feel cool, important, superior, or even justified in my sluggish existence unless I don't like things that you like. See how awesome I am? I'm just so miserable because things aren't awesome enough for me.

    Why don't you join the other forum monkeys and try and figure out the probability that shit happens which, by the way, is 103%. You see, it happens ALL THE TIME, and sometimes twice.

  • The New Warden (unregistered) in reply to maths
    maths:
    vindico:
    Andy is one of the many dicky wannabe programmers that are out there producing shitty software. There should be a law and a minimum 5-year sentence for stupid programmers.

    We wouldn't have a software industry.

    i donnow i've been hearing great things about prisoner labor. hard working, dedicated and dirt cheap. like outsourcing to india used to be...

  • Jem (unregistered)

    Are you all seriously arguing about 8th grade math? Getting it right doesn't make you look smart, you know.

  • oheso (unregistered)

    I predict a bunch more comments about the odds of this causing a problem, and a bunch more comments about how this is because of all those stupid programmers on Platform X. I'd say the odds of this are 16/16.

    The real entertainment of this site is watching commenters get into pissing wars about stuff that's totally incidental to the WTF -- particularly those that try to rewrite the WTF code so it works, vs. just acknowledging it's a WTF and moving on.

  • (cs) in reply to Jem
    Jem:
    Are you all seriously arguing about 8th grade math?
    What else are 8th grade math nerds to do during summer break?
  • (cs)

    shabolubalust!

  • Bruce W (unregistered) in reply to hatterson
    hatterson:
    Technically Andy was right in saying "it's bound to happen sooner or later"

    Later just happens to be several universe lifetimes later in this case

    10^1234 years in the future, on a Friday at 4:55PM -- "DAMN! I knew that we would get a duplicate GUID! My 10^657 great-grandfather Andy was right!"

  • Prison coder #19232132 (unregistered) in reply to boog
    boog:
    Lies:
    the code switches the first 2 chars and then appends them in the original order to itself...
    Which code snippet did you read?

    some of us can read code, others can only read comments: it says:

    // Swap two chars of dataset ID // to create processed ID

    but it does (i added comments so you can read it ;) ) : //get a sting out of a mysterious guid var dsID = dataSetGuid.ToString(); //create a string builder to perform transform var pdsID = new StringBuilder(); //append second char from dsID pdsID.Append(dsID[1]); //append first char from dsID pdsID.Append(dsID[0]); //append the first chars from ID (in their original order) pdsID.Append(dsID.Substring(2)); //create a guid from the 4 char string called pdsID return new Guid(pdsID.ToString());

  • oheso (unregistered) in reply to Bruce W
    Bruce W:
    My 10^657 great-grandfather Andy was right!"

    I'm not sure we need to worry about Andy reproducing

  • Some damn Yank (unregistered)

    // Swap two chars of dataset ID // to create processed ID var dsID = dataSetGuid.ToString(); var pdsID = new StringBuilder(); pdsID.Append(dsID[1]); pdsID.Append(dsID[0]); pdsID.Append(dsID.Substring(2)); return new Guid(pdsID.ToString());

    Well, there's your problem. That should be

    var dsID = dataSetGUID.ToString();

    Of course your Guid isn't unique - only GUIDs are unique, silly.

  • Lies, Damn Lies and WTF (unregistered) in reply to maths
    maths:
    Lies:

    AA = AAAA AB = BAAB AC = CAAC BA = ABBA BB = BBBB BC = CBBC CA = ACCA CB = BCCB CC = CCCC

    you still have the orig 9 options so you get 3^2 alternatives, which gives you a 1/9 chance for each of these.

    the calculation remains n^2 where n is the number of letters in the alphabet.

    Sure, a 1 in 9 chance for any given combination, but that's not the question at hand. As your example shows for a three character alphabet, this happens 3 of 9 times, which is 1 in 3.

    huh??

    what happens 3 out of 9 times???

  • (cs) in reply to boog
    boog:
    Jem:
    Are you all seriously arguing about 8th grade math?
    What else are 8th grade math nerds to do during summer break?

    Wow, I feel like such a loser. I didn't learn this stuff until my fifth year of junior college.

  • Jerry (unregistered) in reply to jrh
    jrh:
    So, to fix this they need to go back to where they are creating the DatasetID, check to see if the first 2 characters match and if they do create a new guid until they don't. Amiright?
    No, no no! That will use up too many guids, aren't you paying attention? If the first two characters are the same, just swap the first and the third.
  • (cs) in reply to Bruce W
    Bruce W:
    hatterson:
    Technically Andy was right in saying "it's bound to happen sooner or later"

    Later just happens to be several universe lifetimes later in this case

    10^1234 years in the future, on a Friday at 4:55PM -- "DAMN! I knew that we would get a duplicate GUID! My 10^657 great-grandfather Andy was right!"

    You missed that it would be the Friday before a long weekend, or the Friday before you leave on vacation.

  • Fred (unregistered) in reply to maths
    maths:
    vindico:
    Andy is one of the many dicky wannabe programmers that are out there producing shitty software. There should be a law and a minimum 5-year sentence for stupid programmers.
    We wouldn't have a software industry.
    Are you citing that as a bug or a feature?
  • oheso (unregistered) in reply to Fred
    Fred:
    Are you citing that as a bug or a feature?

    +1

  • (cs) in reply to Prison coder #19232132
    Prison coder #19232132:
    boog:
    Which code snippet did you read?
    some of us can read code, others can only read comments
    You're cute, but that doesn't answer my question.
    Prison coder #19232132:
    //append the first chars from ID (in their original order) pdsID.Append(dsID.Substring(2));
    What kind of ass-backwards language has a substring form that takes a length with no start index? Even VB does this right.
  • Carl (unregistered) in reply to Anon
    Anon:
    So, what would the solution be? Append U to GUID to make the unprocessed one, and then replace the first U with P to make the processed one?
    Ahem... you put data in a data column. The ID is just for the ID, not the ID+Status. So the requirement for the ID to change when the status changes is TRWTF.

Leave a comment on “A More Unique Identifier”

Log In or post as a guest

Replying to comment #:

« Return to Article