<?xml version="1.0" encoding="utf-8"?>
			
			<rss version="2.0">
			<channel>
			<title>Two Nine Media :: The Personal Studio of Joe Gautreau - ColdFusion</title>
			<link>http://www.twoninemedia.com/blog/index.cfm</link>
			<description>The blog/website of Two Nine Media, the personal studio of Joe Gautreau.  Here you will find samples of my work, with scattered things about my family and life.  Enjoy!</description>
			<language>en-us</language>
			<pubDate>Sat, 04 Sep 2010 18:04:40 -0400</pubDate>
			<lastBuildDate>Wed, 06 May 2009 15:16:00 -0400</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>joe@twoninemedia.com</managingEditor>
			<webMaster>joe@twoninemedia.com</webMaster>
			
			
			
			
			
			<item>
				<title>ColdFusion is NOT dead, it&apos;s just NOT marketed well!</title>
				<link>http://www.twoninemedia.com/blog/index.cfm/2009/5/6/ColdFusion-is-NOT-dead-its-just-NOT-marketed-well</link>
				<description>
				
				&lt;p&gt;&quot;ColdFusion is pretty much a dying language,&quot; said the customer service rep for a very popular hosting company, which I will name later.
&lt;/p&gt;
&lt;p&gt;
Alright, enough of this!  I know this has been a touchy point for ColdFusion developers for years, from the days of Allaire, to the purchase by Macromedia in 2001 which everyone thought would be CF&apos;s demise, to the purchase by Adobe in 2005 which we hoped would push CF to new heights in the coding world, but hasn&apos;t really came to pass as of yet.
&lt;/p&gt;
&lt;p&gt;
In thinking this through, I have come up with a theory as to why CF after 10 plus years is still, a &quot;dying&quot; language...
&lt;/p&gt;
&lt;p&gt;
So how did this come to pass?
&lt;/p&gt;
&lt;p&gt;
A buddy of mine here at work recently called GoDaddy.com in regards to their hosting package, which currently offers CFMX7.  He asked the rep if they had any plans in the works to upgrade to CF8.  His response was &quot;hold on a minute, let me check on that for you...,&quot; a couple minutes later he comes back on the line... &quot;I just talked to our developers and they say that ColdFusion is &apos;pretty much a dying language&apos; and we have no plans to upgrade at this time.&quot;
&lt;/p&gt;
&lt;p&gt;
This coming from one of the biggest hosting providers in the world doesn&apos;t sit well with making me feel any better about the future of CF.
&lt;/p&gt;
&lt;p&gt;
So, here is my theory.  I think CF is awesome, I think it offers so much to the developer, it is easy to use and program in, it is very robust, BUT it&apos;s one drawback, the PRICE TAG!
&lt;/p&gt;
&lt;p&gt;
Listed at $7,499.00 by &lt;a href=&quot;http://www.adobe.com/products/coldfusion/buy/&quot; target=&quot;_blank&quot;&gt;Adobe&lt;/a&gt; for the Enterprise Edition of CF doesn&apos;t exactly make CF an attractive option for going the route of CF.  Why would ANY company want to pay $7,500.00 bucks just to set the stage for a developer to write and deploy code, when there are FREE alternatives, namely, PHP, JAVA, ASP, etc...
&lt;/p&gt;
&lt;p&gt;
This is our livelihood, CF is how we get paid, you would think that Adobe would make CF a more attractive alternative to it&apos;s competing languages.  If Adobe make purchasing CF something that was NOT a financial burden, then more companies would use it.  If more companies used CF, more CF jobs would be created.  When more CF jobs are created, our futures become more secure, pay goes up and Adobe shines.
&lt;/p&gt;
&lt;p&gt;
Maybe my perception is off, but this is just my perception of this whole situation.  What do you think?
&lt;/p&gt;
				
				</description>
						
				
				<category>Goog Feed</category>				
				
				<category>ColdFusion</category>				
				
				<pubDate>Wed, 06 May 2009 15:16:00 -0400</pubDate>
				<guid>http://www.twoninemedia.com/blog/index.cfm/2009/5/6/ColdFusion-is-NOT-dead-its-just-NOT-marketed-well</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Comparing the Match Percentage of Two Strings</title>
				<link>http://www.twoninemedia.com/blog/index.cfm/2008/7/23/ColdFusion-Comparing-the-Match-Percentage-of-Two-Strings</link>
				<description>
				
				Today at work, my boss asked me to check into &quot;Fuzzy Match&quot; capabilities in ColdFusion for a project we&apos;re working on here at work.  Basically we want to compare two strings and find out what is the percentage of match between the two.  For example does string one match string two with 70% accuracy or better?

So after a couple Google searches I came upon a partial solution.  All signs pointed to the fact that I would have to use the Levenshtein distance formula which calculates the number of replacements, insertions or deletions necessary to match string one exactly up to string two.

I happened across a ColdFusion UDF written by Nicholas Zograpos which uses the Levenshtein formula to do this computation and passes back the number of characters needed to change string one into string two.  You can find the UDF &lt;a href=&quot;http://www.cflib.org/index.cfm?event=page.udfbyid&amp;udfid=1067&quot; target=_blank&quot;&gt;here&lt;/a&gt;.

I put this UDF at the top of my CFC.

&lt;code&gt;
&lt;cfscript&gt;
/**
* Computes the Levenshtein distance between two strings.
*
* @param s      First string. (Required)
* @param t      Second string. (Required)
* @return Returns a number.
* @author Nicholas Zographos (nicholas@nezen.net)
* @version 1, March 15, 2004
*/
function levDistance(s,t) {
    var d = ArrayNew(2);
    var i = 1;
    var j = 1;
    var s_i = &quot;A&quot;;
    var t_j = &quot;A&quot;;
    var cost = 0;
    
    var n = len(s)+1;
    var m = len(t)+1;
    
    d[n][m]=0;
    
    if (n is 1) {
        return m;
    }
    
    if (m is 1) {
        return n;
    }
    
     for (i = 1; i lte n; i=i+1) {
d[i][1] = i-1;
}

for (j = 1; j lte m; j=j+1) {
d[1][j] = j-1;
}
    
    for (i = 2; i lte n; i=i+1) {
s_i = Mid(s,i-1,1);

     for (j = 2; j lte m; j=j+1) {
    t_j = Mid(t,j-1,1);

        if (s_i is t_j) {
cost = 0;
}
else {
cost = 1;
}
        d[i][j] = min(d[i-1][j]+1, d[i][j-1]+1);
        d[i][j] = min(d[i][j], d[i-1][j-1] + cost);
}
}
    
return d[n][m];
}
&lt;/cfscript&gt;
&lt;/code&gt;

Next, I created a function of my own inside of my CFC which calls the levDistance function passing in two strings, it then divides the result by the length of the string we want to match against (stringTwo) and multiplies by 100 which gives the percentage of error between the two strings in numeric format.  Finally I compare the error percentage with my threshold or my max error percentage I am willing to allow, passing the user back a true/false based on the result.

You&apos;ll find my function below.

