Re: CFLOCK datasource var?

2000-08-30 Thread Ricq Pattay

So I don't need to lock application-scope variables? One book I have says I
should. How about request-scope vars?


Ricq Pattay [EMAIL PROTECTED]
Univ of Minnesota - Twin Cities
College of Veterinary Medicine



- Original Message -
From: Todd Ashworth [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, August 29, 2000 3:49 PM
Subject: Re: CFLOCK datasource var?


 You shouldn't need to use a Session variable for your DSN .. especially if
 you are going to be setting it over and over in your Application.cfm.
That
 defeats the purpose of having a Session variable anyway.  You could get by
 with another scope .. say Variables.ds, or something.  That way, you
 wouldn't have to worry about locking at all.

 cfif not IsDefined('Variables.ds')
 cfset Variables.ds = "something_dev"
 /cfif

 Todd Ashworth

 - Original Message -
 From: "Ricq Pattay" [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, August 29, 2000 4:42 PM
 Subject: CFLOCK datasource var?


 | In my application.cfm I set a session var for all my queries' datasource
 | like this:
 |
 | cflock scope="session" timeout="30" type="exclusive"
 |  cfset session.ds = "something_dev"
 | /cflock
 |
 | So... Do I need to read-only lock every reference to session.ds in all
my
 | other templates where I have a query using that datasource session var?
 | e.g.,
 |
 | cfquery name="get_year" datasource=#session.ds#
 | select sysdate from dual
 | /cfquery
 |
 | Since session.ds is always identical for every user of this site, what
 does
 | it matter if it's locked or not?
 |
 | 
 | Ricq Pattay [EMAIL PROTECTED]
 | Univ of Minnesota - Twin Cities
 | College of Veterinary Medicine
 |
 |
 |
 |

| --
 
 | Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
 | To Unsubscribe visit
 http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or
 send a message to [EMAIL PROTECTED] with 'unsubscribe' in
 the body.
 |


 --

 Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
 To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.


--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



RE: CFLOCK datasource var?

2000-08-30 Thread Dave Watts

 So I don't need to lock application-scope variables? One book 
 I have says I should. How about request-scope vars?

If it's a memory variable, you need to lock it. If it's not, you don't.
However, setting a variable in application.cfm doesn't make it an
Application variable. Instead, it's a local variable (in the Variables
scope) that gets created and destroyed for each page that uses that
application.cfm.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



RE: CFLOCK datasource var?

2000-08-30 Thread Peter Theobald

Why wouldn't he put it in an Application variable? If it's the same for everyone that 
would make the most sense to me.
!--- Application.cfm ---
cflock scope="application" timeout="30" type="exclusive"
  cfif NOT IsDefined("application.ds")
cfset Application.ds = "mydatasource"
   /cfif
/cflock

If you never EVER EVER set it anywhere else, you shouldn't need to lock it for reads, 
would you?

At 04:45 PM 8/29/00 -0400, Dave Watts wrote:
 In my application.cfm I set a session var for all my queries' 
 datasource like this:
 
 cflock scope="session" timeout="30" type="exclusive"
  cfset session.ds = "something_dev"
 /cflock
 
 So... Do I need to read-only lock every reference to 
 session.ds in all my other templates where I have a query 
 using that datasource session var? e.g.,
 
 cfquery name="get_year" datasource=#session.ds#
 select sysdate from dual
 /cfquery
 
 Since session.ds is always identical for every user of this 
 site, what does it matter if it's locked or not?

The short answer is, yes, you should lock it, because there's a potential
for memory corruption with multiple concurrent reads, which can occur even
with session variables.

The longer answer is that if the value is going to be the same for everybody
using the application, you should store it as a "constant" by putting it
into the local Variables scope within application.cfm, or even better, the
Request scope:

cfset Request.ds = "something_dev"

There's no reason to store this on a per-user basis in memory unless each
user actually gets a different datasource.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body. 


---
Peter Theobald, Chief Technology Officer
LiquidStreaming http://www.liquidstreaming.com
[EMAIL PROTECTED]
Phone 1.212.545.1232 Fax 1.212.679.8032

--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



RE: CFLOCK datasource var?

2000-08-30 Thread Dave Watts

 Why wouldn't he put it in an Application variable? If it's 
 the same for everyone that would make the most sense to me.
 !--- Application.cfm ---
 cflock scope="application" timeout="30" type="exclusive"
   cfif NOT IsDefined("application.ds")
 cfset Application.ds = "mydatasource"
/cfif
 /cflock
 
 If you never EVER EVER set it anywhere else, you shouldn't 
 need to lock it for reads, would you?

Two points.

1. If the variable's never going to change, why make it reside in memory?
The cost of creating and destroying a local or Request scoped variable is
infinitesimal.

2. If I never EVER EVER did anything I shouldn't, I'd be a much better
person. Application development shouldn't rely on the good graces of
individual programmers, wherever it's possible not to. If you create a
memory variable, you should assume that someone else, writing some other
script or maintaining your script after you've moved to other things, will
do the wrong thing.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



RE: CFLOCK datasource var?

2000-08-30 Thread Peter Theobald

1. It's going to reside in memory one way or the other. Either one copy as an 
Application variable or one copy for each page request currently executing as a 
"variable" variable or a request variable. This isn't idle curiosity for me, I am 
doing this on a site that has almost a thousand "constants" each page needs.

2. Point taken. So it would work BUT it's bad practice.

At 03:08 PM 8/30/00 -0400, Dave Watts wrote:
 Why wouldn't he put it in an Application variable? If it's 
 the same for everyone that would make the most sense to me.
 !--- Application.cfm ---
 cflock scope="application" timeout="30" type="exclusive"
   cfif NOT IsDefined("application.ds")
 cfset Application.ds = "mydatasource"
/cfif
 /cflock
 
 If you never EVER EVER set it anywhere else, you shouldn't 
 need to lock it for reads, would you?

Two points.

1. If the variable's never going to change, why make it reside in memory?
The cost of creating and destroying a local or Request scoped variable is
infinitesimal.

2. If I never EVER EVER did anything I shouldn't, I'd be a much better
person. Application development shouldn't rely on the good graces of
individual programmers, wherever it's possible not to. If you create a
memory variable, you should assume that someone else, writing some other
script or maintaining your script after you've moved to other things, will
do the wrong thing.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444 


---
Peter Theobald, Chief Technology Officer
LiquidStreaming http://www.liquidstreaming.com
[EMAIL PROTECTED]
Phone 1.212.545.1232 Fax 1.212.679.8032

--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



RE: CFLOCK datasource var?

2000-08-30 Thread Dave Watts

 1. It's going to reside in memory one way or the other. 
 Either one copy as an Application variable or one copy for 
 each page request currently executing as a "variable" 
 variable or a request variable. This isn't idle curiosity for 
 me, I am doing this on a site that has almost a thousand 
 "constants" each page needs.

Yikes! That's a lot of variables! Why so many?

To answer this question satisfactorily, you'll need to do a load test. You
could do this pretty easily, with the right equipment. I've never had to
track that many individual discrete pieces of information in a single
application, I don't think.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



RE: CFLOCK datasource var?

2000-08-30 Thread Peter Theobald

It's for a multilingual site.  Every bit of text on every page (every button, label, 
alt, and open text) has been replaced by:
#label.labelname#

