Slides and Demo Code from Scotch on the Rocks 2013 (Caching)

I had a great time attending and presenting at Scotch on the Rocks 2013 in Edinburgh. For the past several years now, I've been talking about the importance of caching as part of an overall application architecture consideration. Although I've presented on the topic a dozen or so times now, each presentation I give is different from the last.

If you would like a copy of the slides, along with demo code that illustrates all of the points I covered during the talk, you can download it here:

Caching for Performance and Scalability in ColdFusion 10 (zip) - Scotch on the Rocks 2013

Any questions about the content, please leave a comment!

Adobe ColdFusion 10 Web Application Construction Kit Ships

The wait is over - you were waiting, weren't you? The much anticipated book, Adobe ColdFusion Web Application Construction Kit: ColdFusion 10 Enhancements and Improvements, is now available and shipping from Amazon. I had the pleasure of working on the book along with Ben Forta, Chandan Kumar, Charlie Arehart, Hemant Khandelwal, Kenneth Fricklas, and Ray Camden.

If you're looking for the difinitive guide on what's new in ColdFusion 10, this is the book for you.

Help Test the Next Version of ColdFusion

Interested in helping to test the next version of ColdFusion (code name: Splendor) and/or ColdFusion Builder (code name Thunder)? If so, Adobe wants to hear from you. To sign up to be considered for the pre-release programs, simply fill out the ColdFusion Splendor Pre-release Survey.

There's no official word on the exact start date of the pre-release program, but this post on the official Adobe CF Blog indicates "soon".

Slides and Demo Code from My ColdFusion 10 Developer Week 2012 Presentation on Caching

I had a great turnout for my ColdFusion 10 Developer Week 2012 presentation "Speed Your Websites using Caching in ColdFusion 10". It's always hard to take such a vast subject and distill it into a one hour presentation. I had a little more material to cover than I could comfortably fit into an hour, and things got a bit rushed toward the end. Overall I think the presentation went well, and I hope everyone who turned up for it learned something new. As promised, I'm attaching my slides and all of the demo code I used in the presentation. The presentation recording should be posted by Adobe shortly. As soon as I have the link, I'll blog it as well.

As always, if you have questions about Caching in ColdFusion, hit me up via email or twitter (see my Contact page).

Speed Your Websites using Caching in ColdFusion 10 (zip)

Slides from my cf.Objective 2012 Talk: Ten Steps to Move your Use of Caching Beyond the Basics

Thanks to everyone who came out to hear my presentation on Ten Steps to Move your Use of Caching Beyond the Basics at cf.Objective 2012. As promised, here are the slides, demo code, and ehcache.xml config file from the session.

Ten Steps to Move your Use of Caching Beyond the Basics (zip)

Slides from my cf.Objective 2012 Presentation: Maintaining Healthy ColdFusion Servers

Below you'll find a link to the slides from my cf.Objective 2012 presentation on Maintaining Healthy ColdFusion Servers. Thanks to all those who came out to see the talk!

Maintaining Healthy ColdFusion Servers (zip)

Fixing 404 Errors When Trying to Implement REST in ColdFusion 10 with Apache

If you're working with ColdFusion 10's new REST implementation and experiencing 404 errors with Apache when trying to call your services, chances are your server is misconfigured. See this blog post for a complete step-by-step on how to configure multiple instances of ColdFusion 10 with Apache virtual hosts. It's relevant even if you only have a single instance of ColdFusion 10.

To the specific problem at hand, is how ColdFusion 10 and Tomcat handle mappings between services such as REST and ColdFusion (Tomcat) instances. There's a properties file called uriworkermap.properties that handles this:

