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
I think DevOps is now a rambunctious teenager - it's starting to get a mind of its own, wanting to get its own things but it still needs some adult supervision," explained Thomas Hooker, VP of marketing at CollabNet, in this SYS-CON.tv interview at DevOps Summit at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
"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.
Major trends and emerging technologies – from virtual reality and IoT, to Big Data and algorithms – are helping organizations innovate in the digital era. However, to create real business value, IT must think beyond the ‘what’ of digital transformation to the ‘how’ to harness emerging trends, innovation and disruption. Architecture is the key that underpins and ties all these efforts together. In the digital age, it’s important to invest in architecture, extend the enterprise footprint to the cl...
Data is the fuel that drives the machine learning algorithmic engines and ultimately provides the business value. In his session at Cloud Expo, Ed Featherston, a director and senior enterprise architect at Collaborative Consulting, discussed the key considerations around quality, volume, timeliness, and pedigree that must be dealt with in order to properly fuel that engine.
Two weeks ago (November 3-5), I attended the Cloud Expo Silicon Valley as a speaker, where I presented on the security and privacy due diligence requirements for cloud solutions. Cloud security is a topical issue for every CIO, CISO, and technology buyer. Decision-makers are always looking for insights on how to mitigate the security risks of implementing and using cloud solutions. Based on the presentation topics covered at the conference, as well as the general discussions heard between sessio...
IoT is rapidly becoming mainstream as more and more investments are made into the platforms and technology. As this movement continues to expand and gain momentum it creates a massive wall of noise that can be difficult to sift through. Unfortunately, this inevitably makes IoT less approachable for people to get started with and can hamper efforts to integrate this key technology into your own portfolio. There are so many connected products already in place today with many hundreds more on the h...
No hype cycles or predictions of zillions of things here. IoT is big. You get it. You know your business and have great ideas for a business transformation strategy. What comes next? Time to make it happen. In his session at @ThingsExpo, Jay Mason, Associate Partner at M&S Consulting, presented a step-by-step plan to develop your technology implementation strategy. He discussed the evaluation of communication standards and IoT messaging protocols, data analytics considerations, edge-to-cloud tec...
DXWorldEXPO LLC announced today that the upcoming DXWorldEXPO | CloudEXPO New York event will feature 10 companies from Poland to participate at the "Poland Digital Transformation Pavilion" on November 12-13, 2018.
Digital Transformation is much more than a buzzword. The radical shift to digital mechanisms for almost every process is evident across all industries and verticals. This is often especially true in financial services, where the legacy environment is many times unable to keep up with the rapidly shifting demands of the consumer. The constant pressure to provide complete, omnichannel delivery of customer-facing solutions to meet both regulatory and customer demands is putting enormous pressure on...
CloudEXPO | DXWorldEXPO are the world's most influential, independent events where Cloud Computing was coined and where technology buyers and vendors meet to experience and discuss the big picture of Digital Transformation and all of the strategies, tactics, and tools they need to realize their goals. Sponsors of DXWorldEXPO | CloudEXPO benefit from unmatched branding, profile building and lead generation opportunities.
DXWorldEXPO LLC announced today that All in Mobile, a mobile app development company from Poland, will exhibit at the 22nd International CloudEXPO | DXWorldEXPO. All In Mobile is a mobile app development company from Poland. Since 2014, they maintain passion for developing mobile applications for enterprises and startups worldwide.
The best way to leverage your CloudEXPO | DXWorldEXPO presence as a sponsor and exhibitor is to plan your news announcements around our events. The press covering CloudEXPO | DXWorldEXPO will have access to these releases and will amplify your news announcements. More than two dozen Cloud companies either set deals at our shows or have announced their mergers and acquisitions at CloudEXPO. Product announcements during our show provide your company with the most reach through our targeted audienc...
@DevOpsSummit at Cloud Expo, taking place November 12-13 in New York City, NY, is co-located with 22nd international CloudEXPO | first international DXWorldEXPO and will feature technical sessions from a rock star conference faculty and the leading industry players in the world.
Everything run by electricity will eventually be connected to the Internet. Get ahead of the Internet of Things revolution. In his session at @ThingsExpo, Akvelon expert and IoT industry leader Sergey Grebnov provided an educational dive into the world of managing your home, workplace and all the devices they contain with the power of machine-based AI and intelligent Bot services for a completely streamlined experience.
DXWorldEXPO | CloudEXPO are the world's most influential, independent events where Cloud Computing was coined and where technology buyers and vendors meet to experience and discuss the big picture of Digital Transformation and all of the strategies, tactics, and tools they need to realize their goals. Sponsors of DXWorldEXPO | CloudEXPO benefit from unmatched branding, profile building and lead generation opportunities.
22nd International Cloud Expo, taking place June 5-7, 2018, at the Javits Center in New York City, NY, and co-located with the 1st DXWorld Expo will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud ...
In his keynote at 19th Cloud Expo, Sheng Liang, co-founder and CEO of Rancher Labs, discussed the technological advances and new business opportunities created by the rapid adoption of containers. With the success of Amazon Web Services (AWS) and various open source technologies used to build private clouds, cloud computing has become an essential component of IT strategy. However, users continue to face challenges in implementing clouds, as older technologies evolve and newer ones like Docker c...
JETRO showcased Japan Digital Transformation Pavilion at SYS-CON's 21st International Cloud Expo® at the Santa Clara Convention Center in Santa Clara, CA. The Japan External Trade Organization (JETRO) is a non-profit organization that provides business support services to companies expanding to Japan. With the support of JETRO's dedicated staff, clients can incorporate their business; receive visa, immigration, and HR support; find dedicated office space; identify local government subsidies; get...
Dion Hinchcliffe is an internationally recognized digital expert, bestselling book author, frequent keynote speaker, analyst, futurist, and transformation expert based in Washington, DC. He is currently Chief Strategy Officer at the industry-leading digital strategy and online community solutions firm, 7Summits.
Bill Schmarzo, author of "Big Data: Understanding How Data Powers Big Business" and "Big Data MBA: Driving Business Strategies with Data Science," is responsible for setting the strategy and defining the Big Data service offerings and capabilities for EMC Global Services Big Data Practice. As the CTO for the Big Data Practice, he is responsible for working with organizations to help them identify where and how to start their big data journeys. He's written several white papers, is an avid blogge...