An Application scope structure has been set up in Application.cfm (from a database 
query) to pre-load all the text in all the languages once only. During each page 
request Application.cfm sets the local structure variable "label" to the appropriate 
language data. This local variable is used through each page to substitute the correct 
language text.

So I have ONE copy of all the data in an Application variable, and one *reference* to 
it in a local variable (no extra memory used). An important fact that I document all 
over it is that the local variable "label" is a reference to Application scope data, 
and really should be locked. But I am requiring and expecting that it will only be set 
ONCE at the start of the application.

The alternative would be to stick perhaps HUNDREDS of copies of the following on EACH 
page:
cflock scope='application' timeout='30' 
mode='readonly'cfoutput#label.labelname#/cfoutput/cflock

Which I am not doing. 
This scheme is very efficient and the pages just FLY.

At 05:09 PM 8/30/00 -0400, Dave Watts wrote:
 1. It's going to reside in memory one way or the other. 
 Either one copy as an Application variable or one copy for 
 each page request currently executing as a "variable" 
 variable or a request variable. This isn't idle curiosity for 
 me, I am doing this on a site that has almost a thousand 
 "constants" each page needs.

Yikes! That's a lot of variables! Why so many?

To answer this question satisfactorily, you'll need to do a load test. You
could do this pretty easily, with the right equipment. I've never had to
track that many individual discrete pieces of information in a single
application, I don't think.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444 


