<?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>Richard Hart / Hates_ &#187; programming</title>
	<atom:link href="http://www.ur-ban.com/blog/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ur-ban.com/blog</link>
	<description>Programming &#38; Life - ur-ban.com</description>
	<lastBuildDate>Sat, 28 Jan 2012 21:33:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>The &#8220;Bob bug&#8221; Syndrome</title>
		<link>http://www.ur-ban.com/blog/2012/01/12/the-bob-bug-syndrome/</link>
		<comments>http://www.ur-ban.com/blog/2012/01/12/the-bob-bug-syndrome/#comments</comments>
		<pubDate>Thu, 12 Jan 2012 08:44:18 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[bugs]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=2292</guid>
		<description><![CDATA[Some bosses make the mistake of thinking that if the result of someone&#8217;s work is easy to use, the work itself must be easy. A guy goes in to consult for a company and runs across a bug. He raises the issue and the boss says &#8220;Oh boy &#8211; another &#8216;Bob bug&#8217; &#8211; Bob created [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p><a href="http://scripting.com/stories/2012/01/09/theBossesDoEverythingBette.html">Some bosses make the mistake of thinking that if the result of someone&#8217;s work is easy to use, the work itself must be easy.</a></p></blockquote>
<p>A guy goes in to consult for a company and runs across a bug. He raises the issue and the boss says &#8220;Oh boy &#8211; another &#8216;Bob bug&#8217; &#8211; Bob created a lot of bugs.&#8221; (Bob has moved on by now). After the guy was there for a while he comes to realise that Bob wrote most of the code while the rest of the staff wrote very little. The perception that Bob created a lot of bugs was technically correct, but an analysis of bugs per line of code written show that Bob actually made fewer mistakes than his co-workers, but since he generated the majority of the app, he had the majority of the bugs.</p>
<p><a href="http://www.reddit.com/r/business/comments/oce21/some_bosses_make_the_mistake_of_thinking_that_if/c3g5zuo">Source: Reddit</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2012/01/12/the-bob-bug-syndrome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PDFKit not displaying £ (pound) signs properly</title>
		<link>http://www.ur-ban.com/blog/2011/12/04/pdfkitwkhtmltopdf-not-displaying-pound-signs-properly/</link>
		<comments>http://www.ur-ban.com/blog/2011/12/04/pdfkitwkhtmltopdf-not-displaying-pound-signs-properly/#comments</comments>
		<pubDate>Sun, 04 Dec 2011 13:24:29 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[pdfkit]]></category>
		<category><![CDATA[uft8]]></category>
		<category><![CDATA[wkhtmltopdf]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=2245</guid>
		<description><![CDATA[I&#8217;m generating PDFs with PDFkit/wkhtmltopdf on a current project. While the output is fine in the browser, £ (pound) signs in the generated PDF were showing up incorrectly as: &#160; Â£ The fix was relatively easy as PDFs have their own view layout, so all I had to do was add an extra meta tag [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m generating PDFs with PDFkit/wkhtmltopdf on a current project. While the output is fine in the browser, £ (pound) signs in the generated PDF were showing up incorrectly as:</p>
<pre>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; Â£</div></div>
</pre>
<p>The fix was relatively easy as PDFs have their own view layout, so all I had to do was add an extra meta tag to the head:</p>
<pre>
<div class="codecolorer-container html4strict vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">http-equiv</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;content-type&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/html; charset=utf-8&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></div></div>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2011/12/04/pdfkitwkhtmltopdf-not-displaying-pound-signs-properly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Devise Omniauth Dynamic Providers</title>
		<link>http://www.ur-ban.com/blog/2011/04/30/devise-omniauth-dynamic-providers/</link>
		<comments>http://www.ur-ban.com/blog/2011/04/30/devise-omniauth-dynamic-providers/#comments</comments>
		<pubDate>Sat, 30 Apr 2011 13:57:54 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=2097</guid>
		<description><![CDATA[My current project www.viewshound.com requires different users to have different scopes for their Facebook authentication. Warden supports dynamic providers out of the box. To get it working with Devise was pretty easy, just a couple of minor changes were needed especially to support Facebook. First up was creating the new route. As I&#8217;m using a [...]]]></description>
			<content:encoded><![CDATA[<p>My current project <a href="http://www.viewshound.com">www.viewshound.com</a> requires different users to have different scopes for their Facebook authentication. Warden supports <a href="https://github.com/intridea/omniauth/wiki/Dynamic-Providers">dynamic providers</a> out of the box. To get it working with Devise was pretty easy, just a couple of minor changes were needed especially to support Facebook.</p>
<p>First up was creating the new route. As I&#8217;m using a controller called Omniauth and not Session, the <strong>:to</strong> attribute is different. The other thing to note is I&#8217;m matching <strong>/users/auth/facebook/setup</strong>, not <strong>/auth/facebook/setup</strong> like in the Warden documentation.</p>
<p>routes.rb</p>
<pre>
<div class="codecolorer-container ruby vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; devise_for <span style="color:#ff3333; font-weight:bold;">:users</span>, <br />
&nbsp; &nbsp; &nbsp; <span style="color:#ff3333; font-weight:bold;">:controllers</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:omniauth_callbacks</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;omniauth&quot;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>, <br />
&nbsp; &nbsp; &nbsp; <span style="color:#ff3333; font-weight:bold;">:skip</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:sessions</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; &nbsp; match <span style="color:#996600;">'/users/auth/facebook/setup'</span>, <span style="color:#ff3333; font-weight:bold;">:to</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'omniauth#setup'</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div></div>
</pre>
<p>Next we create the new setup action for Warden to call. The docs use <strong>consumer_key</strong> and <strong>consumer_secret</strong>, but facebook expects <strong>client_id</strong> and <strong>client_secret</strong>, so be sure to use those instead. This is where I make changes to the scope based on the current user if they are signed in or not. So a user can re-authenticate with Facebook to get more permissions for their account if they wish.</p>
<p>omniauth_controller.rb</p>
<pre>
<div class="codecolorer-container ruby vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; <span style="color:#9966CC; font-weight:bold;">class</span> OmniauthController <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">Devise::OmniauthCallbacksController</span><br />
<br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> setup<br />
&nbsp; &nbsp; &nbsp; request.<span style="color:#9900CC;">env</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'omniauth.strategy'</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">client_id</span> = <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#006600; font-weight:bold;">&#123;</span>your_facebook_id_here<span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; request.<span style="color:#9900CC;">env</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'omniauth.strategy'</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">client_secret</span> = <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#006600; font-weight:bold;">&#123;</span>your_facebook_secret_here<span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; request.<span style="color:#9900CC;">env</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'omniauth.strategy'</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">options</span> = <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#006600; font-weight:bold;">&#123;</span>:scope <span style="color:#006600; font-weight:bold;">=&gt;</span> your_facebook_scope_here<span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; render <span style="color:#ff3333; font-weight:bold;">:text</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;Setup complete.&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:status</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">404</span><br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div></div>
</pre>
<p>Finally change the devise.rb initializer to support the new setup.</p>
<p>devise.rb</p>
<pre>
<div class="codecolorer-container ruby vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; config.<span style="color:#9900CC;">omniauth</span> <span style="color:#ff3333; font-weight:bold;">:facebook</span>, <span style="color:#0000FF; font-weight:bold;">nil</span>, <span style="color:#0000FF; font-weight:bold;">nil</span>, <span style="color:#ff3333; font-weight:bold;">:setup</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span></div></div>
</pre>
<p>Restart your application and you should be good to go.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2011/04/30/devise-omniauth-dynamic-providers/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>NERDTree directory colours</title>
		<link>http://www.ur-ban.com/blog/2011/04/01/nerdtree-directory-colours/</link>
		<comments>http://www.ur-ban.com/blog/2011/04/01/nerdtree-directory-colours/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 12:47:04 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[nerdtree]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=2089</guid>
		<description><![CDATA[I just realised that my NERDTree directory colour wasn&#8217;t inline with my Vim theme, and I couldn&#8217;t help but be bugged by it. Seems it&#8217;s a simple change. To change colour you need to use the treeDir highlight group. &#160; :hi treeDir guifg=#96CBFE guibg=#00ff00 To keep it synced with the ir_black theme I use, I just [...]]]></description>
			<content:encoded><![CDATA[<p>I just realised that my NERDTree directory colour wasn&#8217;t inline with my Vim theme, and I couldn&#8217;t help but be bugged by it. Seems it&#8217;s a simple change. To change colour you need to use the <em>treeDir </em>highlight group.</p>
<pre>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; :hi treeDir guifg=#96CBFE guibg=#00ff00</div></div>
</pre>
<p>To keep it synced with the ir_black theme I use, I just added the following to my colour scheme file.</p>
<pre>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; hi link treeDir &nbsp;Keyword</div></div>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2011/04/01/nerdtree-directory-colours/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Accessing values in your plist file from your iPhone/iPad app</title>
		<link>http://www.ur-ban.com/blog/2011/02/23/accessing-values-in-your-plist-file-in-your-iphoneipad-app/</link>
		<comments>http://www.ur-ban.com/blog/2011/02/23/accessing-values-in-your-plist-file-in-your-iphoneipad-app/#comments</comments>
		<pubDate>Wed, 23 Feb 2011 17:46:23 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[computing]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[objective-c]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=2058</guid>
		<description><![CDATA[Recently I&#8217;ve been coding some iPhone and iPad apps with multiple targets, all sharing the same codebase. Previously I had been using Preprocessor Macros to get the job done, but that soon turns messy and hard to maintain. I&#8217;ve since moved to just storing target specific values in each apps related plist file. Retrieving a [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve been coding some iPhone and iPad apps with multiple targets, all sharing the same codebase. Previously I had been using <strong>Preprocessor Macros </strong>to get the job done, but that soon turns messy and hard to maintain. I&#8217;ve since moved to just storing target specific values in each apps related plist file. Retrieving a value is as simple as:</p>
<pre>
<div class="codecolorer-container objc vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;<span style="color: #400080;">NSDictionary</span><span style="color: #002200;">*</span> infoDict <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSBundle</span> mainBundle<span style="color: #002200;">&#93;</span> infoDictionary<span style="color: #002200;">&#93;</span>;<br />
&nbsp;<span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>someString <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>infoDict objectForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;SomeKey&quot;</span><span style="color: #002200;">&#93;</span>;</div></div>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2011/02/23/accessing-values-in-your-plist-file-in-your-iphoneipad-app/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>nginx SSL PEM_read_bio:bad end line</title>
		<link>http://www.ur-ban.com/blog/2010/12/09/nginx-ssl-pem_read_biobad-end-line/</link>
		<comments>http://www.ur-ban.com/blog/2010/12/09/nginx-ssl-pem_read_biobad-end-line/#comments</comments>
		<pubDate>Thu, 09 Dec 2010 12:05:11 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[computing]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=1969</guid>
		<description><![CDATA[Installing the intermediate certificates on our server gave me the following error while trying to start up nginx again: &#160; &#40;SSL: error:0906D066:PEM routines:PEM_read_bio:bad end line&#41; The end of the file looked fine, but the problem was half way through it. Somehow the concatenation had joined two lines together: &#160; -----END CERTIFICATE----------BEGIN CERTIFICATE----- This just needed [...]]]></description>
			<content:encoded><![CDATA[<p>Installing the intermediate certificates on our server gave me the following error while trying to start up nginx again:</p>
<pre>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; <span style="color: #7a0874; font-weight: bold;">&#40;</span>SSL: error:0906D066:PEM routines:PEM_read_bio:bad end line<span style="color: #7a0874; font-weight: bold;">&#41;</span></div></div>
</pre>
<p>The end of the file looked fine, but the problem was half way through it. Somehow the concatenation had joined two lines together:</p>
<pre>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; <span style="color: #660033;">-----END</span> CERTIFICATE----------BEGIN CERTIFICATE-----</div></div>
</pre>
<p>This just needed a line break to fix:</p>
<pre>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; <span style="color: #660033;">-----END</span> CERTIFICATE-----<br />
&nbsp; <span style="color: #660033;">-----BEGIN</span> CERTIFICATE-----</div></div>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2010/12/09/nginx-ssl-pem_read_biobad-end-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Paperclip S3 expiring_url with styles and SSL</title>
		<link>http://www.ur-ban.com/blog/2010/12/07/paperclip-s3-expiring_url-with-styles-and-ssl/</link>
		<comments>http://www.ur-ban.com/blog/2010/12/07/paperclip-s3-expiring_url-with-styles-and-ssl/#comments</comments>
		<pubDate>Tue, 07 Dec 2010 22:17:06 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[paperclip]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=1956</guid>
		<description><![CDATA[A current requirement is that assets uploaded to Amazon S3 must be accessed via SSL and use an expiring URL. Using an expiring url with Paperclip is extremely easy. &#160; my_model.image.expiring_url&#40;5&#41; The problem is expiring_url doesn&#8217;t let you choose a style and doesn&#8217;t use https, which breaks our SSL site. To add the behaviour was [...]]]></description>
			<content:encoded><![CDATA[<p>A current requirement is that assets uploaded to Amazon S3 must be accessed via SSL and use an expiring URL. Using an expiring url with Paperclip is extremely easy.</p>
<pre>
<div class="codecolorer-container ruby vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; my_model.<span style="color:#9900CC;">image</span>.<span style="color:#9900CC;">expiring_url</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">5</span><span style="color:#006600; font-weight:bold;">&#41;</span></div></div>
</pre>
<p>The problem is expiring_url doesn&#8217;t let you choose a style and doesn&#8217;t use https, which breaks our SSL site. To add the behaviour was an easy &#8220;hack&#8221;. I added the file /config/initializers/paperclip.rb with the following code:</p>
<pre>
<div class="codecolorer-container ruby vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; <span style="color:#9966CC; font-weight:bold;">module</span> Paperclip<br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">module</span> Storage<br />
&nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">module</span> S3<br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#9966CC; font-weight:bold;">def</span> expiring_url<span style="color:#006600; font-weight:bold;">&#40;</span>style = default_style, time = <span style="color:#006666;">3600</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#6666ff; font-weight:bold;">AWS::S3::S3Object</span>.<span style="color:#9900CC;">url_for</span><span style="color:#006600; font-weight:bold;">&#40;</span>path<span style="color:#006600; font-weight:bold;">&#40;</span>style<span style="color:#006600; font-weight:bold;">&#41;</span>, <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bucket_name, <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#ff3333; font-weight:bold;">:expires_in</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> time, <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#ff3333; font-weight:bold;">:use_ssl</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div></div>
</pre>
<p>Now calling my expiring image URL with a style and over https is just:</p>
<pre>
<div class="codecolorer-container ruby vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; my_model.<span style="color:#9900CC;">image</span>.<span style="color:#9900CC;">expiring_url</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:original</span>, <span style="color:#006666;">5</span><span style="color:#006600; font-weight:bold;">&#41;</span></div></div>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2010/12/07/paperclip-s3-expiring_url-with-styles-and-ssl/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>‘FBML’ [undefined] is not an object</title>
		<link>http://www.ur-ban.com/blog/2010/11/19/fbml-undefined-is-not-an-object/</link>
		<comments>http://www.ur-ban.com/blog/2010/11/19/fbml-undefined-is-not-an-object/#comments</comments>
		<pubDate>Fri, 19 Nov 2010 17:59:33 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[annoyances]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[fbml]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=1939</guid>
		<description><![CDATA[First let me state how much I dislike developing for the Facebook platform. It&#8217;s just one constant headache. Things are always changing and breaking things. Anyways, I&#8217;ve been banging my head against the wall all day trying to get some FBJS running on a canvas application that&#8217;s embedded on a Fan Page tab. No matter [...]]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter" src="http://www.ur-ban.com/galleryv2/d/16198-1/fbml_undefined.png" alt="" width="507" height="19" /></p>
<p>First let me state how much I dislike developing for the Facebook platform. It&#8217;s just one constant headache. Things are always changing and breaking things. Anyways, I&#8217;ve been banging my head against the wall all day trying to get some FBJS running on a canvas application that&#8217;s embedded on a Fan Page tab. No matter what I did, I kept getting the error:</p>
<pre>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; 'FBML' [undefined] is not an object.</div></div>
</pre>
<p>Even using Facebook&#8217;s own FBJS examples left my tab in a hung state, with the spinner just continuing forever. After hours of playing around, the problem is that I&#8217;m trying to use Javascript one page deep into the application (The landing page itself has no FBJS). Once I added an opening and closing script tag to the landing page, my FBJS woes vanished.</p>
<pre>
<div class="codecolorer-container html4strict vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #ddbb00;">&amp;lt;</span>script<span style="color: #ddbb00;">&amp;gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #ddbb00;">&amp;lt;</span>!--<br />
&nbsp; &nbsp; &nbsp; //--<span style="color: #ddbb00;">&amp;gt;</span><br />
&nbsp; &nbsp; <span style="color: #ddbb00;">&amp;lt;</span>/script<span style="color: #ddbb00;">&amp;gt;</span></div></div>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2010/11/19/fbml-undefined-is-not-an-object/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Why Code Quality Matters</title>
		<link>http://www.ur-ban.com/blog/2010/09/28/why-code-quality-matters/</link>
		<comments>http://www.ur-ban.com/blog/2010/09/28/why-code-quality-matters/#comments</comments>
		<pubDate>Tue, 28 Sep 2010 13:17:42 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=1909</guid>
		<description><![CDATA[Recently the discussion of code quality has come up with a couple of different people. With the main question: &#8220;If the app does what it&#8217;s supposed to do, why does code quality matter?&#8221; In one instance an application that was bringing in over a £1m in revenues a month had one of the worst code [...]]]></description>
			<content:encoded><![CDATA[<p>Recently the discussion of code quality has come up with a couple of different people. With the main question:</p>
<blockquote><p>&#8220;If the app does what it&#8217;s supposed to do, why does code quality matter?&#8221;</p></blockquote>
<p>In one instance an application that was bringing in over a £1m in revenues a month had one of the worst code bases a friend had ever seen. And I totally agree that there is no correlation between code quality and the earnings/growth potential of an application. Then a few days ago I was reading the brilliant Zed Shaw article &#8220;<a href="http://sheddingbikes.com/posts/1285436217.html">Products For People Who Make Products For People</a>&#8221; which completely crystalised why code quality is important:</p>
<blockquote><p>&#8220;&#8230; the frontend product is what brings your revenue stream in, <em>but</em> your backend operations quality is what keeps your costs down as you grow. If your backend costs get out of control because of technical debt then you won&#8217;t make a profit, or someone who can keep them down will just copy you and wipe you out with less.&#8221;</p></blockquote>
<p>Perfect! That&#8217;s it exactly. Code quality matters as that&#8217;s what allows you to grow the system beyond your v1. If you never plan/or want to get past v1, then perhaps you can get away with being a lot more lieniet in your &#8220;quality&#8221;. I know that&#8217;s what I do, if it&#8217;s a quick app then normally I have only the most basic of tests and cut corners where I wouldn&#8217;t normally. Maybe in a sense, code quality is a reflection of technical debt. The lower the quality, the higher the debt and sooner or later you&#8217;re going to have to pay that back (Unless you&#8217;re fortunate enough to close up shop before that time comes). I&#8217;ve worked on projects where the technical debt is so high that you&#8217;re paralysed and just can&#8217;t do anything. Simple changes become huge problems as you&#8217;ve been painted into a corner, and the fear of breaking something is so huge that new feature requests are shied away from.</p>
<p>If you want/expect to be able to grow your business then keep the bar high. Code quality matters a hell of a lot.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2010/09/28/why-code-quality-matters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using SCSS with Webby</title>
		<link>http://www.ur-ban.com/blog/2010/08/21/using-scss-with-webby/</link>
		<comments>http://www.ur-ban.com/blog/2010/08/21/using-scss-with-webby/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 23:14:24 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=1882</guid>
		<description><![CDATA[To get webby using HAML/SASS&#8217; SCSS rendering engine I added the following to my Sitefile. No doubt there&#8217;s a cleaner and quicker way of getting it working, but this works. &#160; Webby::Filters.register :scss do &#124;input, cursor&#124; &#160; &#160; opts = ::Webby.site.sass_options.merge(cursor.page.sass_options &#124;&#124; {}) &#160; &#160; opts = ::Webby.site.sass_options.merge(:syntax =&#62; :scss) &#160; &#160; opts = opts.symbolize_keys [...]]]></description>
			<content:encoded><![CDATA[<p>To get webby using HAML/SASS&#8217; SCSS rendering engine I added the following to my Sitefile. No doubt there&#8217;s a cleaner and quicker way of getting it working, but this works.</p>
<pre>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; Webby::Filters.register :scss do |input, cursor|<br />
&nbsp; &nbsp; opts = ::Webby.site.sass_options.merge(cursor.page.sass_options || {})<br />
&nbsp; &nbsp; opts = ::Webby.site.sass_options.merge(:syntax =&gt; :scss)<br />
&nbsp; &nbsp; opts = opts.symbolize_keys<br />
&nbsp; &nbsp; opts.merge!(:filename =&gt; cursor.page.destination)<br />
&nbsp; &nbsp; opts[:style] = opts[:style].to_sym if opts.include? :style<br />
&nbsp; &nbsp; Sass::Engine.new(input, opts).render<br />
&nbsp; end</div></div>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2010/08/21/using-scss-with-webby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.556 seconds -->

