Tag Archives: ColdFusion

In Part 1 of this series, I showed how to setup your project on Railo so that you could publish your CFML to Microsoft Azure Websites. You should have your project in a state that you want published on the web.

For this part, you will need to have an Azure account. You can sign up for one at http://azure.microsoft.com. Remember, BizSpark and certain MSDN members get free credits on Microsoft Azure.

Login to the Microsoft Azure “Management Portal”

At the time of writing, there are two versions of the portal — the Classic and New. I’m going to show the Classic portal as it seems to be changing the least at the moment — but I’m sure the New portal will eventually replace it.

Create a new “Custom” Website

After you’ve logged into the Management Portal, click on the “+ New” button on the bottom of the site.

Chose “Compute” -> “Website” -> “Custom Create”

Chose a URL for the site, Web Hosting Plan, and if you want a database. Don’t chose the “Publish from Source Control” at this point — we will set this up later.

It will launch the new site. This will take a few minutes. Once you see “running” on the dashboard, click on it to modify the settings of the site.

Click on Configure to configure the site.

Enable Java by setting a version. This will disable PHP, Python and .NET processing.

Make sure to select Tomcat as your container.

Your choice on 64 or 32 bit. Railo doesn’t care which is running.

Web Sockets will allow for outgoing connections from Railo to outside servers (such as HTTP calls). If you don’t do this, keep it off.

Always On will keep the site “warm” if it is not in active use. If this is off, Azure will unload it from memory if there is not traffic to the site within a half-hour.

Scroll down to Default Documents. Add index.cfm. You are free to remove the other options if you wish.

Hit “Save” It will take about 5 minutes for Websites to update your site to use Java.

Upload your site to Azure (Using FTP)

Click back to the Dashboard of your site. Scroll down about half way through the page and find your FTP credentials.

Using your favorite FTP client, login to this FTP site.

Change to the /site/wwwroot/webapps/ROOT/ folder on the remote side. This is where your files will be served out of.

Delete the files that exist in the ROOT folder. Upload ALL the files that exist in the output of your exploded WAR directory (in my case, E:\Projects\SampleWebsite\out\artifacts\SampleWebsite_war_exploded\).

In some cases, you may need to restart the website. You can do this via the management portal and clicking on “STOP” on the bottom of the page. You can then click “START” to restart it.

The first load after you upload the files can take 30 seconds. Don’t be alarmed about this — subsequent loads should be much faster after Railo is loaded into memory.

Keep uploading subsequent changes to your code and play around with settings in Azure. For example, if you want a “custom domain”, you can change the site to a Standard plan instead of the free one. You can also configure IntelliJ to automatically upload changes via FTP when you deploy a site.

Upload your site to Azure (Using GIT)

Deploying via GIT is a pretty cool concept, but it does take a few additional steps to get working. First, we will need to create a new artifact in IntelliJ. This is so we can keep our GIT repository separate from our working one (if we are using GIT for source control).

Right-Click on the SampleWebsite Module in the Project view. Chose Open Module Settings (or you can press F4)

Click on the Artifacts tab.

Add a new Artifact “Web Application: Exploded” -> Empty

Give the new artifact an obvious name, like Azure Push.

Make a note of the output directory name. This will be the root of your new GIT repository

Under Output Layout, click the create directory button to add a new directory named “webapps”

Add another directory below that named “ROOT” (caps matter)

Under Available Artifacts on the right-column, drag “SampleWebsite war:exploded” to be under ROOT

Click Apply, then OK to get out of the Artifact setup.

Go back to the Azure Management Portal. Open your site, and go to the dashboard.

FTP into the site using the site using the instructions above. You don’t need to upload the files, but you DO need to remove all the files in ROOT in order to get a clean site started.

Go back to the site dashboard.

Click “Setup Deployment From Source Control”

Click on “From Local GIT Repository”

Load your GIT client (like git bash), and go to the output directory of the artifact we just created.

Follow the commands on the Azure site on how to commit your initial files to your local GIT repository. Don’t clone the existing site.

After you’ve committed your first file, and connected it to Azure GIT, do a git add * , and commit those files to your site.

Your Azure site may need to be restarted after your first commit. I’ve seen it both ways. If it still shows a generic Azure is running Java page, try restarting the site.

In order to refresh the site’s contents, follow the following steps :

In IntelliJ, Go to the Rebuild Menu -> Rebuild Artifacts -> Azure Push -> Build. This will refresh your site’s artifact. DO NOT CHOSE REBUILD OR CLEAN — these will remove the GIT database files and you will have to re-connect it to GIT.

In GIT, add *, then commit. This should update the site with the latest.

And that is it. A few notes, however :

You can’t deploy .WAR files onto Azure websites. It doesn’t work for some odd reason — and when it does (it happens sometimes), it breaks your site because of partial loads.

It seems that connections to Amazon S3 are blocked. You can’t use the s3:// commands.

