Sweet! If you think it's better than what CFLib.org has, then submit it there as well. I've got a few UDFs there. it's a great site. :o)
Chris Bobby Hartsfield wrote: > Agreed. I actually rewrote this one somewhere to speed it up using cfscript > and randrange(n, n) for ascii values instead of using lists of characters. > > I'll dig it up eventually and post an update to the other one... I wrote > that one in 2002 :-) > > -----Original Message----- > From: Christopher Jordan [mailto:[EMAIL PROTECTED] > Sent: Thursday, December 21, 2006 12:18 PM > To: CF-Talk > Subject: Re: automatically generate password > > I know. I'm just stating for the masses why they maybe would want to > consider making it a habit to code stuff in cfscript wherever they can > whether the time difference between it and similar tag based code is > measurable. :o) > > Chris > > Bobby Hartsfield wrote: > >> I didn't disagree. I just said it wasn't enough processing to matter. >> >> -----Original Message----- >> From: Christopher Jordan [mailto:[EMAIL PROTECTED] >> Sent: Thursday, December 21, 2006 9:51 AM >> To: CF-Talk >> Subject: Re: automatically generate password >> >> Hmm... well, cfscript code is still closer to the native java than tag >> based code. To quote a guy from my local CFUG. >> >> "That is exactly what I've been saying / seeing for many years (pre & >> post CFMX). The reason that tags are slower is because when the template >> JITs, it adds extra libraries into the class. So in other words, when >> you write your code in cfscript, your code needs fewer cftag libraries >> mentioned as Java import namespaces because your code is closer to the >> native Java and requires less overhead. Also, the tag named import also >> contains functionality you may not be using. Therefore, you have thinner >> JITs and faster code. >> >> Now, if we could just get adobe to start offering cfscript equivalents >> for the most used tags, we wouldn't have to have functions that replace >> our tags inside cfscript. We can only hope!" >> >> To see this comment in context, check out this blog entry >> >> > <http://www.daveshuck.com/blog/index.cfm/2006/1/27/Benchmarks--try-VS-isdefi > >> ned--script-VS-tag>. >> >> I've also seen the speed increases. Here's an email that I recently >> posted to my CFUG mailing list. The numbers at the bottom of the email >> amazed me. >> >> <------ BEGIN ------> >> Not to beat a dead horse, but I just wanted to share some numbers. Just >> this morning I changed the part of the code in one of my CFCs from this: >> >> <CFSet var ThisOrderID = ""> >> <CFSet var ThisFieldList = ""> >> <CFSet var ThisClientID = ""> >> <CFSet var ThisMarketPath = ""> >> >> <CFParam Name="Arguments.OrderID" Default=""> >> <CFParam Name="Arguments.FieldList" Default="*"> >> <CFParam Name="Arguments.StafPakID" >> Default="#ThisStafpakClientID#"> >> <CFParam Name="Arguments.Path" >> Default="#ThisStafpakPath#"> >> >> <CFSet ThisOrderID = Trim(Arguments.OrderID)> >> <CFSet ThisClientID = Trim(Arguments.StafPakID)> >> <CFSet ThisMarketPath = Trim(Arguments.Path)> >> <CFSet ThisFieldList = Trim(Arguments.FieldList)> >> >> to this: >> >> <CFScript> >> var My = StructNew(); >> My.OrderID = ""; >> My.FieldList = "*"; >> My.StafpakID = ThisStafpakClientID; >> My.Path = ThisStafpakPath; >> My.ArgumentList = StructKeyList(Arguments); >> >> // loop over the Arguments Structure and put all key values >> into the local >> // 'My' scope... >> for (My.i = 1; My.i LTE StructCount(Arguments); My.i = My.i >> + 1){ >> My.KeyName = ListGetAt(My.ArgumentList, My.i); >> "My.#My.KeyName#" = Arguments[My.KeyName]; >> } >> </CFScript> >> >> and then looked at the numbers in the debugging. I was amazed! >> >> The old way: >> 5170 ms 5170 ms 1 CFC[ C:\Inetpub\wwwroot\Include\CFC\StafPak.cfc | >> FetchThisOrder(... >> >> The new way: >> 140 ms 140 ms 1 CFC[ C:\Inetpub\wwwroot\Include\CFC\StafPak.cfc | >> FetchThisOrder(... >> >> Holy milliseconds, Batman! >> >> Just because I know the numbers fluctuate I ran both again. >> >> The old way (take 2): >> 1124 ms 1124 ms 1 CFC[ C:\Inetpub\wwwroot\Include\CFC\StafPak.cfc | >> FetchThisOrder(... >> >> The new way (take 2): >> 78 ms 78 ms 1 CFC[ C:\Inetpub\wwwroot\Include\CFC\StafPak.cfc | >> FetchThisOrder(... >> >> Jinkies!! That was smokin'! >> >> I'm definitely changing the way I do some things around here... ;o) >> <------ END ------> >> >> Anyway, the speed increase gained in changing your code in this instance >> may be immeasurable, but in general cfscript code is faster than tagged >> code. I find this topic fascinating. I hope you don't think I've wasted >> anyone's time. :o) >> >> Cheers, >> Chris >> >> Bobby Hartsfield wrote: >> >> >>> I converted this to a udf but it's not any faster. Not really enough >>> processing to make a difference really. >>> >>> -----Original Message----- >>> From: Christopher Jordan [mailto:[EMAIL PROTECTED] >>> Sent: Wednesday, December 20, 2006 4:36 PM >>> To: CF-Talk >>> Subject: Re: automatically generate password >>> >>> I've not followed this thread entirely, but if generating a good random >>> password is still an issue, then I'd go with and idea like Bobby has >>> stated, but I'd use a UDF and not a custom tag. >>> >>> As I've recently become *very* aware of, CFScript is just *way* faster >>> than tag based code, especially for something like this. >>> >>> Check out CFLib.org there are two or three password generators out >>> there. One always creates eight character passwords but is free from >>> annoying similar looking characters like 1 and l (one and lower-case >>> L... just in case). Another generates any length password you want, and >>> another generates WEP keys. >>> >>> Here's a link to the first one I mentioned called Make Password >>> <http://www.cflib.org/udf.cfm?ID=437>. >>> >>> Cheers, >>> Chris >>> >>> >>> >>> Bobby Hartsfield wrote: >>> >>> >>> >>>> Take a look at the link I gave you... >>>> >>>> <CF_RANDOM_PASS LENGTH="8,20" >>>> CHARSET="AlphaNumeric" >>>> UCASE="Yes" >>>> RETURNVARIABLE="pword"> >>>> >>>> That will generate a password between 8 and 20 characters long with >>>> >>>> >>>> >>> numbers >>> >>> >>> >>>> and lower and uppercase letters and store it in a variable called >>>> > 'pword' > >>>> (you can change it to whatever you want) >>>> >>>> The link again... >>>> http://acoderslife.com/tutorials/index.cfm?act=t&cid=1&tid=2 >>>> >>>> copy that code and save it in a file called random_pass.cfm and put it >>>> > in > >>>> your custom tag directory (or in the application root somewhere) >>>> >>>> >>>> >>>> >>>> >>> >>> >>> >> >> > > -- http://www.cjordan.info ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264776 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