&lt;code&gt;
&lt;cffunction name=&quot;stringCompare&quot; access=&quot;public&quot; returnType=&quot;boolean&quot; output=&quot;false&quot;&gt;
    &lt;cfargument type=&quot;any&quot; name=&quot;stringOne&quot; default=&quot;&quot; required=&quot;yes&quot;&gt;
    &lt;cfargument type=&quot;any&quot; name=&quot;stringTwo&quot; default=&quot;&quot; required=&quot;yes&quot;&gt;

    &lt;cfset var result = true /&gt;
    &lt;cfset var threshold = 30 /&gt;&lt;!---This means that we are only allowing for a 30% error rate, 70% match in essence.---&gt;
    &lt;cfset var stringCompare = levDistance(trim(arguments.stringOne),trim(arguments.stringTwo))/len(trim(arguments.stringTwo))*100 /&gt;

    &lt;!---Comparing the result.---&gt;
    &lt;cfif stringCompare GT threshold&gt;
        &lt;cfset result = false /&gt;
    &lt;/cfif&gt;

    &lt;cfreturn result&gt;
&lt;/cffunction&gt;
&lt;/code&gt;

Finally, one last bit of code.  How to call the function from the view.

&lt;code&gt;
    &lt;cfset st1 = &quot;How are you doing?&quot; /&gt;
    &lt;cfset st2 = &quot;How are ya doing?&quot; /&gt;

    #myObj.stringCompare(stringOne=st1,stringTwo=st2)#
&lt;/code&gt;

You can play with the percentage numbers as needed to fit your situation.  This really helped me in a problem I faced, hopefully it will do the same for you!
				
				</description>
						
				
				<category>Goog Feed</category>				
				
				<category>General</category>				
				
				<category>ColdFusion</category>				
				
				<pubDate>Wed, 23 Jul 2008 17:25:00 -0400</pubDate>
				<guid>http://www.twoninemedia.com/blog/index.cfm/2008/7/23/ColdFusion-Comparing-the-Match-Percentage-of-Two-Strings</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>CFUnited: My Recap</title>
				<link>http://www.twoninemedia.com/blog/index.cfm/2008/6/24/CFUnited-My-Recap</link>
				<description>
				
				CFUnited 2008 was a great experience for me personally, I presented as a speaker for the first time which was a great experience and challenge, as well as learned a great deal of things that I would like to put into practice in my own development environment.

I wanted to put a quick post out there to go over some of the highlights that I was able to take away learning wise for others to see as well as a constant reminder to myself.  So, what did I personally learn?

&lt;ul&gt;
	&lt;li&gt;In his own words, Ray Camden will be using tables for layout until someone stops him...  Should&apos;ve come to my session Ray!&lt;/li&gt;
	&lt;li&gt;I want to start using CFToolTip more for my end-users benefit.&lt;/li&gt;
	&lt;li&gt;There is a cool Event Validator at RiaForge that Mark Drew referenced, I would like to check into that when I get the time.&lt;/li&gt;
	&lt;li&gt;From Hal Helms session, leave functions open for extention, closed for changes.  Keeping things simple&lt;/li&gt;
	&lt;li&gt;Just because MVC is used, doesn&apos;t mean I&apos;m doing OO.  I can still be doing procedural code in an MVC format.&lt;/li&gt;
	&lt;li&gt;Get  book called Design Patterns by Gang of Four&lt;/li&gt;
	&lt;li&gt;Find the things that are constantly changing in my applications and encapsulate them.&lt;/li&gt;
	&lt;li&gt;Good OO is all about abstraction.&lt;/li&gt;
	&lt;li&gt;Pass objects to be persisted.&lt;/li&gt;
	&lt;li&gt;From Chris Scott&apos;s session, keep ColdSpring simple - getBeans/setBeans&lt;/li&gt;
	&lt;li&gt;Increase the JVM default on the CF Server.&lt;/li&gt;
	&lt;li&gt;Increase the minimum memory on the CF Server.&lt;/li&gt;
	&lt;li&gt;Turn on trusted cache in production.&lt;/li&gt;
	&lt;li&gt;Cache queries used often in applications.&lt;/li&gt;
	&lt;li&gt;Read the CF8 performance brief.&lt;/li&gt;
	&lt;li&gt;Use SQL Server performance monitoring tools to profile, trace, look at execution plans and their costs, run database reports to see which queries are putting loads on the server.&lt;/li&gt;
	&lt;li&gt;If session is not available, reject the form submission, because it means they didn&apos;t come from your form.&lt;/li&gt;
	&lt;li&gt;From Joe&apos;s advanced Model-Glue session... you can use the include tags to include entire applications into your Model-Glue app.&lt;/li&gt;
	&lt;li&gt;Prefix event handlers.&lt;/li&gt;
	&lt;li&gt;Controllers should be as thin as possible.&lt;/li&gt;
	&lt;li&gt;Use views for common joins, filtering, etc... when dealing with larger queries.&lt;/li&gt;
	&lt;li&gt;Index all fields searched on in my SQL tables for fast searching and less load on the database.  A good example of this is looking for pizza in the phone book, but searching every page of the book from A-Z.  With indexing you don&apos;t need to search from A-Z simply jump to &apos;Pizza&apos;.&lt;/li&gt;
	&lt;li&gt;SQL views can be about 75% faster than CF for complex queries.&lt;/li&gt;
	&lt;li&gt;Stored procedures can be about 90% faster than CF.&lt;/li&gt;
	&lt;li&gt;Use cfQueryParams for security as well as not making the SQL Server re-write execution plans everytime a query is run.&lt;/li&gt;
	&lt;li&gt;Be careful about how you index your tables, you could do more damage than good if it&apos;s not done right.&lt;/li&gt;
&lt;/ul&gt;

That was my quick recap of what I learned.  Overall the venue was great, I loved the fact that the conference was in downtown DC instead of Bethesda, the hotel was awesome and close to the conference.  Another great job by the CFUnited team.  I hope to return in 2009.
				
				</description>
						
				
				<category>Goog Feed</category>				
				
				<category>General</category>				
				
				<category>ColdFusion</category>				
				
				<category>CFUnited 2008</category>				
				
				<category>SQL</category>				
				
				<pubDate>Tue, 24 Jun 2008 11:35:00 -0400</pubDate>
				<guid>http://www.twoninemedia.com/blog/index.cfm/2008/6/24/CFUnited-My-Recap</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>CFUnited: Off To Washington D.C.</title>
				<link>http://www.twoninemedia.com/blog/index.cfm/2008/6/16/CFUnited-Off-To-Washington-DC</link>
				<description>
				
				Well, tomorrow morning bright an early I leave for Washington D.C. for a ColdFusion conference at which I&apos;ll be speaking on &quot;The Power of CSS&quot;.  I am excited and nervous all at the same time.  Wondering if my presentation will be valuable, sufficient and timely, but excited about things I may learn and all that goes with experience of taking a trip.

I&apos;ll be blogging daily about the conference and the trip, posting pictures and musings about the things I experience on a daily basis while I am there.

Today, my wife LeeAnn has been running about trying to get some last minute things together before I leave.  I&apos;m going to miss LeeAnn and the kids while I&apos;m gone, but it will work out for good.  The kids have already been asking if I was going to bring them back t-shirts like I did last time.

I picked up a new lens for my camera while I am there, which I will blog about shortly, it&apos;s an Nikon 18-200mm VR Nikkor lens which gives me great range when I am out exploring D.C. so I am looking forward to getting some great shots with it.