If you use Microsoft’s Azure SQL Server, you can’t use any ORM (hibernate). Azure SQL Server requires some changes to the SQL Statements to allow for clustered indexes. You can use their “free” MySQL instance. Manual SQL statements via Stored Procs and CFQUERY work fine.

If you do things like update Railo or upload files locally on your machine, make sure that you update your local project or those files may not make it into your deployed project on Azure.

Hope this tutorial gets you in the right path! I’ve been deploying a few sites using this method with great success. (I’m using GIT to deploy my sites — it’s already in my toolchain and seems to work well).

I was lucky enough to have Microsoft give me some time on Azure through the BizSpark program. If you don’t know what BizSpark is, it is a program from Microsoft to give small businesses a headstart on the Microsoft stack, grattis for three years. That includes MSDN, some credits on Azure and more. Azure is a comparable solution to Amazon’s Web Services that I’ve been using for a few years. Azure’s Websites solution is similar to AWS Beanstalk where you upload your final project to their servers and they take care of the rest (OS, patches, firewalls, etc.)

As I’ve already written in previous blog posts, Railo is simply a Java application that can sit on top of a J2EE server such as Apache Tomcat. Railo is compatible with Adobe ColdFusion, and is 95% there for simply letting ACF code run. The only time you can expect to run into issues is with some of the integration tags like CFEXCHANGE, CFCHART or some of the Active Directory integrations. But on the flip-side, Railo requires no install, no purchase of a license, and (in my opinion) is easier to work with.

In this walk-through I’m going to use Railo 4.2.1 deployed as a WAR application onto Apache Tomcat running on Azure Websites and using IntelliJ IDEA 13.1 as my IDE. You should be able to easily substitute Eclipse or ColdFusion Builder for the IDE — I just don’t happen to use those anymore.

Setting up your environment:

Extract the Tomcat .ZIP file to a directory on your computer. Doesn’t really matter where — as long as you know where it is. This will be where your local, testing environment will run from.

Rename the Railo .WAR file to .ZIP. This will be the files you will start with.

Install IntelliJ, if you haven’t already.

Add your Tomcat setup to IntelliJ.

Go into the IntelliJ Settings by clicking on Configure -> Settings from the Quick Start menu, and search for Application Servers under IDE Settings.

Click the green [+] and then select Tomcat Server.

Provide the Tomcat Home directory. This is the directory where you extracted Tomcat to.

Hit OK, then Apply to commit this new application server to IntelliJ

Add a new Java Project to IntelliJ

Go back to the Quick Start menu, and choose Create New Project

Select Java and then Select Web Application. You may need to add a new Project SDK by clicking on New… on the upper-left of the screen and letting IntelliJ know where your copy of Java is installed.

Don’t select to create the project from a template. Click Next.

Give the project a name and a location. Click Finish to create the project.

After IntelliJ creates the project, in the Project area, you should see a src folder, a web folder, a JSP file, and a WEB-INF folder.

Test your application setup with Tomcat.

From the “Run” drop down, select “Edit Configurations…” to add a new run configuration.

In the “Run/Debug Configuration” screen, click the [+], select Tomcat Server, then Local to add our run config.

Give the Run Config a name (like “Local Debugging”)

Click the “Fix” button near the error that states you don’t have an artifact marked for deployment. This will tell IntelliJ that we plan on deploying our project to our local test server when we click the Run button. The name of the base “artifact” is “SampleWebsite:war exploded”.

Change back to the Server tab. Change the option “On Frame Deactivation” to “Update Resources”. This means that when you make a change within IntelliJ and switch to your web browser to check that change it will happen automatically.

Click Apply then OK to close the window.

Run the Local Application Server and deploy our base application.

Click the green “Run” button next to the drop-down with the Run configuration we just created. You will see Tomcat spin up in the console messages on the bottom of the screen. Eventually you will see a browser launch with a blank page. This is actually displaying the contents of the index.jsp file in our project.

Copy Railo into our project.

Remember when we renamed Railo to be a ZIP file? Extract that ZIP file into our web folder within our project. You most likely have to do this outside the IDE. You will need to overwrite the WEB-INF folder (including the web.xml that is included within it).

Delete the index.jsp file within the web folder. You don’t need it anymore.

Within the web folder, create a new file named index.cfm. Add a <cfdump var=”#server#”>

Click on the green “Run” button next to the drop-down with the Run configuration we created earlier. You will get a dialog asking if you want to update the resources or restart the server. Chose “Restart the server” so that we can load Railo. This is the same option you would use if you ever need to restart CF (for example, to unload a CFC that is loaded into the session memory).

You will see Railo unpack and launch with the console window. After a few seconds, you should see your browser launch with the debug output. Congratulations, you are now running CF!

Create your application like you normally would.

Any files within the WEB folder of your project are essentially in the root of your web server.

