<?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/"
	>

<channel>
	<title>Nolan Consulting Limited</title>
	<atom:link href="http://www.nolanconsul.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nolanconsul.com</link>
	<description>ruby on rails, c++ and javascript developers</description>
	<pubDate>Wed, 03 Mar 2010 01:29:51 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Pure Javascript Mixins</title>
		<link>http://www.nolanconsul.com/articles/pure-javascript-mixins/</link>
		<comments>http://www.nolanconsul.com/articles/pure-javascript-mixins/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 01:29:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.nolanconsul.com/?p=116</guid>
		<description><![CDATA[I&#8217;ve been working on some javascript projects and wanted to be able have mixins, since I have some standard functionality that I use in all my classes, but the functionality suited being a mixin more than using prototype based class inheritance. I don&#8217;t need any fancy inheritance chaining - or ability to do typeof on [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on some javascript projects and wanted to be able have mixins, since I have some standard functionality that I use in all my classes, but the functionality suited being a mixin more than using prototype based class inheritance. I don&#8217;t need any fancy inheritance chaining - or ability to do typeof on the instances, so I wanted something simple and easy. This is what I got&#8230; (including tests for node.js):</p>
<p><script src="http://gist.github.com/320196.js?file=classes.js"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nolanconsul.com/articles/pure-javascript-mixins/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Gamma of Tag Clouds</title>
		<link>http://www.nolanconsul.com/articles/the-gamma-of-tag-clouds/</link>
		<comments>http://www.nolanconsul.com/articles/the-gamma-of-tag-clouds/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 21:35:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.nolanconsul.com/?p=113</guid>
		<description><![CDATA[I was doing some work on making a good looking tag cloud. The trick is to have slightly different tag sizes, but without having a few popular tags grossly outweighing the other tags. The tag size is then set using font-size: Xem.
  @max = @tags.collect(&#38;:frequency).collect(&#38;:to_i).max
  @min = @tags.collect(&#38;:frequency).collect(&#38;:to_i).min

  def tag_size(tag)
   [...]]]></description>
			<content:encoded><![CDATA[<p>I was doing some work on making a good looking tag cloud. The trick is to have slightly different tag sizes, but without having a few popular tags grossly outweighing the other tags. The tag size is then set using font-size: Xem.</p>
<pre>  @max = @tags.collect(&amp;:frequency).collect(&amp;:to_i).max
  @min = @tags.collect(&amp;:frequency).collect(&amp;:to_i).min

  def tag_size(tag)
    gamma = 1.2
    range = 1.0
    offset = 1.0

    [1.0,1.0 / (@max-@min) * (tag.frequency.to_i - @min) ** gamma].min * range + offset
  end</pre>
<div><span style="font-family: 'Courier New', monospace; font-size: small;"><span><br />
</span></span></div>
]]></content:encoded>
			<wfw:commentRss>http://www.nolanconsul.com/articles/the-gamma-of-tag-clouds/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Command line essentials</title>
		<link>http://www.nolanconsul.com/articles/command-line-essentials/</link>
		<comments>http://www.nolanconsul.com/articles/command-line-essentials/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 19:33:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.nolanconsul.com/?p=109</guid>
		<description><![CDATA[When you&#8217;re using the terminal in OS X, you&#8217;re usually using BASH, the Bourne-Again Shell. I&#8217;m occasionally surprised by long time terminal users who don&#8217;t know some of the following tips:
CTRL-A
&#160; &#160; &#160; &#160; Jump to the start of the line
CTRL-E
&#160; &#160; &#160; &#160; Jump to the end of the line
history
&#160; &#160; &#160; &#160; Get [...]]]></description>
			<content:encoded><![CDATA[<p>When you&#8217;re using the terminal in OS X, you&#8217;re usually using BASH, the Bourne-Again Shell. I&#8217;m occasionally surprised by long time terminal users who don&#8217;t know some of the following tips:</p>
<p>CTRL-A<br />
&nbsp; &nbsp; &nbsp; &nbsp; Jump to the start of the line<br />
CTRL-E<br />
&nbsp; &nbsp; &nbsp; &nbsp; Jump to the end of the line<br />
history<br />
&nbsp; &nbsp; &nbsp; &nbsp; Get a list of the last 500 commands typed<br />
history | grep ssh<br />
&nbsp; &nbsp; &nbsp; &nbsp; Show a list of the last ssh commands you used<br />
!script<br />
&nbsp; &nbsp; &nbsp; &nbsp; Run the last command you typed that began with script&#8230; (eg script/server -p 3100 -e production). Use this one with care - !rm can be a dangerous command<br />
`backticks`<br />
&nbsp; &nbsp; &nbsp; &nbsp; Commands in backticks are evaluated first, and the result of the command is inserted into their place in the command. For example:<br />
rm -rf `find . | grep svn`<br />
&nbsp; &nbsp; &nbsp; &nbsp; Removes all the .svn directories from your current directory<br />
CTRL-L<br />
&nbsp; &nbsp; &nbsp; &nbsp; Clear the terminal screen<br />
OPTION-K<br />
&nbsp; &nbsp; &nbsp; &nbsp; Clears the  scrollback history (this is an apple terminal command)<br />
OPTION-T<br />
&nbsp; &nbsp; &nbsp; &nbsp; New Tab in the t apple terminal<br />
tail -f log/production.log<br />
&nbsp; &nbsp; &nbsp; &nbsp; Follow a log (like cat, except stays open and displays new lines as they are written to a file)<br />
CTRL-Z<br />
&nbsp; &nbsp; &nbsp; &nbsp; Pause the current process<br />
bg<br />
&nbsp; &nbsp; &nbsp; &nbsp; Put a paused process into the background (same as running ./process &amp;)<br />
fg<br />
&nbsp; &nbsp; &nbsp; &nbsp; Brings a backgrounded process into the foreground again<br />
grep term -B 2<br />
&nbsp; &nbsp; &nbsp; &nbsp; Greps a file for  &#8221;term&#8221;, then displays the matching line and the two lines before it.</p>
<p>And when you&#8217;re working with files directly - these commands work in most versions of less or vim:</p>
<p>CTRL-B<br />
&nbsp; &nbsp; &nbsp; &nbsp; Page down<br />
CTRL-D<br />
&nbsp; &nbsp; &nbsp; &nbsp; Page up<br />
&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Go to end of file<br />
&lt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Go to start of file<br />
:123<br />
&nbsp; &nbsp; &nbsp; &nbsp; Go to line 123<br />
/searchterm<br />
&nbsp; &nbsp; &nbsp; &nbsp; Searches for said term</p>
<p>If you use the terminal a lot, it&#8217;s definitely worth reading the <a href="http://www.gnu.org/software/bash/manual/bashref.html">bash reference</a> and the <a href="http://tldp.org/LDP/abs/html/">advanced bash scripting</a> guide. It&#8217;s one of those cases of a half hour spent reading saving you an hour per week. <img src='http://www.nolanconsul.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.nolanconsul.com/articles/command-line-essentials/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Nexus? Give me a 2 year old Nokia instead&#8230;</title>
		<link>http://www.nolanconsul.com/articles/nexus-give-me-a-2-year-old-nokia-instead/</link>
		<comments>http://www.nolanconsul.com/articles/nexus-give-me-a-2-year-old-nokia-instead/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 12:56:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.nolanconsul.com/?p=105</guid>
		<description><![CDATA[I&#8217;ve been in the market for a new phone as a complement to my iphone, I wanted a normal candybar phone with T9 keys, a good camera and most importantly, an excellent GPS. I ended up getting a Nokia 6220 classic, which I found on sale for about 125€. It came with 8GB of memory, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been in the market for a new phone as a complement to my iphone, I wanted a normal candybar phone with T9 keys, a good camera and most importantly, an excellent GPS. I ended up getting a Nokia 6220 classic, which I found on sale for about 125€. It came with 8GB of memory, and after installing Ovi Maps 3.0 and Sportstracker, I decided to mount the phone to my bike. A quick bit of tape and a rubber sponge later and I was off for a bike ride on my local trails.</p>
<p>Here&#8217;s part of the map that was generated:</p>
<p><img class="alignnone size-medium wp-image-106" title="picture-4" src="http://www.nolanconsul.com/wp-content/uploads/2010/01/picture-4-300x234.png" alt="picture-4" width="300" height="234" /></p>
<p>The sportstracker app (a free one from Nokia) automatically generates info points for the fastest point, highest point, as well as giving you a high resolution (and very accurate) GPS track of the route. I think there are apps like this for the iphone, but certainly none that run in the background and let you record video at the same time:</p>
<p><a href="http://www.youtube.com/watch?v=BitFEZ8TKAY">Biking on youtube</a></p>
<p>I didn&#8217;t realise until later that I had the camera mounted sideways, and the video that I uploaded to youtube was downsampled a lot from the original 640&#215;480 source video. Regardless, there&#8217;s a lot more you can do on this two-year-old nokia (the 6220 was released in 2008) that you can&#8217;t do with a new iphone 3gs. Admittedly the web browser isn&#8217;t as good on the nokia, but i&#8217;d rather have good content creation tools than a good web browser.</p>
<p>Anyway - as part of my work on a facebook application for places, I worked out how to sync the places I have bookmarked with my <a href="http://maps.ovi.com/">Ovi Maps</a> account. So any places that me or my friends bookmark, will end up on my phone. Fire up maps on my phone, click on the nearest bookmark, click &#8216;driving directions&#8217; and my phone will give me turn by turn driving directions.</p>
<p>Finally, the camera is a 5MP camera with a xenon flash, that includes the GPS co-ordinates as EXIF data in the image, so that if you upload the image to my app, or a similair service (Panoramio, Flickr) the photo is seamlessly associated with a map location.</p>
<p>I&#8217;m impressed Nokia, well done.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nolanconsul.com/articles/nexus-give-me-a-2-year-old-nokia-instead/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Modern FBML</title>
		<link>http://www.nolanconsul.com/articles/modern-fbml/</link>
		<comments>http://www.nolanconsul.com/articles/modern-fbml/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 08:00:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.nolanconsul.com/?p=103</guid>
		<description><![CDATA[I&#8217;ve been doing a bit of FBML lately, and I&#8217;ve been impressed with the quality of tools available for that environment. I think FBML is often underused and underappreciated. With FBJS and the Ajax loaders, you can port pretty much all of your rails functionality over to FBML, and get the benefit of &#8216;native-feeling&#8217; pages [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been doing a bit of FBML lately, and I&#8217;ve been impressed with the quality of tools available for that environment. I think FBML is often underused and underappreciated. With FBJS and the Ajax loaders, you can port pretty much all of your rails functionality over to FBML, and get the benefit of &#8216;native-feeling&#8217; pages and fast load times (without the weird iframe-flash that most facebook apps have). I also find the pain of getting things to work on FBML is absolutely outweighed by the fbml tags facebook provides for searching friends, inviting users or showing facebook-ish dialogs.</p>
<h3><a href="http://code.google.com/p/760-css/">760.css</a></h3>
<p>This is a great css framework for doing block-based layout (as made famous by blueprint.css and 960.css). It lets you create nicely structured pages with simple tags like &lt;div class=&#8221;grid_5&#8243;&gt;&lt;/div&gt;. It&#8217;s nice to see this framework working under FBML.</p>
<h3><a href="http://code.google.com/p/fbjqry/">FBJquery</a></h3>
<p>I&#8217;m a longtime jquery fan, and was very impressed to find this port of jquery to fbjs. It does have some bugs (next, prev and parents don&#8217;t work as they should) and some peculiarities (css doesn&#8217;t accept hashes for example) but is a great start for your facebook development. I&#8217;ve been doing some work on fbjquery, fixing various bugs and making it code-compatible with jquery-1.3.2, I&#8217;ll put my fixes up on github when they&#8217;re ready for release.</p>
<p>The biggest problem I&#8217;ve had so far with Facebook is that you can&#8217;t readily use the render :update functionality of rails to do dynamic page updates, since you can&#8217;t eval() the response from an ajax request.</p>
<p>I&#8217;ve worked around that by manually parsing and executing the returned javascript, this lets me use the normal rails code, but have it converted into something that can be executed by FBJS. It does feel a little bit like hacks on top of hacks, but my goal is to have a complete environment for working inside FBML, not a cut-down version that feels &#8220;hamstrung&#8221; compared to normal HTML.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nolanconsul.com/articles/modern-fbml/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Jquery Image Rotater Snippet</title>
		<link>http://www.nolanconsul.com/articles/jquery-image-rotater-snippetdj/</link>
		<comments>http://www.nolanconsul.com/articles/jquery-image-rotater-snippetdj/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 00:30:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.nolanconsul.com/?p=98</guid>
		<description><![CDATA[There may be an easier way to do this - but given the following html:
&#60;div class="rotate"&#62;
  &#60;div&#62;&#60;img /&#62;&#60;/div&#62;
  &#60;div&#62;&#60;img /&#62;&#60;/div&#62;
  &#60;div&#62;&#60;img /&#62;&#60;/div&#62;
&#60;/div&#62;
You can use the following code snippet to rotate through the images using jquery. You&#8217;ll need to set the rotate to be relatively positioned, and absolutely position the divs inside the .rotate div.
 $(&#8217;div.rotate div&#8217;).hide().eq(1).show();
function rotate(){
var i [...]]]></description>
			<content:encoded><![CDATA[<p>There may be an easier way to do this - but given the following html:</p>
<pre>&lt;div class="rotate"&gt;
  &lt;div&gt;&lt;img /&gt;&lt;/div&gt;
  &lt;div&gt;&lt;img /&gt;&lt;/div&gt;
  &lt;div&gt;&lt;img /&gt;&lt;/div&gt;
&lt;/div&gt;</pre>
<p>You can use the following code snippet to rotate through the images using jquery. You&#8217;ll need to set the rotate to be relatively positioned, and absolutely position the divs inside the .rotate div.</p>
<p><span style="font-family: 'Courier New', monospace; line-height: 18px; font-size: 12px; white-space: pre;"> $(&#8217;div.rotate div&#8217;).hide().eq(1).show();<br />
function rotate(){<br />
var i = $(&#8217;div.rotate div:visible&#8217;).prevAll(&#8217;div&#8217;).length + 1;<br />
i = i % $(&#8217;div.rotate div&#8217;).length;<br />
$(&#8217;div.rotate div&#8217;).fadeOut().eq(i).fadeIn();<br />
setTimeout(&#8217;rotate()&#8217;, 1000);<br />
};<br />
rotate();</span></p>
<p>Enjoy! Up with code snippets and down with unnecessary plugins!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nolanconsul.com/articles/jquery-image-rotater-snippetdj/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Design for sales</title>
		<link>http://www.nolanconsul.com/articles/design-for-sales/</link>
		<comments>http://www.nolanconsul.com/articles/design-for-sales/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 02:19:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.nolanconsul.com/?p=93</guid>
		<description><![CDATA[I&#8217;ve been feeling inspired by Casey&#8217;s writing over at Starting Companies, so I thought I&#8217;d add a few notes of my own.
The Great Buy Now Button
We&#8217;ve been redesigning some elements of the Indigo Renderer site to push more customers to the sales page. One of the biggies has been to make a prominent and attractive [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been feeling inspired by <a href="http://www.mikecasey.com.au/">Casey&#8217;s</a> writing over at <a href="http://www.mikecasey.com.au/">Starting Companies</a>, so I thought I&#8217;d add a few notes of my own.</p>
<p><strong>The Great Buy Now Button</strong></p>
<p>We&#8217;ve been redesigning some elements of the Indigo Renderer site to push more customers to the sales page. One of the biggies has been to make a prominent and attractive &#8216;Buy Now&#8217; button. A bit of playing around in photoshop (even if you&#8217;re not a graphic designer, if you&#8217;re doing work on your website it&#8217;s a good skill to know your way around photoshop layers and layer effects) and I came up with this Buy Now button.</p>
<p>Thanks to <a href="http://lancewiggs.com/">Lance Wiggs</a>, (our friendly business advisor / mentor), we wanted a shiny &#8220;push me&#8221; look. I used a bit of css trickery to make the button roll over highlight, then I washed out the rest of the menu bar so that the buy now button screamed &#8220;Press Me and send money to the Indigoeans!&#8221;.</p>
<p><img class="alignnone size-full wp-image-92" title="picture-9" src="http://www.nolanconsul.com/wp-content/uploads/2009/12/picture-9.png" alt="picture-9" width="313" height="125" /></p>
<p>That was all well and good, but the biggest problem with our Buy Now button - is that it linked to this page:</p>
<p><img class="alignnone size-medium wp-image-94" title="picture-12" src="http://www.nolanconsul.com/wp-content/uploads/2009/12/picture-12-300x196.png" alt="picture-12" width="300" height="196" /></p>
<p>A wall of text that didn&#8217;t really do much to sell the product. Nice shiny button, big wall of text. Doesn&#8217;t do the trick. So just now I&#8217;ve been working on taking our existing Indigo Renderer store and sexing it up a little. The current store looks like so:</p>
<p><img class="alignnone size-medium wp-image-95" title="picture-13" src="http://www.nolanconsul.com/wp-content/uploads/2009/12/picture-13-300x276.png" alt="picture-13" width="300" height="276" /></p>
<p>The main things I want to achieve:</p>
<ol>
<li>Make the store look like the Indigo site, so that the users trust isn&#8217;t broken<br />
(Click buy now - go to a different looking page - &#8220;Hey what the hell is this?&#8221;)</li>
<li>Make the store sexier and encourage more impulsive &#8220;buy now&#8221; decisions</li>
<li>Get more cohesiveness across the website and applications we use, so that we can reuse the same CSS, typography and design elements in everything we do.</li>
</ol>
<p>Thus, I give a preview of the new and slightly improved &#8220;Buy Indigo Renderer&#8221; page:</p>
<p><img class="alignnone size-medium wp-image-91" title="picture-10" src="http://www.nolanconsul.com/wp-content/uploads/2009/12/picture-10-300x229.png" alt="picture-10" width="300" height="229" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nolanconsul.com/articles/design-for-sales/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Remote forwarding failure</title>
		<link>http://www.nolanconsul.com/articles/remote-forwarding-failure/</link>
		<comments>http://www.nolanconsul.com/articles/remote-forwarding-failure/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 21:38:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Facebook]]></category>

		<guid isPermaLink="false">http://www.nolanconsul.com/?p=79</guid>
		<description><![CDATA[
While developing facebook applications I occasionally get this error while running rake facebooker:tunnel:start.

debug1: Remote connections from *:6300 forwarded to local address
localhost:3000
debug1: Entering interactive session.
debug1: remote forward failure for: listen 6300, connect
localhost:3000
Warning: remote port forwarding failed for listen port 6300

Unable to open remote port via ssh
There&#8217;s a couple of reasons for this. First up you might [...]]]></description>
			<content:encoded><![CDATA[<div>
<p class="western">While developing facebook applications I occasionally get this error while running rake facebooker:tunnel:start.</p>
<pre class="western">
debug1: Remote connections from *:6300 forwarded to local address
localhost:3000
debug1: Entering interactive session.
debug1: remote forward failure for: listen 6300, connect
localhost:3000
Warning: remote port forwarding failed for listen port 6300
</pre>
<p class="caption-western">Unable to open remote port via ssh</p>
<p class="western">There&#8217;s a couple of reasons for this. First up you might have your  <a href="http://man-wiki.net/index.php/5:sshd_config">sshd config</a> set up incorrectly, but that wasn&#8217;t the case for me. Instead &ndash; it&#8217;s when I have the tunnel open and I change wifi connections and the old connection seems to hang around on the server, preventing the new ssh connection from opening a port.</p>
<p class="western">You can easily check what process is holding the port open on your server by using netstat:</p>
<pre class="western">
[tomato:~]$ sudo netstat -ap | grep 6300
tcp6       0      0 [::]:6300               [::]:* LISTEN
18354/sshd: ben
</pre>
<p class="caption-western">Netstat results for port 6300 on my server.</p>
<p class="western">Once you&#8217;ve found the hanging sshd process that is holding onto the port you want to tunnel with, you can kill it with extreme prejudice:</p>
<pre class="western">
[tomato:~]$ kill 18354
[tomato:~]$
</pre>
<p class="caption-western">Goodbye useless sshd</p>
<p class="western">You&#8217;re quite safe killing ssh daemons which are running as yourself, just make sure you don&#8217;t killall sshd, or you might find a bit difficult to log back in.</p>
<p class="western">Which is another reason to use a virtual hosting provider, because they usually provide console log on &ndash; which is much harder to bork.</p>
<div type="FOOTER">
<p class="page-number-western" style="margin-top: 0.64cm"></p>
</div>
<p><br clear="left"></div>
]]></content:encoded>
			<wfw:commentRss>http://www.nolanconsul.com/articles/remote-forwarding-failure/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Facebooker Tutorial</title>
		<link>http://www.nolanconsul.com/articles/facebooker-tutorial/</link>
		<comments>http://www.nolanconsul.com/articles/facebooker-tutorial/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 23:30:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Facebook]]></category>

		<guid isPermaLink="false">http://www.nolanconsul.com/?p=58</guid>
		<description><![CDATA[
This tutorial will show you how to build a simple Facebook application using Ruby on Rails and Facebook.

Contents

3 Introduction
4 What you will need
5 Register your Application
7 Create your rails app
9 Creating your first view
10 Start your engines
11 Next steps

 Introduction
Facebook applications are a great way to try out new social web ideas, no longer do [...]]]></description>
			<content:encoded><![CDATA[<div>
<p class="western">This tutorial will show you how to build a simple Facebook application using Ruby on Rails and Facebook.</p>
<p><span id="more-58"></span></p>
<h2 class="western" style="page-break-before: always">Contents</h2>
<div id="Table of Contents1" style="background: transparent" dir="ltr">
<p style="margin-bottom: 0cm; line-height: 150%"><span style="font-family: Arial, sans-serif;"><span style="font-size: x-small;"><strong>3</strong></span></span> <a href="#0.2.Introduction|outline">Introduction</a></p>
<p style="margin-bottom: 0cm; line-height: 150%"><span style="font-family: Arial, sans-serif;"><span style="font-size: x-small;"><strong>4</strong></span></span> <a href="#0.3.What%20you%20will%20need|outline">What you will need</a></p>
<p style="margin-bottom: 0cm; line-height: 150%"><span style="font-family: Arial, sans-serif;"><span style="font-size: x-small;"><strong>5</strong></span></span> <a href="#0.4.Register%20your%20Application%20|outline">Register your Application</a></p>
<p style="margin-bottom: 0cm; line-height: 150%"><span style="font-family: Arial, sans-serif;"><span style="font-size: x-small;"><strong>7</strong></span></span> <a href="#0.5.Create%20your%20rails%20app|outline">Create your rails app</a></p>
<p style="margin-bottom: 0cm; line-height: 150%"><span style="font-family: Arial, sans-serif;"><span style="font-size: x-small;"><strong>9</strong></span></span> <a href="#0.6.Creating%20your%20first%20view|outline">Creating your first view</a></p>
<p style="margin-bottom: 0cm; line-height: 150%"><span style="font-family: Arial, sans-serif;"><span style="font-size: x-small;"><strong>10</strong></span></span> <a href="#0.7.Start%20your%20engines|outline">Start your engines</a></p>
<p style="margin-bottom: 0cm; line-height: 150%"><span style="font-family: Arial, sans-serif;"><span style="font-size: x-small;"><strong>11</strong></span></span> <a href="#0.8.Next%20steps|outline">Next steps</a></p>
</div>
<h2 class="western" style="page-break-before: always"><a name="0.2.Introduction|outline"></a> Introduction</h2>
<p class="western">Facebook applications are a great way to try out new social web ideas, no longer do you have to spend a dozen nights building a cool new website, only to leave it running for a few weeks and get less than a thousand unique visitors.</p>
<p class="western">With Facebook applications you can leverage Facebook Markup Language (FBML), Facebooks authentication, your existing friend network and Facebooks viral promotion tools to get your app in front of more eyeballs.</p>
<p class="western">Combined with Ruby on Rails, one of the best rapid application development tools, you can prototype an idea, put it in front of people and start getting feedback much much quicker.</p>
<p class="western">Also – an often overlooked advantage of Facebook is that is has your non-technical friends on it, so you quickly get feedback from real people – not just your techie early adopter friends.</p>
<p class="western">Feedback like“How do I send this to my friend? I want them to do this quiz”instead of “Oh man, you should&#8217;ve used XFBML+Jquery+SquidmooDB”</p>
<p class="western">Facebook apps are about user engagement, measurement and growth, which is a different and interesting skillset from your usual web development role.</p>
<p class="western">Anyway – I hope I have convinced you that Facebook applications are a great area to get into – so let&#8217;s get started.</p>
<p class="western"> </p>
<h2 class="western" style="page-break-before: always"><a name="0.3.What you will need|outline"></a> What you will need</h2>
<p class="western">I will assume that you have rails installed on your system and you have done some of the Ruby on Rails tutorials. But to be sure – this tutorial expects you have:</p>
<ul>
<li>
<p class="western"><strong>A working Rails 2.3 install.<br />
</strong> <span style="font-weight: normal">Run rails -v to get your rails version.</span></li>
<li>
<p class="western"><strong>Ability to install plugins via git.</strong><br />
So you can install facebooker.</li>
<li>
<p class="western"><strong>A server you can use for a ssh tunnel.</strong><br />
This is the simplest way to let facebook request pages from your development server. If you don&#8217;t have a server, slicehost is a good affordable solution, just get their smallest 256mb virtual machine.</li>
</ul>
<p class="western">Okay – so you&#8217;ve got those, got your macbook, a cup of coffee and a nice perch in your local coffee shop? Let&#8217;s go then.</p>
<h2 class="western" style="page-break-before: always"><a name="0.4.Register your Application |outline"></a> Register your Application</h2>
<p class="western">Go to  <a href="http://www.facebook.com/developers/createapp.php">http://www.facebook.com/developers/createapp.php</a> and create your application.</p>
<p><span style="color: #cccccc;"><img style=";text-align:left" src="http://www.nolanconsul.com/wp-content/uploads/2009/10/sbres-1255505206-1.png" border="1" alt="" width="436" height="177" /><br />
</span></p>
<p class="caption-western">Enter name of your application, can be anything you like.</p>
<p class="western">Then you will be taken to the &#8216;edit application&#8217; form. There are plenty of options you can edit here, you should bookmark this page to come back and set a logo and description. For now, click &#8216;canvas&#8217; on the left hand side and set a canvas page url.</p>
<p class="western">The settings to create are:</p>
<p class="western"><strong>Canvas Page URL:</strong> This is the URL to access your app. Many of these are gone and yours must be unique – so good luck finding something you like.</p>
<p class="western"><strong>Canvas callback URL:</strong> <span style="font-weight: normal">This is the address that facebook uses to access your site – for your development site you should be:</span></p>
<p class="western"><a href="http://yourslicehost.com:4007/"><strong>http://yourslicehost.com:4007/</strong></a> <a href="http://yourslicehost.com:4007/"><strong></strong></a></p>
<p><a href="http://yourslicehost.com:4007/"><strong> </strong></a><strong>We will open an ssh reverse tunnel (via facebooker) to server port 4007 from your local dev environment.</strong></p>
<p class="western"><strong>Render Method:</strong> Set to FBML. Creating iframed pages isn&#8217;t covered in this tutorial.</p>
<p class="western">Hit save and then bring up your terminal and get ready to do some rails.</p>
<p class="western">You want to create two versions of your app – one for development and one for production. For the rest of this article we will be discussing setting up your development application. I tend to name my development applications with the  <span style="text-decoration: none">dev</span> <span style="text-decoration: none">suffix. For example /bestcities/ and /bestcitiesdev/.</span></p>
<h2 class="western" style="page-break-before: always"><a name="0.5.Create your rails app|outline"></a> Create your rails app</h2>
<p class="western">Open the terminal on your pc and type the following commands.</p>
<pre class="western">rails mygreatapp
cd mygreatapp
script/plugin install
git://github.com/mmangino/facebooker.git</pre>
<p class="caption-western">Creating your first facebooker application</p>
<p class="western">Then open mygreatapp in your text editor and open  <strong>config/facebooker.yml</strong>. This file tells the facebooker plugin how to communicate securely with facebook. You have to configure your development environment before starting up your rails app. If you don&#8217;t configure facebooker.yml you will get an error when trying to start rails.</p>
<p class="western">You need to go back to your &#8216;edit application&#8217; form at facebook.com and copy out your API key and Secret. These go into the development section of facebooker.yml.</p>
<p><span style="color: #808080;"><img style=";text-align:left" src="http://www.nolanconsul.com/wp-content/uploads/2009/10/sbres-1255505206-4.png" border="1" alt="" width="436" height="94" /><br />
</span></p>
<p class="caption-western">Getting your Application ID from facebook.com</p>
<pre class="western">development:
 api_key: 8b81627dfbdc1eac5d69f72d11ecb2083
 secret_key: 1f096ea634151345aa54a1a6dbb8db897bf
 canvas_page_name:
<a href="http://apps.facebook.com/bestcities-dev/">mygreatapp-dev</a>
 callback_url:
<a href="http://bennolan.com:6300/">http://bennolan.com:4007/</a></pre>
<p class="caption-western">Configuring facebooker.yml with your application settings</p>
<p class="western">The details you need to set are:</p>
<p class="western"><strong>api_key</strong> Your API key from facebook</p>
<p class="western"><strong>secret_key</strong> Your Applications secret key from facebook</p>
<p class="western"><strong>canvas_page_name</strong> Address of your facebook page</p>
<p class="western"><strong>callback_url</strong> Port 4007 (or another port number of your choice) of your<br />
slicehost server.</p>
<p class="western">You can leave the other settings to their default. You&#8217;re now ready to start development.</p>
<p class="western"> </p>
<h2 class="western" style="page-break-before: always"><a name="0.6.Creating your first view|outline"></a> Creating your first view</h2>
<p class="western">Facebook application views use FBML. Because your html content is served embedded in a facebook page, you html is filtered and sanitized before being displayed. This means no javascript, no css to break out of frames etc.</p>
<p class="western">Read more about FBML here:</p>
<p class="western"><a href="http://wiki.developers.facebook.com/index.php/Category:FBML_tags">http://wiki.developers.facebook.com/index.php/Category:FBML_tags</a></p>
<p class="western">We will start by creating a welcome controller and generating a welcome view.</p>
<pre class="western">script/generate controller welcome</pre>
<p class="caption-western">Create welcome controller</p>
<p class="western">Then create a file in  <strong>app/views/welcome/index.fbml.erb</strong>. This is a standard .erb and .html view, except if will only be served via facebook, and you can include facebook tags. Put this in your view:</p>
<pre class="western">&lt;fb:header&gt;My great application&lt;/fb:header&gt;

&lt;fb:tabs&gt;
  &lt;fb:tab-item href='&lt;%= url_for :controller =&gt; 'welcome',
:action =&gt; 'index' %&gt;' title='Home' selected='true'/&gt;
  &lt;fb:tab-item href='&lt;%= url_for :controller =&gt; 'things',
:action =&gt; 'index' %&gt;' title='Your things' /&gt;
&lt;/fb:tabs&gt;

&lt;p&gt;
  Hi there &lt;fb:name uid="loggedinuser" useyou="false" /&gt;!
Welcome to
  your first app.
&lt;/p&gt;</pre>
<p class="caption-western">app/views/welcome/index.fbml.erb</p>
<p class="western">Now edit config/routes.rb and uncomment this line:</p>
<pre class="western">  map.root :controller =&gt; "welcome"</pre>
<p class="caption-western">Enabling your default route</p>
<h2 class="western" style="page-break-before: always"><a name="0.7.Start your engines|outline"></a> Start your engines</h2>
<p class="western">Bring up your terminal again. You need to start your local development server, and then make that server available to the wider internet. Do this like so:</p>
<pre class="western">script/server &amp;
rake facebooker:tunnel:start &amp;</pre>
<p class="caption-western">Starting your facebook applicatio</p>
<p class="western">Once your server has started, the second command will start a reverse ssh tunnel.</p>
<p class="western">Now load  <a href="http://apps.facebook.com/yourgreatapp_dev/">http://apps.facebook.com/yourgreatapp_dev/</a> and you should be able to access your first facebooker application.</p>
<p><span style="color: #808080;"><img style=";text-align:left" src="http://www.nolanconsul.com/wp-content/uploads/2009/10/sbres-1255505206-5.png" border="1" alt="" width="436" height="125" /><br />
</span></p>
<p class="caption-western">If you see this then you&#8217;re ready to go.</p>
<p class="western">If it didn&#8217;t work – try these steps:</p>
<ol>
<li>
<p class="western">Load  <a href="http://localhost:3000/">http://localhost:3000/</a> and check you get the &#8216;welcome to rails&#8217; page</p>
</li>
<li>
<p class="western">Load  <a href="http://yourslicehost.com:4007/">http://yourslicehost.com:4007/</a> and check you get the &#8216;welcome to rails&#8217; page. If you don&#8217;t, either [a] your ssh tunnel didn&#8217;t start or [b] your server has a firewall running to prevent you getting access to port 4007</p>
</li>
<li>
<p class="western">Check that your facebook application canvas page settings are set to  <a href="http://yourslicehost.com:4007/">http://yourslicehost.com:4007/</a></p>
</li>
</ol>
<p class="western">Once you have your rails app being served locally and displayed inside facebook you are ready to go!</p>
<h2 class="western" style="page-break-before: always"><a name="0.8.Next steps|outline"></a> Next steps</h2>
<p class="western">Now your basic application is going – you can start creating models and controllers. Facebooker will automatically correct your URLs so you can develop like normal. Your next best step is probably learning about authentication.</p>
<p class="western">Check the Nolan Consulting site for further Facebooker tutorials.</p>
<p class="western"><a href="http://www.nolanconsul.com/">http://www.nolanconsul.com/</a></p>
<p class="western">The facebook developers wiki is a great reference source:</p>
<p class="western"><a href="http://wiki.developers.facebook.com/">http://wiki.developers.facebook.com/</a></p>
<p class="western">The facebooker rdoc documentation is available from rdoc.info:</p>
<p class="western"><a href="http://rdoc.info/projects/mmangino/facebooker">http://rdoc.info/projects/mmangino/facebooker</a></p>
<p class="western">To discuss with other facebook developers, try the forum:</p>
<p class="western"><a href="http://forum.developers.facebook.com/">http://forum.developers.facebook.com/</a></p>
<p class="western"> </p>
<p> </p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.nolanconsul.com/articles/facebooker-tutorial/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
