<?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>edible code &#124; Ian Routledge</title>
	<atom:link href="http://ediblecode.com/blog/feed" rel="self" type="application/rss+xml" />
	<link>http://ediblecode.com/blog</link>
	<description>Ramblings of a london based freelance web developer and coder</description>
	<lastBuildDate>Tue, 09 Apr 2013 15:40:13 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Zebra striped tables in pure CSS for IE7 and IE8</title>
		<link>http://ediblecode.com/blog/css/zebra-striped-css-tables-ie7-ie8</link>
		<comments>http://ediblecode.com/blog/css/zebra-striped-css-tables-ie7-ie8#comments</comments>
		<pubDate>Tue, 24 Jul 2012 13:54:59 +0000</pubDate>
		<dc:creator>Ian Routledge</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://ediblecode.com/blog/?p=178</guid>
		<description><![CDATA[<p>Zebra striping, as it is called, is a common technique used to distinguish rows in an HTML table. The technique basically makes tables easier to read.</p> <p>It *should* be something that&#8217;s easy and straightforward to build, however, as always with CSS and HTML there are a number of different ways to achieve the same goal [...]]]></description>
				<content:encoded><![CDATA[<p>Zebra striping, as it is called, is a common technique used to distinguish rows in an HTML table. The technique basically makes tables easier to read.</p>
<p>It *should* be something that&#8217;s easy and straightforward to build, however, as always with CSS and HTML there are a number of different ways to achieve the same goal which have differing outcomes in different browsers.  Below are the most common techniques and then I&#8217;ve outlined a technique that works for IE7 and IE8 too. Here are the normal techniques:</p>
<ol>
<li>Add a class of &#8216;odd&#8217; to odd numbered tables rows on the server side when the table is generated/rendered. Makes the markup slightly less clean and involves extra work on the server.</li>
<li>Add an &#8216;odd&#8217; class to odd numbered rows with jQuery, something like: $(&#8220;tr:odd&#8221;).addClass(&#8220;odd&#8221;);. Requires javascript.</li>
<li>Use the CSS3 nth-child pesudo-selectors to style odd and even rows separately. Doesn&#8217;t work in old browsers.</li>
</ol>
<p>As you can see, none of these methods are perfect, so here&#8217;s another non-perfect technique. It makes use of both the CSS2 <a href="http://reference.sitepoint.com/css/adjacentsiblingselector" target="_blank">adjacent sibling combinator</a> and the CSS3 <a href="http://reference.sitepoint.com/css/generalsiblingselector" target="_blank">general sibling selector</a> (the ~). Fortunately, IE7 supports both selectors, even support is buggy. This solution does have 2 problems though, which are:</p>
<ol>
<li>It is really <a href="http://www.urbandictionary.com/define.php?term=fugly" target="_blank">fugly</a>.</li>
<li>It only works for tables up to a finite length (and requires you to extend the CSS for as long as you need it).</li>
</ol>
<p>Basically it looks like this:</p>
<pre class="brush: css; title: ; notranslate">
tr+tr
 , tr+tr+tr+tr
 , tr+tr+tr+tr+tr+tr
 , tr+tr+tr+tr+tr+tr+tr+tr { background: Red; }
 tr+tr~tr
 , tr+tr+tr+tr~tr
 , tr+tr+tr+tr+tr+tr~tr
 , tr+tr+tr+tr+tr+tr+tr+tr~tr { background: White; }
</pre>
<p>Which makes a lovely red and white striped table up to 9 rows high that works in IE7 and IE8 as well as modern browsers. You can easily extend the CSS to work with more rows, which does admittedly make your CSS look even uglier.</p>
<p>Also, you can easily adapt it to work for other elements, not just rows. For example an unordered list where you wanted to float odd items left and even items right.</p>
]]></content:encoded>
			<wfw:commentRss>http://ediblecode.com/blog/css/zebra-striped-css-tables-ie7-ie8/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing: The application relative virtual path &#8216;~/&#8217; is not allowed here.</title>
		<link>http://ediblecode.com/blog/dev/testing-the-application-relative-virtual-path-is-not-allowed-here</link>
		<comments>http://ediblecode.com/blog/dev/testing-the-application-relative-virtual-path-is-not-allowed-here#comments</comments>
		<pubDate>Wed, 28 Mar 2012 13:37:12 +0000</pubDate>
		<dc:creator>Ian Routledge</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://ediblecode.com/blog/?p=161</guid>
		<description><![CDATA[<p>If you&#8217;re running unit tests in an ASP.NET web app on code accessing settings from the web.config, then you might have some code like:</p> <p>That will work fine when you run the project, but your test will fail and give you the error &#8216;The application relative virtual path &#8216;~/&#8217; is not allowed here.&#8217;. Fortunately, there [...]]]></description>
				<content:encoded><![CDATA[<p>If you&#8217;re running unit tests in an ASP.NET web app on code accessing settings from the web.config, then you might have some code like:</p>
<pre class="brush: csharp; title: ; notranslate">
System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration(&quot;~/&quot;);
HttpRuntimeSection section = config.GetSection(&quot;system.web/httpRuntime&quot;) as HttpRuntimeSection;
</pre>
<p>That will work fine when you run the project, but your test will fail and give you the error &#8216;The application relative virtual path &#8216;~/&#8217; is not allowed here.&#8217;. Fortunately, there is the HttpRuntime.AppDomainAppVirtualPath property you can use for the path, which works in tests as well as when running. (In tests this value is null.) So you code would then look like:</p>
<pre class="brush: csharp; title: ; notranslate">
System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration(HttpRuntime.AppDomainAppVirtualPath);
 HttpRuntimeSection section = config.GetSection(&quot;system.web/httpRuntime&quot;) as HttpRuntimeSection;
</pre>
<p>And your test will work.</p>
]]></content:encoded>
			<wfw:commentRss>http://ediblecode.com/blog/dev/testing-the-application-relative-virtual-path-is-not-allowed-here/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Display your latest foursquare checkin in .NET</title>
		<link>http://ediblecode.com/blog/dot-net/asp-net/display-your-latest-foursquare-checkin-in-net</link>
		<comments>http://ediblecode.com/blog/dot-net/asp-net/display-your-latest-foursquare-checkin-in-net#comments</comments>
		<pubDate>Fri, 10 Feb 2012 17:09:18 +0000</pubDate>
		<dc:creator>Ian Routledge</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[foursquare api]]></category>

		<guid isPermaLink="false">http://ediblecode.com/blog/?p=112</guid>
		<description><![CDATA[<p>This is something I wanted to do for the new version of my portfolio (coming soon). It will essentially be a  one page portfolio built of modules, some being projects, others being social feeds, e.g. latest tweet, Flickr photos and my last foursquare checkin.</p> <p>Twitter is straight-forward, and can be done right from JavaScript without [...]]]></description>
				<content:encoded><![CDATA[<p>This is something I wanted to do for the new version of my portfolio (coming soon). It will essentially be a  one page portfolio built of modules, some being projects, others being social feeds, e.g. latest tweet, Flickr photos and my last foursquare checkin.</p>
<p>Twitter is straight-forward, and can be done right from JavaScript without the need for an API key, for example:</p>
<pre class="brush: jscript; title: ; notranslate">
$.getJSON('https://api.twitter.com/1/statuses/user_timeline.json?exclude_replies=true&amp;trim_user=true&amp;screen_name=ediblecode&amp;count=1&amp;callback=?', function (data, textStatus, jqXHR) {
// Loop through data
});
</pre>
<p>Flickr and foursquare no the other hand need to have an API key to be able to access your photostream and checkins. Here&#8217;s how to do it for foursquare.</p>
<p>First of all, you need to have an API key, or an OAuth consumer as foursquare calls it. Go to <a href="https://foursquare.com/oauth/register">https://foursquare.com/oauth/register</a> and fill in the details. Application name can pretty much be whatever you want, and callback url can be any URL on your site (e.g fs.aspx), you won&#8217;t actually need it for what we&#8217;re going to do &#8211; it doesn&#8217;t need to actually exist.</p>
<p>When you&#8217;ve created your consumer you&#8217;ll get a generated a client id and a client secret. Follow the instructions at <a href="https://developer.foursquare.com/overview/auth">https://developer.foursquare.com/overview/auth</a> to obtain an access token. The access token (or oauth token) is then used to access data from the fourquare API. Here&#8217;s a quick summary of how to get the acces token:</p>
<ol>
<li>Visit https://foursquare.com/oauth2/authenticate?client_id=YOUR_CLIENT_ID&amp;response_type=code&amp;redirect_uri=YOUR_REGISTERED_REDIRECT_URI in your browser.</li>
<li>This will redirect you to YOUR_REGISTERED_REDIRECT_URI?code=YOU_CODE e.g. http://ediblecode.com/fs.aspx?code=XYZ. This will probably give a 404 because we just used anything when we wet up the consumer.</li>
<li>The code querystring value is the bit you want, copy this and then construct a new URL in the format. https://foursquare.com/oauth2/access_token?client_id=YOUR_CLIENT_ID&amp;client_secret=YOUR_SECRET&amp;grant_type=authorization_code&amp;redirect_uri=YOUR_REGISTERED_REDIRECT_URI&amp;code=YOUR_CODE</li>
<li>The response from this URL should then be a bit of JSON that looks like {&#8220;access_token&#8221;:&#8221;YOUR_ACCESS_TOKEN&#8221;}. This access token is the key bit that you then need for accessing the foursquare API.</li>
</ol>
<p>Once you&#8217;ve got your access token (or oauth token) then you can pass it to foursquare for getting details of your profile including checkins, for example https://api.foursquare.com/v2/users/self.json?oauth_token=YOUR_ACCESS_TOKEN. You can do this directly from jquery as the foursquare API supports JSONP, so you make a call to getJSON with a URL of https://api.foursquare.com/v2/users/self.json?oauth_token=YOUR_ACCESS_TOKEN&amp;v=YYYYMMDD&amp;callback=? and jquery will do its usual thing of appending a random callback function to allow cross domain JSON calls to work. However, what this does is expose your access token to anyone who views the source of your web site, and it would be a good idea to hide it.</p>
<p>So, to solve this, create a generic handler in your web site called foursquare.ashx, this will make a call to foursquare and return the JSON back to your web app. This has 2 benefits, you access token isn&#8217;t exposed to anyone and there is no need for cross domain JSONP &#8211; the jquery getJSON call can be direct to the foursquare.ashx handler you just created. The contents of foursquare.ashx would look something like:</p>
<pre class="brush: csharp; title: ; notranslate">
public void ProcessRequest(HttpContext context)
{
 context.Response.Cache.SetCacheability(HttpCacheability.ServerAndPrivate); context.Response.Cache.SetExpires(DateTime.Now.AddDays(1));
 context.Response.ContentType = &quot;application/json&quot;;
 context.Response.ContentEncoding = System.Text.Encoding.UTF8
 WebClient client = new WebClient();
 string json = &quot;{\&quot;error\&quot;:true}&quot;;
 try
 {
 json = client.DownloadString(&quot;https://api.foursquare.com/v2/users/self.json?oauth_token=YOUR_ACCESS_TOKEN&amp;v=20120129&quot;);
 }
 catch
 { }
 context.Response.Write(json);
 context.Response.End();
}
</pre>
<p>Notice the use of the v querystring parameter. This is used for versioning and tells the foursquare API that &#8216;the client is up to date to the specified date&#8217;. This is in the format YYYYMMDD, e.g. 20120210 for Feb 10th, 2012. More information can be found at <a href="https://developer.foursquare.com/overview/versioning">https://developer.foursquare.com/overview/versioning</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ediblecode.com/blog/dot-net/asp-net/display-your-latest-foursquare-checkin-in-net/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing &#8216;An error occurred. Please try again later.&#8217; with Facebook apps in IE</title>
		<link>http://ediblecode.com/blog/dev/facebook/fixing-an-error-occurred-please-try-again-later-with-facebook-apps-in-ie</link>
		<comments>http://ediblecode.com/blog/dev/facebook/fixing-an-error-occurred-please-try-again-later-with-facebook-apps-in-ie#comments</comments>
		<pubDate>Thu, 09 Feb 2012 12:41:02 +0000</pubDate>
		<dc:creator>Ian Routledge</dc:creator>
				<category><![CDATA[Facebook]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[ie]]></category>

		<guid isPermaLink="false">http://ediblecode.com/blog/?p=101</guid>
		<description><![CDATA[<p>I&#8217;ve been making quite a few simple apps and page tabs on Facebook recently. There&#8217;s loads of documentation available at <a href="https://developers.facebook.com/docs/guides/canvas/">https://developers.facebook.com/docs/guides/canvas/</a> and at a simple level, its relatively easy to create a simple app, if you&#8217;ve got knowledge of HTML, JavaScript and CSS. Especially so, since Facebook deprecated FBML last year so apps have to be [...]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve been making quite a few simple apps and page tabs on Facebook recently. There&#8217;s loads of documentation available at <a href="https://developers.facebook.com/docs/guides/canvas/">https://developers.facebook.com/docs/guides/canvas/</a> and at a simple level, its relatively easy to create a simple app, if you&#8217;ve got knowledge of HTML, JavaScript and CSS. Especially so, since Facebook deprecated FBML last year so apps have to be made with iFrames. In fact as of <a href="https://developers.facebook.com/docs/reference/fbml/" target="_blank">June 2012</a> Facebook will start removing FBML support all together.</p>
<p>I generally quite like the Facebook platform and the power it gives you for integration, however, there are quite a few intricacies that you really don&#8217;t find out about until you&#8217;ve built some stuff. In fact, I think this is where the documentation falls down &#8211; the basic examples are quite good, but as soon as you do anything more complicated you run into cross browser issues and more that are difficult to identify, solve and/or find in the docs. If you can find them at all.</p>
<p>This error is one of them.</p>
<p>I had a competition app on Facebook, so that when you click the form submit button it asks you for permission &#8211; the standard &#8216;Request for Permission&#8217; popup window, that is so we can keep track of users who have entered etc. This all worked fine in Chrome, Firefox but didn&#8217;t in, yes you guessed it, Internet Explorer. This is the error I was seeing, &#8216;an error occurred. Please try again later&#8217;:</p>
<p><a href="http://ediblecode.com/blog/wp-content/uploads/2012/02/an-error-has-occurred.jpg"><img class="alignnone size-full wp-image-102" title="An error has occurred: Facebook" src="http://ediblecode.com/blog/wp-content/uploads/2012/02/an-error-has-occurred.jpg" alt="" width="388" height="236" /></a></p>
<p>Pretty generic right? And not very useful. I spent a while searching, and came across a few suggestions, none of which worked. For example, <a href="http://stackoverflow.com/questions/6365531/facebook-apprequests-dialog-error-an-error-occurred-please-try-again-later">http://stackoverflow.com/questions/6365531/facebook-apprequests-dialog-error-an-error-occurred-please-try-again-later</a> didn&#8217;t shed any light, no wonder the answer has been marked down, &#8216;all parts have to be exactly as facebook wants it, or it will not work.&#8217;.</p>
<p>So I tried all sorts of things from the various suggestions around the interwebs. Some of them seemed pointless (and I&#8217;m pretty sure will have no effect), but I had to try something. You&#8217;re reading this, so here are some things to try</p>
<ul>
<li>Use XHTML instead of HTML5.</li>
<li>Check xmlns:fb=&#8221;http://www.facebook.com/2008/fbml&#8221; is an attribute on the html tag.</li>
<li>Validate your HTML.</li>
<li>Calling FB.init() inside the window.fbAsyncInit function.</li>
<li>Try using xfbml: false as part of FB.init();</li>
<li>Try manually calling FB.XFBML.parse();</li>
<li>Try loading the SDK synchronously</li>
</ul>
<p>None of these worked, and it came down to the channeUrl parameter passed to FB.init. Facebook says in the docs &#8216;Specifies the URL of a custom URL channel file. This file must contain a single script element pointing to the JavaScript SDK URL.&#8217; (see <a href="https://developers.facebook.com/docs/reference/javascript/FB.init/">https://developers.facebook.com/docs/reference/javascript/FB.init/</a>). The are however, some more details on the blog at <a href="https://developers.facebook.com/blog/post/530/">https://developers.facebook.com/blog/post/530/</a>.</p>
<p>It does explain a few key things though:</p>
<ul>
<li>The contents of the channel.html file must be refer to the connect.facebook.net/en_US/all.js file with the same protocol as the containing page, so the easiest way is to use the double slash at the start rather than using http or https explicitly.</li>
<li>The channel.html must be hosted on the same (sub)domain as the canvas url. E.g. don&#8217;t mix up yourdomain.com and www.yourdomain.com.</li>
<li>The protocol of the channel url reference must match the protocol of the containing page. E.g. channelUrl: &#8216;http://www.yourdomain.com/channel.html&#8217; won&#8217;t work over https. Using the double slash technique here won&#8217;t work either. So, using ASP.NET MVC3 and the Razor view engine, my channel url looked like: channelUrl: &#8216;@(Request.Url.Scheme )://yourdomain.com/sevendials/channel.html&#8217;.</li>
<li>The channel.html file must be within the canvas url of your apps. By this I mean if your canvas url points to a sub folder on your domain, then the channel.html must reside somewhere under that sub-folder, and not in the root.</li>
</ul>
<p>These last 2 points were the key ones for me, and fixing them got it to work with and without SSL in all browsers including Internet Explorer.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://ediblecode.com/blog/dev/facebook/fixing-an-error-occurred-please-try-again-later-with-facebook-apps-in-ie/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>stage.stageHeight is 100px too small in Flash CS3</title>
		<link>http://ediblecode.com/blog/flash/stage-stageheight-is-100px-too-small-in-flash-cs3</link>
		<comments>http://ediblecode.com/blog/flash/stage-stageheight-is-100px-too-small-in-flash-cs3#comments</comments>
		<pubDate>Mon, 14 Feb 2011 09:39:04 +0000</pubDate>
		<dc:creator>Ian Routledge</dc:creator>
				<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://ediblecode.com/blog/?p=81</guid>
		<description><![CDATA[Annoying little bug this one. When you use stage.stageHeight in Flash CS3, the value returned is 100px too small. It turns out that this problem only occurs if you're using the bandwidth profiler - so just turn it off!]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve recently been making a flash game with one of our clients. It&#8217;s a (pretty awesome if I may say so myself) side-scrolling flash game. Anyway, you can play it on Windows Live Messenger &#8211; just look for &#8216;Trolley Challenge&#8217; in the game section and you should find it.</p>
<p>I was doing the fairly standard thing of positioning items relative to the stage, rather than hardcoding them. I mean, if I want a character at a certain position it would be positioned at stage.stageHeight &#8211; 200 for example. The idea, being that if you need to resize the game to use on a different platform then it&#8217;s straightforward &#8211; just increase the stage size and everything repositions and redraws.</p>
<p>That all works find, until you get in to Flash CS3 and publish the SWF. And what happens?! Well, everything is 100px higher than you&#8217;d expect. It turns out that it&#8217;s a bug in CS3 where this value is too small if you&#8217;re using the bandwidth profiler. There&#8217;s an easy fix though &#8211; simply press CTRL + B to get rid of it and stage.stageHeight goes back to being what you&#8217;d expect.</p>
]]></content:encoded>
			<wfw:commentRss>http://ediblecode.com/blog/flash/stage-stageheight-is-100px-too-small-in-flash-cs3/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Problems Automatically Upgrading WordPress on IIS?</title>
		<link>http://ediblecode.com/blog/uncategorized/problems-automatically-upgrading-wordpress-on-iis</link>
		<comments>http://ediblecode.com/blog/uncategorized/problems-automatically-upgrading-wordpress-on-iis#comments</comments>
		<pubDate>Fri, 14 Jan 2011 13:57:27 +0000</pubDate>
		<dc:creator>Ian Routledge</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ediblecode.com/blog/?p=78</guid>
		<description><![CDATA[I just upgraded WordPress to 3.0.4 but had a problem automatically upgrading. Here's the quick and easy solution.]]></description>
				<content:encoded><![CDATA[<p><a title="WordPress 3.0.4" href="http://codex.wordpress.org/Version_3.0.4" target="_blank">WordPress version 3.0.4</a> was released at the end of December. It contains an important security fix (XSS vulnerabilities in the KSES library whatever that means). Basically, that means you really should upgrade if you haven&#8217;t already. If you&#8217;re running WordPress 2.7+ you can do it automatically, which I tried but this is where I cam across the following problem. The update ran but gave me the following error:</p>
<p>Downloading update from http://wordpress.org/wordpress-3.0.4.zip&#8230;</p>
<p>Unpacking the update&#8230;</p>
<p>Could not copy the files.</p>
<p>Installation Failed.</p>
<p>Now that looks like a permissions error straight away, so i had a quick read of the WP docs at <a title="Updating WordPress" href="http://codex.wordpress.org/Updating_WordPress" target="_blank">http://codex.wordpress.org/Updating_WordPress</a>. Unfortunately, the docs only talk about PHP, and mine runs on IIS on a Windows box. However, there is one line in bold, &#8216;your files all need to be owned by the user under which your Apache server executes&#8217; which says that the server needs permission to be able to overwrite the files. The same of course applies on a Windows server so it&#8217;s just a case of applying those permissions.</p>
<p>You need access to the server to do this, so if you&#8217;re on a managed hosting environment, you may need to contact support to it for you, or just go down the manual route. Here are the steps to fix it:</p>
<ol>
<li>Find the folder than contains the WP files.</li>
<li>Right-click and go to the security tab.</li>
<li>Click &#8216;add&#8217; under the group or user names section, as we need to give a new user permissions to this folder</li>
<li>Click &#8216;advanced&#8217; under the names text area, so we can find the correct user.</li>
<li>Click find now on the right, which populate the search results below.</li>
<li>Double click on the internet guest account (IUSR_MACHINENAME) to select it.</li>
<li>Now click OK. This will add it to the list of users for that folder.</li>
<li>Finally, tick &#8216;modify&#8217; in the &#8216;allow&#8217; column when IUSR_MACHINENAME is selected</li>
</ol>
<p>And there you go, WP should now be able to install the update automatically.</p>
]]></content:encoded>
			<wfw:commentRss>http://ediblecode.com/blog/uncategorized/problems-automatically-upgrading-wordpress-on-iis/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A First Stab at Some Generative Art</title>
		<link>http://ediblecode.com/blog/flash/actionscript-3/a-first-stab-at-some-generative-art</link>
		<comments>http://ediblecode.com/blog/flash/actionscript-3/a-first-stab-at-some-generative-art#comments</comments>
		<pubDate>Thu, 06 Jan 2011 21:19:11 +0000</pubDate>
		<dc:creator>Ian Routledge</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>

		<guid isPermaLink="false">http://ediblecode.com/blog/?p=74</guid>
		<description><![CDATA[Grant Skinner is a big proponent of what he calls 'passionate procrastination'. Here's a quick look at some of my attempts at generative spiral art.]]></description>
				<content:encoded><![CDATA[<p>You may well have heard of a certain <a title="Grant Skinner" href="http://gskinner.com/blog" target="_blank">Grant Skinner</a>, the Flash guru. I saw him speak at FOTB back in September last year, and one of the things he talked about was what he calls &#8216;passionate procrastination&#8217;. Basically, by that he means spending some time that you&#8217;d usually just waste on building something interesting. He goes for the technique of spending 20 minutes a day on passionate procrastination butn reality it&#8217;s never that easy. If you can fit it in, you&#8217;ll be pleasantly surprised by what you can come up with.</p>
<p>I spent some free time a little while ago looking at &#8216;generative art&#8217;. I&#8217;m no artist but code really can produce some beautiful things &#8211; just look at look at work of the likes of <a title="Joshua Davis" href="http://www.joshuadavis.com/" target="_blank">Joshua Davis</a> and <a title="Erik Natzke" href="http://www.joshuadavis.com/" target="_blank">Erik Natzke</a>. My attempts were merely a scratch on the surface of what you could achieve and didn&#8217;t do anything new, but I learned a lot and I enjoyed it. Here&#8217;s a few notes from my experience:</p>
<ul>
<li>Have a goal, don&#8217;t just code. My goal was two-fold: to produce some nice looking spiral generative art with I could make a print and to adapt it to generate in response to sound and music as a data visulatisation.</li>
<li>Be influenced and inspired. There are some great people out there who&#8217;ve done some really, really cool stuff so have a look around and be inspired.</li>
<li>Enjoy it. It&#8217;s called <em>passionate</em> procrastination for a reason, there&#8217;s no point doing it if it&#8217;s a chore.</li>
<li>Learn from it. Try something new, get out of your comfort zone! Use it as an excuse to learn object-orientated Actionscript if you don&#8217;t already; learn HTML 5 and canvas, try processing &#8211; there are so many new technologies and things to try.</li>
<li>Use SVN. Sounds simple but it&#8217;s a great way of storing progress as you develop your ideas and adapt your code.</li>
<li>Show them and be proud. Put them up on Flickr, Deviant Art, your portfolio and tweet them. The more feedback you get, the better and visibility is always good.</li>
</ul>
<p>I&#8217;ve created a <a title="Generative Art on Flickr" href="http://www.flickr.com/photos/iandroutledge/sets/72157625763648460/" target="_blank">set on Flickr</a> of some of my favourites. Let me know what you think. I haven&#8217;t got to putting it to music yet, but fingers crossed I&#8217;ll get to that one day.</p>
<p>Lastly, here is some absolutely awesome inspiration from <a title="Robert Hodgin" href="http://www.flight404.com/blog/" target="_blank">Robert Hodgin</a> (Flight 404):</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/TwQ_BwRTDFs?fs=1&amp;hl=en_GB" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="480" height="385" src="http://www.youtube.com/v/TwQ_BwRTDFs?fs=1&amp;hl=en_GB" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://ediblecode.com/blog/flash/actionscript-3/a-first-stab-at-some-generative-art/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How not to do in-app mobile advertising</title>
		<link>http://ediblecode.com/blog/advertising/how-not-to-do-in-app-mobile-advertising</link>
		<comments>http://ediblecode.com/blog/advertising/how-not-to-do-in-app-mobile-advertising#comments</comments>
		<pubDate>Mon, 20 Dec 2010 22:30:06 +0000</pubDate>
		<dc:creator>Ian Routledge</dc:creator>
				<category><![CDATA[Advertising]]></category>

		<guid isPermaLink="false">http://ediblecode.com/blog/?p=71</guid>
		<description><![CDATA[Advertising has changed massively over the last few years, especially within mobile with faster connections and the rising number of smartphones, but that's not all good news as there's still a lot to learn about mobile advertising in such a young industry]]></description>
				<content:encoded><![CDATA[<p>Advertising has been around for years, in fact Wikipedia reckons the Egyptians used papyrus for making advertising so that&#8217;s certainly a bloody long time. We&#8217;ve learned a lot over the years, not only about how to do it but also how to fail &#8211; just search for &#8216;advertising failures&#8217; on Google and you&#8217;ll find some pretty hilarious stuff. We&#8217;ve seen it change dramatically, especially over the last century, what with different styles and media: print, radio and TV and in the last 15 years or so this thing called the interwebs.</p>
<p>The last few years has seen the mobile industry grow massively: gone are the days of WAP with pure text pages and slow loading. The iPhone and 3G networks have had a large part to play in this and will no doubt continue to do so. But it&#8217;s  the likes of Android and other platforms that are driving prices down and giving consumers choice, making high speed internet on smartphones available to every man and his dog (can dogs use touch screens?). And to go with this, every platform now has its own app store, surely tempted in (for better or worse) by the 300k+ apps 7 billion+ downloads in the Apple app store.</p>
<p>This is great news for developers, being able to make millions from creating an app in your bedroom sounds like a dream come true. I&#8217;m a developer and I own a smartphone and I&#8217;ve been pretty tempted by apps, as there a couple of choices for monetization: free and ad/sponsor supported or paid. Both work quite nicely depending on the type of app, but the ad-supported model is interesting as consumers are willing to download a free app to try it without much thought. A combination of these 2 business plans is being fairly widely used, and if the free app with advertising and then a paid app with more features.</p>
<p>Waffle over: what bugs me about all this is that all the advertising I&#8217;ve seen in-app has been truly terrible. It&#8217;s like we&#8217;ve gone back in time 10 years and people are just discovering flash banner ads for the first time. Not one has even nearly made me want to click on it &#8211; the creative and messaging have both been rubbish. Is it too much to ask for someone to spend more than a few minutes on a decent, clever bit of creative for these ads? I&#8217;m talking mainly about the static pre-game ads as there&#8217;s more screen real-estate to play with rather than the little ads.</p>
<p>I&#8217;ve seen one full on video ad as a pre-roll before a game in Solitaire on the iPhone and this has 2 massive problems: first it froze my game for 20 seconds whilst it downloaded and it played on full volume whilst I was having a nice quiet game on the tube, making me look and feel like a right idiot. All this for Olay! I appreciate they can&#8217;t target ads so I&#8217;m willing to sit through or skip an ad about moisturiser, but the autoplay gave me such a strong negative feeling towards the advertiser (Transpera in this case) and the brand, totally defying the point of advertising in the first place. That and also I&#8217;m quick to skip the ads now before they even start that it&#8217;s a waste of the brand&#8217;s money and surely results in a tiny click-through-rate.</p>
<p>So there we go, that&#8217;s how to not do in-app advertising. Get some decent creative and don&#8217;t be intrusive.</p>
]]></content:encoded>
			<wfw:commentRss>http://ediblecode.com/blog/advertising/how-not-to-do-in-app-mobile-advertising/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Portfolio!</title>
		<link>http://ediblecode.com/blog/portfolio/new-portfolio</link>
		<comments>http://ediblecode.com/blog/portfolio/new-portfolio#comments</comments>
		<pubDate>Tue, 30 Nov 2010 21:57:35 +0000</pubDate>
		<dc:creator>Ian Routledge</dc:creator>
				<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://ediblecode.com/blog/?p=67</guid>
		<description><![CDATA[<p>Welcome to my new portfolio and blog (kind of). It has been a really, really long time coming. I &#8216;designed&#8217; it myself, and I&#8217;ll certainly be the first to admit that I&#8217;m no designer but I think it does the job. It&#8217;s coded in HTML5 and is all standards compliant &#8211; fingers crossed. Finally, the [...]]]></description>
				<content:encoded><![CDATA[<p>Welcome to my new portfolio and blog (kind of). It has been a really, really long time coming. I &#8216;designed&#8217; it myself, and I&#8217;ll certainly be the first to admit that I&#8217;m no designer but I think it does the job. It&#8217;s coded in HTML5 and is all standards compliant &#8211; fingers crossed. Finally, the blog part is powered by WordPress instead of BlogEngine.NET. I find WordPress a lot more powerful and easy to customise and that combined with the fact that it&#8217;s been on my list of things to learn for a while maide it a no brainer.</p>
<p>So, here it is. It&#8217;s not finished and probably never will be, so bare with me&#8230;but then again, which designer is 100% happy with their portfolio?</p>
]]></content:encoded>
			<wfw:commentRss>http://ediblecode.com/blog/portfolio/new-portfolio/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing &#8216;multiple types were found that match the controller named&#8217;</title>
		<link>http://ediblecode.com/blog/dot-net/asp-net-mvc/fixing-multiple-types-were-found-that-match-the-controller-named</link>
		<comments>http://ediblecode.com/blog/dot-net/asp-net-mvc/fixing-multiple-types-were-found-that-match-the-controller-named#comments</comments>
		<pubDate>Tue, 12 Oct 2010 09:58:00 +0000</pubDate>
		<dc:creator>Ian Routledge</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>

		<guid isPermaLink="false">/post/fixing-multiple-types-were-found-that-match-the-controller-named.aspx</guid>
		<description><![CDATA[<p> ASP.NET MVC introduced the concept of &#8216;areas&#8217; within a web app.<br /> They&#8217;re a great way to split a large app into different sections that handle different logic, for example you might have an admin area that has some authorization and handles all of the back end content management for the app. You can [...]]]></description>
				<content:encoded><![CDATA[<p>
ASP.NET MVC introduced the concept of &#8216;areas&#8217; within a web app.<br />
They&#8217;re a great way to split a large app into different sections that handle different logic, for example you might have an admin area that has some authorization and handles all of the back end content management for the app. You can think of them almost as &#8216;sub-projects&#8217;, as they have their own controllers and views.
</p>
<p>
It isn&#8217;t unlikely that you might have the default controller called Home in the root, and also another controller called Home in a separate area.<br />
However, because of the fact that MVC works as pre-compiled web application (rather than a web site), all the controllers get compiled into the assembly and you get the following error:
</p>
<p>
Multiple types were found that match the controller named &#8216;Home&#8217;. This can happen if the route that services this request (&#8216;{controller}/{action}/{id}&#8217;) does not specify namespaces to search for a controller that matches the request. If this is the case, register this route by calling an overload of the &#8216;MapRoute&#8217; method that takes a &#8216;namespaces&#8217; parameter.<br />
<br/><br />
<br/><br />
The request for &#8216;Home&#8217; has found the following matching controllers:<br />
EdibleCode.Web.Controllers.HomeController<br />
EdibleCode.Web.Areas.Admin.Controllers.HomeController
</p>
<p>
So, despite the fact that the controllers are in different namespaces, the app doesn&#8217;t know which one to use. Fortunately, there is an easy fix to tell MVC which namespace to use as the default. Open the global.asax.cs file from the root, and find the Application_Start method. It should have two lines in at the moment (AreaRegistration.RegisterAllAreas(); and RegisterRoutes(RouteTable.Routes);). Simply add the following line after these, replacing the namespace in quotes with the namespace of your controllers:
</p>
<p><code><br />
ControllerBuilder.Current.DefaultNamespaces.Add("EdibleCode.Controllers");<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://ediblecode.com/blog/dot-net/asp-net-mvc/fixing-multiple-types-were-found-that-match-the-controller-named/feed</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>
