You need to generate a unique identification value to track a user.
A very common task that deals with number generation is creating an UUID. UUID stands for Universally Unique Identifier. A UUID is a 35-character string representation of a unique integer. This unique integer is generated from the ethernet 'MAC' address built into the computer, along with the current time (in 100ns increments). This assures that the identifier will be unique.
It is important to note that ColdFusion uses a slightly different format for its UUIDs. ColdFusion UUIDs can be broken into 4 parts such as: B54D60CD-DF98-4869-9C3910ABE33E5112, while other companies such as Microsoft use a 5 part format such as: 4CFB048C-A19E-44E8-83E8-B842A3D43AA3. If you are interested in working with 5 part UUIDs in ColdFusion, you can refer to www.cflib.org for a ColdFusion UDF (User Defined Function) for creating MS Style UUIDs.
You create an UUID in ColdFusion by using the CreateUUID() function:
This question was written by Jeremy Petersen.
It was last updated on January 13, 2006 at 9:06:00 AM EST.
CFML Referenced
Categories
Comments
Comment made by Paul Carney on January 13, 2006 at 1:59 PM
UUIDs are great when you have disparate systems that need to share information and you cannot count on sequential numeric columns (like identity columns in MS SQLServer) to be the same in both system.
But be careful in using the UUID as the key to a database row where scaling to millions of rows will occur. Even with an index on that column, a numeric identity column will produce dramatically better response times in SQL joins than an indexed UUID.
Food for thought as you build, because that little app you build today might just have to handle millions of rows tomorrow....
Comment made by Jacob Munson on January 13, 2006 at 4:29 PM
So a UUID is generated partially from the MAC address. Does this mean a user's ethernet MAC address is available to my CF pages, so I could get and store it using CF? Or is CF using a different piece of information, if the MAC address is not broadcasted as part of a HTTP request?
Comment made by Peter J. Farrell on January 15, 2006 at 2:24 AM
Jacob, CF uses the MAC address of the ethernet on the server that CF resides.