Any files that change on your web server are NOT copied back to your project. This includes configuration changes (like databases) made within the Railo admin. To copy these files back, go to your project folder (in my case E:\Projects\SampleWebsite), then OUT\Artifacts\SampleWebsite_war_exploded\ and copy all the files back to your project. In my previous blog entries I mention which files you can copy back if you are simply looking to save the Railo config files.

Part 2 of this entry I will show how to get this posted on Microsoft Azure Websites.

This is the second part of a two part series on deploying your CFML applications to the cloud using Amazon Web Services’ Elastic Beanstalk. Read the first part here.

Updating your application

Since your app is running through your Elastic Beanstalk, making changes are not as easy as just FTPing a few files to the server. You will have to make the changes the “Java” way.

Make the changes, and preview them on your local Tomcat server. Drop the changed CFML templates into that WebContent directory, and hit refresh in your browser.

Once your changes are good on your local machine, right click on the project name, go to Run A -> On Server…

Choose your AWS instance from the list, and click Next.

Make sure your project is still selected to deploy and click Finish.

Wait. It will take up to 5 minutes to upload your changes to AWS. It will then take another 5 minutes or so to merge your changes with the original project and restart Tomcat. It will take some time, so grab a fresh drink. You may get an error message saying that your instance took too long to start — that’s ok. Give it a few minutes and refresh your browser to see the new version.

Setting up a Database

Amazon Web Services has the ability to host regular databases as well! You have two options:

Create a new database using Amazon RDS. This gives you much more flexibility and lets you choose between MySQL, Oracle, or Microsoft SQL. You get one year free for one DB instance. You can have as many tables and store as much data as you want. You can also tell it to do automatic backups and snapshots of your DB. This is slower for smaller queries (because it relies on TCP sockets across the network), but faster for more CPU intensive queries.

Create a DB within your Elastic Beanstalk instance. This adds no cost to your application, but limits your DB choices. It also means that if you re-create / re-upload your application, your DB will be reset. This is slightly faster for smaller queries, but slower for larger, more CPU intensive queries.

Head over to the Amazon Management Console. Login.

If you are going with option 1, do the following :

Head to the RDS section.

Launch a new instance. Choose your DB engine.

Set the Instance class (this is how much CPU you will have dedicated to the DB. t1.micro is the free one). Choose how much space you plan to use (allocation space), and set a DB name, username and password.

Go through the rest of the configuration settings and launch your DB. It will take about 5 minutes to it to fully launch. Once it is launched, it will give you the “endpoint”, which is the hostname of the DB. Write this down, you will need it later.

Head over to the “DB Security Groups” section. We need to allow our server to access this DB through the firewall.

You may want to add your own computer to the list as well so you can manage the DB over the internet — Add your IP address by using the CIDR connection type (it will tell your computer’s IP address so you can add it properly).

Your DB should be all setup. You can connect to it from your computer using your favorite admin tool — use the endpoint as the hostname, and the login/password/db name to connect to it.

If you are going with option 2, do the following :

Head over to the Elastic Beanstalk section.

Find your application, then the environment you launched.

Click Edit Configuration under the enviroment.

Go to the Database tab, and fill out the following form :

When you apply changes, it will create the DB and spin it up. This will take a few minutes. You will get the endpoint (hostname), the username and password when it is finished.

Head to the RDS section within the AWS Management Console.

Head over to the “DB Security Groups” section. We need to allow our server to access this DB through the firewall.

Click on Default.

Add your own computer to the list as well so you can manage the DB over the internet — Add your IP address by using the CIDR connection type (it will tell your computer’s IP address so you can add it properly).

Your DB should be all setup. You can connect to it from your computer using your favorite admin tool — use the endpoint as the hostname, and the login/password/db name to connect to it.

Go to the Railo or ACF administration interface, and add the DB.

Using the Administration Interface (Railo Specific)

Chances are, you want to be able to keep your configuration settings in sync between your local computer and the AWS instance. This is not hard, but it requires you copying some files around. In all honesty, this is the trickest thing about running Railo in the cloud…

Set a password. The first time you go to this page, it will ask you to set one.

Make your changes. For example, setup your databases, etc.

Click on the Web Administrator tab. At least set a password. This is the context-specific settings (you only have one context at this time, so you may want to set everything in the server admin).

When finished, click back on Server Administration. This will take you back to the dashboard. Keep this open in the background.

Back in ColdFusion Builder, create a set of new folders within the WebContent folder :

WebContent\WEB-INF\lib\railo-server\context\

WebContent\WEB-INF\railo\

Go back to the Server dashboard. Find the configuration file section. Find this file on your file system, and copy it into your new \WebContent\WEB-INF\lib\rail0-server\context\ directory.

Go back to the Web Administrator dashboard. Find the configuration file section. Find this file on your file system, and copy it into your new \WebContent\WEB-INF\railo\ directory.

Any time you want to push Railo configuration file changes into the cloud, you need to repeat this process.

