You are on page 1of 6

brought to you by...

#90
Get More Refcardz! Visit refcardz.com

CONTENTS INCLUDE:
n

n
Introducing Adobe ColdFusion Builder
Installing Getting Started with
Starting a New Project

Adobe ColdFusion Builder


n

n
Connecting to Servers ® ® ™
n
Introduction to Views
n
Working with Code and more...
By Terry Ryan
• Give your project a name: SampleProject
INTRODUCING ADOBE COLDFUSION BUILDER • Uncheck the Use Default Location check box
• Hit the Browse button and navigate to your
ColdFusion Builder is Adobe’s new IDE designed to deliver
ColdFusion webroot
truly rapid application development using its ColdFusion server
• Create a new folder named SampleProject
product. It is the first IDE dedicated specifically to ColdFusion
• Make sure it is selected and click Choose
since Macromedia turned out its last release of ColdFusion
Studio back in 2001. ColdFusion Builder is based on Eclipse, • Click Finish
and not the previous tool. Therefore it works easily with
Adobe® Flash® Builder™ and other Eclipse plugins.

INSTALLING

ColdFusion Builder is an Eclipse plugin, and like Flash Builder


can be installed in one of two methods: standalone and plugin.
Which one you chose will depend on whether you are already
www.dzone.com

using Eclipse and whether it makes sense for you to include


ColdFusion Builder in your workflow.
Standalone
Standalone creates a packaged version of ColdFusion Builder,
which includes Eclipse. It will be labeled “ColdFusion Builder”
and have icons and splash screens that reflect this. However,
most of these differences are cosmetic only. It’s still Eclipse,
and this version of it is fully capable, so you can use other
Eclipse plugins in this install.

Plugin
The plugin version requires you to have Eclipse already setup
on your machine. It installs itself as a plugin into that copy.
Getting Started with Adobe ColdFusion Builder

So all of your screens will still say Eclipse, and ColdFusion will
just be another perspective. This can be any version of Eclipse
you have pulled down from eclipse.org, or a packaged Eclipse To start experimenting with ColdFusion Builder we will need a
install like Flash Builder. ColdFusion file, called a “template”.

STARTING A NEW PROJECT

The basic collection of code in ColdFusion Builder is a project.


Many developers setup one ColdFusion Builder project per
ColdFusion application. However, they are not required to a
one to one match. Some people make the root of their project
the root of their Web server, and have all of the applications
under one giant project. This Refcard will show how to do a 1
app to 1 project match.

Opening up a new installed version of Coldfusion Builder


should show you something similar to figure 1.

To create a new project:


• Create a folder in your ColdFusion’s webroot named
SampleProject
• Go to the File Menu -> New -> ColdFusion Project

DZone, Inc. | www.dzone.com


2
Getting Started with Adobe ColdFusion Builder

To create a new ColdFusion template: ▪ Server Home:


• Go to the File Menu -> New -> ColdFusion Page � ▫ On OSX : /Applications/ColdFusion9
• If Location is blank, click the Browse button � ▫ On Windows: C:\ColdFusion9
• Select Sample Project ▪ Document Root:
� ▫ On OSX : /Applications/ColdFusion9/wwroot
• Click Ok
� ▫ On Windows: C:\ColdFusion9\wwwroot
• Set Name to index.cfm
• Click the Finish Button
We could also use a ColdFusion Component to show some
ColdFusion Builder now knows about your server. We just need
things off.
to tell “SampleProject” to use that server.
To create a new ColdFusion Component: Configure Project to use Server:
• Go to the File Menu -> New -> ColdFusion Component • In the left hand Navigator window Right Click
• If Location is blank, click the Browse button SampleProject
• Select Sample Project • Choose Properties
• Click Ok • Select ColdFusion Server Settings
• Set the Component Name to utility • Select Localhost from the list
• Check the box labeled Generate Script Style Code
To see if this is working we need to preview index.cfm
• Click Finish
• Add the function listed below to utility.cfc between the Preview Web page:
two curly brackets: • If not open, open index.cfm
• Type <strong>hello world</strong> in the editor window
Public string function getToday(){
return dateformat(now()); • Choose File -> Save to save the file
}
• Locate the Source tab at the bottom of the editor
You now have files to test. You can experiment with these if • Next to Source you should see tabs labeled “Safari,”
you like. To get the full use out of ColdFusion Builder we need “IE”,”Firefox” depending on what you have installed.
to configure it to communicate directly with our ColdFusion • Choose the browser of your choice
server. • “Hello World” should appear in bold.

