<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dan's Drivelings</title>
	<atom:link href="http://dan.skaggsfamily.ws/feed/" rel="self" type="application/rss+xml" />
	<link>http://dan.skaggsfamily.ws</link>
	<description>Random Thoughts of a Techno-Hermit</description>
	<lastBuildDate>Mon, 19 Jul 2010 16:26:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Returning ColdFusion 9 ORM objects with JSON</title>
		<link>http://dan.skaggsfamily.ws/2010/07/19/returning-coldfusion-9-orm-objects-with-json/</link>
		<comments>http://dan.skaggsfamily.ws/2010/07/19/returning-coldfusion-9-orm-objects-with-json/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 16:26:26 +0000</pubDate>
		<dc:creator>Dan Skaggs</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://dan.skaggsfamily.ws/?p=413</guid>
		<description><![CDATA[Last week I was working on a client&#8217;s project that makes heavy use of ColdFusion 9&#8242;s ORM features. Everything we&#8217;d done with ORM up to that point had been going really well and I continue to be impressed by the amount of time ORM saves me in development. I had gotten to a point in [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I was working on a client&#8217;s project that makes heavy use of ColdFusion 9&#8242;s ORM features. Everything we&#8217;d done with ORM up to that point had been going really well and I continue to be impressed by the amount of time ORM saves me in development. I had gotten to a point in the project where I needed to be able to use AJAX calls from jQuery to manage some of the data in the database. Based on my experiences using a RemoteFacade.cfc to feed data to a Flex app, I thought it should be pretty easy. Several hours later, I realized that my particular use case for this was anything but easy.<br />
<span id="more-413"></span></p>
<p>What I eventually found was, when trying to load an object using an AJAX call to RemoteFacade.cfc, any object that had a property that was an array of other objects was not returned to Javascript. It wasn&#8217;t even that it was sent across as an empty property. The property absolutely didn&#8217;t exist in the JSON returned by the CFC. I used the ColdFusion debugger to verify that the array existing in the object immediately prior to the &lt;cfreturn&gt; statement and then examined the JSON return using Charles Proxy only to find out that those properties weren&#8217;t in the JSON.  All the normal string, numeric, date, etc type properties were returned just fine, but any properties composed of other objects were missing.</p>
<p>As near as I can tell, the culprit is the serializeJSON() method that ColdFusion uses to convert complex objects into JSON notation. It doesn&#8217;t seem to work correctly on ORM objects. To test my theory, I manually built a structure and inserted each simple property from the ORM object. I then created a key in the structure that was an array and manually populated several items in the array each with a structure of data. When I returned that from the CFC as JSON, the array and all the structures it contained came across the wire just fine.</p>
<p>I&#8217;m not sure if this is a bug in the serializeJSON() method or if serializeJSON() wasn&#8217;t meant to handle objects. Whatever the case, this issue leads to quite a bit of extra work if you need to return an object via JSON and include its properties that are composed of other objects. I&#8217;d definitely be interested in hearing from anyone who has successfully done this with ORM and AJAX to see if I&#8217;ve done something incorrectly in my code.</p>
]]></content:encoded>
			<wfw:commentRss>http://dan.skaggsfamily.ws/2010/07/19/returning-coldfusion-9-orm-objects-with-json/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Building Advanced Workflows with ColdSpring at cf.Obective()</title>
		<link>http://dan.skaggsfamily.ws/2010/04/24/building-advanced-workflows-with-coldspring-at-cf-obective/</link>
		<comments>http://dan.skaggsfamily.ws/2010/04/24/building-advanced-workflows-with-coldspring-at-cf-obective/#comments</comments>
		<pubDate>Sat, 24 Apr 2010 22:53:03 +0000</pubDate>
		<dc:creator>Dan Skaggs</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[ColdSpring]]></category>
		<category><![CDATA[cf.Objective()]]></category>

		<guid isPermaLink="false">http://dan.skaggsfamily.ws/?p=406</guid>
		<description><![CDATA[Thanks to all the folks that came to my Advanced Workflows with ColdSpring session today at cf.Objective(). The conference this year was outstanding and I&#8217;m honored to have been chosen to speak. If you&#8217;re interested in getting the slides and code, I&#8217;ve uploaded a zip file that includes everything I used in the session.]]></description>
			<content:encoded><![CDATA[<p>Thanks to all the folks that came to my Advanced Workflows with ColdSpring session today at cf.Objective(). The conference this year was outstanding and I&#8217;m honored to have been chosen to speak.  If you&#8217;re interested in getting the slides and code, I&#8217;ve uploaded a <a href='http://dan.skaggsfamily.ws/wp-content/uploads/2010/04/cfObjective-Building-Advanced-Workflows-with-ColdSpring.zip'>zip file</a> that includes everything I used in the session.</p>
<p><object height="425" width="550"><param name="movie" value="http://slidesix.com/viewer/SlideSixViewer.swf?alias=Building-Advanced-Workflows-with-ColdSpring" /><param name="menu" value="false"/><param name="scale" value="noScale"/><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always" /><param value="transparent" name="wmode" /><param value="quality" name="best" /><embed src="http://slidesix.com/viewer/SlideSixViewer.swf?alias=Building-Advanced-Workflows-with-ColdSpring" allowscriptaccess="always" allowFullScreen="true" height="425" width="550" type="application/x-shockwave-flash" wmode="transparent" quality="best" /></object></p>
]]></content:encoded>
			<wfw:commentRss>http://dan.skaggsfamily.ws/2010/04/24/building-advanced-workflows-with-coldspring-at-cf-obective/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Embracing &#8220;New&#8221; in ColdFusion 9</title>
		<link>http://dan.skaggsfamily.ws/2010/04/16/embracing-new-in-coldfusion-9/</link>
		<comments>http://dan.skaggsfamily.ws/2010/04/16/embracing-new-in-coldfusion-9/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 17:54:08 +0000</pubDate>
		<dc:creator>Dan Skaggs</dc:creator>
				<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://dan.skaggsfamily.ws/?p=395</guid>
		<description><![CDATA[I&#8217;m not sure how I missed this before but among the long list of things added to ColdFusion 9 is the ability to create a CFC using the &#8220;New&#8221; syntax. Up until now, to create a new object from a CFC we&#8217;d use the createObject() method like so &#60;cfset Team = createObject&#40;&#34;component&#34;, &#34;model.Team&#34;&#41; /&#62; Now, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not sure how I missed this before but among the long list of things added to ColdFusion 9 is the ability to create a CFC using the &#8220;New&#8221; syntax. Up until now, to create a new object from a CFC we&#8217;d use the createObject() method like so</p>

<div class="wp_syntax"><div class="code"><pre class="cfm" style="font-family:monospace;"><span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> Team <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">createObject</span><span style="color: #0000FF;">&#40;</span><span style="color: #009900;">&quot;component&quot;</span>, <span style="color: #009900;">&quot;model.Team&quot;</span><span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF;">/&gt;</span></span></pre></div></div>

<p>Now, using the New keyword, we can shorten that to</p>

<div class="wp_syntax"><div class="code"><pre class="cfm" style="font-family:monospace;"><span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> Team <span style="color: #0000FF;">=</span> New model.Team<span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF;">/&gt;</span></span></pre></div></div>

<p><strong>But wait, there&#8217;s more! </strong><br />
When you use the New keyword, ColdFusion will automatically look for and run any init() method that exists in the CFC. It also respects any arguments that your init() method specifies, meaning that if you have a Team.init() method that can accept team name, color and manager arguments, you can build them right into your the same line of code used to create your object like so</p>

<div class="wp_syntax"><div class="code"><pre class="cfm" style="font-family:monospace;"><span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> Team <span style="color: #0000FF;">=</span> New model.Team<span style="color: #0000FF;">&#40;</span> <span style="color: #009900;">&quot;Bumblebees&quot;</span>, <span style="color: #009900;">&quot;Yellow&quot;</span>, <span style="color: #009900;">&quot;Benny Bee&quot;</span> <span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF;">/&gt;</span></span></pre></div></div>

<p>Likewise, as you&#8217;d expect, named arguments are still supported. So if you had to send in arguments out of order or needed to omit some optional arguments at object creation, you could do</p>

<div class="wp_syntax"><div class="code"><pre class="cfm" style="font-family:monospace;"><span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> Team <span style="color: #0000FF;">=</span> New model.Team<span style="color: #0000FF;">&#40;</span></span>
<span style="color: #333333;">              manager<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;Benny Bee&quot;</span>,</span>
<span style="color: #333333;">              <span style="color: #0000FF;">color</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;Yellow&quot;</span>,</span>
<span style="color: #333333;">              <span style="color: #0000FF;">name</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;Bumblebees&quot;</span><span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF;">/&gt;</span></span></pre></div></div>

<p>I personally am going to make a point to start using this in my code because I can never seem to spell the word &#8220;component&#8221; correctly in the createObject() method.</p>
]]></content:encoded>
			<wfw:commentRss>http://dan.skaggsfamily.ws/2010/04/16/embracing-new-in-coldfusion-9/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>My ColdFusion Anniversary</title>
		<link>http://dan.skaggsfamily.ws/2010/03/18/my-coldfusion-anniversary/</link>
		<comments>http://dan.skaggsfamily.ws/2010/03/18/my-coldfusion-anniversary/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 12:41:33 +0000</pubDate>
		<dc:creator>Dan Skaggs</dc:creator>
				<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://dan.skaggsfamily.ws/?p=383</guid>
		<description><![CDATA[Well, not quite yet, but since I&#8217;m going to be out of pocket the next several days, I wanted to put this out now. Monday, March 22 will mark 10 years since I began my &#8220;journey&#8221; with ColdFusion. That day in 2000 was my first day in a class called &#8220;Fast Track to ColdFusion&#8221;. The [...]]]></description>
			<content:encoded><![CDATA[<p>Well, not quite yet, but since I&#8217;m going to be out of pocket the next several days, I wanted to put this out now.  Monday, March 22 will mark 10 years since I began my &#8220;journey&#8221; with ColdFusion.  That day in 2000 was my first day in a class called &#8220;Fast Track to ColdFusion&#8221;. </p>
<p>The class was taught by <a href="http://www.linkedin.com/in/seanhedenskog" target="_blank">Sean Hedenskog</a> in San Jose, CA where the headquarters for the company I was working for at the time was located.  That company had decided on Allaire Spectra 1.0 as the basis for an enterprise content management system so several of us went through the Fast Track to ColdFusion course in preparation for Spectra training some weeks later.<br />
<span id="more-383"></span></p>
<p>I know there are are a lot of people out there who have more time with ColdFusion than I do. I started with version 4.5 and, if memory serves, our company was one of the first to deploy ColdFusion and Spectra onto Solaris-based servers. Even so, I feel like I&#8217;m somewhat of an old-timer these days. That&#8217;s a good thing however, since it means we&#8217;re getting more and more new people using ColdFusion.</p>
<p>A lot has changed in the 10 years since I started that class. Coming from a strictly HTML background with a little bit of classic ASP thrown in, even the beginner class posed quite a challenge for me. Simple things we don&#8217;t give second thoughts to such as calling a custom tag (there were no UDFs or CFCs then remember) were hard for me to get my head around. I remember having an especially difficult time trying to figure out how arrays and structures worked</p>
<p>Along the way I&#8217;ve been privileged to associate with some very talented and helpful folks. Not long after we started the Spectra project, my company brought in some folks from the Allaire consulting group. <a href="http://www.linkedin.com/in/mattstevanus" target="_blank">Matt Stevanus</a> was one of those folks and quickly became a great friend and mentor. We kept in touch periodically after that project was over and a little over 3 years ago I got the opportunity to work with Matt again when I started consulting with <a href="http://www.universalmind.com" target="_blank">Universal Mind</a>.</p>
<p>A couple years ago I met another guy who would help shape my professional career&#8211;<a href="http://www.nodans.com" target="_blank">Dan Wilson</a>. Dan is widely known these days as a driving force behind the <a href="http://www.model-glue.com" target="_blank">ModelGlue</a> project. Dan and I had an opportunity to work on a long-term project together and he and I&#8217;ve enjoyed working with him on various things ever since. It was Dan that really got me over the &#8220;OO hump&#8221;, convinced me that I needed to start blogging more and to submit topics to various conferences to speak on. </p>
<p>Finally, there are dozens of people out in the ColdFusion community doing blog posts, open source projects, MeetUps and more that have contributed to my success. To everyone, I say a hearty &#8220;THANKS!&#8221; (and my mortgage company loves you too).</p>
<p>So, here&#8217;s looking back at a great 10 years while looking forward to many more ahead!</p>
]]></content:encoded>
			<wfw:commentRss>http://dan.skaggsfamily.ws/2010/03/18/my-coldfusion-anniversary/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Can you code with 9 fingers?</title>
		<link>http://dan.skaggsfamily.ws/2010/02/22/can-you-code-with-9-fingers/</link>
		<comments>http://dan.skaggsfamily.ws/2010/02/22/can-you-code-with-9-fingers/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 18:19:45 +0000</pubDate>
		<dc:creator>Dan Skaggs</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://dan.skaggsfamily.ws/?p=375</guid>
		<description><![CDATA[That&#8217;s what I&#8217;m doing today thanks to a relatively freak accident with a staple gun yesterday. I won&#8217;t bore you with the details (that would confirm what a bonehead I can be sometimes). Just suffice it to say that, it could have been a lot worse.]]></description>
			<content:encoded><![CDATA[<p>That&#8217;s what I&#8217;m doing today thanks to a relatively freak accident with a staple gun yesterday. I won&#8217;t bore you with the details (that would confirm what a bonehead I can be sometimes). Just suffice it to say that, it could have been a lot worse.</p>

<a href='http://dan.skaggsfamily.ws/2010/02/22/can-you-code-with-9-fingers/staple/' title='staple'><img width="150" height="150" src="http://dan.skaggsfamily.ws/wp-content/uploads/2010/02/staple-150x150.jpg" class="attachment-thumbnail" alt="staple" title="staple" /></a>
<a href='http://dan.skaggsfamily.ws/2010/02/22/can-you-code-with-9-fingers/xray1/' title='xray1'><img width="150" height="150" src="http://dan.skaggsfamily.ws/wp-content/uploads/2010/02/xray1-150x150.jpg" class="attachment-thumbnail" alt="xray1" title="xray1" /></a>
<a href='http://dan.skaggsfamily.ws/2010/02/22/can-you-code-with-9-fingers/xray2/' title='xray2'><img width="150" height="150" src="http://dan.skaggsfamily.ws/wp-content/uploads/2010/02/xray2-150x150.jpg" class="attachment-thumbnail" alt="xray2" title="xray2" /></a>
<a href='http://dan.skaggsfamily.ws/2010/02/22/can-you-code-with-9-fingers/xray3/' title='xray3'><img width="150" height="150" src="http://dan.skaggsfamily.ws/wp-content/uploads/2010/02/xray3-150x150.jpg" class="attachment-thumbnail" alt="xray3" title="xray3" /></a>

]]></content:encoded>
			<wfw:commentRss>http://dan.skaggsfamily.ws/2010/02/22/can-you-code-with-9-fingers/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Be careful with the &#8216;local&#8217; scope when migrating from CF8 to CF9</title>
		<link>http://dan.skaggsfamily.ws/2010/02/08/be-careful-with-the-local-scope-when-migrating-from-cf8-to-cf9/</link>
		<comments>http://dan.skaggsfamily.ws/2010/02/08/be-careful-with-the-local-scope-when-migrating-from-cf8-to-cf9/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 14:24:15 +0000</pubDate>
		<dc:creator>Dan Skaggs</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://dan.skaggsfamily.ws/?p=355</guid>
		<description><![CDATA[One of the really nice &#8220;fixes&#8221; included in ColdFusion 9 from a developer&#8217;s perspective is the inclusion of an implicit &#8220;local&#8221; variable scope into which variables created within the body of a &#60;cffunction&#62; tag are placed by default. Previously, developers had to manually add a &#8220;var&#8221; keyword to variables that should only exist within the [...]]]></description>
			<content:encoded><![CDATA[<p>One of the really nice &#8220;fixes&#8221; included in ColdFusion 9 from a developer&#8217;s perspective is the inclusion of an implicit &#8220;local&#8221; variable scope into which variables created within the body of a &lt;cffunction&gt; tag are placed by default. Previously, developers had to manually add a &#8220;var&#8221; keyword to variables that should only exist within the confines of the function.</p>
<p>One of the ways of simplifying this that gained some traction among various developers prior to the release of ColdFusion 9 was to &#8220;var&#8221; a single variable at the top of the function as an empty structure then store any additional variables needed in the function inside it. Many folks, myself included, named this structure &#8220;local&#8221; so that it would be readily apparent that the values inside were local to that function. This approach worked fine and dandy on ColdFusion 8 and below.<br />
<span id="more-355"></span></p>
<p>I recently migrated one of my clients to ColdFusion 9 and not long after the client started getting isolated reports from his people having javascript errors in a data management application that uses AJAX-driven forms talking to CFCs.  At first these were very isolated and we weren&#8217;t able to reproduce the error, but, as time went on, the reports became more widespread. As I was troubleshooting this over the weekend, I discovered that we were getting javascript errors when trying to interact with this RemoteFacade CFC about 40% of the time.</p>
<p>Using <a href="http://www.getfirebug.com" target="_blank">Firebug</a>, I was able to watch the results come back from ColdFusion and noticed a very odd trend. Approximately 60% of the time, the JSON returned from the remote CFC call was as expected. In the other 40%, one of the main data structure names was an arbitrary, machine-generated name instead of the name we had specified in the code.</p>
<p>Here is an example of what we were expecting in the JSON returned from the RemoteFacade.cfc method:</p>

<div class="wp_syntax"><div class="code"><pre class="json" style="font-family:monospace;">{&quot;DATA&quot;:{&quot;CANEDIT&quot;:true,&quot;RECORDDATA&quot;:{&quot;Field1&quot;:&quot;value1&quot;} } }</pre></div></div>

<p>This is an example of what we would get back from the same request when we would see the javascript errors</p>

<div class="wp_syntax"><div class="code"><pre class="json" style="font-family:monospace;">{&quot;___IMPLICITARRYSTRUCTVAR5&quot;:{&quot;CANEDIT&quot;:true,&quot;RECORDDATA&quot;:{&quot;Field1&quot;:&quot;value1&quot;} } }</pre></div></div>

<p>See the difference?  Our &#8220;DATA&#8221; key was named completely differently which caused javascript to throw some error saying that variableName.DATA did not exist.</p>
<p>After looking over the ColdFusion code for quite a while and doing some step debugging with <a href="http://www.fusion-debug.com" target="_blank">FusionDebug</a> I had an idea.  I changed all the function-specific structures I had been using from:</p>

<div class="wp_syntax"><div class="code"><pre class="cfm" style="font-family:monospace;"><span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> <span style="color: #000000; font-weight: bold;">var</span> local <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">structNew</span><span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF;">/&gt;</span></span>
   ....
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfreturn</span> local <span style="color: #0000FF;">/&gt;</span></span></pre></div></div>

<p>to:</p>

<div class="wp_syntax"><div class="code"><pre class="cfm" style="font-family:monospace;"><span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> <span style="color: #000000; font-weight: bold;">var</span> ret <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">structNew</span><span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF;">/&gt;</span></span>
   ....
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfreturn</span> ret <span style="color: #0000FF;">/&gt;</span></span></pre></div></div>

<p>Once I changed those throughout the code base and reinitialized my application, all the javascript errors that we&#8217;d been experiencing across multiple request types went completely away.</p>
<p>I have an unconfirmed theory that in using the name &#8220;local&#8221; for my structure, ColdFusion was sometimes getting &#8220;confused&#8221; on what to return&#8211;ColdFusion&#8217;s built-in local scope or the method-specific variable I had named local. I don&#8217;t really have any way to prove that beyond a shadow of a doubt, but when I made the change, all my errors went away, so I decided chalk it up as a lesson learned for future development and move on to the next problem.  Needless to say the client was happy that the issue was fixed and I can say I learned something that day.</p>
]]></content:encoded>
			<wfw:commentRss>http://dan.skaggsfamily.ws/2010/02/08/be-careful-with-the-local-scope-when-migrating-from-cf8-to-cf9/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>jQuery head-scratcher and lesson learned</title>
		<link>http://dan.skaggsfamily.ws/2010/02/01/jquery-head-scratcher/</link>
		<comments>http://dan.skaggsfamily.ws/2010/02/01/jquery-head-scratcher/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 15:42:02 +0000</pubDate>
		<dc:creator>Dan Skaggs</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[ModelGlue]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://dan.skaggsfamily.ws/?p=343</guid>
		<description><![CDATA[As I mentioned in my last post, I&#8217;m working on a pet project in my spare time. It uses jQuery in various places including in the site design template that I purchased to use with the site. The template uses jQuery to expand and collapse menu items in the left sidebar to show sub items [...]]]></description>
			<content:encoded><![CDATA[<p>As I mentioned in my <a href="http://dan.skaggsfamily.ws/2010/01/31/coldfusion-9-caching-settings-to-watch-out-for">last post</a>, I&#8217;m working on a pet project in my spare time. It uses <a href="http://www.jquery.com" target="_blank">jQuery</a> in various places including in the site design template that I purchased to use with the site. The template uses jQuery to expand and collapse menu items in the left sidebar to show sub items for that selection. Because of this, jQuery and a javascript file named custom.js was included in the template.  After breaking the template apart to work inside my <a href="http://www.model-glue.com" target="_blank">ModelGlue</a> application, I started implementing some other features that used jQuery with their own associated javascript files, one of which was <a href="http://cfuniform.riaforge.org" target="_blank">cfUniform</a>.</p>
<p>As soon as I put the cfUniform code into the page, I started getting javascript errors in the console pane of Firebug. The error would state something similar to &#8220;$(document) not a function&#8221; or &#8220;$ not a function&#8221;.  Now, I&#8217;ve not had a ton of experience with jQuery, but I have used several pre-built jQuery plugins in sites before and I had seen errors similar to this.  Normally this error is caused by one of two issues.  Either a) you&#8217;ve forgotten to include the script block to load the jQuery library or b) your code is loading the jQuery library twice.</p>
<p>I was able to use <a href="http://www.getfirebug.com" target="_blank">Firebug</a> to verify that I was indeed loading it and loading it only once but couldn&#8217;t for the life of me figure out why I was getting an error. Obviously cfUniform wasn&#8217;t really at fault (the error pointed to a line in one of the cfUniform javascript files) so I knew it had to be something on my side.  I did some searching on the phrase and found some discussions around jQuery&#8217;s noConflict() feature that allows you to reference jQuery with a notation other than using the familiar &#8220;$&#8221;.  </p>
<p>After reading for a while, I opened the custom.js file that came with the site template and found the code below:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">jQuery.<span style="color: #660066;">noConflict</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
jQuery<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
   <span style="color: #006600; font-style: italic;">//contents snipped</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Since I&#8217;m not using any other javascript libraries in this application that might conflict with using the &#8220;$&#8221; to access jQuery, I removed the noConflict() line, but that didn&#8217;t fix my problem. On a hunch I did a search/replace through the custom.js file replacing &#8220;jQuery(&#8221; with &#8220;$(&#8221; so that references to the jQuery library in this file would be accessed with the same syntax as in all the other javascript files. Lo and behold, all my errors in Firebug&#8217;s console went away and CFUniform began behaving as expected.</p>
<p>While I don&#8217;t understand all the underpinnings of why this worked, I&#8217;ll take it as my &#8220;lesson for the day&#8221; that in the future I need to always make sure that all the various jQuery plugins and code that is used in my applications need to reference the jQuery library with the same syntax.</p>
]]></content:encoded>
			<wfw:commentRss>http://dan.skaggsfamily.ws/2010/02/01/jquery-head-scratcher/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ColdFusion 9 caching settings to watch out for</title>
		<link>http://dan.skaggsfamily.ws/2010/01/31/coldfusion-9-caching-settings-to-watch-out-for/</link>
		<comments>http://dan.skaggsfamily.ws/2010/01/31/coldfusion-9-caching-settings-to-watch-out-for/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 15:14:09 +0000</pubDate>
		<dc:creator>Dan Skaggs</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[ModelGlue]]></category>

		<guid isPermaLink="false">http://dan.skaggsfamily.ws/?p=340</guid>
		<description><![CDATA[Like a lot of developers, I&#8217;ve got this pet project I&#8217;m working on in whatever spare time I can find between client engagements, home maintenance, family obligations, etc. I&#8217;m using it as an opportunity to work with some of the new features of ColdFusion 9 (ORM mainly), ColdFusion Builder Beta and features in development for [...]]]></description>
			<content:encoded><![CDATA[<p>Like a lot of developers, I&#8217;ve got this pet project I&#8217;m working on in whatever spare time I can find between client engagements, home maintenance, family obligations, etc.  I&#8217;m using it as an opportunity to work with some of the new features of ColdFusion 9 (ORM mainly), ColdFusion Builder Beta and features in development for the next release of <a href="http://www.model-glue.com" target="_blank">ModelGlue 3</a>.</p>
<p>Recently, <a href="http://www.silverwareconsulting.com/" target="_blank">Bob Silverburg</a> has been working on a significant overhaul of the scaffolding feature used by ModelGlue to automatically create CRUD forms for the various data objects in your application. Particularly exciting to me is that you can now override the built-in code templates with your own. Bob wrote a proof-of-concept application that uses the excellent <a href="http://cfuniform.riaforge.org/" target="_blank">cfUniform</a> custom tag library to build standardized forms and validations (see my <a href="http://dan.skaggsfamily.ws/2009/04/29/standardizing-html-forms-with-the-cfuniform-custom-tag-library/">previous post</a> on cfUniform if you&#8217;re not familiar with it). Since I&#8217;m pretty particular about how my project files are arranged, I proceeded to place the css, javascript and image assets into the folders where I wanted them and use ColdSpring to create a configuration bean to pass to cfUniform when I called it. That&#8217;s where the trouble began.</p>
<p>I had to make a couple of changes to the code generated in the custom scaffold CFC in order to have cfUniform see the custom configuration that I had set up. No matter what I did, when the scaffolding engine generated the code for the view and the XML fragment for the event-handler, the changes I made inside the CFC weren&#8217;t included. I spent a couple hours scratching my head, tracing the request cycle, restarting my local ColdFusion instance and always got the exact same code that was in Bob&#8217;s original example CFC. Finally, I decided to change the name of the CFC and update the associated bean configuration in ColdSpring. On the next refresh, I saw my changes reflected in the code generated by the scaffold!</p>
<p>With that in mind, I checked the settings on the Caching page of that instance&#8217;s CF Administrator. Sure enough, the Cache Template In Request,  Component cache, and Save class files options were checked.  I cleared those check boxes, pressed the Clear Template Cache Now and Clear Component Cache Now buttons below and have had no trouble since. Obviously there are situations where you want these enabled, but rarely ever should they be needed on a local system being used for development.</p>
<p>So, the moral of my painful story&#8211;if you&#8217;re making changes to code that&#8217;s not being reflected when you test browse your application, don&#8217;t forget to check the settings on the Caching page in CF Admin. It just might save you a couple hours and a few gray hairs.</p>
]]></content:encoded>
			<wfw:commentRss>http://dan.skaggsfamily.ws/2010/01/31/coldfusion-9-caching-settings-to-watch-out-for/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Going beyond CFPDF with iText</title>
		<link>http://dan.skaggsfamily.ws/2009/11/19/going-beyond-cfpdf-with-itext/</link>
		<comments>http://dan.skaggsfamily.ws/2009/11/19/going-beyond-cfpdf-with-itext/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 15:39:15 +0000</pubDate>
		<dc:creator>Dan Skaggs</dc:creator>
				<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://dan.skaggsfamily.ws/?p=323</guid>
		<description><![CDATA[This week I was working on a proof-of-concept for a customer in which we wanted to extract attachments from a fillable PDF form after its submission. After trying the usual CFPDF tags, reading the documentation, and getting nowhere, we decided to try to attempt to use the iText PDF library for Java from within ColdFusion [...]]]></description>
			<content:encoded><![CDATA[<p>This week I was working on a proof-of-concept for a customer in which we wanted to extract attachments from a fillable PDF form after its submission. After trying the usual CFPDF tags, reading the documentation, and getting nowhere, we decided to try to attempt to use the <a href="http://www.lowagie.com/iText/" target="_blank">iText PDF library for Java</a> from within ColdFusion to extract the attachments.</p>
<p>After doing some reading through the JavaDocs for iText, I found that it includes a class called ExtractAttachments that &#8220;&#8230;lets you extract the attachemnts of a PDF.&#8221;  Since this is precisely what we wanted to do, I thought for sure this would be a simple affair and I&#8217;d be able to finish what I needed to do and turn in early for the evening.  Not quite!<br />
<span id="more-323"></span><br />
I downloaded Mark Mandel&#8217;s excellent <a href="http://javaloader.riaforge.org/" target="_blank">JavaLoader project</a> and dropped it into my webroot. Then I grabbed the <a href="http://www.lowagie.com/iText/download.html" target="_blank">2 JAR files</a> from iText that I needed and put them in a folder named &#8220;lib&#8221; in the web root (remember this is a POC so I didn&#8217;t mind having that stuff in the web root).</p>
<p>Making the classes contained in the JARs available to ColdFusion was a snap thanks to JavaLoader.  You create an array of paths to your JAR files (in my case&#8211;it also works with directories of class files) and pass that into the constructor for JavaLoader like so:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="cfm" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!--- Build an array of JAR files that JavaLoader should reference ---&gt;</span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> loadPaths <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">arrayNew</span><span style="color: #0000FF;">&#40;</span><span style="color: #FF0000;">1</span><span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF;">/&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> <span style="color: #0000FF;">arrayAppend</span><span style="color: #0000FF;">&#40;</span> loadPaths, <span style="color: #0000FF;">expandPath</span><span style="color: #0000FF;">&#40;</span><span style="color: #009900;">&quot;/lib/iText-2.1.7.jar&quot;</span><span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF;">&#41;</span><span style="color: #0000FF;">/&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> <span style="color: #0000FF;">arrayAppend</span><span style="color: #0000FF;">&#40;</span> loadPaths, <span style="color: #0000FF;">expandPath</span><span style="color: #0000FF;">&#40;</span><span style="color: #009900;">&quot;/lib/iText-toolbox-2.1.7.jar&quot;</span><span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF;">&#41;</span><span style="color: #0000FF;">/&gt;</span></span>
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!--- Create the JavaLoader object to dynamically load Java classes ---&gt;</span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> loader <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">createObject</span><span style="color: #0000FF;">&#40;</span><span style="color: #009900;">&quot;component&quot;</span>, <span style="color: #009900;">&quot;javaloader.JavaLoader&quot;</span><span style="color: #0000FF;">&#41;</span></span>
<span style="color: #333333;">                .init<span style="color: #0000FF;">&#40;</span>loadPaths<span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF;">/&gt;</span></span></pre></td></tr></table></div>

<p>Once the classes were available, it was very simple to get an instance of the ExtractAttachments class created.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="cfm" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!--- Create the extractor object ---&gt;</span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> extractor <span style="color: #0000FF;">=</span> </span>
<span style="color: #333333;">       loader.create<span style="color: #0000FF;">&#40;</span><span style="color: #009900;">&quot;com.lowagie.toolbox.plugins.ExtractAttachments&quot;</span><span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF;">/&gt;</span></span></pre></td></tr></table></div>

<p>Ok, so now we have the ExtractAttachments class loaded into a ColdFusion variable so we can use it. But now what? Outside of the JavaDoc, there is precious little documentation on how to use this particular feature of iText so it took quite a bit of experimentation and tracing through the Java source code to figure out how to get my particular test PDF file to be used by the extractor object.</p>
<p>The ExtractAttachments class constructor does not allow you to pass in any arguments, so I couldn&#8217;t give it my file that way. In looking through the Java code, I found that the constructor was creating an empty FileArgument object and putting it into its internal arguments variable (which is an array that can hold various types of arguments). Turns out there is a setValue() method in the FileArgument that takes a Java file object.  Upon finding that, I created a Java file object that pointed to my test PDF and passed it into the setValue() method of the FileArgument like so:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="cfm" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!--- Create a java file object for our source PDF file ---&gt;</span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> inputFile <span style="color: #0000FF;">=</span> loader.create<span style="color: #0000FF;">&#40;</span><span style="color: #009900;">&quot;java.io.File&quot;</span><span style="color: #0000FF;">&#41;</span></span>
<span style="color: #333333;">                   .init<span style="color: #0000FF;">&#40;</span> <span style="color: #0000FF;">expandPath</span><span style="color: #0000FF;">&#40;</span><span style="color: #009900;">'/test.pdf'</span><span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF;">/&gt;</span></span>
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!--- Set our java file object into the FileArgument argument </span>
<span style="color: #808080; font-style: italic;">created by ExtractAttachments constructor ---&gt;</span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> extractor.getArguments<span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">&#41;</span><span style="color: #0000FF;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #0000FF;">&#93;</span>.setValue<span style="color: #0000FF;">&#40;</span> inputFile <span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF;">/&gt;</span></span></pre></td></tr></table></div>

<p>The ExtractAttachments constructor only ever puts one argument into its internal array, so I was able to reliably hard code the array index (the [1] in the code sample). Once that file object was passed into the FileArgument, all that remained was telling the extractor object to go to work:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="cfm" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!--- Extract the attachment(s) ---&gt;</span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> extractor.execute<span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF;">/&gt;</span></span></pre></td></tr></table></div>

<p>The result was a newly created PNG file (which is what I had attached to the PDF) created in the same directory where the file CFML page was executing.  I&#8217;m sure there are ways to specify where that file gets created and do some more intricate things with iText, but for a proof-of-concept test, this one was highly successful. </p>
]]></content:encoded>
			<wfw:commentRss>http://dan.skaggsfamily.ws/2009/11/19/going-beyond-cfpdf-with-itext/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Slides from my ColdSpring session at CFinNC</title>
		<link>http://dan.skaggsfamily.ws/2009/10/18/slides-from-my-coldspring-session-at-cfinnc/</link>
		<comments>http://dan.skaggsfamily.ws/2009/10/18/slides-from-my-coldspring-session-at-cfinnc/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 22:21:52 +0000</pubDate>
		<dc:creator>Dan Skaggs</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[ColdSpring]]></category>
		<category><![CDATA[Speaking Engagements]]></category>

		<guid isPermaLink="false">http://dan.skaggsfamily.ws/?p=315</guid>
		<description><![CDATA[I&#8217;ve attached my slides from the my CFinNC session called &#8220;ColdSpring: Solution to a Problem You May Not Know You Have&#8221;. I&#8217;ve also included the example files that I referenced during the presentation. The slides have been uploaded to SlideSix.com or you can view them below. A PDF version of the slides is also available [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve attached my slides from the my <a href="http://www.cfinnc.com" target="_blank">CFinNC</a> session called &#8220;ColdSpring: Solution to a Problem You May Not Know You Have&#8221;. I&#8217;ve also included the <a href='http://dan.skaggsfamily.ws/wp-content/uploads/2009/10/ColdSpring-Demo-CFinNC-2009.zip'>example files</a> that I referenced during the presentation.</p>
<p>The slides have been uploaded to <a href="http://slidesix.com/view/ColdSpring-A-Solution-to-a-Problem-You-May-Not-Know-You-Have" target="_blank">SlideSix.com</a> or you can view them below. A <a href='http://dan.skaggsfamily.ws/wp-content/uploads/2009/10/CFinNC-09-Preso.pdf'>PDF version</a> of the slides is also available for download.</p>
<p>Thanks to all those folks that attended my session. Also a huge thanks and a job well done to the conference committee and volunteers that made the conference happen.</p>
<p><object height="425" width="550"><param name="movie" value="http://slidesix.com/viewer/SlideSixViewer.swf?alias=ColdSpring-A-Solution-to-a-Problem-You-May-Not-Know-You-Have" /><param name="menu" value="false"/><param name="scale" value="noScale"/><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always" /><param value="transparent" name="wmode" /><param value="quality" name="best" /><embed src="http://slidesix.com/viewer/SlideSixViewer.swf?alias=ColdSpring-A-Solution-to-a-Problem-You-May-Not-Know-You-Have" allowscriptaccess="always" allowFullScreen="true" height="425" width="550" type="application/x-shockwave-flash" wmode="transparent" quality="best" /></object></p>
]]></content:encoded>
			<wfw:commentRss>http://dan.skaggsfamily.ws/2009/10/18/slides-from-my-coldspring-session-at-cfinnc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
