July 13, 2003

Mach II

The Mach II website is now up! You can read about Mach II and download the (beta) framework and example code. The site is still being worked on so keep watching that space...
Posted by seancorfield at 09:17 PM | Comments (0) | TrackBack | architecture | cf

July 11, 2003

CF OOP / Architecture

I've mentioned cfoop.com before but the architecture section is beginning to contain some more interesting and in-depth commentary. The latest post about structured exception handling is a good example and while I don't agree with every point he makes, it's still worthwhile reading. I've commented on that entry, raising the specter of reuse-through-inheritance which I believe is one of the most common design errors most nOObs make and I've been threatening to write up my thoughts on this subject for many, many months (I started a draft back in October last year!). One day I will write a treatise on it!
Posted by seancorfield at 03:00 PM | Comments (0) | TrackBack | architecture | cf


Came across a somewhat strange article by Chris Preimesberger and Charlie Arehart which purports to advocate ColdFusion over JSP - in an apparent attempt to persuade CFers not to switch to JSP. The article has drawn quite a bit of flak on TheServerSide forums. Some of the criticism is deserved (for the vague swipes at JSP as a technology) and some is just noise (the usual uninformed criticisms of CFML). Read the article, read the comments on TheServerSide and make up your own mind.
My position is that CFML has a much easier learning curve than either JSP or Java while not preventing well-designed software from being written. The abilities of the language need to be discussed separately from the abilities of the developers - bad code and poorly performing applications can be built in any language!
Posted by seancorfield at 12:17 PM | Comments (2) | TrackBack | cf | j2ee

July 09, 2003

Mach II Training

Hal Helms and Ben Edwards are running a three-day training course for Mach II in August, in Las Vegas. This fourteen-unit course will take you through object-oriented programming concepts, CFCs, implicit invocation architecture and moves on to Web Services, Flash Remoting, and Plugins as well as looking at MVC and application architecture. It promises to be a comprehensive and very useful course - if you are at all interested in extending your ColdFusion skills into the OO arena. The early bird rate runs until the end of July.
Posted by seancorfield at 11:06 PM | Comments (0) | TrackBack | architecture | cf

Mach II - corfield.org

I have just added a fledgling Mach II section to my website and updated the Fusebox section.
Posted by seancorfield at 09:20 PM | Comments (0) | TrackBack | architecture | cf

Mach II - Initial Thoughts

I've just started looking at the new Mach II framework (formerly Fusebox MX). The framework is built on an implicit invocation architecture (you can read some background to this on the Fusebox Beta website), using "listeners" and "events" and comes with an MVC example application, ContactManager. The framework uses an XML configuration file to define the behavior of your application. The XML is used to specify "listeners" - CFCs that have methods invoked in response to events - "events", "views" and "plugins". Each event specifies which listeners it notifies and whether it displays a view. Each view specifies the CF page that generates that view. The plugins are CFCs that have various methods invoked at certain points in processing each request (event).
For example, the listContacts event notifies the RecentContacts listener to retrieve 'recent contacts' and the ContactManager listener to retrieve 'all contacts' and then the event selects the contactList view. An event can trigger other events. For example, the newContact event causes a form to be displayed into which you enter new contact details. Submitting the form - the createContact event - causes the ContactManager listener to be notified to create the contact and it announces that a new contact has been created (the contactCreated event). That event is, in turn, specified to generate the listContacts event so that after adding a new contact, you end up on contact listing page.
It takes a bit of getting used to if you're from a procedural background but it's certainly very elegant.
More on this later...
Posted by seancorfield at 12:05 PM | Comments (13) | TrackBack | architecture | cf

July 02, 2003

Fusebox Conference

The 4th Annual Fusebox Conference is in Las Vegas, NV this year (8/30-9/1) with the Sunday sessions devoted to Fusebox 4 and Monday's half-day session devoted to Mach-II (formerly Fusebox MX). It's a very reasonable $99 if you sign up before 7/19 (and only $149 after that).
Posted by seancorfield at 06:16 PM | Comments (0) | TrackBack | architecture | cf

June 26, 2003

Forta Blogging

Ben Forta has finally given in to the inevitable and started blogging. Ben pretty much always has something insightful to say so this ought to be a killer blog.
Posted by seancorfield at 08:18 AM | Comments (3) | TrackBack | blogging | cf

June 25, 2003

Fusebox MX Renamed Mach II

Ben Edwards announced in the Fusebox MX forums that work on FBMX continues under a new name - Mach II. There will be a new website up shortly with more information. I'll post here as I know more!
Posted by seancorfield at 08:31 AM | Comments (10) | TrackBack | architecture | cf

June 22, 2003

Fusebox MX & Nested Layouts

I continue to work on a version of my personal site using Fusebox MX. For most of the display fuses, it's been really easy to copy the dsp_xxx.php file to dsp_xxx.cfm and change references to <?= $self ?> to index.cfm.
One change that has caught me out is that FBMX no longer has the layout wrapping mechanism of FB3. I used to set the page title in the display fuse and the layout would run after the display fuse and wrap its output, including being able to use the title variable I just set in the display fuse. FBMX advocates "plug-ins" for layout so the preView() and postView() are called as the wrappers for your display fuse. Since I want to use the title variable in the pre-view plug-in, I've taken the approach of adding setTitle() to my circuit CFCs and invoking that in the fuseaction section of fusebox.xml. It uses request.title to pass the title around and I'm not sure how I feel about that from an encapsulation point of view.
Then there's nested layouts. In FB3, I used nested layouts to create the left nav in the technical section of the site but FBMX has no such concept and at the moment I'm still pondering the cleanest way to achieve something similar since there's also no longer the concept of 'executing a circuit' to which layouts can be attached. It's proving to be an interesting experiment.
Posted by seancorfield at 11:17 PM | Comments (1) | TrackBack | architecture | cf

June 21, 2003

ColdFusion MX Wins Jolt Productivity Award

This one went past under my radar: Macromedia Products Win Awards. The press release starts out with Flash and FlashCom but also mentions CFMX won a Productivity Award in the 13th Annual Jolt Awards. Software Development Magazine announced the Jolt awards in their June 2003 issue.
Posted by seancorfield at 02:56 PM | Comments (1) | TrackBack | cf

June 20, 2003

Fusebox MX

I'm starting to build a version of my personal website using Fusebox MX as an experiment. Fusebox MX is a radically different beast to 'regular' Fusebox but it's still proving to be much simpler than I expected to take the fuses from my PHP site and drop them into this ColdFusion MX prototype - although I'm still figuring out how to organize the site in the FBMX model (or rather in the FBMX view - since FBMX is MVC and most of my site is V!). I'll write this all up in due course, as I did eventually for the move from unstructured PHP to FB3 PHP.
Posted by seancorfield at 05:18 PM | Comments (8) | TrackBack | architecture | cf

June 17, 2003

ColdFusion & Flash Data Connection Kit

Ben Forta has just published an in-depth article showing how to build a complete Rich Internet Application using ColdFusion and the Flash Data Connection Kit. It's a good read and it shows just how powerful these two products are when used together.
Posted by seancorfield at 05:12 PM | Comments (0) | TrackBack | cf | mx

June 16, 2003

Globalizing ColdFusion

Paul Hastings has created a blog dedicated to globalization issues in ColdFusion. This should be a great resource for anyone considering multi-lingual applications as Paul really knows his stuff! [seen on the Daemonite blog]
Posted by seancorfield at 10:49 AM | Comments (0) | TrackBack | cf

ColdFusion Administration Breez-o

Geoff Bowers has created a great presentation using Macromedia Breeze that covers a lot of useful ColdFusion MX administration hints & tips. Big thanx to Geoff for doing this and sharing with the community!
My only quibble would be that Geoff recommends not using J2EE Session Variables - I would definitely recommend enabling those so you can take advantage of the underlying application servers session management. Not sure why Geoff disagrees - he doesn't give any reason in the preso.
Posted by seancorfield at 10:46 AM | Comments (5) | TrackBack | cf

June 11, 2003

ColdFusion MX - Java Verified

Already mentioned on Christian's blog but it bears repeating: today Macromedia announced that ColdFusion MX has achieved "Java Verified" status.
This also got a mention on The Server Side where they say a bit more about the Application Verification Kit. I'll keep watching that thread to see if any interesting comments appear.
Posted by seancorfield at 04:58 PM | Comments (0) | TrackBack | cf | j2ee

MVCF Updated

Benoit Hedard has updated his MVCF website. He has made these updates:
There is the presentation "MX applications based on MVC" that I did at CF-Europe.
I've also updated all the best practices articles:
  • no Hungarian notation anymore
  • nothing in WEB-INF anymore
  • CFC as controllers (with form remote invocation, it works wonderfully...)
I'm glad to see these changes - especially the removal of Hungarian notation! - and I'll check the site out when I get a chance.
Posted by seancorfield at 12:44 PM | Comments (0) | TrackBack | architecture | cf

June 05, 2003

A Taste of Shared Hosting

I finally have a CFMX hosted account! Right now, it's just a test account with an ISP that is asking folks to test their new 'control panel' and I don't know if it'll stay around once their test is complete, but it will give me a sense of what life is like on a shared server.
So far, the experience has been good: the control panel seems well-designed but, obviously, limited in functionality since you don't get a full CF Admin to play with. Not sure yet what I'll put up there by way of a test, probably a small DB-driven Fusebox MX application if I can think of something worthwhile to build.
Posted by seancorfield at 10:47 AM | Comments (4) | TrackBack | cf

June 04, 2003

CFMX for J2EE on WebSphere

IBM have a great article on their DeveloperWorks site about sharing sessions between ColdFusion MX and WebSphere. Even if you're not specifically using WebSphere, the article should provide you with an interesting insight into how the two technologies - ColdFusion and J2EE - interact.
Posted by seancorfield at 03:05 PM | Comments (0) | TrackBack | cf | j2ee

June 03, 2003


Don't forget: CFUN-03 is just $249 registration through the 14th of June (and then $299). CFUN-03 is June 21st & 22nd in Maryland.
Posted by seancorfield at 07:53 PM | Comments (0) | TrackBack | cf

Why is CFMX on Mac OS X so great?

Christian Cantrell waxes lyrical about why you should be excited about ColdFusion MX on Mac OS X! Christian talks about why Mac OS X provides the best of both worlds: robust, powerful Unix with an easy to use GUI and all the standard desktop software. The convenience of a PC with the power of a *nix server! Almost every week I see another member of my team has switched from Windows to Mac, with Powerbooks replacing Wintel laptops. Everyone seems very happy with their choice to switch.
Posted by seancorfield at 04:26 PM | Comments (9) | TrackBack | cf | osx

CFMX for J2EE & Hardware Load Balancing

Brandon Purcell and Frank DeRienzo have just published a great article about setting up hardware load balancing for ColdFusion MX and J2EE application servers. This gives the background to how macromedia.com is set up as well as showing what other enterprise-class options you have with hardware load balancing.
Posted by seancorfield at 03:32 PM | Comments (1) | TrackBack | cf | j2ee

June 02, 2003

Red Sky / CFMX

Phil Costa talks about the next release of ColdFusion MX, a.k.a. red Sky. This is a maintenance release and will be a free upgrade for existing ColdFusion MX customers.
Posted by seancorfield at 11:31 AM | Comments (0) | TrackBack | cf

May 30, 2003

Useful CF Links

The ColdFusion Administrator home page has a lot of useful links on it. But you have to log in to see them. Here's a useful page on macromedia.com that provides the same links.
Posted by seancorfield at 11:17 AM | Comments (0) | TrackBack | cf

May 29, 2003

Extending the CF Administrator

A little-known but useful tip: you can add a CUSTOM EXTENSIONS menu item to the left navigation of the CF admin containing your own links. In the /CFIDE/administrator/ directory, create a file called extensionscustom.cfm and put in your links, separated by <br />. Each link should have target="content" so the result of the link will show up in the main frame within the administrator.
It's listed deep within the ColdFusion 5 Release Notes but I don't know if it's mentioned anywhere else.
Posted by seancorfield at 01:22 PM | Comments (0) | TrackBack | cf

May 22, 2003

Why ColdFusion for J2EE Development?

Ben Forta has a great presentation online about why J2EE developers should look at ColdFusion MX as a powerful RAD tool for building J2EE-based web applications.
Posted by seancorfield at 11:18 AM | Comments (1) | TrackBack | cf | j2ee

May 19, 2003

CF Directory Structures

Tim Buntel's DevNet article about the directory structure of the CFMX Pet Market application refers to my blog and a caveat I posted about directory naming for Web Service CFCs. I mention this again here because Tim's article just refers to my blog's top-level URL rather than to the actual post - this will help readers locate the entry!
Posted by seancorfield at 05:24 PM | Comments (0) | TrackBack | cf

Blog Software in CFML (again!)

I got quite a response to my recent post on this subject so I've put together a fledgling Blogging in ColdFusion page that lists the ones I know about. Let me know of others and your experiences with them.
Posted by seancorfield at 02:21 PM | Comments (1) | TrackBack | blogging | cf

May 17, 2003

Blog Software in CFML

In the continuing search for blogging software written in ColdFusion, I was made aware of this CFXML Blog project website. It uses CFCs and stores blog data in XML so the source code is an interesting example of what ColdFusion MX lets you do. The source code is in Italian which might be a bit of a culture shock but it's still pretty easy to follow the code. The resulting blog looks good, is W3C compliant and seems to be pretty fast.
Posted by seancorfield at 05:03 PM | Comments (13) | TrackBack | cf

Comparing Haskell & ColdFusion

