<?xml version="1.0" encoding="utf-8"?>

			<rss version="2.0" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cc="http://web.resource.org/cc/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">

			<channel>
			<title>Critical-Web</title>
			<link>http://blog.critical-web.com/index.cfm</link>
			<description></description>
			<language>en-us</language>
			<pubDate>Tue, 21 May 2013 11:33:05 -0500</pubDate>
			<lastBuildDate>Fri, 27 Jul 2012 08:09:00 -0500</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>cfabort@critical-web.com</managingEditor>
			<webMaster>cfabort@critical-web.com</webMaster>
			<itunes:subtitle></itunes:subtitle>
			<itunes:summary></itunes:summary>
			<itunes:category text="Technology" />
			<itunes:category text="Technology">
				<itunes:category text="Podcasting" />
			</itunes:category>
			<itunes:category text="Technology">
				<itunes:category text="Tech News" />
			</itunes:category>
			<itunes:keywords></itunes:keywords>
			<itunes:author></itunes:author>
			<itunes:owner>
				<itunes:email>cfabort@critical-web.com</itunes:email>
				<itunes:name></itunes:name>
			</itunes:owner>
			
			<itunes:explicit>no</itunes:explicit>
			
			<item>
				<title>The State Of Affairs</title>
				<link>http://blog.critical-web.com/index.cfm/2012/7/27/The-State-Of-Affairs</link>
				<description>
				
				Wow, I haven&apos;t been here in a while. Things have been pretty crazy over the last two years. Hopefully things will be getting better soon.

A little bit of a recap. For the last three years my work has been implementing e-commerce websites for one of the leading players in the industry. The platform is built on a massive ColdFusion layer. I was responsible for creating new modules, customizing implementations and everything in-between.

In August of last year it was announced that our company was merging with another provider. A decision had to be made: there were now two very different platforms available from the same company. In the end, the other platform was chosen, for a variety of reasons.

The implication, aside from the obvious &quot;I now need to learn a new platform&quot;, is much more important: the entire platform is built on Java.

The last time I used Java was in college, almost ten years ago. To say I&apos;m rusty would be an understatement. I have a whole lot of learning to do.

Luckily, the company is assisting us in this process. There are several ColdFusion developers on the floor with little to no experience with Java. A training path has been set forth and broken down into manageable chunks. We&apos;ve all got a lot of work ahead of us, but I see it as a challenge.

In the next couple of months I will be sharing my experiences as I struggle to continue supporting our legacy implementations while learning a new language and platform.

This is going to be fun.

&lt;em&gt;Over and out&lt;/em&gt;
				</description>
				
				<category>Critical-Web news</category>
				
				<category>Java</category>
				
				<pubDate>Fri, 27 Jul 2012 08:09:00 -0500</pubDate>
				<guid>http://blog.critical-web.com/index.cfm/2012/7/27/The-State-Of-Affairs</guid>
				
				
			</item>
			
			<item>
				<title>The &quot;Behind-the-scenes&quot; of SQUASH&apos;s Authentication</title>
				<link>http://blog.critical-web.com/index.cfm/2009/8/4/The-Behindthescenes-of-SQUASHs-Authentication</link>
				<description>
				
				&lt;p&gt;Yesterday we looked at how to setup a login form and process the information with ColdBox. Today we&apos;ll go a step further by viewing the code behind the authentication model.&lt;/p&gt;&lt;p&gt;At the very beginning of our processLogin event we called upon the authenticationService object to, well, &lt;em&gt;authenticate&lt;/em&gt; the user. The authentication model is made up of three distinct objects: authentication.cfc, authenticationService.cfc and authenticationGateway.cfc. The authenticaionService is the main entry for all requests to the model. The gateway is the part that interacts with the database. Authentication.cfc is basically just a bean that gets passed around alot.&lt;/p&gt;
&lt;h4&gt;authentication.cfc&lt;/h4&gt;
&lt;p&gt;Basically just a bean, it has a couple of properties and a series of get/set methods:&lt;/p&gt;
&lt;code&gt;&lt;cfcomponent output=&quot;false&quot;&gt;
	
	&lt;cfproperty name=&quot;user_name&quot; type=&quot;string&quot; default=&quot;&quot; /&gt;
	&lt;cfproperty name=&quot;password&quot; type=&quot;string&quot; default=&quot;&quot; /&gt;
	&lt;cfproperty name=&quot;user_id&quot; type=&quot;numeric&quot; default=&quot;0&quot; /&gt;
	&lt;cfproperty name=&quot;error&quot; type=&quot;string&quot; default=&quot;&quot; /&gt;

	&lt;cffunction name=&quot;init&quot; access=&quot;public&quot; returntype=&quot;authentication&quot;&gt;
		&lt;cfargument name=&quot;user_name&quot; type=&quot;string&quot; required=&quot;false&quot; default=&quot;&quot; /&gt;
		&lt;cfargument name=&quot;password&quot; type=&quot;string&quot; required=&quot;false&quot; default=&quot;&quot; /&gt;
		&lt;cfargument name=&quot;user_id&quot; type=&quot;numeric&quot; required=&quot;false&quot; default=&quot;0&quot; /&gt;
		&lt;cfargument name=&quot;error&quot; type=&quot;string&quot; required=&quot;false&quot; default=&quot;&quot; /&gt;
		
		&lt;cfset setuser_name( arguments.user_name ) /&gt;
		&lt;cfset setpassword( arguments.password ) /&gt;
		&lt;cfset setuser_id( arguments.user_id ) /&gt;
		&lt;cfset seterror( arguments.error ) /&gt;
		
		&lt;cfreturn this /&gt;
	&lt;/cffunction&gt;
	
	&lt;cffunction name=&quot;setuser_name&quot; access=&quot;public&quot; returntype=&quot;void&quot;&gt;
		&lt;cfargument name=&quot;user_name&quot; type=&quot;string&quot; required=&quot;true&quot; /&gt;
		&lt;cfset variables.instance.user_name = arguments.user_name /&gt;
	&lt;/cffunction&gt;
	&lt;cffunction name=&quot;getuser_name&quot; access=&quot;public&quot; returntype=&quot;string&quot;&gt;
		&lt;cfreturn variables.instance.user_name /&gt;
	&lt;/cffunction&gt;
	&lt;cffunction name=&quot;setpassword&quot; access=&quot;public&quot; returntype=&quot;void&quot;&gt;
		&lt;cfargument name=&quot;password&quot; type=&quot;string&quot; required=&quot;true&quot; /&gt;
		&lt;cfset variables.instance.password = arguments.password /&gt;
	&lt;/cffunction&gt;
	&lt;cffunction name=&quot;getpassword&quot; access=&quot;public&quot; returntype=&quot;string&quot;&gt;
		&lt;cfreturn variables.instance.password /&gt;
	&lt;/cffunction&gt;
	&lt;cffunction name=&quot;setuser_id&quot; access=&quot;public&quot; returntype=&quot;void&quot;&gt;
		&lt;cfargument name=&quot;user_id&quot; type=&quot;numeric&quot; required=&quot;true&quot; /&gt;
		&lt;cfset variables.instance.user_id = arguments.user_id /&gt;
	&lt;/cffunction&gt;
	&lt;cffunction name=&quot;getuser_id&quot; access=&quot;public&quot; returntype=&quot;numeric&quot;&gt;
		&lt;cfreturn variables.instance.user_id /&gt;
	&lt;/cffunction&gt;
	&lt;cffunction name=&quot;seterror&quot; access=&quot;public&quot; returntype=&quot;void&quot;&gt;
		&lt;cfargument name=&quot;error&quot; type=&quot;string&quot; required=&quot;true&quot; /&gt;
		&lt;cfset variables.instance.error = arguments.error /&gt;
	&lt;/cffunction&gt;
	&lt;cffunction name=&quot;geterror&quot; access=&quot;public&quot; returntype=&quot;string&quot;&gt;
		&lt;cfreturn variables.instance.error /&gt;
	&lt;/cffunction&gt;

&lt;/cfcomponent&gt;&lt;/code&gt;
&lt;p&gt;Nothing too special happening here. The set&lt;em&gt;X&lt;/em&gt; methods store the value in the bean&apos;s instance so they can be retrieved later with the get&lt;em&gt;X&lt;/em&gt; methods.&lt;/p&gt;
&lt;h4&gt;authenticationGateway.cfc&lt;/h4&gt;
&lt;p&gt;AuthenticaionGateway is the main entrance to our model. This is the object we request from ColdSpring in our processLogin event.&lt;/p&gt;
&lt;code&gt;&lt;cfcomponent output=&quot;false&quot;&gt;

	&lt;cffunction name=&quot;init&quot; access=&quot;public&quot; returntype=&quot;authenticationService&quot;&gt;
		&lt;cfargument name=&quot;authenticationGateway&quot; type=&quot;authenticationGateway&quot; required=&quot;true&quot; /&gt;
		
		&lt;cfset variables.authenticationGateway = arguments.authenticationGateway /&gt;

		&lt;cfreturn this /&gt;
	&lt;/cffunction&gt;
	
	&lt;cffunction name=&quot;authenticate&quot; access=&quot;public&quot; returntype=&quot;authentication&quot;&gt;
		&lt;cfargument name=&quot;user_name&quot; type=&quot;string&quot; required=&quot;true&quot; /&gt;
		&lt;cfargument name=&quot;password&quot; type=&quot;string&quot; required=&quot;true&quot; /&gt;
		
		&lt;cfset var loc = { } /&gt;
		
		&lt;cfset loc.oAuthentication = createObject( &quot;component&quot;, &quot;authentication&quot; ).init( argumentCollection=arguments ) /&gt;
		&lt;cfset variables.authenticationGateway.authenticateUser( authentication=loc.oAuthentication ) /&gt;
	
		&lt;cfreturn loc.oAuthentication /&gt;
	&lt;/cffunction&gt;
	
	&lt;cffunction name=&quot;isAuthenticated&quot; access=&quot;public&quot; returntype=&quot;boolean&quot;&gt;
		&lt;cfargument name=&quot;authBean&quot; type=&quot;authentication&quot; required=&quot;true&quot; /&gt;
		&lt;cfif arguments.authBean.getUser_id() AND NOT len( arguments.authBean.getError() )&gt;
			&lt;cfreturn true /&gt;
		&lt;cfelse&gt;
			&lt;cfreturn false /&gt;
		&lt;/cfif&gt;
	&lt;/cffunction&gt;

&lt;/cfcomponent&gt;&lt;/code&gt;
&lt;p&gt;Our first method, init(), is going to be called by Coldspring to set the gateway automatically. The authenticate method is the one we call when we want to confirm that the entered user name and password are correct. The way we achieve this is by instantiating an authentication object and then passing it to the gateway for processing. We then return the processed bean to the requester.&lt;/p&gt;
&lt;p&gt;The final method, isAuthenticated(), is a way to encapsulate the logic behind testing for successful authentication. The processLogin event doesn&apos;t need to know the rules behind a proper login. It just needs to ask the service by passing back the bean. The service knows that if the user_id isn&apos;t 0 and that there were no errors the authentication was a success.&lt;/p&gt;
&lt;h4&gt;authenticationGateway.cfc&lt;/h4&gt;
&lt;p&gt;This object is really simple and contains only two methods: init and authenticateUser.&lt;/p&gt;
&lt;code&gt;&lt;cfcomponent output=&quot;false&quot;&gt;

	&lt;cffunction name=&quot;init&quot; access=&quot;public&quot; returntype=&quot;authenticationGateway&quot;&gt;
		&lt;cfargument name=&quot;dsn&quot; type=&quot;string&quot; required=&quot;true&quot; /&gt;
		&lt;cfset variables.dsn = arguments.dsn /&gt;
		&lt;cfreturn this /&gt;
	&lt;/cffunction&gt;
	
	&lt;cffunction name=&quot;authenticateUser&quot; access=&quot;public&quot; returntype=&quot;void&quot;&gt;
		&lt;cfargument name=&quot;authentication&quot; type=&quot;authentication&quot; required=&quot;true&quot; /&gt;
		
		&lt;cfset var loc = { } /&gt;
	
		&lt;cfquery name=&quot;loc.qAuthenticate&quot; datasource=&quot;#variables.dsn#&quot;&gt;
		SELECT
			name.user_id
			, CASE WHEN pw.user_id IS NULL THEN 1 ELSE 0 END AS incorrect_password
		FROM
			users AS name
		LEFT JOIN
			users AS pw
		ON
			name.user_id = pw.user_id 
			AND pw.password = &lt;cfqueryparam cfsqltype=&quot;cf_sql_varchar&quot; value=&quot;#hash( arguments.authentication.getPassword(), &apos;SHA-512&apos; )#&quot; /&gt;
		WHERE
			name.user_name = &lt;cfqueryparam cfsqltype=&quot;cf_sql_varchar&quot; value=&quot;#arguments.authentication.getUser_name()#&quot; /&gt;;
		&lt;/cfquery&gt;
		
		&lt;cfif loc.qAuthenticate.recordcount&gt;
			&lt;cfif NOT loc.qAuthenticate.incorrect_password&gt;
				&lt;cfset arguments.authentication.setUser_id( loc.qAuthenticate.user_id ) /&gt;
			&lt;cfelse&gt;
				&lt;cfset arguments.authentication.setError( &quot;INVALID_PASSWORD&quot; ) /&gt;
			&lt;/cfif&gt;
		&lt;cfelse&gt;
			&lt;cfset arguments.authentication.setError( &quot;INVALID_USERNAME&quot; ) /&gt;
		&lt;/cfif&gt;
		
	&lt;/cffunction&gt;
	