Deploy these changes to your AWS instance by following the Updating your Application section. Your online AWS instance will be updated in a few minutes.

Licensing Considerations (Railo vs. Adobe ColdFusion)

One thing to consider when deploying your CFML application out to the cloud is licensing. In particular, if you are using Adobe ColdFusion there are some serious licensing implications. NOTE: I’m no lawyer — I only play one on TV. Consult your legal weasel team before trusting what I say here.

If you deploy Railo on the cloud, there is very little you have to worry about. By being licensed under the GNU Lesser license, you are free to do pretty much what you want with it. You can deploy, scale up, scale down, etc. without much worry. I promise. Oh, and the Railo team is pretty nice too ;)

If you plan on working with Adobe ColdFusion 9.x and below, know you are breaking license agreement by using AWS. They calculate your license by the number of CPUs that you are running on. There is no way to know that. At all. You could say that you are trying to be honest by having one license per instance — and I’m sure they would believe you, but you are “breaking the law.” I’ve tested this setup with ACF 8.x, ACF 9.x and ACF 10.x (all developer editions of the WAR deployment, of course!) and had it work fine. ACF 8.x is pretty slow on t1.micro, so be aware of that.

If you plan on working with Adobe ColdFusion 10.x, they do allow for ACF on the cloud. You can run either 1 CF Standard instance per license, or up to 10 CF Enterprise instances per license. More information is available on the blog post written on the subject by the CF team. Read the blog post carefully. What it boils down to is if you are running a standard license, you CANNOT use the auto-scaling features of Elastic Beanstalk. If you are running an enterprise license, you need to watch the number of licenses you are consuming at your max when scaling up, and the amount of CPU you plan on consuming.

Conclusion

I hope this tutorial helped you bring your apps to the cloud. As I said earlier, I’ve been deploying many of my customers using this method with great success. Please comment below if you have any questions or comments with the setup. Enjoy!

Deploying CFML, or ColdFusion applications in the “cloud” is a lot easier than you might think. I recently deployed my 5th customer on Amazon Web Services using their Elastic Beanstalk product and once you get the hang of what is going on, it is pretty easy.

For those of you who have never heard of Amazon’s Elastic Beanstalk, it is a “cloud” product for developers. Essentially, it allows you to take a bundle of source code and upload it to a brand new server. You don’t have to setup the OS, configure a web server, worry about permissions, do backups or patches. The Elastic Beanstalk will even scale your server for you if you get a lot of traffic in a short amount of time. Best of all, Amazon gives developers 1 year worth of this service for free (you still have to pay for bandwidth and storage, but in most cases that is less than a dollar each month). Since this is a hands-off approach you are limited as to what OS or runtime tweaks you can make…

What you will need in order to Deploy a ColdFusion app in the cloud:

An Amazon AWS account. You will need to tie a phone number and credit card to your account in order to sign up. You will get 1 year’s worth of service for free for one server.

A working copy of Eclipse. I used the version that is bundled with ColdFusion Builder 2, but you can use any fairly modern version.

A Modern CFML Server that can deploy as a WAR file. This includes Railo 3.2+, Adobe ColdFusion 8.x – 10.x (Enterprise edition only). I’ll dive into licensing concerns later. I’ve been using Railo 4.1.

Apache Tomcat. I recommend Apache Tomcat 7.x. You will want to grab the “Core .ZIP” file.

(Optional) Some sort of CFML editor. Again, I used CFB2. CFEclipse should work equally well.

Setting up your local environment:

Install Eclipse, if you don’t already have a working copy. Install your CFML editor (or if you use ColdFusion Builder, simply use the Eclipse that comes with it).

Make sure the following components are installed within Eclipse… If you don’t see them on the list when you choose the correct repository, then they are already installed. If you are using CFB, you will need to go to Help -> Install New Software -> and choose the Indigo Repository from the Work With… drop-down :

Under Web, XML, Java EE and OSGi Enterprise Development

Eclipse Java EE Developer Tools

JST Server Adapters

JST Server Adapters Extensions

JST Server UI

WST Server Adapters

If you installed any new components, restart Eclipse.

Install the Amazon Web Services Eclipse Toolkit

Go to the Help -> Install New Software… Menu

Click the Add… button next to the Work With drop-down. This will allow you to add a new repository

AWS SDK for Android (This will require the Android toolkit which we haven’t installed)

Click install, and let Eclipse download, verify and install all the required components for AWS. Make sure to restart Eclipse after you finish.

Open the AWS Management Perspective (Click the little plus sign next to the ColdFusion icon in the toolbar).

Click the down arrow on the right side of the AWS Explorer view. Choose AWS account, then Configure AWS accounts.

Setup your account credentials, and give an account name. These were provided to you during the initial setup, but there are also instructions on where to find it in the AWS management portal as well.

Click Apply and OK.

