- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
I like this!
Admin
You're the only one, I don't know why I even come here anymore.
captcha: plaga, this site has caught the plaga
Admin
Admin
Admin
Actually, it was two characters, so 16^2 = 256.
Admin
You keep using the word "unique". I do not think it means what you think it means.
Admin
Admin
Troll.
Admin
This couldn't happen in Linux.
Admin
Admin
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.
Admin
Of which there are 16 combinations where the same digit is repeated, so 16 / 16^2 = 1 /16 = one in sixteen.
Admin
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.
Admin
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.
Admin
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.
Admin
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?
Admin
Need more people designing for quality rather than testing for quality (testing for quality just means it passed your tests)
Admin
Identity field anyone?
Admin
Not that I mind, but isn't this an old one?
Admin
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.
Admin
Should have used the ScottGUID instead.
Admin
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.
Admin
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
Admin
Nope:
Admin
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.
Admin
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?
Admin
What's the probability of misreading comments on the Internets? Approximately 1 in 1.
Admin
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
Admin
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.
Admin
We wouldn't have a software industry.
Admin
Admin
Admin
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.
Admin
i donnow i've been hearing great things about prisoner labor. hard working, dedicated and dirt cheap. like outsourcing to india used to be...
Admin
Are you all seriously arguing about 8th grade math? Getting it right doesn't make you look smart, you know.
Admin
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.
Admin
Admin
shabolubalust!
Admin
Admin
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());
Admin
I'm not sure we need to worry about Andy reproducing
Admin
// 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.
Admin
huh??
what happens 3 out of 9 times???
Admin
Wow, I feel like such a loser. I didn't learn this stuff until my fifth year of junior college.
Admin
Admin
You missed that it would be the Friday before a long weekend, or the Friday before you leave on vacation.
Admin
Admin
+1
Admin
Admin