Lol...nice...

I'll settle with the one in almost a billion (1,999999999) change that
they'll duplicate (well, scaled down with each subsequent call).

If anybody gets a conflict....well, they're a lucky fool.

-joe

----- Original Message -----
From: S. Isaac Dealey <[EMAIL PROTECTED]>
Date: Thu, 15 Jul 2004 13:48:38 -0400
Subject: Re: Free Stuff: Tree, Tab, Accordian Pane Custom Tags
To: CF-Talk <[EMAIL PROTECTED]>

> Thanks for the tip on createUuid() - I've read the

> technote, but tend

> to forget and still use it.  I'll probably change things

> over to a

> random number.

I was originally using #request.tapi.uName()# which I still use for

generating ID's for stuff that's going to go into my database, but

seemed a bit inefficient for these ultimately given the volume of html

elements on a page and the fact that they're transient (most of the

time you won't be storing these in your db or anything). So in order

to make them a bit faster I created a separate

#request.tapi.serialize()# function which produces a mostly numeric

result with a non-fixed number of digits. My algorithm was (iirc)

"tap_"

& dateformat(now(),"yyyymmdd")

& timeformat(now(),"HHmmss")

& gettickcount()

& randrange(1,999999999)

I'd have left it at getTickCount() except that you can get several

calls to the function per milisecond. The remaining bits leading up to

the current year help to ensure that if the resulting html code gets

coppied into a flat html template somewhere else, the likelyhood of

having a duplicated id in the html is minimalized, since any duplicate

would likely have to have been created by the same system during the

same calendar second and with the CF Server running for the exact same

number of miliseconds prior to the function call. heh :)



s. isaac dealey   954.927.5117

new epoch : isn't it time for a change?

add features without fixtures with

the onTap open source framework

http://www.sys-con.com/story/?storyid=44477&DE=1________________________________
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to