So you want more tutorials?

I am going to continue the 'So You Wanna Create a Model Glue Application series. (Thanks Lola ;) For those just tuning in, the Contact-O-Matic is a simple example of a mini-application using ModelGlue and ColdSpring. The tutorials on the Contact-O-Matic go through the code line by line showing how to perform such tasks as:

  1. Set up the frameworks
  2. Build a View
  3. Place your CSS and JS files
  4. Create a form
  5. Validate a submitted form and persist the data
  6. Return success/error messages
  7. Resolve CFC dependancies with ColdSpring
  8. Create Instance Objects with factories
  9. Refactor, as needed

The Contact-O-Matic is not an example of a Best Practices- Enterprise application. This is due to the simple nature of the program. We simply have a list of contacts, a mechanism to add and edit contacts, and a way to remove contacts. As Object Models grow complex in complex applications, it is important to note that there is no perfect Object Model, only the least annoying set of tradeoffs. I want the code in the Contact-O-Matic to remain simple, and so it shall.

Our next move is to integrate Transfer ORM into our application. The next set of posts will cover installation and testing of the Transfer ORM Framework, the inclusion of another 'Contact-O-Feature' in our application as well as some Architectural Techniques.

Pragmatic Snippets

Previously, I showed my top seven snippets. Let us use some of the snippets together to make a new component. To follow along, you should install the snippets.

Next, we will consider our output. We will design a form bean component for a user management form consisting of the following values:

  • Email
  • FullName
  • Status
  • Username

Create a new component called snippet.cfc. Paste the four attributes listed above three times in snippet.cfc . Your file should look like the one below:

view plain print about
1<cfcomponent>
2            
3            Email
4            Fullname
5            Status
6            Username
7
8            Email
9            Fullname
10            Status
11            Username
12
13            Email
14            Fullname
15            Status
16            Username
17        
18        
19        </cfcomponent>

[More]

Seven snippets for highly effective developers

I like to think a lot about Rapid Development. Programming I find to be very enjoyable. I enjoy thinking around problems and designing proper solutions. I also enjoy adding processes and techniques that allow me to write better code faster. Today, we will focus on using snippets in CFEclipse to develop in a rapid fashion.

[More]

Download Download

Drive letters are only 1 character?

Since I created the SUBST drive mapping generator I have been wanting to make drive letters more than one character. I do not think this is possible. It sure would be nice to have ContactManager: in place of Q: OR R:. Is it really true that Windows XP can only have 26 drive mappings?

I defer to the Wizards of the Aggregators to let me know of any solutions to this.

Me as a Simpsons Character

I saw the "Create a Simpson's Character" post on Andy Jarrett's blog, so I gave it a go.

Scary how much realism I got with the hair. The Simpson's movie will be out July 27th 2007. I've been watching the adverts since Christmas and will be catching this in the theatre. If anyone in the Raleigh-Durham area wants to link up, i'll bring extra Twizzlers.

Rapid Development - Generate your drive mappings

I posted a week ago about how to map a directory to a drive letter. This was a good tip for me because to get to my webroot directory, I needed to click 6 times. These 6 clicks have annoyed me for so long, I built a tool to generate the mapping scripts.

The SUBST generation tool uses JQuery. There is no technical wizardry involved, I promise. Matter of fact, all of the logic is client side, so you can view the source if you like. Building the tool seemed like a fun little morning task and I happen to have a few spare moments. I hope you like it.

Note: I've tested this on WinXP, if there are other steps needed for other Windows based OS's, please leave a comment and I'll add it to the program straight away.

Stored Procedure argument is too long for SQL Server

I have been maintaining an ad-hoc report lately. The report uses a stored procedure to perform Cross-Tab functions on a resultset. The stored procedure works by passing in an SQL string, which in my case, is a string of generated SQL. Yesterday, I added some additional functionality to the report and the stored procedure failed. After spending quite a while on diagnosing the problem, I found the maximum length of the input parameter was 8,000 characters. My report generated an SQL string of 12,000 characters.

view plain print about
1Before I continue, I want to note the error messages returned from the stored procedure were syntax errors. Executing the exact same SQL statement with QueryAnalyzer returned a proper resultset. Not once did I get a useful message such as, "Hey Jerko, your parameter is too long".