Take your copy of Tomcat you downloaded earlier, and unzip it somewhere where you can find it. C:\Tomcat\ works great, but it doesn’t really matter. You don’t need to install it, configure it or anything like that — the AWS toolkit will do this for you.

Setting up your new CFML project

Switch back to the CFML perspective in Eclipse.

In the Navigator, click on a blank area and choose New -> Project… (NOT ColdFusion Project!)

src — If you plan on adding any additional Java source-code, this is where you will do it. Otherwise, nothing to see here.

WebContent — this is your WebRoot. It comes pre-loaded with a .JSP file, a styles folder, images folder and a WEB-INF folder. Delete everything in this folder EXCEPT the WEB-INF.

Download your CFML engine as a WAR file. I recommend Railo, which has a .WAR file you can grab right from their website : http://www.getrailo.org/index.cfm/download/. If you are using Adobe ColdFusion, you will need to grab and generate your .WAR file manually.

Rename the .WAR file to .ZIP. Open this ZIP file with your favorite unarchiver.

Copy the contents of this ZIP file and place it in the WebContent folder. If using the downloaded version of Railo, you will end up with some sample .CFML files and a WEB-INF directory. Don’t touch anything in the WEB-INF or META-INF directories, but the rest of the files can be deleted. Make sure to overwrite the web.xml file.

You now have everything in place to start coding.

Testing and debugging your CFML application

You will most likely want to test your application before you deploy to Amazon. That is why we unzipped TomCat earlier!

Right click on your project in the Project Explorer, go to Run As -> Run On Server…

Choose “Manually define a new server”

Choose Apache -> Tomcat v7.0 Server, and choose localhost as the hostname. You will then want to choose “Configure Runtime Environments”

Add a new Tomcat environment, pointing to the Tomcat installation directory to where you unzipped Tomcat.

Chose Next to add your new project to the server (other known as a resource). Hit Finish. Tomcat and Railo should now start. You can watch it start by checking out the console view on the bottom of the screen.

Within about a minute or so, you should see a new tab open up with the “Welcome to Railo” or “Welcome to CF” screen. You server is now running. You can check it out at http://localhost:8080/<projectname&gt;.

As you place and save files in the WebContent directory, those files will be “published” to your local Tomcat server. It sometimes takes a few seconds for them to be published. You can always check the status by looking at the “Servers” view (this is a different Servers view that is just for CF server — this would be the Java one, which is usually hidden by default in CF Builder).

Do note, this environment should be exactly the same as what is published out to Amazon Web Services — except it will be deployed in the Default context — which means that you won’t have the project name in the url. You will have something like http://myproject.amazonwebservices.com/index.cfm instead of http://localhost:8080/myproject/index.cfm

Publishing to Amazon Web Services via Elastic Beanstalk

So, you’ve got your environment setup, your project humming long locally, and you are ready to bring it to the web…

Fill out the Elastic Beanstalk configuration form. You will need to choose a region to launch the app at, an application name (this is used so you can identify your application), and an environment name (this becomes the prefix to the domain name that will be assigned to your application). For this example, the domain assigned to the app was http://appDomainName.elasticbeanstalk.com. Most likely you will point your own DNS entry to this.

Click Next. This will allow you to choose which applications you want to deploy to the EC2 instance. You will only have one, so hit Finish.

Your application will be packaged as a WAR file, uploaded to S3, a new EC2 machine will be created, a firewall, load balancer and your app will be deployed. This can take up to 10 minutes the first time. If you get an error message stating the server took to long to launch, don’t worry… It will launch. It does take a while to start up the first time, trust me.

After the app has launched, you should see an Elastic Beanstalk configuration screen. This will allow you to tweak configuration settings, see the final URL, and much more. Check it out.

Modify the Start timeout setting under Timeouts to something large like 600 sec, so you don’t see any errors while deploying incremental updates.

Congratulations! Your CFML app is now on the web!

Check out Part 2 here. I covered updating your application, integrating it with a database, using the administration interface and a discussion about licensing concerns.

One of the coolest things about CFML is the fact that it was designed for rapid application development. Even more so, as the language (and server platform) evolved, it quickly turned into one of those tools that knew how to talk to just about everything. From FTP, to the Web, to SSH connection, to specialized JDNI connections, it is pretty darn simple to make ColdFusion the glue that holds disparate systems together.

Last month I was tasked with coming up with a tool to allow some of my PBX users to record announcements. The current system they were used to involved them calling a phone number, entering in a special code and then recording their announcements. It was easy because the phone already had a mic, speakers and everything else setup to the point where the user didn’t have to worry about all the related computer settings. I tried to re-create a solution that was just as easy using the Flash Player (and ever a Java applet) — but it turns out that very few people have microphones hooked up to their computers — and those who do have no idea how to tune it so that the sound levels are descent.

