EzDevInfo.com

uuid

Formerly rhumsaa/uuid. A PHP 5.3+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID). Ben Ramsey: ramsey/uuid a php 5.4+ library for generating rfc 4122 version 1, 3, 4, and 5 universally unique identifiers (uuid).

How should I store GUID in MySQL tables?

Do I use varchar(36) or are there any better ways to do it?


Source: (StackOverflow)

Which UUID version to use?

Which version of the UUID should you use? I saw a lot of threads explaining what each version entails, but I am having trouble figuring out what's best for what applications.


Source: (StackOverflow)

Advertisements

Platform-independent GUID generation in C++?

What is the best way to programmatically generate a GUID or UUID in C++ without relying on a platform-specific tool? I am trying to make unique identifiers for objects in a simulation, but can't rely on Microsoft's implementation as the project is cross-platform.

Notes:

  • Since this is for a simulator, I don't really need cryptographic randomness.
  • It would be best if this is a 32 bit number.

Source: (StackOverflow)

How unique is UUID?

How safe is it to use UUID to uniquely identify something (I'm using it for files uploaded to the server)? As I understand it, it is based off random numbers. However, it seems to me that given enough time, it would eventually repeat it self, just by pure chance. Is there a better system or a pattern of some type to alleviate this issue?


Source: (StackOverflow)

Efficient method to generate UUID String in JAVA (UUID.randomUUID().toString() without the dashes)

I would like an efficient utility to generate Unique sequences of bytes. UUID is a good candidate but UUID.randomUUID().toString() generates stuff like 44e128a5-ac7a-4c9a-be4c-224b6bf81b20 which is good as long as you don't need to transmit it over http, in which case the dashes need to be removed.

I'm looking for an efficient way to generate a random strings, only from alphanumeric characters (no dashes or any other special symbols).

Thanks for helping, Maxim.


Source: (StackOverflow)

How to create a GUID in Python

How do I create a GUID in Python that is platform independent? I hear there is a method using ActivePython on Windows but it's Windows only because it uses COM. Is there a method using plain Python?


Source: (StackOverflow)

Why are there dashes in a .NET GUID?

Why are there dashes in a .NET GUID? Are there dashes in most implementations of a GUID, or is it just a Microsoft thing?

Signed,

741ecf77-9c92-4435-8e6b-85975bd13452


Source: (StackOverflow)

How to create a GUID/UUID using the iPhone SDK

I want to be able to create a GUID/UUID on the iPhone and iPad.

The intention is to be able to create keys for distributed data that are all unique. Is there a way to do this with the iOS SDK?


Source: (StackOverflow)

how good is java's UUID.randomUUID?

I know randomized UUID have very very very low probability for collision in theory, but I am wondering, in practice, how good is java 5's randonUUID in terms of not having collision? Does anybody have any experience to share?


Source: (StackOverflow)

Advantages and disadvantages of GUID / UUID database keys

I've worked on a number of database systems in the past where moving entries between databases would have been made a lot easier if all the database keys had been GUID / UUID values. I've considered going down this path a few times, but there's always a bit of uncertainty, especially around performance and un-read-out-over-the-phone-able URLs.

Has anyone worked extensively with GUIDs in a database? What advantages would I get by going that way, and what are the likely pitfalls?


Source: (StackOverflow)

Is there any difference between a GUID and a UUID?

I see these 2 acronyms thrown around, and I was wondering if there are any differences between a GUID and a UUID?


Source: (StackOverflow)

Likelihood of collision using most significant bits of a UUID in Java

If I'm using Long uuid = UUID.randomUUID().getMostSignificantBits() how likely is it to get a collision. It cuts off the least significant bits, so there is a possibility that you run into a collision, right?


Source: (StackOverflow)

PHP function to generate v4 UUID

So I've been doing some digging around and I've been trying to piece together a function that generates a valid v4 UUID in PHP. This is the closest I've been able to come. My knowledge in hex, decimal, binary, PHP's bitwise operators and the like is nearly non existant. This function generates a valid v4 UUID up until one area. A v4 UUID should be in the form of:

xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx

where y is 8, 9, A, or B. This is where the functions fails as it doesn't adhere to that.

I was hoping someone with more knowledge than me in this area could lend me a hand and help me fix this function so it does adhere to that rule.

The function is as follows:

<?php

function gen_uuid() {
 $uuid = array(
  'time_low'  => 0,
  'time_mid'  => 0,
  'time_hi'  => 0,
  'clock_seq_hi' => 0,
  'clock_seq_low' => 0,
  'node'   => array()
 );

 $uuid['time_low'] = mt_rand(0, 0xffff) + (mt_rand(0, 0xffff) << 16);
 $uuid['time_mid'] = mt_rand(0, 0xffff);
 $uuid['time_hi'] = (4 << 12) | (mt_rand(0, 0x1000));
 $uuid['clock_seq_hi'] = (1 << 7) | (mt_rand(0, 128));
 $uuid['clock_seq_low'] = mt_rand(0, 255);

 for ($i = 0; $i < 6; $i++) {
  $uuid['node'][$i] = mt_rand(0, 255);
 }

 $uuid = sprintf('%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x',
  $uuid['time_low'],
  $uuid['time_mid'],
  $uuid['time_hi'],
  $uuid['clock_seq_hi'],
  $uuid['clock_seq_low'],
  $uuid['node'][0],
  $uuid['node'][1],
  $uuid['node'][2],
  $uuid['node'][3],
  $uuid['node'][4],
  $uuid['node'][5]
 );

 return $uuid;
}

?>

Thanks to anyone that can help me out.


Source: (StackOverflow)

When should I use uuid.uuid1() vs. uuid.uuid4() in python?

I understand the differences between the two from the docs.

uuid1():
Generate a UUID from a host ID, sequence number, and the current time

uuid4():
Generate a random UUID.

So uuid1 uses machine/sequence/time info to generate a UUID. What are the pros and cons of using each?

I know uuid1() can have privacy concerns, since it's based off of machine-information. I wonder if there's any more subtle when choosing one or the other. I just use uuid4() right now, since it's a completely random UUID. But I wonder if I should be using uuid1 to lessen the risk of collisions.

Basically, I'm looking for people's tips for best-practices on using one vs. the other. Thanks!


Source: (StackOverflow)

Collisions when generating UUIDs in JavaScript?

This relates to this question. I am using this answer to generate UUID in JavaScript:

'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
    var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
    return v.toString(16);
});

This solution appeared to be working fine, however i am getting collisions. Here's what i have:

  • A web-app running in Google Chrome.
  • 16 users.
  • about 4000 UUIDs have been generated in the past 2 months by these users.
  • i got about 20 collisions - e.g. new UUID genereated today was the same as about 2 months ago (different user).

So the questions are:

  1. What's causing the issue?
  2. How can i avoid it?

Source: (StackOverflow)