Well, here goes nothin&apos;.  Stay tuned for more...
				
				</description>
						
				
				<category>Goog Feed</category>				
				
				<category>CSS</category>				
				
				<category>General</category>				
				
				<category>ColdFusion</category>				
				
				<category>Photography</category>				
				
				<category>CFUnited 2008</category>				
				
				<pubDate>Mon, 16 Jun 2008 16:59:00 -0400</pubDate>
				<guid>http://www.twoninemedia.com/blog/index.cfm/2008/6/16/CFUnited-Off-To-Washington-DC</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>SQL Dynamic Date Range</title>
				<link>http://www.twoninemedia.com/blog/index.cfm/2008/2/1/SQL-Dynamic-Date-Range</link>
				<description>
				
				I work for a school district here in Texas and today an issue arose.  We needed to run a nightly SQL job which pulls students from our Student Information System and dumps them into some tables we use for a local application.  Problem is while we have about 22,000 active students our total student table has over 55,000 records in it, some from prior years.

The initial reaction was to hard-code the school year start and end dates into the system, but then if our DBA leaves, or we forget what kind of lame hack we put in place we have problems next school year.

I had done this previously in ColdFusion, but today I decided to do a SQL version of it.  It will take the current day and decides what the current school year start and end dates are based on the current day, so we&apos;re always pulling current data only no matter what year it may be.

&lt;code&gt;
DECLARE @startDate datetime
DECLARE @endDate datetime

SET @startDate = cast(&apos;7/1/&apos; + cast(datePart(&quot;yyyy&quot;,getDate()) AS varchar) AS datetime)
SET @endDate = cast(&apos;6/30/&apos; + cast(datePart(&quot;yyyy&quot;,getDate()) AS varchar) AS datetime)

SET @startDate = CASE WHEN cast(@startDate AS datetime) &gt; getDate() THEN cast(dateAdd(&quot;yyyy&quot;,-1,@startDate) AS datetime) ELSE cast(@startDate AS datetime) END
SET @endDate = CASE WHEN cast(@endDate AS datetime) &lt; getDate() THEN cast(dateAdd(&quot;yyyy&quot;,1,@endDate) AS datetime) ELSE cast(@endDate AS datetime) END

SELECT @startDate AS startDate, @endDate AS endDate
&lt;/code&gt;

The end result is 7/1/2007 as the startDate and 6/30/2008 for the endDate.  It works perfect for us, and I hope it works for you.
				
				</description>
						
				
				<category>Goog Feed</category>				
				
				<category>General</category>				
				
				<category>ColdFusion</category>				
				
				<category>SQL</category>				
				
				<pubDate>Fri, 01 Feb 2008 18:31:00 -0400</pubDate>
				<guid>http://www.twoninemedia.com/blog/index.cfm/2008/2/1/SQL-Dynamic-Date-Range</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>I&apos;m Speechless!</title>
				<link>http://www.twoninemedia.com/blog/index.cfm/2007/11/30/Im-Speechless</link>
				<description>
				
				&lt;p&gt;
The title says it all, so I&apos;ll write about it instead.  I found out yesterday from Liz at &lt;a href=&quot;http://www.teratech.com/&quot; target=&quot;_blank&quot;&gt;Teratech&lt;/a&gt; that I was picked by the &lt;a href=&quot;http://www.teratech.com/&quot; target=&quot;_blank&quot;&gt;Teratech&lt;/a&gt; team to be one of the speakers at &lt;a href=&quot;http://cfunited.com/&quot; target=&quot;_blank&quot;&gt;CFUnited 2008&lt;/a&gt; in Washington D.C.
&lt;/p&gt;
&lt;p&gt;
I am honored, nervous, and humbled to be chosen to speak at this awesome event.  I feel that there are many people out there who are far better than me, but I look forward with a nervous excitement to this opportunity!
&lt;/p&gt;
&lt;p&gt;
I will be speaking on &lt;a href=&quot;http://cfunited.com/go/topics/2008#topic-1491&quot; target=&quot;_blank&quot;&gt;The Power of CSS&lt;/a&gt;, including tabled layouts vs. css layouts and why CSS is a far better solution for web development.  I have blogged in the past about the speed differences of the two which you can see &lt;a href=&quot;http://www.twoninemedia.com/blog/index.cfm/2007/4/19/TabledLayoutsvsCSSLayouts&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.  If you are going to &lt;a href=&quot;http://cfunited.com/&quot; target=&quot;_blank&quot;&gt;CFUnited&lt;/a&gt;, I look forward to seeing you there!  If not, you can register &lt;a href=&quot;https://secure.teratech.com/cfunited08/register.cfm&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;, don&apos;t forget today is the last day for the special early bird rate!
&lt;/p&gt;
&lt;p&gt;
See you in D.C. :)
&lt;/p&gt;
				
				</description>
						
				
				<category>Goog Feed</category>				
				
				<category>CSS</category>				
				
				<category>General</category>				
				
				<category>ColdFusion</category>				
				
				<category>CFUnited 2008</category>				
				
				<pubDate>Fri, 30 Nov 2007 03:09:00 -0400</pubDate>
				<guid>http://www.twoninemedia.com/blog/index.cfm/2007/11/30/Im-Speechless</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Web Development - How do you approach it?</title>
				<link>http://www.twoninemedia.com/blog/index.cfm/2007/11/15/Web-Development-How-do-you-approach-it</link>
				<description>
				
				&lt;p&gt;
I work for a school district, and I am the first developer they have every had.  So I&apos;ve been developing web apps for them for about six months now using &lt;strong&gt;ColdFusion&lt;/strong&gt; with &lt;strong&gt;Model-Glue&lt;/strong&gt; and &lt;strong&gt;SQL&lt;/strong&gt;, all authentication is done through Active Directory.
&lt;/p&gt;
&lt;p&gt;
Lately I started thinking about the future and how to best do development.  When I was hired they had a list of projects they needed done, and they needed to be done yesterday.  So I began coding, coding, coding.  No design docs, not project scope docs, no database diagrams, nothing of the sort.
&lt;/p&gt;
&lt;p&gt;
My first thought was to slow down and start a process for each project thrown my way.  It may be more tedious, time-consuming and boring, but I really think long-term, a well laid out play with an approval process up front lends itself to successful projects.
&lt;/p&gt;
&lt;p&gt;
I am a big fan of the Interface-Driven approach to web development, but I wanted to get some feedback from the community...
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;What methods/steps do you employ when taking on a project?&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Do you build out pieces and release them or wait till the project is complete?&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;What type of documentation is used and why?&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;What have you found most beneficial to you in your experience with this?&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Thanks in advance for your input!
&lt;/p&gt;
				
				</description>
						
				
				<category>Goog Feed</category>				
				
				<category>General</category>				
				
				<category>ColdFusion</category>				
				
				<category>SQL</category>				
				
				<pubDate>Thu, 15 Nov 2007 17:49:00 -0400</pubDate>
				<guid>http://www.twoninemedia.com/blog/index.cfm/2007/11/15/Web-Development-How-do-you-approach-it</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>ColdFusion: Query to Excel Function</title>
				<link>http://www.twoninemedia.com/blog/index.cfm/2007/11/2/ColdFusion-Query-to-Excel-Function</link>
				<description>
				
				&lt;p&gt;
