Friday, July 03, 2009    
Home My Books Blog ColdFusion About Me Back    

Calendar
<< Jul 2009 >>
S M T W T F S
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  

Search

Categories
 • Acrobat (3) [RSS]
 • Adobe (76) [RSS]
 • AdobeMAX06 (45) [RSS]
 • AdobeMAX07 (59) [RSS]
 • AdobeMAX08 (66) [RSS]
 • AdobeMAX09 (10) [RSS]
 • AIR (190) [RSS]
 • Appearances (175) [RSS]
 • Books (70) [RSS]
 • CFEclipse (14) [RSS]
 • ColdFusion (1277) [RSS]
 • Data Services (28) [RSS]
 • Fish Tank (3) [RSS]
 • Flash (144) [RSS]
 • Flex (458) [RSS]
 • Home Automation (3) [RSS]
 • Jobs (113) [RSS]
 • JRun (13) [RSS]
 • Labs (35) [RSS]
 • LiveCycle (30) [RSS]
 • MAX (205) [RSS]
 • Mobile (103) [RSS]
 • Regular Expressions (17) [RSS]
 • RIA (17) [RSS]
 • SQL (39) [RSS]
 • Stuff (524) [RSS]
 • Tips (CF Studio) (80) [RSS]
 • Tips (CF) (795) [RSS]
 • Tips (Dreamweaver) (91) [RSS]
 • Tips (Flex Builder) (2) [RSS]
 • Using CF (154) [RSS]

Other BLOGs
 • Charlie Arehart
 • Lee Brimelow
 • Ray Camden
 • Christophe Coenraets
 • Sean Corfield
 • Mihai Corlan
 • Cornel Creanga
 • Mark Doherty
 • John Dowdell
 • Danny Dura
 • Enrique Duvos
 • Steven Erat
 • Kevin Hoyt
 • Serge Jespers
 • Adam Lehman
 • Duane Nickull
 • Miti Pricope
 • Andrew Shorten
 • Ryan Stewart
 • James Ward
 • Greg Wilson
 • Full As A Goog

RSS Feeds
 • Feed
 • Subscribe

Join my mailing list and find out about new books and other topics of interest.

Thoughts, ideas, tips, musings, and pontifications (not necessarily in that order) by Ben Forta ...
NOTE: This is my personal blog, and the opinions and statements voiced here are my own.

July 2, 2009

First Bangalore ColdFusion Usergroup

The inaugural meeting of the newly formed Bangalore ColdFusion Usergroup will take place July 09, 2009, at the Adobe Bangalore office. ColdFusion engineering team members will present ColdFusion Centaur and Bolt. Details posted online.

June 26, 2009

ColdFusion Positions In Iraq, KS, and MA

Three ColdFusion positions this week, including one in Iraq:

  • Vykin Corporation (company based in Florida, but position is in Iraq) is looking for a ColdFusion and Flex developer with secret security clearances for the US Department of Defense in Iraq. Requirements include ColdFusion and/or Flex certification. Details posted online.
  • Unnamed client (KS) is looking for a ColdFusion developer for a contract to permanent position. ColdFusion 8 experience required, as is experience with Flash. Contact Melissa Kelly-Foxhoven at recruiter PAiGE Technologies, LLC.
  • NxStage Medical, Inc. (Lawrence, MA) is looking for a ColdFusion developer. Requirements include knowledge of HTML, CSS, JavaScript, XML, and SQL, and a solid understanding of procedural and object-oriented code. Familiarity with framework-driven development environments, and Flash development, a plus. Contact Duane Dumont.


Toronto Wraps My Usergroup Presentations

Last night I presented ColdFusion, Flex, and more to a joint meeting of the local Flex and ColdFusion groups. The group took a little while to warm up, but then really got going. The session ran over 2 hours and was highly interactive.

Big winners were spreadsheet integration, ORM, Bolt extensions, and the data connectivity in Flash Builder 4. We also got into a lively and heated tangent conversation about the AS3 server proof-of-concept shown during the MAX sneaks last year (the crowd was lobbying heavily to turn this into a product).

Last night wrapped my scheduled usergroups presentations, for now.

June 25, 2009

Presenting At Usergroup In Toronto Tonight

