--
Did you find this reply useful? Help the Railo community and add it to the Railo Server wiki at https://github.com/getrailo/railo/wiki
---
You received this message because you are subscribed to the Google Groups "Railo" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/7843c34f-3409-4b61-b98b-b90dc869e11d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
1) the format of a UUID is prescribed, and that will of course stay as-is with the default implementation for compatibility purposes. but since we are still talking about a globally- or universally- unique identifier then the format is one thing, and the concept is another.
2) there are reasons to create a shorter universally-unique identifiers though. especially when you want to put them in URLs or save a file with a unique name. see the youtube video ids for example -- they are much "friendlier" than the 35/36 character long UUIDs. implementation is rather simple so it's a good use of time.
3) with respect to your other email -- we already have a function called createGUID(). see http://railodocs.org/index.cfm/function/createguid/version/4.1.0.000
2) there are reasons to create a shorter universally-unique identifiers though. especially when you want to put them in URLs or save a file with a unique name. see the youtube video ids for example
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/3f68ee58-6756-4c5e-934a-8de4d5be3524%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
a = createuuid(); // -> 855CA476-89B1-4BCE-B47CD837EB897156
b = replace(a, '-', '', 'all'); // -> 855CA47689B14BCEB47CD837EB897156
c = createObject("java", "java.math.BigInteger").init(b, 16);
// -> 177268350457090975001289573812373385558
d = c.toString(36); // -> 7w8da0ok3dy69gjelytcqcrpy--
Did you find this reply useful? Help the Railo community and add it to the Railo Server wiki at https://github.com/getrailo/railo/wiki
---
You received this message because you are subscribed to the Google Groups "Railo" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/d2dea0de-6d83-4637-9f24-ed04e2bae25e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/52BA1A92.4070905%40getrailo.org.
How about if createguid() was changed to accept an argument "base (int)" that if omitted will create a stock-standard UUID and if supplied with for instance "36" would convert it to a base-36 string?
How about if createguid() was changed to accept an argument "base (int)" that if omitted will create a stock-standard UUID and if supplied with for instance "36" would convert it to a base-36 string?
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/353BC378-351D-478D-851F-A1E622C86C84%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/52BA33CB.4020707%40getrailo.org.
For more options, visit https://groups.google.com/groups/opt_out.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/9E4E45BC-6262-49A2-A00E-B2DA07BA36E0%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/52BA3943.1080902%40getrailo.org.
For more options, visit https://groups.google.com/groups/opt_out.
On Dec 25, 2013 2:48 AM, Igal wrote:
> also, if you are to store it in a database like MSSQL Server where default string comparisons are not-case-sensitive then Base36 seems like a better choice of the two.
I think that is an anti-pattern that we should not cater for.
If you are storing UUIDs in a database like MS SQL Server you store them using the uniqueidentifier data type anyway, which is 16-byte binary object. Not only does that save a lot of storage, it does binary comparisons so you don't run the risk of a locale/encoding mismatch turning your index scan into a table scan. Avoiding that worst-case scenario is far more important for a performance minded programmer than anything else: http://jochem.vandieten.net/2008/12/15/querying-ms-sql-server-guuids-from-coldfusion/
Which in turn means that an important question to ask is how different string representations of the UUID are going to work with a database with native UUID support. Can they be thrown at the database directly or do they need to be converted to a standard format first? I know PostgreSQL will accept both the result from createUUID() and createGUID() as well as their base16 representation, but I believe that is already the exception and the norm is that only the strict 36-character string representation ans a32-character string representation are accepted.
So I guess my position comes down to saying that I find it highly unlikely I will be using the feature as proposed, and merely unlikely if it were configurable the way Kai describes.
.Jochem
Yes, that's fine and I understand why YOU would use Base36 over Base64.
My question still stands though: Why, if you were to introduce a different UUID base representation, would you want to limit that to a new function providing a single "chosen baseN by Railo" instead of just adding an optional argument to the existing function that lets everyone do whatever they want?