May 16, 2008

Pages


Search Site


Topics


Useful Links

Blogs I Read


Archives

Entries for month: May 2007

The Most Important Enhancement in ColdFusion 8

May 31 2007 by Andrew Powell
ColdFusion 8 has a TON of new features, and they're all great. Some will help productivity and some will help with the GUI. However, there are a number of CFML enhancements that nobody has really talked about. For me, one stands head and shoulders above them all. It is the single most important enhancement to CFML since the introduction of CFCs. What is it? duplicate() now works on CFCs. Let's stop and say that one more time, for effect. duplicate() now works on CFCs. What does this mean? It means, in geek speak, that we can clone or create a deep copy of a CFC. Until now, you could only pass CFCs around by reference (a pointer to the memory space occupied by the object) instead of by value. This will allow ColdFusion developers to do things like keep value objects in the application scope and take copies of them, when needed, for singletons. Now, instead of going to createObject() each time we need a new object, we simply read the object out memory as a copy. A sample init function within a cfc (we'll call this one foo.cfc and assume it's in the root, for the sake of brevity) might look like this: <cffunction name="init" access="public" output="false" returntype="foo">
<cfargument name="argumentA" type="string" required="true"/>
<cfargument name="argumentB" type="numeric" required="true"/>
<cfscript>
var returnObject = duplicate(this);
returnObject.setPropertyA(arguments.argumentA);
returnObject.setPropertyB(arguments.argumentB);
return returnObject;
</cfscript>
</cffunction>
This enhancement could have a lot of impact on the various frameworks out there (Peter, Matt, & Kurt are you paying attention?). There's a lot of createObject() going on in Mach-II, ColdSpring, Model-Glue, etc. This has the potential to help speed up your favourite framework, so applications you already have can benefit from this new feature once the frameworks are updated to use it. To me, this is, easily, the most important new feature of ColdFusion 8. Well, this and CFTHREAD (no flame wars please Vince & Damon), but that's another post.

Posted in ColdFusion | General | ColdSpring | Adobe | Mach-II | 6 comments

Has Anyone Heard Anything About CF8 Lately?

May 30 2007 by Andrew Powell
Was wondering if anyone had blogged about CF8 recently. Has there been any significant activity lately? ;-) Inspired by....

Posted in ColdFusion | Adobe | 0 comments

Spry Autosuggest with JSON Dataset

May 23 2007 by Andrew Powell
Ray and I were chatting about Spry autosuggests earlier today and were wondering if the autosuggest would work with a JSON dataset in lieu of a XML dataset. We figured there was no reason why it shouldn't, if it acts like a regular dataset. So I set off on a mission to figure out if it would work. It does. With apologies to Ray, I borrowed the basis of his code to do my own autosuggest sample: <link href="/assets/css/SpryAutoSuggest.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/javascript" src="/assets/js/spry/xpath.js"></script>
<script language="JavaScript" type="text/javascript" src="/assets/js/spry/SpryData.js"></script>
<script language="JavaScript" type="text/javascript" src="/assets/js/spry/SpryAutoSuggest.js"></script>
<script language="JavaScript" type="text/javascript" src="/assets/js/spry/SpryJSONDataSet.js"></script>
<script>
var dsTeams = new Spry.Data.JSONDataSet("getJSON.cfm");
</script>
<style>
.highlight   {
   background-color: yellow;
}
</style>
<div id="mySuggest">
   Start typing a player's name to activate the autosuggest: <br/>
   <input type="text" name="search" />
   <div id="resultsDIV" spry:region="dsTeams">
      <span spry:repeat="dsTeams" spry:suggest="{column0}">{column0}<br /></span>   
   </div>
</div>

<script type="text/javascript">
var theSuggest = new Spry.Widget.AutoSuggest("mySuggest","resultsDIV", "dsTeams","column0",
{hoverSuggestClass:'highlight',minCharsType:2,loadFromServer:true,urlParam:'input',containsString:false});
</script>
UPDATE: Here is the code for the JSON Generator: <cfparam name="input" default=""/>

<cfquery datasource="demos" name="players">
SELECT name FROM players WHERE name LIKE '#URL.INPUT#%' ORDER BY name
</cfquery>

<cfset jsonService = createObject('component','autoSuggestWithJSON.json')/>

<cfset retArray = arrayNew(1)>
   
<cfloop query="players">
   <cfset arrayAppend(retArray,players.name)/>
</cfloop>

<cfcontent type="application/json">
<cfoutput>#jsonService.encode(retArray)#</cfoutput>
Working Sample

Posted in ColdFusion | Spry | Adobe | JSON | AJAX | 15 comments

Spry 1.5 Samples

May 18 2007 by Andrew Powell
As you probably already know, Spry 1.5 is officially released now. A few months ago, I posted some Spry 1.5/ ColdFusion samples that flew under the radar. Here are the links again: Nested JSON DataSets JSON DataSet Both of these examples make use of the CFJSON CFC that is available for your use. It lets you serialize and de-serialize JSON before Scorpio even hits the street! You can see working samples of how to build these and other samples of using CF & Spry at my session at CFUnited.

Posted in ColdFusion | Spry | Adobe | XML | AJAX | 0 comments

Are Custom Tags A Lost Art?

May 18 2007 by Andrew Powell
After I gave my presentation a couple of weeks ago at cf.Objective(), Peter Farrell came up to me and mentioned that he thought custom tags were a lost art, and not very useful anymore, until he saw my presentation. That made me think. Are custom tags really a lost art? Have we gotten so immersed in our OO thought patterns that we no longer stop to think what custom tags can do for us when architecting applications?

Read more...

Posted in ColdFusion | General | Conferences | Adobe | AJAX | 6 comments