I am on my way to Toronto for tonight's usergroup presentation on ColdFusion and Flex. Details posted online.

June 23, 2009

Check Out tBlurb.com

Fellow Adobe Platform Evangelist (and recent ColdFusion devotee) Greg Wilson has created tBlurb.com, an app that lets you enter code and get a short URL to it for sharing (you can choose your own or let it pick it for you). The app features a rich text editor, and supports ActionScript, C++, C#, ColdFusion, CSS, Delphi, Java, JavaScript, PHP, Python, Ruby, SQL, VB.NET and XML/HTML. And Greg built it all in ColdFusion!


Presenting Tonight At Usergroup In San Francisco

I am in San Francisco for a few days of meetings, video shoots, and more (almost all MAX 2009 related). But tonight I'll get to do what I really enjoy doing, presenting to our usergroups. I'll be presenting ColdFusion and Flash Builder futures to the BACFUG group this evening at 6:30pm in the Adobe San Francisco office (601 Townsend). Details posted online.

June 22, 2009

More On ColdFusion And Spreadsheets

Last week I posted an entry on the spreadsheet support planned for ColdFusion Centaur. That post (unsurprisingly) generated lots of questions and comments, and so I thought it worthwhile to post a bigger and more sophisticated example, this time building a new spreadsheet from scratch.

We'll start with a simple Application.cfc to define the datasource needed for this app:

<cfcomponent>
    <cfset this.datasource="cfartgallery">
</cfcomponent>

Now to create a spreadsheet using a database query:

<!--- Get data --->
<cfquery name="ArtOrders">
SELECT orderid, customerfirstname, customerlastname, total
FROM orders
ORDER BY orderid
</cfquery>

<!--- Save it --->
<cfspreadsheet action="write"
    query="ArtOrders"
    filename="Orders.xls"
    overwrite="true">

That's all it takes. <cfspreadsheet> creates a spreadsheet populated with the retrieved data, using the query column names as column headers in the first spreadsheet row, and the data starting in the second row. Nice, huh?

But what if you want more control? What if you want to explicitly control data placement? What if you needed to provide row or column or cell level formatting? And what if you needed a total cell containing a formula to SUM the total column?

Here's a complete example:

<!--- Get data --->
<cfquery name="ArtOrders">
SELECT orderid, customerfirstname, customerlastname, total
FROM orders
ORDER BY orderid
</cfquery>

<!--- Create new spreadsheet --->
<cfset sObj=SpreadsheetNew()>

<!--- Create header row --->
<cfset SpreadsheetAddRow(sObj, "Order,First Name,Last Name,Amount")>
<cfset SpreadsheetFormatRow(sObj, {bold=TRUE, alignment="center"}, 1)>

<!--- Add orders from query --->
<cfset SpreadsheetAddRows(sObj, ArtOrders)>

<!--- Figure out row for formula, 2 after data --->
<cfset rowDataStart=2>
<cfset rowDataEnd=ArtOrders.recordCount+1>
<cfset rowTotal=rowDataEnd+2>
<cfset totalFormula="SUM(D#rowDataStart#:D#rowDataEnd#)">

<!--- Add total formula --->
<cfset SpreadsheetSetCellValue(sObj, "TOTAL:", rowTotal, 3)>
<cfset spreadsheetSetCellFormula(sObj, totalFormula, rowTotal, 4)>

<!--- Format amount column as currency --->    
<cfset SpreadsheetFormatColumn(sObj, {dataformat="$00000.00"}, 4)>

<!--- Save it --->
<cfspreadsheet action="write"
    name="sObj"
    filename="Orders.xls"
    overwrite="true">

Once again, we start with a database query. Then, SpreadsheetNew() is used to create a new spreadsheet object.

The code then creates the header row. SpreadsheetAddRow() is used to add a specific row, the column headers (as no row number was specified, SpreadsheetAddRow() adds the row to the next free row, the first). SpreadsheetFormatObject() is then used to format row 1, this function accepts a structure (which here is implicitly created inline).

Next comes the data. SpreadsheetAddRows() adds the entire query to the spreadsheet (again, as no row was specified the data gets added to the next free row).

