[turba] Question about database entries

Michael Richey mike at strangehouse.com
Thu Aug 14 15:28:24 PDT 2003


Thanks Jan, it worked perfectly.

To anyone who wants to know how I generated the ID's:
I couldn't use timestamp because I kept getting duplicates (script runs
faster than the clock)...so I used /dev/urandom to generate the ID's

I started with a comma separated list of
senders_address,contact_name,contact_email and performed the following

bash-2.05b$ for line in `cat addresses.list | sed s/^/","/g | sed s/"
"/"_"/g`; do echo $line | sed s/^/`head -c6 /dev/urandom | md5sum | sed
s/"  -"//g`/g >> modified.list ; done

The above statement can be broken into several parts.
first, sed s/^/","/g - inserts a comma at the beginning of the line
second, sed s/" "/"_"/g - inserts an "_" wherever it fines a space
next, sed s/^/`head -c6 /dev/urandom | md5sum | sed s/"  ="//g`/g -
inserts a random number from /dev/urandom which has been md5summed and
stripped of its trailing "  -" at the beginning of the line

finally, it's all concatenated onto the end of modified.list

With little effort, one can add quotes around each field and insert the
proper statements to turn the whole shebang into an sql statement.

When all was said and done, 3556 address book listings were imported
into the database.

Anyway, I hope this helps anyone in the same situation.

Thanks again Jan, I continue to be impressed by the capabilities (and
stability) of horde!  I'm setting it up on a separate server just see
what I can make it do.

Michael


On Thu, 2003-08-14 at 06:37, Jan Schneider wrote:
> Zitat von Michael Richey <mike at strangehouse.com>:
> 
> > First of all, I'd like to congratulate the creators of horde and turba.
> > I had previously implemented Squirrelmail, which is a fairly nice IMAP
> > client...but then I found horde, imp and turba and I'm totally blown
> > away.  Excellent job!
> 
> Thanks!
> 
> > Ok, here's my question.  I'm using MySQL database back end for
> > everything.  Turba assigns an ID for each address book object, and I'm
> > wondering how these ID's are generated.
> 
> They are just arbitrary unique IDs.
> 
> > I've got several thousand address book entries for all of my users and
> > am working on a method to import all of them at once.  I'm concerned
> > about that ID though.  Is it special?  Will I let out the blue smoke if
> > I just generate unique 32 character ID's based on timestamp?
> 
> No, that's perfect.
> 
> Jan.
> 
> --
> http://www.horde.org - The Horde Project
> http://www.ammma.de - discover your knowledge
> http://www.tip4all.de - Deine private Tippgemeinschaft


More information about the turba mailing list