CONNECTING TO SERVERS INTRODUCTION TO VIEWS

ColdFusion Builder wants to know about the servers that ColdFusion Builder’s tooling is divided into several forms
you develop on. By having that information it can allow you called views.
to manage the servers through the IDE, get extra logging
information and browse datasources and file systems on Navigator
the server. It also allows ColdFusion Builder to provide The Navigator is a basic view that comes with Eclipse. It allows
“code insight” which means that the IDE knows about the you to see and organize your projects and files.
components, methods and variables that you are currently
One of the overlooked featured of this view is the concept
working with.
of “Working Sets.” They allow you to group various projects
It’s recommended that you do your development against a together and then selectively show or hide groups. This is very
locally installed version of ColdFusion on the same workstation effective when you have tens of projects split amongst many
as ColdFusion Builder. We’re going to assume you have a clients. This can allow you to only see your current projects
default install of ColdFusion running the ColdFusion Web without having to go through the trouble of archiving and
Server. If you are using your own Web server like Apache or IIS removing projects that you aren’t working on but could pick up
your settings may vary. at any moment.

To configure a local server: To access Working Sets:


• Find the Servers tab in the bottom of the IDE window • In the Navigator Panel
• In the top of that click the New Server icon (a server tower • Click the down arrow at the top right
with a plus sign over it) • A menu should open with “Select Working Set”
• Set the following values:
▪ Name: localhost File
▪ Host Name: localhost The File view allows you to navigate the file system of your
▪ Select Is Local from the radio box workstation independent of any projects you may have setup.
▪ WebServer Port: 8500 This is useful if you need to quickly open a file from a project
▪ Skip down to Other Setting before you started using ColdFusion Builder and Projects.
▪ Put in your RDS username and password One of the other things the file view can do is connect to FTP/
• Click the Next button to move on and set the next SFTP servers. This means that you can review remote files, and
set of values: edit code on them.

DZone, Inc. | www.dzone.com


3
Getting Started with Adobe ColdFusion Builder

Servers the Outline view, filter for functions, and then sort alphabetically.
We used the Server view previously to add a server. However it
RDS Views
can do more. Through this interface you can do the following:
RDS stands for Remote Development Services in the
• See current status ColdFusion world. It allows developers to access key pieces of
• Start/Stop/Restart Server information about a remote server. It has be be setup as part
• Launch the Administrator of your ColdFusion server install. Be aware that it is perfectly
• Launch the Server Monitor reasonable to have installed on your local install of ColdFusion,
but it is discouraged on public facing or shared hosting
machines due to the large amount of information it makes
available.

RDS Dataview
RDS Data view allows you to see and interact with datasources
that you’ve setup on your ColdFusion server. It allows you
to see tables, views, columns, and column definitions. Using
Console context menus from this view you can activate the RDS Query
When you start your ColdFusion server via the Servers view, the Viewer.
Console output for the server is printed here. This can be very
useful for seeing errors occur in real time. Also content that
is written to the main application log for your server will show
up here. So you can use CFLog to make content appear in the
Console.
Tail View
Tail View allows you to see the contents of a file updated in
real time. This is very useful for targeting the error log of your
ColdFusion server. However it’s important to note that you are
not limited to ColdFusion logs. Any text file on your system
can be seen this way, like your Web server logs, or mail logs.
Service Browser
The Service Browser shows you all CFCs that are installed
under a ColdFusion server’s webroot. It allows you to inspect
all of the methods, see arguments, and filter for access.

It also allows you to paste code calling these CFCs and


methods into your code window.

To paste code from Service Browser:


• Open index.cfm
• Click the Service Browser tab
• Right Click the icon for localhost RDS Query Viewer
• Click Refresh Active RDS Server This view is an interactive query window that allows you to test
• Find and Expand SampleProject in the list SQL SELECT statements against your datasources. Note that
• Expand SampleProject.utility it only allows SELECT, you can not use it to alter data in the
• Right Click getToday() datasource.
• Choose Insert CFInvoke
RDS Fileview
• Look at index.cfm in editor window; a cfinvoke tag should This allows you to browse the file system on your ColdFusion
now be in the code. server. This is obviously much more useful for remote server
Extensions then for your local system.
This view allows you to install, review information about, Snippets
refresh, and delete ColdFusion Builder Extensions. These will Snippets allow you to create brief bits of reusable code,
be discussed separately. organize them, and pull them into your code. You can even
create shortcuts that you can use to pull snippets into your
Outline
source code using shortcut keys.
Outline presents organized version of your highlighting major
structures in your code. You can use the outline to click through To Create a Snippet:
to those structures in your code. It is configurable, sortable and • Go to the Snippet View
filterable, so you can choose what shows up in the outline. • Click the Plus icon
A great use of this is when you inherit a project where • Set the following values:
the functions in CFCs aren’t alphabetized. You can easily go to ▪ Name: Quick Date

DZone,
DZone, Inc.
Inc. || www.dzone.com
www.dzone.com
4
Getting Started with Adobe ColdFusion Builder

▪ Trigger Text: qd
▪ Start Block:�
<cfoutput>#DateFormat(Now())#</cfoutput>
▪ Click Ok
You should now have a snippet named “Quick Date” in your
Snippet View.

In addition to code hinting for CFScript and CFML, ColdFusion


Builder can do this for HTML, JS, and CSS.

Code Insight
While code assist is about knowing what the language is
capable of, Code Insight is about knowing what the code you
are writing is doing. This will allow you to make references
to scopes, variables, and components that you have written,
and get drop down lists of variables, and methods in those
structures.
To use a Snippet:
To see Code Insight in action:
• Open index.cfm • Open and delete any code in index.cfm.
• Double Click “Quick Date” in the Snippets View • Type <cfset test = New
• Date code should appear • Hit Space and wait.
However we can do that even faster. Delete that quick date in • A drop down list of components should appear
index.cfm. • Type Sam; the drop down list should now only have
SampleProject.utility().
To use Trigger text:
• Hit Enter
• In index.cfm type “qd” • You should have <cfset test = New SampleProject.utility()
• Now hit CTRL + J • Close it up with >
• Date code should appear • Type <cfset date = te and wait
• A drop down list with just test should appear
WORKING WITH CODE • Hit Enter
• test should appear
The ColdFusion IDE main purpose is to write ColdFusion code. • Type . and wait
There are a number of features that make the possible. • getToday() should appear
Code Assist � • Close it up with >
Code Assist refers to ColdFusion Builder knowledge about • Type <cfdump var =”#date#”/>
the CFML and CFScript languages. When you are typing • Preview the page with the browser tab
out ColdFusion language constructs, it can prompt you with
attributes speeding up your coding. Those dropdown lists for both component and methods were
the Code Insight feature in action.
To see Code Assist in action:
• Open and delete any code in index.cfm.
Refactoring
Refactoring encompasses a lot of things. In ColdFusion
• Type <cfmail
Builder this feature was installed with only one of those things,
• Hit Space and wait
method renaming. This allows you to rename a method, and
• A drop down list of attributes should appear have references to that method also be renamed, without
• Type su; the drop down list should only have subject having to manually find and replace those references.
in the list
• Hit Enter To Rename methods:
• You’ll have subject=”” with your cursor between the • Open index.cfm.
quotation marks. • If you have just done the Code Insight Example,

DZone, Inc. | www.dzone.com


5
Getting Started with Adobe ColdFusion Builder

