Re: Unique ids
Re: Unique ids
- Subject: Re: Unique ids
- From: Art Isbell <email@hidden>
- Date: Wed, 14 May 2003 08:22:09 -1000
On Wednesday, May 14, 2003, at 12:22 AM, Georg Tuparev wrote:
I need to generate unique ids that I can also use in the url.
Currently I am using something like this:
byte [] buff = new
byte[EOTemporaryGlobalID.UniqueBinaryKeyLength];
EOTemporaryGlobalID.assignGloballyUniqueBytes(buff);
String id = new String(buff);
String encodeStr = encode(id);
Well, this works, but it looks ugly as hell.
Is there a better way to produce unique strings like session ids
(without creating sessions of course ;-)?
Boy I miss NSProcessInfo!
If I recall, NSProcessInfo could provide a globally unique string by
concatenating the host name, process ID, and a time stamp. In a
multithreaded WO app on a multiprocessor computer, it is theoretically
possible that more than one session could create identical strings
using this approach. EOTemporaryGlobalID uses 3 similar values plus a
sequence number that should ensure uniqueness, so this should be
better. But since it is comprised of similar values to those used by
NSProcessInfo, is it really uglier?
Aloha,
Art
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
References: | |
| >Unique ids (From: Georg Tuparev <email@hidden>) |