I have a project at work where I needed to take a result set from a user&apos;s search and give them the option to download those results to excel, but the problem didn&apos;t stop there.  On the same page they are allowed also to call a totally different function and get back a result set a bit different than the first.  So I had two options.  I could send them each to a CF page where they could take results and output them to Excel, or I could write a function that will allow any method to be called, any query result set to be put into Excel regardless of the result set.  I chose the latter, because I have another project it could also be useful for.
&lt;/p&gt;
&lt;p&gt;
Let me first give a quick overview of how the app is set up.  I am using Model-Glue as my framework, with a SQL backend, CF as my development language.  I admit that this is somewhat limited in the sense that you must be using an object oriented type methodology to make this work.
&lt;/p&gt;
&lt;p&gt;
So, the first thing we do is add a bit of JavaScript to our page, which will allow for the submission of a hidden form which will call our function.
&lt;/p&gt;
&lt;code&gt;
    &lt;form action=&quot;index.cfm?event=queryToExcel&quot; method=&quot;post&quot; name=&quot;myMethodCall&quot;&gt;
    	&lt;input type=&quot;hidden&quot; name=&quot;theCFC&quot; value=&quot;myCFCNameHere&quot; /&gt;
	&lt;input type=&quot;hidden&quot; name=&quot;theMethod&quot; value=&quot;myCFCMethodHere&quot; /&gt;
        &lt;input type=&quot;hidden&quot; name=&quot;arg|anArgumentHere&quot; value=&quot;#viewState.getValue(&quot;anArgumentHere&quot;)#&quot; /&gt;
        &lt;input type=&quot;hidden&quot; name=&quot;showFields&quot; value=&quot;firstname|First Name,lastname|Last Name,dob|Date of Birth,statusName|Status&quot; /&gt;
    &lt;/form&gt;
&lt;/code&gt;
&lt;p&gt;
	If you notice there are a few things that are very important about this form.  We have four items that are vital to the entire process.  These four items tell the Excel Function what data to go get for the Excel file.
&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;1.&lt;/strong&gt;  The name/path to the CFC you need to get your data from.&lt;br&gt;
	&lt;strong&gt;2.&lt;/strong&gt;  The method of the CFC to call which returns a query result set of the data.&lt;br&gt;
	&lt;strong&gt;3.&lt;/strong&gt;  Any arguments that you know the method takes as a hidden field with an &quot;arg|&quot; before it so our function knows that it is an argument. (If you have more than one argument, then you&apos;ll have more of these fields.)&lt;br&gt;
	&lt;strong&gt;4.&lt;/strong&gt;  The fields that you want to show from your query result set, often you may bring back more fields then you want in your result set, so this allows you to give the fields you want, the order in which you want them, and the alias of the fieldname for your spreadsheet with the original db fieldname pipe delimited with the alias fieldname.  (ie: fieldname|My Field Name)&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
	Next we&apos;ll insert our JavaScript link which submits this form to our Excel method.
&lt;/p&gt;
&lt;code&gt;
	&lt;a href=&quot;javascript:document.myMethodCall.submit();&quot;&gt;Download Current Results to Excel&lt;/a&gt;
&lt;/code&gt;
&lt;p&gt;
	Our form when submitted goes to an event called &quot;queryToExcel&quot;, this event calls our method &quot;getExcelData&quot; (below) in our controller passing it the form values.
&lt;/p&gt;
&lt;code&gt;
&lt;cffunction name=&quot;getExcelData&quot; access=&quot;public&quot; returnType=&quot;void&quot; output=&quot;false&quot;&gt;
	&lt;cfargument name=&quot;event&quot; type=&quot;ModelGlue.Core.Event&quot; required=&quot;true&quot;&gt;
		
        &lt;cfset var excelQuery = &quot;&quot; /&gt;
        &lt;cfset var pathString = &quot;myApplication.model.&quot; &amp; arguments.event.getValue(&apos;theCFC&apos;) /&gt;
        &lt;cfinvoke component=&quot;#pathString#&quot; method=&quot;#arguments.event.getValue(&quot;theMethod&quot;)#&quot; returnvariable=&quot;excelQuery&quot;&gt;
        	&lt;cfloop list=&quot;#arguments.event.getValue(&quot;fieldNames&quot;)#&quot; index=&quot;i&quot;&gt;
            	&lt;cfif listFirst(i,&quot;|&quot;) IS &quot;arg&quot;&gt;
                	&lt;cfinvokeargument name=&quot;#listLast(i,&quot;|&quot;)#&quot; value=&quot;#arguments.event.getValue(i)#&quot;&gt;
                &lt;/cfif&gt;
            &lt;/cfloop&gt;
        &lt;/cfinvoke&gt;
	&lt;cfset arguments.event.setValue(&quot;excelQuery&quot;, excelQuery) /&gt;
&lt;/cffunction&gt;
&lt;/code&gt;
&lt;p&gt;
	The first thing our controller does is set a couple of variables, one being the path to our CFC.  We then use cfInvoke to make our &quot;dynamic&quot; method call, passing in any arguments which we loop through the form variables to get anything with our &quot;arg|&quot; prefix, then we get the data that we want back in a query result set, that result is then set in the viewState and sent on to our &quot;rendering page&quot; which you can see below.
&lt;/p&gt;
&lt;code&gt;
&lt;cfset excelQuery = viewState.getValue(&quot;excelQuery&quot;) /&gt;
&lt;cfset showFields = viewState.getValue(&quot;showFields&quot;) /&gt;

&lt;cfset variables.columnList = &quot;&quot; /&gt;

&lt;cfif len(showFields) AND listLen(showFields) GT 0&gt;
	&lt;cfloop list=&quot;#showFields#&quot; index=&quot;i&quot;&gt;
    	&lt;cfset variables.columnList = listAppend(variables.columnList,listLast(i,&quot;|&quot;)) /&gt;
    &lt;/cfloop&gt;
&lt;cfelse&gt;
	&lt;cfset variables.columnList = excelQuery.columnList /&gt;	
&lt;/cfif&gt;

&lt;!---If the page was submitted there should be a query, make sure there is one, and make sure there are records in it.  Then spit out the file.---&gt;
&lt;cfif isQuery(excelQuery) AND excelQuery.recordCount GT 0&gt;

&lt;cfsetting enableCFoutputOnly=&quot;Yes&quot;&gt;  

&lt;cfheader name=&quot;Content-Disposition&quot; value=&quot;attachment; filename=myFileName-#dateFormat(now(),&apos;m/d/yyyy&apos;)#.xls&quot;&gt;
&lt;cfcontent type=&quot;application/vnd.ms-excel&quot; reset=&quot;yes&quot;&gt;

&lt;!--- Output data, each row on it&apos;s own line.---&gt;
&lt;cfoutput&gt;
    &lt;table border=&quot;1&quot; cellpadding=&quot;1&quot; cellspacing=&quot;2&quot;&gt;
    &lt;tr&gt;
    	&lt;cfloop list=&quot;#variables.columnList#&quot; index=&quot;i&quot;&gt;
	        &lt;th&gt;#i#&lt;/th&gt;
		&lt;/cfloop&gt;
    &lt;/tr&gt;
