without usec, few percents of generated values are not uniques
the id generated is a string so the presence of ‘-’, this is only for
a better readibility in case of SQL debugging
uuidgen. It’s quite slow, but you can run it once and append 10,000
sequential integers to the result and now you have 10,000 cached unique
values. When you use them up, get another seed-value from uuidgen.
Hello, I need to generate a unique ID, so far I’ve unit tested this
uuidgen. It’s quite slow, but you can run it once and append 10,000
sequential integers to the result and now you have 10,000 cached unique
values. When you use them up, get another seed-value from uuidgen.
But uuidgen seems to be a unix command, I didn’t found anything related
with Ruby… Am I wrong ?
My app will run under Windows XP, so I can’t use unix like commands (and
installing cygwin is not a solution)
Your id mechanism is vulnerable to time being reset, if you are
persisting these, especially if ids across multiple machines
must be compatible in some way (stored in a shared database).
Hello, I need to generate a unique ID, so far I’ve unit tested this
uuidgen. It’s quite slow, but you can run it once and append 10,000
sequential integers to the result and now you have 10,000 cached unique
values. When you use them up, get another seed-value from uuidgen.
But uuidgen seems to be a unix command, I didn’t found anything related
with Ruby… Am I wrong ?
My app will run under Windows XP, so I can’t use unix like commands (and
installing cygwin is not a solution)
In Ruby: uuidgen will work under both unix and windows.
In Ruby: uuidgen will work under both unix and windows.
Okay !! I thought it was a method name… But what is the meaning of
these strange quotes `` ???
Read the Ruby language docs: enclosing a string in backticks causes it
to be executed in a shell. You can put arbitrarily complex commands in
there, same as you would at a shell prompt. You can also put #{…} as
in a Ruby double-quoted string. Your program stops running until the
command completes, and in Ruby, you get back a String which contains
whatever the command wrote to stdout.
uuidgen is present on Windows, definitely, but doesn’t support the -r
option you often find on Unix. So just use it without -r.
In Ruby: uuidgen will work under both unix and windows.
Okay !! I thought it was a method name… But what is the meaning of
these strange quotes `` ???
Read the Ruby language docs: enclosing a string in backticks causes it
to be executed in a shell. You can put arbitrarily complex commands in
there, same as you would at a shell prompt. You can also put #{…} as
in a Ruby double-quoted string. Your program stops running until the
command completes, and in Ruby, you get back a String which contains
whatever the command wrote to stdout.