I came up with a nifty idea. I wrote a really quick CFML app to interact with Twilio (an online phone company that provides a really wicked API for dealing with live telephone calls). Essentially, they post back form requests to you, and you pass back XML documents back to them. They even have an API that can do recordings.

The only problem was the recordings they saved weren’t in a format that my PBX understood. While they provided me mono, 16-bit PCM, 16k wave files, I needed 64-bit, 8k mono uLaw wave files. To a normal computer, these look the same, but to these two different systems, they were radically different.

The solution? I found a really cool Java application known as JAVE. JAVE is a wrapper for ffmpeg, which is a very well known application that can work with audio and video files. JAVE allows me to convert from one type of wave file to another, or even from an mp3 to a wave, or from a Windows Media file to an MP4 file.

Using it? Like dealing with most Java classes, you drop it into your CFML’s LIB directory. I tried it both with Adobe ColdFusion and Railo and it worked flawlessly. Once you have the Java class (jave-1.0.2.jar) in the lib directory and re-start your CFML server, you are ready to start writing some code. Here is what I came up with to convert between my two wave formats :

That’s pretty much it. If you do a cfdump of the “jave.getAudioDecoders()”, “jave.getSupportedDecodingFormats()” you will get a good feeling of all the different file types you can convert between.

This is more of the type of magic we need to be talking about. Sure, converting between file formats can seem dull, but being able to come up with a solution to do it quickly is what makes a language, and a platform useful.

It’s been a long, hard year for anybody who is an Adobe fan. Especially so if you worked at all on any of Adobe’s “enterprise” products like Flex, ColdFusion, or LiveCycle. With the disaster that big red threw on us last November, we learned that Flex was killed (then spun on to Apache, which is actually ending up to be awesome), ColdFusion was moved to India, LiveCycle was made “government only”, and Adobe was left to pursue new markets instead of ones they had put energy into before (like HTML5 and Gaming). This post won’t be about Flex — I help with a monthly newsletter which can give you all the background on that project at the Spoon Foundation. The LiveCycle suite of products died because Adobe felt that anybody not associated with a Fortune 50 company could handle the power it offered.

Anyway, back to ColdFusion. This is the product I’ve been associated with for the longest (since 1997?), and arguably the one that has made me the most money out of any Adobe technology. Lets face the facts, ColdFusion, while not dead is in a downward spiral. Today is not the day when I see new ColdFusion projects being started, and I certainly don’t see new faces in the ColdFusion community. That’s a problem and a tall-tale sign that the platform is slipping into the “Dated” cycle of technology. That’s not a bad thing (unless you are looking for a job), it will just be different.

To my surprise, there was an online panel titled “CFML 2012: State of the Platform” this past week. In my searching of the web, I only found three references to it (two blog posts and a mailing list post). I’m not sure what the panel exactly talked about (I couldn’t find any reference to it being recorded), but Judith Dinowitz did a blog post about it after. I’m going to make some assumptions about the conversations based on the summaries since I didn’t attend live, but I do want to interject my 2 cents…

ColdFusion is past the point where it needs a “killer app”. PHP has a few of these (WordPress, Drupal, etc). Most people simply USE these applications — very few contribute to them. They are not the reason why they have so many developers. I have lots of customers who want WordPress on their domain — not because it is PHP. Consequently, they don’t care that it is written in PHP, they just want that App. Sure, now they have PHP on their site, but it does not really matter anymore — everybody has PHP available on their site. ColdFusion already has what I think is a killer app — Mura from Blue River. It’s the nicest thing that we got, and everybody who does anything with CF should give it a try.

Education is great, but it won’t save CFML. We have years and years of books, blogs, magazines, etc. at people’s disposal that want to learn CF (some of these may be out of print, but you can still find plenty). A site dedicated to learning CF in a week is cool, but it’s not the savior. What is the incentive for people to even look at CFML as a language. No jobs, no demand, nobody cool using it — everybody is just passing it up. If I were looking to pick up a new language, would I honestly pick CF? Nope. Would a website that shows somebody how to use it be beneficial to those who need to learn it for their job? Yup.

A stable platform from Adobe is what is mucking up the place. Look, I’ve been an Adobe/Macromedia/Allaire CF fan for years and years. CF10 was a huge disappointment. Not only was it super buggy out the gate, but when the biggest feature (auto-updates) fails to work a few months after the release, and the fix to it is even harder to find — you know you have a problem. In all honesty I’ve spent more time debugging weird issues in CF in the past 6 months than writing new features in my apps. Weird issues like if you accidently point an ORM relationship the wrong way you have to restart the ORM engine in order for it to work again, or if you call .NET library through and the library tries to return a pointer that CF stops processing requests, cause me and others headaches. The lack of attention to detail for the last 3 releases has been alarming and has caused weird bugs that then need to be reproduced for the end of time because many of the features were done by copy/paste coders rather than engineering the code from scratch. Who the hell would want to touch a platform if all they see is work-arounds instead of new features? Ask any system admin about installing CF and the laborious process that can be.

