I must say that I am constantly amused by the nanniness of the Apple discussion 
lists, telling people what is safe and what is dangerous. There is nothing 
dangerous about bit-twiddling code. You test it til it works and then it works 
forever. It doesn't develop bugs later. My goal was to use the 128 bits of a 
UUID and encode them for use in genealogical database applications using the 
smallest record id strings possible. My choice was to break the 128-bits into 
22 6-bit sequences and encode each 6-bit sequence as a simple character. This 
is good, honest, easy to write, easy to debug software.

In my application databases can be very large, having millions if not billions 
of records. The goal is that every instance of the application, wherever it is 
being run, will generate record ids that are not only unique to itself, but to 
every other instance of the application. In this way people can share 
information with one another knowing with assurance that any data imported from 
a database created by another instance of the program will never have id 
clashes. It is not intended that massive numbers of records be transferred over 
the network, though they could be, just that data can be shared between 
databases to any extent with no clashes. There are other benefits such a system 
has for genealogical data, but what I have described here is good enough.

Tom "danger is my middle name" Wetmore


On May 14, 2010, at 1:00 PM, Jens Alfke wrote:

> (2) If you do need to convert to string, it would be safer to use an existing 
> Base64 converter rather than writing your own as you've done. This kind of 
> bit-twiddling code is very prone to error. Probably the quickest way is to 
> use the Base64 support in the OpenSSL library; a bit of searching in the list 
> archives should turn up some sample code.
> 
> (3) I'm sort of confused by Thomas Wetmore's comment that "my application 
> generates billions of [unique ids]". That's way too many to be sending over 
> the network, so these must be used locally. But in that case, generating 
> unique IDs becomes much easier, and the IDs a lot smaller: just increment a 
> 32-bit counter.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to