continue, if not delete the contents of index.cfm, replace • Click Adobe CFC Generator.zip and click Open
and save with this code: • The Extension wizard will open
• Click Next
<cfset test = New SampleProject.utility()>
<cfset date = test.getToday()> • In Select Server choose localhost
<cfdump var =”#date#”/> • Click Finish
• When you are notified of success, click Ok
• Now open utility.cfc and highlight function name
getToday() Using Extensions
• Right Click and choose Refactor > Rename ColdFusion Builder extensions can be used in a variety of ways.
• For New Name type getCurrentDay They can generate code. They can analyze code. There’s even
• Then Click Preview one that will translate content in your editor window from one
• You should see a list of all of the changes that written language to another, using the Google Translation API.
will be made In short they can do anything ColdFusion can do.
• Click Ok
The Adobe CFC Generator is a basic code generator.

To use Adobe CFC Generator:


• Open the RDS Dataview panel
• Expand localhost
• Expand cfartgallery
• Expand Tables
• Right Click APP.ARTISTS
• Choose Adobe CFC Generator -> Create CFC
• Browse to SampleProject
• Click Ok
• You should see 4 new files:
▪ ARTISTS.cfc
▪ ARTISTSDAO.cfc
▪ ARTISTSGateway.CFC
▪ ARTISTSService.cfc

These files have all of the code to wire up a remote Web


service to manipulate the Artists table from a ColdFusion
AJAX or Flex front end for your applications.

USING EXTENSIONS Finding Extensions


The largest concentration of extensions currently resides
ColdFusion Extensions allow you to extend ColdFusion at RIAForge.com. By February 2010 there were close to 30
Builders features and functionality with ColdFusion. Using Extensions for ColdFusion Builder, which was in beta. It’s
some XML to wire ColdFusion Builder views to backend expected that many of the major frameworks will release
ColdFusion code, you can make the IDE do anything extensions to go along with their tools.
ColdFusion can do.
TIPS
Installing Extensions
Extensions are packaged as zip files. You manage the install of
them through the Extensions view. Enable Line Numbers
By default, ColdFusion Builder (and Eclipse) does not have line
To Install an Extension: numbering enabled.
• Click the tab on the Extensions View to see all currently
To enable line numbering:
installed extensions
• You may have some already installed. If you currently have • On OS X go to the Adobe ColdFusion
one named “Adobe CFC Generator” installed Menu -> Preferences
• If you do, highlight it and click the red X icon in the • On Windows go to the Window Menu -> Preferences
Extensions toolbar to delete • Drill into General -> Editors -> Text Editors
• Choose Completely uninstall • Check the “Show line numbers” check box
• Click the Plus Icon to add an extension Change Profile
• Navigate to where you installed ColdFusion Builder ColdFusion Builder has a default set of color coding and
/Applications/Adobe ColdFusion Builder on OSX shortcut keys. If you’ve migrated to ColdFusion Builder
C:\Program Files\ Adobe\Adobe ColdFusion Builder on from Dreamweaver or CFEclispe you may not like the current
Windows configuration. If so, you can easily change this by alerting your
• Drill into the subfolder extensions profile.

DZone, Inc. | www.dzone.com


6
Getting Started with Adobe ColdFusion Builder

To alter your profile: • On Windows go to the Window Menu -> Preferences


• On OS X go to the Adobe ColdFusion • Drill into ColdFusion -> Editor Profiles -> Editor -> Colors
Menu -> Preferences • Tweak colors on Keywords and what not.
• On Windows go to the Window Menu -> Preferences
However, these settings are not enough for many programmers
• Drill into ColdFusion -> Editor Profiles so you are better off editing the colorization file directly.
• Select another “Active Profile”
To edit Colorization file:
You can also create your own profiles if you wish.
• On Colors Preferences page
Change Syntax Highlighting • Click “Export…”
Any IDE worth its salt is capable of color code. The main
• This will export a .col file.
feature here is tweaking the color settings.
• Edit this col file
To change Code Coloring settings: • Click “Import…”
• On OS X go to the Adobe ColdFusion • Select the edited .col file.
Menu -> Preferences ��

ABOUT THE AUTHOR RECOMMENDED BOOK