view plain print about
1/cfformgateway/* = cfusion
2/CFFormGateway/* = cfusion
3/flex2gateway/* = cfusion
4/flex2gateway = cfusion
5/cffileservlet/* = cfusion
6/CFFileServlet/* = cfusion
7/cfform-internal/* = cfusion
8/flashservices/gateway/* = cfusion
9/flex-internal/* = cfusion
10/rest/* = cfusion
11/*.cfml/* = cfusion
12/*.mxml = cfusion
13/*.as = cfusion
14/*.cfm = cfusion
15/*.cfm/* = cfusion
16/*.swc = cfusion
17/*.cfml = cfusion
18/*.cfc = cfusion
19/*.cfc/* = cfusion
20/*.cfr = cfusion
21/*.cfswf = cfusion
22/*.sws = cfusion
23/*.jsp = cfusion
24/*.hbmxml = cfusion

What you can see here is all the mappings between the various ColdFusion services and the default cfusion instance. The crux of the issue is that you must explicitly declare the uriworkermap.properties file in each Apache virtual host, including the default via a directive called JkMountFile. It looks like this:

view plain print about
1JkMountFile "C:\ColdFusion10\config\wsconfig\1\uriworkermap.properties"

Here's an example of what that looks like for the default virtual host in Apache:

view plain print about
1# Load mod_jk module
2LoadModule jk_module "C:\ColdFusion10\config\wsconfig\1\mod_jk.so"
3# Where to find workers.properties
4JkWorkersFile "C:\ColdFusion10\config\wsconfig\1\workers.properties"
5# Where to put jk logs
6JkLogFile "C:\ColdFusion10\config\wsconfig\1\mod_jk.log"
7# Where to put jk shared memory
8JkShmFile "C:\ColdFusion10\config\wsconfig\1\jk_shm"
9# Set the jk log level [debug/error/info]
10JkLogLevel info
11# Select the timestamp log format
12JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
13
14AddHandler jakarta-servlet .cfm .cfml .cfc .cfr .cfswf
15
16<Files ~ ".hbmxml$">
17Order allow,deny
18Deny from all
19</Files>
20
21<VirtualHost *:80>
22ServerName localhost
23DocumentRoot C:/_web/cf10/cfusion/localhost/wwwroot
24ErrorLog c:/_web/logs/cfusion-localhost.log
25
26JkMountFile "C:\ColdFusion10\config\wsconfig\1\uriworkermap.properties"
27
28<Directory "C:/_web/cf10/cfusion/localhost/wwwroot">
29 Options Indexes FollowSymLinks
30 AllowOverride None
31 Order allow,deny
32 Allow from all
33</Directory>
34
35 Alias /CFIDE "C:\ColdFusion10\cfusion\wwwroot\CFIDE"
36
37 <Directory "C:\ColdFusion10\cfusion\wwwroot\CFIDE">
38 Options Indexes FollowSymLinks
39 AllowOverride None
40 Order allow,deny
41 Allow from all
42 </Directory>
43</VirtualHost>

Note that this is done in the mod_jk.conf file by default. This is the file that CF 10 creates and includes via your httpd.conf file by default. You don't have to use mod_jk.conf if you don't want to, but you must make sure that the various mod_jk directives are called and that JkMountFile is specified for each virtual host you setup.

Ensuring a JkMountFile directive for each virtual host should resolve the majority of your 404 errors when configuring ColdFusion 10 rest services with Apache.

Installing ColdFusion 10 with Apache on Windows

Here's a quick visual walk through for installing ColdFusion 10 in Server Configuration with Apache as the web server on Windows.

Launch the installer, click next.

Accept the license terms, then click next.

Enter your serial number, choose the 30-Day Trial or Developer Edition. Click next.

Choose Server configuration. If you've installed other versions of ColdFusion in the past, you'll notice that there's no longer a Multi-Server option. This is because ColdFusion 10 has standardized the install/directory structure. The Server configuration creates a single, stand-alone instance of ColdFusion with Tomcat embedded as the JEE server. From there, you can create and configure additional instances of ColdFusion from withing the ColdFusion Administrator. To proceed, click Next.

Select the services you want installed and click next.

Enter a username and password for the remote server administration account. Click next.

A new feature in ColdFusion 10 will check the strength of the password you entered and make recommendations if it's found to be weak. Click yes if you want to modify the password you entered. If you want to ignore the warning and proceed, click No.

If you are installing ColdFusion 10 alongside a previous version, you may get a screen telling you that a previous version of the .Net service has been detected. Click next.

Select the directory where you want ColdFusion to install and click next.

It's now time to configure Apache as our web server. Click Add.

Select Apache as the web server.

Find the location of your Apache /conf directory:

Find the location of your Apache httpd.exe file:

Make sure everything is correct and click OK.

You should now have the configuration setup for Apache. Click next.

Enter a password to restrict access to the ColdFusion Administrator. Click next.

The password strength dialog may appear again. Click Yes to change your password or No to accept the one you just entered.

Choose whether or not you want to enable RDS. If you do enable it, provide a password. Click next when you are done.

You may get the password strength dialog again. Click Yes to change your password or No to accept the one you just entered.

If you want ColdFusion to automatically check for updates, check this box. This is a new feature in ColdFusion 10 and I highly recommend it. The check only occurs when you log into the ColdFusion Administrator. When you are done, click Next to proceed.

Review the information for the install. Click Install when you're ready to go.

The installer will now move through a series of screens highlighting features as the program installs.

You'll be greeted with a success message when the installer has completed. Click on the Done button to launch the ColdFusion Administrator and complete the install process.

You should now see the Configuration and Settings Migration Wizard in your browser. This step will completely your server configuration and migrate settings from any previous versions of ColdFusion the wizard detects. You'll need to enter the password you provided for the ColdFusion Administrator. Once you're ready, click Login.

You'll see a screen letting you know configuration is proceeding. The process can take several minutes.

When the process is complete, you can click Ok to launch the ColdFusion Administrator.

Congratulations, you've successfully installed ColdFusion 10 with Apache as your web server.

To see what changes ColdFusion 10 made to your Apache configuration, open your Apache http.conf file. You should see the following at the bottom of the file:

view plain print about
1# Load mod_jk module
2Include "C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf\mod_jk.conf"

This directive tells Apache to load up the ColdFusion Tomcat/Apache connector configuration from an external file called mod_jk.conf. Go ahead and take a look at that file (I've added spacing to make it easier to read):

view plain print about
1# Load mod_jk module
2LoadModule jk_module "C:\ColdFusion10\config\wsconfig\1\mod_jk.so"
3
4# Where to find workers.properties
5JkWorkersFile "C:\ColdFusion10\config\wsconfig\1\workers.properties"
6
7JkMountFile "C:\ColdFusion10\config\wsconfig\1\uriworkermap.properties"
8
9# Where to put jk logs
10JkLogFile "C:\ColdFusion10\config\wsconfig\1\mod_jk.log"
11
12# Where to put jk shared memory
13JkShmFile "C:\ColdFusion10\config\wsconfig\1\jk_shm"
14
15# Set the jk log level [debug/error/info]
16JkLogLevel info
17
18# Select the timestamp log format
19JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
20
21AddHandler jakarta-servlet .cfm .cfml .cfc .cfr .cfswf
22
23Alias /CFIDE "C:\ColdFusion10\cfusion\wwwroot\CFIDE"
24
25<Directory "C:\ColdFusion10\cfusion\wwwroot\CFIDE">
26Options Indexes FollowSymLinks
27AllowOverride None
28Order allow,deny
29Allow from all
30</Directory>
31
32<Files ~ ".hbmxml$">
33Order allow,deny
34Deny from all
35</Files>

This file sets up various mapping and configuration options as well as maps the location for ColdFusion's /CFIDE directory. Note that it places /CFIDE inside of ColdFusion 10's default webroot. It's generally not a good idea to expose your /CFIDE directory to everyone. There are many ways to secure your /CFIDE directory. For specifics, see Pete Freitag's ColdFuion Lockdown Guide.

That's about it for the install. In my next post, I'll be showing how you can extend this installation to include multiple instances of ColdFusion, each with multiple Apache virtual hosts.

ColdFusion 10 Enters Public Beta

The title says it all. The much anticipated ColdFusion 10 (Zeus) has entered public beta and is available for download from Adobe Labs.

ColdFusion 10 represents a leap forward for ColdFusion with a nice combination of updated infrastructure and libraries as well as lots and lots of improvements to existing features. While they were at it the engineering team went ahead and added a slew of new features and language enhancements as well. Here's a small sampling of what's new:

  • Apache Tomcat replaces JRun - I was almost tempted to put a blink tag here.
  • Overhauled scheduler - Quartz scheduler under the hood. Lots and lots of new functionality.
  • Security - Adobe implemented the OWASP ESAPI library under the covers and it's now pervasive throughout ColdFusion.
  • AXIS2 upgrade - Much improved support for SOAP web services.
  • RESTful web services
  • HTML5 WebSockets
  • HTML5 Charting
  • ORM Search
  • Caching updates (updated ehcache, caching functions, query & login cache moved to ehcache).
  • Hotfix Updater - Keeping up with and installing hotfixes and updates has never been so easy.

This is just the tip of the iceberg. For a really nice overview of what's new from engineering team member Sagar Ganatra, check out his site.

How I got Started with ColdFusion

Steve Bryant started a meme encouraging those involved with ColdFusion to post their personal story of how they got involved with the language. Here's mine.

I first fell in love with computers during the summer of 1982. I was 10 years old and my parents signed me up for a summer program to teach kids Basic programming. I spent that summer learning to hack Basic on a terminal connected to a mainframe. The following year my elementary school got a dozen or so Apple IIe computers and I was hooked. From there I got my first home computer – a Commodore Vic 20 with 2.5 k of RAM. I still remember sitting in my room painstakingly typing in game code from the latest issue of Compute magazine. I'd often leave the computer running for days as I didn't have any way to save the programs at the time and retyping everything would take me hours. I'm pretty sure this is where my debugging skills were forged as I hunted through program code trying to find the typos I had made while transcribing from the magazines. It wasn't long before I scraped enough money together to buy a tape drive, allowing me to save my programs. As technology marched forward, so did I. My next home computer was a Commodore 64. I must have spent thousands of hours on that machine programming, playing games, and immersing myself in the world of computers.

When I got to high school, Apple was out and IBM was in. My high school didn't allow freshmen to take computer classes, so I had to wait until 10th grade for any more official instruction. That year I learned Pascal. In my junior year, my computers teach got me an after-school job with a local engineering firm. They were looking for someone to build and maintain some applications for them. I interviewed and got the job. I still remember my first day – sitting down at the leased 286 with an orange monochrome screen. My boss dropped off a big box of discs and manuals for something called Ashton Tate dBase IV. He then said he wanted me to build them a database for all of their pumps and related devices. After looking through the manuals the rest of the day, I stopped in to my boss's office to let him know that I thought I might be in over my head. "Nonsense", he told me. "Why don't you take a few weeks to read the manuals and play around with the software, and if you still feel the same way, then I'll understand and we can part ways with no hard feelings." Turns out dBase wasn't so hard to work with after all. That job lasted me the rest of my time in high school and provided a lot of great programming experience as I built and maintained several networked client-server applications for the company.

As much as I enjoyed computers, I still couldn't see making a living working with them. I had considered doing a degree in computer science, but everyone I knew who had gone that route hated it (granted most of my friends were only a year or two older than I was, so most of them were still working through the fundamental classes). I had this idea of writing snippets of large programs as part of a team of people with little satisfaction. I'm not sure exactly where I got this idea from, but it's something that I just wasn't interested in doing. Computers were always fun for me and I just couldn't bear the idea of taking all the passion out of something I loved by making it into a full-time job for the rest of my life. So instead of computer science, I forgot all about computers for a few years and pursued a double major in political science and sociology. I also enlisted in the Air National Guard as a means to pay my way through school.

Toward the end of my time at the University of Delaware (around 1993) I saw my first web page. I was instantly hooked. From there I started spending more and more time online and eventually started a small consulting company with two other guys I knew. Our main focus was web design and development for nonprofits. Looking back, we were way too early for the market we were primarily targeting. Most of the nonprofits we talked to were just learning about the web and had no idea how to really take advantage of it, let alone a budget to work with. Luckily we had a few small business clients that kept things going and allowed me to develop my skills. I was also working construction at the time to make ends meet.

By 1996 it was clear that the consulting company wasn't going anywhere. My two partners had full time jobs and families and the business just wasn't a high enough priority for them. My girlfriend at the time (now my wife), seeing that this was the case finally told me "you need to find a real job." I started looking in the newspaper the next day and found several promising leads for companies looking for someone to work on the web. After several interviews I happened on an ad for a small electronics company in West Chester, PA looking for a Webmaster to build and manage their corporate web site and intranet. I applied, had an interview, and was hired shortly after. This was early 1996.

I got to work immediately building out their website and intranet with a combination of static HTML and Perl for handling basic tasks like emailing form content. This worked well for a while, but it was only a matter of time before I was asked to add some dynamic content--the request was to "web enable" our corporate address book, which was stored in a Microsoft Access database. My first reaction was to develop the application in Perl. However, at the time, building an application like this in NT Perl (all of our web servers were NT based) wasn't feasible, so I began looking for other solutions.

I first tried a product called DB Web, from a company named Aspect Software that had just been acquired by Microsoft. After a bit of experimentation, I realized that DB Web wasn't what I was looking for. It was more of a tool for querying data from Microsoft Access databases (it wrote VB code on the back end) than a real application development platform. (As a side note, Microsoft stopped supporting DB Web shortly after I evaluated it and rereleased it as ASP (Active Server Pages) a few months later.)

Frustrated, I decided to look into another product I had been hearing about on a web development discussion list. The product was Allaire's ColdFusion (Cold Fusion at the time), a rapid application development platform for creating and deploying dynamic server-based web applications. Within hours of downloading the trial version of the software, I had created a proof-of-concept for the corporate address book application.

Fast forward 15 years and it's almost funny to imagine that I fell in love with a programming language that had just over 30 tags and functions in the 1.5 release. At the time, though, ColdFusion had enough power to handle any web programming task thrown my way. And as the tasks have become more complex, ColdFusion has kept pace. Although I no longer develop as part of my day-to-day responsibilities, I'm still heavily involved with ColdFusion and the ColdFusion community and I can honestly say that with each new release, ColdFusion contains features and functionality that seem to show up just as I find myself needing or wanting them.

Beyond what I think of ColdFusion as a technology, though, is what ColdFusion has provided me personally. Not only has it enabled me to earn a living, it's also been the catalyst for a lot of personal growth. Because of ColdFusion I have had the opportunity to write two books (on ColdFusion, of course), speak at countless user groups and conferences around the world, and literally meet hundreds of passionate, smart people who share my love of technology. Thanks ColdFusion!