&lt;/cfcomponent&gt;&lt;/code&gt;
&lt;p&gt;As before, the init method is called by Coldspring to properly &lt;em&gt;initialize&lt;/em&gt; the object. We configured our coldspring.xml.cfm file to pass in the dsn parameter to the authenticationGateway object, which it does &lt;em&gt;supernaturally&lt;/em&gt;. The authenticateUser method is where everything happens. Basically, it queries the database with the bean&apos;s user name and password properties.&lt;/p&gt;
&lt;p&gt;I built my query this way so that with a single cfquery tag I could confirm the user name exists even if the password check fails. The first table (name) will have a record if the user name matches. If not, the entire resultset will be empty. The second table (pw) will only have a result if the password matches as well. The CASE clause checks for the existence of a record in the second table. If a row is found, it returns 1 (true). Otherwise, it returns 0 (false).&lt;/p&gt;
&lt;p&gt;The second part of the method sets the user_id or the error, depending on the situation:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;If there are results and
		&lt;ul&gt;
			&lt;li&gt;the password is correct: the user_id is set;&lt;/li&gt;
			&lt;li&gt;the password is incorrect: an error is set (&quot;INVALID_PASSWORD&quot;);&lt;/li&gt;
		&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;If there are no results: an error is set (&quot;INVALID_USERNAME&quot;);&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;Why go through all this?&lt;/h4&gt;
&lt;p&gt;You might be asking yourselves: why go to the trouble of doing all of this in the first place? Sure, I could&apos;ve put that query right in the middle of my processLogin event and checked for the logic there. There are a couple of good answers to that (I hope!).&lt;/p&gt;
&lt;h5&gt;Encapsulation of logic&lt;/h5&gt;
&lt;p&gt;Best practice dictates that a controller of an MVC framework should do as less as possible. It&apos;s a traffic agent. It doesn&apos;t need to know how the cars run, it just has to know how to get them across the intersection without causing an accident. Getting our authentication logic out of the controller and into it&apos;s own model allows us to separate concerns and keep logic where it needs to be.&lt;/p&gt;
&lt;h5&gt;Reusability&lt;/h5&gt;
&lt;p&gt;What if our processLogin isn&apos;t the only one that will need to handle authentication? There might be other reasons to call upon the authentication logic: web services, different frontends (Flex, among others). If we have all of our login code in the controller we need to copy it to every event that needs to check for authenticaion. Our authenticaion code is also pretty generic. We could very easily copy it over to a different object, validate the query is still valid against the different database and we&apos;re set!&lt;/p&gt;
&lt;h5&gt;It ain&apos;t that complicated!&lt;/h5&gt;
&lt;p&gt;At first glance, it does look complicated. There are three .cfcs where a query and a couple of lines would&apos;ve done the trick. However if you look closer you&apos;ll notice that there really isn&apos;t that much going on. Some generic set/get methods, another one for querying the database and two more for authenticating the user and making sure the authentication was a success. On top of that, the code within the controller is &lt;em&gt;much&lt;/em&gt; simpler. All it needs to do is ask the authenticationService to do the heavy lifting.&lt;/p&gt;
&lt;p&gt;I hope that clears it all up. One of the nice bonuses of our authentication model is that, although it relies on the users table, it isn&apos;t built &lt;em&gt;from&lt;/em&gt; it. We couldn&apos;t use Illudium PU-36 Code Generator to generate our cfcs for us, we needed to write them on our own. I feel this helps to understand the relation between the different objects in our model. In most cases, however, our models are built from database tables so most of the code can be generated rather simply. All we need to do after is query them from our controllers and we&apos;re set!&lt;/p&gt;
				</description>
				
				<category>Coldfusion</category>
				
				<category>Coldspring</category>
				
				<category>Coldbox</category>
				
				<category>Projects</category>
				
				<pubDate>Tue, 04 Aug 2009 09:20:00 -0500</pubDate>
				<guid>http://blog.critical-web.com/index.cfm/2009/8/4/The-Behindthescenes-of-SQUASHs-Authentication</guid>
				
				
			</item>
			
			<item>
				<title>Getting To Know Our Users</title>
				<link>http://blog.critical-web.com/index.cfm/2009/8/3/Getting-To-Know-Our-Users</link>
				<description>
				
				&lt;p&gt;Now that we know what we&apos;re working with, we&apos;re going to need to sit down and understand how our users will be defined and how they will authenticate with the system.&lt;/p&gt;&lt;p&gt;We&apos;ll start out with a really simple table to define our users. We can always come back later and add additional information.&lt;/p&gt;
&lt;pre&gt;users
------------------
user_id &lt;em&gt;integer&lt;/em&gt;
user_hash &lt;em&gt;string&lt;/em&gt;
user_name &lt;em&gt;string&lt;/em&gt;
password &lt;em&gt;string&lt;/em&gt;
email &lt;em&gt;string&lt;/em&gt;
&lt;em&gt;[...]&lt;/em&gt;&lt;/pre&gt;
&lt;p&gt;The user_id column is the primary key of our table. It&apos;s set to auto-increment, so each new user will have a unique user_id. We also create a unique user_hash for each user. The plan is that in cookies and forms we won&apos;t want to use the user_id as it would be too easy to change the cookie&apos;s value to a different number to try and log in with someone else&apos;s credentials. This user hash is simply going to be a UUID stripped of dashes. Why strip the dashes, you may ask? Well, that&apos;s rather simple: I think they don&apos;t look good. That and the fact that the dashes don&apos;t add to the uniqueness of the UUID. We can remove them without fear of corrupting our data. As for the password, we&apos;ll store it as a hashed string encrypted using the SHA-512 algorithm. This will convert the user&apos;s password to a 128-character long string.&lt;/p&gt;
&lt;blockquote&gt;A UUID, or Universally Unique IDentifier, is a string that is intended to be unique. It uses a combination of the computer&apos;s MAC address, the timestamp and several other magic components to generate this string.&lt;/blockquote&gt;
&lt;p&gt;Let&apos;s start by giving our table a test user to work with. This script was written for MySQL but should also work in most other SQL languages.&lt;/p&gt;
&lt;code&gt;INSERT INTO users ( user_hash, user_name, password, email ) VALUES (
  &apos;50F6E9B5D6765C61F23A6BD60D1EF328&apos;,
  &apos;Admin&apos;,
  &apos;67E1B608EB15C93A327D13BDD7D61EE9B38BAC84E5F4E005B2278953EE9A7A1D28EF4299A32BEC704F0E6D9A098B744C3051403D30E518A127E5BE5EAB459D02&apos;, -- squash
  &apos;your.email@here.com&apos;
);&lt;/code&gt;
&lt;h4&gt;Preparing our login screen&lt;/h4&gt;
&lt;p&gt;To display a login screen, we&apos;ll have to prepare an event in ColdBox. To keep concerns separated, we&apos;ll create a separate handler for users. This handler will do stuff that users do: log-in, log-out, manage profile, user options, etc. But we&apos;re getting ahead of ourselves. For now, let&apos;s just create an empty handler and save it as /handlers/users.cfc:&lt;/p&gt;
&lt;code&gt;&lt;cfcomponent name=&quot;users&quot; extends=&quot;coldbox.system.eventhandler&quot; output=&quot;false&quot;&gt;
	
	&lt;cffunction name=&quot;init&quot; access=&quot;public&quot; returntype=&quot;users&quot; output=&quot;false&quot;&gt;
		&lt;cfargument name=&quot;controller&quot; type=&quot;any&quot;&gt;
		&lt;cfset super.init(arguments.controller)&gt;
		&lt;cfreturn this&gt;
	&lt;/cffunction&gt;

&lt;/cfcompoment&gt;&lt;/code&gt;
&lt;p&gt;Now that our handler&apos;s set up, we need to give it an event. When we don&apos;t request a specific event from a handler, it looks for the default one: index. That&apos;s a perfect spot to put our login form in, so let&apos;s create that event:&lt;/p&gt;
&lt;code&gt;		
	&lt;cffunction name=&quot;index&quot; access=&quot;public&quot; returntype=&quot;void&quot; output=&quot;false&quot;&gt;
		&lt;cfargument name=&quot;event&quot; type=&quot;any&quot;&gt;

		&lt;cfset var loc = { rc=event.getCollection() } /&gt;
		
		&lt;cfset loc.rc.xehLoginForm = getSetting( &quot;SESBaseURL&quot; ) &amp; &quot;/users/processLogin&quot; /&gt;
		
		&lt;cfset event.setView( &quot;users/login&quot; ) /&gt;
	&lt;/cffunction&gt;&lt;/code&gt;
&lt;p&gt;Remember: when ColdBox is looking for an event, it will look in the component for the requested handler, and then call the method with the name of the requested action. For example, when we call index.cfm?event=users.index, it will call the index method of the users component. The first thing we&apos;re doing in our action is creating a local variable with a reference to the request collection. The request collection is a copy of all URL and FORM variables. It also has access to several of ColdBox&apos;s inherent methods. What we do next is create an eXit Event Handler. The purpose of this variable is to tell the view where it will be submitted to. This allows forms to be reused and is a best-practice in most MVC-based frameworks.&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&quot;The basic idea of SES URLs is to create a URL that is passing variables (variable=value pairs) but does not look like it is. Why? Because search engines don&apos;t always pick up links to pages where variables are passed.&quot; (&lt;a href=&quot;http://www.fusionauthority.com/techniques/4226-search-engine-safe-ses-urls.htm&quot; target=&quot;_blank&quot;&gt;source&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;ColdBox automatically converts SES URLs to it&apos;s native format (index.cfm?event=handler.action).&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;ColdBox has a handy method called getSetting that allows you to access it&apos;s internal settings structure. One of these values is SESBaseURL. Basically, it is the complete link to your index.cfm file. After that all you need to do is add the event in the form /handler/action, or, in our case, /users/processLogin. We then tell ColdBox to display our form through the setView method.&lt;/p&gt;
&lt;code&gt;&lt;cfoutput&gt;
&lt;form name=&quot;login&quot; action=&quot;#rc.xehLoginForm#&quot; method=&quot;post&quot;&gt;
	&lt;fieldset&gt;
		
		&lt;cfif event.valueExists( &quot;login_error&quot; )&gt;
			&lt;p class=&quot;form-errors&quot;&gt;#rc.login_error#&lt;/p&gt;
		&lt;/cfif&gt;
		
		&lt;div class=&quot;field&quot;&gt;
			&lt;label for=&quot;user_name&quot;&gt;User name:&lt;/label&gt;
			&lt;input type=&quot;text&quot; id=&quot;user_name&quot; name=&quot;user_name&quot; size=&quot;20&quot; maxlength=&quot;100&quot; tabindex=&quot;1&quot; /&gt;
		&lt;/div&gt;
		
		&lt;div class=&quot;field&quot;&gt;
			&lt;label for=&quot;password&quot;&gt;Password:&lt;/label&gt;
			&lt;input type=&quot;password&quot; id=&quot;password&quot; name=&quot;password&quot; size=&quot;20&quot; maxlength=&quot;100&quot; tabindex=&quot;2&quot; /&gt;
		&lt;/div&gt;
		
		&lt;div class=&quot;field-nolabel&quot;&gt;
			&lt;input type=&quot;checkbox&quot; id=&quot;persist&quot; name=&quot;persist&quot; value=&quot;1&quot; /&gt; &lt;label for=&quot;persist&quot; tabindex=&quot;3&quot;&gt;Stay logged in?&lt;/label&gt;
		&lt;/div&gt;
		
		&lt;div class=&quot;field-nolabel&quot;&gt;
			&lt;button class=&quot;submit&quot; tabindex=&quot;4&quot;&gt;Submit&lt;/button&gt;
		&lt;/div&gt;
		
	&lt;/fieldset&gt;
	
&lt;/form&gt;
&lt;/cfoutput&gt;&lt;/code&gt;
&lt;p&gt;Just a basic HTML form! We know that ColdBox provides us with the an rc struct, which is a reference to the request collection. On line 5 we use another of ColdBox&apos;s methods: event.valueExists(). This functions returns true if the requested variable exists in the request collection and false if it doesn&apos;t.&lt;/p&gt;
&lt;h4&gt;Working with the form data&lt;/h4&gt;
&lt;p&gt;We setup our page to submit to the processLogin action of the users handler. Before I paste the code here&apos;s a rundown of what this event needs to do:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Ensure the user name and password provided is valid;&lt;/li&gt;
	&lt;li&gt;If invalid, return to login page and display the error;&lt;/li&gt;
	&lt;li&gt;If valid, construct a structure with the user&apos;s info;&lt;/li&gt;
	&lt;li&gt;Store the user information in the session scope;&lt;/li&gt;
	&lt;li&gt;If the user wants to stay logged in, store a cookie;&lt;/li&gt;
	&lt;li&gt;Return the user to the main page.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Here&apos;s what I have right now to go through this:&lt;/p&gt;
&lt;code&gt;	&lt;cffunction name=&quot;processLogin&quot; access=&quot;public&quot; returntype=&quot;void&quot; output=&quot;false&quot;&gt;
		&lt;cfargument name=&quot;event&quot; type=&quot;any&quot; /&gt;
		
		&lt;cfset var loc = { rc=event.getCollection() } /&gt;
		
		&lt;cfset loc.authService = getPlugin( &quot;ioc&quot; ).getBean( &quot;authenticationService&quot; ) /&gt;
		&lt;cfset loc.authBean = loc.authService.authenticate( 
				user_name = loc.rc.user_name, 
				password = loc.rc.password 
			) /&gt;
			
		&lt;cfif NOT loc.authService.isAuthenticated( loc.authBean )&gt;
			&lt;cfset loc.rc.login_error = loc.authBean.getError() /&gt;
			&lt;cfset index( event ) /&gt;
			&lt;cfreturn /&gt;
		&lt;/cfif&gt;
		
		&lt;cfset loc.oUser = getPlugin( &quot;ioc&quot; ).getBean( &quot;userService&quot; ).getUser( user_id = loc.authBean.getUser_id() ) /&gt;
		
		&lt;cfset loc.sUser = {
				user_id = loc.oUser.getUser_id(),
				user_hash = loc.oUser.getUser_hash(),
				user_name = loc.oUser.getUser_name(),
				email = loc.oUser.getEmail()
			} /&gt;
			
		&lt;cfset getPlugin( &quot;sessionstorage&quot; ).setVar( &quot;userInfo&quot;, loc.sUser ) /&gt;
		
		&lt;cfif event.getValue( &quot;persist&quot;, false )&gt;
			&lt;cfcookie  name=&quot;squash_user_hash&quot; value=&quot;#loc.sUser.user_hash#&quot; expires=&quot;10&quot; /&gt;
		&lt;/cfif&gt;
		
		&lt;cfset setNextRoute( &quot;general&quot; ) /&gt;
		
		&lt;cfset event.noRender( false ) /&gt;
	&lt;/cffunction&gt;&lt;/code&gt;
&lt;p&gt;I&apos;ll start by going through the entire event, and then I&apos;ll show the code behind some of these objects. So, we start by asking our authentication service to check if the user&apos;s information is valid. If the information is incorrect, we set a variable in our request collection and call the previous event. As you can see, all we need to do is call the method associated to that event to have it fire again. If everything&apos;s OK we can use the user service to retrieve the user&apos;s remaining information and store it in a structure.&lt;/p&gt;
&lt;p&gt;ColdBox has a built-in plugin that encapsulates calls to the session variable. It basically takes care of locking the scope whenever you need to read from/write into it. By calling the plugin and using it&apos;s setVar method we can place our user&apos;s information in the session scope. Then, we use ColdBox&apos;s event.getValue() method to return the persist variable. However, since it&apos;s a checkbox if it wasn&apos;t checked it won&apos;t exist. The second parameter of the method is the value returned if it doesn&apos;t exist. Handy, right? So, if the checkbox was checked, store a cookie with the user&apos;s hash in it. Once we&apos;re done we tell ColdBox to send the user back to the default action of the general handler, which in our case will be our home page. The last call to event.noRender() tells ColdBox not to show a page for this event.&lt;/p&gt;
&lt;p&gt;I had planned to go show how I setup the authentication model today, but then I looked back at all that&apos;s already there and I thought it&apos;s probably more than enough for today. We at least covered how to submit and process forms in ColdBox, and saved the user&apos;s information in the session scope. Tomorrow we&apos;ll see more code from the authentication system.&lt;/p&gt;
				</description>
				
				<category>Coldfusion</category>
				
				<category>Coldbox</category>
				
				<category>Projects</category>
				
				<pubDate>Mon, 03 Aug 2009 13:28:00 -0500</pubDate>
				<guid>http://blog.critical-web.com/index.cfm/2009/8/3/Getting-To-Know-Our-Users</guid>
				
				
			</item>
			
			<item>
				<title>SQUASH: Unveiling</title>
				<link>http://blog.critical-web.com/index.cfm/2009/7/31/SQUASH-Unveiling</link>
				<description>
				
				&lt;p&gt;Surprise! Yeah, I bet you didn&apos;t see that one coming, did you? It&apos;s Friday and I didn&apos;t want to start getting into the code just before a week-end. What better opportunity, then, to go ahead and announce the details of my new project? For your reading pleasure, I give to you: SQUASH.&lt;/p&gt;&lt;h4&gt;What is SQUASH?&lt;/h4&gt;
&lt;p&gt;You&apos;ve all been waiting for it, so here it is. SQUASH is (will be) a full-featured bug tracker / ticketting system. The goal is simple: to provide a streamlined, easy-to-use interface for tracking bugs and enhancement requests. It will also integrate a wiki-based templating system that&apos;ll allow for documentation and other resources to be placed within the system.&lt;/p&gt;
&lt;h4&gt;Another tracker? Why?&lt;/h4&gt;
&lt;p&gt;There are several reasons, really. The first thing that motivated me into doing this is that the tracker we currently use at work is a complete piece of &lt;strong&gt;crap&lt;/strong&gt;. Granted, it&apos;s the first tracker I had to work with, but still, nothing about it is &lt;em&gt;easy&lt;/em&gt; or &lt;em&gt;practical&lt;/em&gt;. A simple example: the interface for replying to a thread doesn&apos;t display past posts. I actually need to have two windows open: one for the original thread, one for the response so I can respond to each point.&lt;/p&gt;
&lt;p&gt;Another reason is that there aren&apos;t many ColdFusion solutions out there for bug tracking. Sure, there&apos;s Ray Camden&apos;s &lt;a href=&quot;http://lighthousepro.riaforge.org/&quot; target=&quot;_blank&quot;&gt;Lighthouse Pro&lt;/a&gt;, but if I stopped myself from doing something just because Ray did it already, I&apos;d be out of a job :P.&lt;/p&gt;
&lt;p&gt;And then, there&apos;s the plain fact that I needed something to do. I want to prove to myself that I can see this project through. It&apos;s a relatively large project in that it has several compoments working together to achieve a single goal: making our lives as programmers easier and more efficient (*cries*).&lt;/p&gt;
&lt;h4&gt;Okay, you win. What will SQUASH have that&apos;ll make it so awesome?&lt;/h4&gt;
&lt;p&gt;Well, I wouldn&apos;t say &lt;em&gt;awesome&lt;/em&gt; (*blushes*). Really cool, though. Anyways, here&apos;s a quick rundown of a couple of key features I&apos;d &lt;strong&gt;&lt;em&gt;like&lt;/em&gt;&lt;/strong&gt; SQUASH to have when launched, in no particular order:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Complete user management (roles, permissions, etc.);&lt;/li&gt;
	&lt;li&gt;Ticket bucketting: categories, folders, groups, etc.;&lt;/li&gt;
	&lt;li&gt;User and ticket queues;&lt;/li&gt;
	&lt;li&gt;Wiki-based templating system;&lt;/li&gt;
	&lt;li&gt;Simple and streamlined user interface;&lt;/li&gt;
	&lt;li&gt;Mylyn integration (this would be &lt;strong&gt;neat&lt;/strong&gt;, though could be tough);&lt;/li&gt;
	&lt;li&gt;Ajaxified elements? This one&apos;s tricky, as some functions warrant AJAX, and some don&apos;t. Might need to think a bit more on this one;&lt;/li&gt;
	&lt;li&gt;And much, much more!&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Like I said, not necessarily all of these features will make it, but I&apos;d sure like them to. As work progresses on the project I might even add in new features as I play around the interface and think of new ways to make it more awesom&lt;strong&gt;&lt;em&gt;er&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;h4&gt;This project sounds cool. How can I help?&lt;/h4&gt;
&lt;p&gt;There&apos;s no denying that several people working on a project will generally get it out the door faster. I&apos;m not necessarily aiming for a quick release, though. Like I stated previously, I&apos;m using this project to hone my skills using ColdBox and Coldspring. If people want to join in on the learning experience, that&apos;s fine by me. If I see enough interest I might setup a project on RIAForge to &lt;em&gt;facilitate&lt;/em&gt; collaboration. In the meantime, this blog will serve as a daily log of my progress, as well as way for me to share what I&apos;ve learned working on the project. Of course, any comments / insight / complaints and insults are always welcome.&lt;/p&gt;
&lt;p&gt;Thanks for sticking around this long. Stay tuned for more.&lt;/p&gt;
				</description>
				
				<category>Coldfusion</category>
				
				<category>Projects</category>
				
				<category>Critical-Web news</category>
				
				<pubDate>Fri, 31 Jul 2009 09:20:00 -0500</pubDate>
				<guid>http://blog.critical-web.com/index.cfm/2009/7/31/SQUASH-Unveiling</guid>
				
				
			</item>
			
			<item>
				<title>Using Coldspring With ColdBox</title>
				<link>http://blog.critical-web.com/index.cfm/2009/7/30/Using-Coldspring-With-ColdBox</link>
				<description>
				
				&lt;p&gt;So what does Coldspring do, anyways? We know by now that it&apos;s an Inversion of Control (IoC) framework. We also know that it helps us manage dependencies between objets. And yet, we&apos;re not quite sure what that means exactly yet. To help demonstrate the power of Coldspring, I&apos;ve prepared a simple example.&lt;/p&gt;&lt;p&gt;To show what Coldspring can do, we need objects. For the purpose of our example, we&apos;re going to use a dummy &lt;em&gt;Person&lt;/em&gt; model. Our model needs properties, so let&apos;s try and see how we can define a person. A person generally has a couple of generic traits: name, birth date, sex (*giggle*), height, weight, and so on. Generally we&apos;d need a way to save all of our people, so we&apos;ll have to think of a table that can hold all of them:&lt;/p&gt;
&lt;pre&gt;&lt;strong&gt;person_id&lt;/strong&gt;	&lt;em&gt;integer&lt;/em&gt;
name		&lt;em&gt;varchar&lt;/em&gt;
birth date	&lt;em&gt;datetime&lt;/em&gt;
sex		&lt;em&gt;char&lt;/em&gt;
height		&lt;em&gt;smallint&lt;/em&gt;
weigth		&lt;em&gt;smallint&lt;/em&gt;
[...]&lt;/pre&gt;
&lt;p&gt;Simple stuff. Now, our generic template for most of our templates will require four objects: a bean, a service object, a gateway and a DAO.&lt;/p&gt;
&lt;dl&gt;
	&lt;dt&gt;Bean&lt;/dt&gt;
	&lt;dd&gt;Picture the bean as the actual representation of our object. Through the bean we can set and get it&apos;s properties and make sure that it&apos;s valid in it&apos;s current state.&lt;/dd&gt;
	&lt;dt&gt;Service object&lt;/dt&gt;
	&lt;dd&gt;This is generally who we&apos;re going to be talking to. We&apos;ll ask our service object for an instanciated bean of our person model; we&apos;ll ask our service object to retrieve a series of beans; we&apos;ll ask our service object to save our bean in the DB; etc. The service object then handles the request and sends it to the appropriate object for processing.&lt;/dd&gt;
	&lt;dt&gt;Gateway&lt;/dt&gt;
	&lt;dd&gt;The gateway serves as the proxy to the database for multi-user queries. Generally the gateway will be used to select a list of model objects.&lt;/dd&gt;
	&lt;dt&gt;DAO&lt;/dt&gt;
	&lt;dd&gt;The DAO, or Data Access Object, is the proxy for CRUD (Create, Read, Update, Delete) operations on an object. The service object will use the DAO to perform CRUD operations on the model.&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;&lt;em&gt;Real-life update 1: Electrical problems on the train. It&apos;s hot as hell but I get more time to write :P.&lt;/em&gt;&lt;/p&gt;
&lt;blockquote&gt;Using a tool like cfcgenerator can save you alot of time when writing your domain model. It will take a table and generate all four objects for you.&lt;/blockquote&gt;
&lt;p&gt;If we look at what a tool like cfcgenerator generates for us, we&apos;ll notice four new .cfcs. Here they are with the interesting parts outlined:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Real-life update 2: Turns out a cable snapped and it&apos;ll take at least half an hour to fix. Ironically I&apos;m 10 minutes&apos; walk away from my parents house.&lt;/em&gt;&lt;/p&gt;
&lt;pre&gt;&lt;strong&gt;person.cfc&lt;/strong&gt;
--------------
init()
setPerson_id()
setName()
[...]
getPerson_id()
getName()
[...]

&lt;strong&gt;personService.cfc&lt;/strong&gt;
--------------
init()
	personGateway &lt;em&gt;personGateway&lt;/em&gt;
	personDAO &lt;em&gt;personDAO&lt;/em&gt;
getPerson()
getPersons()
savePerson()
[...]

&lt;strong&gt;personGateway.cfc&lt;/strong&gt;
--------------
init()
	dsn &lt;em&gt;string&lt;/em&gt;
getPersonsByAttribute()
[...]

&lt;strong&gt;personDAO.cfc&lt;/strong&gt;
init()
	dsn &lt;em&gt;string&lt;/em&gt;
create()
read()
update()
delete()
[...]&lt;/pre&gt;
&lt;p&gt;As you can see I didn&apos;t list out all the methods: just enough to show what these objects actually do and what they depend on. Notice that personService object needs to have the personGateway and personDAO objects passed in when inited. Also, both the personGateway and personDAO objects require a dsn string be passed in when inited. Without IoC, here&apos;s how that would look like:&lt;/p&gt;
&lt;code&gt;&lt;cfscript&gt;
dsn = &quot;mydsn&quot;;

// remember we have a squash mapping that points to our install location
oPersonGateway = createObject( 
		&quot;component&quot;, 
		&quot;squash.model.personGateway&quot; 
	).init( dsn=dsn );

oPersonDAO = createObject( 
		&quot;component&quot;, 
		&quot;squash.model.personDAO&quot; 
	).init( dsn=dsn );

oPersonService = createObject( 
		&quot;component&quot;, 
		&quot;squash.model.personService&quot; 
	).init( 
		personGateway=oPersonGateway, 
		personDAO = oPersonDAO 
	);
&lt;/cfscript&gt;&lt;/code&gt;
&lt;p&gt;That&apos;s alot of code! Enough to turn anyone away from using object-oriented programming. With Coldspring, however, things get much easier.&lt;/p&gt;
&lt;code&gt;&lt;cfset oPersonService = getPlugin( &quot;ioc&quot; ).getBean( &quot;personService&quot; ) /&gt;&lt;/code&gt;
&lt;p&gt;There&apos;s a plugin within ColdBox called &quot;ioc&quot;. This is basically what talks to Coldspring and makes all the magic work. Using the plugin&apos;s getBean method we ask Coldspring to return the personService object instantiated. It takes care of resolving any and all dependencies.&lt;/p&gt;
&lt;p&gt;But how does Coldspring know how to resolve these dependencies? In our config folder there&apos;s a coldspring.xml.cfm file. Within that file we define our objects (beans) and declare how they depend on each other. When cfcgenerator generates all our model code, it also generates a coldspring definition file for each of the objects generated. We just need to merge them all together and put them in our own file:&lt;/p&gt;
&lt;code&gt;&lt;!DOCTYPE beans PUBLIC &quot;-//SPRING//DTD BEAN//EN&quot; &quot;http://www.springframework.org/dtd/spring-beans.dtd&quot;&gt;  
&lt;beans&gt;

	&lt;bean id=&quot;personDAO&quot; class=&quot;squash.model.personDAO&quot;&gt;
		&lt;constructor-arg name=&quot;dsn&quot;&gt;&lt;value&gt;${dsn}&lt;/value&gt;&lt;/constructor-arg&gt;
	&lt;/bean&gt;
	&lt;bean id=&quot;personGateway&quot; class=&quot;squash.model.personGateway&quot;&gt;
		&lt;constructor-arg name=&quot;dsn&quot;&gt;&lt;value&gt;${dsn}&lt;/value&gt;&lt;/constructor-arg&gt;
	&lt;/bean&gt;
	&lt;bean id=&quot;personService&quot; class=&quot;squash.model.personService&quot;&gt;
		&lt;constructor-arg name=&quot;personDAO&quot;&gt;
			&lt;ref bean=&quot;personDAO&quot;/&gt;
		&lt;/constructor-arg&gt;
		&lt;constructor-arg name=&quot;personGateway&quot;&gt;
			&lt;ref bean=&quot;personGateway&quot;/&gt;
		&lt;/constructor-arg&gt;
	&lt;/bean&gt;

&lt;/beans&gt;&lt;/code&gt;
&lt;p&gt;Each &quot;bean&quot; represents an object in our domain model. We give them an ID so they can be referenced elsewhere in the config file as well as by the getBean method. The class attribute points to the actual .cfc file.&lt;/p&gt;
&lt;p&gt;Within each bean you can notice that there are constructor-arg nodes. These are arguments that will be passed in to the init method of each object. For both the personGateway and personDAO nodes the single constructor-arg is the dsn, which in this case is a reference to a ColdBox setting variable. Anytime you enclose a value with ${}, ColdBox will attempt to pass in a value from the &lt;em&gt;YourSettings&lt;/em&gt; node in the coldbox.xml.cfm.&lt;/p&gt;
&lt;p&gt;The personService bean is slightly different. Instead of having a value node within it&apos;s constructor-args, it has a ref node. This is how you tell Coldspring that a bean depends on another (or others). You pass in the ID of the bean and Coldspring knows that it will need to resolve their dependencies and inject them into the bean requested before sending it back.&lt;/p&gt;
&lt;p&gt;You might also notice that there&apos;s nothing in there relating to the person object. The reason is that generally we won&apos;t need to access the person bean directly: the service object will provide it for us. Since it isn&apos;t a dependancy of anything, and that we won&apos;t be asking Coldspring for it, we can leave it out.&lt;/p&gt;
&lt;p&gt;And that&apos;s the end of my eventful ride to work. We won&apos;t be needing the person model for SQUASH so we won&apos;t be seeing it again. Tomorrow, if nothing goes wrong (*knocks on wood*), we should be looking at some actual SQUASH code.&lt;/p&gt;
				</description>
				
				<category>Coldfusion</category>
				
				<category>Coldspring</category>
				
				<category>Coldbox</category>
				
				<pubDate>Thu, 30 Jul 2009 10:28:00 -0500</pubDate>
				<guid>http://blog.critical-web.com/index.cfm/2009/7/30/Using-Coldspring-With-ColdBox</guid>
				
				
			</item>
			
			<item>
				<title>Creating Our First Event</title>
				<link>http://blog.critical-web.com/index.cfm/2009/7/28/Creating-Our-First-Event-And-Trying-Out-Coldspring</link>
				<description>
				
				&lt;p&gt;Now that our application is setup, we want to make sure that it works. We&apos;ll start out by removing extra files we won&apos;t need. Once that&apos;s done we&apos;ll setup our default event and make sure everything&apos;s working.&lt;h3&gt;Pruning the install&lt;/h3&gt;
&lt;p&gt;ColdBox includes a couple of extra files in it&apos;s application template. These files generally serve to display the default &quot;welcome&quot; event. Since we&apos;ll be replacing this event by our own, we can strip out a couple of files from the template:&lt;/p&gt;
&lt;pre&gt;/
	includes/
		helpers/
			ApplicationHelper.cfm
		images/
			coldbox.png
	logs/
		YourAppNamehere.log (a new one will be generated with our actual app name)
	build.properties
	build.xml
	readme.txt&lt;/pre&gt;
&lt;p&gt;All that should be left now is all that we need for our ColdBox-based application to work.&lt;/p&gt;
&lt;h3&gt;An event&lt;/h3&gt;
&lt;blockquote&gt;An event is basically an &lt;em&gt;action&lt;/em&gt;. When you request a page in ColdBox, you call an &lt;em&gt;event&lt;/em&gt;. ColdBox then wires that event to a method in one of it&apos;s handlers, which then handles the request.&lt;/blockquote&gt;
&lt;p&gt;It&apos;s important to understand the idea behind event handling before proceeding. When you call a page, traditionally, your url would look something like this:&lt;/p&gt;
&lt;pre&gt;/squash/some_folder/file.cfm&lt;/pre&gt;
&lt;p&gt;In a ColdBox-based app (and many other MVC style frameworks), your url would look more like so:&lt;/p&gt;
&lt;pre&gt;/squash/index.cfm?event=some_handler.some_action&lt;/pre&gt;
&lt;p&gt;We&apos;re passing in a URL variable to ColdBox: event. This variable contains two very important parts delimited by the period. The first part, &lt;em&gt;some_handler&lt;/em&gt;, is the &lt;em&gt;handler&lt;/em&gt;. The handler is basically a .cfc file with loads of methods in it. The second part, &lt;em&gt;some_action&lt;/em&gt;, is the name of the &lt;em&gt;action&lt;/em&gt;. The action represents a method in the handler. By convention, when ColdBox receives an event call, it will look for a .cfc file with the name of &lt;em&gt;handler&lt;/em&gt; in the handlers folder. It will then call the method within it that has the same name as the &lt;em&gt;action&lt;/em&gt;. In our case, it will look for a some_handler.cfc file in the handlers folder, and call it&apos;s some_action method.&lt;/p&gt;
&lt;p&gt;Now that the groundwork is done, let&apos;s override the default event left by ColdBox and create our own. In the coldbox.xml.cfm file, in the config folder, there&apos;s a setting named &quot;DefaultEvent&quot;. This represents the event called in the case that none is provided; when someone hits index.cfm without providing an &quot;event&quot; variable, this is what will be called. Right now it&apos;s set to general.index which is just fine. Knowing what we now know, we can open up general.cfc in the handlers folder and search for the index method within it to see what it actually does:&lt;/p&gt;
&lt;code&gt;&lt;cffunction name=&quot;index&quot; access=&quot;public&quot; returntype=&quot;void&quot; output=&quot;false&quot;&gt;
	&lt;cfargument name=&quot;Event&quot; type=&quot;any&quot;&gt;

	&lt;cfset Event.setValue(&quot;welcomeMessage&quot;,&quot;Welcome to ColdBox!&quot;)&gt;	
	

	&lt;cfset Event.setView(&quot;home&quot;)&gt;
&lt;/cffunction&gt;&lt;/code&gt;
&lt;p&gt;Not much happening here. All actions receive an event variable, which contains all the functions/methods pertaining to the current request. One of those methods is setValue(). This adds/sets a variable within the request collection, which is then available through all methods/views for that particular request. We provide the variable name and then it&apos;s value.&lt;/p&gt;
&lt;blockquote&gt;A view is a ColdFusion template for displaying, well, stuff. In a MVC style framework, data is parsed/mashed in the model (M) and controller (C), while the view (V) should only bother with displaying stuff. In a ColdBox application, the model layer (M) is consisted of your beans (more on that later) and the controller (C) is made of your handlers and events.&lt;/blockquote&gt;
&lt;p&gt;We won&apos;t need the welcomeMessage where we&apos;re going, so we can remove it. Once we&apos;re done, we tell ColdBox which view to use to display our data. By convention, the views are located in the views folder. Tricky, huh? Let&apos;s open up home.cfm in the views folder and clear it out. We&apos;ll start by a simple hello world message:&lt;/p&gt;
&lt;code&gt;&lt;p&gt;Hello world!&lt;/p&gt;&lt;/code&gt;
&lt;p&gt;When outputting that in the browser (by calling index.cfm or by providing the event parameter with index.cfm?event=general.index) we get the expected result... or do we? We can see our hello world message just fine, however some things are off. Why is there a title to our page? Also, some styles seem to be applied by default. The answer to these questions is rather simple: ColdBox uses a layout system to &quot;wrap&quot; around your views. You can create any amount of layouts you want and assign them to specific views or events. For now, we&apos;ll settle with using just the default layout. To modify it, we first have to figure out where it is. In the coldbox.xml.cfm file, there&apos;s a Layouts node. Within this node there&apos;s another one named DefaultLayout. This is currently set to Layout.Main.cfm, which is fine. By convention, layouts are in the layouts folder. Now that we know which file is causing our problems let&apos;s open it. For the time being we&apos;ll just clean out everything we don&apos;t need and leave it as a simple shell:&lt;/p&gt;
&lt;code&gt;&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
	&lt;head&gt;
		&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
		&lt;title&gt;Oooh, a layout!&lt;/title&gt;
	&lt;/head&gt;
	&lt;body&gt;
		&lt;cfoutput&gt;#renderView()#&lt;/cfoutput&gt;
	&lt;/body&gt;
&lt;/html&gt;
&lt;/code&gt;
&lt;p&gt;A quick refresh to confirm everything is working well... great!&lt;/p&gt;
&lt;p&gt;I took a little longer than expected to go over these basics because I think it&apos;s important that at least this is covered before going into the nitty-gritty of the application coming up ahead. I won&apos;t go into as much detail for the basics in the next posts, however. One more post about the basics of ColdBox and ColdSpring and we actually get to work on SQUASH.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;edit:&lt;/strong&gt; removed ColdSpring from the title, that&apos;s for the next post ;).&lt;/p&gt;
				</description>
				
				<category>Coldfusion</category>
				
				<category>Coldbox</category>
				
				<pubDate>Tue, 28 Jul 2009 09:33:00 -0500</pubDate>
				<guid>http://blog.critical-web.com/index.cfm/2009/7/28/Creating-Our-First-Event-And-Trying-Out-Coldspring</guid>
				
				
			</item>
			
			<item>
				<title>Weird lsDateFormat issue</title>
				<link>http://blog.critical-web.com/index.cfm/2009/7/27/Weird-lsDateFormat-issue</link>
				<description>
				
				&lt;p&gt;Today I stumbled upon a strange lsDateFormat issue. On a project I&apos;m currently working on (not THE project ;)) dates are stored in this format: &quot;mm/dd/yyyy&quot;. Today, one of the pages started throwing an odd error:&lt;/p&gt;&lt;blockquote&gt;7/29/2009 is an invalid date format.&lt;/blockquote&gt;
&lt;p&gt;For some reason this particular date was throwing it off. I also ran a couple of tests to try and figure out where things were going wrong.&lt;/p&gt;
&lt;code&gt;&lt;cfset dtstring = &quot;7/29/2009&quot; /&gt;

&lt;cfoutput&gt;
&lt;p&gt;
	Is date valid: #isValid( &quot;date&quot;, dtstring )#
&lt;/p&gt;
&lt;p&gt;
	lsDateFormat, plain:
	&lt;cftry&gt;
		#lsDateFormat( dtstring, &quot;long&quot; )#
		&lt;cfcatch&gt;FAIL&lt;/cfcatch&gt;
	&lt;/cftry&gt;
&lt;/p&gt;
&lt;p&gt;
	lsDateFormat, fixed?:
	&lt;cftry&gt;
		#lsDateFormat( dtstring+0, &quot;long&quot; )#
		&lt;cfcatch&gt;FAIL&lt;/cfcatch&gt;
	&lt;/cftry&gt;
&lt;/p&gt;
&lt;p&gt;
	dateFormat:
	&lt;cftry&gt;
		#dateFormat( dtstring, &quot;long&quot; )#
		&lt;cfcatch&gt;FAIL&lt;/cfcatch&gt;
	&lt;/cftry&gt;