Now for the formula which will total all orders. So as to not hard code the row, a few <cfset> statements are used to calculate the first and last data row, and the row for the total (2nd row after the end of the data, so leaving one empty row in between data and total). The formula too can't be hard coded, so instead of SUM(D2:D24), the row variables are used to build the formula string dynamically. SpreadsheetSetCellValue() is used to add a title, and SpreadsheetSetCellFormula() inserts the formula.

Next, the entire fourth column, containing the order amounts and the calculated total, is formatted to display as currency using SpreadsheetFormatColumn().

All that is left to do then is to save the file using <cfspreadsheet>.

<cfspreadsheet> and its 30+ supporting functions can do lots more, but this should give you a taste of just what's possible using this innovative new feature.


For Now, Avoid Kindle Version of My RegEx Book

My Sams Teach Yourself Regular Expressions in 10 Minutes has proven to be a very popular book, and tens of thousands of developers have used it to get started with Regular Expressions. The book teaches RegEx incrementally, and for each example a block of text is used, and matching text is shaded to clearly demonstrate what the Regular Expression is doing.

Sams Teach Yourself Regular Expressions in 10 Minutes has apparently now been released for the Amazon Kindle. I've not seen the Kindle version yet (as I don't have a Kindle yet), but readers are reporting to me that the Kindle version is missing the shading, making all of the examples rather useless!

I've contacted the publisher about this problem, and hope they'll correct it quickly. But for now, I suggest you avoid the Kindle version of the book, and stick with the print version.


Executing Code On Server Startup

ColdFusion can execute code when an application starts and ends, when a session starts and ends, when a request starts and ends, and more. But what if you need to execute code when a server starts up? Granted, this is not a common use case, but when needed, we've had to use onApplicationStart for this, probably doing something like:

<cfif not IsDefined("SERVER.myVar")>
...
</cfif>

ColdFusion Centaur adds the ability to define code to be executed onServerStart.

By default this is a method named onServerStart in server.cfc. But, actually, it can be in any ColdFusion Component, including an Application.cfc. In ColdFusion Administrator you can point to the CFC and method to be invoked, and ColdFusion will execute the code on server start-up before processing any requests.

June 21, 2009

The New ColdFusion LOCAL Scope

ColdFusion developers have long known to ensure that local variables remain local by using the "var" keyword to define them. Here's an example:

<cffunction name="myFunction">
    <cfset var mySafeVariable = 1>
    <cfset myUnsafeVariable = 1>
</cffunction>

In the above snippet, two variables are created. The first variable uses the var keyword to ensure that the variable is local to the function, and if the same variable name existed elsewhere it won't be overwritten. The second variable does not use var, and as such is not local, and variable conflicts can indeed occur. And so, when creating user defined functions or ColdFusion Component methods, the rule has always been to always prefix local variables with "var".

But what exactly is a var variable? What scope is it in? And how is it accessed using explicit scope notation? The answers to these questions are somewhat unclear, partially because the local var scope is not used like any other ColdFusion scope which is always designated by using a scope prefix (VARIABLES.myVariable, FORM.myVariable, SESSION.mayVariable, etc.).

ColdFusion Centaur simplifies the use of local scopes (without breaking existing code) by explicitly defining a local scope that it intuitively named LOCAL. Here is the same local variable set above, but using the LOCAL scope instead of var:

<cfset LOCAL.mySafeVariable = 1>

But what if you do indeed use var? Well, it'll just work. Look at the following two <CFSET> statements:

<cfset local.myVar1=1>
<cfset var myVar1=1>

Both of these code snippets do the exact same thing. Variables with the var prefix are now automatically defined in the LOCAL scope. So a variable defined as:

<cfset var mySafeVariable = 1>

can be safely accessed as:

<cfoutput>#LOCAL.mySafeVariable#</cfoutput>

It's clean, it's simple, it's intuitive, and it's fully backwards compatible. And yes, if you have a variable named "local" it'll still work, the variable will just become LOCAL.local, and as the LOCAL scope is in the default evaluation chain it'll just work.

Oh, one other change. The "var" keyword used to only be supported at the top of functions and methods, so all local variables had to be defined upfront. This limitation has been removed in ColdFusion Centaur (and I actually have mixed feelings about this, but so be it).

June 20, 2009

Look, No Datasource

Look at this code snippet. Notice anything odd about it?

<cfquery name="Art">
SELECT *
FROM art
ORDER BY ArtName
</cfquery>

Yep, the <CFQUERY> tag in the above snippet is missing the DATASOURCE attribute. And yet, this code works. Why? Take a look at this Application.cfc file:

<cfcomponent>
    <cfset this.datasource="cfartgallery">
</cfcomponent>

In ColdFusion Centaur you can now specify an application wide default datasource by setting this.datasource in Application.cfc. The specified datasource becomes the default for all <CFQUERY>, <CFSTOREDPROC>, and other tags that expect a datasource to be specified. Of course, datasource can still be specified manually if needed, and a specified datasource will override the application default one.

This is one of those duh! enhancements that just makes sense. And, as I'll explain in an upcoming post, it also has another important purpose.

June 19, 2009

ColdFusion Powered Proxyclick Feeds Locals (Including Microsoft Employees) And Wins Awards

Belgian software company Proxyclick positions itself as a "life improvement platform". Their primary application is ColdFusion powered Click'n Lunch and is used by employees at lots of local companies (including Microsoft Belgium) to order lunch and more. And the app just won the B2B BeCommerce Award 2009.


ColdFusion Functionality Exposed As Services

Have you ever stopped to think about just how much functionality is baked into ColdFusion? We use <CFQUERY> to work with databases, allowing for highly flexible and dynamic SQL as well as query caching and more, and this is powered by a sophisticated internal engine. We use tags like <CFCHART> and expect charts to be generated and displayed, without every really paying attention to the fact that an entire Java based charting engine is built in and actually doing the heavy lifting. The same is true for <CFPDF>, <CFIMAGE>, <CFSEARCH>, support for SOAP and Web Services, XMPP and JMS integration, and so much more. While most of us focus on CFML the language, the truth is that the bulk of ColdFusion, the majority of what gets installed, is not the language but the extensive array of integrated services, services that are exposed to ColdFusion via CFML tags and functions.

But what if these services could be accessed outside of ColdFusion? If a PHP developer in the next cube over needed to merge PDF files, why couldn't he invoke ColdFusion's PDF manipulation services? If a .NET developer needed to access Microsoft Exchange, why couldn't she use ColdFusion's brilliant Exchange tags (rather than having to write lots and lots of .NET code, and I do mean lots and lots)? What about the Java developer who needs to easily manipulate spreadsheet files without tinkering with low level libraries?

And while we're at it, what about the Flex developer who needs to generate an e-mail message? Flex (well, Flash) has no built in SMTP libraries, and so Flex developers who need to programmatically generate e-mail messages do so by writing code on the server. For ColdFusion developers this means creating a ColdFusion Component which accepts data from a Flex application (likely via an AMF call) and then passes that same data to a <CFMAIL> tag. In other words, code is being written on the server just to be able to pass data from Flex on the client to the <CFMAIL> tag. So why couldn't a Flex developer just invoke <CFMAIL> directly, passing it name=value pairs so it can generate an e-mail?

Well, with the upcoming ColdFusion Centaur, the answer to all of these questions is yes, these are all doable! In ColdFusion Centaur we're exposing lots of those integrated ColdFusion services via AMF (Flash Remoting) and SOAP (Web Services). The PHP, .NET, and Java developers can invoke ColdFusion built-in Web Services, pass in data, and get back results. And the Flex developer can include a ColdFusion SWC file exposing ActionScript classes and MXML tags via simple abstracted AMF calls. Simply include the SWC in your Flash Builder project, define the ColdFusion name space like this:

<mx:Application xmlns:cf="coldfusion.service.mxml.*">

and you'll have access to CFML tags within your Flex project. For example, to send an e-mail you could use the following:

<cf:Mail id="cfMail"
    to="{to.text}"
    from="{from.text}"
    subject="{subject.text}"
    content="{body.text}"
    type="html"    />

The above code creates an instance of the Mail object and names it "cfMail", and sets to, from, subject, etc., with the values of other Flex objects. To actually send the mail all you'd need is to invoke the following (possibly when a Send button is clicked):

cfMail.execute();