&lt;/cfoutput&gt;
	&lt;cfoutput&gt;
    	&lt;cfloop from=&quot;1&quot; to=&quot;#excelQuery.recordCount#&quot; index=&quot;num&quot;&gt;
            &lt;tr&gt;
                &lt;cfloop list=&quot;#variables.columnList#&quot; index=&quot;i&quot;&gt;
                    &lt;td&gt;&lt;cfif isDate(trim(excelQuery[listFirst(i,&quot;|&quot;)][num]))&gt;#dateFormat(trim(excelQuery[listFirst(i,&quot;|&quot;)][num]),&quot;m/d/yyyy&quot;)#&lt;cfelse&gt;#trim(excelQuery[listFirst(i,&quot;|&quot;)][num])#&lt;/cfif&gt;&lt;/td&gt;
                &lt;/cfloop&gt;
            &lt;/tr&gt;
        &lt;/cfloop&gt;
    &lt;/cfoutput&gt;
&lt;cfoutput&gt;
    &lt;/table&gt;
&lt;/cfoutput&gt;

&lt;cfelse&gt;
	&lt;p&gt;Sorry, try again.&lt;/p&gt;
&lt;/cfif&gt;
&lt;/code&gt;
&lt;p&gt;
	In our processing file which I call dspExportData.cfm, we are setting our query to a variable as well as the fields in the previous form submission that we want to show.  If the &quot;showFields&quot; form value was blank we set our columnList to output to the query.columnList, otherwise we grab the passed in column names.
&lt;/p&gt;
&lt;p&gt;
	Next, we check to make sure we&apos;re dealing with a query, we then set our content output to Excel.  To output the data, we first output our column names then move on to our query.  We do a bit of double looping to make this work, first looping from 1 to our recordCount, inside of that loop we loop over our column list and refer to our query result set like an array outputting our results and coming out with what we wanted all along.
&lt;/p&gt;
&lt;p&gt;
	I hope this was useful for you, this is just the way I thought to do it, there are probably better ways to do this but never-the-less this is what worked for me!  If you think of better ways to do this, let me know I would love the feedback!
&lt;/p&gt;
				
				</description>
						
				
				<category>Goog Feed</category>				
				
				<category>General</category>				
				
				<category>ColdFusion</category>				
				
				<pubDate>Fri, 02 Nov 2007 16:49:00 -0400</pubDate>
				<guid>http://www.twoninemedia.com/blog/index.cfm/2007/11/2/ColdFusion-Query-to-Excel-Function</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Recursion and Active Directory</title>
				<link>http://www.twoninemedia.com/blog/index.cfm/2007/8/21/RecursionAndActiveDirectory</link>
				<description>
				
				So, I have this project on my plate of building a &quot;portal&quot; type application where you can access all internal applications from one spot, with one login.  We are using Active Directory to authenticate the user, but the permissions on each application is set on the application side of the house.

I quickly ran into a problem.

When I would use cfAuthenticate to login it would give me back all of the groups that I was a member of, I would then use cfLDAP to grab other important data needed for the user.  The only problem was that when I would get my list of groups back from cfAuthenticate it wouldn&apos;t give me nested groups.

For instance if I was a member of &quot;Group One&quot; in AD as an individual it would see me as having &quot;Group One&quot; as a group I could access, however if I was a member of &quot;Technology&quot; and we put the entire technology group into &quot;Group One&quot; it wouldn&apos;t see me as having access to &quot;Group One&quot;.

This was my first time messing with Active Directory so I didn&apos;t know anything about this, but here is what I came up with.

I could take that group that I originally got back from my cfAuthenticate call and pass it in to a function that would loop through them and see what groups they were a member of.  This would allow me to loop through the &quot;technology&quot; group and see that it was a member of &quot;Group One&quot; therefore I should be able to access anything &quot;Group One&quot; had access to.

So here it is...

First, I authenticate the user and then go grab important info about them for later use.

&lt;code&gt;
&lt;!---Authenticating to the domain.---&gt;
&lt;cfntauthenticate username=&quot;#trim(arguments.username)#&quot; password=&quot;#trim(arguments.password)#&quot; domain=&quot;#theDomain#&quot; result=&quot;loginResult&quot; listgroups=&quot;yes&quot;&gt;

