CFC 101: Presentation to CFUG Auckland

I made a presentation on CFCs to CFUG Auckland a few weeks back. Most of the CFUG users already had some experience with CFCs.

The presentation was fairly short. But the discussion was lively. A need was expressed to understand CFC best practices as applied to particular problems. There was also an element of sounding off experiences. And that made it quite interesting.

I’ve attached a copy of the presentation and the sample code used.

Fixing error: The XML-RPC service is not available

Late Friday evening, I was developing a small application on my laptop that looped over a list of webservice URLs and fired off a given function on each of the webservices to retrieve some information. The application worked beautifully and life was good!

But on Monday morning, I restarted the CFMX 7 Server, and found that I couldn’t log into to CF Administrator. I was getting the following error:

The XML-RPC service is not available.
This exception is usually caused by service startup failure. Please check your server configuration.

The error occurred in Application.cfm: line 82
-1 : Unable to display error’s location in a CFML template.

This is definitely not an error that you want to be staring at first thing on Monday morning. Here is how I fixed it.Mr Google brought up another blog that mentioned the same error. Apparantly a missing neo-xmlrpc.xml on a CFMX 7 server can cause this.

So, I opened \WEB-INF\cfusion\lib\ directory where the file should exist. And it was there. So it wasn’t missing in my case. But date modified value pointed that it had been changed on Friday.

Opened the file an XML editor. Noticed that it contained a WDDX packet containing links to the webservices I was accessing using my application. Interesting. So next, I tried to validate whether the XML doc was well formed or not. And it turned out that it wasn’t. CF Server had added characters into the XML that it didn’t like.

It contained nodes like:

<var name=’http://remotesite.co.nz<;char code=’0d’/>/folder/webservice.cfc?wsdl’>

Notice that there is an extraneous:

<char code=’0d’/>

This is what was breaking the xml. Interestingly, the character code ‘0d’ is equivalent to carriage return.

Once I removed all such references and the XML validated as well-formed, life was back to normal!

It would be interesting to figure out why the CFMX server inserted these characters in the first place. However, that is a mission for another day.

On with Monday now…

Lessons in customizing BlogCFC

After debating for a couple days and trying out Blogger.com and WordPress.com, I have finally decided to use BlogCFC from Raymond Camden. Thanks Ray.

Adam Lapsley @ Lapsley Media set me up with great CF hosting. Thanks Adam. If you are looking for expert ColdFusion development and hosting in further-down-from-down-under, i.e., in New Zealand, you might want to have a chat with Adam.

There were a couple of interesting things I had to do with BlogCFC to get it to go.

  • I wanted to use the styles from my earlier blog at Blogger.com. Customizing BlogCFC was fairly painless. Having said that, it did take a couple of hours.
  • I didn’t want to use index.cfm as the default document. I know I could have continued to use index.cfm, but default.cfm was what I wanted to use! To get this going, I had to do a search and replace on all instances of index.cfm with default.cfm. There a couple of places where the code was looking for the last nine characters (number of characters in index.cfm). I had to change itto look for 11 characters (for default.cfm).It would be interesting to see how long it will take to use a new version of BlogCFC as references to “index.cfm” as the default document are hard-coded at quite a few places.
  • I wanted to not use the search-engine safe (SES) urls. (I don’t know if that term continues to hold meaning as spidering engines now seem to be intelligent enough to follow query strings.) Changing that was as simple as deleting values in “alias” column in tblBlogCategories and tblBlogEntries.
  • I wanted to pass username and password in all the tags. Again, I had to do a search and replace to add these attributes to the tag.

All in all, it was fairly straightforward to customize BlogCFC to look as well as behave the way I wanted to! Nice 🙂

Now that I’m all setup, I can devote my energy to posting the sample Cairngorm contacts application on the blog. See my previous blog entry for more on this.

Completed Flex 2.0 Training Course

So, last week I completed the Flex 2.0 course for trainers. The course was held in Sydney, at the Adobe office in Chatswood. Spread over 5 days, the training comprised of two courses run consecutively. The first course, Flex 2: Developing Rich Client Applications, was spread over the first 3 days. The last two days covered Flex 2: Data and Communcations.

It was good to go over all the basics in the first 3 days. Even though most of the trainees of the course were fairly comfortable with a lot of the concepts in Flex, all felt that that it was good to put all the various concepts together. The labs at the end of the day were very well thought out and consolidated the concepts and learnings.I am a trainer for ColdFusion and ShadoCMS (a content management system written in ColdFusion). I often encounter a sense of wonder — the “oooh” feeling — that the trainees feel when they are able accomplish seemingly complex tasks with little effort. The second course, Flex 2: Data and Communications, had a lot of “oooh” moments for everyone, including me.

It covered areas like web services, remote objects (CFCs and Java), data validation and working with complex data (ArrayCollectiosn). A significant time was spent on more exciting areas like, Flex Data Services, Flex Message Service, Flex Data Management Service, and E4X. And all this generated a lot of ooohs. The ease with which one can architect apps with real-time chat and collaboration between different users is quite amazing. And so was the relative simplicity by which one can synchronize data between a Flex client and a web application’s data tier.

Robin Hilliard (of Rocketboots) was the instructor. And usual, he made the course very interesting by providing lots of real-life examples of concepts and his distinct sense of humor! Some of us were familiar with the basic concepts of Cairngorm 2. But we wanted to work on a simple Cairngorm 2 app. For those of you who don’t know, Robin is Cairngorm king down under. So he took out some extra time during lunch and evenings and we started building a simple contact manager using Cairngorm. (Rocketboots had built a simple contact manager in Flex 1.5.) Although there wasn’t enough time finish the app during the training, I’ve been working on it over the past few days and am almost through. I’ll post here in the next few days.

For me, the consolidation of all the Flex 2.0 concepts, the introduction to the data and communication capabilities flex, and working on a Cairngorm app made the training very useful.