Re: cfscript Common Functions and Best Practices

2005-12-08 Thread Larry Lyons
>Setting commonly used functions to a 'permanent' memory scope such as server 
>or application is a good idea. A better one would be to create a CFC that 
>contains the common functions as well as common data and store that CFC in 
>the memory scope.

How would that work under a clustered environment? I had thought that in a 
clustered environment, CFC's are not serializable unless you use "sticky 
sessions".

thx,

larry 

--
Larry C. Lyons
Web Analyst
BEI Resources
American Type Culture Collection
email: llyons(at)atcc(dot)org
tel: 703.365.2700.2678
--

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

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


Re: cfscript Common Functions and Best Practices

2005-12-07 Thread Ryan Guill
No problem, let me know if you have any questions.

On 12/7/05, Ben Nadel <[EMAIL PROTECTED]> wrote:
> Ryan,
>
> I appreciate the response. I am definitely interested in at the very least
> taking a look at how it works, as I am very new to OOP and very interested
> in how you all get things working at such a high level.
>
> Good to know that I can use it on a project to project basis. I know this
> goes against a lot of code reuse ideas, but trust me, its how things become
> possible in my work world.
>
> Thanks,
> Ben
> ...
> Ben Nadel
> Web Developer
> Nylon Technology
> 6 West 14th Street
> New York, NY 10011
> 212.691.1134
> 212.691.3477 fax
> www.nylontechnology.com
>
> "Vote for Pedro"
>
--
Ryan Guill
BlueEyesDevelopment
[EMAIL PROTECTED]
www.ryanguill.com
(270) 217.2399
got google talk?  Chat me at [EMAIL PROTECTED]

The Coldfusion Open Application Library - COAL - http://coal.ryanguill.com

www.ryanguill.com/
The Roman Empire: www.ryanguill.com/blog/

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

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


RE: cfscript Common Functions and Best Practices

2005-12-07 Thread Ben Nadel
Ryan,

I appreciate the response. I am definitely interested in at the very least
taking a look at how it works, as I am very new to OOP and very interested
in how you all get things working at such a high level. 

Good to know that I can use it on a project to project basis. I know this
goes against a lot of code reuse ideas, but trust me, its how things become
possible in my work world.

Thanks,
Ben
...
Ben Nadel 
Web Developer
Nylon Technology
6 West 14th Street
New York, NY 10011
212.691.1134
212.691.3477 fax
www.nylontechnology.com

"Vote for Pedro"