&lt;!---Querying Active Directory for employee specific data for later use.  (correct name, email, employeeID, locationID)---&gt;
&lt;cfldap server=&quot;my.ldap.server&quot; port=&quot;123&quot; action=&quot;query&quot; name=&quot;UserInfo&quot; start=&quot;ou=Employees,ou=Users,dc=my,dc=ldap,dc=server&quot; attributes = &quot;cn,mail,employeeID,houseIdentifier&quot; filter=&quot;(sAMAccountName=#trim(arguments.username)#)&quot; username=&quot;AD_UserName&quot; password=&quot;AD_Password&quot; maxrows=&quot;1&quot;&gt;
&lt;/code&gt;

If they are authenticated, I take the groups passed back and pass them into a function which I will later call recursively.

&lt;code&gt;
&lt;cfset recursiveGroupCall = getAllGroups(groupList = loginResult[&quot;groups&quot;]) /&gt;
&lt;/code&gt;

The function then does its thing which is detailed below and builds a string with all of my groups.

&lt;code&gt;
    &lt;!---Initializing public access variables.---&gt;
    &lt;cfset variables.groupString = &quot;&quot; /&gt;

    &lt;cffunction name=&quot;getAllGroups&quot; access=&quot;public&quot; returntype=&quot;string&quot;&gt;
        &lt;cfargument name=&quot;groupList&quot; type=&quot;string&quot; required=&quot;yes&quot; default=&quot;&quot;&gt;
        
        &lt;cfset var newGroups = &quot;&quot; /&gt;
        &lt;cfset var removeDups = &quot;&quot; /&gt;
        
        &lt;!---Loop over the passed in list and get the groups that each item is a member of.---&gt;
        &lt;cfloop list=&quot;#arguments.groupList#&quot; index=&quot;i&quot;&gt;
            &lt;cfldap server=&quot;myLDAPServer&quot; port=&quot;123&quot; action=&quot;query&quot; name=&quot;user&quot; start=&quot;DC=my,DC=ldap,DC=server&quot; attributes = &quot;memberof,cn&quot; scope=&quot;subtree&quot; separator=&quot;|&quot; filter=&quot;(cn=#i#)&quot; username=&quot;ADUsername&quot; password=&quot;ADPassword&quot;&gt;
            &lt;!---Loop over the query returned for the item.---&gt;
            &lt;cfloop query=&quot;user&quot;&gt;
                &lt;cfoutput&gt;
                    &lt;!---Loop over the members of the query item and grab the groups out.---&gt;
                    &lt;cfloop list=&quot;#user.memberof#&quot; index=&quot;i&quot; delimiters=&quot;|&quot;&gt;
                        &lt;cfif NOT len(newGroups)&gt;
                            &lt;cfset newGroups = listLast(listFirst(i),&quot;=&quot;) /&gt;
                        &lt;cfelse&gt;
                            &lt;cfset newGroups = newGroups &amp; &apos;,&apos; &amp; listLast(listFirst(i),&quot;=&quot;) /&gt;
                        &lt;/cfif&gt;
                    &lt;/cfloop&gt;
                &lt;/cfoutput&gt;
            &lt;/cfloop&gt;
        &lt;/cfloop&gt;
    
        &lt;!---Set our overall group string to whatever is present.---&gt;
        &lt;cfif NOT len(variables.groupString)&gt;
            &lt;cfset variables.groupString = arguments.groupList &amp; &apos;,&apos; &amp; newGroups&gt;    
        &lt;cfelse&gt;
            &lt;cfset variables.groupString = variables.groupString &amp; &apos;,&apos; &amp; newGroups&gt;
        &lt;/cfif&gt;
    
        &lt;cfif len(newGroups)&gt;
            &lt;!---If there are new groups then call this function again, until there is no more new groups.---&gt;
            &lt;cfset recursivenav = getAllGroups(groupList=newGroups)&gt;
        &lt;cfelse&gt;
            &lt;!---If there is nothing in the new groups variable, return the entire group string.---&gt;
    
            &lt;!---Removing dups from the list, and cleaning it up.---&gt;
            &lt;cfset removeDups = StructNew()&gt;
            &lt;cfloop index=&quot;i&quot; list=&quot;#variables.groupString#&quot;&gt;
                &lt;cfset removeDups[i] = &quot;&quot;&gt;
            &lt;/cfloop&gt;
            &lt;!--- Convert the set back to a list ---&gt;
            &lt;cfset variables.groupString = StructKeyList(removeDups)&gt;
            
            &lt;!---Now we return it.---&gt;
            &lt;cfreturn variables.groupString&gt;
        &lt;/cfif&gt;
    &lt;/cffunction&gt;
&lt;/code&gt;

Feedback is always appreciated, if I could have done this differently, or more efficiently let me know.
				
				</description>
						
				
				<category>Goog Feed</category>				
				
				<category>General</category>				
				
				<category>ColdFusion</category>				
				
				<pubDate>Tue, 21 Aug 2007 12:54:00 -0400</pubDate>
				<guid>http://www.twoninemedia.com/blog/index.cfm/2007/8/21/RecursionAndActiveDirectory</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>ColdFusion: Stored Procedures For Beginners</title>
				<link>http://www.twoninemedia.com/blog/index.cfm/2007/5/18/ColdFusionStoredProceduresForBeginners</link>
				<description>
				
				So, you are a beginner in ColdFusion and you want to know the quick and dirty way to build a stored procedure and call it in ColdFusion.

&lt;strong&gt;Step One:&lt;/strong&gt;
Open SQL Server Enterprise Manager and browse to your database, you will find a section called &quot;Stored Procedures&quot;, right click on it and select &quot;New Stored Procedure&quot;.

&lt;img src=&quot;http://www.twoninemedia.com/gallery/storedProc/spStep1.jpg&quot; width=&quot;315&quot; height=&quot;275&quot; border=&quot;0&quot;&gt;

&lt;strong&gt;Step Two:&lt;/strong&gt;
A window &quot;Stored Procedure Properties&quot; window will open where you will drop in your t-SQL code for running a query.  Save it and you are good to go.  Below you&apos;ll find the window and example code.

&lt;code&gt;
CREATE PROCEDURE dbo.getStuff
@firstname varchar(50)
AS

SELECT dbo.[User].firstName AS Firstname, dbo.[User].lastName AS Lastname, dbo.[User].email AS EmailAddress, dbo.Role.name AS Role,dbo.Organization.Name AS OrgName, dbo.Permission.name AS PermissionName
FROM dbo.RolePermission INNER LOOP JOIN
	dbo.UserOrganization INNER LOOP JOIN
        dbo.[User] ON dbo.UserOrganization.UserID = dbo.[User].userID INNER LOOP JOIN
        dbo.UserOrganizationRole ON dbo.UserOrganization.UserOrganizationID = dbo.UserOrganizationRole.userorganizationid INNER LOOP JOIN
        dbo.Role ON dbo.UserOrganizationRole.roleid = dbo.Role.roleId ON dbo.RolePermission.roleid = dbo.Role.roleId INNER LOOP JOIN
        dbo.Organization ON dbo.UserOrganization.OrganizationID = dbo.Organization.OrganizationID INNER  JOIN
        dbo.Permission ON dbo.RolePermission.permissionid = dbo.Permission.permissionID
WHERE dbo.[User].firstName = @firstname
GO
&lt;/code&gt;

&lt;img src=&quot;http://www.twoninemedia.com/gallery/storedProc/spStep2.jpg&quot; width=&quot;500&quot; height=&quot;298&quot; border=&quot;0&quot;&gt;

&lt;strong&gt;Step Three:&lt;/strong&gt;
Open up a ColdFusion document and drop the following code in to call the stored procedure.  You&apos;ll need the datasource to the database where the strored procedure lives, the stored procedure name, and a name you will call your result, also pass in any parameters that the stored procedure needs.

&lt;code&gt;
&lt;cfset myFirstname = &quot;Joe&quot; /&gt;

&lt;cfstoredproc datasource=&quot;aDatasource&quot; procedure=&quot;getStuff&quot;&gt;
	&lt;cfprocresult name=&quot;myQueryResultSet&quot; /&gt;
	&lt;cfprocparam type = &quot;IN&quot; CFSQLType=&quot;cf_sql_varchar&quot; value=&quot;#myFirstname#&quot; dbvarname=&quot;@firstname&quot;&gt;
&lt;/cfstoredproc&gt;
&lt;/code&gt;

Dump your stored procedure result.

&lt;code&gt;
&lt;cfdump var=&quot;#myQueryResultSet#&quot;&gt;
&lt;/code&gt;

And just like that, you&apos;ve got results.  A stored procedure is really quite simple and very useful.

&lt;img src=&quot;http://www.twoninemedia.com/gallery/storedProc/spStep3.jpg&quot; width=&quot;500&quot; height=&quot;160&quot; border=&quot;0&quot;&gt;

&lt;strong&gt;Why use stored procedures?&lt;/strong&gt;

Many times, depending on what you are doing a stored procedure is much quicker.  Everytime you write a query in ColdFusion, the SQL server takes it and says... &quot;What would be the most efficient way to run this query?&quot;  It then runs it.  Whereas with a stored procedure, the &quot;Execution Plan&quot; of how to run the query most efficiently is stored in the system so the next time you call the stored procedure, it doesn&apos;t have to evaluate and come up with an &quot;Execution Plan.&quot;

The main reason for using them is speed.  You&apos;ll have to evaluate for yourself based on your situation at hand, what is quicker for the task at hand.  And no, I don&apos;t recommend using stored procedures for every little query, but for some of the bigger more complex ones... WHY NOT???

&lt;strong&gt;NOTE:&lt;/strong&gt;

Microsoft SQL and Sybase among others use Transact SQL as the language to write a stored procedure.  It is extremely robust and evolved and it may behoove you to learn some of the functionality available to you to perform more advanced operations (branching logic, looping over results, etc...).

An excellent reference book on this subject can be found &lt;a href=&quot;http://www.amazon.com/Transact-SQL-Programming-Lee-Gould/dp/1565924010/ref=pd_sim_b_1/002-2079352-8047202?ie=UTF8&amp;qid=1179519299&amp;sr=8-2&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.
				
				</description>
						
				
				<category>General</category>				
				
				<category>ColdFusion</category>				
				
				<category>SQL</category>				
				
				<pubDate>Fri, 18 May 2007 18:24:00 -0400</pubDate>
				<guid>http://www.twoninemedia.com/blog/index.cfm/2007/5/18/ColdFusionStoredProceduresForBeginners</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Paycheck Calculator Web Service</title>
				<link>http://www.twoninemedia.com/blog/index.cfm/2007/5/17/PaycheckCalculatorWebService</link>
				<description>
				
				I had a task at work where I had to create a paycheck calculator using the yearly salary, number of pay-periods, number of dependents, pre-tax deductions, and tax filing status.  This calculator would take these parameters in and process them, and returning a structure to the caller to work with.

Well, I had never done a web service before so I decided to make this my guinea pig.  I took my CFC and exposed my method as a remote method.

&lt;code&gt;&lt;cffunction name=&quot;getSalaryBreakdown&quot; access=&quot;remote&quot; returnType=&quot;struct&quot; output=&quot;false&quot;&gt;&lt;/code&gt;

I then built my method &quot;getSalaryBreakdown&quot; out to calculate values needed for a properly estimated paycheck.

&amp;nbsp;&amp;nbsp;&lt;strong&gt;-&lt;/strong&gt;&amp;nbsp;Gross Pay&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;strong&gt;-&lt;/strong&gt;&amp;nbsp;Pre-Tax Deductions&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;strong&gt;-&lt;/strong&gt;&amp;nbsp;Taxable Amount&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;strong&gt;-&lt;/strong&gt;&amp;nbsp;Federal Tax&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;strong&gt;-&lt;/strong&gt;&amp;nbsp;Social Security Tax&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;strong&gt;-&lt;/strong&gt;&amp;nbsp;Medicare Tax&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;strong&gt;-&lt;/strong&gt;&amp;nbsp;Post-Tax Deductions&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;strong&gt;-&lt;/strong&gt;&amp;nbsp;Net Pay&lt;br&gt;

I used all of the latest and greatest tax info and percentages from our governmental agencies.

&lt;strong&gt;Web Service Usage Instructions&lt;/strong&gt;

Pass in the following:
&amp;nbsp;&amp;nbsp;&lt;strong&gt;-&lt;/strong&gt;&amp;nbsp;Yearly Salary as &lt;strong&gt;&quot;salary&quot;&lt;/strong&gt; (numeric)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;strong&gt;-&lt;/strong&gt;&amp;nbsp;Number of Payperiods as &lt;strong&gt;&quot;payperiods&quot;&lt;/strong&gt; (numeric)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;strong&gt;-&lt;/strong&gt;&amp;nbsp;Any pre-tax deductions - ie: 401K, Medical, Etc... as &lt;strong&gt;&quot;preTaxAmt&quot;&lt;/strong&gt; (numeric)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;strong&gt;-&lt;/strong&gt;&amp;nbsp;Number of Dependents as &lt;strong&gt;&quot;dependents&quot;&lt;/strong&gt; (numeric)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;strong&gt;-&lt;/strong&gt;&amp;nbsp;
	Federal Filing Status as &lt;strong&gt;&quot;fedFiling&quot;&lt;/strong&gt; (numeric)
		&lt;br /&gt;
		&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-&amp;nbsp;Single (1)&lt;br /&gt;
		&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-&amp;nbsp;Married Filing Jointly or Qualifying Widow (2)&lt;br /&gt;
		&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-&amp;nbsp;Married Filing Separately (3)&lt;br /&gt;
		&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-&amp;nbsp;Head of Household (4)&lt;br /&gt;

WSDL: &lt;a href=&quot;http://twoninemedia.com/webServiceExample/webService.cfc?wsdl&quot; target=&quot;_blank&quot;&gt;http://twoninemedia.com/webServiceExample/webService.cfc?wsdl&lt;/a&gt;

&lt;strong&gt;Web Form Version&lt;/strong&gt;

I also created a web version of the calculator using the web service as the back-end.  &lt;a href=&quot;http://www.twoninemedia.com/webserviceexample/webService.cfm&quot; target=&quot;_blank&quot;&gt;You can view it here.&lt;/a&gt;

All in all this was a fun project and a good way for me to learn how to build a web service.  Enjoy!
				
				</description>
						
				
				<category>Goog Feed</category>				
				
				<category>General</category>				
				
				<category>ColdFusion</category>				
				
				<pubDate>Thu, 17 May 2007 17:04:00 -0400</pubDate>
				<guid>http://www.twoninemedia.com/blog/index.cfm/2007/5/17/PaycheckCalculatorWebService</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Moving On - The Joy and The Pain</title>
				<link>http://www.twoninemedia.com/blog/index.cfm/2007/5/10/MovingOn</link>
				<description>
				
				The last few weeks of my life have been wild to say the least.  I recently accepted a new position with another organization, and as of May 18, I&apos;ll be moving on.

But this move has not been without much joy and also much pain.

Pain, because I have to leave my current employer which has been so good to me and my family for my tenure there.  An employer which has helped grow my skills, with co-workers whom I have gleaned immense amounts of knowledge and know-how from.  A co-worker in specific who has been my mentor and teacher.  A boss, Audrey, who has been nothing short of great, always there for her employees, and a very understanding, caring individual as well.  I will miss my co-workers and all they have given me, but I know it is for the best!

More pain, because of how this whole thing went down.  I saw a post for a ColdFusion Web Developer with an exact match to the skills I currently possess.  I figured why not check into it.  So I called and was invited in for an interview, then another interview and finally an offer.  I accepted the offer after a small bit of negotiation and put in my notice at my current employer.

I called Audrey and she immediately made me feel wanted and good about what I had become, letting me know that she didn&apos;t want to lose me and told me how valuable I was to the team, she said she was going to do everything in her power to keep me.

She ended up getting me a counter offer that was a bit higher than the offer I had already accepted, but by that time, I had already made up my mind as to moving on.

I met with the company that I had accepted the offer of and we had lunch that afternoon.  Things went well, and talk was all about the future.

As I got back to work after lunch that day, I got a call from an organization that I had applied to some time ago, but didn&apos;t think I possessed the skill-set they were looking for.  I began to talk to them about what they were looking for, what the job entailed and so-forth.  The more I heard the more excited I became, this was turning out to be the job you only see in a perfect world.

God definitely had plans for me, I interviewed for the position feeling that I must research all possibilities thrown my was at the time, after all my next position would be my home for quite some time.

My interview went well and I began to go over the benefits I would receive if I got hired.

&amp;nbsp;&amp;nbsp;&amp;nbsp;-&amp;nbsp;Over TWO MONTHS of &quot;vacation/leave&quot;.&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;-&amp;nbsp;Medical coverage for $200 less per month.&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;-&amp;nbsp;A job so close to my house, I can ride a bike to work and come home for lunch.  MORE FAMILY TIME!!!&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;-&amp;nbsp;An exciting position of developing web applications from the ground up with the latest methodologies.&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;-&amp;nbsp;And more...

All in all I knew I couldn&apos;t pass this up, this was best for my family and myself.  The hard part was telling the previous opportunity, whose job I had accepted, that I found something I just could not pass up.

Well, yesterday I emailed them to break the news, it was a hard thing to do, and I felt very bad for having to do so.  I haven&apos;t heard back yet from them, but I hope they take it well and I hope they understand.

So, you see the pain, hard, hard decisions of leaving &quot;2&quot; jobs, but in the end I must do what is best.

I am looking forward to my new opportunity, it is exciting, challenging and no-doubt will be rewarding.

I hope it all works out, and all the pain has already turned into so much joy.  Thanks be to God for his orchestration of this perfect plan.
				
				</description>
						
				
				<category>Family</category>				
				
				<category>General</category>				
				
				<category>ColdFusion</category>				
				
				<pubDate>Thu, 10 May 2007 20:46:00 -0400</pubDate>
				<guid>http://www.twoninemedia.com/blog/index.cfm/2007/5/10/MovingOn</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Calculating The &quot;Working Days&quot; In A Date Range</title>
				<link>http://www.twoninemedia.com/blog/index.cfm/2007/3/26/CalculatingTheWorkingDaysInADateRange</link>
				<description>
				
				Recently at work I came across a problem.  I was tasked with developing a report for the user to choose a month/year combination and be able to view a report of the average amount of &quot;WORKING DAYS&quot; it took to complete a request.

Using the dateDiff function it would be easy enough to find out how many days are between the date the request was requested and the date is was completed, but the twist was &quot;WORKING DAYS&quot;.

I came up with the following solution with a little help from &lt;a href=&quot;http://www.petefreitag.com/item/151.cfm&quot; target=&quot;_blank&quot;&gt;Pete Freitag&apos;s Blog&lt;/a&gt; which taught me that you can loop over a date range with CFLOOP.

The following solution is pretty strait forward, but if you ever need a quick and dirty with minimal code to figure out how many working days are in a date range, then here you go!

First off, we&apos;ll set our variables for our begining date and ending date which we&apos;ll call date1 and date2.

&lt;code&gt;
&lt;cfset variables.date1= &quot;02/17/2007&quot;&gt;
&lt;cfset variables.date2 = &quot;02/25/2007&quot;&gt;
&lt;/code&gt;

Next, we&apos;ll set up a counter so as we loop through the date range we can add one if the day isn&apos;t a Saturday or Sunday.

&lt;code&gt;
&lt;cfset variables.totalWorkingDays = 0&gt;
&lt;/code&gt;

Then we will loop over our dates like so, and if the day IS NOT a Saturday or Sunday add 1 to our counter.

&lt;code&gt;
&lt;cfloop from=&quot;#variables.date1#&quot; to=&quot;#variables.date2#&quot; index=&quot;i&quot;&gt;
	&lt;cfif dayOfWeek(i) NEQ 1 AND dayOfWeek(i) NEQ 7&gt;
		&lt;cfset variables.totalWorkingDays = variables.totalWorkingDays + 1&gt;
	&lt;/cfif&gt;
&lt;/cfloop&gt;
&lt;/code&gt;

Finally after our loop is complete, we&apos;ll show the world our total working days.

&lt;code&gt;
Total Working Days: #variables.totalWorkingDays#
&lt;/code&gt;

Of course all of this is wrapped in CFOUTPUT tags as in the complete snippet below.

&lt;code&gt;
&lt;cfoutput&gt;
&lt;!---Setting the 2 &quot;Date Range&quot; dates.---&gt;
&lt;cfset variables.date1= &quot;02/17/2007&quot;&gt;
&lt;cfset variables.date2 = &quot;02/25/2007&quot;&gt;

&lt;!---Setting up our total working days counter.---&gt;
&lt;cfset variables.totalWorkingDays = 0&gt;

&lt;!---Looping over our &quot;Date Range&quot; an incrementing our counter where the day is not Sunday or Saturday.---&gt;
&lt;cfloop from=&quot;#variables.date1#&quot; to=&quot;#variables.date2#&quot; index=&quot;i&quot;&gt;
	&lt;cfif dayOfWeek(i) NEQ 1 AND dayOfWeek(i) NEQ 7&gt;
		&lt;cfset variables.totalWorkingDays = variables.totalWorkingDays + 1&gt;
	&lt;/cfif&gt;
&lt;/cfloop&gt;

&lt;!---Outputing our total working days.---&gt;
Working Days: #variables.totalWorkingDays#
&lt;/cfoutput&gt;
&lt;/code&gt;

Hopefully you&apos;ll find this as useful as I did!
				
				</description>
						
				
				<category>Goog Feed</category>				
				
				<category>General</category>				
				
				<category>ColdFusion</category>				
				
				<pubDate>Mon, 26 Mar 2007 13:46:00 -0400</pubDate>
				<guid>http://www.twoninemedia.com/blog/index.cfm/2007/3/26/CalculatingTheWorkingDaysInADateRange</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Getting RSS Feeds in ColdFusion</title>
				<link>http://www.twoninemedia.com/blog/index.cfm/2006/7/20/Getting-RSS-Feeds-in-ColdFusion</link>
				<description>
				
				I recently ran into a problem.  I wanted to take a certain category of RSS feeds from my blog to use for display elsewhere.  With the help of a friend of mine, &lt;a href=&quot;http://www.dougboude.com&quot;&gt;Doug Boude&lt;/a&gt;, I was able to come up with a solution in ColdFusion that is simple yet effective.

&lt;code&gt;
&lt;cfhttp url=&quot;http://www.twoninemedia.com/blog/rss.cfm?mode=full&amp;mode2=cat&amp;catid=88B93F56-FE8D-9F6A-2CF816F71FB23F11&quot;&gt;&lt;/cfhttp&gt;
&lt;cfset xmlParser = xmlParse(cfhttp.FileContent)&gt;
&lt;cfif isXML(xmlParser)&gt;
	&lt;cfset xPath = &quot;//item&quot;&gt;
	&lt;cfset items = xmlSearch(xmlParser, xPath)&gt;
	&lt;cfif arrayLen(items) GT 0&gt;
		&lt;!---Tell it the max number of entries I want to display.  If it&apos;s greater than 4 entries show only 4, if not show them all.---&gt;
		&lt;cfif arrayLen(items) GT 4&gt;
			&lt;cfset myLoopTo = 4&gt;
		&lt;cfelse&gt;
			&lt;cfset myLoopTo = arrayLen(items)&gt;
		&lt;/cfif&gt;
		&lt;!---Loop through the array of items and output the nessessary info.---&gt;
		&lt;cfloop from=&quot;1&quot; to=&quot;#myLoopTo#&quot; index=&quot;i&quot;&gt;
			&lt;cfoutput&gt;
				#dateformat(items[i].pubDate.xmlText, &quot;mmmm dd, yyyy&quot;)#
				&lt;br /&gt;
				&lt;a href=&quot;#items[i].link.xmlText#&quot;&gt;&lt;strong&gt;#items[i].title.xmlText#&lt;/strong&gt;&lt;/a&gt;
				&lt;br /&gt;
				#mid(items[i].description.xmlText, 1, 100)#...&amp;nbsp;&amp;nbsp;&lt;a href=&quot;#items[i].link.xmlText#&quot;&gt;&lt;strong&gt;More&lt;/strong&gt;&lt;/a&gt;
				&lt;br /&gt;
				&lt;br /&gt;
			&lt;/cfoutput&gt;
		&lt;/cfloop&gt;
	&lt;/cfif&gt;
&lt;/cfif&gt;
&lt;/code&gt;

Of course this could get far more complex if need be, but it suited my needs just fine for the moment.
				
				</description>
						
				
				<category>Goog Feed</category>				
				
				<category>ColdFusion</category>				
				
				<pubDate>Thu, 20 Jul 2006 18:45:00 -0400</pubDate>
				<guid>http://www.twoninemedia.com/blog/index.cfm/2006/7/20/Getting-RSS-Feeds-in-ColdFusion</guid>
				
			</item>
			
		 	
			</channel></rss>