There is much more to this "ColdFusion as a Service" functionality, including lots more services exposed, and a sophisticated security model.

But the bottom line is that ColdFusion is now poised to become even more valuable to Flex and AIR developers, and now even of value to developers using other platforms and languages.

June 18, 2009

Rethinking MAX BOFs

I just posted some thoughts on MAX BOFs over on the Adobe MAX blog.


LiveCycle Data Services3 Now On Labs

LiveCycle Data Services 3 is now in beta and available for download on Labs. Product Manager Anil Channappa has posted details on what's new in LCDS 3.


MAX 2009 Press Release Posted

The MAX team has published their first press release announcing Adobe MAX 2009. Just be warned, the cool Flash video at the bottom of the page is loud!


Working With Spreadsheets In ColdFusion

Spreadsheets are key to just about all businesses and organizations, and ColdFusion developers have long sought a way to access and manipulate spreadsheet data programmatically. The truth is, ColdFusion has supported spreadsheet access for a while in a variety of ways, it's been possible to access Excel files from an ODBC driver, and it's been possible to generate these files using CFReport as well as by generating HTML or CSV content and then setting the appropriate MIME type to force the browser to display the data using Excel.

But ColdFusion developers have been asking for more, greater and more control, and the ability to read and write specific parts of spreadsheet files. And as I demoed in my usergroup presentations last week, this is indeed planned for ColdFusion "Centaur".

Just like we did with the ColdFusion image manipulation functionality, spreadsheets in ColdFusion are manipulated using a tag or functions, or some combination thereof. The <CFSPREADSHEET> tag is used to read a sheet from a spreadsheet file (as a spreadsheet object, a query, a CSV string, or HTML), write sheets to XLS files, and add sheets to XLS files. The over 30 supporting functions like SpreadsheetSetCellValue(), SpreadsheetAddRow(), and SpreadsheetSetCellFormula() allow for more granular spreadsheet manipulation, and can be used in conjunction with supporting functions like SpreadsheetNew() to create a new spreadsheet object, and SpreadsheetInfo() which returns title, subject, sheet names, last saved date and time, and more.

Here are some of the examples I used at my presentations. This first example reads an entire spreadsheet as a query and dumps the contents:

<!--- Read spreadsheet --->
<cfspreadsheet action="read"
                src="Sales.xls"
                query="myQuery">

<cfdump var="#myQuery#">

This next example reads a specific cell on a specific sheet and returns it in a variable:

<!--- Read a spreadsheet cell --->
<cfspreadsheet action="read"
                src="Sales.xls"
                name="myVar"
                sheet="1"
                rows="C"
                columns="3">

<cfdump var="#myVar#">

<CFSPREADSHEET> is also used to write (or overwrite) a spreadsheet, as seen here:

<!--- Write spreadsheet --->
<cfspreadsheet action="write"
    overwrite="true"
    filename="Sales.xls"
    name="sObj" />

To update a specific cell, you need to read, update, and save, like this:

<!--- Read spreadsheet --->
<cfspreadsheet action="read"
        src="Sales.xls"
        name="sObj" />

<!--- Set cell value --->
<cfset spreadsheetSetCellValue(sObj, FORM.sales, FORM.row, FORM.col)>
<!--- Write spreadsheet --->
<cfspreadsheet action="write" overwrite="true"
        filename="Sales.xls"
        name="sObj" />

This example uses form fields to specify the row, column, and value.

There's a lot more to it, but you get the idea. <CFSPREADSHEET> supports Excel and Open Office spreadsheet files.

Oh, and this one came up several times, so worth noting. Just like any other file access (for example, using <CFFILE> or <CFIMAGE>), you'd not want concurrent access, and so you'd want to use <CFLOCK> calls when accessing and manipulating spreadsheet files, read locks when reading, exclusive locks when updating, using named locks (perhaps with the spreadsheet file name as the name).

June 17, 2009

Tim Buntel Needs Help Seeking Debbie

"Debbie" is a persona, a composite character representing a type or class of developer. Lots of Flash Builder 4 features are being built with "Debbie" in mind, and Tim Buntel is asking for help finding Debbie to validate and test features. More on Tim's blog.

June 15, 2009

