Re: Simple Application.cfm Question
My understanding though is that you have to do a duplicate on any complex data types (structs, arrays, queries etc.) you "copy" from application to local page vars (whatever the scope) otherwise, without locks you are still open to corruption because you are accessing the original application var via a pointer rather than a unique local version of it. Douglas Brown wrote: > > My preference in this situation is to always use request vars and create a > struct for them. I use a local page for all scoping of variables and just do an > include in my application page > > IE: > > > > > > > > > > > > > > > > > > > > > > > "Success is a journey, not a destination!!" > > Doug Brown > - Original Message - > From: "Dave Watts" <[EMAIL PROTECTED]> > To: "CF-Talk" <[EMAIL PROTECTED]> > Sent: Sunday, April 14, 2002 11:16 AM > Subject: RE: Simple Application.cfm Question > > > > In the application.cfm I write the following: > > > > > > http://www.mysite.com";> > > > > > > Then I call this on certain pages in the application, > > > such as: #APPLICATION.webroot# > > > > > > My question is this: > > > > > > 1) Do I need to use locks around everytime I call this > > > APPLICATION variable? > > > > Well, the generic recommendation I give in this situation is, yes, you must > > lock every instance of any memory variable. There are those who disagree, > > specifically with Application or Server variables, who will argue that as > > long as the variable is locked, and only written to once, there shouldn't be > > any problem. In my opinion, I'd rather be safe than sorry, since memory > > variables have caused enough trouble in applications I've seen. > > > > > 2) Can I get away with using a REQUEST variable instead of > > > APPLICATION variable when I write CFSET commands, such as > > > (I know I can do REQUEST variables for calling DSN connections): > > > > > > http://www.mysite.com";> then > > > #REQUEST.webroot# > > > > Yes, not only can you "get away with it", but in the case of variables which > > are essentially static through the lifespan of the application - datasource > > names, file paths, and the like - I'd strongly recommend that you use either > > the Request or the local Variables scope and simply set these variables in > > Application.cfm. > > > > Dave Watts, CTO, Fig Leaf Software > > http://www.figleaf.com/ > > voice: (202) 797-5496 > > fax: (202) 797-5444 > > > > > __ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Simple Application.cfm Question
One nice thing about the request scope is that it's a structure, as opposed to the variables scope. -- Yes, not only can you "get away with it", but in the case of variables which are essentially static through the lifespan of the application - datasource names, file paths, and the like - I'd strongly recommend that you use either the Request or the local Variables scope and simply set these variables in Application.cfm. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ voice: (202) 797-5496 fax: (202) 797-5444 __ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Simple Application.cfm Question
My preference in this situation is to always use request vars and create a struct for them. I use a local page for all scoping of variables and just do an include in my application page IE: "Success is a journey, not a destination!!" Doug Brown - Original Message - From: "Dave Watts" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Sunday, April 14, 2002 11:16 AM Subject: RE: Simple Application.cfm Question > > In the application.cfm I write the following: > > > > http://www.mysite.com";> > > > > Then I call this on certain pages in the application, > > such as: #APPLICATION.webroot# > > > > My question is this: > > > > 1) Do I need to use locks around everytime I call this > > APPLICATION variable? > > Well, the generic recommendation I give in this situation is, yes, you must > lock every instance of any memory variable. There are those who disagree, > specifically with Application or Server variables, who will argue that as > long as the variable is locked, and only written to once, there shouldn't be > any problem. In my opinion, I'd rather be safe than sorry, since memory > variables have caused enough trouble in applications I've seen. > > > 2) Can I get away with using a REQUEST variable instead of > > APPLICATION variable when I write CFSET commands, such as > > (I know I can do REQUEST variables for calling DSN connections): > > > > http://www.mysite.com";> then > > #REQUEST.webroot# > > Yes, not only can you "get away with it", but in the case of variables which > are essentially static through the lifespan of the application - datasource > names, file paths, and the like - I'd strongly recommend that you use either > the Request or the local Variables scope and simply set these variables in > Application.cfm. > > Dave Watts, CTO, Fig Leaf Software > http://www.figleaf.com/ > voice: (202) 797-5496 > fax: (202) 797-5444 > > __ Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Simple Application.cfm Question
- Original Message - From: "Mark Leder" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Sunday, April 14, 2002 11:54 AM Subject: Simple Application.cfm Question > In the application.cfm I write the following: > > http://www.mysite.com";> > > Then I call this on certain pages in the application, such as: > #APPLICATION.webroot# > > My question is this: > > 1) Do I need to use locks around everytime I call this APPLICATION > variable? Yes. You should. > 2) Can I get away with using a REQUEST variable instead of APPLICATION > variable when I write CFSET commands, such as (I know I can do REQUEST > variables for calling DSN connections): > > http://www.mysite.com";> then > #REQUEST.webroot# Yes. Or you can just use the standard variables scope if you don't need to access the variable from within cf tags. Either one avoids the need to lock the variable, but comes at a (very) slight performance hit since the variable is created and set in every request. Jim __ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Simple Application.cfm Question
Thanks for your help Dave - this really helps. Thanks, Mark -Original Message- From: Dave Watts [mailto:[EMAIL PROTECTED]] Sent: Sunday, April 14, 2002 2:16 PM To: CF-Talk Subject: RE: Simple Application.cfm Question > In the application.cfm I write the following: > > http://www.mysite.com";> > > Then I call this on certain pages in the application, > such as: #APPLICATION.webroot# > > My question is this: > > 1) Do I need to use locks around everytime I call this > APPLICATION variable? Well, the generic recommendation I give in this situation is, yes, you must lock every instance of any memory variable. There are those who disagree, specifically with Application or Server variables, who will argue that as long as the variable is locked, and only written to once, there shouldn't be any problem. In my opinion, I'd rather be safe than sorry, since memory variables have caused enough trouble in applications I've seen. > 2) Can I get away with using a REQUEST variable instead of > APPLICATION variable when I write CFSET commands, such as > (I know I can do REQUEST variables for calling DSN connections): > > http://www.mysite.com";> then > #REQUEST.webroot# Yes, not only can you "get away with it", but in the case of variables which are essentially static through the lifespan of the application - datasource names, file paths, and the like - I'd strongly recommend that you use either the Request or the local Variables scope and simply set these variables in Application.cfm. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ voice: (202) 797-5496 fax: (202) 797-5444 __ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Simple Application.cfm Question
> In the application.cfm I write the following: > > http://www.mysite.com";> > > Then I call this on certain pages in the application, > such as: #APPLICATION.webroot# > > My question is this: > > 1) Do I need to use locks around everytime I call this > APPLICATION variable? Well, the generic recommendation I give in this situation is, yes, you must lock every instance of any memory variable. There are those who disagree, specifically with Application or Server variables, who will argue that as long as the variable is locked, and only written to once, there shouldn't be any problem. In my opinion, I'd rather be safe than sorry, since memory variables have caused enough trouble in applications I've seen. > 2) Can I get away with using a REQUEST variable instead of > APPLICATION variable when I write CFSET commands, such as > (I know I can do REQUEST variables for calling DSN connections): > > http://www.mysite.com";> then > #REQUEST.webroot# Yes, not only can you "get away with it", but in the case of variables which are essentially static through the lifespan of the application - datasource names, file paths, and the like - I'd strongly recommend that you use either the Request or the local Variables scope and simply set these variables in Application.cfm. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ voice: (202) 797-5496 fax: (202) 797-5444 __ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists