<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Stillnet Studios</title>
	<atom:link href="http://www.stillnetstudios.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stillnetstudios.com</link>
	<description>Web development notes and commentary from Ryan Stille</description>
	<lastBuildDate>Mon, 05 Mar 2012 03:47:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Free ColdFusion 10 beta hosting</title>
		<link>http://www.stillnetstudios.com/free-coldfusion-10-beta-hosting/</link>
		<comments>http://www.stillnetstudios.com/free-coldfusion-10-beta-hosting/#comments</comments>
		<pubDate>Mon, 05 Mar 2012 03:47:22 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://www.stillnetstudios.com/?p=1101</guid>
		<description><![CDATA[Wanting to try out the new ColdFusion 10 beta without downloading and installing it? Hostek is offering free CF 10 beta hosting. You&#8217;ll get 5GB of storage space, and 200GB of transfer. Plenty of resources to play around with. You&#8217;ll get your own subdomain to use, and access to a MySQL database. Get it here: [...]]]></description>
			<content:encoded><![CDATA[<p>Wanting to try out the new ColdFusion 10 beta without downloading and installing it? Hostek is offering free CF 10 beta hosting. You&#8217;ll get 5GB of storage space, and 200GB of transfer. Plenty of resources to play around with. You&#8217;ll get your own subdomain to use, and access to a MySQL database.</p>
<p>Get it here: <a href="http://hostek.com/hosting/coldfusion/coldfusion10-hosting.asp">http://hostek.com/hosting/coldfusion/coldfusion10-hosting.asp</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.stillnetstudios.com/free-coldfusion-10-beta-hosting/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Removing spaces from columns in cfspreadsheet (or any query)</title>
		<link>http://www.stillnetstudios.com/remove-spaces-columns-cfspreadsheet/</link>
		<comments>http://www.stillnetstudios.com/remove-spaces-columns-cfspreadsheet/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 02:33:07 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.stillnetstudios.com/?p=1086</guid>
		<description><![CDATA[I love the CFSPREADSHEET tag that was added to ColdFusion9. It makes working with spread sheet data so easy. The spreadsheets I am given to work with often contain descriptive column names that contain spaces like &#8220;First Name&#8221; or &#8220;Home Phone&#8221;. This causes a problem when you try to work with the data in a [...]]]></description>
			<content:encoded><![CDATA[<p>I love the CFSPREADSHEET tag that was added to ColdFusion9. It makes working with spread sheet data so easy. The spreadsheets I am given to work with often contain descriptive column names that contain spaces like &#8220;First Name&#8221; or &#8220;Home Phone&#8221;. This causes a problem when you try to work with the data in a QoQ (query of a query).</p>
<p>Lets say you have a spread sheet containing these columns: Name, City, State, Postal Code. Then pull it into a query using the cfspreadsheet tag:<br />
<code>&lt;cfspreadsheet action="read" src="c:\Customers.xls" query="customers" headerrow="1" rows="2-65536" sheetname="Customers"&gt;</code></p>
<p>Now try to narrow down the results to only those in a certain postal code. This won&#8217;t work of course:<br />
<code>&lt;cfquery name="qryCA" dbtype="query"&gt;<br />
SELECT * FROM customers WHERE [Postal Code] = '90210'<br />
&lt;/cfquery&gt;</code></p>
<p>Neither will this:<br />
<code>&lt;cfquery name="qryCA" dbtype="query"&gt;<br />
SELECT * FROM customers WHERE [Postal\ Code] = '90210'<br />
&lt;/cfquery&gt;</code></p>
<p>Or this:<br />
<code>&lt;cfquery name="qryCA" dbtype="query"&gt;<br />
SELECT * FROM customers WHERE ['Postal Code'] = '90210'<br />
&lt;/cfquery&gt;</code></p>
<p>I have not found any way to escape a space in a column name inside QoQ. But, thankfully there is a way we can manipulate the column names to remove the space.</p>
<pre><code>&lt;cfset colNameArray = customers.getColumnNames() /&gt;
&lt;cfloop from="1" to="#arrayLen(colNameArray)#" index="i"&gt;
	&lt;cfset colNameArray[i] = colNameArray[i].replace(' ','') /&gt;
&lt;/cfloop&gt;
&lt;cfset customers.setColumnNames(colNameArray) /&gt;</code></pre>
<p>You could use this to completely rename column names if you wanted to. This isn&#8217;t just useful for working with cfspreadsheet either, I could see this being used in other circumstances to change the column names.</p>
<p>Thanks to <a href="http://www.neiland.net/blog/article/using-java-to-rename-columns-in-a-coldfusion-query-object/" title="Steven Neiland">Steven Neiland</a> for pointing me in this direction.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stillnetstudios.com/remove-spaces-columns-cfspreadsheet/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Online code formatters</title>
		<link>http://www.stillnetstudios.com/online-code-formatters/</link>
		<comments>http://www.stillnetstudios.com/online-code-formatters/#comments</comments>
		<pubDate>Thu, 14 Jul 2011 01:53:22 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[AJAX / JavaScript]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.stillnetstudios.com/?p=1082</guid>
		<description><![CDATA[Lately I&#8217;ve come across some online formatting tools that have been very helpful. I like these because they work regardless of what IDE you use, what operating system, etc. They work from any computer that has internet access. Handy when you are troubleshooting on a remote machine. Here is one for formatting XML: http://www.shell-tools.net/index.php?op=xml_format And [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve come across some online formatting tools that have been very helpful. I like these because they work regardless of what IDE you use, what operating system, etc. They work from any computer that has internet access. Handy when you are troubleshooting on a remote machine.</p>
<p>Here is one for formatting XML: <a href="http://www.shell-tools.net/index.php?op=xml_format">http://www.shell-tools.net/index.php?op=xml_format</a></p>
<p>And one for JSON from the same site: <a href="http://www.shell-tools.net/index.php?op=json_format">http://www.shell-tools.net/index.php?op=json_format</a></p>
<p>Here is a SQL one that helped me out a lot tonight: <a href="http://www.dpriver.com/pp/sqlformat.htm">http://www.dpriver.com/pp/sqlformat.htm</a></p>
<p>I fed it a horrible looking, very complex query and it made it easily readable. <img src='http://www.stillnetstudios.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.stillnetstudios.com/online-code-formatters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Joining to one of two tables with one ID</title>
		<link>http://www.stillnetstudios.com/joining-two-tables-one-id/</link>
		<comments>http://www.stillnetstudios.com/joining-two-tables-one-id/#comments</comments>
		<pubDate>Mon, 23 May 2011 01:40:47 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.stillnetstudios.com/?p=1061</guid>
		<description><![CDATA[I came across an interesting problem the other day where I needed to join to either one of two different tables. Here is an example scenario: Say you have an ecommerce site that your customers log into. Customers exist in a table named “customers”. When they place an order, an order record is created in [...]]]></description>
			<content:encoded><![CDATA[<p>I came across an interesting problem the other day where I needed to join to either one of two different tables. Here is an example scenario:</p>
<p>Say you have an ecommerce site that your customers log into. Customers exist in a table named “customers”. When they place an order, an order record is created in the orders table.  There is a CreatorID field that indicates which customer placed the order. A common practice when creating order reports is to join the order to the customer in order to be able to display the customer contact information when displaying the order. </p>
<p><code>SELECT orders.*, customers.name FROM orders<br />
JOIN customers on orders.creator ID = customers.customerID</code></p>
<p>Later you are given the task of allowing vendors to place orders.  Vendors also log into your site but their accounts are stored in a separate vendors table. So now you are faced with the question of how to link orders to both the customers and vendors table. You could add a vendorID field to the orders table, then change your join to connect to both tables:</p>
<p><code>SELECT orders.*, customers.name AS customerName, vendors.name AS vendorName FROM orders<br />
LEFT JOIN customers on orders.creator ID = customers.customerID<br />
LEFT JOIN  vendors on orders.vendorID = vendors.vendor ID</code></p>
<p>The LEFT JOIN here is necessary so we still get an order record even when there is not a match in the customers or vendors table. The problem I had with this approach is it requires changing a lot of other code on the system. Because the “name” column is ambiguous between the two tables, we had to alias the “name” column to be different for each of the two tables. So now all your view code would have to be changed to look at one of those two columns.</p>
<p><code>&lt;cfoutput query=”TodaysOrders”&gt;<br />
 	order: #orderID#, placed by<br />
	&lt;cfif val(creatorID)&gt;#customerName#&lt;cfelse&gt;#vendorName#&lt;/cfif&gt;<br />
&lt;/cfoutput&gt;</code></p>
<p>Here is another solution – I added creatorIDtype field that indicates if the creatorID is a customer or a vendor:</p>
<p><code>SELECT orders.*,<br />
name =<br />
CASE e.creatorIDtype<br />
		WHEN 'CUSTOMER' THEN customer.name<br />
	      	ELSE vendor.name<br />
	    	END<br />
FROM orders<br />
LEFT JOIN customers on orders.creatorID = customers.customerID<br />
LEFT JOIN  vendors on orders.creatorID = vendors.vendorID</code></p>
<p>Now the view code does not need to be changed, the “name” column will continue to hold the name of the person who placed the order, regardless if it was a customer or a vendor.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stillnetstudios.com/joining-two-tables-one-id/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Formatting CFGRID with JavaScript</title>
		<link>http://www.stillnetstudios.com/formatting-cfgrid-with-javascript/</link>
		<comments>http://www.stillnetstudios.com/formatting-cfgrid-with-javascript/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 14:47:24 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[AJAX / JavaScript]]></category>
		<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://www.stillnetstudios.com/?p=806</guid>
		<description><![CDATA[A while back I had the need to do some formatting on a cfgrid. I was using a typical product/price table but the prices are stored with 4 decimals and we needed to display that much resolution. The html version of CFGRID does not directly support this. Consider this &#8220;fake&#8221; query set: &#60;cfset materials=QueryNew("ProductCode,Description,Price","VarChar, VarChar, [...]]]></description>
			<content:encoded><![CDATA[<p>A while back I had the need to do some formatting on a cfgrid. I was using a typical product/price table but the prices are stored with 4 decimals and we needed to display that much resolution. The html version of CFGRID does not directly support this.</p>
<p>Consider this &#8220;fake&#8221; query set:</p>
<pre><code>&lt;cfset materials=QueryNew("ProductCode,Description,Price","VarChar, VarChar, decimal")&gt;
&lt;cfset Temp=QueryAddRow(materials,1)&gt;
&lt;cfset Temp=QuerySetCell(materials,"ProductCode","MAT1")&gt;
&lt;cfset Temp=QuerySetCell(materials,"Description","Copper Bar")&gt;
&lt;cfset Temp=QuerySetCell(materials,"Price",<strong>3.3400</strong>)&gt;
&lt;cfset Temp=QueryAddRow(materials)&gt;
&lt;cfset Temp=QuerySetCell(materials,"ProductCode","MAT2")&gt;
&lt;cfset Temp=QuerySetCell(materials,"Description","Feeler Gauge")&gt;
&lt;cfset Temp=QuerySetCell(materials,"Price",<strong>2.2900</strong>)&gt;
&lt;cfset Temp=QueryAddRow(materials)&gt;
&lt;cfset Temp=QuerySetCell(materials,"ProductCode","MAT3")&gt;
&lt;cfset Temp=QuerySetCell(materials,"Description","Plastic Retainer")&gt;
&lt;cfset Temp=QuerySetCell(materials,"Price",<strong>1.3201</strong>)&gt;  </code></pre>
<p>Note the prices have 4 decimal values, this is how they come to us from the database. If you try to display these with this cfgrid code:</p>
<pre><code>&lt;cfform&gt;
&lt;cfgrid name="testgrid" format="html" query="materials"&gt;
&lt;/cfgrid&gt;
&lt;/cfform&gt;</code></pre>
<p>You will end up with this:<br />
<img src="/wp-content/uploads/2011/03/cfgrid-1.png" alt="" title="cfgrid-1" width="302" height="96" class="alignnone size-full wp-image-1014" /><br />
<span id="more-806"></span><br />
Notice the 3rd material is displayed correctly, but the others are not, we would like them to all have the same number of decimals for consistency. You might think you could use cfgridcolumn tags and the numberformat attribute like this:</p>
<pre><code>&lt;cfform&gt;
&lt;cfgrid name="testgrid" format="html" query="materials"&gt;
	&lt;cfgridcolumn name="ProductCode"&gt;
	&lt;cfgridcolumn name="Description"&gt;
	&lt;cfgridcolumn name="Price" numberformat="0.0000"&gt;
&lt;/cfgrid&gt;
&lt;/cfform&gt;</code></pre>
<p>But this will not work, the numberformat attribute only works on Java type cfgrids, not HTML ones. This attempt will silently fail with no error message, leaving you scratching your head for a while.  Lucky for us, ColdFusion creates its grids using the populat EXT JavaScript framework. This means there is a lot of documentation and examples out there on how to work with this code in EXT.  Its pretty easy to hook into the grid with JavaScript and format the data.</p>
<pre><code>&lt;script&gt;var myFormatter = Ext.util.Format.numberRenderer('.0000');
mygrid = ColdFusion.Grid.getGridObject('testgrid');
cm = mygrid.getColumnModel();
cm.setRenderer(2, myFormatter);  <em>// the 2 here indicates we want to format the 3rd column (JS is zero indexed)</em>
mygrid.reconfigure(mygrid.getStore(),cm);
&lt;/script&gt;</code></pre>
<p>But you can&#8217;t run the JavaScript code when your page loads because the grid takes a few milliseconds to get setup, so if your code runs right away it won&#8217;t find the grid. You could use the JavaScript setTimeout() to delay execution of your code:</p>
<pre><code>&lt;script language="javaScript"&gt;
var myFormatter = Ext.util.Format.numberRenderer('.0000');
formatgrid = function() {
	mygrid = ColdFusion.Grid.getGridObject('testgrid');
	cm = mygrid.getColumnModel();
	cm.setRenderer(2, myFormatter);
	mygrid.reconfigure(mygrid.getStore(),cm);
	}
setTimeout("formatgrid()",500);
&lt;/script&gt;</code></pre>
<p>However you would be guessing at how long it will take and its going to vary on each client. I know ColdFusion has the built in ajaxOnLoad function that is supposed to run your code after things like grids have been created, but I have never gotten this to work. I know for sure it won&#8217;t work for content that is loaded secondarily after the base page has finished loading, like many of my pages are. But I can&#8217;t get it work even on a simple test file. So I wrote a little function to watch for the grid, and call the formatting code when the grid exists.</p>
<pre><code>&lt;script language="javaScript"&gt;
function lookForGrid() {
	// keeps checking the page to see if the grid exists yet. When it does, then call the formatter function
	if (ColdFusion.Grid.getGridObject('testgrid')) {
		formatgrid();
		}
	else {
		setTimeout(lookForGrid,10);
		}
	}

var myFormatter = Ext.util.Format.numberRenderer('.0000');
formatgrid = function() {
	mygrid = ColdFusion.Grid.getGridObject('testgrid');
	cm = mygrid.getColumnModel();
	cm.setRenderer(2, myFormatter);
	mygrid.reconfigure(mygrid.getStore(),cm);
	}
();
&lt;/script&gt;</code></pre>
<p>And this is the result:<br />
<a href="http://www.stillnetstudios.com/wp-content/uploads/2011/03/cfgrid-2.png"><img src="http://www.stillnetstudios.com/wp-content/uploads/2011/03/cfgrid-2.png" alt="cfgrid is now formatted correctly" width="302" height="96" class="alignnone size-full wp-image-1020" /></a></p>
<p>The code could definitely be cleaned up a little, so the grid name isn&#8217;t duplicated at least, but its a good start. There are lots of other formatters available also, we&#8217;ve found the DateRenderer to be useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stillnetstudios.com/formatting-cfgrid-with-javascript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Accessing ColdFusion form values as an array</title>
		<link>http://www.stillnetstudios.com/cf-form-array-comma-workaround/</link>
		<comments>http://www.stillnetstudios.com/cf-form-array-comma-workaround/#comments</comments>
		<pubDate>Tue, 22 Mar 2011 13:44:49 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://www.stillnetstudios.com/?p=1028</guid>
		<description><![CDATA[When you pass several form or URL variables into ColdFusion with the same name, they end up as a comma separated list. This is commonly done with checkboxes &#8211; a user can check as many items as they want, then they will end up in your code all in a single variable. In many other [...]]]></description>
			<content:encoded><![CDATA[<p>When you pass several form or URL variables into ColdFusion with the same name, they end up as a comma separated list.  This is commonly done with checkboxes &#8211; a user can check as many items as they want, then they will end up in your code all in a single variable. In many other languages, Ruby or PHP for example, the selected items will end up in an array. Getting these values as a list usually works fine, until one of your values contains the list delimiter (comma).  Take this form, for example:</p>
<pre><code>&lt;form action="test.cfm" method="post"&gt;
&lt;p&gt;Select your books:&lt;/p&gt;
&lt;input type="checkbox" name="books" value="A Wrinkle in Time"&gt;
A Wrinkle in Time&lt;br&gt;
&lt;input type="checkbox" name="books" value="A Tale of Two Cities"&gt;
A Tale of Two Cities&lt;br&gt;
&lt;input type="checkbox" name="books" value="The Lion, the Witch and the Wardrobe"&gt;
The Lion, the Witch and the Wardrobe&lt;br&gt;
&lt;input type="submit" name="submitButton" value="Go"&gt;
&lt;/form&gt;</code></pre>
<p><img src="http://www.stillnetstudios.com/wp-content/uploads/2011/03/book-form.png" alt="example of the book form" title="book-form" width="272" height="130" class="alignnone size-full wp-image-1036" /></p>
<p>If you check the first two boxes and submit the form, you will end up with this in the form scope:<br />
<img src="/wp-content/uploads/2011/03/cfdump-form-1.png" alt="a dump of the form scope shows two books separated by a comma" width="297" height="96" class="alignnone size-full wp-image-1030" /></p>
<p>But if you check the third book, which has a title containing commas, things start to get messy:<br />
<img src="/wp-content/uploads/2011/03/cfdump-form-2.png" alt="Dumping the form scope with a book containing commas - you can&#039;t tell them apart." width="486" height="94" class="alignnone size-full wp-image-1031" /><br />
<span id="more-1028"></span><br />
How can you tell the selections apart!?  You can&#8217;t. Now, ideally you should be using an ID for the checkbox values instead of a string. In this example maybe you&#8217;d use the ISBN number instead of the title. But this is not always possible. Sometimes you are receiving a form post from a third party which you have no control over. I&#8217;ve run into situations where the checkbox values contained part numbers, which you would think would be comma-safe, but we did encounter some part numbers that contained commas (don&#8217;t get me started&#8230;)</p>
<p>But, ColdFusion gives us the power of Java under the hood, and we can reach down into the Java layer to pull out these parameters as a real <em>array</em>! Its very easy:</p>
<p><code>getPageContext().getRequest().getParameterValues('Your form or url field name')</code></p>
<p>So lets try it with the &#8216;books&#8217; field:</p>
<p><code>&lt;cfdump var="#getPageContext().getRequest().getParameterValues('books')#"&gt;</code></p>
<p>Gives us:<br />
<img src="/wp-content/uploads/2011/03/cfdump-parameterValues.png" alt="a dump of the getParameterValues() method reveals an array" width="215" height="94" class="alignnone size-full wp-image-1038" /></p>
<p>Nice! Another interesting method is <code>getParameterMap()</code>. It gives us Form <em>and </em>URL variables, with each variable coming through as its own array. To show this, I&#8217;ve modified the form tag a little to include a URL variable:</p>
<p><code>&lt;form action="test.cfm?event=someFakeEvent" method="post"&gt;</code></p>
<p>Here is the output of the getParameterMap() method:<br />
<img src="/wp-content/uploads/2011/03/cfdump-parameterMap.png" alt="a dump of the getParameterMap() method" width="302" height="236" class="alignnone size-full wp-image-1039" /></p>
<p>As I was wrapping up this blog post another opportunity arose to use this idea at work. We tried this, but for some reason it wasn&#8217;t working, we always got an undefined value instead of an array. After some research we discovered this way of pulling parameters only works on regular application/x-www-form-urlencoded encoded forms. When you upload files on a form, as we were in this case, you need to use the multipart/form-data enctype. Which renders this nice trick useless.</p>
<p>But there is another way to get the values as an array when the enctype is set to application/x-www-form-urlencoded. Below is a method that will return a form or URL variable as an array, and it works for either enctype. All values with the given name will be returned, whether they came in on the URL or the Form scope.</p>
<pre><code>&lt;cffunction name="FormFieldAsArray" returntype="array" output="false" hint="Returns a Form/URL variable as an array."&gt;
	&lt;cfargument name="fieldName" required="true" type="string" hint="Name of the Form or URL field" /&gt;

	&lt;cfset var tmpPartsArray = Form.getPartsArray() /&gt;
	&lt;cfset var returnArray = arrayNew(1) /&gt;
	&lt;cfset var tmpPart = 0 /&gt;
	&lt;cfset var tmpValueArray = "" &gt;

	&lt; !--- if the getPartsArray method did not return NULL, then this is a multipart/form-data request, which must be handled as such. ---&gt;
	&lt;cfif IsDefined("tmpPartsArray")&gt;
		&lt;cfloop array="#tmpPartsArray#" index="tmpPart"&gt;
			&lt;cfif tmpPart.isParam() AND tmpPart.getName() EQ arguments.fieldName&gt;
				&lt;cfset arrayAppend(returnArray, tmpPart.getStringValue()) /&gt;
			&lt;/cfif&gt;
		&lt;/cfloop&gt;
	&lt;/cfif&gt;

	&lt; !--- Add the values that maybe on the URL with the same name, also if this *wasn't* a multipart/form-data request then
	the above code did not get any of the data, and the method below will return all of it. ---&gt;
	&lt;cfset tmpValueArray = getPageContext().getRequest().getParameterValues(arguments.fieldName) /&gt;

	&lt; !--- that may have returned null, so need to test for it. ---&gt;
	&lt;cfif IsDefined("tmpValueArray")&gt;
		&lt;cfloop array="#tmpValueArray#" index="tmpPart"&gt;
			&lt;cfset arrayAppend(returnArray, tmpPart) /&gt;
		&lt;/cfloop&gt;
	&lt;/cfif&gt;

	&lt;cfreturn returnArray /&gt;
&lt;/cffunction&gt;</code></pre>
<p>If you copy and paste the code above you&#8217;ll need to fix the comments to get it to execute, I had to mangle them to get them to display properly in this post.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stillnetstudios.com/cf-form-array-comma-workaround/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Loading CFrichtext / FCKeditor on-the-fly</title>
		<link>http://www.stillnetstudios.com/loading-fckeditor-dynamically/</link>
		<comments>http://www.stillnetstudios.com/loading-fckeditor-dynamically/#comments</comments>
		<pubDate>Sun, 06 Mar 2011 22:20:06 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[AJAX / JavaScript]]></category>
		<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://www.stillnetstudios.com/?p=1003</guid>
		<description><![CDATA[At work we had an issue where we had too many FCKeditor rich text controls on a page at once. We probably had 6 or 7, each on their own tab. For the tabs we are using the &#60;cflayout type="tab"&#62; tag. FireFox would handle the page with no problems, but IE would sometimes fail to [...]]]></description>
			<content:encoded><![CDATA[<p>At work we had an issue where we had too many FCKeditor rich text controls on a page at once. We probably had 6 or 7, each on their own tab. For the tabs we are using the <code>&lt;cflayout type="tab"&gt;</code> tag. FireFox would handle the page with no problems, but IE would sometimes fail to load one or more of the rich text controls and would not throw any kind of error about it. The controls simply did not display.</p>
<p>A solution we came up with was to load the rich text controls on demand, when the user needed to use them, rather than load them all when the page first loads. At first I thought we&#8217;d have to install a separate, stand alone copy of FCKeditor (now called &#8220;CKEditor&#8221;) to do this, but we found out this is unnecessary, you use the version that comes with CF to do this.</p>
<p>First, we manually load the FCKeditor JavaScript:<br />
<code>&lt;script type="text/javascript" src="/CFIDE/scripts/ajax/FCKeditor/fckeditor.js"&gt;&lt;/script&gt;</code></p>
<p>Then create a function that can change a regular textarea into a rich text controls:</p>
<pre><code>&lt;script type="text/javascript"&gt;
function changeToRichText(elementToHide,id,width,height) {
	var oFCKeditor = new FCKeditor(id,width,height,'my_toolbar_set') ;
	oFCKeditor.BasePath = "/CFIDE/scripts/ajax/FCKeditor/";
	oFCKeditor.ReplaceTextarea();
	if (elementToHide) elementToHide.style.display = 'none';
	}
&lt;/script&gt;</code></pre>
<p>Then we changed the places on the page that used to have rich text controls to instead use plain textareas. Then placed an link next to each one the user can click on to change the textarea into a rich text. Sometimes they don&#8217;t need the functionality of rich text and will just enter plain text into a textarea. Here is the code:</p>
<pre><code>&lt;div id="rootCause_outter" style="text-align: left; width: 100%;"&gt;<a href="JavaScript:;" onclick="changeToRichText(document.getElementById('rootCause_outter'),'rootCause',740,290);">click to use editor</a>&lt;br /&gt;&lt;/div&gt;
&lt;textarea name="rootCause" style="width:740px; height: 290px;"&gt;&lt;/textarea&gt;&lt;br /&gt;</code></pre>
<p>This is used for creating records only, not editing. But it would not be hard to modify this to make it work on an edit page also.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stillnetstudios.com/loading-fckeditor-dynamically/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mura URL rewriting on Windows 2008 / IIS7</title>
		<link>http://www.stillnetstudios.com/url-rewriting-windows-2008-iis7/</link>
		<comments>http://www.stillnetstudios.com/url-rewriting-windows-2008-iis7/#comments</comments>
		<pubDate>Thu, 09 Dec 2010 23:21:00 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[System Administration]]></category>

		<guid isPermaLink="false">http://www.stillnetstudios.com/?p=973</guid>
		<description><![CDATA[I have been involved in setting up a new Mura site on Windows 2008 Server. Mura is a full featured CMS written in ColdFusion. By default Mura URLs look something like /index.cfm/SiteID/pagename. So for example the contact us page might look like /index.cfm/default/contact-us. Not a great URL. But its fairly simple to translate into /contact-us [...]]]></description>
			<content:encoded><![CDATA[<p>I have been involved in setting up a new Mura site on Windows 2008 Server.  <a href="http://www.getmura.com/">Mura</a> is a full featured CMS written in ColdFusion.</p>
<p>By default Mura URLs look something like /index.cfm/SiteID/pagename.  So for example the contact us page might look like /index.cfm/default/contact-us.  Not a great URL.  But its fairly simple to translate into /contact-us which is much nicer.</p>
<h2>Getting rid of the SiteID</h2>
<p>Getting rid of the siteID is easy in the newest version of Mura.  In the config/settings.ini.cfm file there is a setting named &#8220;siteidinurls&#8221;.  Set this to 0 and Mura will no longer add the siteID to the URLs it generates.  Of course this only works if you plan on only using Mura for one site.  If you had more than one site, Mura wouldn&#8217;t know which one you are trying to access.  There are several ways to get around this if you have more than one site, but I won&#8217;t get into that in this article.</p>
<h2>Getting rid of the index.cfm</h2>
<p>Getting rid of the index.cfm takes a little more work.  There is another setting in the ini file called indexfileinurls.  Setting this to 0 will remove the index.cfm from the URLs Mura generates.  But when you click on any of those links you are going to get the 404 page.  To fix this, you&#8217;ll need to tweak your webserver.</p>
<p>Apache is pretty straight forward, as you would expect.  Enable the mod_rewrite module and drop this into an .htaccess file in your webroot:</p>
<pre><code>RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^([a-zA-Z0-9/-]+)$ /index.cfm%{REQUEST_URI} [PT]</code></pre>
<p>Our site happens to be hosted on Windows 2008 Server / IIS7.  To do the rewriting on II7 you&#8217;ll need to install Microsoft&#8217;s URL rewriting extension.  You can get it from here: <a href="http://www.iis.net/download/URLRewrite">http://www.iis.net/download/URLRewrite</a></p>
<p>Once its installed, open IIS Manager.  Click on your website, then double click on the new URL rewrite icon.<br />
<a href="http://www.stillnetstudios.com/wp-content/uploads/2010/12/iis7_url_rewrite1.png"><img src="/wp-content/uploads/2010/12/iis7_url_rewrite1.png" alt="" title="iis7_url_rewrite" width="600" class="alignnone size-full wp-image-988" /></a><br />
<span id="more-973"></span><br />
Select Import Rules from the right hand side.<br />
<img src="/wp-content/uploads/2010/12/iis7_url_import_link.png" alt="" title="iis7_url_import_link" width="583" height="474" class="alignnone size-full wp-image-979" /></p>
<p>Then paste the apache lines above into the Rewrite rules box.<br />
<img src="/wp-content/uploads/2010/12/iis7_url_paste_here.png" alt="" title="iis7_url_paste_here" width="583" height="474" class="alignnone size-full wp-image-980" /></p>
<p>Instantly you&#8217;ll see the new rules appear in the Converted Rules box. Click Apply in the upper right.<br />
<img src="/wp-content/uploads/2010/12/iis7_url_after_pasting.png" alt="" title="iis7_url_after_pasting" width="583" height="474" class="alignnone size-full wp-image-981" /></p>
<p>Now change the Mura ini file I mentioned above, then click the Reload link in your Mura admin.</p>
<p><img style="border: 1px solid black;" src="/wp-content/uploads/2010/12/iis7_mura_ini.png" alt="" title="iis7_mura_ini" width="237" height="167" class="alignnone size-full wp-image-983" /></p>
<p>That&#8217;s it!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stillnetstudios.com/url-rewriting-windows-2008-iis7/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Concatenating child rows in SQL &#8211; Cross Apply / FOR XML PATH</title>
		<link>http://www.stillnetstudios.com/concatenating-child-rows/</link>
		<comments>http://www.stillnetstudios.com/concatenating-child-rows/#comments</comments>
		<pubDate>Wed, 20 Oct 2010 16:39:47 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.stillnetstudios.com/?p=764</guid>
		<description><![CDATA[Here&#8217;s a neat trick when you need to concatenate child rows in a SQL Select statement. What do I mean by that? Its a little hard to explain, so I&#8217;ll try to illustrate below. Say you have these two database tables: orders OrderID OrderNotes 1 Notes about order 1 2 Notes about order 2 3 [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a neat trick when you need to concatenate child rows in a SQL Select statement.  What do I mean by that? Its a little hard to explain, so I&#8217;ll try to illustrate below.</p>
<p>Say you have these two database tables:</p>
<table style="background-color: #FFEF0A; margin-right: 40px;" border="1" align="left">
<caption>orders</caption>
<tr>
<td><b>OrderID</b></td>
<td><b>OrderNotes</b></td>
</tr>
<tr>
<td>1</td>
<td>Notes about order 1</td>
</tr>
<tr>
<td>2</td>
<td>Notes about order 2</td>
</tr>
<tr>
<td>3</td>
<td>Notes about order 3</td>
</tr>
</table>
<table style="background-color: #FFEF0A;" border="1">
<caption>orderLines</caption>
<tr>
<td><b>LineItemID</b></td>
<td><b>OrderID</b></td>
<td><b>LineNotes</b></td>
</tr>
<tr>
<td>50</td>
<td>1</td>
<td>ABC</td>
</td>
<tr>
<td>51</td>
<td>1</td>
<td>XYZ</td>
</td>
<tr>
<td>52</td>
<td>2</td>
<td>HJK</td>
</td>
<tr>
<td>53</td>
<td>2</td>
<td>DEF</td>
</td>
<tr>
<td>54</td>
<td>2</td>
<td>KLM</td>
</td>
</table>
<p>Using the SQL trick below you will end up with a result set that looks like this:</p>
<table cellpadding="5" border="1">
<tr>
<td><b>OrderID</b></td>
<td><b>OrderNotes</b></td>
<td><b>listOfLineNotes</b></td>
</tr>
<tr>
<td>1</td>
<td>Notes about order 1</td>
<td>ABC,XYZ</td>
</tr>
<tr>
<td>2</td>
<td>Notes about order 2</td>
<td>HJK,DEF,KLM</td>
</tr>
<tr>
<td>3</td>
<td>Notes about order 3</td>
<td>NULL</td>
</tr>
</table>
<p>When would you need to do this?  I&#8217;ve need it a couple times.  One was when we were grabbing database records to index into Verity.  We wanted not only data from the orders table, but also wanted to index all the notes on each line item, which were separate records in a different table.  We didn&#8217;t want to index these separately, because if there was a match in a Verity search we wanted to return the order, not the line item.  Using the query below we were able to combine all this data into one query.</p>
<pre><code>SELECT *
FROM orders AS o
CROSS APPLY (
	SELECT linenotes + ','
	FROM orderLines AS ol
	WHERE ol.orderID = o.orderID
	FOR XML PATH('') )
temp ( listOfLineNotes )</code></pre>
<p>Using this code, listOfLineNotes will be a comma separated list of all the line item notes for this order.</p>
<p>Another time this trick came in handy was when we needed to get some records from a literature database table to display on our public website.  We were going to do some filtering using JavaScript, so needed a field in each literature item row that contained a list of all the categories the item was in.  This was an easy way to accomplish that.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stillnetstudios.com/concatenating-child-rows/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Great book on usability testing: Rocket Surgery Made Easy</title>
		<link>http://www.stillnetstudios.com/usability-testing-book-review/</link>
		<comments>http://www.stillnetstudios.com/usability-testing-book-review/#comments</comments>
		<pubDate>Sat, 09 Oct 2010 01:14:22 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[Book Reviews]]></category>

		<guid isPermaLink="false">http://www.stillnetstudios.com/?p=932</guid>
		<description><![CDATA[In a meeting the other day we decided to bring in some of our customers and have them take a look at a new website we are building for them. I immediately thought of this book so I got it and read in a weekend. Rocket Surgery Made Easy by Steve Krug is &#8220;The Do-it-Yourself [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.amazon.com/dp/0321657292"><img style="margin-right: 15px; margin-bottom: 35px;" border: 0px; src="http://img.usabilitypost.com/books/rocketsurgery_large.jpg" align="left" /></a>In a meeting the other day we decided to bring in some of our customers and have them take a look at a new website we are building for them.  I immediately thought of this book so I got it and read in a weekend.  <a href="http://www.amazon.com/dp/0321657292"><em>Rocket Surgery Made Easy</em></a> by Steve Krug is &#8220;The Do-it-Yourself Guide to Finding and Fixing Usability Problems&#8221;.  I love one of Steve&#8217;s other books, <a href="http://www.stillnetstudios.com/dont-make-me-think/"><em>Don&#8217;t Make Me Think</em></a> which is a great primer on building interfaces with good usability.</p>
<p><em>Rocket Surgery Made Easy</em> is a short, easy read, just my kind of book.  After reading this book I felt I was ready to sit down with a user and get feedback from them on our site.  Steve is a veteran in doing usability testing and he imparts his wisdom in a easy to absorb way. </p>
<p>Three big take-aways from this book are:<br />
- How to test any design, on a web page or hand drawn.<br />
- How to find the most important problems<br />
- And how to fix the problems you&#8217;ve found, using his &#8220;The least you can do&#8221; approach.</p>
<p>If you don&#8217;t have any experience in usability testing, but find yourself needing to do so, this is the book for you.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stillnetstudios.com/usability-testing-book-review/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