I enthused about Haskell without giving any examples of the language and, since many folks have never seen any Haskell code, I thought I'd show how it compares to CFML.
Let's take a simple example - we have a list and we want to apply a transformation of some sort to every element. Perhaps we have a list of strings and we want a list of their lengths, e.g., "This,is,a,list" would produce "4,2,1,4". This is pretty simple to do in CFML. Now let's suppose that we want to write a UDF to do this transformation - for arbitrary lists and arbitrary transformations - mapping a transform (function) across a list. We'll call the function map and it will take two arguments: a function to perform the transformation and the list to transform. If we have a function square() that returns the square of its integer argument, we want to be able to say map(square,"1,2,3,4") and get back "1,4,9,16". Here's the CFML for map:
function map(f,l) {
	if ( l is "" ) {
		return "";
	} else {
		return listPrepend( map( f, listDeleteAt(l,1) ), f( listGetAt(l,1) ) );
Note that I'm using recursion. The logic of the UDF says "if l is an empty list then return an empty list, else return f applied to the first element of the list followed by the list obtained by mapping f across the remainder of the list". The order of arguments for listPrepend make the code read rather strangely but, trust me, that's what the UDF does.
Given a few simple UDFs, we can try some things out:
function square(x) { return x * x; }
function length(x) { return len(x); }

sq = map(square,"1,2,3,4,5");
ln = map(length,"This,is,a,list!");
We have to define a wrapper for the len() function because we can't pass built-in functions into map() directly. Try it out and convince yourself that it works... Try mapping a few more functions across various lists...
Once you're comfortable with that, we'll look at the equivalent in Haskell. The first thing to know is that Haskell is a typed language so you declare each function's 'type signature' first. However, let's look at how map() would be defined in Haskell before we look at its type:
map f [] = []
map f (x:xs) = (f x) : (map f xs)
In Haskell, [] is an empty list and (x:xs) is a list that begins with x and has xs as the rest of the list. You can often remove the conditionals (if/else) by declaring multiple patterns for the function arguments. Trust me that this is equivalent to the ColdFusion UDF above!
Now let's look at the types involved. The second argument to map() is a list of something (a) so we designate that with [a]. The first argument is a function that takes an argument of one type (a) and returns a result of a possibly different type (b) so we designate that with a -> b. The result of map() is a list (of type b). map() is therefore declared:
map :: (a -> b) -> [a] -> [b]
I'll probably post some more articles exploring Haskell and comparing it with CFML in due course.
Posted by seancorfield at 03:33 PM | Comments (1) | TrackBack | cf

When cfobject and createObject() are disabled

If you're on a shared host, you might find that your hosting company has disabled cfobject and createObject() so that you can't instantiate Java objects. In ColdFusion MX, you can call getClass() on any simple expression to object an object of type Class. From that you can load the class for any other type, using forName("my.package.MyClass"). Once you have that, you can instantiate the class using newInstance() as long as it has a default constructor:
x = 0;
classObject = x.getClass();
myClassHandle = classObject.forName("my.package.MyClass");
myClassObject = myClassHandle.newInstance();
If your class does not have a default constructor, you have to jump through a few more hoops. First, you have to get the appropriate constructor (getConstructor(Class[] parameterTypes)) which means you have to construct an array of the appropriate Java class objects. I'm not going to go into that today but if folks want me to some code, I'll write it up and post it (otherwise, it's an exercise for the reader!).
Posted by seancorfield at 01:22 PM | Comments (3) | TrackBack | cf

May 16, 2003


Macromedia's DevNet is fairly Mac-heavy right now, including an article on installing CFMX on Mac OS X. The new Flash Detection Kit is also heavily featured.
Posted by seancorfield at 11:12 PM | Comments (0) | TrackBack | cf | macromedia | mx | osx

CFLib.org RSS Feed

Seen on Ray Camden's blog, CFLib now has an RSS feed describing new utilities on the site.
Posted by seancorfield at 11:05 PM | Comments (0) | TrackBack | blogging | cf

May 15, 2003

CFMX : Coming Up

The Twin Cities ColdFusion User Group was host to Ben Forta recently and he talked about the next CFMX release. A lot of enhancements coming down the pipe. Stay tuned for more information soon!
Posted by seancorfield at 07:47 AM | Comments (0) | TrackBack | cf

May 11, 2003

Fusebox 4 & Fusebox MX Forums

The Fusebox(.org) site has new forums specifically for discussing Fusebox 4 and Fusebox MX. If you're following Fusebox development, you should check out the new forums.
Posted by seancorfield at 10:22 PM | Comments (0) | TrackBack | cf

May 07, 2003

Meet The Makers & Jeremy Allaire

As part of the ongoing Conversations series, Jeremy Allaire is interviewed about ColdFusion, the web and the future of wireless.
Posted by seancorfield at 09:59 PM | Comments (0) | TrackBack | cf | wifi

CFMX for J2EE & Windows

Yesterday I did my first full install of JRun 4 and CFMX for J2EE on Windows. Last time I worked on Windows, CFMX Server had just been released and CFMX for J2EE was under development. I'd gotten used to installing CFMX Server on Windows (I did it countless times during the Neo development cycle!) so it was a pleasant surprise to find how smooth the process was.
JRun 4 installed cleanly and uneventfully (on C:\), although the server didn't have Java installed so halfway through the JRun install I had to pause while I downloaded and installed Sun's 1.4.1_02 JVM (J2SE). I configured JRun with IIS to serve .jsp and .jws files and tested it with a simple JSP in the default IIS wwwroot (on E:\). No problem.
Then I started the CFMX for J2EE install and decided to go for the EAR install (habit, even tho' I always end up unpacking it to get at the WAR files!). Now I had cfusion.ear and no jar command. Hmm. So I downloaded WinZIP and used that to unpack the EAR file (to get at the two WAR files) and then unpack the WAR files into the JRun default server (under CFIDE and cfusion). Then I used JMC (JRun Management Console) to edit the context root to / and told it the document root was E:\inetpub\wwwroot\. Finally, I ran wsconfig to connect it to IIS. Done! Both JSP and CFM files serve up from the same directories as HTML.
Then it was time to test the CF5 applications on this box. I created a few data sources (Oracle 8) and tried the apps. The first one failed because it used client variables and I always disable those in the admin (along with selecting J2EE session variables). Changed client variables to use cookies and the first app worked just fine. The next app failed because it had ';' at the end of some of its SQL statements - allowed by the CF5 Oracle drivers, not allowed by the CFMX Oracle drivers. That's a fairly simple edit (regex replace ';$' with '').
The only real glitch in all of this is that, for some reason I haven't figured, cfregistry does not seem to be able to read or write the registry. That means that ODBC DSNs do not show up in the CF administrator and it's hard to create certain data sources (e.g., Microsoft Access). The workaround for the moment is to create the System DSN in Windows and then attempt to create an Access data source in the CF administrator with the same name but no file path value. "Submit" produces a failures (unable to update the registry and DRIVERPATH variable undefined) but the data source is created and, because it mirrors the System DSN, it verifies just fine.
Thanks to Brandon Purcell, this glitch is fixed. He said:
To fix this add the necessary dlls' to the java.library.path in jvm.config
All my cfregistry tags and ODBC machinery work just fine now.
And a further note: it was pointed out that this configuration change is mentioned in the install docs... I just missed it (and I was actually making an effort to follow the docs for once). At least it's a simple fix and easy to debug and identify the problem. Mike Nimer had me create this simple script to verify the function of cfregistry:
<cfregistry action="GETALL" name="qODBC" type="string" sort="entry" branch="#Branch_ODBCDS#">
<cfdump label="ODBC Data Sources" var="#qODBC#">
Posted by seancorfield at 03:41 PM | Comments (2) | TrackBack | cf | j2ee | j2ee

Fusebox 4 Beta!

The Fusebox 4 beta is now active through July 4th. There are to be two flavors of Fusebox 4: Fusebox 4 for XML (aka FB4) and Fusebox 4 for CFCs (aka FBMX). They share many commonalities (XML configuration, plugins etc) but are radically different in structure and approach. I've downloaded all the code so I'll be experimenting over the next few weeks and writing up my experiences.
Posted by seancorfield at 12:22 PM | Comments (0) | TrackBack | architecture | cf

May 05, 2003

DevNet Updated - Lots of ColdFusion Content!

The latest DevNet update provides plenty of meat for ColdFusion developers. You can start off with Ben Forta's Logged In column extolling the virtues of CFMX. That article links to several others, including new articles on integrating CFMX and J2EE by Drew Falkman, using cftransaction by Simon Horwith, building Object-Oriented user interfaces by David Friedel and caching by Matt Boles. Plenty of thought-provoking and informative ColdFusion goodness!
Posted by seancorfield at 07:37 PM | Comments (0) | TrackBack | cf | macromedia

May 01, 2003

cfform & /CFIDE

A couple of weeks ago, I mentioned how to get cfform working on a hosted environment. Macromedia has a new Tech Note that says much the same thing so now it's even easier to find the solution to this problem!
Posted by seancorfield at 11:03 AM | Comments (0) | TrackBack | cf | macromedia

April 30, 2003

Managing Whitespace

A useful tip from Christian Cantrell about leveraging CFMX's Java integration to remove unwanted output when generating XML output.
Posted by seancorfield at 01:30 PM | Comments (1) | TrackBack | cf | j2ee

April 29, 2003


CFUN-03 is happening in June in Maryland. If you're quick, you can still get the early bird registration ($199 thru 4/30, $249 after that). There's some great speakers, including our very own Christian Cantrell, and Hal Helms and John QT will be talking about Fusebox 4 and sharing code!
Posted by seancorfield at 07:02 PM | Comments (0) | TrackBack | cf

April 28, 2003

ColdFusion Floats

What a brilliant idea! A ColdFusion-at-sea conference! Speakers / trainers include Ben Forta, David Vaccaro and Pete Freitag. Avast ye land lubbers!
Posted by seancorfield at 02:54 PM | Comments (1) | TrackBack | cf

April 24, 2003

BACFUG: Web Services

I'm presenting at tonight's BACFUG meeting. I'll be going over my Under the Hood report to look at the architecture behind macromedia.com then I'll be showing a little of what would be possible if the website had a public Web Services API.
Why don't you comment on this entry, telling me what you would like to see made available as a Web Service on macromedia.com? The most popular suggestion I've received so far has been to provide Web Service access to the search function.
Posted by seancorfield at 09:58 AM | Comments (2) | TrackBack | cf | macromedia

April 22, 2003

DRK3 & Firefly

Some very exciting announcements on Macromedia DevNet today about the latest DevNet Resource Kit (Volume 3) and the Macromedia Firefly Components behind the forthcoming Flash MX Data Connection Kit.
DRK3 speaks for itself with a lot of ColdFusion content this time around as well as some great sample applications.
You can get a sense of just how exciting the Data Connection Kit will be by reading Aral Balkan's article Building an RSS Aggregator with Macromedia Firefly Components.
Posted by seancorfield at 09:55 AM | Comments (3) | TrackBack | cf | macromedia | mx

April 18, 2003


Big Damn Heroes' blog has a post about XML-RPC that provides a CFC to convert between ColdFusion data structures and XML-RPC format. This allows you to easily create XML-RPC services in CFMX as well as consume them.
Posted by seancorfield at 12:31 PM | Comments (0) | TrackBack | cf

Fusebox 4

Hal Helms and John Quarto-vonTivadar will be unveiling Fusebox 4 at the Atlanta ColdFusion User Group meeting on May 7th. I believe it may be broadcast using Flash Communication Server but have no further details at present.
Posted by seancorfield at 09:58 AM | Comments (1) | TrackBack | architecture | cf

April 17, 2003

CFMX / IIS Startup Dependencies

An excellent post in Dan Switzer's blog explains the startup dependencies between IIS and ColdFusion MX, and how to update the registry to ensure those services startup in the correct order.
Posted by seancorfield at 08:37 PM | Comments (0) | TrackBack | cf

April 16, 2003

DevNet: ColdFusion & Databases

Debbie Dickerson's Logged In column focuses on resources to get you up to speed with using databases in ColdFusion.
Debbie provides a lot of links including a new article by Sue Hove about Advanced Queries in ColdFusion that is worth reading.
Posted by seancorfield at 11:54 AM | Comments (0) | TrackBack | cf

April 15, 2003

cfform & /CFIDE

A commonly asked question by folks trying to use cfform and its ilk in a hosted ColdFusion MX environment is "Why won't my CF5 code work on CFMX?"
First of all, why should it break? In CF5, cfform etc generated inline JavaScript code to perform validation. In CFMX, that JavaScript is kept in a file instead and included where needed. Unfortunately, that file is under /CFIDE/scripts/ and if you're in a hosted environment, you may well not have the administrator available to you so CFMX cannot find the JavaScript source file.
According to the documentation, cfform takes a scriptSrc attribute:
scriptSrc - optional, Default: /cfide/scripts/cfform.js - Lets the user control the URL of the script file; useful if you do not keep the file in the /cfide directory.
Useful if you don't have a /CFIDE directory too! Just push your local copy of cfform.js up onto your hosted server and use scriptSrc to point to it:
<cfform scriptSrc="/myscripts/cfform.js" ...>
Posted by seancorfield at 09:32 PM | Comments (0) | TrackBack | cf

ColdFusion is not Java, part 97: this scope

ColdFusion's "this" scope seems to cause endless confusion because people keep thinking it is something like "this" in Java. I posted the following to cf-talk today in yet another attempt to highlight that CF is scope-based whereas "this" in Java is an alias for the current object, i.e., it's more like a variable.
Here's some code to show just how radically unlike Java's "this" it is:
	<cffunction name="hidden" access="private">
		<cfreturn "I'm a private method">
	<cffunction name="changeable" access="public">
		<cfset this.changeable = hidden>
		<cfreturn "I'm public - call me again!">
Now, call "changeable()" twice on the same instance:
<cfset obj = createObject("component","sly")>
You'll get:
I'm public - call me again! I'm a private method

This is meant to show that ColdFusion's "this" is a scope in which you can manipulate variables with abandon, adding and changing anything you want.
Posted by seancorfield at 09:11 PM | Comments (1) | TrackBack | cf

April 10, 2003

Design Patterns & ColdFusion

As most folks know by now, I'm a big fan of design patterns and they feature heavily in the ColdFusion code that underpins macromedia.com.
Brendan O'Hara has started what promises to be an awesome series in the ColdFusion Developers' Journal which looks at classic design patterns implemented in ColdFusion MX. So far, he has covered the Template Method Pattern and the Iterator Pattern.
Posted by seancorfield at 06:04 PM | Comments (2) | TrackBack | architecture | cf

April 01, 2003

cfargument & arguments

A curiosity about the interaction between the cfargument and the actual arguments structure / array was posted to the CFCDev mailing list today. It seems that if you use cfargument with required="false" then such arguments appear in the arguments scope even if no value is passed... sort of...
  <cffunction name="foo" returntype="numeric">
    <cfargument name="a" required="false">
    <cfreturn arrayLen(arguments)>
If you call foo it will return 1 even if you don't pass an argument. If you pass an argument called b, it will return 2 - 1 for a declared and 1 for b passed in.
You need to use structKeyExists(arguments,"name") to detect whether an actual argument is passed - don't rely on the 'length' of the arguments scope.
Posted by seancorfield at 07:27 PM | Comments (2) | TrackBack | cf

March 30, 2003

Depressed Press: Variables

Jim Davis just published a very useful and very thorough guide to variables in CFML. It explains all the different data types and different scopes so, no matter how much experience you have with ColdFusion, you'll learn something new. Depressed Press also has an equally excellent guide to locking which talks about race conditions and when and why you need to use cflock. Highly recommended!
Posted by seancorfield at 12:39 PM | Comments (0) | TrackBack | cf

March 29, 2003

Under the Hood

The first of a series of Under the Hood articles is now up on macromedia.com - these will show you what's going on behind the scenes on the new site. In this report, I talk about the architectural evolution of the ColdFusion applications on the site, moving from 'traditional' CF5 applications through to Rich Internet Applications. Hope you enjoy it!
Posted by seancorfield at 01:17 AM | Comments (1) | TrackBack | architecture | cf | macromedia

March 22, 2003

Context Root Neutral

When you're writing CF code that may have to run on both ColdFusion MX Server as well as CFMX for J2EE, you need to think about context roots. With CFMX Server, your URL paths are always something like /path/to/file.cfm. However, CFMX for J2EE inherits the underlying J2EE application server concept of context roots for applications - a unique prefix for each web application deployed on the server. You can choose to deploy CFMX for J2EE in the default - or empty - context root in which case your URL paths will be the same as for CFMX Server. If you are creating code that your customers are going to deploy on their own servers, they might well choose to use a different context root. In the examples in this blog, I usually refer to a context root of /cfusion so your URL paths are something /cfusion/path/to/file.cfm.
CFMX applications can be written to work regardless of the actual context root because the context root can be determined dynamically.
For example, you could add this line to your Application.cfm:
<cfparam name="request.contextRoot"
Then you can use #request.contextRoot# wherever you need to construct a root-relative URL:
<a href="#request.contextRoot#/path/to/myfile.cfm">link</a>
Posted by seancorfield at 02:02 PM | Comments (0) | TrackBack | cf | j2ee

March 21, 2003

ColdFusion MX Updater 3

Reported everywhere already, but I was waiting until I'd installed it myself before blogging anything about it. I downloaded the CFMX for J2EE version yesterday morning (using the AIX download to get the JAR file) and installed it on JRun on my PowerBook G4. It went very smoothly and the whole process took only about ten minutes before I was up and running again. I'm going to install it on Tomcat later today (alongside my existing three instances!). The nice thing about the J2EE version is that you can easily upgrade one instance of CFMX without upgrading others so that you can run your applications side-by-side on both the original and the updated CFMX for J2EE for regression testing.
First off, make sure you read the release notes for details of all the fixes in this update - it's a long list!
Second, read the Updater FAQ, in particular What's required to use the Updater?. You need a Macromedia Membership ID. That means you need to login to get the Updater, which means you need the latest Macromedia Flash Player.
My favorite fixes in Updater 3 are probably:
  • The Web Service proxy in Flash Remoting can now be disabled (and is disabled by default). I talked about this issue in January. It's good for security.
  • Web Services have been enhanced by upgrading the Axis engine to the 1.0 release. Furthermore, CFMX Web Services can now be consumed by .NET clients.
  • All the web connector fixes! Lots of them, including the failure under load with Apache 1.3.x with I reported back in September.
  • Search Engine Safe URLs are now correctly supported.

Let me know what your favorites are by commenting on this post!
3.26.2003 By way of clarification: the Web Services Proxy change is purely to block the ability to use the Flash Remoting gateway as a proxy to call other Web Services (e.g., on other servers) - it does not affect the primary Flash Remoting functionality.
Posted by seancorfield at 11:08 AM | Comments (4) | TrackBack | cf | macromedia

Fusebox & CFCs

There's an interesting thread on the Fusebox forums about how CFCs may or may not play into forthcoming versions of Fusebox. We seem to be drawing nearer to an early release of a CFC-centric 'experimental version' of Fusebox MX although development of a more conventional Fusebox 4 is also in the works. I'm reproducing one of my (longer) responses to the thread here.
I'm excited to hear that we only have about a month to wait before an early cut of FBMX is made available!
I share Hal's enthusiasm for OO - both he and I have a long history of working in the OO field and so we both understand the benefits (and pitfalls!) and how much of a paradigm shift it can be for many folks (which is somewhat ironic since OO thinking is really much more in line with how we think about everything in the world *except* software!).
Hal's point about scalability is interesting. I'd assumed he meant performance scalability because one of the most common concerns I've heard expressed about CFCs is the 'performance overhead' of OO code.
Changing requirements are normally the bane of our lives. One of the much-vaunted benefits of OO is the ability to create systems that are much more adaptive and therefore easier to 'grow' as requirements change. I assert that a well-designed OO system will usually accommodate change more easily than a procedural system, even a well-designed procedural system. The emphasis is on "well-designed", a point Hal makes here when he talks about 'being rigorous in the design and implementation of an application'. I've always said that OO punishes poor design much more harshly (than a non-OO system) - if you get your core object structure wrong, it can be very hard to correct that problem later on without rewriting a lot of code. As Hal says 'rigor isn't something you can add in after the fact'.
Do we have the full arsenal of OO features available in ColdFusion, compared to Java, Smalltalk or C++? Not yet. Do we have enough features to build effective implementations of good OO designs? I think so, yes, but you have to remember to abide by your own design rules - CF doesn't (yet) provide the same level of protection against breaking encapsulation, for example, that some other languages provide. You can create a good OO implementation of a good OO design in CF but then have some future consumer (developer, client etc), break things horribly by not following the 'contracts' in your design.
That poses a particularly interesting dilemma for folks like Hal, trying to build clean OO frameworks that other developers can use. The framework can be great, but the protection is not there yet to prevent abuse - intentional or otherwise - of the OO design inherent in the framework.
Will Macromedia add the features that Hal finds lacking? Hal's had encouraging discussions with Macromedians about that and I'd also hazard a guess that as CF users become more sophisticated in their use of OO features, requests for more robust protection against design abuse will increase and that will drive the evolution of CF. Ray Camden canvassed the community for their 'top ten' CFC enhancements and submitted that list to the CF team so I know that many of these things are under consideration.
My top enhancements would be:
  • tidy up the scope / access machinery so we have a private scope and a protected scope (we currently have a public scope and a sort of protected scope)
  • add machinery to make it easier to call overridden methods (the 'super' issue)
  • add a better constructor notation
  • add interfaces

Those were all on the list Ray sent in but none of these actually prevent good OO implementations.
Posted by seancorfield at 10:32 AM | Comments (0) | TrackBack | architecture | cf

March 19, 2003

Ben Forta's Tags

Ben Forta's website lists all the ColdFusion Tags he has on the ColdFusion Exchange. Ben rather cryptically mentions "the magic of Web Services" on that page so I thought I'd take this opportunity to provide a little bit more detail. Since the new Exchange is a Rich Internet Application, the Flash user interface relies on CFC methods with access="remote" in order to perform all dynamic queries. This means that the CFCs are also available as Web Services (with a caveat I'll mention below). Ben is able to dynamically retrieve his published extensions by using cfinvoke webservice="..." and getting back a query object containing the relevant data. As I've previously explained in my DevNet article about design patterns, we use a façade CFC for each of the major parts of our applications. Each of those CFCs is essentially a Web Service, theoretically exposing all of the functionality on macromedia.com through a variety of remote methods (suitably secured via membership authentication where appropriate).
As you can imagine from the functionality of the various Rich Internet Applications, there's a lot of potential for third-party interaction with macromedia.com that will take things like the DevNet XML resource feed to a new level.
The caveat: we aren't publishing the URLs for these CFCs at the moment because they are currently optimized for use with our Flash user interfaces rather than being general Web Services. We are, however, considering what sort of Web Services would be useful - please feel free to provide your thoughts here as comments or send me email.
Posted by seancorfield at 02:49 PM | Comments (0) | TrackBack | cf | macromedia

March 17, 2003

CFMX for J2EE Clustering

Quite a few people have been asking me for more information on setting up CFMX for J2EE for clustering (after my earlier blog posts on that subject). Before I could find time to write a lengthy post on that subject, Brandon Purcell has just published a terrific article on the subject on Macromedia DevNet! Brandon explains the process in great detail, showing several possible options for creating clusters. Required reading!
Posted by seancorfield at 10:47 PM | Comments (0) | TrackBack | cf | j2ee | macromedia

March 15, 2003

ColdFusion Advocacy

If you think ColdFusion is wonderful, surf to cfAdvocacy.org and contribute some articles and resources. Creator Jim Davis wants this to become the reasoned mouthpiece that answers the question "Why ColdFusion?" but he needs your help. Even if all you do is send him links to existing articles that advocate using ColdFusion, I think that will be helpful.
p.s. I think the "click stream" review feature on the site is pretty neat!
Posted by seancorfield at 10:45 AM | Comments (4) | TrackBack | cf

March 11, 2003

Macromedia DevNet XML Feed

If you've been using the XML feed of DevNet articles, the recent website redesign may have broken it for you. We moved the XML feed and put a server-side redirect in place. If your cfhttp tag has redirect="true" then you'll be OK. If you omitted that attribute, you'll be getting a blank result or an exception depending on how you wrote your code. Todd Rafferty laments his lack of error checking... Sorry Todd!
Read more about the XML feed.
Posted by seancorfield at 05:32 PM | Comments (0) | TrackBack | cf | macromedia

March 06, 2003

macromedia.com a.k.a. Dylan65

Well, yes, it's finally here and everyone's very excited. After many months of work, both on the design & production side (kudos to Tony Lopez for steering that ship) and the engineering side (kudos to my boss, Robin Ducot, for same), we launched the brand new site on Tuesday evening. The deployment went smoothly - amazingly so considering the complexity of rolling out such a vast rewrite.
We've received a lot of feedback about it, via the feedback form on the site and the survey, as well as via the many community mailing lists and forums. We're reading it all and it'll help us decide what to address and how. Thanks to everyone who has provided direct feedback so far.
As Christian points out, one of the key things to remember is that this is a dog food site now using ColdFusion MX on the back end for all dynamic content, powering the Rich Internet Applications and other parts of the site. When you look at the numbers, you'll see that no one can tell you that ColdFusion "doesn't scale" - during morning peak times, we see in excess of 15,000 concurrent active sessions. There's about 80,000 lines of in-house developed CFML code in production, just over half of which is in CFCs. There's about the same amount of code again behind our automated test harness and regression suites. About 10,000 lines of that production code represents CFC façades that are called via Flash Remoting as part of our Rich Internet Applications: Exchanges, Membership, Trial Downloads and Product Registration.
There's also about 75,000 lines of ActionScript in about 300 movie files that make up the user interface of those four Rich Internet Applications and the home page navigation system. Finally, there's about 30,000 lines of Java code behind the site, mostly dealing with encryption, data security and search engine integration.
Sure, there are some issues with the current site. I think we know about most of them (thanks to all the valuable feedback we're getting) and we'll be addressing them as we move forward. We still have a long way to go and we'll be deploying new and improved Rich Internet Applications over the coming months.
Posted by seancorfield at 07:14 PM | Comments (0) | TrackBack | cf | macromedia | mx

March 01, 2003

More on Fusebox

Fusebox Open Source is a project designed to move Fusebox forward using the much more collaborative approach of Open Source. I was notified of this by Rick Mason, manager of the Mid-Michigan CFUG, whose group hosted a presentation from John Farrar about Fusebox Open Source in February. You can download his presentation from the MMCFUG's Downloads page. There's also an embryonic Fusebox Open Source website which has an online version of the presentation.
As Rick said in his email to me "The powerpoint doesn't do it justice. He's added the concept of skins to Fusebox. He showed a login that brought up a standard html page. Then he logged out and logged back in with the site changing to Flash. Lots of potential for multi-lingual sites.".
It'll be interesting to see where this Open Source effort goes, especially with work on Fusebox MX / Fusebox 4 seeming to progress so slowly.
Posted by seancorfield at 01:48 PM | Comments (0) | TrackBack | architecture | cf

February 28, 2003

Including JSP pages in CFM pages

A thread on cf-talk recently touched on some of the Java integration points with ColdFusion MX (the thread actually started out talking about BlueDragon). One of the questions was whether you could include Java Server Pages in a ColdFusion page. The answer is yes and here's how:
	We're in CFML.<br />
	<cfset getPageContext().include('jsp.jsp')>
	We're back in CFML.<br />
	<% String s = new String("JSP"); %>
	This is a <%= s %> page.<br />

This produces:
	We're in CFML.
	This is a JSP page.
	We're back in CFML.
You can also forward from ColdFusion pages to JSP using getPageContext().forward('nextpage.jsp')
Posted by seancorfield at 12:49 PM | Comments (1) | TrackBack | cf | j2ee

February 27, 2003

Fusebox 4?

A fairly long thread on cf-talk over the last few days has focused on Fusebox, CFMX and CFCs. I was disappointed to hear that some members of the Fusebox Council do not believe that CFCs are ready for "prime time" and that the work Hal Helms was doing on Fusebox MX - as reported here and elsewhere - will not lead to a version of the core files based on ColdFusion Components.
Having seen some early prototypes of Hal's work on a CFC-based Fusebox, I was looking forward to Fusebox MX. I think CFCs are solid enough for enterprise-class production applications and I haven't, yet, seen any specific reasons from the Fusebox community as to why Hal has abandoned CFCs. It seems particularly strange after Hal's article on CFCs on Macromedia's website and his book "Discovering CFCs (ColdFusion MX Components)" - and now an eWorkbook (see Techspedition's website).
However, some good news came out of the thread: John Quarto-vonTivadar commented that in Fusebox 4 you will be able to extend the core quite easily using "plugins". The plug-in architecture of Fusebox MX was one of the things that had excited me about Hal's work so I'm glad that part at least will make it into Fusebox 4.
Update: Hal has taken time to comment on this thread and clarify his position. Please read his comments (especially if you are a Fuseboxer who is saying CFCs are no good should!).
Posted by seancorfield at 11:19 PM | Comments (8) | TrackBack | architecture | cf

J2EE Sessions & cflocation

There's been a fascinating and somewhat complex discussion on CFGURU about issues with J2EE sessions on CFMX with cflocation. The seed of it all hinges on whether ;jsessionid=XXX is valid in a URL or not. The J2EE specification says that J2EE application servers can insert that into URLs, after the filename but before the ? like this:
Normally, what happens next is that the J2EE application server's web server connector is passed the URL and it parses out the session ID and the query string.
Consider this URL tho':
Some J2EE application server connectors will intercept this and strip the session ID, some won't. It's unclear what the behavior should be and there are arguments in favor of both approaches.
You might ask why this is even an issue - if you're creating a URL to a static page (or to an external server), you simply don't want to add session management information, right? Well, yes, except that if you use cflocation, you can't avoid jsessionid unfortunately. You can say addToken="false" but CFMX still adds the session ID. That's a bug (#49530) and Phil Costa posted that a fix will be included in Updater 3.
David Grabbe emailed me to ask where to find this fix. Well, it isn't out yet but it prompted me to suggest a workaround: use cfheader to write out Location: destinationURL instead of cflocation when you want to redirect to another server (or a static page on your own server).
Specifically, you need:
	<cfheader statuscode="302" statustext="Temporarily Moved"/>
	<cfheader name="Location" value="destinationURL"/>
You need to set the status code so that the browser honors the location header!
Posted by seancorfield at 03:07 PM | Comments (2) | TrackBack | cf | j2ee | macromedia

February 17, 2003

Weather Web Service Revisited

Thanx go to Travis, who emailed me via the contact link to point out that the weather web service I wrote up has another nice feature: getIconIndex(). Travis sent me the location of the icons so you can use them yourself by putting the following code in your page:

<img src="http://www.ejse.com/WeatherService/images/52/#Weather.getIconIndex()#.gif">

Posted by seancorfield at 12:18 PM | Comments (0) | cf

February 11, 2003

Web Service Returns

Sometimes it's hard to figure out what a Web Service returns. Take this one for example: http://www.ejse.com/WeatherService/Service.asmx?wsdl. What, exactly, do you get back when you call it from CFMX? This is another case where cfdump is your friend:

webservice = "http://www.ejse.com/WeatherService/Service.asmx?wsdl"
method = "GetWeatherInfo"
zipCode = "94546"
returnvariable = "Weather">
<cfdump var="#Weather#">

What you get back is a Java object, with a bunch of methods. This is a proxy object for the return type of the Web Service. Not entirely obvious, is it? A quick perusal of the methods should lead you to write something like this to display the result:

Weather for location: #Weather.getLocation()#
Temp: #Weather.getTemprature()#
Feels like: #Weather.getFeelsLike()#
Forecast: #Weather.getForecast()#
Visibility: #Weather.getVisibility()#
Pressure: #Weather.getPressure()#
DewPoint: #Weather.getDewPoint()#
UVIndex: #Weather.getUVIndex()#
Humidity: #Weather.getHumidity()#
Wind: #Weather.getWind()#
Reported at: #Weather.getReportedAt()#
Last updated: #Weather.getLastUpdated()#

The next thing we need is a utility to take WSDL and tell us how to call it from CFMX, i.e., tell us what arguments - and what types - we need to pass to the Web Service!

Posted by seancorfield at 11:43 PM | Comments (0) | cf

February 05, 2003

CFML Forever!

The rallying call of Vince Bonfanti of New Atlanta, makers of Blue Dragon, in a soon to be published column for CFDJ (PDF). Interesting to hear the background to his company's product, as well as news of a .Net release. This is all very positive for ColdFusion, in my opinion.

Posted by seancorfield at 02:23 PM | Comments (0) | cf

February 04, 2003

CFMX for J2EE Compile Script - JRun version

I decided to post the JRun version of this script after all. It's quite a bit more sophisticated than the Tomcat one I published yesterday. This one will compile everything in the current directory (and below) by default, or you can specify a directory to compile. It also assumes your server instances all begin with cfmx and it will compile the code into all of them, and it assumes your context root is cfusion. Feel free to mess with it for your own installation.
# adjust this to match the environment:

# where to compile (it's recursive):
if test "$1" = ""

# location of javax servlet stuff:

# loop over installed cfmx instances:
for WEBROOT in $JRUNHOME/servers/cfmx*/cfusion

        $JAVA -classpath $CP coldfusion.tools.Compiler          \
                -webroot $COMPILEDIR -webinf $WEBINF $COMPILEDIR
This is actually the version from my Mac laptop but it's identical to the one we're using on Solaris, except for the value of JRUNHOME.
Posted by seancorfield at 02:07 PM | Comments (0) | TrackBack | cf | j2ee

Java Flash Remoting with CFMX for J2EE

Several people have commented that if you put CFMX for J2EE on top of JRun, you ought to be able to access Java via the Flash Remoting gateway. First off, why was it disabled? Mostly it's a security issue: if a Flash movie could access Java classes within the ColdFusion system, it can do quite a bit of damage (consider the ServiceFactory!). However, if you really want to enable some Java functionality within the ColdFusion Flash Remoting gateway, edit the web.xml file in the WEB-INF directory and, in the flashservices Servlet definition, add the following:
        <description>When set to true, this setting disables 
                the Java Adapters in the gateway.</description>
This will enable the Java Bean Adapter and the Java Class Adapter. It will not enable the EJB or Servlet Adapters. More on that later I hope.
Posted by seancorfield at 11:33 AM | Comments (0) | TrackBack | cf | j2ee | mx

February 03, 2003

CFMX for J2EE Compile Script

I spent a little time reworking the CFMX compile script so that it will work with CFMX for J2EE. Here's a version that works with Tomcat (on Mac OS X):

$JAVA -classpath $J2EEMX/lib/cfusion.jar:$J2EEWEBINF/lib/cfx.jar:$JLIBDIR \
   coldfusion.tools.Compiler -webroot $1 -webinf $J2EEWEBINF $1
Note that WEBROOT will need to change to wherever the context root is for your installation. I have a slightly more sophisticated version that works with JRun and handles multiple CFMX installations (i.e., multiple server instances). If there's sufficient interest, I'll post it here.
Posted by seancorfield at 12:17 PM | Comments (0) | TrackBack | cf | j2ee | osx

January 27, 2003

Wanna full CFMX license on the Mac?

Several folks have asked for a version of CFMX on the Mac that accepts connections from more than one computer. Well, there's nothing stopping you. Just buy a full license of CFMX for J2EE (for any platform) and, instead of installing it, use the serial number to activate your Mac version. Yep, that'll give you a full-fledged CFMX for J2EE on Mac OS X. Of course, it still won't be a supported installation and, if you even think of installing the actual version you bought - in addition to using that serial number on your Mac version - then you'll be in violation of your license agreement...
Posted by seancorfield at 10:55 PM | Comments (0) | TrackBack | cf | j2ee | osx

January 22, 2003

Accelerating J2EE with ColdFusion MX

Seybold's J2EE Promises and Customer Experiences says some very nice things about why CFMX is a great way to build J2EE applications faster and cheaper. Another nice thing it says is the part of ColdFusion's success can be attributed to its strong developer community!

Posted by seancorfield at 10:25 PM | Comments (0) | TrackBack | cf | j2ee

January 21, 2003

Another Pet Market

A lot of folks in the CF community asked if a pure CF version of Pet Market would appear so they could compare it on their terms, as a simple HTML-based application, with other implementations. You can now read all about Why We Built the ColdFusion MX HTML Pet Market Blueprint Application by Tim Buntel on the Macromedia Designer & Developer website.

Posted by seancorfield at 10:46 PM | Comments (0) | cf

CFMX, Tomcat and graphics

Some folks have reported problems with the CF_GRAPHICS_JVM_OPTIONS setting suggested for setenv.sh in the installation notes. If you copy and paste from the documentation, you'll end up with a space in the line, after rt.jar:. You need to remove this space for the options to work.

Posted by seancorfield at 04:28 PM | Comments (0) | cf

January 20, 2003


I continued to be more and more impressed with ColdFusion MX the more I use it. Over the last week, I've had two interesting problems to solve that proved to be almost trivial in CFMX. The first problem was that various business owners were writing specifications in HTML that contained lots of repetitive information that I needed in a database. The second problem was that I received a spreadsheet showing hundreds of potential configuration changes to Apache involving server-side redirects. How did CFMX help?

cfhttp lets me read HTML documents. REFindNoCase() allows me to use powerful Regular Expression pattern matching to extract information from strings. I wrote a short CFC that takes a list of HTML documents to scan and a struct containing 'static' information for the database records to be inserted from those documents. The CFC method loops over the list of documents, reading each one and repeatedly extracting data from two adjacent columns in a variety of tables which it then inserts or updates in the database. Then I wrote a simple driver CF page that calls the CFC over and over with lists of documents and metadata. I can now add arbitrary groups of documents with just a small addition to the driver page. The whole thing is less than 200 lines of code and produces a comprehensive report of successes and failures. The end result is that the business owners can change the specs whenever they want and all I have to do is hit a web page to repopulate the database!

For the spreadsheet, I manually saved it as a comma-delimited CSV. Then I wrote a few lines to slurp that into memory as an associative array (a map) followed by a few lines of code to read the Apache configuration file and cross-check each redirect against the associative array, outputting the revised configuration file when it's done. Less than 100 lines of code - and it still produces success / failure reports and timings.

The ease with which CF can read web pages and read / write files, combined with regular expression pattern matching and excellent text list processing mean that I don't have to learn Perl to do this kind of stuff - for which I'm very grateful!

Posted by seancorfield at 12:26 AM | Comments (0) | cf

January 18, 2003

Baba O'Reilly!

O'Reilly's website now has a section dedicated purely to ColdFusion! There's not much there yet (mostly Dick Applebaum's series of articles on CFMX for Mac OS X) but I hope it will grow to be a valuable resource.

Posted by seancorfield at 08:59 AM | Comments (2) | cf

January 10, 2003

cfhttp & cfloop

If you have used cfhttp much, you've probably tripped over the bug that if you use it inside a loop, it's reliability degrades. I have been working on a little application that validates URLs in a database and was having problems with the reliability of the cfhttp tag.

I was stumped. Repeated calls to cfhttp gradually deteriorated into failure, with generic "Connection failure" errors. Brandon Purcell, in an off-hand moment, suggested putting the cfhttp tag call in a separate CFC and call that method from the original page with the cfloop. To my surprise, it worked! So, if you need to validate a database full of URLs, split the application up and you'll have more success.

Posted by seancorfield at 12:23 AM | Comments (0) | cf

Whither Fusebox?

Someone reminded me today that I promised to write up my experiences with converting my website from "plain" PHP to Fusebox. Yes, yes, yes. I will get to it. I'm kind of snowed right now, trying to finish the new macromedia.com (along with many other folks) so cut me some slack. I will just say that it wasn't as unpleasant as I'd initially expected... No faint praise from me!

Posted by seancorfield at 12:15 AM | Comments (0) | TrackBack | architecture | cf | php | programming

January 07, 2003

CFMX for J2EE on Mac OS X

I downloaded the Mac edition and discovered it is a .jar file. I was hoping it might be. The installation offers you a .ear file deployment or a .war file deployment - I chose WAR file and was rewarded with cfusion.war and rds.war. Out of curiosity, I went to my Tomcat installation and created a new cfmac directory under /home/tomcat/webapps. Then I unpacked the cfusion.war file (jar xvf ~/CFMXJ2ee/cfusion.war) and restarted Tomcat. http://localhost:8080/cfmac/CFIDE/administrator brought up the ColdFusion MX Administrator.

Of course, Tomcat doesn't give you all the features of JRun, but it's interesting to see it running on top of Tomcat, alongside my installation of BlueDragon!

1.8.2003 - Guess I should RTFM since that provides full instructions for installation on Tomcat!
Posted by seancorfield at 11:05 PM | Comments (0) | TrackBack | cf | j2ee | macromedia | osx

More Mac OS X Goodness

Christian Cantrell has plenty to say about this in his article, Macromedia - Designer & Developer : Logged In: Macromedia Expands JRun and ColdFusion MX for J2EE to the Macintosh OS X Platform.

Posted by seancorfield at 07:00 PM | Comments (0) | TrackBack | cf | j2ee | macromedia | osx

JRun & CFMX for OS X

It's sort of 'old' news, even though the announcement has not been made officially. Macworld has this snippet from the Expo - ColdFusion gets X support. The downloads are accessible on macromedia.com: JRun 4 Developer Version, ColdFusion MX for J2EE (JRun Mac OS X Developer Edition). JRun for Mac OS X can also be purchased in the Online Store. No doubt there will be a lot more information published about this later today.
Posted by seancorfield at 10:17 AM | Comments (0) | TrackBack | cf | j2ee | macromedia | osx

January 06, 2003

cflock (again)

It's been a while since I posted about good practice locking but an issue keeps coming up which needs to be written down: I see a lot of code like this:

<cfif not isDefined("application.somevar")>
<cflock type="exclusive" ...>
<cfset application.somevar = somevalue>

This isn't safe! Consider what happens if two requests hit this at the same time - they can both find application.somevar is not defined and then they'll both initialize it. The cflock only ensures that the updates will be done one at a time. In order to be safe, the entire condition needs to be locked to ensure only one request will actually initialize things:

<cflock type="exclusive" ...>
<cfif not isDefined("application.somevar")>
<cfset application.somevar = somevalue>

Now the cflock ensures the variable will really only be initialized once.

1.8.2003 - Thanx to Marcello Frutig for spotting an error in my original post (a missing not) and also for a performance tweak: as written, the code above will effectively single-thread every request which is potentially a big deal. Since we're only trying to avoid race conditions, Marcello suggested the following idiom which is much better:

<cfif not isDefined("application.somevar")>
<cflock type="exclusive" ...>
<cfif not isDefined("application.somevar")>
<cfset application.somevar = somevalue>

This ensures that no requests will single thread once the application has been fully initialized but still avoids race conditions during initialization. Neat! Thanx Marcello!

Posted by seancorfield at 11:07 PM | Comments (2) | cf

January 02, 2003

CFMX for J2EE: Shared Document Root

Previously, I talked about how to set up multiple CFMX for J2EE instances on your J2EE server and noted that each instance had it's own document root. Now I'm going to tell you how to have these instances share a common document root - so you only have to have one copy of your CF source files. Unfortunately, it's not entirely straightforward and I'm much beholden to Brandon Purcell for his help in ironing out the specifics of how to do this with JRun.
First of all, you can't simply have the entire document root shared. CFMX has a WEB-INF directory which contains server instance specific data and therefore that cannot be shared. This means you have to be a little creative!
Second, some CFMX code expects the WEB-INF directory to be underneath the document root. Fortunately, this 'fixed' section can shared.
Once again, we have to edit XML files to make all this happen. For each server instance, edit the jrun-web.xml file in {jrun.home}/servers/<instance>/cfusion/WEB-INF/ (assuming your context root is /cfusion). The end of the file looks like this - remove the section in red (if present) and add the section in blue:
{cfmx} should be replaced by the common document root you've chosen for CFMX, {jrun.home} should be replaced by the JRun install directory and <instance> should be replaced by the name of the server instance whose XML file you are editing.
If the section in black isn't present, you can add it although it represents the defaults.
This removes the default document root mapping (in red) and adds two new mappings (in blue):
  • a document root mapping to the shared document root
  • a WEB-INF mapping to ensure each server instance can find its own private library files
I typically add a third mapping (of /CFIDE/*) to the instance's CFIDE directory - to save having to copy the CF Administrator code from the CFMX for J2EE install out to the common document root. It's up to you - I find it convenient because of the automated builds I do on my systems.
If you put your own libraries in the shared document root's WEB-INF area, under classes or lib, then you need to add those directories to the java.class.path in jvm.config.
Finally, you need to copy the WEB-INF/cfusion/lib/jrun.properties file out of one of the server instances to the corresponding location under the shared document root. This is the piece that has to reside under the actual document root rather than the installed WEB-INF.
Posted by seancorfield at 11:05 PM | Comments (0) | TrackBack | cf | j2ee

January 01, 2003

JRun Clustering & Session Replication - How does it do that?

Both clustering and replication work over the network and do a lot of things automatically for you. If you have two physical servers on the same network subnet and create clusters on both of them using the same cluster name, then the clusters will automagically find each other when you start them up. That means the server instances on each of those physical servers needs to be unique across both servers - server instance names must be unique within a cluster and a cluster can span physical servers. Similarly, session replication can be set up to have an application on one server instance buddy up with a set of other server instances running that application, anywhere else in the extended cluster. Once the server instances are up and running, buddies will automagically find each other.

Let's look at a slightly more complex setup and see what this allows us to do. Consider the following server setup:

  • Server 1, instances cfmx11, cfmx12, cluster cfmxprod

  • Server 2, instances cfmx21, cfmx22, cluster cfmxprod

  • Server 3, instances cfmx31, cfmx32, cluster cfmxprod

Three physical servers, each with two instances of CFMX, using the same cluster name on all three servers. If you connect your web server to this cluster, wsconfig will set things up so your web server will 'boot' off one of the instances but will then treat all six instances as 'proxy servers' (in the jrunserver.store file). Any request (to a /cfusion context root if you followed some of my naming conventions) will be routed to one of the six instances (and that session will then stay on that server).

If you take down one of your servers, any active sessions will be lost unless you've set up session replication. So let's assume we've set up session replication as follows:

  • cfmx11 buddies with cfmx21 and cfmx31

  • cfmx12 buddies with cfmx22 and cfmx32

  • cfmx21 buddies with cfmx11 and cfmx31

  • cfmx22 buddies with cfmx12 and cfmx32

  • cfmx31 buddies with cfmx11 and cfmx21

  • cfmx32 buddies with cfmx12 and cfmx22

With this setup, each server instance has buddies on other physical servers. That means that if we take down one physical server, all active sessions on that server will migrate to their buddies. Let's reboot Server 1. Active sessions on cfmx11 will migrate to either cfmx21 or cfmx31 and active sessions on cfmx12 will migrate to either cfmx22 or cfmx32. No downtime for your users!

So, how does it do that? It uses JINI. JINI let's each server broadcast its services so that other servers (on the same subnet) can automatically discover them. JRun's clustering mechanism uses JINI to discover other servers on the same subnet that host clusters with the same name - and merges them all into one big cluster. Similarly, replication uses JINI to discover on which servers the named buddies exist so that session data can be shared over the network. This is a good example of how powerful JINI can be - you don't need to configure other hostnames or IP addresses into your system: JRun just takes care of it for you. But you do need to be slightly careful - JRun searches the subnet for matching cluster names so if you have a cluster called cfmx on your machine and your colleague also has a cluster called cfmx on his machine, you could suddenly find both machines sharing the load! Choosing your cluster name is therefore quite important!

Posted by seancorfield at 08:17 PM | Comments (0) | cf

CFMX for J2EE: Session Replication with JRun

If you've created your cluster (see below), you may decide to make your system more robust by enabling session replication. There are some important caveats however:
  • You cannot enable session replication if you store any CFC instances in session scope. CFC instances do not serialize / deserialize fully (because they are full-blown Java objects and session replication is not designed to replicate complex Java objects, only simple data types).
  • Session replication works over the network and, for CFMX, cannot use the file-system persistence feature mechanism in JRun.
Having decided to enable session replication, here's how you go about it in JRun. This assumes you have already created a cluster according to my earlier blog entry with server instances called cfmx1, cfmx2 etc. As before, load the JMC in your browser and do the following:
  • On the Home page, in the main frame under Application Servers, click cfmx1 to see the J2EE Components on that server.
  • Under Web Applications (main frame), click CFMX Application to see the overview of that application.
  • Check Enable Session Replication (this auto-enables File-based Session Persistence which we will disable manually later).
  • For New Replication Buddy, enter cfmx2 and click Add
  • cfmx2 should now be displayed in the Session Replication Buddy List
  • Click Apply
  • Go back to the Home page - click the Home link in the top left corner.
  • In the main frame under Application Servers, click cfmx2 this time to see the J2EE Components on that server.
  • Under Web Applications (main frame), click CFMX Application to see the overview of that application.
  • Check Enable Session Replication (again, this auto-enables File-based Session Persistence which we will later disable).
  • For New Replication Buddy, enter cfmx1 this time and click Add
  • cfmx1 should now be displayed in the Session Replication Buddy List
  • Click Apply

Now you need to disable File-based Session Persistence because it conflicts with the CFMX custom class loader. You can't do this inside the JMC so you have to edit the jrun-web.xml file for each server instance using your favorite text editor:

  • {jrun.home}/servers/cfmx1/cfusion/WEB-INF/jrun-web.xml
  • {jrun.home}/servers/cfmx2/cfusion/WEB-INF/jrun-web.xml
The session config section needs to looks like this:
By default, the <active> flag is true, it should be changed to false as shown above.
Now restart your server instances and your session data will magically be replicated between server instances!
Posted by seancorfield at 07:50 PM | Comments (0) | TrackBack | cf | j2ee

CFMX for J2EE: Creating a JRun cluster

In order to cluster CFMX instances, you need to have multiple server instances, each containing a CFMX installation. For example, I create server instances called cfmx1, cfmx2 etc and then a common context root of cfusion under each of these. Then I create a cluster in JRun and add in the server instances. Note that JRun clusters contain server instances - a server instance can contain several different applications, each with their own context root. A request to the cluster for a particular context root will be served by any one of the server instances that have that context root. More on this later.
For JRun, open the JMC (JRun Management Console) in a browser and do the following:
  • Click Create New Server (top nav, main frame) to get the add server pop-up
  • Enter cfmx1 as the JRun Server Name
  • Click Create Server
  • On the next page, you can change the port number if you wish to use your own scheme rather than whatever JRun allocates for you - I use 8300, 8400 etc for the Web Server Port Number and 51030, 51040 etc for the Web Connector Proxy Port Number - then click Update Port Numbers
  • Click Finish and the pop-up will be dismissed
  • Click Refresh Now if necessary on the main panel to show the updated port numbers on server cfmx1
  • Click Create New Server again and repeat the process for server name cfmx2 (and change the port numbers if desired)
  • Click Refresh Now if necessary on the main panel to show the updated port numbers on server cfmx2
  • Click Create New Cluster (top nav, main frame) to get the add cluster pop-up
  • Enter cfmxXXX as the Cluster Name where XXX identifies the system, e.g., cfmxdev.
  • Click Next
  • Select both cfmx1 and cfmx2 from the list and click Next
  • It should confirm the servers were successfully added - click Done
Now you can start both CFMX server instances and then run wsconfig to configure your web server connector to talk to the cluster you just created.
Posted by seancorfield at 07:34 PM | Comments (0) | TrackBack | cf | j2ee

CFMX for J2EE: Manual Installation

When you download your copy of CFMX for J2EE, you have a couple of options for installation. My preference is to have the installer produce the EAR file cfusion.ear and then do a manual installation of this. The installer asks for your CF Admin password and the context root - if you do a manual installation, the context root you entered in the installer is irrelevant because you can control the context root later. Once you have cfusion.ear, unpack it manually:
jar xvf cfusion.ear
This creates cfusion.war, rds.war and a META-INF directory.
Now go to your J2EE server instance where you want to run CFMX. Create a directory, named for the actual context root you want, e.g., cfmx. Go into that directory and unpack the WAR file from above (jar xvf /path/to/cfusion.war). If you want to enable RDS to this server, you need to create a CFIDE context root directory (alongside the directory you just created above) and unpack the small RDS WAR file there (jar xvf /path/to/rds.war). Start your server instance and then, in your browser, open http://<server>:<port>/<contextroot>/CFIDE/administrator/index.cfm. Go through the first time dialog and you're done!
I've been installing servers this way on JRun (and other J2EE servers) and, whilst it may seem like extra work, it's actually more flexible - you don't need to re-run the entire installer every time, just create a directory and unpack the WAR file. Depending on the functionality of your J2EE server, you may now create a cluster of these instances - I'll show how to do that in another post shortly. Note that each context root has its own ColdFusion document root - the directory you created under your server instance. In another post, soon, I will show how to have server instances share a common document root.
Posted by seancorfield at 07:02 PM | Comments (1) | TrackBack | cf | j2ee

December 16, 2002

Flash Remoting for CFers

Quite a few ColdFusion developers have expressed an interest in learning Flash Remoting but have pointed out a lack of good tutorials. Lucas Sherwood addresses this in his article Macromedia - Designer & Developer : A ColdFusion Developer Teaches Flash Remoting Basics Through Examples.

Posted by seancorfield at 07:11 PM | Comments (0) | cf


Some folks may know that I've been very busy recently reconfiguring my team's servers to use CFMX for J2EE and experimenting with configurations. I can't say too much about some of the specifics that I've been doing just yet but here's a great article by Brandon Purcell that should give you an idea of why I'm doing this! Macromedia - Designer & Developer : Advantages of Using Multiple Instances for ColdFusion MX for J2EE

Posted by seancorfield at 07:06 PM | Comments (0) | TrackBack | cf | j2ee

December 13, 2002


NewAtlanta's Vince Bonfanti gave an interesting presentation at last night's BACFUG: An Introduction to JSP for CF Developers. I am somewhat familiar with JSP but to see a side-by-side comparison like this was enlightening, especially the section on the new JSTL specification. Vince is active in the JSP 2.0 and JSTL expert groups, as are members of Macromedia's JRun product team.
After the presentation, Vince gave a demo of BlueDragon - more or less in place of the usual Q&A session - which was also worth seeing. Vince showed how you can develop CF applications using BlueDragon on Tomcat and then deploy as a 'compiled' Web Archive file to a different J2EE application server - he took Ben Forta's CF5 Construction Kit as an example, showed it running on BD/Tomcat and then created a .war file which he then deployed to BEA's WebLogic and showed it running. Impressive. And, as I had to concede, something that is not possible with CFMX at the moment.
I had already downloaded both the Tomcat installer and the BlueDragon trial about a month ago but had been too busy to actually install either. While Vince talked, I installed Tomcat and BlueDragon on my TiBook in just a few minutes:
tar xvfz jakarta-tomcat-4.1.12.tar.gz
mv jakarta-tomcat-4.1.12 /home/tomcat
tar xvfz BlueDragon.tar.gz
cp -r BlueDragon_J2EE /home/tomcat/webapps/bd
cd /home/tomcat/bin
Then hit http://localhost:8080/bd/bluedragon/admin.cfm and explored the BlueDragon administrator. Simple but effective. The developer edition pops up an alert every 20 requests which is kind of annoying but a very effective way to ensure no one tries to deploy to production!
Posted by seancorfield at 02:18 PM | Comments (0) | TrackBack | cf | j2ee

December 11, 2002

Updater 2

Read the Macromedia - ColdFusion MX Updater Release Notes for details of the latest Updater available for ColdFusion MX. There's several important fixes in this update, including a lot of database driver issues. You can get the Updater from the Macromedia ColdFusion - Updaters, Patches, and Hot Fixes Overview page.

Posted by seancorfield at 05:24 PM | Comments (0) | cf

December 10, 2002


An interesting article on kdub's log about choosing technology and methodology based on 'best tool for the job'. Kurt Wiersma has a great mix of content on his blog covering Java, OS X, ColdFusion and PHP which are all subjects near to my heart!

Posted by seancorfield at 04:39 PM | Comments (0) | TrackBack | architecture | blogging | cf | j2ee | osx | php

December 08, 2002

Servlet -> CFML

I was intrigued by this code snippet from Matt Liotta that shows how to redirect from a Java Servlet to a ColdFusion page:

getServletContext().getRequestDispatcher("/index.cfm�).forward(request, response);

I believe Matt has suggested this idiom can be used to wrap a ColdFusion application in a Java Servlet that secures the application for licensing purposes, amongst other uses. Yet another way Java and ColdFusion are living more happily together these days.

Posted by seancorfield at 05:27 PM | Comments (0) | cf

November 25, 2002

How fast?

A lot of people seem obsessed with speed. Common questions on the CF mailing lists is "how fast is X in CF5/CFMX?" and "has MM published any performance figures?" The answer to the second question can be found on the Macromedia - ColdFusion MX : White Papers, Data Sheets and Briefs page. I was particularly interested in the new performance brief on CFMX for WebSphere. Page 14 has some throughput numbers showing CFMX standalone is about 1.5x faster than CF5 and that CFMX for WebSphere is about 2x faster than CF5 on single- and dual-processor systems. Impressive.

The first question? Oh write some code and test it yourself... just remember that overall application speed is likely to be more important to your users!

Posted by seancorfield at 10:02 PM | Comments (0) | cf

November 21, 2002


The Bay Area ColdFusion User Group met early this month, on the 14th, and Kelly Ross talked about the state of the web applications industry and what can we do to protect our careers. It was an interesting talk, if a little gloomy, and it contained some good advice for consultants looking to keep their clients and stay afloat in this tough economy. You can download Kelly's presentation from the BACFUG Code Sharing page.
I presented a snapshot of Hal Helms' new version of Fusebox but at the moment the code is too fluid to share even a snapshot and Hal would not allow the presentation to be shared either, since it explains how the current code works and will change with the code over the coming weeks. I'll keep y'all posted as I get more information on Fusebox MX.
The main focus of my life right now is to become intricately familiar with CFMX for J2EE and JRun 4 since we're in the process of rebuilding all our development and QA servers to use a new and improved configuration. So far I've been very impressed with JRun - the JMC (JRun Management Console) makes it simple to manage multiple servers, deploy applications and generally tune your system. Combined with CFMX for J2EE, it makes an awesome platform!
Posted by seancorfield at 10:46 AM | Comments (0) | TrackBack | cf

October 30, 2002

Fusebox MX (more detail)

Hal talked about the general shift in the programming world from procedural to OO and noted that ColdFusion had shifted in that direction too with CFMX. He made a comment about persistence and someone (Michael Dinowitz I think) asked Hal to define 'persistence': he said it's when "objects stick around after you turn the computer off" - I was pleased to hear that since I seem to be a bit of a lone voice at times saying that shared scopes in CF are not a form of 'persistence' and now I know that at least Hal agrees with me! Hal defined procedural programming as using algorithms to act on data, and OO programming as constructing "scale models that respond to messages". He explained that his background was in Smalltalk (one of the grandaddies of OO) and then gave a gentle introduction to the fundamentals of polymorphism, inheritance and encapsulation in OO. At that point he introduced what he is calling "Fusebox MX" and said it was his vision rather than any official statement from the Fusebox community at this point. In Hal's vision, the central core file is replaced by a relatively simple ColdFusion Component and the settings file is replaced by an easy-to-read XML file. Each circuit is implemented as a CFC as well, replacing the switch statement with method calls, but fuses remain the pretty much the same (simple .cfm pages). Instead of the traditional Fusebox idiom of accessing a specific set of global variables, you would 'send messages' to retrieve that data by calling methods like getSelf(), getCircuit("Products"), applySkin("Skins.redLayout"). The other major new feature is the plugin base component that can be extended (by writing components that inherit from it) to enhance pretty much any aspect of the core file by overriding one or more of the six plugin point methods: preprocess(), prefuseaction(), preskin(), postskin(), postfuseaction() and postprocess(). This is a very flexible architecture and leverages the new functionality in ColdFusion MX really well. Some good examples for plugins are security, debugging, logging... all without changes the core files! When Hal has his new website up and running, I'll have more to say about this. I plan to download his new code and try it out, alongside FB3 (which I have running locally for both CFMX and PHP!).

Posted by seancorfield at 08:27 AM | Comments (0) | TrackBack | architecture | cf

Round Room (more detail)

The discussion started out with some very specific issues: Michael Dinowitz pointed out that included templates that contained no CFML code, only HTML, did not get a Java .class file generated, although they seemed to be cached somehow because he found no difference in speed between first and second calls. He seemed to think this was an "MX pro" (I have not had a chance to validate this but it's made me curious about the compilation process!). Next we had an "MX con" from a customer who had just migrated a CF5 / SQL Server application from Windows to CFMX on Solaris and said the application was much slower. Several people suggested that the Solaris JDBC driver might be an issue here (talking to her original SQL Server database) and this led to a useful discussion about taking a holistic approach to application tuning. The general feeling was that there were too many variables in this particular migration to lay the blame on CFMX and that much more investigation was needed. Rob Brooks-Bilson related a migration story where an initial slowdown (of several orders of magnitude) was tracked to some very inefficient list handling which was more of an algorithmic or architectural problem with his code that CF5 had allowed passed. There is a feeling that CF5 was much more lenient with bad code and that now we need think harder about writing good code. Ray Camden highlighted an interesting migration issue around the use of the CGI scope: isDefined("CGI.whatever") is always true, even when the variable is not really present (CGI.whatever would return an empty string in this case). He also noted that HTTP is effectively an alias to CGI which means that neither CGI nor HTTP can be used as regular variable names - they are "reserved" in MX. Shlomy Gantz talked about how experienced CFers who have adopted structured programming techniques (picking up custom tags early on, then moving to modules; separating display from logic etc) will likely find the move to CFMX less of a disconnect since the new features are easier to assimilate with that background of experience. Shlomy said he is gathering material for a "Design Patterns in ColdFusion" book and would love to hear from people on that subject.
Talk shifted to CF Studio and Dreamweaver MX - another facet of the migration for many people - and a subject that clearly provokes strong feelings. Many CFers are very devoted to CF Studio. As I mentioned in the overview, Charlie Arehart talked about a lot of the tips & tricks to make DWMX much more Studio-like and many of the preferences and settings he mentioned were news to a lot of folks present who have tried DWMX and gone back to Studio. A lot of the issues that were mentioned also cropped up in the ColdFusion IDEs "Birds of a Feather" session I reported on so I'll mention them under that. For more reference information on migrating from CF Studio to DWMX, check these docs on mm.com.
I seem to have been alone in not knowing of Bob Denny. There was a true sense of awe around this man who created the former-O'Reilly webserver which is now, once more, provided by his own company, deerfield.com. Bob talked about the pros and cons of the ISAPI webserver connector protocol compared with WSAPI, invented earlier and used by his product WebSite. In the early days, ColdFusion shipped with WebSite and there was a sense of nostalgia for those days. Bob feels that if WebSite was once again an 'officially supported' ColdFusion webserver, many current IIS users would switch back to it and would see big performance boosts. I asked if he had a Mac version but, unfortunately, he doesn't.
Once Vern arrived, talk shifted to the content on Macromedia's website with a lot of people ready to criticize. Some people feel that clearer guidance should be given about the level of the material and the intended level of the audience (e.g., a beginner's introduction to an advanced topic). I said that I'd heard both that material was too simple and that it was too complex - that probably means some of it is just right but it's a hard line to walk. Vern called for more content from the community - if you don't like what's on the site, write something else for us. (I remember having this problem too when I was the editor of a C++ journal).
Posted by seancorfield at 07:13 AM | Comments (0) | TrackBack | cf

October 29, 2002

ColdFusion IDEs (overview)

Ben Forta led a healthy - and relatively calm - discussion about the pros and cons of Dreamweaver MX and ColdFusion Studio and gathered feedback on what people do and don't like about each of them. The discussion occasionally wandered onto other topics but Ben was able to keep everyone on track and managed to get a lot of useful information from everyone in just one hour... Go Ben! The general feeling seems to be that ColdFusion developers want a fast, light code-based editor most of the time but there are definitely things that some folks like about Dreamweaver MX and a sense that it can become what more of those developers want. In other words, despite some specific criticisms of DWMX, it was quite a positive session. I may write more on this after the conference, once I've had a chance to turn my frantic notes into something more coherent!

Posted by seancorfield at 04:25 PM | Comments (0) | cf

Fusebox MX (overview)

Hal Helms repeated the presentation he gave during the Fusebox Conference (which immediately preceded DevCon) about his vision for the future of Fusebox and how it could leverage the new features in ColdFusion MX. I'll do a full write-up later but, suffice to say, I was very impressed with what Hal is trying to do. A testament to his work is that fusebox.cfc, which is effectively the main Fusebox core file, is a mere 200 lines of code and anything you want to do as an extension to the core files could be done by creating a "plugin" component which extends a standard base component. Instead of the settings file being an executable ColdFusion file, Hal is proposing an XML file that specifies circuits, plugins etc. I think this is all extremely promising! Hal's hoping to have a new website up shortly containing information about this new Fusebox proposal which is still awaiting finalization by the Fusebox Council. More on this later!

Posted by seancorfield at 03:12 PM | Comments (0) | TrackBack | architecture | cf

October 22, 2002

NetShield & CFMX

If you run NetShield on your ColdFusion MX server, you need to be aware of this issue recently reported by a couple of customers. An incorrect virus definition (in the DAT file) may cause NetShield to quarantine the jikesw.exe file which can prevent CFMX from running properly. The virus definition is fixed in the latest DAT files available from McAfee's website. Make sure your virus definitions are up to date! You might also want to exclude certain parts of the CFMX install directory from the virus checker to prevent similar future problems.

Posted by seancorfield at 05:47 PM | Comments (0) | cf

CFMX Issues List

In response to requests from the ColdFusion community, Macromedia has published a Tech Note documenting Known ColdFusion MX Issues which are under consideration for future Updater releases.

As Vern says "Inclusion or exclusion in this list does not guarantee inclusion or exclusion from future releases of the ColdFusion MX Updater."

Posted by seancorfield at 11:28 AM | Comments (0) | cf

October 19, 2002

jEdit & CFML

I spoke too soon about my coldfusion.xml. To really get the highlighting working properly, it's quite a bit more complex than it initially looks. I've made a few more changes but it still doesn't do the right thing in all cases so I'm starting again, pretty much from scratch. The problem is that in certain contexts #expr# means 'evaluate expr' and in other contexts the # is 'just' a character and may not always occur in pairs. Similarly for & which does not always indicate the start of an SGML entity (e.g., &amp;). Still, the current version available for download isn't bad but it could - and will - be much better!

Posted by seancorfield at 10:07 AM | Comments (0) | cf

October 18, 2002

jEdit & CFML

I've made several changes to the coldfusion.xml edit mode file that Joshua Miller makes available on his site. I won't claim that it makes it more compatible with CF Studio or HomeSite+ in terms of tag highlighting but, in my opinion, it's an improvement and it definitely fixes a few bugs in the original XML. You can right-click and download it (it may not render in your browser if you simply click on the link - it references a local DTD that only exists in jEdit). Things that I think I've improved include: recognizing ge and le as operators, highlighting "#variable#" in attributes and #variable# inside <cfoutput>, ignoring whitespace, JavaScript processing.

Thanks to Joshua Miller for spotting a bug - now fixed - in the highlighting! He says he'll post my version back to his site shortly. My next task is to start work on the ColdFusion tag completion XML document, once I've figured out how...

Posted by seancorfield at 12:44 AM | Comments (0) | cf

October 17, 2002


Lest you drown in a sea of MVAs (Model-View-Acronyms), here's a very interesting whitepaper that explains the difference between MVC (Model-View-Controller) and MVP: Model-View-Presenter The Taligent Programming Model for C++ and Java. Wondering about MVCF? That was the named coined by Benoit Hediard for his "Model-View-controller in ColdFusion" architecture - another interesting read.

Posted by seancorfield at 02:17 PM | Comments (0) | TrackBack | architecture | cf | programming

October 16, 2002

dateFormat & JRE versions

Rob Rohan recently reported a problem with dateFormat() and the 1.4.1 JRE. If you have (ddd) as the last text in your format, you get a mysterious error that the timestamp you passed in is invalid. The code works just fine on the 1.3.1 JRE and it works if you don't have (ddd) in the format. Rob found a workaround that is equally mysterious: add a space to the end of the format string (so it ends in "...(ddd) "). Why this works, I have no idea. Why it failed in the first place, I have no idea. It just seems a weird enough bug - with a weird enough workaround - that it's worth blogging!

Posted by seancorfield at 11:40 PM | Comments (0) | cf

October 14, 2002

kwfu: ['cfc']

Spike's blog is always a good read but right now it deserves a special mention for a couple of lengthy posts about ColdFusion Components. Spike provides quite a few code examples to help understand how components manage their instance data.

Posted by seancorfield at 11:24 AM | Comments (0) | cf

October 11, 2002

JEdit in use

I've been using jEdit now for a few days and I've found it to be fast and reliable. It's made me realize how much I rely on Dreamweaver's concept of "sites". Even when I'm working on my local ColdFusion MX system, I typically use CVS to check-in/-out files to a directory tree that is outside my CFMX wwwroot and then use Dreamweaver's site definition functionality to 'put' files to the actual CFMX location. So I created a jEdit macro to do this. I create a .site file in the root of my working area, e.g., /Users/sean/repository/, which contains a single line that specifies the directory within the CFMX installation that 'matches' that point on the source tree, e.g., /home/coldfusionmx/. The script searches 'up' the file system from the file being edited to find .site (much like ColdFusion does to find Application.cfm) so you can have different subdirectories map to different places within the CFMX installation (as I do). Then you just save a file, e.g., /Users/sean/repository/extensions/components/lib/item.cfc and choose Macros > Files > Push To Site and the macro copies the file to /home/coldfusionmx/extensions/components/lib/item.cfc - it figures out the relative path from the 'site root' on both sides.
It's not very sophisticated, just a 'convenience' for the way I work. It doesn't handle remote sites (via ftp). Maybe I'll enhance it to do that one day, or maybe you can, dear reader! It certainly shows the power and flexibility of jEdit for people on platforms where ColdFusion Studio or HomeSite+ is not available.
Posted by seancorfield at 09:28 PM | Comments (0) | TrackBack | cf

October 09, 2002

JEdit & ColdFusion

Quite a few people have expressed enthusiasm for an Open Source Java-based programmer's editor called JEdit. For people looking for a free ColdFusion Studio / HomeSite style text editor for Linux or Mac OS X, JEdit and ColdFusion - A Users-Guide will be very interesting. I'm about to install JEdit and go through the users' guide in detail. I'll report back with what I think.

Posted by seancorfield at 06:09 PM | Comments (0) | cf

October 05, 2002

Reality ColdFusion

A few weeks back (at a cat show in Tucson, in fact), I read Ben Forta's "Macromedia Flash MX Integration" book, part of his "Reality ColdFusion" series. It's an interesting book, taking you through four case study applications that provide a Flash UI to a ColdFusion back-end, via Flash Remoting: Jukebox, Expense Reporting, Mail Client and Chat. Each case study takes you through the requirements outline, early design, development, delivery and conclusions. The Expense Reporting application is particularly interesting for its ability to work offline using Flash MX's Local Shared Objects to store expense reports locally for editing until the user goes online and then submits them to the main application. The Chat client uses Flash Communication Server and shows how easy it is to build interactive multi-user applications.

The book focuses on ActionScript, from a ColdFusion programmer's point of view. There's very little detail about user interfaces and most of the user interfaces are little more than engineering-art: this is not a book about Flash design. Some of the ActionScript examples are very simple, others are complex enough that a little more explanation would have been useful. The ColdFusion code - in CFCs - is extremely simple for the most part. The thrust of the book is to show how easy Rich Internet Applications can be to build. Mastery, of course, takes much longer.

I think the book succeeds as an introduction to Flash MX / ColdFusion MX integration. It doesn't try to teach you ActionScript but any CF developer who has use CFscript will pick it up quickly. It doesn't try to teach you how to use the Flash authoring tool but there's good examples and tutorials in the product to help you there. It doesn't go too quickly through the material, not does it try to dig too deep into the subtleties of the technology - it's a good middle ground.

Watch out for other books in this series!

Posted by seancorfield at 04:44 PM | Comments (0) | cf

October 04, 2002

Apache 1.3.27

As a few folks have commented, there has been a flurry of security upgrades recently with Apache. Since the launch of ColdFusion MX, Apache 2.0.x has gone from 2.0.39 (supported by the launch version of CFMX), through 2.0.40 (supported by the updated version of CFMX) and on to 2.0.43 now. This week we have seen a rev in the Apache 1.3.x branch from 1.3.26 to 1.3.27. You can read about the fix in this Apache Week article: Apache httpd 1.3 vulnerabilities. My feeling is you should look to upgrade to Apache 2.0.39 (or 2.0.40 as appropriate) because of the increased stability and performance with ColdFusion MX.
Posted by seancorfield at 12:15 PM | Comments (0) | TrackBack | cf

Japanese ColdFusion

Thanx to Ken Azuma for letting me know that he has a Japanese ColdFusion blog called ColdFusionLab.

Posted by seancorfield at 07:50 AM | Comments (0) | cf

October 02, 2002

Brazilian ColdFusion

Alex Hübner just linked to my blog from his: < CF_GIGOLÔ > - na cama com o macromedia coldfusion. Do you know of any other non-English blogs about ColdFusion? Let me know!
Posted by seancorfield at 12:38 PM | Comments (0) | TrackBack | cf

Trying CF5?

As a follow-up to my post about buying CF5, I've been given permission to post the direct download link for the Windows Developer Release of CF5. Obviously we'd prefer folks to try & buy CFMX but we understand that some people are simply not in a position to upgrade yet and need to maintain a homogeneous CF5 environment.

Posted by seancorfield at 07:45 AM | Comments (0) | cf

October 01, 2002

Buying CF5?

"Can I still buy CF5?" This is a common question that crops up on the mailing lists from time to time. The answer is addressed in the Macromedia - ColdFusion MX : General Information FAQ which says 'yes' and tells you how to do it. The FAQ includes a lot of other information which answers many of the logistics questions that are asked about ColdFusion.

Posted by seancorfield at 02:17 PM | Comments (0) | cf

Modularization & Code Size

A post on CF-Talk the other day caught my interest. A user was migrating a large Fusebox application to ColdFusion MX and ran into a problem that I haven't seen reported very much yet: the underlying 64k limit in Java. There's two ways to hit this limit:
  • Creating code where a single method (in the generated Java) exceeds 64k
  • Creating a cfswitch where there is more than 32k of (generated Java) code inside it
These are inherent limits in Java, based on the design of its Virtual Machine, but they highlight an interesting issue in your CFML. If your CFML is well-structured and reasonably modular, you are unlikely to hit this problem. For example, if your code is broken down into UDFs and custom tags. If, however, you have large 'slabs' of inline code - even if you cfinclude it - you may hit the Java limits. In CFMX, you can also hit this limit by having a very long cffunction. Again, modularization - breaking the code into smaller, logical functions - will solve the problem. A more modular program is a more understandable program. A more modular program usually allows more code reuse as well.
Posted by seancorfield at 01:59 PM | Comments (0) | TrackBack | cf

September 27, 2002


At BACFUG last night, Matt Liotta presented the fruits of his company's labor: Alchemy EX. It wasn't a sales pitch - kudos to Matt for that - but instead it was a very interesting presentation about what Montara Software have been busy building. What they have built is a suite of products that help Java and ColdFusion developers build content-managed web sites. Their "Studio" product is their visual site designer tool and it is a full Rich Internet Application: a Flash MX user interface that provides a graphical representation of the navigation structure of the site you are building, with popup forms for properties and layout etc. You then write JSP or CFML pages that use the Alchemy tag library to access page properties. Very slick. Check out his website for more details - he's also running a series of WebEx demos of the product suite. You can access his presentation on the BACFUG "code" page.

Posted by seancorfield at 08:34 PM | Comments (0) | cf

September 24, 2002

Which Apache?

If you are running CFMX on Solaris, you will need to use Apache 2.0.39 with the base CFMX product or Apache 2.0.40 with the updated product (i.e., after running the CFMX Updater). If you run Apache 1.3.26, it's time to upgrade because under load you will see your Apache processes consume more and more CPU until your system becomes unresponsive. My team had seen this internally but I had not seen it reported publicly until this morning, so now I know it's not something quirky about our development machine. We're already in the process of upgrading to Apache 2.x but there are some 'gotchas' since mod_perl is not yet completely stable in the new Apache release. Our approach is to use the lightweight, multi-threading Apache 2.x as a front-end, routing CF requests to CFMX and most other requests to an Apache 1.3.x process running on the loopback address which does the 'heavy lifting' of mod_perl, images, swfs, HTML etc.

Posted by seancorfield at 07:50 AM | Comments (0) | cf

September 21, 2002

< cf notes >

A web site with some interesting technical notes on ColdFusion MX, this link was sent to me by Andy Burton at Tanjents originally for his notes on how to persuade IIS to talk to both CF5 and CFMX on a per virtual-server basis.

Posted by seancorfield at 05:04 PM | Comments (0) | cf

September 17, 2002

CFMX Updater

The much awaited Updater for ColdFusion MX has been released. You can read the Release Notes for the Updater to see what it will do for you.

For Apache users, please note that the updater will require an upgrade from 2.0.39 to 2.0.40 to incorporate the latest security fixes for Apache.

Posted by seancorfield at 05:46 PM | Comments (0) | cf

September 12, 2002


Do you use cflock when updating shared scope variables? You should. Do you lock based on scope or do you use named locks? You would do better to use the latter. Consider the situation where you have two difference pieces of code that access different variables in, say, server scope. If they both lock on the server scope, then only one of them can run at any time. That would be particularly bad if one piece of code is executed frequently (but is otherwise fast) and the other piece of code is executed rarely but is very slow - you'll block several of your users for no reason. It's much better practice to use named locks:

<cflock name="serverFooLock"...>
<cfset server.foo = someExpression()/>
<cflock name="serverBarLock"...>
<cfset server.bar = someOtherExpression()/>

This is better than having both pieces of code lock on the same resoure, server scope.

I received an email about this advice, questioning whether locking is necessary at all in CFMX. Well, yes and no. In CF5, if you failed to lock your updates, your shared scopes could get corrupted - that won't happen with CFMX. But if your updates are susceptible to race conditions, you should still lock on updates to prevent such races. Since that can be hard to figure out sometimes, it's still good advice to lock on updates in general.

Posted by seancorfield at 04:18 PM | Comments (0) | cf

CFMX Updater

Ben Forta yesterday posted to several mailing lists and forums some (unofficial) clarification on our forthcoming ColdFusion MX update program. He writes:

"Yes, an update for CFMX is on the way. No, it is not a full
service-pack, rather, it is a new update mechanism that will allow
patches or fixes to be applied safely and easily. This will not be a one
time update, the intent is to provide a means by which to get important
updates and fixes to customers as quickly as possible whenever the need

"Along with the updater will be an initial set of updates. We're still
doing some testing, so no final details yet, but as an FYI, here is some
of what is included in the first update:

  • COM connectivity (both functionality and performance)

  • Database connectivity improvements

  • Administrator functionality fixes

  • Internationalization/UNICODE fixes

  • Debugging fixes

  • Web server connector improvements"

More details will appear in due course. (see the 9.17.2002 entry)

Posted by seancorfield at 12:12 PM | Comments (0) | cf

September 09, 2002

Upgrading from CF5

When you install CFMX and you have CF5 already installed, you get the option to "upgrade" and have the installer import and convert all your CF5 settings. However, if you have to abort the installer for some reason (disk space, time for lunch, whatever), when you run the installer again to complete the process, the option to "upgrade" has gone. Bummer. Sean Daniels just posted a solution on CF-Talk: "In case anyone else has this issue, I found a solution. There is a key in CF5 registry called CFMX_Upgraded. I deleted this key and got the option to upgrade again when I ran the installer." Useful!

Posted by seancorfield at 11:06 AM | Comments (0) | cf


Today we announced ColdFusion MX for J2EE, running on IBM WebSphere, Sun ONE and Macromedia JRun. My team will be deploying ColdFusion MX for JRun 4 shortly.

Posted by seancorfield at 10:30 AM | Comments (0) | TrackBack | cf | j2ee | macromedia

September 06, 2002

CFMX in production?

Who is running ColdFusion MX in production seems to be a common question. ColdFusion Examples is one such example and - hopefully - a useful one too!

Posted by seancorfield at 06:10 PM | Comments (0) | cf

September 04, 2002


Check out the new Security Development Center in the Designer & Developer Center. There's an excellent two-part article from Charlie Arehart on sandbox security and Tom Donovan provides the top ten tips on security ColdFusion MX.
Posted by seancorfield at 05:34 PM | Comments (0) | TrackBack | cf | macromedia

August 26, 2002

Got .class?

A few people have been asking recently how do you figure out which .class file in the WEB-INF/cfclasses directory is generated from which source file - mostly when they want to delete a single file to force recompilation and they have multiple index.cfm files! The answer comes from Mike Nimer:

The generated filename is cf + mapped-filename + hash-code (+ .class). The mapped-filename is obtained by taking the full root-relative pathname of the file and replacing directory separators with __ (double underscore) and any characters that are not valid in a Java identifier with their two-digit hex equivalent. The hash-code is the (Java) hashCode() of the File object which represents the file (see Sun's documentation). If the hashCode() result is negative, it is exclusive-OR'd with 0xFFFFFFFF to get the value used by ColdFusion.

Batch scripts to compile .cfm pages have started to appear in various people's blogs so I won't reproduce them here.

Posted by seancorfield at 03:28 PM | Comments (0) | cf

August 23, 2002

Paradigm Shift

Benoit Hediard (MVCF) recently posted the following link on cf-talk: First Impressions of ColdFusion MX: Fusebox is Toast?. The article dates back to May 20, 2002 but it's very interesting to see how much of a revelation ColdFusion Components were to the article's author, Ben Rogers. For someone like myself, with a heavy OO background and coming to CF first through the MX release, it can be difficult to get a sense of how CFMX looks to the 'old hands' so I enjoy articles like this one.

And is Fusebox toast? No, but Ben explains why Fusebox could be less compelling now that ColdFusion Components exist.

Posted by seancorfield at 09:15 PM | Comments (0) | TrackBack | architecture | cf | programming

August 21, 2002


Another ColdFusion "tips" web site was just brought to my attention: ColdFusion Tips Plus | CFTipsPlus.com - A ColdFusion ezine delivered to your email every week. With tips on ColdFusion, JavaScript, HTML, Design, and more. I haven't had time to delve into the site too much yet but it looks interesting.

Posted by seancorfield at 08:26 AM | Comments (0) | cf


As proof that ColdFusion MX allows much more expressive approaches to building web sites, Benoit Hediard has put together a methodology based on applying the Model-View-Controller paradigm to ColdFusion. You can read about it on his Benorama :: ColdFusion MX web site. I'll blog my thoughts about it here once I've had time to read through more thoroughly.

Posted by seancorfield at 08:22 AM | Comments (0) | TrackBack | architecture | cf | programming

August 16, 2002

ColdFusion Components

Ben Forta has a great new article on the Designer & Developer Center this week, called Using ColdFusion Components -- Properly. It'll help you write more reusable code!

Posted by seancorfield at 03:25 PM | Comments (0) | cf

August 15, 2002


cf-talk recently had a discussion about best practices and, in addition to mentioning the Coding Guidelines I published and the Macromedia Tips Application, someone pointed out this fledgling site: HOW2CF - Your source for ColdFusion Answers. There's only a few tips there at the moment but, like the Macromedia Tips Application, these things take time. I'll keep an eye on it and see how it develops.

Posted by seancorfield at 10:36 PM | Comments (0) | TrackBack | cf | macromedia

August 14, 2002

LDAP & Web Services

An interesting article: Using Cold Fusion Web Services To Query an LDAP Server. It's nice to see ColdFusion MX covered on a site that is primarily focused on ASP and VBscript!

Posted by seancorfield at 03:12 PM | Comments (0) | cf

August 05, 2002

Developer Edition & IP addresses

The Developer Edition of ColdFusion MX allows you to access the server from the local machine (IP and one other IP address. The way it does this is to remember the first non-local IP address that accesses the server and write it to the license.properties file in {CFMX}/lib. With the CF5 Developer Edition, you could only access the server from one IP but it 'forgot' that IP every time you restarted the server. With CFMX, you get two IP addresses - one of them is always localhost - but it permanently remembers the additional IP address (until you edit the license file and restart the server).

Posted by seancorfield at 05:35 PM | Comments (0) | cf


There are several ways to pass arguments to a function when you invoke it: positional arguments, named arguments, argumentCollection and cfinvokeargument. Positional arguments is how you would normally invoke a UDF:

res = myUDF(arg1, arg2, arg3);

Named arguments is where you specify the actual argument names with their values:

res = myUDF(x=arg1, y=arg2, z=arg3);

This allows you to specify the arguments in any order, for example the following call is identical:

res = myUDF(z=arg3, x=arg1, y=arg2);

If you use cfinvoke to call a function in a component, you can specify named arguments in the invocation:

<cfinvoke component="cmp" method="foo"
x="#arg1#" z="#arg3#" y="#arg2#"

You can also specify arguments to the cfinvoke tag by using the cfinvokeargument tag:

<cfinvoke component="cmp" method="foo"
x="#arg1#" y="#arg2#"
<cfinvokeargument name="z" value="#arg3#"/>

If there are duplicates between the named arguments and the cfinvokeargument names, the latter takes precedence.

The argumentCollection mechanism allows you to specify your arguments in a struct and pass that as a single argument:

args = structNew();
args.x = arg1;
args.y = arg2;
args.z = arg3;
res = myUDF(argumentCollection=args);

You can even mix this form with named arguments:

res = myUDF(argumentCollection=args,x=42);

In this case, the explicitly named arguments will override the arguments specified in the args struct. I actually think this would be more useful if it were the other way around - which would allow the explicitly named arguments to act as defaults for missing values in the argumentCollection struct but that's not how it works.

However, if you try to mix argumentCollection with named arguments in a cfinvoke tag, the argumentCollection struct is totally ignored! This is a bug - it should work. Fortunately, there are two workarounds. You can either specify the named arguments with cfinvokeargument or you can change argumentCollection to attributeCollection as these two examples indicate:

<cfinvoke component="cmp" method="foo"
<cfinvokeargument name="z" value="#arg3#"/>


<cfinvoke component="cmp" method="foo"

Since this is a known bug that will be fixed in a future release, my advice would be to use the former workaround. Why does the second workaround even work? Well, attributeCollection is how you pass a group of arguments (attributes) to a custom tag so presumably the machinery is supported since this makes it easier for ColdFusion MX to implement (in Java) the custom tag machinery.

Posted by seancorfield at 03:29 PM | Comments (0) | cf

August 01, 2002

Web Services (& other DesDev updates)

The Macromedia - Designer & Developer Center has just added a whole bunch of new content including a Web Services topic with a lot of interesting articles. I'm also pleased to say that this blog is featured in its own article!

Posted by seancorfield at 05:57 PM | Comments (0) | cf

July 31, 2002

The need for speed

The mailing lists seem alive with questions about which is faster: CF5 or CFMX? There are also questions about whether particular coding constructs are faster than others. The simple answer is, well, try it for yourself - getTickCount() is your friend here. The recently published Macromedia Performance Brief (see my 7.24.2002 entry) shows that users should generally expect CFMX to be 10% faster than CF5 on Windows (and much faster than CF5 on Linux). That's in general of course and your mileage may vary. Some users are complaining that their applications are slower on CFMX. On cf-talk in particular, we are starting to see code fragments posted that actually time different features. <cfwddx> seems to be slower on CFMX, as does the string insert() function. This is probably not too surprising since Java is typically slower at processing text than C/C++ in general.
A related question on that list was whether it is faster to convert a list to an array and loop through it, rather than use listGetAt(). Since that is effectively a string processing function, it shouldn't really surprise you that using listToArray() and looping through the array is much faster (about 20x faster according to initial tests).
Posted by seancorfield at 10:42 AM | Comments (0) | TrackBack | cf

July 30, 2002


Remember some time ago when I warned that there are certain things that you can't call duplicate() on? Here's another one: duplicate(arguments) will fail with a null pointer error. isStruct(arguments) returns true and you can structCopy() it just fine. The workaround is to loop over the items in arguments and copy them individually into a new struct (which you can then duplicate).

Posted by seancorfield at 02:43 PM | Comments (0) | cf

July 26, 2002


Last night I was part of a panel-format meeting of the Bay Area ColdFusion User Group. Nathan Dinterfass showed how easy it is to manipulate XML in ColdFusion MX, Matt Liotta showed how you can easily wrap Java functionality in ColdFusion Components, Brian Ghidinelli showed a simple Rich Internet Application to maintain a little database and I showed how you can do useful stuff with CFC metadata. The panel example code will be uploaded to the BACFUG Code Sharing page in due course. In the meantime, you can download my example code, along with my previous BACFUG presentation, from my ColdFusion Resources page.

Posted by seancorfield at 03:27 PM | Comments (0) | cf

July 24, 2002


Macromedia has now announced official performance data for ColdFusion MX. You can read the whitepaper, ColdFusion MX Performance Brief (PDF, 363 KB), on the Macromedia - ColdFusion MX : White Papers, Data Sheets and Briefs web page.

The summary says "See how ColdFusion MX outperforms ColdFusion 5 in both performance and scalability. Testing was done on Windows, Linux, and Solaris."

Posted by seancorfield at 05:22 PM | Comments (0) | TrackBack | cf | macromedia

July 23, 2002


Following on from a discussion about process and 'good' code on BACFUG, Matt Liotta posted a link to an article he wrote for DevX about refactoring an application to make it more maintainable and more adaptable. His story makes good reading as it explains both the why and the how behind his architectural process.

Posted by seancorfield at 09:56 PM | Comments (0) | TrackBack | architecture | cf | programming

July 22, 2002

Chinese locales

ColdFusion MX supports three Chinese locales that are not covered in the main documentation so you might have missed them. They are: Chinese (China); Chinese (Hong Kong); Chinese (Taiwan). These correspond to the underlying locales zh_CN, zh_HK and zh_TW respectively. How can you find out what a ColdFusion MX locale maps to in general? You can access the Java code underneath as this code fragment shows:

<cfset pc = getPageContext() />
<cfset setLocale("Chinese (China)") />
  Current Locale: #getLocale()# --- Current date: #LSDateFormat(now(), "ddd-mmm-yyyy")#
  <!--- look at locale in the java pageContext object --->
  <br>here's the language for the ServletResponse object:
  <br>here's the country for the ServletResponse object:

In this example we examine Chinese (China) but you can try it for other values of locale. Credit to my colleague Seth Hodgson for this example.

Posted by seancorfield at 02:56 PM | Comments (0) | TrackBack | cf

Service-specific Error 2

A few people may have seen this when trying to start ColdFusion MX. Everything was working fine, you changed some Java and JVM Settings and things were still fine. Then you restarted... and ColdFusion MX wouldn't come back up and all you got was that cryptic message. This can happen if you put something illegal into the JVM Arguments field in the administrator. That field gets written out to the configuration file and next time you try to start ColdFusion MX, it fails because the java driver can't make sense of these new options.

To fix the problem, you'll need to edit {CFMX}/runtime/bin/jvm.config and correct the java.args line back to something like this:

# Arguments to VM

i.e., remove the extraneous arguments you added in the JVM Arguments field. Note that on your platform there may be quite a few more, valid, arguments than shown above - see below for what's in my jvm.config. Then you should be able to restart ColdFusion MX.

# Arguments to VM
java.args=-DJINTEGRA_NATIVE_MODE -Xmx512m \
-Xbootclasspath/a:{application.home}/lib/webchartsJava2D.jar \
-Djava.awt.graphicsenv=com.gp.java2d.ExGraphicsEnvironment \

Note: I have broken this onto multiple lines for readability and added \ at the end of each line to indicate continuation!

Posted by seancorfield at 09:17 AM | Comments (0) | cf

July 19, 2002

More on Fusebox

My comments about Jeff & Nat's book have a page of their own. If you don't agree with me, let me know!
Posted by seancorfield at 04:10 PM | Comments (0) | TrackBack | architecture | cf | programming

Error Reporting

Someone recently observed on BACFUG that the default error 'page' no longer contains a link to email the site administrator. Earlier versions of ColdFusion allowed you to specify an "administrator email" and that was shown in the default error messages. In ColdFusion MX, you can control the format of the error information by editing {CFMX}/wwwroot/WEB-INF/exception/detail.cfm. You could change it to email all the details directly to your webmaster address if you wanted. All errors are reported through this file via specific exception handlers in the coldfusion/runtime subfolder. Even cfabort output can be controlled via AbortMessageException.cfm (if you specify showError=, otherwise it uses AbortException.cfm - the only exception handler file that does not invoke detail.cfm).
This allows you to create custom detail pages for any exception you throw via cfthrow. If you specify type="foo", the CustomException.cfm handler will be invoked which just delegates to detail.cfm as shipped. However, if you change the custom handler to this:
<!--- error handler for custom user exceptions --->
<cfimport taglib="../../" prefix="ex">
<cfinclude template="/WEB-INF/exception/#replace(error.type,'.','/')#.cfm">
<cfcatch type="any">
<!--- no user-supplier handler --->
<ex:detail error=#error#/>
then you can put foo.cfm in the exception folder and it will be executed instead of the default detail.cfm handler! Note the call to replace() which maps hierarchical exceptions like "foo.bar" to directory paths like foo/bar.
I am indebted to two members of the ColdFusion Product Team: Spike Washburn for the insight into how this actually works and Edwin Smith for implemented such flexible machinery in the first place! You guys rock!
Posted by seancorfield at 02:28 PM | Comments (0) | TrackBack | cf


Macromedia has not said much about the performance of ColdFusion MX compared to earlier releases. Some people find this particularly strange after the trumpeting about CF5 being so much faster than CF4.5. Back in May, eWeek did some tests (on the Release Candidate) and published their results as part of an article about application server maturity. Their tests indicate that CFMX scales better than CF5. Since those tests (on the Release Candidate), further performance enhancements were made to the product so the shipping release should be even better.
If I hear of more performance results being published, I'll provide links to them here.
Posted by seancorfield at 10:07 AM | Comments (0) | TrackBack | cf | macromedia

July 17, 2002

More on /

A colleague of mine, David Keith, bemoaned the fact that Dreamweaver MX generates <cfset > when you click the set option in the CFML Basic tag insert menu. He wanted it to generate the closing / so that the result would be XHTML-compliant. He soon figured out how: in the Dreamweaver MX install directory, edit Configuration/Objects/CFML Basic/Cfset.htm and change the code that gets inserted to have ' />' instead of just '>' - the extra space improves readability. Thanx David!
Posted by seancorfield at 02:34 PM | Comments (0) | TrackBack | cf


A question that crops up fairly regularly is "Why does ColdFusion execute my tag twice?". If you have a custom tag foo.cfm and call it as <cf_foo>, it will be called just once, as most people expect. If you call it as <cf_foo/>, it will be called twice - notice the /. This is a surprise to many people but if you think it through, it becomes clear what is going on... Consider the following code:


Here we are calling foo.cfm with obvious start and end tags. Not surprisingly, foo.cfm is executed twice: once for the start tag and once for the end tag. How can we tell these situations apart? We can test thisTag.executionMode. It will equal "start" for the first execution and "end" for the second execution. This allows complex custom tags to perform some setup at the start and then deal with the tag body (stuff in the example above, referenced as thisTag.generatedContent) during the "end" execution. We would write:

<!--- foo.cfm --->
<cfif thisTag.executionMode is "start">
  <!--- perform setup --->
  <!--- handle thisTag.generatedContent --->
  <cfset thisTag.generatedContent = "<b>" & thisTag.generatedContent & "</b>"/>

All this does is to embolden the body of the tag so no setup is needed in this case.

Now let's go back to our original example: <cf_foo/>. The / indicates a 'closing tag' so this is identical to <cf_foo></cf_foo>. It should be clear from this that foo.cfm will be executed twice. What should you do about this? Well, you have a choice... you can either code your custom tag so that it will not allow an end tag (by testing thisTag.hasEndTag and throwing an exception if that is true) or you can have your tag only execute at the start (when thisTag.executionMode is "start"). I prefer the second option because it then allows you to specify the closing / and have XHTML-compliant CFML source code, without affecting the behavior of your program. Of course, you still have to be careful when using custom tags that you didn't write - but if a third-party custom tag isn't robust enough to handle this, I recommend you complain to the tag's author!

Posted by seancorfield at 10:36 AM | Comments (0) | cf

July 15, 2002


The long weekend away allowed me to read Jeff & Nat's new book on Fusebox from cover to cover. It's a good book: it's very well-written and I now have a much better understanding of why Fusebox works for people. I might even try rewriting my personal site using PHP Fusebox, just for the experience. I have a lot of notes about the book that I'll be writing up over the next few days, where I will go into more detail about what I really think of Fusebox, FLiP - the Fusebox Lifecycle Process - and Fusedocs. For now, I'd say that whether or not you're already a Fusebox fan, this book should be on your reading list.
Posted by seancorfield at 04:15 PM | Comments (0) | TrackBack | architecture | cf | programming

July 10, 2002


Want ColdFusion MX to serve up .foo files? Matthew Haughey asked how to do just that on BACFUG recently and later posted the answer to his own question: "Editing the web.xml file located at {CFMX}/wwwroot/WEB-INF, by adding these lines did the trick:"



Another servlet-mapping that may be useful to you is FileServlet which will cause ColdFusion MX to render files that match the url-pattern "as-is", i.e., without interpretation.

Posted by seancorfield at 11:12 PM | Comments (0) | cf

July 07, 2002

Hidden metadata

When you're writing components, it can be useful to walk through the metadata of the component's parents or through all of the properties - declared and inherited - in the component. It would be useful to be able to get all of this metadata in a single call, rather than having to navigate through arrays and structs to find what you're looking for. If you are willing to cfinclude a file from inside the administrator directory tree, you can do this.

/CFIDE/componentutils/_component_utils.cfm contains two useful methods: getAncestors() and getProperties(). You can use these as follows:

<cfset metadata = getMetadata(this)/>
<cfset ancestors = getAncestors(metadata)/>
<cfset properties = getProperties(ancestors)/>

The results are an array of metadata (ancestors) and a struct of metadata (properties). The properties struct has every single declared and inherited cfproperty as a key. The keys' values are also structs, containing two items: implementedin and metadata. The former is the name of the component in which the property is declared. The latter is the metadata for the property itself.

Once again, note that cfproperty is not related to variables declared in the public this scope or in the unnamed private scope of a component. However, cfproperty can be very useful when writing components that map database or other such 'external' structures.

Posted by seancorfield at 05:09 PM | Comments (0) | cf

July 04, 2002

var is your friend!

Back on 6.19.2002 I was talking about local variables. I want to emphasize how important these are when you're writing functions, especially inside ColdFusion Components. If you work with complex data structures - including XML - you will probably find yourself writing functions to manipulate parts of those structures. Those functions will probably call other functions. As soon as you start doing that, you need to make sure that any variables used in one function do not clash with variables used in the other functions. That's why var should become second-nature. If you declare your function inside <cfscript> then begin with a block of 'declarations': for every single variable you use in that function, initialize it at the head of the function with var variableName = someValue;. If you're declaring functions using the new cffunction tag - which is recommended since you can specify argument and return type validation! - then you should begin with a block of cfset tags that 'declare' each variable you intend to use:
<cfset var variableName = someValue/>. This will ensure that your functions will not overwrite each other's variables.

Posted by seancorfield at 03:47 PM | Comments (0) | cf

June 28, 2002

Coding Standards / tidy

I added some links to the ColdFusion MX Coding Guidelines so that people could find the tool tidy referred to there.

Posted by seancorfield at 12:16 PM | Comments (0) | TrackBack | cf | programming

Apache Security Issue

Some of you may have heard about a security flaw recently discovered in Apache. The wonderful folks at Apache.org already have fixes for this and recommend you upgrade to 1.3.26 or 2.0.39. More details can be found at CSB02-02 - Apache buffer overflow vulnerability in 1.3.x and 2.0.3x. Note that if you upgrade to 2.0.39 and you are using JRun 4 or ColdFusion MX, you will need a patch from us. Details of that can be found at MPSB02-07 - Patch available to support Apache 2.0.39 with JRun 4.0/ColdFusion MX.

Posted by seancorfield at 07:22 AM | Comments (0) | cf

June 26, 2002


At the beginning of this blog I recommended folks check out the new ColdFusion MX debugging machinery, especially with the dockable.cfm debugging template. Nolan Erck just noted on BACFUG that the classic debugging mode now outputs scoped variables on a single line instead of one per line like CF4.5. This is easy enough to fix: edit {CFMX}/wwwroot/WEB-INF/debug/classic.cfm and starting around line 535, add in <br> tags in each <cfloop...> just before the <cfcatch...> tag. Probably a good idea to make a backup of the file first tho'...

Posted by seancorfield at 05:45 PM | Comments (0) | cf

To #Pound# or not to pound?

The BACFUG mailing list has seen an interesting dialog over the last few days about certain stylistic issues (which, in fact, led to my posting our coding guidelines - see my 6.25.2002 posting) and, in particular, asking questions about when you should enclose a variable name with pound signs to force evaluation. Charles Arehart took the time to read our fine new manuals and posted a link to this very helpful page: ColdFusion MX LiveDocs : Using pound signs.

Although that is part of the ColdFusion MX documentation, similar information can also be found in the ColdFusion 5 documentation: ColdFusion 5 LiveDocs : Pound signs.

Posted by seancorfield at 10:30 AM | Comments (0) | cf

ColdFusion Studio or Dreamweaver MX?

Your choice of IDE is a very personal thing. I've used a variety of them over the years, some through company policy, some through choice, some through lack of choice. At my previous company I went from vi to HomeSite but couldn't quite make the jump to Dreamweaver (version 2 as it was back then). When I joined Macromedia, pre-Allaire-merger, company policy effectively switched me to Dreamweaver 3 then to UltraDev 4.

As internal builds of Dreamweaver MX solidified I started to use that but, well, those early builds could be a little flaky... so I installed ColdFusion Studio 4.5. For some reason, I couldn't really get on with it - it just didn't 'feel' right to me. I upgraded to version 5 but Dreamweaver MX kept getting better and better so quietly uninstalled ColdFusion Studio and never looked back.

For a lot of ColdFusion developers, ColdFusion Studio is their natural tool of choice and they make quite a few skeptical comments about Dreamweaver MX. Read Tom Muck's article Three Reasons to Migrate from ColdFusion Studio/HomeSite to Dreamweaver MX and decide for yourself. If you're a HomeSite user thinking about moving up, you might also want to read Jennifer Rowe's tutorial Migrating from Macromedia HomeSite to Macromedia Dreamweaver MX.

Posted by seancorfield at 09:50 AM | Comments (0) | cf

June 25, 2002

Coding Standards (continued)

Last night I got permission to publish a (slightly modified) version of the Macromedia Web Technology Group ColdFusion MX Coding Guidelines. It refers to our Accessibility Guidelines which I've also published. These documents are provided as-is for the community - feel free to use them, change them, provide feedback...
Posted by seancorfield at 12:05 PM | Comments (0) | TrackBack | cf | programming

public/private (continued)

A brief follow-up to my 6.18.2002 post on the unnamed scope inside components: if you say variables.x inside a component, it will refer to x in the caller's page scope (i.e., the caller's variables.x). This is a known bug - it was intended that variables.x should refer to a private data member of the instance, just like the unnamed scope does. Do not rely on variables.x pulling x from the caller's scope as this bug will be fixed in a future release!

Posted by seancorfield at 07:26 AM | Comments (0) | cf

June 24, 2002

Coding Standards (continued)

A few days ago I bemoaned the lack of public domain ColdFusion Coding Standards. Michael Smith of the Maryland CFUG pointed me at this collection of links to ColdFusion coding guidelines. I haven't checked the links out yet - I'll save that for bedtime reading in my copious free time and follow up with some thoughts on the material linked to.

Posted by seancorfield at 02:12 PM | Comments (0) | TrackBack | cf | programming

Buying Documentation

The question recently came up: where do I go to buy the ColdFusion MX documentation set? The answer is that you can buy the documentation for $50 from our online store - here's a link that takes you straight to the Macromedia Worldwide Online Store - Documentation Set - ColdFusion MX page.

Posted by seancorfield at 08:13 AM | Comments (0) | cf

June 22, 2002

Coding Standards

These are a Good Thing(tm) so why doesn't the ColdFusion community have anything published on this? Take a look at the what the comp.lang.c++ FAQ says about coding standards - and, in particular, the list of links to the public domain (and extremely good) Ellemtel Rules & Recommendations. Unfortunately, quite a few of the links given lead to the dreaded 404... a hazard of history on the web: 'link decay'.

I'd love to see the ColdFusion community develop and publish some basic coding guidelines. My team at Macromedia has some pretty extensive coding guidelines but in their current form they contain quite a bit of Macromedia-specific information...

Posted by seancorfield at 08:39 AM | Comments (0) | TrackBack | cf | programming

June 19, 2002

More on "this"

People are asking where we've documented all this good stuff! I posted a link to documentation about the new var keywood earlier today. Here's some corrections to the documentation that clarify this scope: Macromedia: ColdFusion MX: Documentation Updates Chapter 3: Using ColdFusion Variables > About scopes. Hope that helps.

Posted by seancorfield at 10:52 AM | Comments (0) | cf

Local Variables

Another question that came up recently concerned how to declare variables inside functions that are not treated as private instance data (see public/private on 6.18.2002). As I indicated in that entry, cfset can use the new var keyword to declare a local variable. See Macromedia: ColdFusion MX: Documentation Additions for more details.

For more on this subject, see 7.4.2002.

Posted by seancorfield at 10:49 AM | Comments (0) | cf

June 18, 2002


There seems to be quite a bit of confusion about how to manage public and private data members in components. In Java and C++, you explicitly declare your data members as public or private and all data is part of the this scope, with only data members declared public being accessible outside the class instance.

Things are a little different in ColdFusion. Whilst functions can be declared as public or private (or package or remote) via the access= attribute on the cffunction tag, ColdFusion doesn't really have the notion of explicit data members. What happens is that anything you store in the this scope is treated as public data and can be accessed outside the component instance, e.g., <cfset this.publicVar = "anyone can see me"/>. Inside the component instance, you can simply assign to an unqualified variable and it is treated like private data, e.g., <cfset privateVar = "hidden"/>. You can use the var qualifier to create genuinely local variables for functions, e.g., <cfset var localVar = 42/>.

Posted by seancorfield at 02:51 PM | Comments (0) | cf


One question that has cropped up a few times recently concerns the scope of tags imported by cfimport. People want to have some sort of 'global' imported namespace, e.g., by putting cfimport into Application.cfm. You can't do that: a namespace applies only to the physical page you are on - an import inside an included file does not affect the file that includes it, nor does an import on a page affect any files included into it. I think this is a good thing - otherwise cfimport could hijack tags in unexpected ways.

There's also a good technical reason why cfimport only affects the physical page in which it appears: the CFML parser needs to know whether <tagname> is an imported tag (with an empty prefix) or a native, probably HTML, tag. It should be fairly obvious that <tagname> some content </tagname> is handled very differently when tagname is an imported ColdFusion tag as opposed to just being a tag that the ColdFusion parser can 'ignore' and pass straight through to the client.

Posted by seancorfield at 12:00 PM | Comments (0) | cf

June 15, 2002


Often considered an 'evil' function, this has been discussed quite a bit recently on the <cfguru/> list. The first part of the thread talked about what sort of expressions are valid between #...# - you can put fairly arbitrary CF script expressions in there (unlike in CF4) but you cannot put an assignment there: #a = b + c# is an invalid expression according to CFMX, as was the case in CF5. Also like CF5 you can put an assignment statement in an evaluate() call: evaluate("a = b + c") works and returns the value of a after the assignment.

I've seen some pretty complex examples using evaluate() so I can understand why a lot of people recommend avoiding it. It's a powerful feature and, like most powerful features in a programming language, care should be exercised with it.

Posted by seancorfield at 10:21 AM | Comments (0) | cf

June 13, 2002

metadata revisited

A few people have commented that it seems strange to require an instance of a component in order to get its metadata. After all, they argue, isn't the metadata independent of any instance? Well, yes and no. Yes, strictly speaking, the metadata belongs more to the .cfc file than to any particular instance. However, ColdFusion is very much instance-based: there are no static methods or data members in components and there is no 'type' that represents the metadata itself - it's just a struct - unlike Java where you have Class within the language itself.

But ColdFusion MX is built on top of Java and inventive souls have found a way to reach into the Java layer and obtain a component's metadata without creating an instance:

<cfset instance = createObject("component","lib.mycomponent")/>
<cfset metadata1 = getMetadata(instance)/>
<cfset proxy = createObject("java", "coldfusion.runtime.TemplateProxy")/>
<cfset metadata2 = proxy.getMetadata("lib.mycomponent", getPageContext())/>

Thanx to Matt Liotta for that gem. Caveat programmer: you should not rely on the coldfusion.runtime classes too much - they are an internal mechanism and therefore not documented or supported for external use. It's still a neat trick.

Posted by seancorfield at 04:14 PM | Comments (0) | cf

June 11, 2002


In Java, you can invoke getClass() on any object to get hold of a Class object that represents the type of the object. This let's you introspect the type. ColdFusion's getMetadata() function let's you do something very similar (see 6.10.2002 entry below). However, now that ColdFusion runs on top of J2EE, you can also call getClass() on some ColdFusion objects. You can't call it on a component instance (because ColdFusion spots the attempted method call and performs a lookup within the component) but you can call it on other objects:
  <cfset a = arrayNew(1) />
  <cfset am = getMetadata( a ) />
  a.getClass().getName() = #a.getClass().getName()#<br>
  a.toString() = "#a.toString()#"<br>
  am.getClass().getName() = #am.getClass().getName()#<br>
  am.toString() = "#am.toString()#"<br>
  <cfset s = structNew() />
  <cfset sm = getMetadata( s ) />
  s.getClass().getName() = #s.getClass().getName()#<br>
  s.toString() = "#s.toString()#"<br>
  sm.getClass().getName() = #sm.getClass().getName()#<br>
  sm.toString() = "#sm.toString()#"<br>
This produces the following output:
a.getClass().getName() = coldfusion.runtime.Array
a.toString() = "[]"
am.getClass().getName() = java.lang.Class
am.toString() = "class coldfusion.runtime.Array"
s.getClass().getName() = coldfusion.runtime.Struct
s.toString() = "{}"
sm.getClass().getName() = java.lang.Class
sm.toString() = "class coldfusion.runtime.Struct"
However, the following produces an error ("The method 'getClass' could not be found in component"):
  <cfset x = createObject("component","lib.component") />
Is this useful? Maybe. It's more an artifact of how ColdFusion MX is implemented than a deliberate feature.

Posted by seancorfield at 11:23 AM | Comments (0) | TrackBack | cf

June 10, 2002


it's a very useful part of the new ColdFusion Components machinery. Calling getMetadata(this) inside a component method returns a struct that provides information about the component, its properties, its functions and their arguments. It contains all of the 'standard' tag attributes such as name=, returntype= and so on. It also contains any additional arbitrary attributes you supply such as <cfcomponent foo="bar"> - as follows:

  <cfset meta = getMetadata(this)>

This will produce bar as output - the new foo attribute is added to the metadata of the component.

If you cfdump the metadata, you'll see all the interesting stuff. But you can't just duplicate() the metadata unfortunately. It looks like a native ColdFusion data structure but some of the elements are actually Java objects. Most manipulations of them will work, such as accessing structure contents, but duplicate() cannot currently handle such objects.

Posted by seancorfield at 03:08 PM | Comments (0) | cf

June 02, 2002

Another BACFUG-related discussion (from the

Another BACFUG-related discussion (from the listserv) has been around QA and testing frameworks. Macromedia's ColdFusion team created a simple set of custom tags to make it easier to write automated tests. My team (Web Technology Group, building the next generation Macromedia web site with our MX products) uses these tags heavily to create automated test suites for all our components and tags.

I got permission from the CF QA folks to distribute them - as unsupported code - download them here. They may turn up in the Developers' Exchange at some point.

Posted by seancorfield at 11:28 AM | Comments (0) | cf

At BACFUG (Bay Area ColdFusion

At BACFUG (Bay Area ColdFusion User Group) on Thursday (5/30/2002), Nathan Dinterfass presented "What's New in CFMX?" (download and unzip it into your CFMX docroot). He did a really thorough job (which meant a very lengthy presentation) and I learned a few things about the differences between CF5 and CFMX. It was almost exactly a year since BACFUG presented "What's New in CF5?".

Afterwards, someone asked about MX tags in ColdFusion Studio - you can get the tag updaters from Macromedia's web site.

Posted by seancorfield at 11:24 AM | Comments (0) | cf