<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
				<channel>
					<title>Simon Baynes - ColdFusion Web Development</title>
					<link>http://www.simonbaynes.com</link>
					<description>My latest musings on ColdFusion Development and the internet.</description>
					<language>en-gb</language>
					<image>
						<title>Simon Baynes - ColdFusion Web Development</title>
						<url>http://www.simonbaynes.com/assets/images/layout/RSS_Logo.png</url>
						<link>http://www.simonbaynes.com</link>
					</image>
					
					<item>
						<title><![CDATA[New Role]]></title>
						<description><![CDATA[Well I am pleased to announce that I have accepted the role of Technical Architect at <a href="http://www.hostelbookers.com">HostelBookers.com</a>. I had initally set my sights on contracting, but I felt this was an opportunity I would regret turning down.<br /><br />I am going to really miss my old colleagues at <a href="http://www.haymarket.com">Haymarket</a>. Easily the most talented and hard working people I have ever worked with. I&apos;ll be leaving many friends behind which will be a wrench, but thankfully I&apos;m only 20 minutes down the Piccadilly Line so I am sure I&apos;ll see them all regularly.<br /><br />I start on 8th February so I get a nice week of R&amp;R before I start.]]></description>
						<link>http://www.simonbaynes.com/blog/?action=single&amp;nBlogID=87&amp;nMonth=1&amp;nYear=2010</link>
					</item>
					
					<item>
						<title><![CDATA[Moving On]]></title>
						<description><![CDATA[Well after four and a half years I have decided to move on from Haymarket. It was a difficult decision but I felt that I needed a change. I will be leaving behind some proud achievements, great friends and colleagues. I&apos;ll be working till the end of the month and then I&apos;ll be going contracting, well at least that is the plan anyway.<br /><br />Wish me luck.]]></description>
						<link>http://www.simonbaynes.com/blog/?action=single&amp;nBlogID=86&amp;nMonth=1&amp;nYear=2010</link>
					</item>
					
					<item>
						<title><![CDATA[Moving from Apache to IIS]]></title>
						<description><![CDATA[My most recent project has been moving all our production websites to IIS from Apache. This mainly quite low level and not at all complicated. The real challenge comes because we are heavy users of <a href="http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html">mod_rewite</a>.<br /><br />Fortunately <a href="http://www.helicontech.com">Helicon</a> have a product called ISAPI rewrite 3 which has very similar syntax to mod_rewrite. There are a few gotchas to bear in mind. The one that I spent too long solving was that the URL that you are assessing with RewriteRule in ISAPI rewrite starts with a / which is not the case in mod_rewrite. However, I was very thankful to discover that I did not need to change all my rules, I just had to add RewriteBase / just after the RewriteEngine on directive.<br /><br />The other huge one for me was that environment variables were not supported in ISAPI Rewrite. This did cause me to have to rearchitect thew rewrites I had for my search. However the upside of this was that I got a lot better at rewrites and realised that my initial implementaion was over complicated.]]></description>
						<link>http://www.simonbaynes.com/blog/?action=single&amp;nBlogID=85&amp;nMonth=2&amp;nYear=2009</link>
					</item>
					
					<item>
						<title><![CDATA[IIS returning 403.1 error]]></title>
						<description><![CDATA[Had a strange issue with IIS this afternoon at work that I thought I would share.<br /><br />I am in the process of migrating an application from Apache to IIS and during the testing I discovered a strange error. When trying to return an HTML file IIS was returning a 403.1 status code and moaning about execute permissions.<br /><br />I spent a while checking all manner of security permissions only to discover that it was because the file was in a folder whose name ended in &apos;.com&apos;. Apparently this causes issues because IIS thinks that you are trying to execute a file with a &apos;.com&apos; extension.<br /><br />Sadly I had to recode my architecture to change the folder name as there did not seem to be a work around.<br /><br />Anyway hope this helps someone someday who is scratching their head!]]></description>
						<link>http://www.simonbaynes.com/blog/?action=single&amp;nBlogID=84&amp;nMonth=2&amp;nYear=2009</link>
					</item>
					
					<item>
						<title><![CDATA[Return of the Baynes]]></title>
						<description><![CDATA[OK,<br />I haven&apos;t written a new blogpost for a couple of years now, this due to several things. A combination of being very busy with my job and working hard recovering from a serious car accident in April 2007.<br /><br />I am going to start putting up useful posts again in an effort to justify my web site existing for something other than a method to recruiters to harass me!<br /><br />This all hugely presumptuous on my part as I have no idea if anyone reads this blog to notice if I post or not!<br /><br />Regards,<br /><br />Simon]]></description>
						<link>http://www.simonbaynes.com/blog/?action=single&amp;nBlogID=83&amp;nMonth=2&amp;nYear=2009</link>
					</item>
					
					<item>
						<title><![CDATA[Using Java to Optimise Looping Over Lists]]></title>
						<description><![CDATA[Once you have been using ColdFusion for a while you will have undoubtedly had to loop through a list. Now this is very straight forward operation and one where you rarely have to consider performance. However, if you are reading in a 10,000+ row CSV file this iterative process can be very slow. Many of you would do something like this:-<br /><br /><div class="code">&lt;cfloop list=&quot;#myCSV#&quot; index=&quot;thisRow&quot;&gt;<br />&lt;!--- here is where you would do your row processing ---&gt;<br />&lt;/cfloop&gt;</div><br />Now there is essentially nothing wrong with this code, however this processing is not optimal performancewise. Fortunately you can access the power of the underlying Java to up the performance.<br /><br /><div class="code">&lt;!--- here we use the java.lang.String class to convert our CSV into an array using the split() method ---&gt;<br />&lt;cfset myCSV = createObject(&quot;java&quot;, &quot;java.lang.String&quot;).init(myCSV).split(chr(13) &amp; chr(10))&gt;<br />&lt;cfloop from=&quot;1&quot; to=&quot;#arrayLen(myCSV)#&quot; index=&quot;thisRow&quot;&gt;<br />&lt;!--- here is where you would do your row processing ---&gt;<br />&lt;/cfloop&gt;</div><br />I have seen this provide enormous performance gains.]]></description>
						<link>http://www.simonbaynes.com/blog/?action=single&amp;nBlogID=82&amp;nMonth=7&amp;nYear=2006</link>
					</item>
					
					<item>
						<title><![CDATA[SQL Optimisation Tip]]></title>
						<description><![CDATA[There is a saying &apos;There are many ways to skin a cat&apos; this is rarely as true as it is with optimising SQL.<br /><br />However, I have a tip for you for SQL Server. You can specify that you wish to do a &apos;Dirty Read&apos;. This means that you want the select to go ahead without worrying if there are locks on the table / row because of inserts, updates, and deletes. So if a row that fits your criteria is in the process of being deleted it will still end up in your results.<br /><br />So obviously this is not a solution for every query but it can really relieve some pressure if you do not mind the draw backs.<br /><br /><div class="code">SELECT *<br />FROM myTable WITH (NOLOCKS)</div><br />It will also work when you do joins but you must include the &apos;WITH (NOLOCKS)&apos; command after every table declaration.<br /><br /><div class="code">SELECT *<br />FROM myTable a WITH (NOLOCKS)<br />INNER JOIN myOtherTable b WITH (NOLOCKS)<br />ON a.ID = b.ID</div>]]></description>
						<link>http://www.simonbaynes.com/blog/?action=single&amp;nBlogID=81&amp;nMonth=5&amp;nYear=2006</link>
					</item>
					
					<item>
						<title><![CDATA[Promotion]]></title>
						<description><![CDATA[I got promoted yesterday. I am now the Senior Developer at Haymarket Publishing. Well done me!]]></description>
						<link>http://www.simonbaynes.com/blog/?action=single&amp;nBlogID=80&amp;nMonth=4&amp;nYear=2006</link>
					</item>
					
					<item>
						<title><![CDATA[CGI Scope Fun and Games]]></title>
						<description><![CDATA[I recently discovered that if you use &lt;cfdump&gt; to output the CGI scope then it doesn&apos;t actually display all the keys in the CGI structure. It actually displays a defined list of keys which I unfortunately only realised after about an hour trying to work out where the variables Apache was supposedly setting were.<br /><br />Very annoying.]]></description>
						<link>http://www.simonbaynes.com/blog/?action=single&amp;nBlogID=79&amp;nMonth=3&amp;nYear=2006</link>
					</item>
					
					<item>
						<title><![CDATA[Using Array Notation in ColdFusion]]></title>
						<description><![CDATA[Referencing dynamic variable names can be tricky, unless you are aware of a few basic ColdFusion concepts.<br /><br />I see things like this:-<br /><div class="code">&lt;cfloop collection=&quot;#form#&quot; item=&quot;iFormKey&quot;&gt;<br />&lt;cfset temp = evaluate(form.#iFormKey#)&gt;<br />#temp#<br />&lt;/cfloop&gt;</div> and it drives me insane. It is so unnecessary not to mention messy.<br /><br />Here it is again but using array notation.<br /><div class="code">&lt;cfloop collection=&quot;#form#&quot; item=&quot;iFormKey&quot;&gt;<br />#form[iFormKey]#<br />&lt;/cfloop&gt;</div><br />Now this is not only optimal it is also clear. If you find yourself using the evaluate() function you are either going about it in the wrong way or you are trying to cheat ColdFusion into doing something that it doesn&apos;t want to do.<br /><br />Also bear in mind that barring a few exceptions all ColdFusion variables are in a struct.<br /><br /><div class="code">&lt;cfscript&gt;<br />myVar1 = 1;<br />myVar2 = 2;<br />myVar3 = 3;<br />myVar4 = 4;<br />myVar5 = 5;<br /><br />for (i = 1; i LTE 5; i = i + 1) {<br />// now we use the fact that by default any non-scoped variables are put in the variables scope to our advantage<br />writeOutput(variables[&quot;myVar&quot; &amp; i] &amp; &quot;&lt;br /&gt;&quot;);<br />}<br />&lt;/cfscript&gt;</div><br />So as you can see array notation is very powerful and clean.]]></description>
						<link>http://www.simonbaynes.com/blog/?action=single&amp;nBlogID=78&amp;nMonth=3&amp;nYear=2006</link>
					</item>
					
					<item>
						<title><![CDATA[Default Proxy for ColdFusion]]></title>
						<description><![CDATA[Ever had to develop an application that used cfhttp? Ever done this on a machine that is behind a proxy?<br /><br />If the answer to those two questions is yes then you may have written some bung code like this:-<br /><br /><div class="code">&lt;cftry&gt;<br />&lt;cfhttp url=&quot;http://www.simonbaynes.com/rss.cfm&quot; proxyserver=&quot;255.255.255.255&quot; port=&quot;80&quot; throwonerror=&quot;true&quot; /&gt;<br />&lt;!--- if there is an error then we are on live ---&gt;<br />&lt;cfcatch type=&quot;any&quot;&gt;<br />&lt;cfhttp url=&quot;http://www.simonbaynes.com/rss.cfm&quot; throwonerror=&quot;true&quot; /&gt;<br />&lt;/cfcatch&gt;<br />&lt;/cftry&gt;</div><br />This is totally unnecessary as with some jvm.config arguments you can set a default proxy for your ColdFusion instance.<br /><br /><div class="code">-DproxySet=true -Dhttp.proxyHost=255.255.255.255 -DproxyPort=80#</div>]]></description>
						<link>http://www.simonbaynes.com/blog/?action=single&amp;nBlogID=77&amp;nMonth=3&amp;nYear=2006</link>
					</item>
					
					<item>
						<title><![CDATA[Copying Structures]]></title>
						<description><![CDATA[Once you start using structures you need to understand pointers. This essentially is that if you set a variable equal to a structure you do not create a copy but in fact a reference (or alias). This means that if you change either of them you will change them both.<br /><br /><div class="code">&lt;cfscript&gt;<br />stDemo = structNew();<br />stDemo.sName = &quot;Simon&quot;;<br />stDemo.nAge = 27;<br />stNew = stDemo;<br />stNew.nAge = 28;<br /><br />// now check the result of this output<br />writeOutput(stDemo.nAge);<br />&lt;/cfscript&gt;</div><br />So as you can see this does not perform as you would expect. The way to prevent this is to use the duplicate() function.<br /><br /><div class="code">&lt;cfscript&gt;<br />stDemo = structNew();<br />stDemo.sName = &quot;Simon&quot;;<br />stDemo.nAge = 27;<br />stNew = duplicate(stDemo);<br />stNew.nAge = 28;<br /><br />// now check the result of this output<br />writeOutput(stDemo.nAge);<br />&lt;/cfscript&gt;</div>]]></description>
						<link>http://www.simonbaynes.com/blog/?action=single&amp;nBlogID=76&amp;nMonth=2&amp;nYear=2006</link>
					</item>
					
					<item>
						<title><![CDATA[Var(ing) Variables]]></title>
						<description><![CDATA[A real bug bear of mine is people not var(ing) variables in their functions. Many people think this is just an inconvenience but<br />trust me it is nothing compared to trying to debug code that is acting strange only to discover some hours later that your<br />variables are being overwriten by another function.<br /><br /><strong>Some common errors include:-</strong><br /><strong>Not var(ing) your indexes</strong><br /><br /><div class="code">&lt;--- This is just a made up function that replicates structKeyList() ---&gt;<br />&lt;cffunction name=&quot;getStructKeyList&quot; returntype=&quot;string&quot;&gt;<br />&lt;cfargument name=&quot;stStruct&quot; type=&quot;struct&quot; required=&quot;true&quot;&gt;<br />&lt;cfargument name=&quot;sDelimiter&quot; type=&quot;string&quot; required=&quot;false&quot; default=&quot;,&quot;&gt;<br />&lt;cfscript&gt;<br /><br />// now here is where we are var(ing) our variables<br />var lstKey  = &quot;&quot;; <br /><strong>var iKey = 0; // this is something that many people forget and you must var ALL your local variables</strong><br /><br />// loop through collection to get the key list<br />for (iKey in arguments.stStruct) {<br />lstKeys = listAppend(lstKeys, iKey, arguments.sDelimiter); <br />}<br /><br />return lstKeys; <br />&lt;/cfscript&gt;<br />&lt;/cffunction&gt;</div><br /><strong>Not var(ing) queries</strong><br /><br /><div class="code">&lt;cffunction name=&quot;getQuery&quot; returntype=&quot;query&quot;&gt;<br /><strong>&lt;--- You must also var your queries ---&gt;</strong><br />&lt;cfset var qGetData = &quot;&quot;&gt;<br />&lt;cfquery name=&quot;qGetData&quot; datasource=&quot;myDSN&quot;&gt;<br />SELECT *<br />FROM tbl_myTable<br />&lt;/cfquery&gt;<br /><br />&lt;cfreturn qGetData&gt;<br />&lt;/cffunction&gt;</div><br />So you see, it is easy to overlook all your local variables, but you really must var all of them as it will make your life immeasurably easier once your functions get more complicated.]]></description>
						<link>http://www.simonbaynes.com/blog/?action=single&amp;nBlogID=75&amp;nMonth=2&amp;nYear=2006</link>
					</item>
					
					<item>
						<title><![CDATA[Some CSS Tips]]></title>
						<description><![CDATA[Now I don&apos;t profess to be a legend of CSS, but I get by. Two things that really used to bug me when I was doing layouts with CSS were the base margins and padding around HTML elements like &lt;form&gt;, &lt;ul&gt;, &lt;h1&gt; and &lt;p&gt; are never constant on different browsers. Secondly, it is the purple border that IE puts around an image that is a link by default. Here is some quick CSS to set all your padding and margins to zero and prevent all borders on images.<br /><br /><div class="code">* {<br />padding: 0;<br />margin: 0;<br />}<br /><br />img {<br />border: 0;<br />}</div><br />There are now all defaulted and be overridden for individual elements.]]></description>
						<link>http://www.simonbaynes.com/blog/?action=single&amp;nBlogID=74&amp;nMonth=1&amp;nYear=2006</link>
					</item>
					
					<item>
						<title><![CDATA[Clear Template Cache Broken in ColdFusion 7.01?]]></title>
						<description><![CDATA[It appears that the clear template cache function has been broken by the ColdFusion 7.01 updater. The only way round it I have is to turn off the Trusted Cache while you use your updated code and then reinstate it. Hope that hasn't caught anyone out.]]></description>
						<link>http://www.simonbaynes.com/blog/?action=single&amp;nBlogID=73&amp;nMonth=1&amp;nYear=2006</link>
					</item>
					
				</channel>
			</rss>