What would I do to change it if I had the community’s support?

Have the community switch their primary support to Railo. They care, and they fix bugs. It’s free*, and when you want their support, they actually support their product. Gert and their engineers care and they care about the community and the community’s future. Because the barrier to entry is lower for Railo (and don’t give me the BS that you can develop real applications in CF and then buy it later on. I’ll show you each application that I’ve written that needed to get around the three IP barrier just to do simple debugging), it will make it easier for people to try. The trick is getting people to know about it and actually try it.

Marketing. This is the big one. Right now, we have very few cheerleaders left. I don’t know very many Adobe employees that are really saying much about CF. The usual subjects like Forta, Ray Camden made very little noise about CF10 being released when compared to the previous versions. Heck, Adobe didn’t even do a road-show to the user groups and communities to tout the features of CF10 (they are planning one now — nearly 10 months after the release). In addition to the dismal marketing effort by Adobe, the other CFML engines have not had much luck with their marketing campaigns. It’s amazing how many active CFML developers I’ve talked to in the last year that never heard of Railo, let alone have used it. They are all scared to try it — it’s different — and it’s not Big Red. That is one thing that the remaining cheerleaders can do to help — help us get the word out of what is out there, how cool it is, and how ‘fun’ it is to use it.

More Marketing. Close your eyes for a moment and think of a “typical” Delphi or Pascal programmer. What kind of image pops in your head when I ask you to think of a COBOL programmer? I bet they have beards, work in cubicles, wear ties and probably are closer to retirement than college. Now think of a Ruby programmer or a Node.JS programmer. I bet you thought of a hipster working out of a Starbucks or some cool Silicon Valley office overlooking the hills. This is totally generalizes a whole swath of people (which I hate), but it makes a point. ColdFusion programmers are not seen as “cool.” ColdFusion is not seen as “Cool.” It is not what the cool kids use, and it’s not what the startups use. No idea how to fix this one. This has nothing to do with the feature set of the language, how it performs under load or how fast it is to create an application for it. In fact, it may be those things that CAUSE the “not cool” issue… I still see too many hipsters arguing about how to break JavaScript just so they can win the game of using less semicolons. It might also have something to do with us constantly arguing with each other about which framework is cooler when the rest of the world is looking to do cool stuff. Again, we are probably way past where we can fix this one. Just don’t make me shave my beard.

Make CFML easy to use. Not for us developers. Make it easy for server admins to use. There is nothing worse than trying to install CF9 onto Windows Server 2008 (CF9 came out /after/ 2008). Between getting the server to even run, and run well, you need to go into IIS hell to get it to answer pages properly. Install CF10 on RHEL with Apache? Hope you have all weekend. The truth of the matter is installing Adobe’s CF is torturous if it is not your passion. This is why we get so much resistance from IT people who don’t do development. Sure, there are blog posts and some tech support documents scattered all over the place on how to do it, but for many people (some of them become decision makers), this is their first experience with the engine. Railo is not free and clear in this one either — while what they offer is much better, it is still much harder than it needs to be (installing the connectors can be a real pain). This could be solved by making configurators and wizards to help with the processes. But the biggest thing is to make sure they work WELL. What would be even better would be to offer a quick and easy way for developers to package up their apps, all the settings and allow us to make our own installers. Adobe strictly prohibits this (they don’t OEM CF licenses), and the licenses from Railo seem to avoid the issue all together. An extension of this idea would be to make the CFML engine packageable so that we could make our own WAR files and be able to just drop them into Tomcat or WebSphere. You can /kinda/ do it today with a deep understanding of the engine and how Java works.

If you made it this far, well then you managed to make it through my mind-barf. Am I giving up on CF? I’ve pretty much given up on Adobe CF. Unless they turn that ship around, and quick, I don’t see spending thousands of dollars on the frustrations they call a product. Am I giving up on CFML? No, but I see my time being spent on many other languages and products. I’ve been getting better and better with Java, and ActionScript still has a lot of my attention. Do I see myself dropping everything and picking up the language de-jour some day? I have paying customers that expect me to get work done, so probably not.

I hope not to offend anybody — and please do leave your comments below. An open discussion is one I want to see and contribute to.

This year I had the distinct honor of being asked to present at Adobe’s MAX conference. The conference was an absolute blast. From the Keynotes to ALL the other sessions I attended, the thing went off without a hitch.

I gave two presentations this year — one for the 360|MAX Unconference and one for the Develop Track at MAX.

Getting Data From Here To There (with Flex)

This session was not recorded, but fairly well attended. You can see my slides here. In this session I talked about the different communications methods available to Flex developers, and I started to lay out a basic matrix of when to use what type of communication method, and what the pros and cons were of each type. Not all of my demos worked due to a broken J2EE server, but I think everybody got the idea. I don’t have great downloads for that presentation as most were specific to my server setups.

