<?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&#039;s Drivelings</title>
	<atom:link href="http://www.tntechnohermit.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tntechnohermit.com</link>
	<description>Random Thoughts of a Techno-Hermit</description>
	<lastBuildDate>Thu, 01 Sep 2011 16:37:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Can you be too object-oriented for your client&#8217;s good?</title>
		<link>http://www.tntechnohermit.com/2011/09/01/can-you-be-too-object-oriented-for-your-clients-good/</link>
		<comments>http://www.tntechnohermit.com/2011/09/01/can-you-be-too-object-oriented-for-your-clients-good/#comments</comments>
		<pubDate>Thu, 01 Sep 2011 16:37:53 +0000</pubDate>
		<dc:creator>Dan Skaggs</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.tntechnohermit.com/?p=549</guid>
		<description><![CDATA[Unless you&#8217;ve been coding under a rock since ColdFusion 4.5, you&#8217;ve likely noticed the massive momentum behind object-oriented design and development in the ColdFusion sphere over the last 2 to 3 years. I love the idea of designing apps using object-oriented techniques&#8211;so much so that I&#8217;m presenting a session titled &#8220;OOP: What is it and [...]]]></description>
			<content:encoded><![CDATA[<p>Unless you&#8217;ve been coding under a rock since ColdFusion 4.5, you&#8217;ve likely noticed the massive momentum behind object-oriented design and development in the ColdFusion sphere over the last 2 to 3 years. I love the idea of designing apps using object-oriented techniques&#8211;so much so that I&#8217;m presenting a session titled &#8220;OOP: What is it and why do I care?&#8221; at <a href="http://www.ncdevcon.com">NCDevCon</a> next month. After a while of developing OO-style applications you can get really spoiled to that way of writing and organizing code.</p>
<p>As a consultant, I get the opportunity to work for a wide array of companies and an even wider array of projects&#8211;not all of which are designed and built using the latest and greatest OO principles. Sometimes you can fall into the trap of thinking how you&#8217;d do a certain thing in an object-oriented way when the application you&#8217;re working on is written in a (good or bad) procedural manner. As tempting as it might be to scrap the client&#8217;s procedural code and write a shiny new OO block of code, you have to step back and remember what the client is paying you to do and decide if that&#8217;s the best use of the client&#8217;s money. </p>
<p>Unless the client is specifically paying you to refactor an older application, sometimes it simply doesn&#8217;t make sense to change the way the client&#8217;s application works so drastically. Sometimes you just have to &#8220;forget&#8221; all the OO goodness that you&#8217;ve learned to love over the last couple of years and go back to the &#8220;old&#8221; way of doing things in order to best service your client. It may not be fun, exciting or cutting edge work, but there are still a great number of procedural applications out there that we might be called upon to work on. </p>
<p>Disclaimer: This post was written as a &#8220;note to self&#8221;, not as an indictment of anyone that I have worked with. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.tntechnohermit.com/2011/09/01/can-you-be-too-object-oriented-for-your-clients-good/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How I got started in ColdFusion</title>
		<link>http://www.tntechnohermit.com/2011/08/01/how-i-got-started-in-coldfusion/</link>
		<comments>http://www.tntechnohermit.com/2011/08/01/how-i-got-started-in-coldfusion/#comments</comments>
		<pubDate>Mon, 01 Aug 2011 13:41:45 +0000</pubDate>
		<dc:creator>Dan Skaggs</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.tntechnohermit.com/?p=545</guid>
		<description><![CDATA[After separating from active duty with the US Air Force in early 1998, I took a job working at a telecommunications company located in Brentwood, TN as a desktop and server support IT guy. About 6 months after I started, the company advertised an open position for their first full-time web developer. I applied and, [...]]]></description>
			<content:encoded><![CDATA[<p>After separating from active duty with the US Air Force in early 1998, I took a job working at a telecommunications company located in Brentwood, TN as a desktop and server support IT guy. About 6 months after I started, the company advertised an open position for their first full-time web developer. I applied and, owing to their policy of trying to &#8220;hire from within&#8221; first, I was chosen to fill the position.<br />
<span id="more-545"></span></p>
<p>The company had a completely static site that we built and maintained using Microsoft FrontPage (which was integrated with the company&#8217;s Visual Source Safe SCM system). I eventually started adding tiny bits of functionality using ASP (now called &#8220;classic ASP&#8221;) and that formed the basis of my &#8220;programming&#8221; experience.</p>
<p>After about 2 years in that position, the parent company for the company I worked for decided that our company no longer needed to be a wholly-owned subsidary, but should be a branch office instead. So, in January of 2000, I accepted an offer to transition to the web development team of the parent company. They too had a completely static web site that they used Dreamweaver to maintain, but they had BIG plans on the horizon.</p>
<p>They were in the process of choosing an &#8220;enterprise content management system&#8221; that would allow business users to create and update their own content. At the end of the selection process, Allaire Spectra was chosen. After the decision was made, I flew out to San Jose, CA (where the company was headquartered) several times to attend the Fast Track to ColdFusion, Advanced ColdFusion and Spectra 1.0 classes taught by folks that contracted with Allaire to provide training.</p>
<p>Having had no formal programming experience or training (playing with Basic in the computer labs at my high school couldn&#8217;t be counted as experience), some of the basic concepts were quite foreign to me. I remember specifically having trouble wrapping my head around how arrays and structures worked. Eventually though, it all kind of clicked and I felt pretty good about what I had learned.</p>
<p>After our initial training sessions, we went on to build out our corporate site using Allaire Spectra with the help of two consultants from Allaire that flew to San Jose every week for about 8 months. The site went live sometime in early 2001 and everything was great for about 2 weeks. We had a hardware failure in a load balancer and the IT support person working with us mistakenly identified it as an issue with Spectra and rolled our site back to the static version we had just prior to launching the Spectra site. </p>
<p>Before we could correct the issue and get the Spectra site back online, Macromedia (which had recently purchased Allaire) announced that they were going to end-of-life Spectra. Upon hearing this news, our company decided that we couldn&#8217;t base our corporate web strategy on a technology that had been cancelled. Our company decided instead to rebuild the entire site once again, but since we had such a significant investment in ColdFusion licenses and hardware, we standardize on ColdFusion for our web development needs.</p>
<p>I&#8217;ve been building web applications in ColdFusion ever since.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tntechnohermit.com/2011/08/01/how-i-got-started-in-coldfusion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I turned 40 yesterday&#8230;Here&#8217;s to the 2nd half</title>
		<link>http://www.tntechnohermit.com/2011/07/08/i-turned-40-yesterday-heres-to-the-2nd-half/</link>
		<comments>http://www.tntechnohermit.com/2011/07/08/i-turned-40-yesterday-heres-to-the-2nd-half/#comments</comments>
		<pubDate>Fri, 08 Jul 2011 20:59:50 +0000</pubDate>
		<dc:creator>Dan Skaggs</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.tntechnohermit.com/?p=541</guid>
		<description><![CDATA[For those of you that normally come here for technical information, this post is completely non-technical and I&#8217;ll understand if you decide to spend your valuable time somewhere else. As the title of this post suggests, I made it through what some people refer to as the &#8220;black birthday&#8221; yesterday. According to some statistic I [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you that normally come here for technical information, this post is completely non-technical and I&#8217;ll understand if you decide to spend your valuable time somewhere else.</p>
<p>As the title of this post suggests, I made it through what some people refer to as the &#8220;black birthday&#8221; yesterday. According to some statistic I found online, white males in the USA have an average life expectancy of 77.1 years. Pessimists would say that means I&#8217;m slightly over half dead. Optimists would respond with something along the lines that I have nearly half of my life in front of me. I&#8217;m really in neither category as I prefer to focus on things that I can make an impact on today (or plan today for things that I&#8217;m going to have to deal with in the near future).<br />
<span id="more-541"></span></p>
<p>Like a lot of people that hit this particular time in their lives, I spent a few moments reflecting on my &#8220;first half&#8221; this week and in doing so was reminded that I&#8217;ve been truly blessed thus far in my life. That&#8217;s not to say I haven&#8217;t made mistakes and would do some things differently if given the chance, but I&#8217;m really grateful for the opportunities I&#8217;ve had and the experiences that I&#8217;ve been able to take part in. Below are just a few of the things that I feel really blessed that are or have been a part of my life.</p>
<p><strong>I Have an Awesome Family</strong><br />
I married my high school sweetheart and we&#8217;re more in love today than we were back then. There are so many ways that we compliment each other that it&#8217;s uncanny. I&#8217;m a heavy metal guy, she&#8217;s a jazz/classical/big band gal. I get fired up about something and she calmly looks at alternatives and consequences. We have 3 great children&#8211;twin girls who will be 14 in a couple of weeks and a 5-year-old boy who make me proud as they grown, learn and experience new things on a weekly basis.</p>
<p><strong>I&#8217;m a Veteran</strong><br />
I&#8217;m extremely proud to have served our great nation as part of the US Air Force and the Tennessee Air National Guard. The people I served with and the experiences I had during my time in uniform helped shape me into who I am today. The military gave me the opportunity to live in another country (Honduras) for a year, experience what it&#8217;s like to hunker down in a dorm room while 2 typhoons came over us (Okinawa) and taught me how to logically diagnose and fix problems that were presented. It also gave me the opportunity to grow up from being a teenager to a person that my fellow airman knew they could depend on.</p>
<p><strong>I&#8217;m a GEEK!</strong><br />
I have a great career doing something I love. I&#8217;ve been into computers since before I got my first C-64. Writing software is what I live and breathe and I love it. I&#8217;ve been a contract consultant now for nearly 5 years and had a chance to work with and for some amazing people. My wife and I, along with her parents, are in the process of launching a brand new company and healthcare industry software product. It&#8217;s challenging, scary and rewarding all at the same time and I&#8217;m not sure I&#8217;d want it any other way.</p>
<p>To summarize quickly, I feel like I&#8217;ve had a great &#8220;first half&#8221;. I&#8217;m excited to see what the &#8220;second half&#8221; is going to bring. If you&#8217;ve made it this far, thank you for taking the time to allow me to share.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tntechnohermit.com/2011/07/08/i-turned-40-yesterday-heres-to-the-2nd-half/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Automatically encrypting and decrypting data with ColdFusion ORM and annotations</title>
		<link>http://www.tntechnohermit.com/2011/04/04/automatically-encrypting-and-decrypting-data-with-coldfusion-orm-and-annotations/</link>
		<comments>http://www.tntechnohermit.com/2011/04/04/automatically-encrypting-and-decrypting-data-with-coldfusion-orm-and-annotations/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 15:19:59 +0000</pubDate>
		<dc:creator>Dan Skaggs</dc:creator>
				<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://www.tntechnohermit.com/?p=525</guid>
		<description><![CDATA[I&#8217;m writing an application that uses ColdFusion&#8217;s ORM features heavily. Various fields in my database deal with Personally Identifiable Information (PII) and need to be encrypted to meet regulatory requirements. I&#8217;ve been mulling over the best way to deal with keeping the data encrypted while in the database but have it be readily usable when [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m writing an application that uses ColdFusion&#8217;s ORM features heavily. Various fields in my database deal with Personally Identifiable Information (PII) and need to be encrypted to meet regulatory requirements. I&#8217;ve been mulling over the best way to deal with keeping the data encrypted while in the database but have it be readily usable when loaded into an entity. None of the scenarios that came to mind felt right or could be implemented without an extensive amount of &#8220;work-around&#8221; code and I just wasn&#8217;t willing to go down those paths.  </p>
<p>I put the question out to the folks that follow me on Twitter and got a couple of responses, one of which was from <a href="http://www.compoundtheory.com">Mark Mandel</a> who suggested using annotations. Now, I&#8217;ve heard the word annotation mentioned, but had never had the time/opportunity to research what they were or how they were used. That was a few weeks ago and in the meantime, I&#8217;d gotten busy focusing on other things and just got around to thinking about the encryption thing again a few days ago. What I found out astonished me.<br />
<span id="more-525"></span></p>
<p>In ColdFusion CFCs, an annotation is nothing more than an additional attribute you put on a component, property or function tag (and maybe others too, but these will do for my scenario). To test this theory, I added the attribute <strong><em>encrypted=&#8221;true&#8221;</em></strong> to the password property of my User entity (the user accounts for people that are authorized to log into and use the application) and issued an ormReload() command to recreate the ORM entities. That worked without an error, but at this point it really didn&#8217;t do anything except just add a bit of metadata to that property tag.</p>
<p>The secret to the automatic encryption and decryption comes when you combine the <strong><em>encrypted=&#8221;true&#8221; </em></strong>annotation with the event handling methods provided by ColdFusion ORM. ORM provides the ability to run your own custom routines at various points throughout the ORM request cycle&#8211;preInsert(), preUpdate() and postLoad() are three of the ones that I took advantage of.  In essence, I used the preInsert() and preUpdate() methods to automatically replace the clear-text value of properties that had the <strong><em>encrypted=&#8221;true&#8221;</em></strong> flag with an encrypted version of that value. Similarly, I used the postLoad() method to reverse the process and replace the encrypted string that is stored in the database with the clear-text value.</p>
<p>I&#8217;ve included the code bits that I used below.</p>
<p>The password property of the User entity:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td 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;">cfproperty</span> <span style="color: #0000FF;">name</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;password&quot;</span> </span>
<span style="color: #333333;">     encrypted<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;true&quot;</span> </span>
<span style="color: #333333;">     <span style="color: #0000FF;">type</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;string&quot;</span> </span>
<span style="color: #333333;">     length<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;100&quot;</span> </span>
<span style="color: #333333;">     <span style="color: #0000FF;">required</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;true&quot;</span> </span>
<span style="color: #333333;">     notnull<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;true&quot;</span> <span style="color: #0000FF;">/&gt;</span></span></pre></td></tr></table></div>

<p>The ORM event handler methods:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td 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;">cffunction</span> <span style="color: #0000FF;">name</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;preInsert&quot;</span> output<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;false&quot;</span> <span style="color: #0000FF;">access</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;public&quot;</span> returntype<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;void&quot;</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> encryptProperties<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;">cffunction</span><span style="color: #0000FF;">&gt;</span></span>
&nbsp;
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cffunction</span> <span style="color: #0000FF;">name</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;preUpdate&quot;</span> output<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;false&quot;</span> <span style="color: #0000FF;">access</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;public&quot;</span> returntype<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;void&quot;</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> encryptProperties<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;">cffunction</span><span style="color: #0000FF;">&gt;</span></span>
&nbsp;
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cffunction</span> <span style="color: #0000FF;">name</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;postLoad&quot;</span> output<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;false&quot;</span> <span style="color: #0000FF;">access</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;public&quot;</span> returntype<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;void&quot;</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> decryptProperties<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;">cffunction</span><span style="color: #0000FF;">&gt;</span></span></pre></td></tr></table></div>

<p>I then created the encryptProperties() and decryptProperties() methods to loop through the properties of the given object looking for any properties that had the <strong><em>encrypted=&#8221;true&#8221;</em></strong> attribute set and perform the associated transformation when/if one is found:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
</pre></td><td 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;">cffunction</span> <span style="color: #0000FF;">name</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;encryptProperties&quot;</span> </span>
<span style="color: #333333;">     output<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;false&quot;</span> </span>
<span style="color: #333333;">     <span style="color: #0000FF;">access</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;public&quot;</span> </span>
<span style="color: #333333;">     returntype<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;void&quot;</span> <span style="color: #0000FF;">&gt;</span></span>
&nbsp;
     <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> props <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">getMetaData</span><span style="color: #0000FF;">&#40;</span> this <span style="color: #0000FF;">&#41;</span>.properties <span style="color: #0000FF;">/&gt;</span></span>
&nbsp;
     <span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfloop</span> array<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;#props#&quot;</span> <span style="color: #0000FF;">index</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;prop&quot;</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;">cfif</span> <span style="color: #0000FF;">structKeyExists</span><span style="color: #0000FF;">&#40;</span>  prop, <span style="color: #009900;">&quot;encrypted&quot;</span> <span style="color: #0000FF;">&#41;</span> AND prop.encrypted <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> variables<span style="color: #0000FF;">&#91;</span> prop.<span style="color: #0000FF;">name</span> <span style="color: #0000FF;">&#93;</span> <span style="color: #0000FF;">=</span> </span>
<span style="color: #333333;">                 <span style="color: #0000FF;">encrypt</span><span style="color: #0000FF;">&#40;</span> variables<span style="color: #0000FF;">&#91;</span> prop.<span style="color: #0000FF;">name</span> <span style="color: #0000FF;">&#93;</span>, <span style="color: #009900;">&quot;&lt;key&gt;&quot;</span>, <span style="color: #009900;">&quot;AES&quot;</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;">cfif</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;">cfloop</span><span style="color: #0000FF;">&gt;</span></span>
&nbsp;
<span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cffunction</span><span style="color: #0000FF;">&gt;</span></span>
&nbsp;
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cffunction</span> <span style="color: #0000FF;">name</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;decryptProperties&quot;</span> </span>
<span style="color: #333333;">     output<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;false&quot;</span> </span>
<span style="color: #333333;">     <span style="color: #0000FF;">access</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;public&quot;</span> </span>
<span style="color: #333333;">     returntype<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;void&quot;</span><span style="color: #0000FF;">&gt;</span></span>
&nbsp;
     <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> props <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">getMetaData</span><span style="color: #0000FF;">&#40;</span> this <span style="color: #0000FF;">&#41;</span>.properties <span style="color: #0000FF;">/&gt;</span></span>
&nbsp;
     <span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfloop</span> array<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;#props#&quot;</span> <span style="color: #0000FF;">index</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;prop&quot;</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;">cfif</span> <span style="color: #0000FF;">structKeyExists</span><span style="color: #0000FF;">&#40;</span>  prop, <span style="color: #009900;">&quot;encrypted&quot;</span> <span style="color: #0000FF;">&#41;</span> AND prop.encrypted <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> variables<span style="color: #0000FF;">&#91;</span> prop.<span style="color: #0000FF;">name</span> <span style="color: #0000FF;">&#93;</span> <span style="color: #0000FF;">=</span> </span>
<span style="color: #333333;">                 <span style="color: #0000FF;">decrypt</span><span style="color: #0000FF;">&#40;</span> variables<span style="color: #0000FF;">&#91;</span> prop.<span style="color: #0000FF;">name</span> <span style="color: #0000FF;">&#93;</span>, <span style="color: #009900;">&quot;&lt;key&gt;&quot;</span>, <span style="color: #009900;">&quot;AES&quot;</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;">cfif</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;">cfloop</span><span style="color: #0000FF;">&gt;</span></span>
&nbsp;
<span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cffunction</span><span style="color: #0000FF;">&gt;</span></span></pre></td></tr></table></div>

<p>To make the above approach even more useful, I put all those methods in a CFC named AbstractEntity.cfc that all my ORM entity CFCs extend.  So, now whenever I need to add another column to store encrypted data (no matter which entity I need them in as long as that entity extends the AbstractEntity.cfc), I define all the attributes for the property as normal and simply add the <strong><em>encrypted=&#8221;true&#8221;</em></strong> attribute to the property and ColdFusion handles the encryption and decryption for me automatically. The end result is that not only does this happen transparently to me as the developer, the clear-text values that I need to interact with in my application are encrypted when stored in the database as well as while in transit to/from the database.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tntechnohermit.com/2011/04/04/automatically-encrypting-and-decrypting-data-with-coldfusion-orm-and-annotations/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Adding ModelGlue&#8217;s event API to ColdFusion Builder&#8217;s code insight</title>
		<link>http://www.tntechnohermit.com/2011/02/07/adding-modelglues-event-api-to-coldfusion-builders-code-insight/</link>
		<comments>http://www.tntechnohermit.com/2011/02/07/adding-modelglues-event-api-to-coldfusion-builders-code-insight/#comments</comments>
		<pubDate>Mon, 07 Feb 2011 16:54:23 +0000</pubDate>
		<dc:creator>Dan Skaggs</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Development Environments]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[ModelGlue]]></category>

		<guid isPermaLink="false">http://www.tntechnohermit.com/?p=508</guid>
		<description><![CDATA[For the last year or so, all of my ColdFusion development projects have been built using the Model-Glue MVC framework. Over time, you get to where you know the most commonly used methods that are used to interact with the framework by heart. Sometimes there are lesser-used methods that you have to go look up. [...]]]></description>
			<content:encoded><![CDATA[<p>For the last year or so, all of my ColdFusion development projects have been built using the Model-Glue MVC framework. Over time, you get to where you know the most commonly used methods that are used to interact with the framework by heart. Sometimes there are lesser-used methods that you have to go look up. All the time (for me at least) I&#8217;m trying to find a way to write code faster and with less errors.</p>
<p>ColdFusion Builder has done a very nice job of providing code insight for ColdFusion tags, functions and CFC methods. This is especially true if you have a server configured in the &#8220;Servers&#8221; panel and mapped to your CF Builder project as it then will provide code insight for your own CFCs that you create on the page. However, when using Model-Glue, the &#8220;event&#8221; object is created for you and is always there. Because it&#8217;s not explicitly created on the page, CF Builder can&#8217;t provide code insight when you need to interact with it. However, it only takes a couple of settings in your project to make CF Builder aware of the event object and start providing help for it.</p>
<p>Here&#8217;s the process:</p>
<ol>
<li>Right click on your project and choosing &#8220;Properties&#8221;. </li>
<li>In the left pane of the window that comes up, click on &#8220;ColdFusion Variable Mappings&#8221;. </li>
<li>On the right side, click the &#8220;New&#8221; button and enter the following values into the boxes
<ul>
<li><strong>Variable Name:</strong> event</li>
<li><strong>Mapped To:</strong> html.ModelGlue.gesture.eventrequest.EventContext</li>
</ul>
</li>
<li>Press the &#8220;New&#8221; button and enter the following values into the boxes
<ul>
<li><strong>Variable Name:</strong> arguments.event</li>
<li><strong>Mapped To:</strong> html.ModelGlue.gesture.eventrequest.EventContext</li>
</ul>
</li>
<li>Press the Apply button then the OK button
</ul>
<p>* Note that the value in the &#8220;Mapped To&#8221; box is the actual dot-notated path to the EventContext.cfc file from your <strong>CF Builder project root</strong>. I happen to have my webroot files in a folder named &#8220;html&#8221; under the project root (see screenshot #1 below).</p>
<p>Once you have those settings saved, any time you type &#8220;event.&#8221; or &#8220;arguments.event.&#8221; you&#8217;ll get the list of methods contained in the Event object. Of course, this doesn&#8217;t only work with Model-Glue. Any CFC that you regularly use the same name with can be configured this same way.</p>
<p>I&#8217;ve attached some screenshots for reference. If you have any questions or something isn&#8217;t working, feel free to ping me.</p>

<a href='http://www.tntechnohermit.com/2011/02/07/adding-modelglues-event-api-to-coldfusion-builders-code-insight/cfbuilder-project-setup/' title='cfbuilder-project-setup'><img width="150" height="150" src="http://www.tntechnohermit.com/wp-content/uploads/2011/02/cfbuilder-project-setup-150x150.png" class="attachment-thumbnail" alt="Sample project setup" title="cfbuilder-project-setup" /></a>
<a href='http://www.tntechnohermit.com/2011/02/07/adding-modelglues-event-api-to-coldfusion-builders-code-insight/cfbuilder-variable-mappings/' title='cfbuilder-variable-mappings'><img width="150" height="150" src="http://www.tntechnohermit.com/wp-content/uploads/2011/02/cfbuilder-variable-mappings-150x150.png" class="attachment-thumbnail" alt="ColdFusion Builder Variable Mappings" title="cfbuilder-variable-mappings" /></a>
<a href='http://www.tntechnohermit.com/2011/02/07/adding-modelglues-event-api-to-coldfusion-builders-code-insight/cfbuilder-code-assist-view/' title='cfbuilder-code-assist-view'><img width="150" height="150" src="http://www.tntechnohermit.com/wp-content/uploads/2011/02/cfbuilder-code-assist-view-150x150.png" class="attachment-thumbnail" alt="cfbuilder-code-assist-view" title="cfbuilder-code-assist-view" /></a>
<a href='http://www.tntechnohermit.com/2011/02/07/adding-modelglues-event-api-to-coldfusion-builders-code-insight/cfbuilder-code-assist-controller/' title='cfbuilder-code-assist-controller'><img width="150" height="150" src="http://www.tntechnohermit.com/wp-content/uploads/2011/02/cfbuilder-code-assist-controller-150x150.png" class="attachment-thumbnail" alt="cfbuilder-code-assist-controller" title="cfbuilder-code-assist-controller" /></a>

]]></content:encoded>
			<wfw:commentRss>http://www.tntechnohermit.com/2011/02/07/adding-modelglues-event-api-to-coldfusion-builders-code-insight/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Observations of a CES newbie – Day 2</title>
		<link>http://www.tntechnohermit.com/2011/01/08/observations-of-a-ces-newbie-%e2%80%93-day-2/</link>
		<comments>http://www.tntechnohermit.com/2011/01/08/observations-of-a-ces-newbie-%e2%80%93-day-2/#comments</comments>
		<pubDate>Sat, 08 Jan 2011 06:10:10 +0000</pubDate>
		<dc:creator>Dan Skaggs</dc:creator>
				<category><![CDATA[CES]]></category>

		<guid isPermaLink="false">http://www.tntechnohermit.com/?p=503</guid>
		<description><![CDATA[Day two of our first trip to CES went much like day one. We walked and walked and walked! Yesterday we spent most of our day in the South Hall exhibit areas. Today we went through the smaller Central and North halls. In addition to the fact that these two areas were each smaller in [...]]]></description>
			<content:encoded><![CDATA[<p>Day two of our first trip to CES went much like day one. We walked and walked and walked! Yesterday we spent most of our day in the South Hall exhibit areas. Today we went through the smaller Central and North halls. In addition to the fact that these two areas were each smaller in floor space than the South Hall (but by no means could be considered small themselves), they both also had many more &#8220;mega booths&#8221;. Microsoft, Samsung, Sony and others had very large display areas.</p>
<p>A good portion of the North Hall was devoted to high end car electronics. Jennette and I skipped most of that since we weren&#8217;t really interested in most of those class of products. The one vendor we did visit there was the Pioneer booth to check out the features of the newest in-dash touchscreen navigation units. </p>
<p><strong>General thoughts on today:</strong></p>
<ol>
<li>A few companies were displaying renewable energy solutions for the home. Samsung and Sony both had new solar panel technologies on display as well as energy monitoring and management hardware and applications that looked very impressive.</li>
<li>There are only so may booths of iPhone/iPod/iPad cases that I can look at before I stop caring. At some point they all start looking the same (the exception was the Pure Energy induction charging cases I talked about yesterday)</li>
<li>I was sort of disappointed in the Digital Health tech zone. I was hoping to see more medical devices and mobile apps than I saw today</li>
<li>My wife had a great trip through the Mommy Tech zone picking up lots of information on resources she can use in the home school settings with our children</li>
<li>LED TVs and computer monitors are CRAZY thin. One line of computer monitors I saw looked like they were only about 1/2&#8243; thick. Any thinner and we&#8217;ll be having holographic displays that require no screen at all.
</ol>
<p><strong>Three exhibits that got my attention today:</strong></p>
<ol>
<li><a href="http://looxcie.com/">Looxcie</a> wearable camera. At first glance this looks like a bluetooth headset (and it is that as well). It also has a camera in the end of the boom that records up to an hour of 480p video. Apps for your iOS or Android device complement the camera and allow you to email videos or post to social sites.</li>
<li><a href="http://www.nativeunion.com">Native Union</a> displayed a series of both wired and bluetooth handsets for use with your mobile phone and/or computer. Admittedly, these are novelty items but the design and &#8220;neat factor&#8221; merit their mention I think.</li>
<li>Samsung displayed a next-generation energy-efficient refrigerator with a super slick design. According to the literature, it uses 20% less energy than the average refrigerator on the market today. Additionally, it had a food inventory system built into a touch-screen computer mounted in the door. Lastly (and this is an idea I&#8217;m surprised I hadn&#8217;t seen before), a small door set in the middle of the main door allows you to reach in and grab a drink from a shelf on the inside of the door without opening the larger main door&#8211;which obviously reduces the amount of cooled air that escapes while you&#8217;re grabbing said drink.</li>
</ol>
<p>Overall I didn&#8217;t see as many things today that made me go wow as I did yesterday. Still lots of cools stuff out there today though. I did get a chance to go back and talk to the folks at Laser Shot and try my hand with their handgun training product again. Tomorrow we&#8217;re looking forward to a somewhat less frenzied day and lunch with some of the folks from Adobe that are here at the show.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tntechnohermit.com/2011/01/08/observations-of-a-ces-newbie-%e2%80%93-day-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Observations of a CES newbie &#8211; Day 1</title>
		<link>http://www.tntechnohermit.com/2011/01/07/observations-of-a-ces-newbie-day-1/</link>
		<comments>http://www.tntechnohermit.com/2011/01/07/observations-of-a-ces-newbie-day-1/#comments</comments>
		<pubDate>Fri, 07 Jan 2011 06:12:29 +0000</pubDate>
		<dc:creator>Dan Skaggs</dc:creator>
				<category><![CDATA[CES]]></category>

		<guid isPermaLink="false">http://www.tntechnohermit.com/?p=496</guid>
		<description><![CDATA[My wife and I experienced the International Consumer Electronics Show today for the first time. The first word that comes to mind is just WOW! We saw maybe 1/4 of the entire exhibit space today and even then my brain was completely overloaded. We spent most of our time today in the South Exhibit Hall [...]]]></description>
			<content:encoded><![CDATA[<p>My wife and I experienced the International Consumer Electronics Show today for the first time. The first word that comes to mind is just WOW! We saw maybe 1/4 of the entire exhibit space today and even then my brain was completely overloaded. We spent most of our time today in the South Exhibit Hall which is where most of the &#8220;small vendors&#8221; are located. As such we walked past a larger number of vendors since most of them had smaller booths.</p>
<p><strong>Some general thoughts:</strong></p>
<ol>
<li>Tablets are everywhere! Companies that you have never heard of are demonstrating tablets.</li>
<li>3d televisions and projectors are still big items is year.</li>
<li>Did I mention this place is HUGE? We have seen only a small part of it and it&#8217;s still huge.</li>
<li>There were several vendors displaying new models of LED light bulbs. It&#8217;s great to see more vendors investing in new LED technologies and bringing a wider range of bulb types and light temperatures to the market</li>
</ol>
<p><strong>Three exhibits that really got me excited:</strong></p>
<ol>
<li><a href="http://pureenergy.com/">Pure Energy</a> was demonstrating their &#8220;charging mat&#8221; technology for mobile and rechargeable devices. Charging mats are not a completely new concept, but Pure Energy also had a line of very nicely designed charging cases for iPhones, iPads, Blackberry handsets and even Wii controllers that work with their charging mats.</li>
<li><a href="http://www.makerbot.com">Maker Bot&#8217;s</a> Thing-O-Matic. This robot assembly takes 3d drawing files and creates physical items from the drawings in ABS plastic. It&#8217;s just amazing to watch. I&#8217;m not sure what real use I&#8217;d have for one, but I seriously want one at my house</li>
<li>I got to try out a <a href="http://www.lasershot-hometheater.com/">Laser Shot</a> firearms training system that uses a computer with a projector and webcam to teach shooting mechanics and sharpen shooting skills under all types of situations. Nothing can completely replace live fire shooting practice, but this is a super way to teach shooting mechanics and save a few dollars in ammo at the same time. I seriously want one of these</li>
</ol>
<p>Several other people have said this too, but, if you&#8217;re looking to come to a CES, be prepared to be on your feet A LOT! You&#8217;ll want some good walking shoes. There&#8217;s just so much great tech to see out here. I&#8217;m looking forward to seeing things in the other exhibit halls tomorrow.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tntechnohermit.com/2011/01/07/observations-of-a-ces-newbie-day-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Merry Christmas from the Skaggs family</title>
		<link>http://www.tntechnohermit.com/2010/12/23/merry-christmas-from-the-skaggs-family/</link>
		<comments>http://www.tntechnohermit.com/2010/12/23/merry-christmas-from-the-skaggs-family/#comments</comments>
		<pubDate>Thu, 23 Dec 2010 20:51:36 +0000</pubDate>
		<dc:creator>Dan Skaggs</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.tntechnohermit.com/?p=485</guid>
		<description><![CDATA[Here&#8217;s hoping you all have a very Merry Christmas and a super New Year!]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s hoping you all have a very Merry Christmas and a super New Year!</p>
<p><a href="http://www.tntechnohermit.com/wp-content/uploads/2010/12/001-collage-1.jpeg"><img src="http://www.tntechnohermit.com/wp-content/uploads/2010/12/001-collage-1.jpeg" alt="" title="Christmas Card" width="600" height="480" class="aligncenter size-full wp-image-487" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tntechnohermit.com/2010/12/23/merry-christmas-from-the-skaggs-family/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Converting one company to CFML using an OSS CFML engine</title>
		<link>http://www.tntechnohermit.com/2010/12/03/oss-cfml-engine-success-story/</link>
		<comments>http://www.tntechnohermit.com/2010/12/03/oss-cfml-engine-success-story/#comments</comments>
		<pubDate>Fri, 03 Dec 2010 19:26:06 +0000</pubDate>
		<dc:creator>Dan Skaggs</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[ColdSpring]]></category>
		<category><![CDATA[Mach II]]></category>
		<category><![CDATA[Transfer ORM]]></category>

		<guid isPermaLink="false">http://www.tntechnohermit.com/?p=473</guid>
		<description><![CDATA[There have been some lively discussions on Twitter today centered around the adoption of open source CFML engines in various types of businesses. I can&#8217;t speak to any kind of trends anywhere, but I wanted to share my experience with a project I was involved in last year that used Railo as the CMFL engine. [...]]]></description>
			<content:encoded><![CDATA[<p>There have been some lively discussions on Twitter today centered around the adoption of open source CFML engines in various types of businesses. I can&#8217;t speak to any kind of trends anywhere, but I wanted to share my experience with a project I was involved in last year that used <a href="http://getrailo.org">Railo</a> as the CMFL engine.<br />
<span id="more-473"></span></p>
<p>My brother, <a href="http://twitter.com/andrewskaggs">Andrew</a>, is the head of the IT department for a firm that sells books and other supplies to school libraries all over the country. When he took over the position, he inherited a web site built on Java using the Struts framework.  The original site had been in place for quite some time and the ownership decided it was time to refresh the site. The main issue (besides the outdated design) with the site was that it was so difficult to update.  I&#8217;m not a Java developer by any stretch of the imagination, but from what I understand, even the simplest update required the site to be recompiled. The actual implementation of the site was fairly brittle as well, so new features were generally not even considered for fear of breaking something that was currently working. </p>
<p>Andrew had previously done some ColdFusion work with me on some of my other projects. He approached his management about contracting with me to help them replace their java web site with one built on CFML. During the initial requirements gathering and planning phases, the decision was made to use Railo as the CFML engine for the site.  The site was launched a few months after Railo released their first open source version which appealed to them as they have several systems within the company that are open source. Cost was not a major concern (Railo being free vs the cost of a standard license of <a href="http://www.adobe.com/coldfusion">Adobe ColdFusion</a>) but it was a consideration as this project did have a fixed budget. When we started the project, Adobe ColdFusion 8 was the most current release. Budgetary constraints probably a few more factors I wasn&#8217;t privy to led to the decision to use Railo as the CFML engine for the site.</p>
<p>Our experience developing with Railo was very positive. We built the site using <a href="http://www.mach-ii.com">Mach-II</a>, <a href="http://www.transfer-orm.com">Transfer</a>, <a href="http://coldspringframework.org">ColdSpring</a> using a <a href="http://www.postgresql.org">PostgreSQL</a> database backend. We had one little issue with Mach-II when we plugged in the Mach-II Dashboard module into our main config. <a href="http://blog.maestropublishing.com/">Peter Farrell</a> and I traced it down and found that it was due to a difference in how Railo parsed XML vs how Adobe ColdFusion did. I worked with the folks at Railo and they got the problem sorted out in one of the next releases.</p>
<p>The site went live the first of August, 2009.  Between January 1 and August 1 of 2010, the site experienced a 562% increase in revenue generated when compared to the same time period of 2009 (the YTD time frame leading up to the new site going live). They&#8217;ve also seen a dramatic increase in the amount of traffic to the site since the new version went live (although I don&#8217;t have exact percentages at my fingertips to share). Just as importantly, in the months sice the new site went live, they have been able to add dozens of new features to the site&#8211;both publicly-available features as well as features for administrators and sales people that just would have been too difficult to try to weave into the previous java struts based application.</p>
<p>Finally, while this &#8220;success story&#8221; has Railo as <em><strong>one</strong></em> of its key components, the bigger issue in my mind is the fact that a formerly java-centric shop has converted to using CFML successfully to run their business and provide a better experience for their customers and employees.</p>
<p>Disclaimer: I&#8217;m not on either side of the Railo/OpenBD/Adobe CF argument. I&#8217;ve not had a client since that project that&#8217;s given me the option to use Railo so all of my work since then has been in Adobe CF but I certainly wouldn&#8217;t dismiss Railo straight away if there were an option to use it on a future project.  The intent behind this blog post is simply to provide one real-world example of Railo being an entry point into CFML development, not to take either side of the Twitter discussions that have been going on today.</p>
<p>**Update: Corrected the incorrect timeline of when Adobe ColdFusion 8 came out and removed some inaccurate statements about speed of Railo vs the Adobe CF version out at the time (which was mistakenly stated to be MX7). Thank you Adam for pointing out the error. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.tntechnohermit.com/2010/12/03/oss-cfml-engine-success-story/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Experimenting with HTML and Javascript development in Adobe AIR</title>
		<link>http://www.tntechnohermit.com/2010/11/01/experimenting-with-html-and-javascript-development-in-adobe-air/</link>
		<comments>http://www.tntechnohermit.com/2010/11/01/experimenting-with-html-and-javascript-development-in-adobe-air/#comments</comments>
		<pubDate>Mon, 01 Nov 2010 14:13:01 +0000</pubDate>
		<dc:creator>Dan Skaggs</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Amateur Radio]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://dan.skaggsfamily.ws/?p=443</guid>
		<description><![CDATA[This is a rather long post detailing some of the things I learned this weekend while creating my first &#8220;real&#8221; Adobe AIR application that joins my love of programming with another hobby that I have enjoyed for several years. Those of you that know me very well might remember that one of my hobbies is [...]]]></description>
			<content:encoded><![CDATA[<p>This is a rather long post detailing some of the things I learned this weekend while creating my first &#8220;real&#8221; Adobe AIR application that joins my love of programming with another hobby that I have enjoyed for several years.</p>
<p>Those of you that know me very well might remember that one of my hobbies is amateur radio. There are many facets to the ham radio hobby and one of them that I&#8217;ve been involved with over the last few years combines radios and GPS data into a real-time position reporting system called Automatic Position Reporting System (APRS). To make a long story short, people equipped to use this system have specialized radios in their vehicles that read positional data from GPS units and transmit it out over certain frequencies periodically. Usually, these information packets eventually find their way to a series of servers that forward the data to connected clients for display on whatever mapping system the client has available locally.</p>
<p>This weekend, I spent some time creating an Adobe AIR application written in HTML and Javascript that connects to one of these servers and plots the position reports on a Google map. I haven&#8217;t had a chance to do much development with AIR up to now so I thought this would be a good exercise to see if I could create a usable solution.<br />
<span id="more-443"></span></p>
<p>The first hurdle was to create some method of translating the raw packet of information (which is a variable length string of text) into its component parts that I could then use. Below is an example of an APRS position report packet.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">KI4TDG-9&gt;APT407,WIDE1-1,WIDE2-2,qAR,N5AAA-1:!3546.23N/08654.00W&gt;069/000/A=000800</pre></div></div>

<p>This looks like a bunch of gibberish I know, but the data formats (there are multiple different types of packets that can be transmitted over the APRS system) are well documented.  I wound up creating a Javascript object called APRSPacketParser.js (original name I know, but it works) that had a method called parse() that accepted a raw APRS packet like the one above. This method then used other methods such as extractCall(), extractTimeStamp(), extractPosition() and so on to reduce the raw string into a series of values that I stored in another Javascript object called APRSPositionReport.js.  That took about 3 hours or so to write up. Because of the many different types of packet formats, the parser object still needs a lot of work, but for now it works on the 3 most common forms of position reports.</p>
<p>Once that was complete and tested, I created a regular HTML page to get my head around integrating with the Google maps javascript API.  Within no time, I was able to have a Google map in my HTML page, centered on my location with a custom zoom level set. Once the map was there, I began experimenting with parsing sample packets I had hard-coded into the page and using the location data stored in the resulting APRSPositionReport object to insert markers on the Google map.  So far so good and my total time so far was less than 4 hours worth of work. At this point I decided to quit for the night and try to tackle the AIR bits the next day.</p>
<p>Up to this point, all I&#8217;d really accomplished was proving that I could follow the instructions for using the Google maps API and that I could parse some sample packets into position reports.  I still had to make all that work inside AIR.  Upon creating a new AIR project, I put the HTML and javascript code that I&#8217;d been working on into the project and ran it, expecting to see a Google map pop up. Nope!  All I got was a blank screen and a message saying that the variable &#8220;google&#8221; was undefined. </p>
<p>After a couple hours of head scratching and research, I found out about AIR security sandboxes and found some example code on how to successfully use assets in your AIR application that are not part of the project itself. The examples showed how to use the ParentSandboxBridge and ChildSandboxBridge objects to essentially create an &#8220;API&#8221; between pages to allow data to be shared between two sandboxes with different security levels.  At this point, I had my empty Google map displaying inside my AIR application. With a little bit of bug fixing, the javascript code that I had used to create the markers on the map was working and I had 4 sample APRS packets parsed and plotted on the Google map. Total time to this point was somewhere around 7 hours.</p>
<p>Obviously, to be useful, the hard-coded position reports had to go and be replaced with a real-time stream of data from one of the APRS servers.  This part was probably the easiest thing I did all weekend. The socket class in AIR makes it absolutely simple to create a TCP socket connection to a server. To create a socket object, I used the following code. The first line creates the object and the remaining lines assign methods to listen to various events that happen with the socket connection.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">//Set up socket object that we'll use later when the connect/disconnect </span>
<span style="color: #006600; font-style: italic;">//buttons are clicked</span>
socket <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> air.<span style="color: #660066;">Socket</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
socket.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span>air.<span style="color: #660066;">Event</span>.<span style="color: #000066;">CLOSE</span><span style="color: #339933;">,</span> closeHandler<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
socket.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span>air.<span style="color: #660066;">Event</span>.<span style="color: #660066;">CONNECT</span><span style="color: #339933;">,</span> connectHandler<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
socket.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span>air.<span style="color: #660066;">IOErrorEvent</span>.<span style="color: #660066;">IO_ERROR</span><span style="color: #339933;">,</span> ioErrorHandler<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
socket.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span>air.<span style="color: #660066;">SecurityErrorEvent</span>.<span style="color: #660066;">SECURITY_ERROR</span><span style="color: #339933;">,</span> securityErrorHandler<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
socket.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span>air.<span style="color: #660066;">ProgressEvent</span>.<span style="color: #660066;">SOCKET_DATA</span><span style="color: #339933;">,</span> socketDataHandler<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>I then created a button labeled &#8220;Connect&#8221; and set the onClick action to run the javascript method named connect().  The code for that method looked like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> connect<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>socket.<span style="color: #660066;">connected</span> <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    socket.<span style="color: #660066;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;second.aprs.net&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">20157</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    writeln<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;user NOCALL pass -1 vers AirPRS 0.01 filter r/35.625/-86.9847/150&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>			
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>In my case I needed to connect to the server named &#8220;second.aprs.net&#8221; on port 20157.  The last line of that method uses the writeln() method to send a string of configuration data to the server over the socket connection telling it about the kind of data I want it to send me. The server sends a new line of data across the socket connection each time it receives a position report from an amateur station. At this point, all I had to do was fill in the body of the socketDataHandler() listener method to forward each packet to another method I created that uses the parser to parse the incoming string and dispatch a message to the map to create a marker with the information contained in the APRSPositionReport javascript object created from the raw packet.  Total time to this point was about 9 hours.</p>
<p>I spent another 3 or 4 hours adding error trapping and a &#8220;console&#8221; area to the application that got updated each time a new packet came in from the server so that I could see data flowing into the application.</p>
<p>All in all, I had around 12 hours or so of actual development time in creating a functional, though not very feature rich, application based on the Adobe AIR platform. If you care to take a look at what I&#8217;ve done or run the application, I&#8217;ve made the <a href="http://dan.skaggsfamily.ws/AirPRS/AirPRS.air">application</a> and the <a href="http://dan.skaggsfamily.ws/AirPRS/AirPRS.src.zip">source code</a> available for download.</p>
<p>Here&#8217;s a screenshot of what the application looks like after it&#8217;s been running for a bit to pull in some position reports (click on the image for the full-sized view).</p>
<p><a href="http://dan.skaggsfamily.ws/wp-content/uploads/2010/10/AirPRS-screenshot.png"><img src="http://dan.skaggsfamily.ws/wp-content/uploads/2010/10/AirPRS-screenshot-300x242.png" alt="" title="AirPRS-screenshot" width="300" height="242" class="aligncenter size-medium wp-image-449" /></a></p>
<p>I already have a list of things that I want to add to this such as a preferences pane so that you can set your own center map point, control the radius around the center that you want reports for and so on.  I want to use the built-in SQLite functions to store those values which will provide me with another learning opportunity with a different feature of AIR.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tntechnohermit.com/2010/11/01/experimenting-with-html-and-javascript-development-in-adobe-air/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