&lt;/p&gt;
&lt;/cfoutput&gt;&lt;/code&gt;
&lt;p&gt;Running the above code I was left with the following output:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Is date valid: YES&lt;/p&gt;
&lt;p&gt;lsDateFormat, plain: FAIL&lt;/p&gt;
&lt;p&gt;lsDateFormat, fixed: July 29, 2009&lt;/p&gt;
&lt;p&gt;dateFormat: July 29, 2009&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The first thing that&apos;s odd is that the isValid call returns true. ColdFusion recognizes that this is a valid date. Also, passing it to dateFormat works perfectly. Why, then, does sending it to lsDateFormat fail?&lt;/p&gt;
&lt;p&gt;The fix I ended up putting in is rather simple. By adding 0 to the string, we are forcing ColdFusion to convert the date to it&apos;s integer representation before performing the operation. Once that&apos;s done, the original date&apos;s format is no longer important.&lt;/p&gt;
&lt;p&gt;It&apos;s also worth noting that using the ISO format (yyyy-mm-dd) in this case would&apos;ve also solved the problem. However, in my case, changing the date formats was not a possibility and I had to rely on this &quot;quick-fix&quot;.&lt;/p&gt;
				</description>
				
				<category>Coldfusion</category>
				
				<pubDate>Mon, 27 Jul 2009 15:34:00 -0500</pubDate>
				<guid>http://blog.critical-web.com/index.cfm/2009/7/27/Weird-lsDateFormat-issue</guid>
				
				
			</item>
			
			<item>
				<title>Getting Our Project Started</title>
				<link>http://blog.critical-web.com/index.cfm/2009/7/27/Getting-Our-Project-Started</link>
				<description>
				
				&lt;p&gt;Last week we were talking about using ColdBox and Coldspring to run our project. Let&apos;s take a look at how we actually make this happen.&lt;/p&gt;&lt;p&gt;The first thing we need to do is download the latest stable release of both frameworks. You can download ColdBox from &lt;a href=&quot;http://www.coldbox.org/index.cfm/download&quot; target=&quot;_blank&quot;&gt;http://www.coldbox.org/index.cfm/download&lt;/a&gt; and Coldspring from &lt;a href=&quot;http://www.coldspringframework.org/&quot; target=&quot;_blank&quot;&gt;http://www.coldspringframework.org/&lt;/a&gt;. The docs recommend we unpack the archives directly unto our web root. Personally I do it slightly differently. Using the power of application-specific mappings, we can place them pretty much anywhere we want, as long as we create a mapping for them in our application.cfc file. On my install, I have a frameworks folder in my web root and within it version-specific folders for each framework&lt;/p&gt;
&lt;code&gt;/
	frameworks/
		coldbox_2.6.2/
		coldbox_2.6.3/
		coldspring_1.2/&lt;/code&gt;
&lt;p&gt;This allows me to tell each distinct application which version of each framework to use. The next step is copying over the application template from ColdBox&apos;s install folder to where we want our application to be. In the root of our new folder, there are now two files of interest: Application.cfc and Application_noinheritance.cfc. This is where we get to choose which one we want.&lt;/p&gt;
&lt;dl&gt;
	&lt;dt&gt;Application.cfc&lt;/dt&gt;
	&lt;dd&gt;This file extends the ColdBox framework. Since the link to the framework is (and has to be) in the first line, there is no way to specify where to find the appropriate version without hard-coding it in the extends attribute.&lt;/dd&gt;
	&lt;dt&gt;Application_noinheritance.cfc&lt;/dt&gt;
	&lt;dd&gt;This version extends no other cfc&apos;s. This is perfect for us, since we now have plenty of room to create our mappings before the application creates a reference to the framework.&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;At this point, we can safely delete Application.cfc and remove _noinheritance from the other file&apos;s name. In our new Application.cfc file, we&apos;ll add a couple of lines just before the application sets it&apos;s root path:&lt;/p&gt;
&lt;code&gt;&lt;cfcomponent output=&quot;false&quot;&gt;

	&lt;cfset this.name = hash(getCurrentTemplatePath())&gt; 
	&lt;cfset this.sessionManagement = true&gt;
	&lt;cfset this.sessionTimeout = createTimeSpan(0,0,30,0)&gt;
	&lt;cfset this.setClientCookies = true&gt;
	
	&lt;cfset this.mappings[ &quot;/coldbox&quot; ] = expandPath( &quot;/frameworks/coldbox_2.6.3&quot; ) /&gt;
	&lt;cfset this.mappings[ &quot;/coldspring&quot; ] = expandPath( &quot;/frameworks/coldspring_1.2&quot; ) /&gt;
	&lt;cfset this.mappings[ &quot;/squash&quot; ] = getDirectoryFromPath(getCurrentTemplatePath()) /&gt;
	
	&lt;cfset COLDBOX_APP_ROOT_PATH = getDirectoryFromPath(getCurrentTemplatePath())&gt;

	&lt;cfset COLDBOX_CONFIG_FILE = &quot;&quot;&gt;
	
	&lt;cffunction name=&quot;onApplicationStart&quot; returnType=&quot;boolean&quot; output=&quot;false&quot;&gt;&lt;/code&gt;
&lt;p&gt;Notice the three lines starting with &quot;&amp;lt;cfset this.mappings&quot;. These three lines do the same thing than actually going into your admin and creating three mappings, with one major difference: the mappings are exclusive to this application. That means that you could actually have a /coldbox mapping in your admin but within this application it would use a different path for it.&lt;/p&gt;
&lt;blockquote&gt;A mapping is a way for your application to link to a specific path on your system, without having to write the entire string out each time. When &lt;/blockquote&gt;
&lt;p&gt;The first two lines are for the frameworks. The mappings require an absolute path (c:\path\to\your\folder) which is why we need to use expandPath. The third line is a shortcut I use for linking to the application&apos;s folder. By retrieving the directory from the current template (Application.cfc) we have a direct link to the application&apos;s root. As a bonus, even if we move our application (new folder, new server, etc.), it will always have a squash mapping linking to it&apos;s exact installation location.&lt;/p&gt;
&lt;p&gt;ColdBox is great for using IoC frameworks: out of the box it can handle both Coldspring and Lightwire. For this project I&apos;ve decided to use Coldspring. So ColdBox knows which choice I&apos;ve made I&apos;ll tell it in the coldbox.xml.cfm file, located in the config folder of our install. In the settings block there are two nodes that we need to make sure are set appropriately: IOCFramework and IOCDefinitionFile:&lt;/p&gt;
&lt;code&gt;		&lt;Setting name=&quot;IOCFramework&quot; value=&quot;coldspring&quot; /&gt;
		&lt;Setting name=&quot;IOCDefinitionFile&quot; value=&quot;config/coldspring.xml.cfm&quot; /&gt;&lt;/code&gt;
&lt;p&gt;With these two little lines of code ColdBox now knows which IoC framework we want to use and where to find it&apos;s definition file. Now then, what do we put in that definition file? Well, that&apos;s s story for another day. At this point, ColdBox and Coldspring stand ready, but all that&apos;s in the application is the default event. We can call it by hitting the application&apos;s index.cfm file. Ain&apos;t it pretty? We&apos;ll strip all of that out tomorrow morning. In the meantime, don&apos;t forget to eat your vegetables.&lt;/p&gt;
				</description>
				
				<category>Coldfusion</category>
				
				<category>Coldspring</category>
				
				<category>Coldbox</category>
				
				<category>Projects</category>
				
				<pubDate>Mon, 27 Jul 2009 09:35:00 -0500</pubDate>
				<guid>http://blog.critical-web.com/index.cfm/2009/7/27/Getting-Our-Project-Started</guid>
				
				
			</item>
			
			<item>
				<title>New project: additional details are leaked</title>
				<link>http://blog.critical-web.com/index.cfm/2009/7/24/New-project-additional-details-are-leaked</link>
				<description>
				
				&lt;p&gt;Two days ago I had announced that I&apos;d started work on a new project that I&apos;d been wanting to work on for a while. Rather than spill out all the details in one post, I thought it&apos;d be better (and funnier) to stretch it out a little.&lt;/p&gt;&lt;p&gt;What&apos;s in a name? A product&apos;s name is what defines it. When people first see / hear about your product, they see / hear it&apos;s name. Your first impression is achieved by how you call your project. You could always name your project something like &quot;Another Forum Software&quot; or &quot;Blog&quot; and, although original (in their simplicity), these names simply don&apos;t stand out. Sure, they give us a pretty good idea about what they actually are, but that&apos;s pretty much it. No emotion. No power. So... cold. On the other end of the spectrum, you have names like &lt;a href=&quot;http://galleon.riaforge.org/&quot; target=&quot;_blank&quot;&gt;Galleon Forums&lt;/a&gt;, by Raymond Camden, or &lt;a href=&quot;http://www.mangoblog.org/&quot; target=&quot;_blank&quot;&gt;Mango Blog&lt;/a&gt; by Laura Arguello, both excellent products. When I think of galleons, I see ships crossing the Atlantic Ocean reuniting long-separated continents. For mangos, I think of sweet, sexy, sure; I especially think of &lt;em&gt;enjoyable&lt;/em&gt;. These projects and several others served as an inspiration.&lt;/p&gt;
&lt;p&gt;Now what did I name my project? I can&apos;t give you too many details about the thought process (that&apos;d give you too many hints), but I will say what I&apos;ve decided to call it:&lt;/p&gt;
&lt;blockquote&gt;SQUASH&lt;/blockquote&gt;
&lt;p&gt;Yes, in caps. It adequately represents the core of what the project is, and still has an original ring to it.&lt;/p&gt;
&lt;p&gt;Now, for the project itself. I will be writing using the excellent &lt;a href=&quot;http://www.coldboxframework.com/&quot; target=&quot;_blank&quot;&gt;ColdBox Framework&lt;/a&gt; as a base for the application. It has served me well in the past, and will provide a robust structure from which I can build my project. I will also be using &lt;a href=&quot;http://www.coldspringframework.org/&quot; target=&quot;_blank&quot;&gt;Coldspring&lt;/a&gt; to manage my object dependancies. Coldspring is an IoC (inversion-of-control) framework that can relieve many of the headaches associated with having several objects in your domain model. It also integrates seamlessly with ColdBox, which is a plus. As a time-saver, I will use &lt;a href=&quot;http://cfcgenerator.riaforge.org/&quot; target=&quot;_blank&quot;&gt;Illudium PU-36 Code Generator&lt;/a&gt; (or cfcgenerator for close friends) to generate my basic model files and Coldspring definition file. This is a great tool and saves you from typing the same validation and set/get functions over and over again.&lt;/p&gt;
&lt;p&gt;So that&apos;s it for today. The train is arriving in the station. In the next episode we&apos;ll go over getting all of these great tools working together. If you&apos;re nice, I might also have some more details on my project as well.&lt;/p&gt;
				</description>
				
				<category>Coldspring</category>
				
				<category>Coldbox</category>
				
				<category>Projects</category>
				
				<pubDate>Fri, 24 Jul 2009 09:25:00 -0500</pubDate>
				<guid>http://blog.critical-web.com/index.cfm/2009/7/24/New-project-additional-details-are-leaked</guid>
				
				
			</item>
			
			<item>
				<title>A New Dawn</title>
				<link>http://blog.critical-web.com/index.cfm/2009/7/22/A-New-Dawn</link>
				<description>
				
				&lt;p&gt;I&apos;m back again. Over the last couple of months I&apos;ve been pretty busy with a lot of things in my life. A new addition to the family and a new job all happening at the same time had a bigger impact on my &quot;blogging time&quot; that I had anticipated. Luckily, I feel that I&apos;ve finally struck a balance in my schedule and the time I spend commuting by train will be a perfect time to work on projects / blogging.&lt;/p&gt;
&lt;p&gt;I&apos;ve actually started work on something that I&apos;ve wanted to tackle for a while now. I&apos;ll have more information in the following days, but for now I just wanted to let the world know that I&apos;m &lt;em&gt;still alive&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Stay tuned.&lt;/p&gt;
				</description>
				
				<category>Critical-Web news</category>
				
				<pubDate>Wed, 22 Jul 2009 12:53:00 -0500</pubDate>
				<guid>http://blog.critical-web.com/index.cfm/2009/7/22/A-New-Dawn</guid>
				
				
			</item>
			
			<item>
				<title>Beginner&apos;s Guide Series - Basic ColdFusion, part 2</title>
				<link>http://blog.critical-web.com/index.cfm/2009/5/16/Beginners-Guide-Series--Basic-ColdFusion-part-2</link>
				<description>
				
				&lt;p&gt;Moving on with basic ColdFusion topics, today we&apos;ll look into the different variable types available. We&apos;ll also talk about the different ways of controlling the flow of the page through the use of conditional blocks and loops.&lt;/p&gt;&lt;h3&gt;ColdFusion variable types&lt;/h3&gt;
&lt;p&gt;A really nice feature of ColdFusion is that it is a typeless language. What that means, in plain English, is that even though we declare a variable with a certain type, we can always come back later and assign it a different variable type later. However, the type of the variable will give us access to different functions that we&apos;ll be able to use later.&lt;/p&gt;
&lt;h4&gt;Simple types&lt;/h4&gt;
&lt;p&gt;The simple variable types are remarkable due to the fact that they&apos;re, well, simple. The best way to explain them is that they hold a simple value, as opposed to complex data.&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;String&lt;/dt&gt;
&lt;dd&gt;
&lt;p&gt;String variables contain basic text. In our &lt;a href=&quot;http://blog.critical-web.com/blog/index.cfm/2009/5/13/Beginners-Guide-Series--Basic-ColdFusion-part-1&quot; target=&quot;_blank&quot;&gt;Hello world! example&lt;/a&gt; yesterday we stored our text in a string variable. When setting your string variable you need to enclose it within single- or double-quotes.&lt;/p&gt;
&lt;code&gt;&lt;cfset myVariable = &quot;myString&quot; /&gt;

