[Yanel-dev] Unique IDs
Nigel Runnels-Moss
n.runnels-moss at sourcesense.com
Wed Jan 12 14:29:12 CET 2011
There are issues with UUID shortening, not least of which they cease to
become unique...
How about this?
new_sequence_id =3D=3D previous_sequence_id++;
Starts at 0. Easy!
N.
--
P.S. In all seriousness, the Use Case for UUIDs is quite different from the
Use Case for Tinyurl (or similar URL shorteners).
Do you need:
- Uniqueness? (Totally, or 'best endeavours'?)
- Distributed generation?
- Human readability?
- Human user entry?
- Meaningfulness?
- ...
On Wed, Jan 12, 2011 at 10:17 AM, Michael Wechner <michael.wechner at wyona.com
> wrote:
> On 1/12/11 8:38 AM, Balz Schreier wrote:
>
> Dear all,
>
> Sometimes we need unique IDs, for identifying a session, a cookie or
> other things.
>
> Usually we use the UUID class that comes with Java SE:
>
> UUID.randomUUID().toString() --> 67849f28-c0af-46c7-8421-94f0642e5d4d
> (128 Bits)
>
> But that is very long and maybe not suitable if you require people to
> enter that ID in a form on your web site:
>
>
> what about something like
>
> *http://tinyurl.com/49ygnbx
>
> ?
>
> Cheers
>
> Michael
> *
>
>
>
> Do you have experience with other number generators?
>
> I see that UUID has also other methods, e.g.:
>
> UUID.randomUUID().getLeastSignificantBits() --> 6174657925133947722 (64
> Bits)
>
> UUID.randomUUID().getMostSignificantBits() --> 5706839542716611039 (64
> Bits)
>
>
>
> I was recently pointed to this URL where you can generated IDs by
> configuring the length and the used characters (digits only etc.):
>
> http://www.thegeeks.us/index.php/Random_Password_Generator_Writen_In_Java
>
>
> I also posted on stackoverflow.com this question:
>
>
> http://stackoverflow.com/questions/4666647/how-to-create-user-friendly-un=
ique-ids-uuids-or-other-unique-identifiers-in-java
>
>
> Cheers
>
> Balz
>
>
>
> --
> Yanel-development mailing list Yanel-development at wyona.com
> http://lists.wyona.org/cgi-bin/mailman/listinfo/yanel-development
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wyona.org/pipermail/yanel-development/attachments/2011011=
2/f8caf4cd/attachment.htm
More information about the Yanel-development
mailing list