Fig Leaf Software Now Blogging

Longtime ColdFusion partner (as in since early Allaire days) Fig Leaf Software is now blogging, and promise lots of cf-centric content.


Acrobat.com Adds Spreadsheet And Presentation Tools

Acrobat.com has hosted Buzzword (a Flash based online word processor and collaboration tool) for a while now. And more Acrobat.com tools are on their way. Acrobat.com Labs is now offering sneak peeks at Tables (a spreadsheet) and Presentations (create presentations, duh!).

June 14, 2009

Blog Updated

Sorry for all of the comment spam many of you have been receiving. I am not sure why the parasites think that my site readers would be particularly interested in WOW Gold and Muslim Dating, but ...

I was running a rather dated version of Ray Camden's BlogCFC (my setup is a very modified version of Ray's client code, so upgrades are rather complex), and was therefore not taking advantage of many of the newer features, including much improved comment spam blocking. But, I have now updated to the latest and greatest, so hopefully comment spam is a think of the past (I said "hopefully"!). Thanks for your patience.

June 13, 2009

Usergroup Tour Week 1 Report

I presented to 4 usergroups this week, primarily focusing on ColdFusion futures (including "Bolt", the planned ColdFusion IDE) but also covering Flash Builder 4 and Flash Catalyst.

The reactions at all groups were highly consistent - enthusiasm, excitement, and lots of spontaneous applause. The big winners (measured using the rather unscientific applause-o-meter) were the spreadsheet support planned for ColdFusion "Centaur" (easily #1), ORM support, and "Bolt", as well as the Flash Builder 4 ColdFusion data integration.

I'm not presenting to any groups this coming week, but will present to the San Francisco and Toronto groups the week after that. And there are lots of other tour dates too, presented by other members of the Adobe Platform Evangelism team.

June 11, 2009

Lee Explains The Flashbelt Dead Drop

Lee Brimelow has done it again. His latest Dead Drop required inspecting mail headers, performing a SQL injection attack, following GPS coordinates, lock picking ... I am amazed every time someone actually solves one of these things! But, someone did indeed solve it, and now Lee explains all.


NYC Rocked, Minneapolis Is Next

Last night's usergroup event in NYC was incredible! A crowd of about 120 packed one of the beautiful new conference facilities at NYU Medical Center, and we chatted for over 2 hours about ColdFusion, Flex, Flash Catalyst, and more. The crowd was amazing, dozens of questions and comments and interruptions before I had even gotten to the second feature! The crowd was so involved and engaged and enthusiastic that I actually had to ask them to stop the questions a couple of time so as to get to the next topic, and that does not happen often.

Thanks to Ben Nadel and Clark Valberg and crew for putting together an incredible event, complete with top notch catered food (sandwiches, sushi, and even ColdFusion branded cupcakes)! Oh, and sorry about the late start (darned NYC construction crews and cabbies who are unaware of them).

Next up, flying to Minneapolis for tonight's session to the Twin Cities ColdFusion Usergroup.

June 10, 2009

Next Up Is NYC

Yesterday's usergroup presentation in Washington, D.C. went very well. Lots of excitement, good (and some tough) questions, and the interactivity I've come to expect from this group. What I did not expect was the poor turnout, this has been one of the best attended groups for over a decade, and yesterday's numbers were the lowest I have seen for this group. That was quite a disappointment, but I'll chalk it up to the suddenly nasty weather (which also wreaked havoc on flight in the area).

After the presentation I was treated to a tour of the White House. I got to follow the standard tour, through the Red Room, Green Room, Blue Room (RGB colored rooms, interesting), the State Dining Room, and more. I also got to look into lots of other rooms, including the Cabinet Room and the Oval Office. And then I got to see parts of the White House compound not on the official tour. The experience was entirely surreal, and rather awe inspiring (despite the fact that every room felt smaller than how I had envisioned it from pictures).

I am now in NYC, parked in the Adobe office so as to get some work done. This evening Adam Lehman and I will be presenting to a join session of the NYCFUG and the local Flex usergroup. Once again, I am looking forward to great turnout and the loud interactive session that this group has always delivered. I hope to see you there!

  © Copyright 1997-2009 Ben Forta, All Rights Reserved