&lt;!--- is the same as ---&gt;
&lt;cfset myVariable = &apos;myString&apos; /&gt;&lt;/code&gt;
&lt;p&gt;I realize now I haven&apos;t talked about comments in ColdFusion. They&apos;re very simple, really. &quot;&amp;lt;!---&quot; opens a ColdFusion comment, and &quot;---&amp;gt;&quot; closes it. Whatever is encompassed within will not be parsed by ColdFusion, and will not be returned to the browser.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;Numeric&lt;/dt&gt;
&lt;dd&gt;
&lt;p&gt;This type of variable contains numbers. The only difference between numeric and string is that numerics can only contain numbers. ColdFusion can convert between types automatically as long as the value is a number. Numeric values do not need to be enclosed within quotes.&lt;/p&gt;
&lt;code&gt;&lt;cfset myVariable = &quot;23&quot; /&gt;

&lt;!--- is the same as ---&gt;
&lt;cfset myVariable = 23 /&gt;&lt;/code&gt;
&lt;p&gt;This variable type can also contain floating numbers (1.23, 8.234, etc).&lt;/p&gt;
&lt;/dd&gt;
&lt;h4&gt;Complex types&lt;/h4&gt;
&lt;p&gt;Complex variable types generally contain a collection of data.&lt;/p&gt;
&lt;dt&gt;Lists&lt;/dt&gt;
&lt;dd&gt;
&lt;p&gt;A list is basically a string variable, however it is notable due to the fact that it may contain several values separated by a delimiter (the default is a comma (,)). Nothing special needs to be done for ColdFusion to recognize the variable as a list.&lt;/p&gt;
&lt;code&gt;&lt;cfset myList = &quot;boy,girl,mom,dad&quot; /&gt;

