Ten ColdFusion 9 One-Liners

ColdFusion 9

All great performers have repertoire of one-liners. ColdFusion is no different and here are some cool new ColdFusion 9 one-liners:

1. Take a Word document and convert it to PDF
<cfdocument format="pdf" srcfile="/mydoc.docx" filename="mydoc.pdf" />

2. Take a PDF and optimize it (remove extra images, bookmarks, etc that are not needed)
<cfpdf action="optimize" source="bigpdf.pdf" algo="Bicubic" destination="smallpdf.pdf">

3. Get an object/record of an artist based on the key
<cfset artist = entityLoad('artists',1,true)>

(Change it <cfset artist.setLastName('McCoy')>)

4. Save the object back to the database
<cfset entitySave(artist)>

5. Add a map to a page
<cfmap centeraddress="275 Grove Street Newton, MA 02466" zoomlevel="8" type="hybrid" />

Map

6. Connect to an imap server
<cfimap action="open" server="imap.googlemail.com" username="" secure="yes" port="993" password="" connection="gmail">

7. Add a message box
<cfmessagebox type="prompt" name="mes" message="Enter Message" labelok="Send" multiline="true" width="400" />

8. Add a media player to a Flash video file
<cfmediaplayer source="/phone.flv" >

9. Put a query into a spreadsheet
<cfspreadsheet action="write" filename="test.xls" query="getArtists">

10. Create a multiple file upload UI
<cffileupload url="multiUploadProcess.cfm">

Ah, what the heck, here's a bonus one:

11. Process those files and save to the file system
<cffile action="uploadall" destination="#getTempDirectory()#">

Pretty cool stuff. All of these new features have a lot of other attributes and possibilities for customization.

There are even a few (creating a progress bar, converting a PowerPoint presentation) that I left off.

Ben Nadel said:
 
WORD UP!
 
posted 120 days ago
View Replies (2) || Add Comment Reply to: this comment OR this thread
 
.: HIDE REPLIES :.
Todd Rafferty said:
 
No love for ? :(
 
posted 120 days ago
Add Comment Reply to: this comment OR this thread
 
Steven Erat said:
 
Nice selection of Newton on the map instead of a Cali addr! Mediaplayer's gonna make Flex have ColdFusion envy.
 
posted 120 days ago
Add Comment Reply to: this comment OR this thread
 
Jules Gravinese said:
 
With CFMAP, you don't have to use a google map api key?
 
posted 120 days ago
View Replies (1) || Add Comment Reply to: this comment OR this thread
 
.: HIDE REPLIES :.
Steven Erat said:
 
The ColdFusion 9 Administrator has a Settings page that now includes a field for Google API key:
--
Google Map API Key
Specify the Google Map API license key that you require to access Google Maps.
--

The CFML reference also offers several other ways:

--
The Google map API key can be specified in the following ways:

1. Using the cfajaximport tag. You specify the map API key in the params attribute as follows:


2. Using Application.cfc as follows:



3.Using the Settings page in the ColdFusion Administrator. Specify the map API key in the Google Map Key field. You can also specify the map API key in runtime.cfc
--
 
posted 120 days ago
Add Comment Reply to: this comment OR this thread
 
samfarmer said:
 
Heh. I'm not sure if thats the original Allaire building where CF was born or a new office but the idea was for the home of ColdFusion.
 
posted 119 days ago
View Replies (1) || Add Comment Reply to: this comment OR this thread
 
.: HIDE REPLIES :.
Steven Erat said:
 
ColdFusion was born in Minnesota, then moved to Cambridge MA. CFMX was born in Newton.
 
posted 119 days ago
Add Comment Reply to: this comment OR this thread
 

Search

Twitter
You should follow me on Twitter here
About Me
I am a 34-year old Web Developer specializing in ColdFusion. I live and work in downtown Washington, DC with my wife and two daughters. Read more About Me

2007 CFeMmy Best Newcommer winner
As voted on by fellow CF Bloggers.
CFinNC - Carolina ColdFusion / Flex / Air Conference - Oct 17-18, 2009