Terry Ryan is currently an Adobe Platform This Getting Started volume starts with Web and Internet
Evangelist for ColdFusion. His job is to drum up fundamentals and database concepts and design, and
support and excitement among developers for Adobe then progresses to topics including creating data-driven
ColdFusion.  He has been working with it for over 10 pages, building complete applications, implementing
years. He’s presented at various Adobe ColdFusion security mechanisms, integrating with e-mail, building
events including cf.Objective, webDU, and Adobe reusable functions and components, generating data-
Max.  Prior to joining Adobe, Terry worked for the driven reports and graphs, building Ajax-powered user
Wharton School of Business at the University of Pennsylvania in interfaces, and much more.
various roles around ColdFusion from Application Developer to
System Administrator.
BUY NOW
Terrence Ryan | Adobe Platform Evangelist | http://terrenceryan.com books.dzone.com/books/adobe-coldfusion-8-web

#82

Browse our collection of over 85 Free Cheat Sheets


Get More Refcardz! Visit refcardz.com

CONTENTS INCLUDE:

About Cloud Computing
Usage Scenarios Getting Started with
n
Aldo

Cloud#64Computing

Underlying Concepts
Cost
by...

Upcoming Refcardz
youTechnologies ®
Data

t toTier
brough Comply.
borate.
Platform Management and more...

Chan
ge. Colla By Daniel Rubio

tion:
dz. com

also minimizes the need to make design changes to support


CON

tegra ternvasll
ABOUT CLOUD COMPUTING one time events. TEN TS
INC ■
HTML LUD E:

us Ind Anti-PPaat
Basics
Automated growthHTM
ref car

Web applications have always been deployed on servers & scalable


L vs XHT technologies

nuorn

Valid
ation one time events, cloud ML
connected to what is now deemed the ‘cloud’. Having the capability to support

Java GUI Development


Usef
Du
ti

ul M.
computing platforms alsoulfacilitate
4 Open the gradual growth curves

n an
Page Source

o

s
Vis it

However, the demands and technology used on such servers Structure

C
faced by web applications. Tools

Core
By Key ■
Elem

atte
has changed substantially in recent years, especially with Structur
E: al Elem ents
INC LUD gration
NTS
P the entrance of service providers like Amazon, Google and Large scale growth scenarios involvingents
specialized
and mor equipment
rdz !

ous Inte Change

HTML
CO NTE Microsoft. es e... away by
(e.g. load balancers and clusters) are all but abstracted
Continu at Every e chang
m

About ns to isolat
relying on a cloud computing platform’s technology.
Software i-patter
space

Adobe Catalyst
rdz .co


n
Re fca

e Work
Build
riptio
and Ant These companies
Desc have a Privat
are in long deployed trol repos
itory web applicationsge HTM
L BAS

to mana
Patterns Control

that adaptDeve
lop softw
and scale to
n-con
large user
a versio bases,ng and making them In addition, several cloud computing ICSplatforms support data
les to ize mergi
ment
rn
Version e... Patte it all fi minim le
tier technologiesHTM
Manage s and mor e Work knowledgeable in amany
ine to
mainl aspects related tos multip
cloud computing. that Lexceed the precedent set by Relational
space Comm and XHT

ref ca

Build
re

tice Privat lop on that utilize HTML MLReduce,


Prac

Deve a system Database Systems (RDBMS): is usedMap are web service APIs,
Build of work prog as thescalethe foundati By An
Ge t Mo

This Refcard will introduce e within


to you to cloud riente computing, with an
d units
RATION
etc. Some platforms ram support large grapRDBMS deployments.

The src
INTEG softwar emphasis on these providers, so es by
task-o it
youComm can better understand and Java s written in hical on of
all attribute dy Ha
also rece JavaScri user interfac web develop and the rris
Vis it

OUS

Flash Builder 4
chang
ding code Level
as the desc
the ima alt attribute ribes whe
www.dzone.com

a Task
ive data pt. Server-s
ce
NTINU of buil tr what it is a cloud computing es as platform can offer your ut web output e in clien ment.
T CO cess ion con it chang e witho likew ide lang t-sid e ge is describe re the ima
ise use mec hanism. fromAND
e name CLOUD COMPUTING PLATFORMS
the pro ject’s vers applications. and subm sourc
ABOU (CI) is
with uniqu are from web
The eme pages and uages like Nested
unavaila s alte ge file
rd z!

a pro the build softw um was HTM ble. rnate can be


