Jul 22
With the release of ColdFusion 9 you can do nearly everything in script syntax that you were able to do using tags, including executing queries. I'm not really sure when this feature was introduced in Railo (probably 3.2), but you can do this in Railo as well. However, I found one inconsistency today when doing a query-of-query using script syntax.
In ColdFusion, there is a dbtype argument to the execute() method of the Query object. So to do a query-of-queries you can just specify dbtype="query" when you execute your query:
<cfscript>
// myQuery is a predifined query
// so I can execute a query against myQuery this way:
qoq = new Query();
qoq.setSQL("select * from myQuery where foo = 'bar'");
qoq.execute(dbtype="query").getResult();
</cfscript>
But when I ran this code in Railo (latest BER version 3.30.023). I got the error "Table 'mydsn.myQuery' doesn't exist"
So it was looking for a table in my db named 'myQuery' and seemed to ignore the dbtype="query" argument that I passed into the execute() function. Fortunately, you can look right into the workings of Railo's Query object by opening WEB-INF/railo/components/org/railo/cfml/Query.cfc, and by doing that you can see that there is no dbtype argument specified for execute(). However, it turns out that you can get it to work in Railo by using the setDBType() method.
<cfscript>
qoq.setDBType("query");
qoq.execute().getResult();
</cfscript>
Basically Query.cfc extends a Base.cfc component which uses onMissingMethod to enable using setters for passing in things that you would use attributes for in the tag version. So it's one extra line of code, but it works. And the good news is that it also works in ColdFusion 9. Since it is inconsistent with CF9, I submitted an issue for it. But I just thought I'd post this in case someone else runs into this issue.
Nov 22
In Mura CMS, there is the concept of templates that make up your site theme. Your theme can have multiple templates, such as a two-column template and a 3 column template which can be assigned to individual pages in your site. You can read more about templates in Mura here. Recently, while working on a Mura site, I wanted my pages to be able to dynamically use either a 2- or a 3-column template depending on whether something was assigned to the right column display region (which was display region #3 in this site).
So I whipped up this template named default.cfm:
<cfif len( trim($.dspObjects(3)) )>
<cfinclude template="three_column.cfm" />
<cfelse>
<cfinclude template="two_column_SL.cfm" />
</cfif>
So basically it checks to see if anything was assigned to the right column display region. If so, the 3 column template is rendered. If not it defaults to 2 columns. This way, I can just set all pages to the default template and let the content determine whether 2 or 3 columns are used.
Oct 8
A while back, I posted instructions on how to integrate a ColdBox application into a Mura CMS site. Basically, you edit a few files make some configuration changes which allow you to include the ColdBox front controller index.cfm into a Mura page using the [mura] tag. What I didn't make clear is, once you have the home page of the ColdBox app showing up on your page, how do you navigate into other pages (or events) of your ColdBox app? I was recently asked this question by someone who read the original blog post so I thought I'd write this as a follow up.
Read more...
Apr 21
Below is a screenshot of my Railo Development server showing the change log for the latest development release (version 3.1.2.011).

Take special note of the last 3 tickets. That's right -- you can now write properties, components, and interfaces in full cfscript with the latest development release of Railo. Thanks to Sean Corfield for pointing my attention to this. Enjoy!
Apr 1
I recently had a chance to listen to the latest edition of the This
Week in ColdFusion Podcast wherein design patterns are discussed.
One of the design patterns that Brian Carr talks about in the podcast is
the Decorator Pattern.
As an example, Brian describes how you can use the dynamic nature of
ColdFusion to assign a function to a variable and then add that function
to an object at runtime (this is also known as "method injection"). Bob Silverberg, who was a
guest on the podcast then asked Brian whether the injected method would
show up in the object's metadata if you called the getMetaData()
function on it. Brian didn't know for sure, but he and Bob agreed that
it was unlikely. This piqued my curiosity, so I set about to test this
myself.
Read more...
10-8-2010
8-30-2010
6-1-2010
4-21-2010
4-1-2010