Got issues with OpenOffice & ColdFusion 9 Multi-server?
Aaron Longnion
Director of Internet Technology
www.PeopleXS.com
www.Twitter.com/aqlong
Join the PeopleXS Community at www.peoplexs.com/communities/nl/
Aaron Longnion // ColdFusion architect, American expat living and working at www.Peoplexs.com, near The Hague (Den Haag) in The Netherlands
I'm excited that I've just been informed by my colleague at Peoplexs, Maurice Crama, that Ben Forta will be gracing us with his presence at our humble CFUGNL in Amsterdam on 10 March, 2010.
Sign up now while there's still room: http://www.cfug.nl/default/index.cfm/agenda/meeting-cfug-maart/
It's of course at Adobe's office in Amsterdam: map.
I'm not sure if this is smart in all situations, but if you have a borked version of MySQL (5.0 in my case), and want to install a higher version of it, you can use these commands in Linux (RHEL in my case) to force installation on the server- and client- RPM files, assuming those files are in the current directory:
1/14/10 7:57 PM System of a Down Drummer Boy Will Melt Your Face Off [VIDEO] - http://bit.ly/4rwLJi |
Sent from my iPhone
trying to work up the nerve to do it tomorrow (2010)... who's with me?!
Ok, so I know that I've said (many times) that including layout in a CFC is generally a bad idea. I still think it is. But like most rules there are always exceptions. Normally this wouldn't be a big deal, but HTML and JavaScript within a script based component is - well - it's ugly. Here is an example:
1 case "textbox": {
2 return s & '<input type="text" name="#arguments.name#" value="#currentValue#">';
3 }This simple example works, but more complex HTML gets messier. I could have switched the component over to tags. It's not like that would be the end of the world! But then I remember - you can use savecontent within script based cfcs. So instead of the inline HTML you see above, I now use:
1 case "event date": {
2 savecontent variable="s" {
3 include "render/eventdate.cfm";
4 }
5 return s;
6 }Woot. I wish I had remembered this when I began the project, but I'm guessing I'll be getting used to ColdFusion 9 syntax until right around the release of ColdFusion 10.
This entry was posted on Tuesday, December 22, 2009 at 9:29 PM. It was filed in the following categories: ColdFusion. It has been viewed 901 times and has 6 comments.
TweetBacks
There are no TweetBacks for this entry.Comments
[Add Comment] [Subscribe to Comments]
Comment 1 written by Daniel Budde on 23 December 2009, at 8:09 AM
Although, I am not on CF9 yet, I have ran into this in the past when I wanted to e-mail template based reports from within my CFC. The reports already existed as HTML templates within the application, so the easy fix was to use <cfsavecontent> with a <cfinclude>.![]()
It always makes me feel a little bad to have to break encapsulation, but as you say, there are those exceptions to the rule. I always just comment them well and since they are few and far between, they have just never caused any trouble.
Comment 2 written by Tony Nelson on 23 December 2009, at 9:34 AM
You'll want to be careful when using .cfm mixins inside singleton components to make sure any variables declared within the mixin are thread-safe.![]()
Comment 3 written by Raymond Camden on 23 December 2009, at 9:54 AM
Agreed. I'm forcing myself to use local.x for all variables. I normally do NOT like local.foo, I just var scope, but for this component I'm using it as a way to ensure I'm always local.![]()
Comment 4 written by Daniel Budde on 23 December 2009, at 9:59 AM
I do the same as well. All my variables used within the template are always located under (LOCAL.templateInfo).![]()
Comment 5 written by Tony Nelson on 23 December 2009, at 10:31 AM
If you don't want to have to use local.x everywhere, you could create a small Include.cfc proxy for including templates.![]()
case "event date": {
return new Include("render/eventdate.cfm",arguments);
}Include.cfc:
component {
public string function init(template, params) {
structDelete(variables, "init");
structDelete(variables, "this");
structAppend(variables, arguments.params);
savecontent variable="local.html" {
include arguments.template;
}
return local.html;
}
}Now any variables declared inside render/eventdate.cfm won't bleed into your component.
Comment 6 written by Raymond Camden on 23 December 2009, at 10:32 AM
That's slick as crap. Thanks Tony.![]()
read the comments on Ray's blog, too. Cool code there, too.
Don't know why, but this puts me in a holiday mood. Relax and enjoy some of the best music of all time...