-
From: Charles Sheehan-Miles [EMAIL PROTECTED]
To: CF-Talk cf-talk@houseoffusion.com
Date: Wed, 19 Apr 2006 23:19:13 -0400
Subject: Re: Evaluate vs ?
I'm going to have to do some serious thinking about this. Performance
on
the mailer is a lot slower than I'd like, and I suspect its because I'm
Performance on
the mailer is a lot slower than I'd like, and I suspect its because I'm
using evaluate.
Here is a test I made on my develop system (3000 MHz):
CFSET myStruct = structNew ()
CFSET myStruct.myvar = test
CFSET start = GetTickCount()
CFLOOP INDEX=i FROM=1 TO=10
CFSET test =
I think that bites more people than not in regards to optimization.
On 4/20/06, Claude Schneegans [EMAIL PROTECTED] wrote:
There are many other places to look for optimization, the first being
queries and correct indexes in the database.
.
BTW, if your sending out that much mail, I hope you have a dedicated SMTP
server and are not using the SMTP on IIS.
Russ
-Original Message-
From: Charles Sheehan-Miles [EMAIL PROTECTED]
To: CF-Talk cf-talk@houseoffusion.com
Date: Wed, 19 Apr 2006 23:19:13 -0400
Subject: Re: Evaluate
) Michaels
-Original Message-
From: Bruce, Rodney S C-E LCMC HQISEC/Signal Solutions
[EMAIL PROTECTED]
To: CF-Talk cf-talk@houseoffusion.com
Date: Tue, 18 Apr 2006 13:30:08 -0700
Subject: RE: Evaluate vs ?
Ok, guess I am missing something here:
cfset foo = fee fi fo fum #variable
-Original Message-
From: Bruce, Rodney S C-E LCMC HQISEC/Signal Solutions
[EMAIL PROTECTED]
To: CF-Talk cf-talk@houseoffusion.com
Date: Tue, 18 Apr 2006 13:30:08 -0700
Subject: RE: Evaluate vs ?
Ok, guess I am missing something here:
cfset foo = fee fi fo fum #variable
Dave Watts said:
What's the matter with using evaluate?
It's generally more expensive to tell the computer to treat a
literal string as an expression, than to just give the computer an
expression in the first place.
I think the bigger issue is the question where that string expression
a bit late on this post, but heres another example:
http://www.succor.co.uk/index.cfm/2006/4/13/Avoid-evaluate-always
On 18/04/06, Dave Watts [EMAIL PROTECTED] wrote:
What's the matter with using evaluate?
It's generally more expensive to tell the computer to treat a literal
string
as an
How would you fix this one?
Cfset Month1 = 0101
Cfset Month2 = 0102
Cfset Month3 = 0103
Cfloop from=1 to=3 index=i
cfset CMonth = Month i
cfset CCMonth = #Evaluate(CMonth)#
/cfloop
Lee Surma
~|
Message:
How would you fix this one?
Cfset Month1 = 0101
Cfset Month2 = 0102
Cfset Month3 = 0103
Cfloop from=1 to=3 index=i
cfset CMonth = Month i
cfset CCMonth = #Evaluate(CMonth)#
/cfloop
cfset CCMonth = variables[Month i]
Jochem
cfset cmonth = variables[month i] /
then no need for CMonth
On 4/18/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
How would you fix this one?
Cfset Month1 = 0101
Cfset Month2 = 0102
Cfset Month3 = 0103
Cfloop from=1 to=3 index=i
cfset CMonth = Month i
cfset CCMonth =
cfset Month1 = 0101
cfset Month2 = 0102
cfset Month3 = 0103
cfloop from=1 to=3 index=i
cfset CCMonth = variables[Month i]
/cfloop
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 18, 2006 10:20 AM
To: CF-Talk
Subject: RE: Evaluate vs
variables['cMonth' i]
(assuming the variables scope, of course)
On 4/18/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
How would you fix this one?
Cfset Month1 = 0101
Cfset Month2 = 0102
Cfset Month3 = 0103
Cfloop from=1 to=3 index=i
cfset CMonth = Month i
cfset CCMonth =
#
/cfloop
What's the expected outcome, or output?
--
Timothy Heald
Analyst, Architect, Developer
[EMAIL PROTECTED]
W: 202-228-8372
C: 703-300-3911
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 18, 2006 10:20 AM
To: CF-Talk
Subject: RE: Evaluate vs
PROTECTED]
Sent: Tuesday, April 18, 2006 10:24 AM
To: CF-Talk
Subject: Re: Evaluate vs ?
variables['cMonth' i]
(assuming the variables scope, of course)
On 4/18/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
How would you fix this one?
Cfset Month1 = 0101
Cfset Month2 = 0102
Cfset Month3 = 0103
What about this one:
cfloop collection=struct_Params item=theKey
cfset Evaluate(myObject.set#theKey#(struct_Params.#theKey#) /
/cfloop
Basically it is calling a setter method based on what is in the a structure.
The cfset would evaluate to myObject.setFirstName('Matt')
cfset myObject['set' theKey](struct_Params[theKey]) /
^ untested :)
On 4/18/06, Matt Williams [EMAIL PROTECTED] wrote:
What about this one:
cfloop collection=struct_Params item=theKey
cfset Evaluate(myObject.set#theKey#(struct_Params.#theKey#) /
/cfloop
Basically it is calling a setter
Not sure what you're going for here, the above could be used in about
the
same way or something like this:
My example was altered and simplified. It goes to 12. Variables worked
and speeded the page load slightly. Some of the other object type
examples are intriguing.
Lee Surma
Charlie,
It didn't like that. Error message here.
Invalid CFML construct found...
ColdFusion was looking at the following text:
(
So then I tried moving the first closing bracked to include the arguments,
but no go there either. This can be emulated if you have an object with a
getter function
Matt,
What about this one:
cfloop collection=struct_Params item=theKey
cfset Evaluate(myObject.set#theKey#(struct_Params.#theKey#) /
/cfloop
Basically it is calling a setter method based on what is in the a
structure.
The cfset would evaluate to myObject.setFirstName('Matt')
This is
cfset getter = FirstName
cfset myFN = myObject['get' getter]() / ---Throws error
Other try:
cfset myFN = myObject['get' getter '()'] / ---Also errors
It's just a shoot in the dark, but, in my experience, if you want to
dinamically define the method's name cfinvoke gives you more
Dan,
This was close, but acts strange. I can do the following:
cfoutput
#myObject.getFirstName()# --- outputs correctly.
cfset getter = FirstName /
cfset doMethod = myObject[get getter] /
cfset myFN = doMethod() / --- throws error
#myFN#
/cfoutput
The error thrown by the doMethod() line is
For cfinvoke to use an object instance,just do
component=#inst#
instead of
component=somename
On 4/18/06, Matt Williams [EMAIL PROTECTED] wrote:
Dan,
This was close, but acts strange. I can do the following:
cfoutput
#myObject.getFirstName()# --- outputs correctly.
cfset getter =
So from Massimo and Ray's suggestions, it can it work.
cfset getter = FirstName /
cfinvoke component=#myObject# method=get#getter# returnvariable=theFN
/
cfoutput#theFN#/cfoutput
No errors and output as expected.
But it seems the other should be possible too? Have I stumped the
CF-Talkers?
Is there a time when evaluate should be used?
It's generally more expensive to tell the computer to treat a literal string
as an expression, than to just give the computer an expression in the first
place.
~|
Message:
No.
--
Timothy Heald
Analyst, Architect, Developer
[EMAIL PROTECTED]
W: 202-228-8372
C: 703-300-3911
-Original Message-
From: Stan Winchester [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 18, 2006 1:12 PM
To: CF-Talk
Subject: Re: Evaluate vs ?
Is there a time when evaluate should
Is there a time when evaluate should be used?
There WAS a time, when structures were not available in CF, but
nowadays, you can always avoid it.
--
___
REUSE CODE! Use custom tags;
See http://www.contentbox.com/claude/customtags/tagstore.cfm
(Please send
Is there a time when evaluate should be used?
If you want to dynamically build an unpredictable string which contains
logic, rather than just variable names, then afaik you can only invoke the
logic using Evaluate(). But then again, that's not something that people
need to do very often.
Nick
Matt,
So from Massimo and Ray's suggestions, it can it work.
cfset getter = FirstName /
cfinvoke component=#myObject# method=get#getter#
returnvariable=theFN
/
cfoutput#theFN#/cfoutput
No errors and output as expected.
But it seems the other should be possible too? Have I stumped the
Sometimes I send out emails through my system which dynamically generate the
content from variables:
example:
Last year you gave $#lsnumberformat(lastyear, 9.99)# to support our work.
This year we hope you'll give $#lsnumberformat(lastyear*2, 9.99)#.
My mailer routine uses evaluate against the
Last year you gave $#lsnumberformat(lastyear, 9.99)# to support our
work.
This year we hope you'll give $#lsnumberformat(lastyear*2, 9.99)#.
My mailer routine uses evaluate against the string to parse out those
values, then it is sent out via cfmail inside a loop. If Evaluate() isn't
:01 -0400
Subject: Re: Evaluate vs ?
Sometimes I send out emails through my system which dynamically
generate the
content from variables:
example:
Last year you gave $#lsnumberformat(lastyear, 9.99)# to support our
work.
This year we hope you'll give $#lsnumberformat(lastyear*2, 9.99
-
From: Claude Schneegans [EMAIL PROTECTED]
To: CF-Talk cf-talk@houseoffusion.com
Date: Tue, 18 Apr 2006 13:22:35 -0400
Subject: Re: Evaluate vs ?
Is there a time when evaluate should be used?
There WAS a time, when structures were not available in CF, but
nowadays, you can always avoid
]
Sent: Tuesday, April 18, 2006 12:04 PM
To: CF-Talk
Subject: Re: Evaluate vs ?
that's not really true claude,
take the following.
cfset foo = fee fi fo fum #variable# this is dynamic content
You would need to use DE() and Evaluate() to output the content of foo
properly with any variables
[mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 18, 2006 12:04 PM
To: CF-Talk
Subject: Re: Evaluate vs ?
that's not really true claude,
take the following.
cfset foo = fee fi fo fum #variable# this is dynamic content
You would need to use DE() and Evaluate() to output the content of foo
-Miles [EMAIL PROTECTED]
To: CF-Talk cf-talk@houseoffusion.com
Date: Tue, 18 Apr 2006 13:42:01 -0400
Subject: Re: Evaluate vs ?
Sometimes I send out emails through my system which dynamically
generate the content from variables:
example:
Last year you gave $#lsnumberformat(lastyear, 9.99
Is there a time when evaluate should be used?
Nick's answer is pretty much on target. It used to be the case that you
needed to do this, because in some cases you had no way to reference
variable names when you didn't know them until runtime. As CF's scopes
became exposed as structures, the need
I've read you should not use Evaluate(). In the following example, what
would be best practice?
cfloop index=i from=1 to=#FORM.itemsOnPage#
set Quantity = val(Evaluate(FORM.Quantity_ i)) /
/cfloop
Thank you,
Aftershock Web Design, Inc.
by: Stan Winchester
President/Developer
cfset Quantity = form.[Quantity_#i#] /
On 4/17/06, Stan Winchester [EMAIL PROTECTED] wrote:
I've read you should not use Evaluate(). In the following example, what
would be best practice?
cfloop index=i from=1 to=#FORM.itemsOnPage#
set Quantity = val(Evaluate(FORM.Quantity_ i)) /
Err, sorry, no period in there...
On 4/17/06, Ryan Guill [EMAIL PROTECTED] wrote:
cfset Quantity = form.[Quantity_#i#] /
On 4/17/06, Stan Winchester [EMAIL PROTECTED] wrote:
I've read you should not use Evaluate(). In the following example, what
would be best practice?
cfloop
You could use #form['quantity_' i]#
On 4/17/06, Stan Winchester [EMAIL PROTECTED] wrote:
I've read you should not use Evaluate(). In the following example, what
would be best practice?
cfloop index=i from=1 to=#FORM.itemsOnPage#
set Quantity = val(Evaluate(FORM.Quantity_ i)) /
Stan Winchester wrote:
I've read you should not use Evaluate(). In the following example, what
would be best practice?
cfloop index=i from=1 to=#FORM.itemsOnPage#
set Quantity = val(Evaluate(FORM.Quantity_ i)) /
/cfloop
cfloop index=i from=1 to=#Val(form.itemsOnPage)#
set Quantity =
Thanks everybody! I thought it was something like that.
cfloop index=i from=1 to=#FORM.itemsOnPage#
set Quantity = val(Evaluate(FORM.Quantity_ i)) /
/cfloop
~|
Message:
What's the matter with using evaluate?
Cheers
Mike Kear
Windsor, NSW, Australia
Certified Advanced ColdFusion Developer
AFP Webworks
http://afpwebworks.com
ColdFusion, PHP, ASP, ASP.NET hosting from AUD$15/month
On 4/18/06, Stan Winchester [EMAIL PROTECTED] wrote:
Thanks everybody! I thought
generally speaking, it's considered to be slow and somewhat
inefficient (this is not just in CF, btw... in most languages that I'm
aware of)
On 4/17/06, Mike Kear [EMAIL PROTECTED] wrote:
What's the matter with using evaluate?
Cheers
Mike Kear
Windsor, NSW, Australia
Certified Advanced
What's the matter with using evaluate?
VERY VERY BAD indeed. It will cost at least 1/2 mili sec per page, it
will completely clog the server,
waist all its banwidth, and worst: it will slow down the whole Internet
in the planet! ;-))
--
___
REUSE CODE! Use
: Re: Evaluate vs ?
Err, sorry, no period in there...
On 4/17/06, Ryan Guill [EMAIL PROTECTED] wrote:
cfset Quantity = form.[Quantity_#i#] /
On 4/17/06, Stan Winchester [EMAIL PROTECTED] wrote:
I've read you should not use Evaluate(). In the following
example, what
would be best
[mailto:[EMAIL PROTECTED]
Sent: Monday, April 17, 2006 6:49 PM
To: CF-Talk
Subject: Re: Evaluate vs ?
What's the matter with using evaluate?
Cheers
Mike Kear
Windsor, NSW, Australia
Certified Advanced ColdFusion Developer
AFP Webworks
http://afpwebworks.com
ColdFusion, PHP, ASP, ASP.NET hosting
Claude, you forgot to mention bringing about the downfall of civilisation as
we know it, and cause all our kids to learn to play the banjo.
Cheers
Mike Kear
Windsor, NSW, Australia
Certified Advanced ColdFusion Developer
AFP Webworks
http://afpwebworks.com
ColdFusion, PHP, ASP, ASP.NET hosting
What's the matter with using evaluate?
It's generally more expensive to tell the computer to treat a literal string
as an expression, than to just give the computer an expression in the first
place.
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
Fig Leaf Software provides the
50 matches
Mail list logo