list@carlestam.com wrote on 9/21/2010 9:36 PM: > The thing that made me hesitant towards knop_unique and other > techniques to get a unique string that really just aim for a random > one just happened.
In order to return a unique ID, the tag must return an ID that can never again be generated for the rest of time. That immediately requires the ID to be tied to a timestamp that has as small of resolution as possible. Even then, if multiple requests are generated quickly, you might still see duplicates, so in addition to the timestamp, you must also generate a random portion as well; but note, there's a very very small chance that you'll still see a collision. For it to be bullet-proof, you'd have to force the tag to space out the generating requests to as long as the smallest resolution of time that you have; that is, if you have a timestamp that only goes to the nearest second, then the requests must be spaced out at least 1 second apart to ensure they remain unique.
> I have some code to generate a bunch of unique ids that can be > inserted into an excel table for import into Mysql. Right now the > import failed because of a duplicate key. This was a table with 238 > records.
For kicks, I ran knop_unique, lp_string_random and lasso_uniqueid 5000 times each to see how many collisions occurred. Knop_unique and lasso_uniqueid both had 1 collision, lp_string_random had none. Most likely due to lp_string_random being 20 characters long vs. 13 chars for knop_unique.
The tests are below if you want to try it yourself. Oh, I used map->seek, you'll have to rewrite it if you don't have it installed. If you want to install it, this goes into the main LassoStartup:
LP8 => pair: (7F000001167ce39169Qqno27B0FC)=(2) ======================================================= -- ############################################################# This message is sent to you because you are subscribed to the mailing list <knop@lists.montania.se>. To unsubscribe, E-mail to: <knop-off@lists.montania.se> Send administrative queries to <knop-request@lists.montania.se> List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html Project homepage http://montania.se/projects/knop/ Google Code has the latest downloads at http://code.google.com/p/knop/
Sep 22
Bil Corry Re: Word of warning knop_unique
Sep 22, 2010; 00:26
Bil Corry
Re: Word of warning knop_unique
Sep 22
list Word of warning knop_unique
Sep 22, 2010; 14:36
list
Word of warning knop_unique
Sep 22
list Re: Word of warning knop_unique
Sep 22, 2010; 17:01
list
Re: Word of warning knop_unique
Search
Lasso Programming
This site manages and broadcasts several email lists pertaining to Lasso Programming and technologies related and used by Lasso developers. Sign up today!