Getting Physical With Flash (Hardware Hacking)

This session was a blast to present. We had about 140 people in the room who seemed to be really into it. I presented on integrating the Arduino hardware prototyping kit into Flash/Flex in addition to showing how to integrate the Microsoft Kinect into Flash/Flex. I came armed with about 6 electronics projects that I showed people to inspire them to create their own.

If you have ever attended one of my presentations on BlazeDS, LiveCycle DS, or Flex/ColdFusion, you have heard me talk about how bad the data-connectivity wizards are in ALL of the IDEs available for the Flex SDK. Even the new Flash Builder 4.5 dosen’t address the white-hot mess they call the data connectivity wizards that they started including in 4.0 (Side note: I love most of the features in Flash Builder — I use it every day, but some of the wizards they included to make life easier really don’t).

Even including the services-config.xml document as a configuration option in your application will often lead you to troubles in the long-run. This is included for you when you tell Flash Builder that you want to use ColdFusion or Java as your server model. When you do this, the compiler inspects your services-config.xml configuration document on your server, and builds a table of the channels (endpoints) and destinations that are configured on the server. You can then call the destination by name in theortags and not have to worry about how your client actually connects back to the server…

… untill you need to move your application…

… or you need connect your AIR application to your server…

… or you have a mobile or television application that needs resources on your server…

In my last blog post I mentioned that there were various properties available when you create your own BlazeDS / LiveCycle DS destination at runtime. The properties available to you are based on which type of adapter you are using.

Each set of properties is baked into a ConfigMap instance that you pass to the initialize() method of the adapter. In my research, I’ve found that there are some adapters that fire up ok without any properties defined (these tend to be the open-source ones), and some which cause all sorts of issues unless you have certain magical properties defined (these tend to be the closed-source ones).

In addition to the regular properties, there are also “ServerSettings” and “NetworkProperties”, which are not covered here. By not setting those properties, your destination will assume the defaults.

So, what are the available properties that you can set? Below is a list of the service/adapter/properties:

include-methods (if defined, this is the list of methods that are allowed to be called)

exclude-methods (a list of methods that are blocked from being called. do not use with include-methods)

method

name

messaging-service (used for realtime messaging applications)

cfgateway (used to have ColdFusion mediate messages on the destination)

gatewayid (the dot-location to the cfc that will handle the message) ***

gatewayhost (used to define which host is hosting the cfcs, if it is not localhost — for example if your BlazeDS server is different from your CF server)

allowedIPs (which servers are allowed send data onto the destination back to the clients)

remote-username (bakes in this username into all the packets sent to CF)

remote-password (bakes in this password into all the packets sent to CF)

actionscript

(there are no properties for ActionScript. Send in an empty ConfigMap)

jms

jms (as ConfigMap)

destination-type

message-type

connection-factory

destination-jndi-name

delivery-mode

message-priority

preserve-jms-headers

acknowledge-mode

max-producers

There are also services for proxying and data-management, however I’ve never used them (well, I have used data-management a lot, but since the licensing changes to LCDS, it’s pretty much dead to me). I don’t know much about the jms adapter, so I can’t really say what all the properties mean, but I do know they are there.

I have marked some properties with a ***. If you see that, you need to include it, or you will get varied results in creating the destination at runtime (most likely, it will fail the first time you send data to it, rather when you create it).

Ok, lets dive right into a really geeky topic… destinations in BlazeDS and LiveCycle Data Services.

For one of my customers, I was given the requirement to create a runtime destination in BlazeDS. BlazeDS, along with its bigger brother LiveCycle allow you to create destinations in one of two ways — via the configuration XML files (services-config.xml, and related files), or via Java calls. I won’t talk about the XML file method because it is extremely well documented. However, the biggest disadvantage of the XML file method of creating destinations is that you usually have to reload or reboot your server in order for the changes to take affect.

Runtime Destinations are not permanent — they do not persist during restarts. They are also not magically added to the XML documents either. Their creation is also often blocked on shared hosting servers as well. But besides that, they act and smell just like ones created by the XML documents. Why would you want to use them? There are quite a few reasons for wanting them — for example to help secure your server by only exposing your destinations on demand, or by providing private destinations to clients so there is no way that data can be shared (in that case you COULD use subtopics, but that is controlled by the client). In my case I was asked to provide a solution where the client would not have to change any configuration files when they installed our application. We were using ColdFusion 9 as our back-end server, but these techniques work for Java based solutions too (you would just have to change the Syntax a bit).

I’ll start off by saying that the documentation is extremely poor (I wish Adobe would make this stuff clearer one day!), but with the help of two people, Sven Ramuschkat and Marko Simic, I was able to get to the point where reading the source code made sense.

The first step in creating the dynamic destination was getting the instance of the Message Broker. The Message Broker in BlazeDS/LCDS is the guy who does all the work for remoting, messaging, data services and proxying. You can access it in ColdFusion with the following commands