I'm Speechless!

Goog Feed, CSS, General, ColdFusion, CFUnited 2008    Comments (10)


The title says it all, so I'll write about it instead. I found out yesterday from Liz at Teratech that I was picked by the Teratech team to be one of the speakers at CFUnited 2008 in Washington D.C.

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!

I will be speaking on The Power of CSS, 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 here. If you are going to CFUnited, I look forward to seeing you there! If not, you can register here, don't forget today is the last day for the special early bird rate!

See you in D.C. :)

Web Project Idea - What do you think?

Goog Feed, General    Comments (3)


The other day I came up with an idea for a new web application. It would be a FREE service to users for keeping track of their personal inventory, via notes, costs, dates, pictures and video of things in their home or possession.

This idea was sprung because recently my sister had her home catch on fire and everything in her house was damaged by the fire, she didn't have her personal possessions written down ahead of time, but if she would have she wouldn't have had to spend days digging through fire damaged items to report her assets to the insurance company. Furthermore if you write down your belongings on a piece of paper in your home, or even store them on your personal home computer that has a chance of burning as well, thus the idea of creating a web-based solution to the problem. You can access it from anywhere, with different file download options, even use this app for other personal inventory items, such as a vehicle, business, etc...

Once all of your household items are in the system, it's easy to add a new asset to your collection as you purchase them. You'll be able to enter the place you purchased it, notes, the cost the date purchased, which is all important information for the insurance company when determining your check for losses.

What do you think?

I have recently posted this idea to IdeaBlob.com which you can vote for by clicking on this link - http://www.ideablob.com/u/jgautreau/754-Develop-A-Personal-Inventory-, by voting on my idea you give me a chance to win $10,000 so I can begin the development of it.

Web Development - How do you approach it?

Goog Feed, General, ColdFusion, SQL    Comments (3)


I work for a school district, and I am the first developer they have every had. So I've been developing web apps for them for about six months now using ColdFusion with Model-Glue and SQL, all authentication is done through Active Directory.

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.

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.

I am a big fan of the Interface-Driven approach to web development, but I wanted to get some feedback from the community...

What methods/steps do you employ when taking on a project?
Do you build out pieces and release them or wait till the project is complete?
What type of documentation is used and why?
What have you found most beneficial to you in your experience with this?

Thanks in advance for your input!

Office Ergonomics - How do you sit?

Goog Feed, General    Comments (11)


My back has been hurting me lately. Stiffness when I wake up, soreness at work and I am only 27 years old! I have been in the computer industry for the past 7 years, sitting at a chair the whole time. I was young, still am, but I never gave much thought to posture and my back/neck. I don't want to get a pinched nerve when I'm 30, or have back surgery when I am 40.

So here is the question to all of you office people. What do you do to help your back and neck? Do you use a certain chair that you find useful? Certain excercise throughout the day? Cause the way I am going, things won't be pleasant when I get older.

One thought I had was to get a tall desk, where I could stand/sit at a stool.

Just looking for some good feedback on this issue. Thanks!

ColdFusion: Query to Excel Function

Goog Feed, General, ColdFusion    Comments (0)


I have a project at work where I needed to take a result set from a user's search and give them the option to download those results to excel, but the problem didn'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.

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.

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.

<form action="index.cfm?event=queryToExcel" method="post" name="myMethodCall">
   <input type="hidden" name="theCFC" value="myCFCNameHere" />
   <input type="hidden" name="theMethod" value="myCFCMethodHere" />
<input type="hidden" name="arg|anArgumentHere" value="#viewState.getValue("anArgumentHere")#" />
<input type="hidden" name="showFields" value="firstname|First Name,lastname|Last Name,dob|Date of Birth,statusName|Status" />
</form>

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.

1. The name/path to the CFC you need to get your data from.
2. The method of the CFC to call which returns a query result set of the data.
3. Any arguments that you know the method takes as a hidden field with an "arg|" before it so our function knows that it is an argument. (If you have more than one argument, then you'll have more of these fields.)
4. 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)

Next we'll insert our JavaScript link which submits this form to our Excel method.

<a href="javascript:document.myMethodCall.submit();">Download Current Results to Excel</a>

Our form when submitted goes to an event called "queryToExcel", this event calls our method "getExcelData" (below) in our controller passing it the form values.

<cffunction name="getExcelData" access="public" returnType="void" output="false">
   <cfargument name="event" type="ModelGlue.Core.Event" required="true">
      
<cfset var excelQuery = "" />
<cfset var pathString = "myApplication.model." & arguments.event.getValue('theCFC') />
<cfinvoke component="#pathString#" method="#arguments.event.getValue("theMethod")#" returnvariable="excelQuery">
   <cfloop list="#arguments.event.getValue("fieldNames")#" index="i">
   <cfif listFirst(i,"|") IS "arg">
   <cfinvokeargument name="#listLast(i,"|")#" value="#arguments.event.getValue(i)#">
</cfif>
</cfloop>
</cfinvoke>
   <cfset arguments.event.setValue("excelQuery", excelQuery) />
</cffunction>

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 "dynamic" method call, passing in any arguments which we loop through the form variables to get anything with our "arg|" 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 "rendering page" which you can see below.

<cfset excelQuery = viewState.getValue("excelQuery") />
<cfset showFields = viewState.getValue("showFields") />

<cfset variables.columnList = "" />

<cfif len(showFields) AND listLen(showFields) GT 0>
   <cfloop list="#showFields#" index="i">
   <cfset variables.columnList = listAppend(variables.columnList,listLast(i,"|")) />
</cfloop>
<cfelse>
   <cfset variables.columnList = excelQuery.columnList />   
</cfif>

<!---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.--->
<cfif isQuery(excelQuery) AND excelQuery.recordCount GT 0>

<cfsetting enableCFoutputOnly="Yes">

<cfheader name="Content-Disposition" value="attachment; filename=myFileName-#dateFormat(now(),'m/d/yyyy')#.xls">
<cfcontent type="application/vnd.ms-excel" reset="yes">

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

<cfelse>
   <p>Sorry, try again.</p>
</cfif>

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 "showFields" form value was blank we set our columnList to output to the query.columnList, otherwise we grab the passed in column names.

Next, we check to make sure we'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.

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!

More Entries