You will be redirected in 30 seconds or close now.

ColdFusion Authors: Yakov Fain, Jeremy Geelan, Maureen O'Gara, Nancy Y. Nee, Tad Anderson

Related Topics: ColdFusion

ColdFusion: Article

ColdFusion Everywhere PART 1

Create applications that run on the Web, from CD, or on the desktop

Think about the last time you bought a car. Did you walk around the vehicle, look under the hood and sit in the driver's seat to get a feel for it? You probably took it for a test-drive before making the final decision. If you're a developer producing the next "killer app," it's only reasonable for your customers to want to test-drive your application as well. Have you ever wanted to demo your application but thought...

  • It's too difficult to put together a general-purpose demo.
  • Even if you did publish a "live" demo site, it would be open to wrong-headed visitors entering offensive data, corrupting the demo for others.
  • If you don't allow data entry, you limit the effectiveness of the demo.
  • You could allow users to download your application (in some protected time-limited format), but they would need to install it and all the prerequisite programs (CFML server, database server, application server, Web server). They would also have to configure the application, populate the database, etc., etc., etc. This could take hours (or days).
  • This is a daunting proposition even for the technically capable - who are likely not the people you want to see your demo. (If potential customers had to put together a Lexus before taking it for a test drive, they'd buy a BMW...)
Ideally, potential customers can experiment with your application at the time and place they choose, using their own data - with no unnecessary activities to deter or distract them, and no need to have access to the Internet.

What if you could deliver your application into the hands of customers in a package they could just double-click and run?

Well, you can! With readily available building blocks you can put together a self-contained package that holds your application and everything needed to run it on any platform you support. Your application appears as an icon on the desktop. You double-click and run...that's it! Nothing gets in the way!

In this article we'll show you a way to package and deploy your CF applications that is different from anything you've done before - making your application available as a single download (zip) file, or burning it onto a CD or DVD. If your application doesn't need to write files or update a database, it can be run directly from the CD. The objective is to enable you to run your CF application everywhere (the Web, a desktop, or CD) - we call the concept "CFEverywhere."

Examples of CFEverywhere Applications

CF has been used (almost) exclusively to develop applications for Web (and intranet) sites. With CFEverywhere, you are no longer limited to the Web dynamic. You can take advantage of the power of CF to write desktop applications.

Let's look at some examples of how you can use CFEverywhere today with current CF products.

A Downloadable Trial Application
This is the scenario discussed earlier - you have a Web application that you want to give to potential customers to "try before you buy." Here customers run your Web application with full read/write database and file capabilities on their desktops.

A Web Site On a CD
A company maintains a Web site containing a catalog of thousands of items in hundreds of categories. To promote their site the company makes CDs of the entire site, which it hands out to potential customers at an annual trade show.

The Web site exists as a database-driven series of CF templates. Without CFEverywhere, it takes days of tedious, painstaking (and expensive) effort to convert the site to thousands of interlinked static HTML pages that can be accessed from a CD. Some Web site capabilities, such as searching and sorting, are not possible in the static version. With CFEverywhere, the Web site (CF templates and database) is copied intact to the CD along with the other components necessary to run CFEverywhere.

The time and expense of the conversion to static pages is eliminated. The user experience is enhanced because the CFEverywhere version contains all of the searching and sorting capabilities that exist on the Web site - in fact, we have duplicated the actual Web site onto the CD.

A Combination Offline/Online Application
There is a class of applications that can be used in a combination of ways. Some sections of the application do not require access to the Internet and run quite happily on the desktop using local files and data. Other sections require connection to the Web site and synchronization with the corporate database.

Consider this scenario: a manager updates a local copy of employee appraisals while off on retreat at a mountain cabin (with no access to the Internet). Later, upon returning to the real world, the manager connects to the corporate Web site and applies all the local updates to the corporate database.

There are many corporate activities that could follow the same pattern of offline data entry batched for online data update/cutover: price changes, new product catalogs, inventory counts, etc.

For example, a mail-order company with a large seasonal catalog sends a promotional CD to potential customers. Customers browse the catalog at their convenience selecting items to order: gift cards, shipping addresses, wrapping paper, etc. This is done over several days or weeks. The program is run directly from the CD, but the information is saved in a file on the customer's hard disk. When customers are ready to order, they click a button and the application connects to the vendor's Web site, uploads the order, and displays any "specials" not in the catalog. Truly, customers shop at their convenience - not governed by whether the Internet is available (or performing poorly because of traffic congestion).

Portfolio Piece
The Web is ever-changing. You may have written Web sites or applications that have been taken in-house and/or have been extended by other developers. Or, your implementation of the site was so dazzling that the company was purchased by another and for whatever reason, you can't point to these Web sites as examples of your work.

With CFEverywhere, you can maintain an archive of all the CF sites and applications you have developed, and create a "portfolio" CD for potential customers.

CF Desktop (non-Web) Applications
Traditionally, CF has been used to develop Web applications. However, many developers use CF as a quick, powerful solution for doing some non Web-related tasks such as reformatting and populating a database, statistical/design analysis of a database; application prototyping, and ad hoc report generation.

With CFEverywhere, you can actually develop applications specifically for the desktop. Use your imagination. Once you realize that you don't (necessarily) need a Web site to take advantage of the power of CF, a world of possibilities opens:

  • A CF application can be a low-cost alternative to writing a desktop application in Java or C. This is especially true when the programming resources are limited and there is a large backlog of high(er) priority applications. A CF solution could be implemented to provide immediate results (and benefits) until a more rigorous solution can be implemented in the other language.
  • Or, maybe the requirement is for a one-time report or analysis that is due yesterday - where CF is the only way to get it done. While a browser implementation of a user interface may not be ideal for a desktop application, it is likely to be easier and less expensive to implement than a custom UI written by other means. Arguably, the browser UI will be more familiar (and comfortable) for most users than a custom UI.
  • You could write a control panel/monitor that displays the status of all components of the system.
  • You can write desktop applications that invoke Web-related facilities (e-mail, messaging, Web services) to provide desktop functions.
    - For example, the control panel/monitor application could use e-mail to send an SMS text message to a technician's cellphone, alerting him that the system needs attention.
    - Or, a desktop application could invoke a Web service to obtain stock prices to update your portfolio.
    - Or, send an e-mail to a CF desktop application that reboots the database server. Since the CF application runs on the desktop, it can (with authentication) have complete access to the OS facilities, file system, scripting languages, etc.
For example, you could write a CF application that watches a certain folder in a user's system. Whenever an image file is added to the folder, the CF application executes a shell script to invoke Photoshop to copy and resize the image into a database or photo album (or product catalog).

These are only a few ideas of how CFEverywhere can deliver applications - on the desktop! Certainly, these are quite different from "typical" CF Web applications! Hopefully, we've whet your appetite for CFEverywhere. In the next section we will begin to assemble the CFEverywhere system to deliver your application.

CFEverywhere Components

To achieve CFEverywhere, the following components are required: a J2EE server, a Web server, a database server, a CFML runtime and, of course, our application code. The J2EE server acts as a "container" for the runtime that executes the application code. Let's go through the process of choosing the appropriate components and performing their configuration. In this section, we will configure and install the Web/J2EE servers and the CFML runtime. (Note: This process is cross-platform and works for Windows and Mac OS X/Linux.) Figure 1 shows the CFEverywhere directory structure.

There are several J2EE servers available on the market today. Some are open source while others are commercial offerings. You may have heard of these J2EE server products: JBoss AS, BEA WebLogic, and Macromedia JRun. For our purposes we will use a server called Jetty from Mort Bay Consulting. Jetty was selected for the following reasons:

  • It's free
  • It includes a Web server
  • The license allows for commercial use and distribution
  • It's easy to install and configure
  • It has a small footprint and is embeddable
We also need to select a CFML runtime. In addition to Macromedia CFMX/J2EE, there is a product called BlueDragon 6.1/J2EE from New Atlanta. Of these products, only BlueDragon can be used with CFEverywhere due to licensing restrictions. New Atlanta has a very friendly OEM/partner program that allows for distribution of BlueDragon with your CF application. Contact them and they'll be happy to discuss the details of their program. Macromedia currently has no such program but we understand the next release of CFMX (code name Blackstone) may address this issue and make it suitable for a CFEverywhere application. We'll have to wait and see.

Before we proceed further, make sure your system has a Java runtime installed. At a command prompt (or terminal on Mac OS X) type:

java -version

You should see something like "java version 1.4.2_05." If you get an error, you don't have Java installed/configured on your system. Go to http://java.sun.com/downloads/index.html to download the Java runtime. Note that although the latest version of Java is 1.5 (a k a 5.0) most products are not yet supported for that version. Your best bet is to install a Java runtime version 1.4.x. Also, create a folder for the project and call it "CFEverywhere." For example:

  • D:\CFEverywhere (for Windows)
  • /Applications/CFEverywhere (for Mac OS X)
Download Jetty from the Jetty Web site, http://jetty.mortbay.org. The latest stable version is 5.1.0 so you should download jetty-5.1.0-all.zip, which includes demo files and other extras. Extract the zip file into your CFEverywhere folder. It will expand as jetty-5.1.0, but to save some typing at the command line, rename the folder server. Create a new folder underneath the CFEverywhere/server directory called wwwroot. This folder will serve as the Web root for our CFML application. To test your Jetty installation, open a command line and change to the server directory

cd d:\CFEverywhere\server

Then start the server

java -jar start.jar etc/demo.xml

This will start Jetty; you can test it by pointing your Web browser to http://localhost:8080/. You should see a version of the Jetty Web site. If you don"t, you may have a port conflict with port 8080. Check for any other servers listening on that port and shut them down.

By launching the Jetty demo, you noticed that Jetty is configured with XML files. We need to create a configuration file for our CFEverywhere application. Copy the demo.xml to a file called CFEverywhere.xml. Open the file in any text editor and change the root context to point to the /CFEverywhere/server/wwwroot folder. It should look like the following:

  <!-- Add root context web applications. -->
  <Call name="addWebApplication">
    <Arg><SystemProperty name="jetty.home" default="."/>/wwwroot</Arg>
    <Set name="defaultsDescriptor">org/mortbay/jetty/servlet/webdefault.xml</Set>

(The complete file can be downloaded from sys-con.com/coldfusion/sourcec.cfm). Let's create a couple of test pages. Create a simple index.html page that displays "Hello World" and put it in the wwwroot directory. Next, create a file CFEverywhere.cfm with this code:

<cfset message = "Hello World! -- CFEverywhere" />
<cfdump var=#cgi#>

Now launch Jetty with:

java -jar start.jar etc/CFEverywhere.xml

This time when you point your browser to http://localhost:8080/, you should see "Hello World." Great! We're able to serve up HTML files but we really want to run our CFML page. Enter BlueDragon...

Go to the New Atlanta Web site, www.newatlanta.com, and download the latest BlueDragon 6.1 for J2EE (BlueDragon_J2EE_61.zip). Extract the archive to a convenient location like your desktop but don't put it in the CFEverywhere folder. Copy the contents of the BlueDragon_webapp_61 folder to your CFEverywhere/server/wwwroot folder (just the contents, not the entire folder). I hope you didn't blink because you might have missed it. You just deployed BlueDragon/J2EE on Jetty! Now launch Jetty again like we did previously. Browse to http://localhost:8080/CFEverywhere.cfm and you should see "Hello World! -- CFEverywhere" as well as a dump of the CGI scope variables.

That's it! You've just completed your first CFEverywhere application. Try transferring the CFEverywhere files to another computer (even on a different platform) and see if you can get it to run. If the "Hello World! -- CFEverywhere" application doesn't inspire you, come back for the other articles in this series where we'll:

  • Show you how to deploy a typical CF application that includes a database
  • Make a clickable application that can run on Mac OS X and Windows
  • Burn it to CD-ROM

More Stories By Phil Cruz

Phil Cruz is a Macromedia Certified Advanced ColdFusion developer and has over 12 years of experience in the computing industry. He is responsible for www.mach-ii.info, a community site for the Mach-II framework. As a micro-ISV, he created Tracking Tools, an easy-to-use bug tracking application built with Mach-II (www.tracking-tools.com).

More Stories By Dick Applebaum

Dick Applebaum has been involved with computers (and their predecessors) since 1956, including 16 years with IBM. Dick and two partners opened the fifth retail computer store in Silicon Valley in 1978. Eleven years later, he sold the stores and didn?t touch a computer for seven years (when he discovered the Web). Since 1997, Dick has been developing applications using ColdFusion.

Comments (4) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.

Most Recent Comments
giuseppe 02/19/08 05:40:54 AM EST

I read your CFEverywhere part 1, 2 and 3:
very interesting ! ! !
Do you know something more about Macromedia license program for distribute CF Desktop applications?

Otoniel Rojas 02/07/05 10:54:53 AM EST

This is great!!! It works perfectly. I am eagerly waiting for the rest!!.

Eli Sanders 02/02/05 12:09:23 PM EST

Great Article... can't wait for next edition... everything worked just as they said...

pim 01/27/05 03:55:41 AM EST

Amazing, I am verrry impatient to read part 2, I have followed every step of the tutorial, it worked perfect in a few minuts.
Can't wait for the rest :))


@ThingsExpo Stories
In his session at 21st Cloud Expo, Carl J. Levine, Senior Technical Evangelist for NS1, will objectively discuss how DNS is used to solve Digital Transformation challenges in large SaaS applications, CDNs, AdTech platforms, and other demanding use cases. Carl J. Levine is the Senior Technical Evangelist for NS1. A veteran of the Internet Infrastructure space, he has over a decade of experience with startups, networking protocols and Internet infrastructure, combined with the unique ability to it...
"There's plenty of bandwidth out there but it's never in the right place. So what Cedexis does is uses data to work out the best pathways to get data from the origin to the person who wants to get it," explained Simon Jones, Evangelist and Head of Marketing at Cedexis, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
"Cloud Academy is an enterprise training platform for the cloud, specifically public clouds. We offer guided learning experiences on AWS, Azure, Google Cloud and all the surrounding methodologies and technologies that you need to know and your teams need to know in order to leverage the full benefits of the cloud," explained Alex Brower, VP of Marketing at Cloud Academy, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clar...
Large industrial manufacturing organizations are adopting the agile principles of cloud software companies. The industrial manufacturing development process has not scaled over time. Now that design CAD teams are geographically distributed, centralizing their work is key. With large multi-gigabyte projects, outdated tools have stifled industrial team agility, time-to-market milestones, and impacted P&L stakeholders.
Gemini is Yahoo’s native and search advertising platform. To ensure the quality of a complex distributed system that spans multiple products and components and across various desktop websites and mobile app and web experiences – both Yahoo owned and operated and third-party syndication (supply), with complex interaction with more than a billion users and numerous advertisers globally (demand) – it becomes imperative to automate a set of end-to-end tests 24x7 to detect bugs and regression. In th...
"Akvelon is a software development company and we also provide consultancy services to folks who are looking to scale or accelerate their engineering roadmaps," explained Jeremiah Mothersell, Marketing Manager at Akvelon, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
"MobiDev is a software development company and we do complex, custom software development for everybody from entrepreneurs to large enterprises," explained Alan Winters, U.S. Head of Business Development at MobiDev, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
SYS-CON Events announced today that CrowdReviews.com has been named “Media Sponsor” of SYS-CON's 22nd International Cloud Expo, which will take place on June 5–7, 2018, at the Javits Center in New York City, NY. CrowdReviews.com is a transparent online platform for determining which products and services are the best based on the opinion of the crowd. The crowd consists of Internet users that have experienced products and services first-hand and have an interest in letting other potential buye...
"IBM is really all in on blockchain. We take a look at sort of the history of blockchain ledger technologies. It started out with bitcoin, Ethereum, and IBM evaluated these particular blockchain technologies and found they were anonymous and permissionless and that many companies were looking for permissioned blockchain," stated René Bostic, Technical VP of the IBM Cloud Unit in North America, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Conventi...
SYS-CON Events announced today that Telecom Reseller has been named “Media Sponsor” of SYS-CON's 22nd International Cloud Expo, which will take place on June 5-7, 2018, at the Javits Center in New York, NY. Telecom Reseller reports on Unified Communications, UCaaS, BPaaS for enterprise and SMBs. They report extensively on both customer premises based solutions such as IP-PBX as well as cloud based and hosted platforms.
"Space Monkey by Vivent Smart Home is a product that is a distributed cloud-based edge storage network. Vivent Smart Home, our parent company, is a smart home provider that places a lot of hard drives across homes in North America," explained JT Olds, Director of Engineering, and Brandon Crowfeather, Product Manager, at Vivint Smart Home, in this SYS-CON.tv interview at @ThingsExpo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
Coca-Cola’s Google powered digital signage system lays the groundwork for a more valuable connection between Coke and its customers. Digital signs pair software with high-resolution displays so that a message can be changed instantly based on what the operator wants to communicate or sell. In their Day 3 Keynote at 21st Cloud Expo, Greg Chambers, Global Group Director, Digital Innovation, Coca-Cola, and Vidya Nagarajan, a Senior Product Manager at Google, discussed how from store operations and ...
It is of utmost importance for the future success of WebRTC to ensure that interoperability is operational between web browsers and any WebRTC-compliant client. To be guaranteed as operational and effective, interoperability must be tested extensively by establishing WebRTC data and media connections between different web browsers running on different devices and operating systems. In his session at WebRTC Summit at @ThingsExpo, Dr. Alex Gouaillard, CEO and Founder of CoSMo Software, presented ...
WebRTC is great technology to build your own communication tools. It will be even more exciting experience it with advanced devices, such as a 360 Camera, 360 microphone, and a depth sensor camera. In his session at @ThingsExpo, Masashi Ganeko, a manager at INFOCOM Corporation, introduced two experimental projects from his team and what they learned from them. "Shotoku Tamago" uses the robot audition software HARK to track speakers in 360 video of a remote party. "Virtual Teleport" uses a multip...
A strange thing is happening along the way to the Internet of Things, namely far too many devices to work with and manage. It has become clear that we'll need much higher efficiency user experiences that can allow us to more easily and scalably work with the thousands of devices that will soon be in each of our lives. Enter the conversational interface revolution, combining bots we can literally talk with, gesture to, and even direct with our thoughts, with embedded artificial intelligence, whic...
SYS-CON Events announced today that Evatronix will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Evatronix SA offers comprehensive solutions in the design and implementation of electronic systems, in CAD / CAM deployment, and also is a designer and manufacturer of advanced 3D scanners for professional applications.
Leading companies, from the Global Fortune 500 to the smallest companies, are adopting hybrid cloud as the path to business advantage. Hybrid cloud depends on cloud services and on-premises infrastructure working in unison. Successful implementations require new levels of data mobility, enabled by an automated and seamless flow across on-premises and cloud resources. In his general session at 21st Cloud Expo, Greg Tevis, an IBM Storage Software Technical Strategist and Customer Solution Architec...
To get the most out of their data, successful companies are not focusing on queries and data lakes, they are actively integrating analytics into their operations with a data-first application development approach. Real-time adjustments to improve revenues, reduce costs, or mitigate risk rely on applications that minimize latency on a variety of data sources. In his session at @BigDataExpo, Jack Norris, Senior Vice President, Data and Applications at MapR Technologies, reviewed best practices to ...
An increasing number of companies are creating products that combine data with analytical capabilities. Running interactive queries on Big Data requires complex architectures to store and query data effectively, typically involving data streams, an choosing efficient file format/database and multiple independent systems that are tied together through custom-engineered pipelines. In his session at @BigDataExpo at @ThingsExpo, Tomer Levi, a senior software engineer at Intel’s Advanced Analytics gr...
When talking IoT we often focus on the devices, the sensors, the hardware itself. The new smart appliances, the new smart or self-driving cars (which are amalgamations of many ‘things’). When we are looking at the world of IoT, we should take a step back, look at the big picture. What value are these devices providing? IoT is not about the devices, it’s about the data consumed and generated. The devices are tools, mechanisms, conduits. In his session at Internet of Things at Cloud Expo | DXWor...