&lt;!--- this could also be used as a list, although it only has one value ---&gt;
&lt;cfset myList = &quot;superdog&quot; /&gt;&lt;/code&gt;
&lt;p&gt;As you can see, the list is defined the same way as a string. The only difference is the way we treat the variable.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;Arrays&lt;/dt&gt;
&lt;dd&gt;
&lt;p&gt;An array is basically a collection of variables. In its simplest form you&apos;ll see an array with a collection of simple variables:&lt;/p&gt;
&lt;code&gt;&lt;!---
	We create an array with the arrayNew() method.
	It takes one argument, which is the number of dimensions.
	For now, we&apos;ll just use 1 (it gets a little more complicated
	the more dimensions you add.
---&gt;
&lt;cfset myArray = arrayNew(1) /&gt;

&lt;cfset myArray[1] = &quot;this is my first value&quot; /&gt;
&lt;cfset myArray[2] = 24 /&gt;&lt;/code&gt;
&lt;p&gt;The way we store values within an array is through square brackets ([ and ]). Within them, we specify the position (also known as index) at which we want to save our value. It&apos;s important to know that the array must have a value at all the previous positions before you assign it to a new one. What that means is you can&apos;t assign a value to position 2 before assigning something to position 1.&lt;/p&gt;
&lt;p&gt;What&apos;s really neat with arrays is that you can also store other complex variables within it:&lt;/p&gt;
&lt;code&gt;&lt;cfset myArray = arrayNew(1) /&gt;

&lt;!---
	Let&apos;s create our second array. We need to do it first
	so we can place it in myArray later.
---&gt;
&lt;cfset myNestedArray = arrayNew(1) /&gt;
&lt;cfset myNestedArray[1] = &quot;some value&quot; /&gt;
&lt;cfset myNestedArray[2] = &quot;some other value&quot; /&gt;

&lt;cfset myArray[1] = &quot;this is my first value&quot; /&gt;
&lt;cfset myArray[2] = 24 /&gt;

&lt;!--- Place it in ---&gt;
&lt;cfset myArray[3] = myNestedArray /&gt;&lt;/code&gt;
&lt;p&gt;If you want to display a value stored at a particular position in the index, all you need to do is use the same square brackets:&lt;/p&gt;
&lt;code&gt;&lt;cfoutput&gt;The value at position 2 is: #myArray[2]#&lt;/cfoutput&gt;&lt;/code&gt;
&lt;blockquote&gt;The value at position 2 is: 24&lt;/blockquote&gt;
&lt;/dd&gt;
&lt;dt&gt;Structures&lt;/dt&gt;
&lt;dd&gt;
&lt;p&gt;A structure, in many ways, looks a lot like an array: it&apos;s designed to store a collection of data. It can also contain other complex variables. The main difference between the two is that structures don&apos;t use an index to store the position of the values. Instead, it uses keys.&lt;/p&gt;
&lt;p&gt;A key is generally a string, although it can also be a numeric value, that is unique within the structure. This key reserves a spot for other values to be saved at. Where an array will always have indexes in sequence (ie.: 1, 2, 3, n... ), a structure&apos;s keys may have no apparent logic between them:&lt;/p&gt;
&lt;code&gt;&lt;!--- 
	We define the structure with the structNew() function.
	As the name implies, it returns a new, blank structure.
---&gt;
&lt;cfset myStructure = structNew() /&gt;

&lt;!--- 
	You can set a value within the structure by using square brackets.
---&gt;
&lt;cfset myStructure[&quot;color&quot;] = &quot;red&quot; /&gt;
&lt;cfset myStructure[&quot;size&quot;] = 12 /&gt;

&lt;!---
	You can also use dot-notation. This implies using the structure&apos;s name,
	then following it by a period and the name of the key.
---&gt;
&lt;cfset myStructure.favoriteMovie = &quot;Scary Movie XII&quot; /&gt;&lt;/code&gt;
&lt;p&gt;Outputting data from a structure is as easy as with an array. In fact, it&apos;s actually more verbose: since you retrieve the value using a key rather than a numeric index, it gives a better idea as to what you are trying to return:&lt;/p&gt;
&lt;code&gt;&lt;cfoutput&gt;
&lt;!---
	You can output a value from within a structure using either square
	brackets or dot-notation. Notice that I don&apos;t need to retrieve the values
	the same way they were set.
---&gt;
My hair color is #myStructure.color# and my favorite movie is #myStructure[&quot;favoriteMovie&quot;]#.
&lt;/cfoutput&gt;&lt;/code&gt;
&lt;blockquote&gt;My hair color is red and my favorite movie is Scary Movie XII.&lt;/blockquote&gt;
&lt;/dd&gt;
&lt;dt&gt;Queries&lt;/dt&gt;
&lt;dd&gt;
&lt;p&gt;Queries are a little more complicated, so we&apos;ll come back to them later. Basically, a query is a collection of data represented by rows. Generally this kind of data is retrieved from a database, although there are exceptions. A perfect example of a query is an Excel spreadsheet we&apos;re you&apos;d have a list of the people in your little league and their information in columns. ColdFusion is really great for getting data out of databases and making it easy to handle it, so more on that in a couple of posts.&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;As you can see there are plenty of variable types out there. The trick is using the right one for the situation. I&apos;ll be coming back on these topics later and referencing back to this page in the following posts. We&apos;ll see the different things we can do with them and the best way to use them.&lt;/p&gt;
				</description>
				
				<category>Beginner&apos;s Guide</category>
				
				<category>Coldfusion</category>
				
				<pubDate>Sat, 16 May 2009 02:05:06 -0500</pubDate>
				<guid>http://blog.critical-web.com/index.cfm/2009/5/16/Beginners-Guide-Series--Basic-ColdFusion-part-2</guid>
				
				
			</item>
			
			<item>
				<title>Beginner&apos;s Guide Series - Basic ColdFusion, part 1</title>
				<link>http://blog.critical-web.com/index.cfm/2009/5/13/Beginners-Guide-Series--Basic-ColdFusion-part-1</link>
				<description>
				
				&lt;p&gt;We now make it to the &lt;em&gt;pice-de-resistance&lt;/em&gt;. The next 2 or 3 posts should go over the basics of ColdFusion.&lt;/p&gt;&lt;h3&gt;What is ColdFusion?&lt;/h3&gt;
&lt;p&gt;ColdFusion is a server-side scripting language that was first released in July 1995. It&apos;s most distinguishing feature is it&apos;s tag-based syntax which looks a lot like HTML (you can easily distinguish them, however, since ColdFusion tags all start with cf). The advantage this has for us is that&apos;s it&apos;s relatively easy to learn. We already know about tags and attributes, thanks to the previous posts. ColdFusion is basically more of the same, with a slight twist.&lt;/p&gt;
&lt;h3&gt;How is a ColdFusion page processed?&lt;/h3&gt;
&lt;p&gt;To better understand the role of a ColdFusion template (that&apos;s what a ColdFusion file is called), it&apos;s important to know how it gets processed. ColdFusion templates have the .cfm extension. When the client points his browser to a page with a .cfm extension, the server knows that it must first parse this file before sending it back. This is where ColdFusion comes in.&lt;/p&gt;
&lt;p&gt;ColdFusion looks at the file and determines what it needs to change. What it would need to do can vary:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Display a part of the document if a certain condition is fulfilled;&lt;/li&gt;
&lt;li&gt;Query a database and output the recordset;&lt;/li&gt;
&lt;li&gt;Include repeated sections on multiple pages (think page headers, footers).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Once ColdFusion is done processing the template, it then sends the finished page back to the server who passes it on to the browser as a plain HTML document. The browser has no notion of ColdFusion or of the processing that had to take place. All it receives is the finished product. It is therefore impossible, with ColdFusion, to change something once the page has been processed. To change something in the resultant page (hide/show a section when a button is clicked, display a pop-up, etc.), you&apos;d need to use a client-side scripting language like JavaScript. We&apos;ll talk more about that subject in future posts.&lt;/p&gt;
&lt;h3&gt;&quot;Hello world!&quot;, ColdFusion style&lt;/h3&gt;
&lt;p&gt;Once again, the &quot;Hello world!&quot; example will allow us to demonstrate the basic principles behind a programming language. To achieve this, we&apos;ll first see how we can declare and set a variable. We&apos;ll then output it&apos;s value back to the result page.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;This post assumes that you have a ColdFusion environment available that will process your .cfm templates. If this isn&apos;t the case, you first need to download and install ColdFusion. Luckily, there is a nice, free developer edition available on the &lt;a href=&quot;http://www.adobe.com/products/coldfusion/&quot; target=&quot;_blank&quot;&gt;Adobe&lt;/a&gt; site.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Start by creating a new ColdFusion template in your webroot. Let&apos;s call it helloWorld.cfm. In this file, we&apos;re going to start by placing a new HTML page.&lt;/p&gt;
&lt;code&gt;&lt;html&gt;
	&lt;head&gt;

		&lt;title&gt;Hello world!, ColdFusion style&lt;/title&gt;

	&lt;/head&gt;

	&lt;body&gt;

	&lt;/body&gt;
&lt;/html&gt;&lt;/code&gt;
&lt;p&gt;There&apos;s nothing really special about it yet. If you can point your browser to the page all you&apos;ll see is a blank page with the provided title. Now, to set a variable in ColdFusion we need to use the &amp;lt;cfset&amp;gt; tag. This tag accepts only one attribute, which is the name of the variable we want to declare. The attribute&apos;s value will become the new variables value.&lt;/p&gt;
&lt;code&gt;&lt;cfset outputString = &quot;Hello world!&quot; /&gt;&lt;/code&gt;
&lt;p&gt;Once the variable is set, we can come back as often as we want to change it&apos;s value with additional &amp;lt;cfset&amp;gt; tags. Place the new &amp;lt;cfset&amp;gt; tag inside the body of our template:&lt;/p&gt;
&lt;code&gt;&lt;html&gt;
	&lt;head&gt;

		&lt;title&gt;Hello world!, ColdFusion style&lt;/title&gt;

	&lt;/head&gt;

	&lt;body&gt;

		&lt;cfset outputString = &quot;Hello world!&quot; /&gt;

	&lt;/body&gt;
&lt;/html&gt;&lt;/code&gt;
&lt;p&gt;If you point your browser to the page once again you&apos;ll still see a blank page. That&apos;s because all we&apos;ve done is set the variable. We still need to output it. The way to identify that we&apos;re referencing a variable, when we&apos;re amongst other text, is to surround it with hash (#) signs:&lt;/p&gt;
&lt;code&gt;&lt;html&gt;
	&lt;head&gt;

		&lt;title&gt;Hello world!, ColdFusion style&lt;/title&gt;

	&lt;/head&gt;

	&lt;body&gt;

		&lt;cfset outputString = &quot;Hello world!&quot; /&gt;

		Say hello: #outputString#

	&lt;/body&gt;
&lt;/html&gt;&lt;/code&gt;
&lt;p&gt;Here&apos;s how that looks in the browser:&lt;/p&gt;
&lt;blockquote&gt;Say hello: #outputString#&lt;/blockquote&gt;
&lt;p&gt;The reason the variable wasn&apos;t replaced by it&apos;s value is because, generally speaking, ColdFusion doesn&apos;t bother parsing text that isn&apos;t part of a ColdFusion tag. However, there&apos;s a very easy way to force ColdFusion to look at our text: the &amp;lt;cfoutput&amp;gt; tag.&lt;/p&gt;
&lt;code&gt;&lt;html&gt;
	&lt;head&gt;

		&lt;title&gt;Hello world!, ColdFusion style&lt;/title&gt;

	&lt;/head&gt;

	&lt;body&gt;

		&lt;cfoutput&gt;

			&lt;cfset outputString = &quot;Hello world!&quot; /&gt;

			Say hello: #outputString#

		&lt;/cfoutput&gt;

	&lt;/body&gt;
&lt;/html&gt;&lt;/code&gt;
&lt;p&gt;And we finally get our expected result:&lt;/p&gt;
&lt;blockquote&gt;Say hello: Hello world!&lt;/blockquote&gt;
&lt;h3&gt;Things to watch out for&lt;/h3&gt;
&lt;p&gt;In it&apos;s simplest form, the &amp;lt;cfoutput&amp;gt; tag looks for hash signs within it&apos;s content, and replaces variables by their value. What happens, however, when you actually want to write out a hash sign to the browser (say, for a telephone number)? If ColdFusion sees a lonely hash sign it&apos;ll throw an error. Luckily, escaping in ColdFusion is super-easy (escaping is the process of removing the special nature of a character): you double it. You need to output a hash sign? Put two of them together!&lt;/p&gt;
&lt;code&gt;Enter your telephone ##&lt;/code&gt;
&lt;p&gt;Becomes:&lt;/p&gt;
&lt;blockquote&gt;Enter your telephone #&lt;/blockquote&gt;
&lt;p&gt;The process is the same for pretty much all the other special characters in ColdFusion.&lt;/p&gt;
&lt;p&gt;This post took a little longer than intended. Hopefully I haven&apos;t crammed too much into it. There&apos;s more to cover, but that&apos;ll be for another day.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;The train keeps-a rolling.&lt;/em&gt;&lt;/p&gt;
				</description>
				
				<category>Beginner&apos;s Guide</category>
				
				<category>Coldfusion</category>
				
				<pubDate>Wed, 13 May 2009 13:32:08 -0500</pubDate>
				<guid>http://blog.critical-web.com/index.cfm/2009/5/13/Beginners-Guide-Series--Basic-ColdFusion-part-1</guid>
				
				
			</item>
			
			<item>
				<title>Beginner&apos;s Guide Series - Basic CSS</title>
				<link>http://blog.critical-web.com/index.cfm/2009/5/10/Beginners-Guide-Series--Basic-CSS</link>
				<description>
				
				&lt;p&gt;I know I&apos;d promised that the next post would be about ColdFusion, but I guess I forgot to take a look at my list: what I want to talk about first is Cascading Style Sheets (CSS).&lt;/p&gt;&lt;h3&gt;What is CSS?&lt;/h3&gt;
&lt;p&gt;CSS is used to &quot;style&quot; your HTML page. Where HTML defines the structure of your document, CSS gives it a look and feel. It can be used to change the font of the document or of a specific element. It can also change colors, apply backgrounds, modify layout, change size and more. It&apos;s a series of rules that apply changes to the different elements of the page.&lt;/p&gt;
&lt;h3&gt;Declaring rules&lt;/h3&gt;
&lt;p&gt;There are three places where we can define these rules. The first and simplest way is inline with the element. Say you want to change the font size of the text within a particular paragraph. We&apos;d do this by using the HTML style attribute. This attribute can be placed in any HTML tag, and simply defines the CSS styles to apply to that specific element:&lt;/p&gt;
&lt;code&gt;&lt;p&gt;This is some text with the default font size.&lt;/p&gt;

&lt;p style=&quot;font-size: 14pt;&quot;&gt;The text in here should be 14pt.&lt;/p&gt;&lt;/code&gt;
&lt;p&gt;The result:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;This is some text with the default font size.&lt;/p&gt;

&lt;p style=&quot;font-size: 14pt;&quot;&gt;The text in here should be 14pt.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;A CSS rule is made up of two parts: the property and the value. They are separated by a colon (:). The semi-colon (;) at the end of the rule is optional, although it becomes mandatory if you want to declare additional rules within the style attribute.&lt;/p&gt;
&lt;p&gt;The other two places are in the header of our HTML document. One of them has the rules in the actual page, whereas the other one has the rules in an external file, called from within the HTML page. To define the rules from directly within our HTML document, we need to add a &amp;lt;style&amp;gt; tag inside the head of the document:&lt;/p&gt;
&lt;code&gt;&lt;html&gt;
	
	&lt;head&gt;

		&lt;title&gt;Learning CSS&lt;/title&gt;

		&lt;style type=&quot;text/css&quot;&gt;
		
		&lt;/style&gt;

	&lt;/head&gt;

&lt;/html&gt;&lt;/code&gt;
&lt;p&gt;We could place as many rules as we&apos;d want within that tag. However, we can also keep our style information inside a completely different file. To call it from our document we use the &amp;lt;link&amp;gt; tag:&lt;/p&gt;
&lt;code&gt;&lt;html&gt;
	
	&lt;head&gt;

		&lt;title&gt;Learning CSS&lt;/title&gt;

		&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;style.css&quot; /&gt;

	&lt;/head&gt;

&lt;/html&gt;&lt;/code&gt;
&lt;p&gt;The &lt;em&gt;rel&lt;/em&gt; and &lt;em&gt;type&lt;/em&gt; attributes are standard. The &lt;em&gt;href&lt;/em&gt; tells the browser where to retrieve the CSS information from. You can specify the location the same as with images. In the .css file, you do not need to start with the &amp;lt;style&amp;gt; tag; you only need to write down your rules.&lt;/p&gt;
&lt;p&gt;In both cases, however, since we aren&apos;t directly declaring the rules in the element we want to style, we need to have a way to reference it. Luckily for us, there are three ways to reference elements from within a CSS declaration:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;All elements of the same type (ie.: all paragraphs (&amp;lt;p&amp;gt;));&lt;/li&gt;
&lt;li&gt;All elements of the same class (more on this later);&lt;/li&gt;
&lt;li&gt;The single element with the provided id (also more on this later).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The first way is pretty simple. We want to change the default font size for all paragraphs. To define a series of a rules, all we need to do is place the element we want to style, open up some curly braces ({,}) and start styling:&lt;/p&gt;
&lt;code&gt;p {
	font-size: 14pt;
}&lt;/code&gt;
&lt;p&gt;Within the curly braces we can put as many rules as we want:&lt;/p&gt;
&lt;code&gt;p {
	font-size: 14pt;
	font-family: Arial;
	color: red;
}&lt;/code&gt;
&lt;p&gt;The second way applies rules to elements with the certain class. This is a way of regrouping elements (not all necessarily of the same tag) so that we can quickly apply certain style rules to them. This is done by using the class HTML attribute with the elements we want styled.&lt;/p&gt;
&lt;code&gt;&lt;p&gt;Just a regular paragraph.&lt;/p&gt;

&lt;p class=&quot;smaller&quot;&gt;Make me smaller!&lt;/p&gt;

&lt;p class=&quot;smaller&quot;&gt;I want to be smaller too!&lt;/p&gt;&lt;/code&gt;
&lt;p&gt;When you want to reference elements of the same class in CSS, you simply need to use the name of the class, preceded by a period (.):&lt;/p&gt;
&lt;code&gt;.smaller {
	font-size: smaller;
}&lt;/code&gt;
&lt;p&gt;Here&apos;s how that looks like when it&apos;s all put together:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Just a regular paragraph.&lt;/p&gt;

&lt;p style=&quot;font-size: smaller;&quot;&gt;Make me smaller!&lt;/p&gt;

&lt;p style=&quot;font-size: smaller;&quot;&gt;I want to be smaller too!&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;The last way is by referencing an element with a specific ID. The &lt;em&gt;id&lt;/em&gt; attribute is used to give a specific identity to an element. This ID can then later be used by CSS and JavaScript to reference it directly. To reference an element by it&apos;s ID in CSS, we precede it by a hash sign (#):&lt;/p&gt;
&lt;code&gt;#title {
	font-size: 20pt;
}&lt;/code&gt;
&lt;p&gt;And in the HTML, we simply use the &lt;em&gt;id&lt;/em&gt; attribute to distinguish it:&lt;/p&gt;
&lt;code&gt;&lt;p id=&quot;title&quot;&gt;Welcome to my page&lt;/p&gt;
&lt;p&gt;This is just a basic paragraph.&lt;/p&gt;&lt;/code&gt;
&lt;p&gt;The result:&lt;/p&gt;
&lt;blockquote&gt;&lt;p style=&quot;font-size: 20pt;&quot;&gt;Welcome to my page&lt;/p&gt;
&lt;p&gt;This is just a basic paragraph.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;There are loads of possibilities. It would take far too long to list out all available properties here, but luckily the &lt;a href=&quot;http://www.w3schools.com/css/css_reference.asp&quot; target=&quot;_blank&quot;&gt;w3schools&lt;/a&gt; site is a really great reference.&lt;/p&gt;
				</description>
				
				<category>Beginner&apos;s Guide</category>
				
				<category>CSS</category>
				
				<pubDate>Sun, 10 May 2009 11:25:00 -0500</pubDate>
				<guid>http://blog.critical-web.com/index.cfm/2009/5/10/Beginners-Guide-Series--Basic-CSS</guid>
				
				
			</item>
			
			<item>
				<title>Beginner&apos;s Guide Series - Basic HTML, part 3</title>
				<link>http://blog.critical-web.com/index.cfm/2009/5/8/Beginners-Guide-Series--Basic-HTML-part-3</link>
				<description>
				
				&lt;p&gt;In this last part for basic HTML, we&apos;ll be looking at generating a table. Tables, in HTML, are used to display data. It can be a report. It can be a list of people and their related information. It can be, well, a lot of things. It should not, however, be used to create the layout for your page. There are much better and more convenient ways to do that, which we&apos;ll see in a couple of sections.&lt;/p&gt;&lt;h3&gt;The tags&lt;/h3&gt;
&lt;p&gt;Tables are represented by a collection of tags. As such, they are one of the most complex aspects of pure HTML. Luckily, it&apos;s not really that bad, and once these are mastered everything else should be pretty easy. Here are the basic tags for tables in HTML:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&amp;lt;table&amp;gt;: This is the outer tag. It encloses the entire table;&lt;/li&gt;
&lt;li&gt;&amp;lt;tr&amp;gt;: This represents a table row. It&apos;s inside the table and contains all the cells for that row;&lt;/li&gt;
&lt;li&gt;&amp;lt;th&amp;gt;: This is a column header. It is contained within a table row;&lt;/li&gt;
&lt;li&gt;&amp;lt;td&amp;gt;: This is an actual cell. It is contained within a table row.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There are other tags available for defining tables, however they are not within the scope of this entry. For now, we just want to be able to design a table and output it in the browser.&lt;/p&gt;
&lt;p&gt;Like I wrote earlier, tables are a relatively complex object. Like lists, we need to nest a couple of tags to get the desired result:&lt;/p&gt;
&lt;code&gt;&lt;table&gt;
	&lt;tr&gt;
		&lt;th&gt;Column 1&lt;/th&gt;
		&lt;th&gt;Column 2&lt;/th&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;Row 2, Cell 1&lt;/td&gt;
		&lt;td&gt;Row 2, Cell 2&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;Row 3, Cell 1&lt;/td&gt;
		&lt;td&gt;Row 3, Cell 2&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;&lt;/code&gt;
&lt;p&gt;Here&apos;s how that looks like:&lt;/p&gt;
&lt;blockquote&gt;&lt;table&gt;
	&lt;tr&gt;
		&lt;th&gt;Column 1&lt;/th&gt;
		&lt;th&gt;Column 2&lt;/th&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;Row 2, Cell 1&lt;/td&gt;
		&lt;td&gt;Row 2, Cell 2&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;Row 3, Cell 1&lt;/td&gt;
		&lt;td&gt;Row 3, Cell 2&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;&lt;/blockquote&gt;
&lt;p&gt;You can see we have three distinct rows, each identified in the code with a &amp;lt;tr&amp;gt; tag. In the first row, we&apos;ve defined headers with &amp;lt;th&amp;gt;. In the other two rows we&apos;ve used regular cells with &amp;lt;td&amp;gt;. Notice the first row&apos;s cells are in bold text and are centered. This is how most browsers output &amp;lt;th&amp;gt; tags.&lt;/p&gt;
&lt;p&gt;One of the neat things we can do with table cells is merge them. Using the colspan attribute, we can tell a cell to span more than one column. Let&apos;s take the previous example, and modify it so there is only one header cell.&lt;/p&gt;
&lt;code&gt;&lt;table&gt;
	&lt;tr&gt;
		&lt;th colspan=&quot;2&quot;&gt;This is a header&lt;/th&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;Row 2, Cell 1&lt;/td&gt;
		&lt;td&gt;Row 2, Cell 2&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;Row 3, Cell 1&lt;/td&gt;
		&lt;td&gt;Row 3, Cell 2&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;&lt;/code&gt;
&lt;blockquote&gt;&lt;table&gt;
	&lt;tr&gt;
		&lt;th colspan=&quot;2&quot;&gt;This is a header&lt;/th&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;Row 2, Cell 1&lt;/td&gt;
		&lt;td&gt;Row 2, Cell 2&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;Row 3, Cell 1&lt;/td&gt;
		&lt;td&gt;Row 3, Cell 2&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;&lt;/blockquote&gt;
&lt;p&gt;The colspan attribute can be used in both &amp;lt;th&amp;gt; and &amp;lt;td&amp;gt; tags. Another nice feature is making a cell span over multiple rows. Let&apos;s take the first column for rows 2 and 3 and merge it:&lt;/p&gt;
&lt;code&gt;&lt;table&gt;
	&lt;tr&gt;
		&lt;th colspan=&quot;2&quot;&gt;This is a header&lt;/th&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td rowspan=&quot;2&quot;&gt;This is a merged cell!&lt;/td&gt;
		&lt;td&gt;Row 2, Cell 2&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;Row 3, Cell 2&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;&lt;/code&gt;
&lt;blockquote&gt;&lt;table&gt;
	&lt;tr&gt;
		&lt;th colspan=&quot;2&quot;&gt;This is a header&lt;/th&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td rowspan=&quot;2&quot;&gt;This is a merged cell!&lt;/td&gt;
		&lt;td&gt;Row 2, Cell 2&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;Row 3, Cell 2&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;&lt;/blockquote&gt;
&lt;p&gt;Notice I had to remove a cell in row 3. Since the first cell in row 2 spanned two rows, there&apos;s less space for cells in row 3. Again, the rowspan attribute can be used in both &amp;lt;th&amp;gt; and &amp;lt;td&amp;gt; tags.&lt;/p&gt;
&lt;p&gt;There are plenty of other things we can do with tables in HTML. We&apos;ll get back to it in another episode. However, that&apos;ll have to wait, as starting in the next post we&apos;ll be looking at basic ColdFusion.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Stay tuned...&lt;/em&gt;&lt;/p&gt;
				</description>
				
				<category>Beginner&apos;s Guide</category>
				
				<category>HTML</category>
				
				<pubDate>Fri, 08 May 2009 16:16:00 -0500</pubDate>
				<guid>http://blog.critical-web.com/index.cfm/2009/5/8/Beginners-Guide-Series--Basic-HTML-part-3</guid>
				
				
			</item>
			
			<item>
				<title>Beginner&apos;s Guide Series - Basic HTML, part 2</title>
				<link>http://blog.critical-web.com/index.cfm/2009/5/7/Beginners-Guide-Series--Basic-HTML-part-2</link>
				<description>
				
				&lt;p&gt;Yesterday, I talked about what HTML is and what an HTML document looks like. In part two of this section we&apos;ll cover general HTML tags, what they represent and how they are used. Remember, these can be placed anywhere between the document&apos;s &amp;lt;body&amp;gt; tags.&lt;/p&gt;&lt;h3&gt;The paragraph: &amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;/h3&gt;
&lt;p&gt;One of the most-used tags in HTML is the paragraph. This tag is used to separate text in blocks. Very easy to use, it comes with a built-in margin to space out the text.&lt;/p&gt;
&lt;code&gt;&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum placerat lorem vel arcu convallis pellentesque. Nullam nunc orci, ornare ut suscipit vitae, fermentum id tellus. Aliquam erat volutpat. Nullam nec.&lt;/p&gt;
&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque lectus urna, bibendum quis eleifend quis, mattis ac velit. Aliquam ac tellus vel tortor mollis fermentum ac et orci. In sagittis.&lt;/p&gt;&lt;/code&gt;
&lt;p&gt;Here&apos;s how that looks like once output to the screen:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum placerat lorem vel arcu convallis pellentesque. Nullam nunc orci, ornare ut suscipit vitae, fermentum id tellus. Aliquam erat volutpat. Nullam nec.&lt;/p&gt;
&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque lectus urna, bibendum quis eleifend quis, mattis ac velit. Aliquam ac tellus vel tortor mollis fermentum ac et orci. In sagittis.&lt;/p&gt;&lt;/blockquote&gt;
&lt;h3&gt;The line-break: &amp;lt;br /&amp;gt;&lt;/h3&gt;
&lt;p&gt;When all you need is a line-break and a paragraph is simply too much, you can always turn to the &amp;ltbr /&amp;gt; tag. In HTML, all kinds of whitespace (spaces, tabs, line-feed, etc.) are displayed as a single space. What that means, amongst other things, is if you try writing something like this:&lt;/p&gt;
&lt;code&gt;This is some
really cool text.&lt;/code&gt;
&lt;p&gt;What you&apos;ll actually get will look like this:&lt;/p&gt;
&lt;blockquote&gt;This is some really cool text.&lt;/blockquote&gt;
&lt;p&gt;The easy way around this is to place a &amp;ltbr /&amp;gt; tag where we&apos;d normally enter a normal line-break (the enter key):&lt;/p&gt;
&lt;code&gt;This really cool text&lt;br /&gt;
will actually work.&lt;/code&gt;
&lt;p&gt;Using the appropriate tag to force a line-break we get the following result:&lt;/p&gt;
&lt;blockquote&gt;This really cool text&lt;br /&gt;
will actually work.&lt;/blockquote&gt;
&lt;p&gt;You might be wondering why I&apos;m using the forward slash for this tag. Modern day standards for HTML require that every single tag be closed. Since the &amp;lt;br /&amp;gt; tag isn&apos;t put around anything else, we don&apos;t normally use the closing &amp;lt;/br&amp;gt; tag. However, there&apos;s a shortcut. Placing a forward slash before the closing chevron allows to open and close the tag in one move. Practically speaking, however, &amp;lt;br&amp;gt; and &amp;lt;br /&amp;gt; are equivalent, although the example with the forward slash is more standards-compliant.&lt;/p&gt;
&lt;h3&gt;Headers: &amp;lt;h1&amp;gt; through &amp;lt;h6&amp;gt;&lt;/h3&gt;
&lt;p&gt;Headers are used to highlight new sections or particular elements. The difference between the six versions is the size of the text (&amp;lt;h1&amp;gt; is larger than &amp;lt;h6&amp;gt;)&lt;/p&gt;
&lt;code&gt;&lt;h1&gt;h1 sample output&lt;/h1&gt;
&lt;h2&gt;h2 sample output&lt;/h2&gt;
&lt;h3&gt;h3 sample output&lt;/h3&gt;
&lt;h4&gt;h4 sample output&lt;/h4&gt;
&lt;h5&gt;h5 sample output&lt;/h5&gt;
&lt;h6&gt;h6 sample output&lt;/h6&gt;&lt;/code&gt;
&lt;p&gt;And the result:&lt;/p&gt;
&lt;blockquote&gt;&lt;h1&gt;h1 sample output&lt;/h1&gt;
&lt;h2&gt;h2 sample output&lt;/h2&gt;
&lt;h3&gt;h3 sample output&lt;/h3&gt;
&lt;h4&gt;h4 sample output&lt;/h4&gt;
&lt;h5&gt;h5 sample output&lt;/h5&gt;
&lt;h6&gt;h6 sample output&lt;/h6&gt;&lt;/blockquote&gt;
&lt;h3&gt;Lists: &amp;lt;ul&amp;gt; and &amp;lt;ol&amp;gt;&lt;/h3&gt;
&lt;p&gt;Lists are used to enumerate items. In HTML, there are two types of lists: ordered an unordered. The difference is that ordered lists will display numbers next to each item, while unordered lists will use bullets. The &amp;lt;ul&amp;gt; and &amp;lt;ol&amp;gt; tags and their corresponding closing tags define the start and end of the list. Each element will be enclosed within them, and be identified by &amp;lt;li&amp;gt; tags (list item).&lt;/p&gt;
&lt;code&gt;&lt;ul&gt;
	&lt;li&gt;Item 1&lt;/li&gt;
	&lt;li&gt;Item 2&lt;/li&gt;
	&lt;li&gt;Item 3&lt;/li&gt;
	&lt;li&gt;Item 4&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
	&lt;li&gt;Item 1&lt;/li&gt;
	&lt;li&gt;Item 2&lt;/li&gt;
	&lt;li&gt;Item 3&lt;/li&gt;
	&lt;li&gt;Item 4&lt;/li&gt;
&lt;/ol&gt;&lt;/code&gt;
&lt;p&gt;The example first shows how to prepare an unordered list, and ends with an ordered list. See the difference below:&lt;/p&gt;
&lt;blockquote&gt;&lt;ul&gt;
	&lt;li&gt;Item 1&lt;/li&gt;
	&lt;li&gt;Item 2&lt;/li&gt;
	&lt;li&gt;Item 3&lt;/li&gt;
	&lt;li&gt;Item 4&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
	&lt;li&gt;Item 1&lt;/li&gt;
	&lt;li&gt;Item 2&lt;/li&gt;
	&lt;li&gt;Item 3&lt;/li&gt;
	&lt;li&gt;Item 4&lt;/li&gt;
&lt;/ol&gt;&lt;/blockquote&gt;
&lt;p&gt;The nice thing is you can nest lists, too. This would allow for further indenting.&lt;/p&gt;
&lt;code&gt;&lt;ul&gt;
	&lt;li&gt;Item 1&lt;/li&gt;
	&lt;li&gt;
		Item 2
		&lt;ul&gt;
			&lt;li&gt;Sub-item 1&lt;/li&gt;
			&lt;li&gt;Sub-item 2&lt;/li&gt;
		&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;&lt;/code&gt;
&lt;blockquote&gt;&lt;ul&gt;
	&lt;li&gt;Item 1&lt;/li&gt;
	&lt;li&gt;
		Item 2
		&lt;ul&gt;
			&lt;li&gt;Sub-item 1&lt;/li&gt;
			&lt;li&gt;Sub-item 2&lt;/li&gt;
		&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;&lt;/blockquote&gt;
&lt;h3&gt;Links: &amp;lt;a&amp;gt;&lt;/h3&gt;
&lt;p&gt;Up until now, all the tags we&apos;ve used have been pretty simple. The two next ones require a little more information. The first we&apos;ll look at is the link. Links play a really important role on the internet. They&apos;re what makes pages relate to each other. To create a link, we need two things: where the link will lead to and what text to display. The displayed text is enclosed between a start the end &amp;lt;a&amp;gt; tags. However, we also need to tell it where to go once it&apos;s clicked. We do this using an attribute.&lt;/p&gt;
&lt;p&gt;Attributes are a series of extra information that we can add in a starting tag. You can have more than one attribute per tag (simply separate them with spaces). Here is the &amp;lt;a&amp;gt; tag with it&apos;s main attribute, href (hypertext reference):&lt;/p&gt;
&lt;code&gt;&lt;a href=&quot;http://blog.critical-web.com/blog/&quot;&gt;Click me!&lt;/a&gt;&lt;/code&gt;
&lt;blockquote&gt;&lt;a href=&quot;http://blog.critical-web.com/blog/&quot;&gt;Click me!&lt;/a&gt;&lt;/blockquote&gt;
&lt;p&gt;There are two different ways of linking to a page: absolute and relative. Absolute means that you provide the entire address for the page, including http://. This is useful when linking to an external site. A relative link only needs to provide the location of the page relative to the caller. Imagine a page in the root of the web server. That page (page-a.html) has a link to another page (page-b.html) in the folder sections:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		Site root
		&lt;ul&gt;
			&lt;li&gt;
				sections/
				&lt;ul&gt;
					&lt;li&gt;page-b.html&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/li&gt;
			&lt;li&gt;page-a.html&lt;/li&gt;
		&lt;/ul&gt;
&lt;/ul&gt;
&lt;p&gt;Our link would only need to provide &lt;em&gt;sections/page-b.html&lt;/em&gt; in the href attribute to link to page-b.html.&lt;/p&gt;
&lt;h3&gt;Images: &amp;lt;img&amp;gt;&lt;/h3&gt;
&lt;p&gt;The image tag allows to, well, show an image in the browser. It has three major attributes:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;src: location of the image file (absolute or relative);&lt;/li&gt;
	&lt;li&gt;width: the width of the image, in pixels;&lt;/li&gt;
	&lt;li&gt;height: the height of the image, in pixels.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The src attribute is pretty self-explanatory (see the link section above for more information). The width and height tag, however, are important as they provide a way for the browser to create a placeholder for the image. In a situation where the image cannot be found (either because it was renamed, or the server providing it is down) or there&apos;s a delay in downloading them, the layout of the page will be exactly as it would if the image was loaded. Without specifying the width and height the browser will only reserve a small space for the image, and expand to the actual size when ready. Since we don&apos;t want our page layout to jump around during loading, we&apos;re better off specifying the width and height in the image&apos;s attributes.&lt;/p&gt;
&lt;code&gt;&lt;img src=&quot;/blog/images/blog_images/hello-world.png&quot; height=&quot;169&quot; width=&quot;202&quot; /&gt;&lt;/code&gt;
&lt;blockquote&gt;&lt;img src=&quot;/blog/images/blog_images/hello-world.png&quot; height=&quot;169&quot; width=&quot;202&quot; /&gt;&lt;/blockquote&gt;
&lt;p&gt;You have to be careful, though, when specifying the width and height of your image (notice I changed the width):&lt;/p&gt;
&lt;code&gt;&lt;img src=&quot;/blog/images/blog_images/hello-world.png&quot; height=&quot;169&quot; width=&quot;400&quot; /&gt;&lt;/code&gt;
&lt;blockquote&gt;&lt;img src=&quot;/blog/images/blog_images/hello-world.png&quot; height=&quot;169&quot; width=&quot;400&quot; /&gt;&lt;/blockquote&gt;
&lt;p&gt;That&apos;s it for this episode. I&apos;ll have a little more HTML goodness for another post, and then we&apos;ll take our first look into ColdFusion.&lt;/p&gt;
				</description>
				
				<category>Beginner&apos;s Guide</category>
				
				<category>HTML</category>
				
				<pubDate>Thu, 07 May 2009 18:40:00 -0500</pubDate>
				<guid>http://blog.critical-web.com/index.cfm/2009/5/7/Beginners-Guide-Series--Basic-HTML-part-2</guid>
				
				
			</item>
			</channel></rss>