Nick,

Give this a try for your code that detects the correct initial and sets the
variable name... you may find your performance improve, especially if you
stick the struct in the application scope. Remember that if you stick the
struct in the application scope and only edit it when you first start up the
application you can read from it any time without locking.

Note that the double cfif outside and inside the CFLOCK isn't a typo. This
is a really simple snippet for such a condition to occur, but if the first
visitor sees the variables don't exist, creates a lock, and starts to create
the scope while a second visitor also sees that the code hasn't run and
queues up to create, when the first thread (or visitor) finishes, the code's
been run and the variables exist, but unless there's a second CFIF to make
sure it checks again before it creates the variables it will run again... on
a busy site that can mean all sorts of odd problems.

<!--- scope this to the application scope for best performance --->
<cfif not structKeyExists(application,"dirNames")>
<cflock scope="application" type="exclusive" timeout="3">
<cfif not structKeyExists(application,"dirNames")>
<cfset application.dirNames = structNew()>

<cfset application.dirNames.abcd = "A-D">
<cfset application.dirNames.efgh = "E-H">
<cfset application.dirNames.ijkl = "I-L">
<cfset application.dirNames.mnop = "M-P">
<cfset application.dirNames.qrst = "Q-T">
<cfset application.dirNames.uvwxyz = "U-Z">
</cfif>
</cflock>
</cfif>
<!--- end application scope stuff --->

<!--- This goes in the page --->
<cfset dir = "Other">
<cfset initial = left(form.cadidateName,1)>

<cfloop collection="#application.dirNames#" item="i">
<cfif find(initial,i)>
<cfset dirName = application.dirNames[i]>
<cfbreak />
</cfif>
</cfloop>
<!--- end code for the page --->

Laterz,
J


On 9/20/05, Nick Sweeney <[EMAIL PROTECTED]> wrote:
>
> I do something similar to this, not exactly, but you will see how to
> manipulate it -
>
> I save the files in a directory like:
> d:\website.com\Admin\files\Resumes\A-B\Nick.doc
> Probably better ways to do it - but it isn't bad.
>
> I also store the file info in the database, Name, Type, Description,
> Postedby, etc.
>
> -Nick


>


--
---------------
-------------------------------------
Buy SQLSurveyor!
http://www.web-relevant.com/sqlsurveyor
Never make your developers open Enterprise Manager again.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Purchase Studio MX from House of Fusion, a Macromedia Authorized Affiliate and 
support the CF community.
http://www.houseoffusion.com/banners/view.cfm?bannerid=50

Message: http://www.houseoffusion.com/lists.cfm/link=i:15:1420
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to