gration ed to Label ies to
build minim UNDERLYING once CONCEPTS L and rging use HTM PHP tags text that found,
ous Inte
activit the bare standard a very loos XHTML Tags
committ to a pr USAGE SCENARIOS ate all
gurat
ion cies to t
ely-defi as thei Ajax
technolo L can is disp
Continu ry change ization, cannot be (and freq
Autom nden ymen layed
tion r visu
Re fca

a solu inef tool depe same


deplo t need but ned al eng gies if
eve (i.e., ) alled the nmen for stan as software languag overlap uen
(i.e., t, use target enviro it has ine. HTM
e-inst
with blem Amazon EC2: Industry
whether standard
dards and virtualization
e with b></ , so <a>< tly are) nest
patterns-patterns ar pro ymen
ory. d deploEAR) in each has bec become very little L a> is

Maven 3
reposit ed via particul tions that e Pay only what you consume
tagge or Amazon’s cloud you cho platform
computing
the curr isome
heavily basedmoron fine. b></ ed insid
anti e imp a></
For each (e.g. WAR
ent stan ose to writ
lain the t
es more e
not lega each othe
and x” solu b> is
be exp text) to “fi duc Web application deployment ge until
nden a few years
t librari agonmen was similar app ortant,
ns are to pro packa t enviro industry standard
that will softwaredardand virtualization
e HTM technology.
Mo re

CI can ticular con used i-patter they tend but can


all depe all targe
s will L or XHT arent. Reg the HTM l, but r. Tags
etimes s. Ant tices,
to most phone services: alizeplans with le that
late fialloted resources, ts with an and XHT simplify all help ML, und ardless
L VS
XHTM <a><
in a par hes som , Centr temp you prov b></
enting your
ces end nmen
pro prac incurred cost whether a single
such resources on
were consumed
enviro orthenot. ML of L
in the rily bad
based t Virtualization
muchallows aare physical pieceothe ofr hardware ideto be erstand HTML
implem
eate
approac ed with the cial, but, ies are nt targe es to
of the actually web cod a solid ing has
necessa pared to into differe
opert chang
efi itting utilized by multiple operating simplerThis allows
function systems. ing.resourcesfoundati job adm been arou
associat to be ben e builds
Ge t

are not n com Cloud computing as it’semot known etoday


e comm
has changed this.
befor commo alitytohas than Fortuna on irably, nd for
They
etc. they
Build (e.g. bandwidth, memory,
n elem CPU) be allocated exclusively totely exp som
lts whe that job
ually,
appear effects. rm a
Privat , contin nt team Every mov
entsinstances. ed to CSS
used
to be, HTM ected.
has exp e time. Whi
ed resu ion The various resourcesPerfo consumed by webperio applications
dically (e.g.
opme pag
individual operating system because
L Brow Early
adverse unintend Integrat
sitory Build r to devel common e (HTML . ser HTM anded le it has
web dev manufacture L had very
Repo
e ous bandwidth, memory, CPU) areInteg tallied
ration on a per-unit CI serve basis or XHT far done
duc
Continu Refcar
rm an from
extensio .) All are limited mor e than
om

pro ML shar its


tern.
ack rs add
(starting from zero) by Perfo all major cloud
feedb computing platforms. As a user of Amazon’s essecloud
EC2 elopers
nti computing es platform, you are result anyb
on layo
he pat tion he term le this s toma
ted
hey occur d based n H c ed
d

DZone, Inc.
ISBN-13: 978-1-934238-70-7
140 Preston Executive Dr. ISBN-10: 1-934238-70-8
Suite 100
50795
Cary, NC 27513

DZone communities deliver over 6 million pages each month to 888.678.0399


919.678.0300
more than 3.3 million software developers, architects and decision
Refcardz Feedback Welcome
$7.95

makers. DZone offers something for everyone, including news,


refcardz@dzone.com
tutorials, cheat sheets, blogs, feature articles, source code and more. 9 781934 238707
Sponsorship Opportunities
“DZone is a developer’s dream,” says PC Magazine.
sales@dzone.com
Copyright © 2010 DZone, Inc. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, Version 1.0
photocopying, or otherwise, without prior written permission of the publisher.

You might also like