#90 brought to you by...

CONTENTS INCLUDE:

n Introducing Adobe ColdFusion Builder n Installing Getting Started with n Starting a New Project n Connecting to Servers ® ® ™ n Introduction to Views

n Adobe ColdFusion Builder Working with Code and more... By Terry Ryan Visit refcardz.com

• 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 turned out its last release of ColdFusion Studio back in 2001. ColdFusion Builder is based on , • 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 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,

www.dzone.com Get More Refcardz! 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. 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

Adobe ColdFusion Builder 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 Getting Started with

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 : • If not open, open index.cfm • Type hello world 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 Outline create shortcuts that you can use to pull snippets into your 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, Inc. || www.dzone.com 4 Getting Started with Adobe ColdFusion Builder

▪ Trigger Text: qd ▪ Start Block:� #DateFormat(Now())# ▪ 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 • Date code should appear • Type Code Assist refers to ColdFusion Builder knowledge about • Type 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: Refactoring • Open and delete any code in index.cfm. Refactoring encompasses a lot of things. In ColdFusion • Type

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 • In Select Server choose localhost • 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 to manipulate the Artists table from a ColdFusion 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 • 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 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

CONTENTS INCLUDE:

■ Browse our collection of over 85 Free Cheat Sheets About Cloud Computing ■ Usage Scenarios Getting Started with ■ Underlying Concepts ■ Cost ® ■ Data Tier Technologies #64 ply. Cloud Computing om brought■ Platform to you Management by... and more... e. C . Collaborat AldonChange By Daniel Rubio Visit refcardz.com

also minimizes the need to make design changes to support CON ABOUT CLOUD COMPUTING one time events. TEN TS IN ■ HTM CLU L Basic DE: ■ s Upcoming Refcardz H Web applications have always been deployed on servers Automated growth &TM scalableL vs XH technologies s ■ Validatio TML connected to what is now deemed the ‘cloud’. Having the capability■ to supportn one time events, cloud Useful O computing platforms also facilitate the gradual growth curves ■ Page Structupen Sou #84 However, the demands and technology used on such servers rce Tool faced by web applications.■ Key Structural reElem Elem s : has changed substantiallyBy Paul in recent M. years, Duvall especially with ent Visit refcardz.com s

n the entrance of service providers like Amazon, Google and Large scale growth scenarios involvingents specialized and m equipment e Continuous Integration:s CONTENTS INCLUDE ange ore.. Patterns andMicrosoft. Anti-Patternte ch (e.g. load balancers and clusters) are all but abstracted. away by la GUI Development ery Chang

m e to iso ■ About Continuousre at EvIntegratios spac n Work relying on a cloud computing platform’s technology. tio rivate ry Core escrip P ■ Build Softwa D in a posito ge HTML BASIC These companiesftw haveare long deployedtrol re web applicationsana p so n-con d to m ■ velo an Patterns and Anti-patternrol De a versio rging rn that adapt and scaleles to to large user m ebases, making them In addition, several cloud computingS platforms support data t Patte ll fi inimize ■ ce mit a m HTML Version Cont re... spa om e to ltiple HTML and XHTML a Work knowledgeableC in manyainlin aspects related tos m cloudu computing. tier technologies that exceed the precedent set by Relational mo ate n a m tilize ■ Priv o at u Build Managemen velop m th HTML is used as the in client-sid De syste rk Database Systems (RDBMS): Map Reduce, web service APIs, ithin a f wo re the foundation of all web development ■ e w nits o programs written in JavaScript. Serve Build Practices and This Refcard will introduce to you to cloudted computing,u with an -orien etc. Some platforms support large scale RDBMS deployments. The s By Andy Harris Adobe ATION sk r s by ta it and Java also rc attribute describes whe emphasis on these providers,an soge you ocanmm better understand de ch evel C and the alt attribute describes alternate text that is displayed i ce co Task L as the output mechanism. The eme r what it is a cloud computinges as a platform can offer yourt web receive data f