-Original Message-
From: Ryan Guill [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 07, 2005 9:39 AM
To: CF-Talk
Subject: Re: cfscript Common Functions and Best Practices

You do not have to put the files outside of the current application or
have any mappings if you dont want.  You certainly can if you want to
take advantage of some features such as the ability to share the same
exactly librarlies across applications, but it is not a requirement.

You can download coal, extract out the folder and stick it right into
your application.  Just make it a top level directory.  Everything
*should* work from there.

And if you had other requirements, it should be easy enough for you to
modify to get it to suit your needs.

But you can just download it, and stick the COAL directory inside your
application directory.  Shouldnt be any problems, and if so, let me
know.

At any rate, just wanted to let you know about it.  If nothing else,
you may be able to look at COAL and how it does things and be able to
adapt something similar to suit your needs.


~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

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


Re: cfscript Common Functions and Best Practices

2005-12-07 Thread Ryan Guill
You do not have to put the files outside of the current application or
have any mappings if you dont want.  You certainly can if you want to
take advantage of some features such as the ability to share the same
exactly librarlies across applications, but it is not a requirement.

You can download coal, extract out the folder and stick it right into
your application.  Just make it a top level directory.  Everything
*should* work from there.

And if you had other requirements, it should be easy enough for you to
modify to get it to suit your needs.

But you can just download it, and stick the COAL directory inside your
application directory.  Shouldnt be any problems, and if so, let me
know.

At any rate, just wanted to let you know about it.  If nothing else,
you may be able to look at COAL and how it does things and be able to
adapt something similar to suit your needs.

On 12/7/05, Ben Nadel <[EMAIL PROTECTED]> wrote:
> Ryan,
>
> I don't know much about COAL, but I can tell you that I am not a big fan of
> any framework that requires the installing of "Core" files outside of the
> current application or any mappings of any kind.
>
> 
>
> Between work and home, I work on the same project on as many as 4 different
> servers and if I have to do anything except sync of the actually application
> directory, it becomes a total nightmare, especially considering that I do
> not have access to the wwwroot folder on 3 of the 4 servers.
>
> I am not putting COAL down, only saying that I don't think I can really take
> advantage of it in my current situation.
>
> ...
> Ben Nadel
> Web Developer
> Nylon Technology
> 6 West 14th Street
> New York, NY 10011
> 212.691.1134
> 212.691.3477 fax
> www.nylontechnology.com
>
> "Vote for Pedro"
>
> -Original Message-----
> From: Ryan Guill [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 07, 2005 9:06 AM
> To: CF-Talk
> Subject: Re: cfscript Common Functions and Best Practices
>
> Just so you know, you can also use COAL to do something similar.
>
> You just create an object out of COAL, and then you can access your
> different libraries at the time you need them.
>
> And all of cflib.org's libraries are already in COAL.
>
> You can check out COAL here: http://coal.ryanguill.com/
>
>
> 

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

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


RE: cfscript Common Functions and Best Practices

2005-12-07 Thread Ben Nadel
Ryan,

I don't know much about COAL, but I can tell you that I am not a big fan of
any framework that requires the installing of "Core" files outside of the
current application or any mappings of any kind. 

 

Between work and home, I work on the same project on as many as 4 different
servers and if I have to do anything except sync of the actually application
directory, it becomes a total nightmare, especially considering that I do
not have access to the wwwroot folder on 3 of the 4 servers. 

I am not putting COAL down, only saying that I don't think I can really take
advantage of it in my current situation.

...
Ben Nadel 
Web Developer
Nylon Technology
6 West 14th Street
New York, NY 10011
212.691.1134
212.691.3477 fax
www.nylontechnology.com

"Vote for Pedro"

-Original Message-
From: Ryan Guill [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 07, 2005 9:06 AM
To: CF-Talk
Subject: Re: cfscript Common Functions and Best Practices

Just so you know, you can also use COAL to do something similar.

You just create an object out of COAL, and then you can access your
different libraries at the time you need them.

And all of cflib.org's libraries are already in COAL.

You can check out COAL here: http://coal.ryanguill.com/


~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

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


Re: cfscript Common Functions and Best Practices

2005-12-07 Thread Ryan Guill
Just so you know, you can also use COAL to do something similar.

You just create an object out of COAL, and then you can access your
different libraries at the time you need them.

And all of cflib.org's libraries are already in COAL.

You can check out COAL here: http://coal.ryanguill.com/

On 12/7/05, Ben Nadel <[EMAIL PROTECTED]> wrote:
> Ryan,
>
> I store my UDFs in a CFC called UDFLib. The UDFLib then in turn composes its
> own sub libraries for easier code organization:
>
> // Inside the INIT for UDFLib
> THIS.Array = CreateObject("component", "udflib.ArrayLib").Init(THIS);
> THIS.String = CreateObject("component", "udflib.StringLib").Init(THIS);
> THIS.System = CreateObject("component", "udflib.SystemLib").Init(THIS);
> THIS.Validation = CreateObject("component",
> "udflib.ValidationLib").Init(THIS);
>  etc ...
>
>
> Then I store the parent library in the APPLICATION scope, but inside of a
> ServiceFactory. I am new to OOP and not sure if this is the best method, but
> then in my page pre-request area I have
>
> REQUEST.UDFLib = APPLICATION.ServiceFactory.GetUDFLib();
>
> Then for anywhere on the page I can use calls like:
>
> REQUEST.UDFLib.Validation.IsEmail(FORM.user_email);
>
> Or
>
> REQUEST.UDFLib.String.ToMixedCase(qBlam.foo);
>
> Since the ServiceFactory is only created once and stored in APPLICATION and
> itself creates and stores one copy of UDFLib, then it gets cached while the
> application is running.
>
> Hope that helps at all.
>
> ...
> Ben Nadel
> Web Developer
> Nylon Technology
> 6 West 14th Street
> New York, NY 10011
> 212.691.1134
> 212.691.3477 fax
> www.nylontechnology.com
>
> "Vote for Pedro"
> -Original Message-
> From: Ryan Duckworth [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 06, 2005 5:54 PM
> To: CF-Talk
> Subject: cfscript Common Functions and Best Practices
>
> Currently we have many functions that we use within cfscript.  We are
> storing them in the request scope (see 2 examples below).
>
>
> Here is what I am don't like about this approach:  Every page hit from
> every user is loading these common functions.  I personally am not
> convinced that the request scope is the best place for these types of
> functions.  I'm sure that many of you out there use functions of your
> own and from www.cflib.org.  Is the server scope a better place for
> these?  Should we only reload the functions if they are not already
> defined in the server scope?
>
> Thanks,
> Ryan
>
>
> 

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

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


RE: cfscript Common Functions and Best Practices

2005-12-07 Thread Ben Nadel
Ryan,

I store my UDFs in a CFC called UDFLib. The UDFLib then in turn composes its
own sub libraries for easier code organization:

// Inside the INIT for UDFLib
THIS.Array = CreateObject("component", "udflib.ArrayLib").Init(THIS);
THIS.String = CreateObject("component", "udflib.StringLib").Init(THIS);
THIS.System = CreateObject("component", "udflib.SystemLib").Init(THIS);
THIS.Validation = CreateObject("component",
"udflib.ValidationLib").Init(THIS);
 etc ...


Then I store the parent library in the APPLICATION scope, but inside of a
ServiceFactory. I am new to OOP and not sure if this is the best method, but
then in my page pre-request area I have

REQUEST.UDFLib = APPLICATION.ServiceFactory.GetUDFLib();

Then for anywhere on the page I can use calls like:

REQUEST.UDFLib.Validation.IsEmail(FORM.user_email);

Or 

REQUEST.UDFLib.String.ToMixedCase(qBlam.foo);

Since the ServiceFactory is only created once and stored in APPLICATION and
itself creates and stores one copy of UDFLib, then it gets cached while the
application is running.

Hope that helps at all. 

...
Ben Nadel 
Web Developer
Nylon Technology
6 West 14th Street
New York, NY 10011
212.691.1134
212.691.3477 fax
www.nylontechnology.com

"Vote for Pedro"
-Original Message-
From: Ryan Duckworth [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 06, 2005 5:54 PM
To: CF-Talk
Subject: cfscript Common Functions and Best Practices

Currently we have many functions that we use within cfscript.  We are
storing them in the request scope (see 2 examples below).


Here is what I am don't like about this approach:  Every page hit from
every user is loading these common functions.  I personally am not
convinced that the request scope is the best place for these types of
functions.  I'm sure that many of you out there use functions of your
own and from www.cflib.org.  Is the server scope a better place for
these?  Should we only reload the functions if they are not already
defined in the server scope?

Thanks,
Ryan


~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

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


RE: cfscript Common Functions and Best Practices

2005-12-06 Thread Bobby Hartsfield
There was a thread not long ago about storing them in the application scope.
It sounded reasonable but I haven’t tried it so I can't elaborate on any
performance issues it might cause or clear up. You should be able to find
the thread in the archives.

..:.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com


-Original Message-
From: Ryan Duckworth [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 06, 2005 5:54 PM
To: CF-Talk
Subject: cfscript Common Functions and Best Practices

Currently we have many functions that we use within cfscript.  We are
storing them in the request scope (see 2 examples below).


Here is what I am don't like about this approach:  Every page hit from
every user is loading these common functions.  I personally am not
convinced that the request scope is the best place for these types of
functions.  I'm sure that many of you out there use functions of your
own and from www.cflib.org.  Is the server scope a better place for
these?  Should we only reload the functions if they are not already
defined in the server scope?

Thanks,
Ryan












request.abort = abort;
request.sleep = sleep;



Call from within cfscript tag:
request.sleep(3000);
request.abort();



~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

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


Re: cfscript Common Functions and Best Practices

2005-12-06 Thread Michael Dinowitz
Setting commonly used functions to a 'permanent' memory scope such as server 
or application is a good idea. A better one would be to create a CFC that 
contains the common functions as well as common data and store that CFC in 
the memory scope.


> Currently we have many functions that we use within cfscript.  We are
> storing them in the request scope (see 2 examples below).
>
>
> Here is what I am don't like about this approach:  Every page hit from
> every user is loading these common functions.  I personally am not
> convinced that the request scope is the best place for these types of
> functions.  I'm sure that many of you out there use functions of your
> own and from www.cflib.org.  Is the server scope a better place for
> these?  Should we only reload the functions if they are not already
> defined in the server scope?
>
> Thanks,
> Ryan


~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

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