UUIDs.. you know you want them

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, LCMark

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: UUIDs.. you know you want them

Post by mwieder » Sat May 04, 2013 12:36 am

Considering that a mobile app can't modify itself, the uuid would only be in memory for the length of time the app is running. In that case we could just generate a random uuid. And that's only in the case where a mobile app is actually generating an object. And consuming its uuid.

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: UUIDs.. you know you want them

Post by monte » Sat May 04, 2013 12:50 am

I don't think there's a huge problem with random UUIDs either way because the chance of conflict in a 128 bit number is incredibly small... Like I said before... I'm starting to think even the chance of conflict in a 64 bit number is sufficiently low for our purposes and if it's the choice between that and what we have I'd choose that... moving to 128 bit IDs and all that involves is after all a much bigger change than just moving from ID being uint4 to it being uint64_t and generating it randomly rather than sequentially...
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: UUIDs.. you know you want them

Post by mwieder » Sat May 04, 2013 1:01 am

I forget now... was there something wrong with the BSD license used by libuuid? (although looking at the code it seems to generate just type 1 and type 4 uuids).

https://github.com/karelzak/util-linux/ ... er/libuuid

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: UUIDs.. you know you want them

Post by monte » Sat May 04, 2013 1:14 am

Er... I can't remember if that's the one I looked at. I looked at one in detail and it ended up requiring POSIX so wasn't windows compatible unless we used MinGW which we can't.... well I guess we could if it were an external on windows...
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Re: UUIDs.. you know you want them

Post by malte » Sat May 04, 2013 8:16 am

Hey Monte,

nothing half-assed about the proposal. :-) I just want to be sure that the UUIDs we generate are conform with rfc4122 and nothing we are baking ourselves... :-)

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: UUIDs.. you know you want them

Post by monte » Sat May 04, 2013 11:29 am

OK, I think there's two separate issues. Generating UUIDs for use in our own apps and moving object IDs to UUIDs. Just generating UUIDs is fairly easy although it seems it may be hard to find code that is portable enough to use on all our platforms so we may need to go with whatever each platform can provide which appears to be most often either type 1 or type 4. Essentially it's just finding the right libraries and implementing it. The change from ID to UUID for object IDs on the other hand is a fairly significant architectural change to the platform and needs lots of thought and discussion. The engine and our code is riddled with references to IDs and it's all got to transition smoothly to the change. It's even possible as I said earlier that we could get away with a 64 bit randomly generated ID although seeing as UUID is out there as a standard it does seem like if we moved to a new scheme that should be it.
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: UUIDs.. you know you want them

Post by mwieder » Sat May 04, 2013 7:02 pm

I think that's three separate issues <g>.

At any rate, for generating uuids we should be able to tap into the native libraries on desktop platforms without having to resort to other libraries. I believe they're built in to Windows, OSX, and linux. For mobile platforms, type 1 and 4 uuids are easy enough to generate with a minimum of code.

The bigger issue, as you mentioned, is getting all those short id references changed in the engine code.

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: UUIDs.. you know you want them

Post by monte » Sat May 04, 2013 11:17 pm

I believe they're built in to Windows, OSX, and linux. For mobile platforms, type 1 and 4 uuids are easy enough to generate with a minimum of code.
It's really only Windows that couldn't use a libuuid based solution... The only option I've found for windows is CoCreateGUID
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: UUIDs.. you know you want them

Post by mwieder » Sat May 04, 2013 11:46 pm

Bummer. But maybe that means we only have to find a properly-licensed Windows solution. I'll have to take a look at that RFC.

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: UUIDs.. you know you want them

Post by monte » Sun May 05, 2013 1:02 am

The boost one appears to be the only portable C or C++ solution. At least from what I can see. CoCreateGUID is type 1 only... as is CFUUID...
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: UUIDs.. you know you want them

Post by mwieder » Sun May 05, 2013 1:48 am

Seems to be available in Windows as well. I won't have my development xp VM available until Monday, but this looks to be straightforward. It's not clear, though, whether this will generate anything other than type-4 uuids.

http://stackoverflow.com/posts/1626302/revisions
http://stackoverflow.com/questions/5433 ... ation-in-c

Also, here's some code to generate type 1->4 uuids (everything except SHA1). It was released into the wild in 1998.

http://www.opengroup.org/dce/info/draft ... ids-01.txt

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: UUIDs.. you know you want them

Post by monte » Sun May 05, 2013 2:29 am

Hmm... what min windows version are we supporting. UUIDCreate which CoCreateGUID calls is 2000+

UUIDCreateSequential can be used to get type 1 while UUIDCreate can be used to get type 4 although typical microsoft they actually haven't stated the types in the docs.

It looks like the opengroup code needs a re-implemented true_random function as it's commented

Code: Select all

/* true_random -- generate a crypto-quality random number.
     This sample doesn't do that. */
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: UUIDs.. you know you want them

Post by mwieder » Sun May 05, 2013 2:37 am

"true" random, eh? I once made a random number generator by reverse-biasing a germanium transistor as a noise generator and feeding it into an analog-to-digital converter. Back in the day.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: UUIDs.. you know you want them

Post by mwieder » Sun May 05, 2013 2:38 am

but I can't really believe we'd be trying to support anything pre-Win2k. Or even Win2k except accidentally. Win2k was EOLed in July 2010 and went on life support in 2005. :P

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: UUIDs.. you know you want them

Post by Simon » Sun May 05, 2013 3:55 am

I have no idea on the complexities that you are working in regards to UUID's.
But I have to say that I see many Windows XP users on the lists, I think they are Mac users who purchased cheap Windows machines for testing (maybe it's a vm thing?). I only noted this because I'm amazed that there are still so many.
Ah, a search on the user list has 3.4 K hits for XP.

Just a data point,
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Locked

Return to “Engine Contributors”