hang ithou the image is unavailable Visit refcardz.co Visit e w bmit c nam ur r-side languages like PH . re the image rocess of building softwa d su nique m so likewise use HTML and XHTMLr omas their web visual pages engine. and use HTM HTM ’s version cont applications. an ith u are fr o ce CLOUD COMPUTING PLATFORMS AND e ABOUT CONTINUOUS INTEGR uild w softw Get More Refcardz! roject l the b uild um was once a very loosely-de Nested tags file can be found abe s to b minim . L bare UNDERLYING CONCEPTS all activitie the rging Ajax technologie P r mate tion cies to standa Tags can be (and f USAGE SCENARIOSAuto gura nden ent L , epe eploym rdization, but as it has beco Continuous Integration (CI) is the p tool d me d ent need for standa fi ned language with very littl cannot overlap, so lled e sa ronm requently a f ef ) e-insta se th t envi s Flash Builder 4 t, u en rge with every change committed to a p ploym ach ta Amazon EC2:whether Industry you choose standard to write HTML orand XHTML, virtualization understandin b> fi x” the particularre solutions problem tha deploymentpack untildent lib a few yearset e nago was similar re appa is not legal, but epen ll targ industry standardthat will simplifysoftware all and your virtualization other web coding. technology. Fortunately HTM CI can be explained via patterns (i.e., a solution to a p n all d that a rds will help you p rent. Rega e HTML VS XHTM r. Tags to most phone services:ntralize plans withte fi allotedle resources, with an Ce mpla ents and XHTML a < www.dzone.com Get More Refcardz! gle te ronm rdless o in a particular context) and anti-patterns (i.e., in g a sin d on nvi / rocess. Anti-patterns a te ase et e e incurred cost whetherea such reresources b weret targ consumed or th not. Virtualizationmuch allowsof the functionalitya physical piece has moved of hardware to CSSrovide to bea solid foundatio f HTML has been a L roaches sometimes the p used to “ rties a ren nges to re actually simpler than they used to be, becaus app with ope to diffe g cha g fi cial, but, in the end, theyred tend to implementin to produc uilds in mmittin utilized by multiple operating systems. This allows resources job admirabl ote b re co round for some time. While it has done it associated re not necessarily bad practices, but ca em befo tc. common element n Maven 3 ild , e Cloud computing as it’s knownte today Bu has changed this.ually (e.g. bandwidth, memory, CPU) to be allocated exclusively to

riva ontin m expected. Earlyy, thatHTML job had has very expanded limited lafar mo Get More Refcardz! Refcardz! More Get P a

appear to be bene rm a ically, c nt te Every page (H ffects. They aresults when compa The various resourcesP econsumedrfo by web eapplicationsriod (e.g.pme L n sitory ild p evelo individual sinstances. Browser manufactu Repo n Bu r to d . tio common.) All a adverse e tegra I serve TML or XHTML sha e bandwidth, memory, CPU) are an In tallied on raom per-unit C basis web developers r erform back f r

produce unintended. P feed m extension r rers adde e than an s d r on e esse n (starting from zero) by all majorma tecloud computingy occu platforms.ased As a user of Amazon’s EC2 cloud computingres platform, you are res he pattern tio he term Continuousle this Refca Integratios to he d b o H nti ult c d yo yb 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 more than 3.3 million software developers, architects and decision 919.678.0300 makers. DZone offers something for everyone, including news, Refcardz Feedback Welcome [email protected] tutorials, cheat sheets, blogs, feature articles, source code and more. 9 781934 238707 $7.95 Sponsorship Opportunities “DZone is a developer’s dream,” says PC Magazine. [email protected] Copyright © 2010 DZone, Inc. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any or by means electronic, mechanical, Version 1.0 photocopying, or otherwise, without prior written permission of the publisher.