For this report, the SQL Statement was generated at runtime. I needed a way to shorten the SQL Statement and still preserve the flexibility of the runtime SQL generation. After talking this through with my friend and co-worker, Bassil Karam, he recommended I replace a portion of the SQL statement with a view. Once I did that, I was able to shorten up the generated SQL to fit inside the input parameter of the Stored Procedure and my report ran just fine.

As an aside, the project I am working on has approached the technical limits of SQL server quite a few times. For example, I remain shocked at the table row limit. There are a lot of things right about MS SQL Server, but there are still some weak areas. Maybe left over limitations from when SQL Server was MS Access? ( Ha Ha Ha )

CF8 PostgreSQL support is Enterprise only?

Update: This post is no longer true. The documentation has been updated to reflect the inclusion of PostgreSQL in the standard edition of ColdFusion. See the comments for Steven Erat's response.

While the specs are not fully complete, Damon Cooper has released the system requirements for the impending CF8 release. I thank the entire CF team and Adobe for their transparency.

From the document, it appears that support for several databases will be only for CF8 Enterprise edition. This is not completely out of the norm as the Enterprise edition of CF has had improved Oracle drivers for a long time. If anyone has ever had to purchase 3rd party Oracle drivers, (Merant, anyone?) they are expensive and certainly make sense in the Enterprise edition. What surprised me was PostgreSQL support made the Enterprise list, but not the Professional list.

The PostgreSQL JDBC drivers are available for download at no charge. The implementation is Type 4, pure java implementation. The license for the drivers (taken from the http://jdbc.postgresql.org/ site:

view plain print about
1The PostgreSQL JDBC driver is distributed under the BSD license, same as the server. The simplest explanation of the licensing terms is that you can do whatever you want with the product and source code as long as you don't claim you wrote it or sue us.

While I completely understand, and embrace, inclusion of expensive licensed drivers, (such as Oracle) in CF Enterprise only, I find the decision to include PostgreSQL JDBC drivers in CF Enterprise very surprising.

The good news is, adding the PostgreSQL drivers to a CF Pro installation is very easy. I often consult the most excellent tutorial by Joachem Van Dieten for the JDBC JAR file installation and datasource configuration

As stated in the paper, the material is subject to change. Let's hope they do.

Huge time saver: Alias a directory as a drive letter

Using a quick command, you can alias a directory in MSWindows to a drive letter. This is extremely handy when you access a nested directory often, as web developers are prone to do.

the command to do this is simply:

view plain print about
1SUBST [DriveLetter]: [FullDirectoryPath]
2
3Example: SUBST z: C:\httpd\Apache2\htdocs
Now, when I need to get to my htdocs folder, I simply hit WindowsKey+R then z: + enter. MUCH nicer than clicking through the paths and waiting an interminable amount of time for each directory to load...

I found this on LifeHacker. If you haven't looked at LifeHacker before, you should. I have their RSS feed as a libe bookmark in Firefox so I can quickly scroll through their entries without having to visit the site.

West Street Band is Awesome

While out in Raleigh, my lovely girlfriend Shannon and I caught the West Street Band playing at the Blue Martini in downtown Raleigh.

Having not heard of the band before, we settled in on the couch with a little wine and waited for the songs. What came forth was pure amazement

Firstly, Shannon knew the keyboard player Fred so we chatted with him before the set. Oddly enough, Fred was once a High School Principal. He plays a great set of keys.

The band itself played a great set of blues and rock music. The singer was very much the entertainer, and played some excellent guitar solos.

The drummer was also excellent. He kept the whole band moving forward and his fills and sense of rhythm added a great dimension to the group. However, the showpiece of the night was the Bass Guitar player. This guy was a piece of work! Turns out, he had lived and played in New Orleans before Katrina turned the whole thing into a lake. He floated his Bass Guitar out of the flooded area on a mattress and ended up in Raleigh, North Carolina. This guy was simply amazing. He played a 6 string bass like it was an electric guitar. I can't explain his very active bass style, but Shannon and I enjoyed the performance immensely.

If you get the chance to see the West Street Band perform, please do so. Their schedule for the year is posted on the website at http://www.weststreetband.com/.