<?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>Zenji Web Development &#187; Web</title>
	<atom:link href="http://www.zenjiwebworks.com/category/software-development/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zenjiwebworks.com</link>
	<description>Website development and consultancy</description>
	<lastBuildDate>Fri, 25 Sep 2009 08:10:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>iPhone Blogging</title>
		<link>http://www.zenjiwebworks.com/2009/03/12/iphone-blogging/</link>
		<comments>http://www.zenjiwebworks.com/2009/03/12/iphone-blogging/#comments</comments>
		<pubDate>Thu, 12 Mar 2009 18:32:20 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.zenjiwebworks.com/2009/03/12/iphone-blogging/</guid>
		<description><![CDATA[I only just noticed that there&#8217;s a blogging app for Wordpress on the iPhone. It happily gets around the problem with Safari not allowing image uploads. 

]]></description>
			<content:encoded><![CDATA[<p>I only just noticed that there&#8217;s a blogging app for Wordpress on the iPhone. It happily gets around the problem with Safari not allowing image uploads. </p>
<p><a href="http://www.zenjiwebworks.com/wp-content/uploads/2009/03/p-640-480-018d9434-0e97-48c5-ace3-02583bcefe94.jpeg"><img src="http://www.zenjiwebworks.com/wp-content/uploads/2009/03/p-640-480-018d9434-0e97-48c5-ace3-02583bcefe94.jpeg" alt="" width="225" height="300" class="alignnone size-full wp-image-364" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenjiwebworks.com/2009/03/12/iphone-blogging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET MVC ActionFilters and Response.Redirect</title>
		<link>http://www.zenjiwebworks.com/2008/12/19/aspnet-mvc-actionfilters-and-responseredirect/</link>
		<comments>http://www.zenjiwebworks.com/2008/12/19/aspnet-mvc-actionfilters-and-responseredirect/#comments</comments>
		<pubDate>Fri, 19 Dec 2008 16:28:53 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[Gotchas]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.zenjiwebworks.com/2008/12/19/aspnet-mvc-actionfilters-and-responseredirect/</guid>
		<description><![CDATA[There is an issue with using the following code in an action filter:



filterContext.HttpContext.Response.Redirect&#40;loginUrl, true&#41;;



which is a bit of code quite common in an authentication filter. The problem is it will throw a ThreadAbortException as soon as you put your code on a live site resulting in the error page for anyone who is not logged [...]]]></description>
			<content:encoded><![CDATA[<p>There is an issue with using the following code in an action filter:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">filterContext.<span class="me1">HttpContext</span>.<span class="me1">Response</span>.<span class="me1">Redirect</span><span class="br0">&#40;</span>loginUrl, <span class="kw2">true</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>which is a bit of code quite common in an authentication filter. The problem is it will throw a ThreadAbortException as soon as you put your code on a live site resulting in the error page for anyone who is not logged in. This is probably not what you want since you are attempting to redirect them to the login page.</p>
<p>Now it is a little unfair to say that it&#8217;s an issue because that is the intended functionality. But it doesn&#8217;t fit well with MVC controllers, especially since Microsoft&#8217;s official suggestion is to set the endResponse flag to false. That is just downright misleading since your controller action (which the filter just decided you can&#8217;t access) is still executed after the filter fails authentication &#8211; resulting in the action code being executed anyway whilst you see the login screen on the browser and assume it all went swimmingly! Meanwhile those files that this user shouldn&#8217;t have access to got deleted.</p>
<p>Yeah, that&#8217;s what I just did during testing whilst proving to myself that you can&#8217;t fake the URL as a non-registered user. Imagine my surprise. It&#8217;s true that the chances of a malicious user actually working out the URL might be low, but that&#8217;s no reason to leave the door open.</p>
<p>Oh, and your unit tests probably won&#8217;t catch this because the filters don&#8217;t get executed by the unit tests. But I digress&#8230;</p>
<p>To cut a long story short, this bit of code in your base controller (assuming you have one, otherwise stick in in all of the controllers) will prevent the issue:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">protected override <span class="kw4">void</span> OnException<span class="br0">&#40;</span>ExceptionContext filterContext<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>filterContext.<span class="me1">Exception</span> is ThreadAbortException<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; filterContext.<span class="me1">ExceptionHandled</span> = <span class="kw2">true</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.zenjiwebworks.com/2008/12/19/aspnet-mvc-actionfilters-and-responseredirect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maximum Request Length Exceeded</title>
		<link>http://www.zenjiwebworks.com/2008/12/11/maximum-request-length-exceeded/</link>
		<comments>http://www.zenjiwebworks.com/2008/12/11/maximum-request-length-exceeded/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 08:52:52 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[IIS]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.zenjiwebworks.com/2008/12/11/maximum-request-length-exceeded/</guid>
		<description><![CDATA[It&#8217;s hard to believe how badly this is handled in IIS. Admittedly I&#8217;ve only tried it in IIS 6, but I see no evidence that it gets any better in IIS 7.
So here&#8217;s the problem &#8211; you create a website that allows the upload of images (or any file types for that matter). It&#8217;s very [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s hard to believe how badly this is handled in IIS. Admittedly I&#8217;ve only tried it in IIS 6, but I see no evidence that it gets any better in IIS 7.</p>
<p>So here&#8217;s the problem &#8211; you create a website that allows the upload of images (or any file types for that matter). It&#8217;s very likely you&#8217;re going to want to limit the size of those uploads or you&#8217;ll end up in a world of pain when your users go and use up all your disk space. By default IIS allows upload sizes of 4Mb which is ample for image purposes. However, if someone uploads a file above that size you&#8217;re likely to want to notify them by telling them gently they&#8217;re an idiot for not reading the note above the file input field and then allow them to reselect a file.</p>
<p>But you can&#8217;t because the requests never gets to your page. IIS simply drops the request and seems to respond with nothing at all. That leaves the user looking at a &#8216;Web site could not be found&#8217; error, which is misleading and just plain wrong.<br />
<span id="more-39"></span></p>
<p>And this is the situation I found myself in. Simply put, you can&#8217;t catch the HttpException in your code and recover gracefully. Unfortunately the vast majority of people out there believe the answer is to increase the maxRequestLength in web.config. How can that be considered a solution? It&#8217;s like saying the way to deal with traffic congestion is to double the size of every road. Someone, somewhere will then try and upload a file that is even bigger and the problem repeats itself.</p>
<p>I spent a long time looking for a solution and eventually came across a little trick which you can pull in your Global.asax:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">protected <span class="kw4">void</span> Application_BeginRequest<span class="br0">&#40;</span>Object sender, EventArgs e<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw4">int</span> maxRequestLength = <span class="nu0">4096000</span>; <span class="co1">// 4MB</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>Request.<span class="me1">ContentLength</span> &gt; maxRequestLength<span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; HttpApplication app = sender as HttpApplication;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; HttpContext context = app.<span class="me1">Context</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; HttpWorkerRequest wr = <span class="br0">&#40;</span>HttpWorkerRequest<span class="br0">&#41;</span><span class="br0">&#40;</span>context.<span class="me1">GetType</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">GetProperty</span><span class="br0">&#40;</span><span class="st0">&quot;WorkerRequest&quot;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.<span class="me1">Reflection</span>.<span class="me1">BindingFlags</span>.<span class="me1">Instance</span> | System.<span class="me1">Reflection</span>.<span class="me1">BindingFlags</span>.<span class="me1">NonPublic</span><span class="br0">&#41;</span>.<span class="me1">GetValue</span><span class="br0">&#40;</span>context, <span class="kw2">null</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; byte<span class="br0">&#91;</span><span class="br0">&#93;</span> buffer;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>wr.<span class="me1">HasEntityBody</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> contentlen = Convert.<span class="me1">ToInt32</span><span class="br0">&#40;</span>wr.<span class="me1">GetKnownRequestHeader</span><span class="br0">&#40;</span>HttpWorkerRequest.<span class="me1">HeaderContentLength</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; buffer = wr.<span class="me1">GetPreloadedEntityBody</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> received = buffer.<span class="me1">Length</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> totalrecv = received;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>!wr.<span class="me1">IsEntireEntityBodyIsPreloaded</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; buffer = new byte<span class="br0">&#91;</span><span class="nu0">65535</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">while</span> <span class="br0">&#40;</span>contentlen &#8211; totalrecv &gt;= received<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; received = wr.<span class="me1">ReadEntityBody</span><span class="br0">&#40;</span>buffer, buffer.<span class="me1">Length</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; totalrecv += received;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; received = wr.<span class="me1">ReadEntityBody</span><span class="br0">&#40;</span>buffer, contentlen &#8211; totalrecv<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; context.<span class="me1">Response</span>.<span class="me1">Redirect</span><span class="br0">&#40;</span><span class="st0">&quot;~/Error.aspx/FileTooBig&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>Thanks to <a href="http://dotnetslackers.com/Community/blogs/haissam/archive/2008/09.aspx">this guy</a> for the hard work.</p>
<p>It seems to be about the only place in the code that you can do anything about the error. What it&#8217;s actually doing is reading in the whole of the request even though it is over your maximum request size. Once the whole request has been read you are able to make a response to the calling client, in this case a redirect to an error page. It&#8217;s possible that you could take this further and carry on with the page the user originally intended to work with, catching the error and displaying it there. But I&#8217;m too burned out to try that right now and this solution works fine for me!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenjiwebworks.com/2008/12/11/maximum-request-length-exceeded/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating Strongly-Typed Views in ASP.NET MVC Beta</title>
		<link>http://www.zenjiwebworks.com/2008/12/05/creating-strongly-typed-views-in-aspnet-mvc-beta/</link>
		<comments>http://www.zenjiwebworks.com/2008/12/05/creating-strongly-typed-views-in-aspnet-mvc-beta/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 11:42:01 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.zenjiwebworks.com/2008/12/05/creating-strongly-typed-views-in-aspnet-mvc-beta/</guid>
		<description><![CDATA[One of the big problems with the early adoption of any framework is the documentation. No books are released yet, if they are ever going to be, and so turning to Google is your best bet. In fact it&#8217;s your only option and my own preference is using Google over books anyway.
But frameworks change during [...]]]></description>
			<content:encoded><![CDATA[<p>One of the big problems with the early adoption of any framework is the documentation. No books are released yet, if they are ever going to be, and so turning to Google is your best bet. In fact it&#8217;s your only option and my own preference is using Google over books anyway.</p>
<p>But frameworks change during development and you come across the issue that all of the top hits for your query are based on previous versions. When that previous version did it differently you&#8217;re stuck! I had this problem today when trying to create strongly-typed views. I love strongly-typed anythings, but I&#8217;m just a sucker for having a project that is more likely to work when another developer makes an edit and doesn&#8217;t bother fully checking the effects of their changes. It&#8217;s another safety net, and I&#8217;m a sucker for safety nets as well.</p>
<p>So, this is how I did it in bite-sized chunks. First the controller function:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">public ActionResult Index<span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; var ContentObject = new ContentClass<span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">return</span> View<span class="br0">&#40;</span>ContentModel.<span class="me1">Load</span><span class="br0">&#40;</span>ContentObject<span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>Next I created a new view by right-clicking the above method (bear in mind that I&#8217;m using Visual Studio 2008) and checking the &#8216;Create a strongly-typed view&#8217; before entering the full name of the object type (ContentClass). That produces an aspx.cs which looks something like this:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">public partial class Index : ViewPage&lt;ContentClass&gt;</div>
</li>
</ol>
</div>
<p>So far so good, but where I really came unstuck was actually using this in the view. Turns out it&#8217;s simpler than ever. All you need to use is the ViewData.Model parameter, which is automatically typed to whatever you set the view up as previously:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&lt;%</div>
</li>
<li class="li1">
<div class="de1">foreach <span class="br0">&#40;</span>var portfolio in ViewData.<span class="me1">Model</span>.<span class="me1">Portfolios</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">%&gt;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &lt;p&gt;&lt;%= portfolio.<span class="me1">ID</span> %&gt;&lt;/p&gt;</div>
</li>
<li class="li1">
<div class="de1">&lt;%</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">%&gt;</div>
</li>
</ol>
</div>
<p>All that I have to do now is pass that through to a UserControl. I&#8217;m assuming I can strongly-type those as well. We shall see.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenjiwebworks.com/2008/12/05/creating-strongly-typed-views-in-aspnet-mvc-beta/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deploying ASP.NET MVC Applications</title>
		<link>http://www.zenjiwebworks.com/2008/11/28/deploying-aspnet-mvc-applications/</link>
		<comments>http://www.zenjiwebworks.com/2008/11/28/deploying-aspnet-mvc-applications/#comments</comments>
		<pubDate>Fri, 28 Nov 2008 21:56:31 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.zenjiwebworks.com/2008/11/28/deploying-aspnet-mvc-applications/</guid>
		<description><![CDATA[Now I&#8217;m a huge fan of the ASP.NET MVC framework. So much so that I have taken to porting across applications already started using the Castle Monorail framework. Why? Well, there&#8217;s just a nice, warm, supported feeling when using a framework that is built-in to your chosen development platform.
Or at least that&#8217;s what you&#8217;d think. You [...]]]></description>
			<content:encoded><![CDATA[<p>Now I&#8217;m a huge fan of the ASP.NET MVC framework. So much so that I have taken to porting across applications already started using the Castle Monorail framework. Why? Well, there&#8217;s just a nice, warm, supported feeling when using a framework that is built-in to your chosen development platform.</p>
<p>Or at least that&#8217;s what you&#8217;d think. You know how it is &#8211; you get it all working on your lovely development machine and then once the decision has been made on where to host the final result, you upload your application and&#8230;bang&#8230;</p>
<pre>HttpException (0x80004005): The incoming request does not match any route.</pre>
<p>Oh yes, that works so well.</p>
<p>Suddenly that belief that, finally, someone has produced a framework which is so nicely integrated with your target platform comes crashing down around your head as you weep softly into your keyboard. No, ASP.NET MVC is not actually supported on anything under IIS7. Does your host offer IIS7 at the moment? I guess not.</p>
<p>Now don&#8217;t get me wrong, it does <em>work</em> on IIS6 but you have to mangle it a bit and unless you pay a fortune each month for access to your own virtual server then you&#8217;re likely to lose those pretty urls. That&#8217;s not the same as being <em>supported</em>. For those that have spent the last two hours Googling and still getting the same problem, here is the man with the answer:</p>
<p><a href="http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx">http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenjiwebworks.com/2008/11/28/deploying-aspnet-mvc-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The trouble with the right-alignment of input fields</title>
		<link>http://www.zenjiwebworks.com/2008/07/11/the-trouble-with-right-alignment-of-input-fields/</link>
		<comments>http://www.zenjiwebworks.com/2008/07/11/the-trouble-with-right-alignment-of-input-fields/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 10:32:31 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Gotchas]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.zenjiwebworks.com/2008/07/11/the-trouble-with-right-alignment-of-input-fields/</guid>
		<description><![CDATA[Everyone knows that when you have a text box which accepts a number, it should automatically right-align the text content. Well maybe not everyone, but accountants certainly do and if you&#8217;re writing an application for an accountant it just won&#8217;t look right unless the values are right-aligned.
Simple, I thought &#8211; text-align:right in the CSS and [...]]]></description>
			<content:encoded><![CDATA[<p>Everyone knows that when you have a text box which accepts a number, it should automatically right-align the text content. Well maybe not everyone, but accountants certainly do and if you&#8217;re writing an application for an accountant it just won&#8217;t look right unless the values are right-aligned.</p>
<p>Simple, I thought &#8211; text-align:right in the CSS and the jobs a good &#8216;un. Well yes, you would think so. The fact of the matter is that text-align:right is only supposed to apply to block level elements (according to the CSS2 specs), although it isn&#8217;t quite implemented that way in all browsers. So, add display:block in there as well just to be on the safe side:</p>
<p>Left Align: &lt;input style=&#8221;padding: 0px; text-align: right; display: block&#8221; type=&#8221;text&#8221; /&gt;</p>
<input style="padding: 0px; text-align: right; display: block" type="text" /> Right Align: &lt;input style=&#8221;padding: 0px; display: block&#8221; type=&#8221;text&#8221; /&gt;</p>
<input style="padding: 0px; display: block" type="text" />
<p>Job done! Well, not quite if you are viewing this in Internet Explorer 7. Click in the input field which is aligned to the right and no cursor displays at all! I must be tired today because this took me ages to work out and I found no reference to it anywhere in the web. For some reason the cursor is there &#8211; it&#8217;s just off to the right a little too far. I say &#8217;some reason&#8217; when I now know that the actual reason is that the padding is set to 0px. The reason for this happens to be because it has inherited the property from other elements in my form layout, but in this example I have added it specifically. Add a little padding to the right and hey presto:</p>
<p>Left Align: &lt;input style=&#8221;padding: 0px 1px 0px 0px; text-align: right; display: block&#8221; type=&#8221;text&#8221; /&gt;</p>
<input style="padding: 0px 1px 0px 0px; text-align: right; display: block" type="text" /> Right Align: &lt;input style=&#8221;padding: 0px 1px 0px 0px; display: block&#8221; type=&#8221;text&#8221; /&gt;</p>
<input style="padding: 0px 1px 0px 0px; display: block" type="text" />
<p>That&#8217;s just strange. Zero padding displays the cursor on the left, but not the right. Except in Firefox, which just shows it correctly in either case.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenjiwebworks.com/2008/07/11/the-trouble-with-right-alignment-of-input-fields/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CakePHP and clean URLs</title>
		<link>http://www.zenjiwebworks.com/2007/07/28/cakephp-and-clean-urls/</link>
		<comments>http://www.zenjiwebworks.com/2007/07/28/cakephp-and-clean-urls/#comments</comments>
		<pubDate>Sat, 28 Jul 2007 10:39:23 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.zenjiwebworks.com/2007/07/28/cakephp-and-clean-urls/</guid>
		<description><![CDATA[Now don&#8217;t get me wrong &#8211; I love CakePHP and I know there&#8217;s a good reason for the controller/action format of urls. In fact I often find it helps to have a framework that forces that sort of thinking on me all the time since most of the sites I write are more application than [...]]]></description>
			<content:encoded><![CDATA[<p>Now don&#8217;t get me wrong &#8211; I love CakePHP and I know there&#8217;s a good reason for the controller/action format of urls. In fact I often find it helps to have a framework that forces that sort of thinking on me all the time since most of the sites I write are more application than website. It&#8217;s a bit like the good old days when I was struggling to get my head around the concept of OO after coming from a very procedural background. I could probably have done with a framework then too.</p>
<p>So I do think that it&#8217;s great for web <strong>applications</strong>, but not necessarily for web <strong>sites</strong>. Clean urls have many touted advantages over controller/action urls for a web site. I&#8217;m not sure how many are true (things like Google favouring them seem like a good reason, if that is actually the case) but for me it&#8217;s best simply because <em>they are not controller actions</em>.  A &#8216;contact me&#8217; page is a &#8216;contact me&#8217; page. It&#8217;s not really an action on a particular controller in your application. An &#8216;about&#8217; page is similar &#8211; it just seems wrong to say &#8216;about&#8217; is an action on &#8216;pages&#8217;. Well, it does to me anyway. Whilst I usually write web applications there is almost always a web site component like this to them and I think it&#8217;s fine to seperate those two concepts even when they&#8217;re on the same site.</p>
<p>Now it&#8217;s true that you can write static pages directly to the webroot, but my clients almost always want some management control over those pages. As much as I&#8217;d like them to have to come back to me every time they want to change a word it just doesn&#8217;t seem particularly fair and just harms my chances of repeat business! All of the other solutions I came across just seemed rather complex and often slightly dodgy. So I came up with a simple solution of my own that works fine.</p>
<p>Basically you add an entry to routes.php for each of these pages:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="re0">$Route</span>-&gt;<span class="me1">connect</span><span class="br0">&#40;</span><span class="st0">&#8216;/contact/*&#8217;</span>, <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="st0">&#8216;controller&#8217;</span> =&gt; <span class="st0">&#8216;pages&#8217;</span>, <span class="st0">&#8216;action&#8217;</span> =&gt; <span class="st0">&#8216;contact&#8217;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>This will redirect any call to &#8216;/contact&#8217; to &#8216;/pages/contact&#8217;, but without giving that fact away to the user. It&#8217;s true that you can&#8217;t now have a controller called &#8216;contact&#8217; but then you wouldn&#8217;t want one anyway (the main reason being controller names should be plural when following the Cake conventions!). You can add as many of these lines as you like. If you end up with more than 2 or 3 you might want to question whether those pages should have been part of a controller!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenjiwebworks.com/2007/07/28/cakephp-and-clean-urls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using checkboxes in CakePHP</title>
		<link>http://www.zenjiwebworks.com/2007/07/03/using-checkboxes-in-cakephp/</link>
		<comments>http://www.zenjiwebworks.com/2007/07/03/using-checkboxes-in-cakephp/#comments</comments>
		<pubDate>Tue, 03 Jul 2007 21:26:21 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.zenjiwebworks.com/2007/07/03/using-checkboxes-in-cakephp/</guid>
		<description><![CDATA[Something that&#8217;s had me confused for a couple of hours today is using a checkbox in my CakePHP application. I&#8217;ve been using the html helper to create the relevant html and was initially confused by the fact that it not only creates the input element but also a preceding hidden input element.



&#60;input type=&#34;hidden&#34; name=&#34;data[Item][big_rock]&#34; &#160;value=&#34;0&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>Something that&#8217;s had me confused for a couple of hours today is using a checkbox in my CakePHP application. I&#8217;ve been using the html helper to create the relevant html and was initially confused by the fact that it not only creates the input element but also a preceding hidden input element.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&lt;input type=<span class="st0">&quot;hidden&quot;</span> name=<span class="st0">&quot;data[Item][big_rock]&quot;</span> &nbsp;value=<span class="st0">&quot;0&quot;</span> id=<span class="st0">&quot;ItemBigRock_&quot;</span> /&gt;</div>
</li>
<li class="li1">
<div class="de1">&lt;input type=<span class="st0">&quot;checkbox&quot;</span> name=<span class="st0">&quot;data[Item][big_rock]&quot;</span> id=<span class="st0">&quot;ItemBigRock&quot;</span> &nbsp;value=<span class="st0">&quot;1&quot;</span> /&gt;</div>
</li>
</ol>
</div>
<p>So I did the best thing I could think of and ignored it, but when I came to creating the form to edit existing values I just ended up getting strange results. The checkboxes seemed to have a life of their own, checking and un-checking at will between post-backs. Google came up with several posts about the general problem most people come across with checkboxes &#8211; the fact that they post back nothing if they are not checked, but it took me far too long to actually put the strange hidden input field and this standard behaviour together. In my defence, there is very little documentation on this (that I could find) for CakePHP.<br />
<span id="more-17"></span><br />
I did a bit of debugging and discovered that I did always get a value posted back &#8211; sometimes &#8216;0&#8242;, sometimes &#8216;on&#8217; and sometimes &#8216;-1&#8242;. The &#8216;on&#8217; I&#8217;m used to as that is the value posted back by a checkbox when it is actually checked, but the others seemed a bit random. After much nashing of teeth and a lot of keyboard punching I think I have it, or at least I have a good enough idea of what they are doing to get it to work for me.</p>
<p>The hidden input field has the same name as the checkbox meaning that any value it contains is posted back if the checkbox is unchecked when the form posts. Nifty trick. If the checkbox is set to &#8216;unchecked&#8217; when the form is rendered then the hidden field is set to &#8216;-1&#8242;, otherwise it is set to &#8216;0&#8242;. The result is that the value posted back is &#8216;on&#8217; if the checkbox is checked by the user, 0 if the checkbox is unchecked by the user (and was originally checked when the form rendered) and -1 if the checkbox is unchecked (and was originally unchecked when the form rendered).</p>
<p>Make sense? I hope so. It&#8217;s actually pretty useful since you can tell what the user did rather than just knowing the state when the form is posted. Since this is not the value we want to stick in our database (well, -1 isn&#8217;t anyway) we need to do a bit of manipulation at the  controller end. Rather than just mapping the checkbox to the model as you would probably do with a text field it is best to have some sort of interim parameter which can be checked and the desired value set on the model. This is my effort. I don&#8217;t think it&#8217;s too pretty but it&#8217;s late, I&#8217;m tired and it works.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span><a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$this</span>-&gt;<span class="me1">data</span><span class="br0">&#91;</span><span class="st0">&#8216;Item&#8217;</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st0">&#8216;big_rock_checked&#8217;</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="re0">$this</span>-&gt;<span class="me1">data</span><span class="br0">&#91;</span><span class="st0">&#8216;Item&#8217;</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st0">&#8216;big_rock_checked&#8217;</span><span class="br0">&#93;</span> != <span class="st0">&#8216;-1&#8242;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$this</span>-&gt;<span class="me1">data</span><span class="br0">&#91;</span><span class="st0">&#8216;Item&#8217;</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st0">&#8216;big_rock&#8217;</span><span class="br0">&#93;</span> = <span class="re0">$this</span>-&gt;<span class="me1">data</span><span class="br0">&#91;</span><span class="st0">&#8216;Item&#8217;</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st0">&#8216;big_rock_checked&#8217;</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>So, my fake value &#8216;big_rock_checked&#8217; gets the posted value from the form and if it is &#8216;-1&#8242; I know there&#8217;s no change to the value and can ignore it. Since it doesn&#8217;t get set on the model it doesn&#8217;t change the db value. If it&#8217;s &#8216;0&#8242; or &#8216;on&#8217; I just set the model value and let the framework deal with it.</p>
<p>I think some sleep is in order after that one <img src='http://www.zenjiwebworks.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenjiwebworks.com/2007/07/03/using-checkboxes-in-cakephp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setting up CakePHP with fastCGI</title>
		<link>http://www.zenjiwebworks.com/2007/07/02/setting-up-cakephp-with-fastcgi/</link>
		<comments>http://www.zenjiwebworks.com/2007/07/02/setting-up-cakephp-with-fastcgi/#comments</comments>
		<pubDate>Mon, 02 Jul 2007 10:36:44 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Gotchas]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.zenjiwebworks.com/2007/07/02/setting-up-cakephp-with-fastcgi/</guid>
		<description><![CDATA[I&#8217;ve been using CakePHP for quite a while now with no .htaccess issues at all, either running locally or on hosted sites. That all changed last night when I couldn&#8217;t get it to work at all on one of my budget hosting sites. Instead of my application all I saw were 500 Internal Server Errors.
I [...]]]></description>
			<content:encoded><![CDATA[<p><img title="Cake PHP Logo" src="http://www.cakephp.org/img/cake-logo.png" border="1" alt="Cake PHP Logo" hspace="5" vspace="5" width="180" height="180" align="right" />I&#8217;ve been using CakePHP for quite a while now with no .htaccess issues at all, either running locally or on hosted sites. That all changed last night when I couldn&#8217;t get it to work at all on one of my budget hosting sites. Instead of my application all I saw were 500 Internal Server Errors.</p>
<p>I found that the issue was definitely down to one line in the root .htaccess (which was unmodified from the original CakePHP download):</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">RewriteRule &nbsp; &nbsp;(.*) app/webroot/$1 [L]</div>
</li>
</ol>
</div>
<p>Unfortunately my cheaper hosting doesn&#8217;t allow me access to the error logs so it was difficult to diagnose the problem. By 11:00 last night I was certainly not in a good mood and no closer to an answer. I managed to Google plenty of references to similar issues but none solved my problem.</p>
<p>This morning I resorted to the hosting company themselves and within an hour they came up trumps! My thanks to Rob at VirtualNames support who not only worked it out, he even changed the file for me!</p>
<p>It looks like the problem is that the mod_rewrite rules don&#8217;t like fastcgi, which is the preferred option for this hosting account &#8211; it seems to try and redirect the internal URLs for fast cgi causing a rewriting loop. VirtualNames support felt it would probably work if the PHP mode is switched back to module mode, but they also came up with a fix to the .htaccess in the domain folder to (the root .htaccess for the CakePHP installation):</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&lt;IfModule mod_rewrite.c&gt;
</div>
</li>
<li class="li1">
<div class="de1">RewriteEngine on
</div>
</li>
<li class="li1">
<div class="de1">RewriteCond &nbsp; %{REQUEST_URI} &nbsp;!^/cgi-bin/
</div>
</li>
<li class="li1">
<div class="de1">RewriteRule &nbsp; &nbsp;^$ app/webroot/ &nbsp; &nbsp;[L]
</div>
</li>
<li class="li2">
<div class="de2">RewriteCond &nbsp; %{REQUEST_URI} &nbsp;!^/cgi-bin/
</div>
</li>
<li class="li1">
<div class="de1">RewriteRule &nbsp; &nbsp;(.*) app/webroot/$1 [L]
</div>
</li>
<li class="li1">
<div class="de1">&lt;/IfModule&gt;</div>
</li>
</ol>
</div>
<p>This stops it trying to redirect the fastcgi internal access urls, and appears to cure the problem. It looks like the other .htaccess files do not need changing. .htaccess and rewrite rules are still a bit of a black art to me. After this they are going on my list of things to pick up!</p>
<p>I can also recommend <a href="http://www.virtualnames.co.uk">VirtualNames</a> as a budget hosting solution should you need one. Their support people actually do&#8230;erm&#8230;&#8217;support&#8217; <img src='http://www.zenjiwebworks.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenjiwebworks.com/2007/07/02/setting-up-cakephp-with-fastcgi/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Setting up for web development on OS X</title>
		<link>http://www.zenjiwebworks.com/2007/06/16/setting-up-for-web-development-on-os-x/</link>
		<comments>http://www.zenjiwebworks.com/2007/06/16/setting-up-for-web-development-on-os-x/#comments</comments>
		<pubDate>Sat, 16 Jun 2007 15:12:44 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.zenjiwebworks.com/2007/06/16/setting-up-for-web-development-on-os-x/</guid>
		<description><![CDATA[I&#8217;ve been slowly working through all of the bits I usually use for web development on my MacBook, attempting to get it set up in a similar way to my PC. No particular reason for that, it&#8217;s just what works for me and means I can swap between machines whenever I like &#8211; PC for [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been slowly working through all of the bits I usually use for web development on my MacBook, attempting to get it set up in a similar way to my PC. No particular reason for that, it&#8217;s just what works for me and means I can swap between machines whenever I like &#8211; PC for the working week and Mac for out-of-hours seems to be my pattern&#8230;</p>
<p>On the whole it has gone fairly smoothly, though it hasn&#8217;t been entirely without problems. Here is the detail of what I have set up and where I came across issues. It might help someone if they come from a similar background to me of PC development.<br />
<span id="more-15"></span><br />
<strong>Apache 2</strong></p>
<p>Thanks to it already being set up on OS X this was no bother at all. System Preferences &gt; Sharing &gt; Services and set Personal Web Sharing to on. You should be able to browse to your home page straight away and it even gives you the URL of your home page at the bottom of the tab. It&#8217;s little touches like that that really make you think Apple love you!</p>
<p>Don&#8217;t think you won&#8217;t come across set up issues later though. It will need some tweaking to get it running properly with the other stuff coming up.</p>
<p><strong>PHP</strong></p>
<p>It doesn&#8217;t really matter what version as long as it&#8217;s 4.3 or later. Before that it was not quite so easy to install PHP on a Mac, but now it&#8217;s a doddle. Apple have a nice tutorial:</p>
<p><a href="http://developer.apple.com/internet/opensource/php.html">http://developer.apple.com/internet/opensource/php.html</a></p>
<p><strong>MySQL</strong></p>
<p>I thought this would be the most difficult area but, again, Apple have a nice tutorial:</p>
<p><a href="http://developer.apple.com/internet/opensource/osdb.html">http://developer.apple.com/internet/opensource/osdb.html</a></p>
<p>I also installed the MySQL GUI tools. To be honest I still think they&#8217;re a bit poor compared to other admin tools for other databases (or even for MySQL for that matter). For instance, MS SQL Server&#8217;s management console is far superior, in my opinion. Unless you&#8217;re really good with command-line SQL (and I&#8217;m not even though I&#8217;ve worked with databases for over 7 years!) then the tools will be necessary for setting up databases and database users. As I&#8217;m sure you know, it&#8217;s never a good idea to use root for applications. That reminds me, the first thing you should do is give root a password as it will be blank by default.</p>
<p><strong>CakePHP</strong></p>
<p>Not that you have to install <a href="http://bakery.cakephp.org/articles/view/installing-cakephp-on-macos-x">CakePHP</a>, it just happens to be something I&#8217;ve used on a couple of projects recently and contains some quite complex components. I figured that if I could get this up and running my environment would be ready. The installation is fairly straight-forward, but certainly not without problems. This was not necessarily down to CakePHP or any other component, just the set up between them.</p>
<p>The first thing you really should use with CakePHP is .htaccess which is turned off by default in Apache. However, what I didn&#8217;t know is that changing the setting for  AllowOverride from &#8216;None&#8217; to &#8216;All&#8217; in /etc/httpd/httpd.conf is not enough. There are also your local configuration settings in /etc/httpd/users/&lt;username&gt;.conf which require the same change.</p>
<p>That certainly made a difference as I immediately received 403 forbidden errors &#8211; &#8216;You don&#8217;t have permission to access /&#8217;. It turns out, after some trawling around, that the issue is with the FollowSymLinks option not being available. Check that &#8216;Options FollowSymLinks&#8217; is enabled in your personal .conf file. Mine now looks like this:</p>
<pre>&lt;Directory "/Users/Jason/Sites/"&gt;
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
&lt;/Directory&gt;</pre>
<p>I also had problems with Apache locating my files, probably because I was working directly from my /Users/ folder and Apache was set to use /Library/WebServer/ since I&#8217;d left it at the default. Rather than mess around with that I just created a link folder from the console. This seemed to sort the problem nicely.</p>
<pre>ln -s /Users/ /Library/WebServer/Users/</pre>
<p>Finally I had my web application running, .htaccess redirection was working nicely and the right files were being served up on request. But then it was failing to talk to the database, spewing out &#8216;Can&#8217;t connect to local MySQL server through socket &#8230;&#8217;. That took me a while to work out since most of the time Google searches just tell you that the MySQL db server hasn&#8217;t been started. I knew it had otherwise the client tools wouldn&#8217;t have been able to do much. It turns out that the database configuration file in my CakePHP application was incorrect. Not in an obvious way either. It just happens that you cannot refer to the local database as &#8216;localhost&#8217; which works fine on my Windows environment. If you get the problem try 127.0.0.1 instead.</p>
<p>database.php:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">class</span> DATABASE_CONFIG</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">var</span> <span class="re0">$default</span> = <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="st0">&#8216;driver&#8217;</span> =&gt; <span class="st0">&#8216;mysql&#8217;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&#8216;connect&#8217;</span> =&gt; <span class="st0">&#8216;mysql_connect&#8217;</span>,</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&#8216;host&#8217;</span> =&gt; <span class="st0">&#8216;127.0.0.1&#8242;</span>, &nbsp; &nbsp;<span class="coMULTI">/* NOT &#8216;localhost&#8217; */</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&#8216;login&#8217;</span> =&gt; <span class="st0">&#8216;login_name&#8217;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&#8216;password&#8217;</span> =&gt; <span class="st0">&#8216;login_password&#8217;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&#8216;database&#8217;</span> =&gt; <span class="st0">&#8216;database_name&#8217;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&#8216;prefix&#8217;</span> =&gt; <span class="st0">&#8216;md_&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>And that seems to be it at the moment. I haven&#8217;t done much actual work yet so I&#8217;m sure things will crop up as I go along. Hopefully I won&#8217;t forget these issues the next time though.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenjiwebworks.com/2007/06/16/setting-up-for-web-development-on-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