---
Peter Theobald, Chief Technology Officer
LiquidStreaming http://www.liquidstreaming.com
[EMAIL PROTECTED]
Phone 1.212.545.1232 Fax 1.212.679.8032

--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



CFLOCK datasource var?

2000-08-29 Thread Ricq Pattay

In my application.cfm I set a session var for all my queries' datasource
like this:

cflock scope="session" timeout="30" type="exclusive"
 cfset session.ds = "something_dev"
/cflock

So... Do I need to read-only lock every reference to session.ds in all my
other templates where I have a query using that datasource session var?
e.g.,

cfquery name="get_year" datasource=#session.ds#
select sysdate from dual
/cfquery

Since session.ds is always identical for every user of this site, what does
it matter if it's locked or not?


Ricq Pattay [EMAIL PROTECTED]
Univ of Minnesota - Twin Cities
College of Veterinary Medicine




--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



RE: CFLOCK datasource var?

2000-08-29 Thread Dave Watts

 In my application.cfm I set a session var for all my queries' 
 datasource like this:
 
 cflock scope="session" timeout="30" type="exclusive"
  cfset session.ds = "something_dev"
 /cflock
 
 So... Do I need to read-only lock every reference to 
 session.ds in all my other templates where I have a query 
 using that datasource session var? e.g.,
 
 cfquery name="get_year" datasource=#session.ds#
 select sysdate from dual
 /cfquery
 
 Since session.ds is always identical for every user of this 
 site, what does it matter if it's locked or not?

The short answer is, yes, you should lock it, because there's a potential
for memory corruption with multiple concurrent reads, which can occur even
with session variables.

The longer answer is that if the value is going to be the same for everybody
using the application, you should store it as a "constant" by putting it
into the local Variables scope within application.cfm, or even better, the
Request scope:

cfset Request.ds = "something_dev"

There's no reason to store this on a per-user basis in memory unless each
user actually gets a different datasource.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



Re: CFLOCK datasource var?

2000-08-29 Thread Todd Ashworth

You shouldn't need to use a Session variable for your DSN .. especially if
you are going to be setting it over and over in your Application.cfm.  That
defeats the purpose of having a Session variable anyway.  You could get by
with another scope .. say Variables.ds, or something.  That way, you
wouldn't have to worry about locking at all.

cfif not IsDefined('Variables.ds')
cfset Variables.ds = "something_dev"
/cfif

Todd Ashworth

- Original Message -
From: "Ricq Pattay" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, August 29, 2000 4:42 PM
Subject: CFLOCK datasource var?


| In my application.cfm I set a session var for all my queries' datasource
| like this:
|
| cflock scope="session" timeout="30" type="exclusive"
|  cfset session.ds = "something_dev"
| /cflock
|
| So... Do I need to read-only lock every reference to session.ds in all my
| other templates where I have a query using that datasource session var?
| e.g.,
|
| cfquery name="get_year" datasource=#session.ds#
| select sysdate from dual
| /cfquery
|
| Since session.ds is always identical for every user of this site, what
does
| it matter if it's locked or not?
|
| 
| Ricq Pattay [EMAIL PROTECTED]
| Univ of Minnesota - Twin Cities
| College of Veterinary Medicine
|
|
|
|
| --

| Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
| To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
|


--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



RE: CFLOCK datasource var?

2000-08-29 Thread Dave Watts

 I'm unfamiliar with the request scope and can't seem to find 
 it in any of my docs. Where is a request-scope var stored?

It's new to CF 4.5.x. It's similar to the local Variables scope in that it's
stored in memory until the entire page has been generated, then it's
discarded. The advantage of using the Request scope instead of the Variables
scope is that it's available to all of the custom tags within a single page
request.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



Re: CFLOCK datasource var?

2000-08-29 Thread Jamie Keane

Yeah, but the "Variables" scope isn't persistent.  Each time a page loads it
will unset itself.  It would be better IMHO to just do a plain vanilla
CFSET.

--
Jamie Keane
Programmer
SolutionMasters, Inc.
9111 Monroe Rd., Suite 100
Charlotte, NC  28270
www.solutionmasters.com
704.563.5559 x 228  Voice
704.849.9291  Fax
-Original Message-
From: Todd Ashworth [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Tuesday, August 29, 2000 4:48 PM
Subject: Re: CFLOCK datasource var?


You shouldn't need to use a Session variable for your DSN .. especially if
you are going to be setting it over and over in your Application.cfm.  That
defeats the purpose of having a Session variable anyway.  You could get by
with another scope .. say Variables.ds, or something.  That way, you
wouldn't have to worry about locking at all.

cfif not IsDefined('Variables.ds')
cfset Variables.ds = "something_dev"
/cfif

Todd Ashworth

- Original Message -
From: "Ricq Pattay" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, August 29, 2000 4:42 PM
Subject: CFLOCK datasource var?


| In my application.cfm I set a session var for all my queries' datasource
| like this:
|
| cflock scope="session" timeout="30" type="exclusive"
|  cfset session.ds = "something_dev"
| /cflock
|
| So... Do I need to read-only lock every reference to session.ds in all my
| other templates where I have a query using that datasource session var?
| e.g.,
|
| cfquery name="get_year" datasource=#session.ds#
| select sysdate from dual
| /cfquery
|
| Since session.ds is always identical for every user of this site, what
does
| it matter if it's locked or not?
|
| 
| Ricq Pattay [EMAIL PROTECTED]
| Univ of Minnesota - Twin Cities
| College of Veterinary Medicine
|
|
|
|
| -
-

| Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
| To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
|


---
---
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.


--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



RE: CFLOCK datasource var?

2000-08-29 Thread Raymond K. Camden


 -Original Message-
 From: Dave Watts [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, August 29, 2000 5:04 PM
 To: '[EMAIL PROTECTED]'
 Cc: '[EMAIL PROTECTED]'
 Subject: RE: CFLOCK datasource var?


  I'm unfamiliar with the request scope and can't seem to find
  it in any of my docs. Where is a request-scope var stored?

 It's new to CF 4.5.x. It's similar to the local Variables scope

Actually it was in CF 4.01. (And no, I don't mean to be nitpicky, but I know
a lot of people still use 4.01, so I didn't want anyone to think they
couldn't use it. :)

===
Raymond Camden, Cold Fusion Jedi Master for Syntegra (www.syntegra.com)
Allaire Certified Instructor and Member of Team Allaire

Email   : [EMAIL PROTECTED]
ICQ UIN : 3679482

"My ally is the Force, and a powerful ally it is." - Yoda

--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



RE: CFLOCK datasource var?

2000-08-29 Thread Dave Watts

  It's new to CF 4.5.x. It's similar to the local Variables scope
 
 Actually it was in CF 4.01. (And no, I don't mean to be nitpicky, 
 but I know a lot of people still use 4.01, so I didn't want anyone 
 to think they couldn't use it. :)

No, you're not being nitpicky at all. Better to stand corrected now than to
be wrong in the future. I don't know why I thought it was introduced in
4.5.x, since I knew that Spectra uses it.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



RE: CFLOCK datasource var?

2000-08-29 Thread Dave Watts

 Yeah, but the "Variables" scope isn't persistent. Each time 
 a page loads it will unset itself. It would be better IMHO 
 to just do a plain vanilla CFSET.

When you do a "plain vanilla" CFSET, you're using the Variables scope. If
you set a local variable (one within the Variables scope) in
application.cfm, that local variable will be created and destroyed for each
page, which is not a bad approach for handling constants.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.