<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[Stacked Notion]]></title>
  <link href="http://www.stackednotion.com/atom.xml" rel="self"/>
  <link href="http://www.stackednotion.com/"/>
  <updated>2012-02-02T11:27:52+00:00</updated>
  <id>http://www.stackednotion.com/</id>
  <author>
    <name><![CDATA[Luca Spiller]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[Puppet: Setting up and using the Puppetmaster]]></title>
    <link href="http://www.stackednotion.com/blog/2012/01/30/puppet-setting-up-and-using-the-puppetmaster/"/>
    <updated>2012-01-30T00:00:00+00:00</updated>
    <id>http://www.stackednotion.com/blog/2012/01/30/puppet-setting-up-and-using-the-puppetmaster</id>
    <content type="html"><![CDATA[<p>Over the past few months I&#8217;ve been working on using Puppet to automate my server setup. At the moment I only have one server, but it is still a pain to rebuild every few years whenever an old version of Ubuntu is discontinued. You can see <a href="https://github.com/lucaspiller/stackednotion-puppet">what I&#8217;ve got so far on GitHub</a>. Puppet seems like a great idea but documentation is absolutely appalling.</p>

<p>The tool itself has changed quite quickly, so a lot of old documentation isn&#8217;t relavent anymore and others (on the main site) has &#8220;not yet been written&#8221;. Hmm. It is also quite clear (not trying to flame, but anyway&#8230;) that the tool is built for sys admins not developers. This isn&#8217;t necessarily a bad thing as they are going to be the ones mainly using it, but if you just want to Get Shit Done™, you are in for one hell of a ride.</p>

<p>My previous attempts to use Puppet (see my GitHub repo for examples of both!) have been using Puppet under <a href="http://vagrantup.com/">Vagrant</a> (really nice, except I couldn&#8217;t find an Ubuntu 11.10 image&#8230; so I had to build my own) and using some custom magical single server setup (again, see the repo). I&#8217;m actually beginning to use Puppet across more than one server now though, so I wanted to setup Puppetmaster. This is basically a central repository to Puppet scripts, which shared them out to connected clients. As expected there was no documentation, so I wrote this!</p>

<h1>Hostnames</h1>

<p>Puppet uses SSL certificates to ensure that the client and server are who they say they are. This prevents your clients from receiving bad commands, and from your server revealing private data (MySQL root password) to untrusted hosts. For this to happen the client first talks to the server, and the server keeps it in a pending state. You then need to go onto the server and run a command to mark the client as safe. After that it will receive commands.</p>

<p>For this to happen firstly the time needs to be in sync between the boxes, and also the hostnames need to be the same on each (e.g. the master is master.home on both the master and client). As such you might need some <code>/etc/hostname</code> and <code>/etc/hosts</code> trickery.</p>

<h1>Installation</h1>

<p>Next up install the Puppet packages. Ubuntu versions lower than 11.10 have out of date versions, so don&#8217;t even bother installing those. If your host only provides images for older versions either <a href="http://www.linode.com/?r=d07359301288936c3ad67967a27fd2ed9384bc9c">move somewhere else</a> or upgrade the installation once you&#8217;ve got the box setup.</p>

<p>All commands should be run on root, those denoted <code>master</code> should be run on the master, and those denoted <code>client</code> should be run on any clients (simple eh?).</p>

<pre><code>master# apt-get update
master# apt-get install puppetmaster

client# apt-get update
client# apt-get install puppet
</code></pre>

<h1>Start the master</h1>

<p>When the mater is started it&#8217;ll generate it&#8217;s own certificate so make sure you have hostnames sorted by this point. Don&#8217;t worry if the directory you are deleting doesn&#8217;t exist, that it just to clear previously generated certificates.</p>

<pre><code>master# rm -Rf /var/lib/puppet ssl
master# puppetmasterd --verbose --logdest console --no-daemonize
</code></pre>

<h1>Start the client</h1>

<p>The same notes apply to the master as the client.</p>

<pre><code>client# rm -Rf /var/lib/puppet ssl
client# puppet agent --verbose  --logdest console --no-daemonize --server=master.home
</code></pre>

<p>After that, you should see the following on screen (as well as other stuff):</p>

<pre><code>Client:
info: Creating a new SSL certificate request for client.home
info: Certificate Request fingerprint (md5): 0A:7B:EB:BF:63:E5:CC:92:03:96:28:43:65:59:08:3C

Master:
notice: client.home has a waiting certificate request
</code></pre>

<h1>Verify client certificate</h1>

<p>Next you need to verfiy the clients certificate:</p>

<pre><code>master# puppet cert list
  client.home (0A:7B:EB:BF:63:E5:CC:92:03:96:28:43:65:59:08:3C)
master#  puppet cert sign client.home
  notice: Signed certificate request for client.home
  notice: Removing file Puppet::SSL::CertificateRequest client.home at '/var/lib/puppet/ssl/ca/requests/client.home.pem'
</code></pre>

<h1>After a while&#8230;</h1>

<p>The client automatically retries to connect to the master. You can either wait, or restart the process on the client. Then you should see this:</p>

<pre><code>Client:
info: Caching certificate for client.home
info: Caching certificate_revocation_list for ca
info: Caching catalog for client.home
info: Applying configuration version '1327959635'
info: Creating state file /var/lib/puppet/state/state.yaml
notice: Finished catalog run in 0.03 seconds

Master:
notice: Compiled catalog for client.home in environment production in 0.02 seconds
</code></pre>

<h1>Success</h1>

<p>After that you&#8217;ll want to daemonize the processes, which should just involve some <code>/etc/init.d</code> trickery. After that you are done! Puppet scripts go on <code>/etc/puppet</code> on the master.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[I've switched to Octopress!]]></title>
    <link href="http://www.stackednotion.com/blog/2011/11/02/ive-switched-to-octopress/"/>
    <updated>2011-11-02T20:34:00+00:00</updated>
    <id>http://www.stackednotion.com/blog/2011/11/02/ive-switched-to-octopress</id>
    <content type="html"><![CDATA[<p>Like most geeks in 2011, I&#8217;ve decided to make the switch to <a href="http://octopress.org/">Octopress</a>. Previously I was running a Wordpress installation that hadn&#8217;t been updated since early 2009 which I wasn&#8217;t too uneasy about. Plus I&#8217;ve also been meaning to consolidate a couple of servers for a while, and this makes it even easier as I don&#8217;t have to worry about moving the database. :)</p>

<p>At the moment I have imported all the posts and comments, however there are a few bits that need fixing. I need to go through all the posts at some point as images are broken and some of the formatting could be improved. Until then though, I&#8217;m afraid you&#8217;ll just have to suffer, so bear with me!</p>

<p>P.S. Apologies in advance in case anyone has any issues with the feed&#8230;</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Take Risks]]></title>
    <link href="http://www.stackednotion.com/blog/2011/10/22/take-risks/"/>
    <updated>2011-10-22T00:00:00+01:00</updated>
    <id>http://www.stackednotion.com/blog/2011/10/22/take-risks</id>
    <content type="html"><![CDATA[This is going to be a bit different from my normal technical musings, so if that isn&#8217;t your thing, you should probably just skip now and wait for my next article (most likely something Erlang related).

I like to thing that no matter how things are, you can always do better. As such I try and take every opportunity to broaden my horizons and learn something new. I&#8217;ve recently found Nerd Fitness, it is a Tim Ferris-esque fitness mixed with life improvement blog. This is a comment I left on the latest article <a href="http://nerdfitness.com/blog/2011/10/17/fail-more/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+NerdFitnessBlog+%28Nerd+Fitness+Blog%29">Fail More, Suck Less</a>:

<blockquote>
Great article! I like the idea of a fail folder (if anyone has a link to the article give me a shout); it reminds me of Rejection Therapy (http://rejectiontherapy.com/). I actually tried the perfect 10 thing earlier in the week because of Rejection Therapy:

I had been dragged along to a singles night and my mate was chatting to some girls who weren&#8217;t really my type. In most cases like this I usually just have a few too many beers and forget about my worries. This time I didn&#8217;t feel like getting drunk, and I also didn&#8217;t want to look like a loner standing at the side of the dance floor. As such I decided to just go and dance. There were a few other drunk people making fools of themselves so I figured I couldn&#8217;t do much worse. Also it definitely peeked up my mood.

After that a few girls came and joined us, you know the type that look real nice but just want the attention. I started dancing with one of them, then got talking and to my surprise she wasn&#8217;t the attention seeker I expected, she was actually a really nice girl. Anyway, it ended up with us exchanging numbers and agreeing to go out with me tonight, wish me luck!

I think the moral of this is that unless you take risks, nothing exciting is going to happen. Things are just going to stay the same as they are. If you take risks, even if you fail, you learn something, and next time you can use what you have learnt to improve.</blockquote>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Things that should work in IE that don't...]]></title>
    <link href="http://www.stackednotion.com/blog/2011/09/25/things-that-should-work-in-ie-that-dont/"/>
    <updated>2011-09-25T00:00:00+01:00</updated>
    <id>http://www.stackednotion.com/blog/2011/09/25/things-that-should-work-in-ie-that-dont</id>
    <content type="html"><![CDATA[For the first version of <a href="http://www.textjs.com/">TextJs</a> I &#8220;forgot&#8221; about Internet Explorer. I didn&#8217;t have a machine to easily test it on, and just wanted to get something out there to see whether the idea is worthwhile. I quickly soon got a complaint about this, so thought with the latest version I should fix that. I installed Windows 7 onto (into?) a virtual machine, here is what I got:

<a href="http://www.stackednotion.com/wp-content/uploads/2011/09/Screen-Shot-2011-09-25-at-16.25.03.png"><img src="http://www.stackednotion.com/wp-content/uploads/2011/09/Screen-Shot-2011-09-25-at-16.25.03.png" alt="" title="Screen Shot 2011-09-25 at 16.25.03" style="width: 550px" /></a>

Le sigh. I&#8217;m quite surprised that the Javascript works fine, but I&#8217;m using Backbone and jQuery for practically everything rather than rolling it myself, so that is probably why. The CSS though is a different story&#8230; I am also rather surprised about that as I thought Internet Explorer 8 was supposed to do a half decent job, I guess not. Below is what I discovered.

<b>&#8220;IE doesn’t believe in HTML 5 elements&#8221;</b>
Some of the CSS selectors applied to <i>header</i> tags, which IE doesn&#8217;t know about. As such it just ignores them. Adding the Javascript from <a href="http://html5doctor.com/how-to-get-html5-working-in-ie-and-firefox-2/">html5 doctor</a> solves that. This fixed the message date and hover-menu styling.

<b>Menu Highlighting</b>
This was actually my own fault rather than IE&#8217;s. I used the <a href="http://www.colorzilla.com/gradient-editor/">Ultimate CSS Gradient Generator</a> to generate the code for the gradients, and for certain elements wanted to override it. This was easy, I just needed <i>background: none</i> (e.g. to remove it). However I missed that it also generated IE specific <i>filter</i> code. I also needed <i>filter: none</i>. Next&#8230;

<b>Menu Dates</b>
Unlike the message dates, the menu dates weren&#8217;t fixed with the teaching-IE-about-HTML5 Javascript file. Again the CSS rules being ignored were on <i>header</i> tags, however for some reason these were still being ignored. I couldn&#8217;t figure this one out, so I just moved the rules to other tags. Meh.

<b>Box Shadow</b>
<a href="http://css3generator.com/">CSS3 Generator</a>, which I used for the other CSS3 effects didn&#8217;t supply a <i>filter</i> tag for the box shadow which IE supports, so this needed to be added:
<pre><code>
background: #fff;
filter: progid:DXImageTransform.Microsoft.Shadow(color='#d0d0d0', Direction=135, Strength=3);
</code></pre>
The background needs to be set, as unlike the CSS3 box shadow this also applies to any text on a transparent background. It also doesn&#8217;t support short hex colour codes, so <i>#d0d0d0</i> rather than <i>#ddd</i> needs to be specified as the colour.

<b>Border Radius</b>
IE (below 9) doesn&#8217;t support border radius without some nasty hacks, either from Javascript or <a href="http://msdn.microsoft.com/en-us/library/ms531018(v=vs.85).aspx">HTC files</a>. I&#8217;m not that fussed about them so I&#8217;ll give that a miss.

<b>Keyboard Shortcuts</b>
For keyboard shortcuts I used Thomas Fuchs&#8217; most excellent <a href="https://github.com/madrobby/keymaster">Keymaster</a>. This is great and works cross browser no problems. The only issue is that most of the keyboard shortcuts I have in TextJs default to a browser function. I solved this in most cases (it doesn&#8217;t work for Cmd-N on Chrome >_<) by calling the jQuery function <a href="http://api.jquery.com/event.preventDefault/">preventDefault</a> on the event. This however doesn&#8217;t work in IE.

Apparently this is the incorrect way to stop an event from firing the default action, however the solution is easy. <a href="http://fuelyourcoding.com/jquery-events-stop-misusing-return-false/">Just return false</a> from the event handler. I didn&#8217;t know about this before, and there are a few caveats (pointed out in the article), but for my use case this seems fine. It still doesn&#8217;t solve the Chrome issue though :-/

<b>Console</b>
I had a few mischievous <i>console.log</i>&#8217;s left in place which caused a few Javascript errors. That is fixed with this nifty line of Javascript:
<pre><code>
if (typeof console == "undefined" || typeof console.log == "undefined") var console = { log: function() {} };
</pre></code>
I decided to add this rather than removing them as I&#8217;m sure more will appear later, so I would rather be safe than sorry.

<b>Roundup</b>
And there we go, let&#8217;s hope IE 9 is better. The fonts still look rubbish, but that is just Windows. For comparison this is what it looks like on Chrome on OS X. Aaahhh.

<a href="http://www.stackednotion.com/wp-content/uploads/2011/09/Screen-Shot-2011-09-25-at-16.24.14.png"><img src="http://www.stackednotion.com/wp-content/uploads/2011/09/Screen-Shot-2011-09-25-at-16.24.14.png" alt="" title="Screen Shot 2011-09-25 at 16.24.14" style="width: 550px" /></a>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[TextJs: Now available on the Android Market]]></title>
    <link href="http://www.stackednotion.com/blog/2011/09/18/textjs-now-available-on-the-android-market/"/>
    <updated>2011-09-18T00:00:00+01:00</updated>
    <id>http://www.stackednotion.com/blog/2011/09/18/textjs-now-available-on-the-android-market</id>
    <content type="html"><![CDATA[Just a quick note to say that TextJs, my desktop SMS app, is <a href="https://market.android.com/details?id=org.stackednotion.textjs.rosebud">now available on the Android Market</a>!

If you need any help or support feel free to <a href="mailto:support@textjs.com">send me an email</a> or post a question in our <a href="http://getsatisfaction.com/textjs">Get Satisfaction group</a>!
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[How to setup log rotation for Rails apps]]></title>
    <link href="http://www.stackednotion.com/blog/2011/09/12/how-to-setup-log-rotation-for-rails-apps/"/>
    <updated>2011-09-12T00:00:00+01:00</updated>
    <id>http://www.stackednotion.com/blog/2011/09/12/how-to-setup-log-rotation-for-rails-apps</id>
    <content type="html"><![CDATA[I&#8217;m sure we&#8217;ve all been there. You&#8217;ve been tasked with fixing a Rails app, you go in for some debugging magic and find the <i>production.log</i> is 3GB and counting as nobody bothered to setup log rotation. Here is how to avoid that&#8230;

On Ubuntu machines (and I would guess most other Linux distributions) <i>logrotate</i> comes installed by default. To set it up, you just need to create a new config file in <i>/etc/logrotate.d/</i>, for example:

<pre><code>
$ cat /etc/logrotate.d/tweetedlinks-backend 
/var/www/TweetedLinks/current/log/*.log {
    compress
    copytruncate
    daily
    dateext
    delaycompress
    missingok
    rotate 90
}
</code></pre>

This tells it to rotate any logs with the <i>.log</i> extension in <i>/var/www/TweetedLinks/current/log/</i>. You don&#8217;t need to worry about permissions or restarting anything, just plonk that in a file and relax. Job done.

In case you were wondering, here are what all the options mean:
<ul>
<li><b>compress</b> - Compress rotated logs. <a href="http://swoolley.org/man.cgi/1/zgrep">zgrep</a> and <a href="http://swoolley.org/man.cgi/1/zcat">zcat</a> are your friends.</li>
<li><b>copytruncate</b> - Copy the log out of the way, and then truncate the existing logs. Some processes don&#8217;t handle log files being rotated, and will write logs to an empty file descriptor rather than the new log. This solves that.</li>
<li><b>daily</b> - Rotate logs daily.</li>
<li><b>dateext</b> - Add the date the logs were rotated as the extension rather than a number.</li>
<li><b>delaycompress</b> - Skip compressing the log until the following day. Apparently some processes don&#8217;t handle logs being rotated properly and will write to the wrong file descriptor - n.b. does this even have any effect with <i>copytruncate</i>?</li>
<li><b>missingok</b> - Don&#8217;t raise an error when there is a missing log file.</li>
<li><b>rotate 90</b> - Keep up to 90 days worth of logs. There doesn&#8217;t appear to be an option to not delete old logs, but you can just set this to a large number, like 36500 to keep 100 years of logs.</li>
</ul>

<b><a href="http://news.ycombinator.com/item?id=2988555">Discuss on Hacker News</a></b>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Testers Required]]></title>
    <link href="http://www.stackednotion.com/blog/2011/07/27/testers-required/"/>
    <updated>2011-07-27T00:00:00+01:00</updated>
    <id>http://www.stackednotion.com/blog/2011/07/27/testers-required</id>
    <content type="html"><![CDATA[<p>Over the past few weeks I have been working on an app which lets you send and receive SMS messages on your phone using your PC. I first started working on it over a ago but like most projects something more interesting came along (<a href="http://www.tweetedlinks.com/">Tweeted Links</a> I think :-p). After seeing a few other apps trying to solve this problem, and although having half-assed implemenatations getting quite a bit of traction, motivation set in and I decided to get back on this.</p>
<p>The original interface I had was Javascript based and ran in the browser. I quite liked this implementation as after you have downloaded an app to your phone, you don&#8217;t want to then have to download an app to your PC - and let&#8217;s not forget all the issues that come along with developing and maintaining a desktop app&#8230; The original version just used JQuery and some horrendous Javascript. I have now moved to using <a href="http://documentcloud.github.com/backbone/">BackboneJS</a> and CoffeeScript which I love working with. I&#8217;m using a custom version of <a href="https://github.com/tdreyno/middleman/">Middleman</a> and a watchfile (based on work by <a href="http://twitter.com/pusewicz">@pusewicz</a>) to build everything automagically which works a treat. I&#8217;ll put up a post about this later on as it really simplifies development. The interface has gone under a major Lion-esque overhaul as well - if you follow me on Twitter you will have probably seen the screenshots.</p>
<p>Anyway, on to the purpose of this post&#8230; I am just finishing up and over the weekend want to get it out to some real people to test. This is the first alpha release so I am expecting testers to give me feedback on their experiences. Requirements other than this are simple&#8230; you just need a phone running Android 2.1+. Interested? Leave a comment and I&#8217;ll be in contact!</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Dear Google, what's going on?]]></title>
    <link href="http://www.stackednotion.com/blog/2011/06/29/dear-google-whats-going-on/"/>
    <updated>2011-06-29T00:00:00+01:00</updated>
    <id>http://www.stackednotion.com/blog/2011/06/29/dear-google-whats-going-on</id>
    <content type="html"><![CDATA[I don&#8217;t know how long this has been going on for, but I first noticed it about a month ago. Certain tube stations in London have non-English names on Google Maps. I haven&#8217;t actually visited them, so they could have been renamed as far as I know&#8230; I would have thought I would have read about it in The Metro at least.

<center>
<img class="aligncenter size-full wp-image-355" title="Screen shot 2011-06-29 at 19.00.51" src="http://www.stackednotion.com/wp-content/uploads/2011/06/Screen-shot-2011-06-29-at-19.00.51.png" alt="" width="204" height="115" />
White City.

<img class="aligncenter size-full wp-image-354" title="Screen shot 2011-06-29 at 18.59.55" src="http://www.stackednotion.com/wp-content/uploads/2011/06/Screen-shot-2011-06-29-at-18.59.55.png" alt="" width="205" height="121" />
Victoria.

<img class="aligncenter size-full wp-image-357" title="Screen shot 2011-06-29 at 19.07.44" src="http://www.stackednotion.com/wp-content/uploads/2011/06/Screen-shot-2011-06-29-at-19.07.44.png" alt="" width="215" height="134" />
Southwark.
</center>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[My Problems]]></title>
    <link href="http://www.stackednotion.com/blog/2011/05/28/my-problems/"/>
    <updated>2011-05-28T00:00:00+01:00</updated>
    <id>http://www.stackednotion.com/blog/2011/05/28/my-problems</id>
    <content type="html"><![CDATA[<ul>
	<li>I have to use different applications on different platforms to communicate with people. There is no fully integrated cross platform messaging system. I may SMS one person, and then later talk to them on GTalk, or maybe send them an email if there is something a bit longer than can fit in an SMS. For each of these I need to use a different application (SMS, Adium / IMO, GMail), and more often than not a different application on each platform. Isn&#8217;t this what XMPP was supposed to solve?</li>
	<li>Producing admin interfaces for web applications is a pain. More often than not it is it&#8217;s own project in itself. <a href="https://github.com/sferik/rails_admin/">Rails Admin</a> looks promising (for Rails applications), but it still seems a bit bizarre for something that usually has the same basic features for each project, it needs to be reinvented over and over again. Understandably there is some customisation, e.g. branding, but most of the time the basic features repeated over and over are just an ACL and CRUD.</li>
</ul>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Feeling Relieved]]></title>
    <link href="http://www.stackednotion.com/blog/2011/05/22/feeling-relieved/"/>
    <updated>2011-05-22T00:00:00+01:00</updated>
    <id>http://www.stackednotion.com/blog/2011/05/22/feeling-relieved</id>
    <content type="html"><![CDATA[So the other day, after maybe a couple too many beers, I left my bag on the bus. Said bag contained my phone and laptop among other non-important things. Luckily it was all insured, but it&#8217;ll probably be a good few weeks before I have replacements from the insurance company.

I am slightly bummed about it, but really nothing (other than the physical devices) has really been lost. Everything I do either happens in the cloud e.g. email, or is pushed to the cloud e.g. coding. The next day when I was in work I got a few peoples numbers from Gmail who I needed to contact, then sent them an SMS over Skype to let them know I would get back to them later. I then got my temporary phone setup and updated my number on Facebook, so anyone who syncs with that would instantly have my new number. I could have just as easily done this from an internet café in some foreign country.

My backup plan for my laptop is the same, non-existant (Time Machine bugs me every couple of weeks that I haven&#8217;t backed up for a couple of hundred days). The thing is though, I don&#8217;t need to backup. I do everything is in the cloud.

(Admittedly though a few things were lost, for example game progress and a couple of rubbish photos - the good ones were posted to Twitter before hand - but everything that mattered to me was available instantly.)
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[New features on Tweeted Links]]></title>
    <link href="http://www.stackednotion.com/blog/2011/05/13/new-features-on-tweeted-links/"/>
    <updated>2011-05-13T00:00:00+01:00</updated>
    <id>http://www.stackednotion.com/blog/2011/05/13/new-features-on-tweeted-links</id>
    <content type="html"><![CDATA[Over the last couple of weeks I&#8217;ve been implementing a few new features on Tweeted Links. I actually released them last week, but forgot to write up a follow-up post :)

<img src="http://www.stackednotion.com/wp-content/uploads/2011/05/Screen-shot-2011-05-13-at-11.48.22.png" alt="" title="Screen shot 2011-05-13 at 11.48.22" width="400" class="aligncenter size-full wp-image-326" />

First of all there is a new design. The old one was hacked together in about 5 minutes, so this is kind of a relief. It was made by my old friend <a href="http://www.jamesdeerdesign.com/">James Deer</a> for a project we worked on together a few years ago, but never got around to finishing. It looks a lot friendlier than the old design, so hopefully people won&#8217;t be scared off it anymore.

<img src="http://www.stackednotion.com/wp-content/uploads/2011/05/Screen-shot-2011-05-13-at-12.04.42.png" alt="" title="Screen shot 2011-05-13 at 12.04.42" width="400" height="316" class="aligncenter size-full wp-image-334" />

Next up, it now separates different types of links, so articles are separated from pictures and music.  This is probably the biggest new feature for me in this release, as before you were inundated with links and didn&#8217;t really know too well what they were. Previews are shown for pictures as well which I quite like. I&#8217;m looking to extend this for other media types as well, for example checkins and videos. If you have any other requests let me know!

There have also been a couple of changes behind the scenes, link expanding for example is a lot more robust than it was before (old links have been reprocessed), so more articles should be picked up. I&#8217;m currently working on rewriting the Tweet fetcher to use the streaming API, so that new links will appear near enough at the same time as they are posted to Twitter. I am also going to add pagination (of some sort, I&#8217;m thinking infinite scrolling) to the list of links, as some people have quite a lot of links. <a href="http://tweetedlinks.com/lucaspiller/images">My list of images</a>, for example, takes quite a while to load and for the browser to render.

I&#8217;m still wondering where to take this in the future, so I am open to any suggestions or requests you may have! One thing I was thinking of doing was making the link expander and detail fetcher thingy (I need someone to explain that in a marketing way) publicly accessible, if something like this had existed in the first place I wouldn&#8217;t really have to have built Tweeted Links!
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Facebook Apps Primer]]></title>
    <link href="http://www.stackednotion.com/blog/2011/03/04/facebook-apps-primer/"/>
    <updated>2011-03-04T00:00:00+00:00</updated>
    <id>http://www.stackednotion.com/blog/2011/03/04/facebook-apps-primer</id>
    <content type="html"><![CDATA[I was interested in how the flow of Facebook apps work and the interactions a user can make. This presentation is the results :)

<iframe src="https://docs.google.com/present/embed?id=ajh57dctftcs_226hj6mgtdf&size=m" frameborder="0" width="555" height="451"></iframe>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Designing Android Interfaces]]></title>
    <link href="http://www.stackednotion.com/blog/2011/03/02/designing-android-interfaces/"/>
    <updated>2011-03-02T00:00:00+00:00</updated>
    <id>http://www.stackednotion.com/blog/2011/03/02/designing-android-interfaces</id>
    <content type="html"><![CDATA[One of the issues that has started to annoy me as Android has started to game momentum commercially is that a lot of Android apps are just a copy of the iPhone application. This issue occurs on iOS as well, as a lot of iPad (compatible) apps are just scaled up iPhone apps, however this is a really bad practice. Android has a lot of different ways for users to interact with an application compared to iOS (physical buttons and sometimes even a physical keyboard), and developers should really take advantage of these. This isn&#8217;t really helped by the fact that there isn&#8217;t really any good first party documentation on standard design patterns used in Android.

Over the last week I have been working on creating a nice interface for an Android application I am working on. I have had absolutely no design experience before (that is worth mentioning, anyway), however I have wanted to learn so I thought this would be a good opportunity. I have spent a lot of time researching Android design patterns and come across a few nice tools and resources, so hopefully this will help avoid the issue Android apps being blatant copies of iPhone apps in the future.

<strong>Android Patterns</strong>
<a href="http://www.androidpatterns.com/">http://www.androidpatterns.com/</a>

I don&#8217;t know how I haven&#8217;t come across this before, but speaking to other Android fanbois I am not the only one. Android Patterns is a wiki providing a nice graphical overview of interaction patterns on Android. This is very much aimed at designers, so if you are are designing your first Android application (especially if moving from iOS) this is a must-read!

<strong>Android UI Design Patterns</strong>
<a href="http://www.androiduipatterns.com/"> http://www.androiduipatterns.com/</a>

This site provides a nice review of the patterns used in popular applications. It provides a nice critical review, so it is easy to see what worked and what didn&#8217;t. The site seems to be quite new, however it is being updated quick regularly at the moment. Hopefully this will continue, there are quite a few apps I would like to see reviewed.

<strong>Pencil + Android templates</strong>
Pencil app: <a href="http://pencil.evolus.vn/">http://pencil.evolus.vn/</a>
Android templates: <a href="http://code.google.com/p/android-ui-utils/">http://code.google.com/p/android-ui-utils/</a>

Pencil is a nice user interface design tool, that runs inside Firefox (euggh&#8230;). It is quite easy to use, especially if you aren&#8217;t a Photoshop expert like me. I expect there are Photoshop templates for Android same, but I liked this as it was easy to learn. Last night I managed to design a couple of screens in less than half an hour, it is definitely a lot nicer to see the actual mockup rather than messing about with an XML template to try and get something looking nice. Also DroidDraw just isn&#8217;t worth the effort (sorry!), compared to this.

That&#8217;s about it for now, I&#8217;ll try and keep this updated as I find new resources. If you have any that you think would be useful feel free to post them in the comments.
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Agile development in a team of one]]></title>
    <link href="http://www.stackednotion.com/blog/2010/12/11/agile-development-in-a-team-of-one/"/>
    <updated>2010-12-11T00:00:00+00:00</updated>
    <id>http://www.stackednotion.com/blog/2010/12/11/agile-development-in-a-team-of-one</id>
    <content type="html"><![CDATA[The other day at work we were discussing something that I expect the majority of developers feel. When working on your personal projects, you <strong>never seem to finish anything</strong>. Fortunately one of the guys came up with an answer that he used to get <a href="http://www.likumobile.com/">his app</a> out of the door: Do what you do at work, <strong>use agile</strong>!

It seems he isn&#8217;t the only one, a quick search turned up a few related posts:
<ul>
	<li><a href="http://www.21apps.com/agile/doing-agile-in-a-team-of-one/">Doing Agile in a Team of One</a></li>
	<li><a href="http://www.builderau.com.au/strategy/projectmanagement/soa/Agile-programming-works-for-the-solo-developer/0,339028292,320267171,00.htm">Agile programming works for the solo developer</a></li>
	<li><a href="http://accidentaltechnologist.com/programming/what-aspects-of-agile-software-development-are-working-for-soloists/">What Aspects of Agile Software Development are Working for Soloists?</a></li>
	<li><a href="http://stackoverflow.com/questions/829497/agile-methods-specifically-taylored-to-working-solo">Agile Methods Specifically taylored to working solo?</a></li>
</ul>
One of the things to bear in mind with agile is that you should <strong>be pragmatic about it</strong>, don&#8217;t follow everything by the book but do what works for you. There isn&#8217;t really any point in having a standup by yourself, however it is probably a good idea to <strong>be clear what your targets for the day are</strong>.

I&#8217;m going to try this with my next project, a rewrite of <a href="http://www.stackednotion.com/2010/08/11/tweeted-links-an-introduction-and-a-review">Tweeted Links</a> (that I have been procrastinating about for a few months). Thinking about it, I guess <strong>agile methodologies could be used for all sorts of projects</strong>, not just developing software. Maybe I&#8217;ll use it for my next DIY task?
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[What I'm running on my Nexus One]]></title>
    <link href="http://www.stackednotion.com/blog/2010/11/10/what-i%27m-running-on-my-nexus-one/"/>
    <updated>2010-11-10T00:00:00+00:00</updated>
    <id>http://www.stackednotion.com/blog/2010/11/10/what-i&#8217;m-running-on-my-nexus-one</id>
    <content type="html"><![CDATA[Just for future reference, here is what software I&#8217;m running on my Nexus One:
<ul>
	<li><a href="http://forum.cyanogenmod.com/topic/2326-cyanogenmod-61-for-nexus-one-holy-crap-its-full-of-awesome-v610-rc1-10272010/">Cyanogen Mod (6.1.0 RC1</a>)</li>
	<li><a href="http://forum.xda-developers.com/showthread.php?t=653598">intersectRaven&#8217;s Kernel (20101107)</a></li>
</ul>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Tweeted Links: An introduction, and a review]]></title>
    <link href="http://www.stackednotion.com/blog/2010/08/11/tweeted-links-an-introduction-and-a-review/"/>
    <updated>2010-08-11T00:00:00+01:00</updated>
    <id>http://www.stackednotion.com/blog/2010/08/11/tweeted-links-an-introduction-and-a-review</id>
    <content type="html"><![CDATA[If you follow me on Twitter you have most likely seen my rants about my new service, <a href="http://tweetedlinks.com/">Tweeted Links</a>. The method behind the madness of it is basically this: I post a lot of links to Twitter, and often want to revisit them at a later time. I usually don&#8217;t Tweet anything meaningful with them that will help searching (e.g. KK) and usually shorten the URLs. Tweeted Links solves that problem! It keeps the links in a single location (a la del.icio.us) and fetches the title of the page. It also solves the problem of shortened URLs by attempting to expand those too.

Another big point that I rather liked about it, was that from design, through development to deployment it took about 6 hours to get the first release out! I fixed a few bugs a couple of days later, so there has altogether been about 8 hours work put into it. Not too shabby, for something useful! I decided to use something new to build it, so used the <a href="http://monkrb.com/">Monk &#8216;glue&#8217; framework</a> which by default combines Sinatra, Ohm and Redis. It is a pretty nice system, however like most Ruby software the default skeletons (and at least the ones mentioned on the site) are rather opinionated. I myself prefer Bundler however none of them had this for dependency management. I wouldn&#8217;t have thought it would be terribly difficult to have a nice system that lets you add or remove different gems from the skeleton so you can customise it to your liking, that would be a nice feature for a future revision of the website. I then rounded it up with running on Ruby 1.9.2 and Unicorn.

In terms of actually using the tools, I have used Sinatra before and played around with Redis and Ohm a bit, however for those I mainly relearnt everything I (thought I) knew. This was the first time I had properly used a key-value storage engine, so something things were a bit strange. As an example I wanted to &#8216;expire&#8217; old users after 6 hours so that their statuses would be refetched. In SQL this is dead simple, however how to replicate that in Redis? In the end I ended up fetching all the records and comparing the created_at field in code, I have doubts this is the optimum solution however&#8230;.

I also had a few teething problems that went unnoticed (for about 15 days &gt;_&lt;) which I recently resolved. I&#8217;m not sure what happened however the expiry daemon just stopped working, even restarting it didn&#8217;t help. In the end I restarted Redis which sorted it, so I&#8217;m not sure what was to blame there. <a href="http://twitter.com/johnno_uk">JNo</a> was the last user to be added to the system, so I blame him. Everything seems to be working again now, at least for a while&#8230;.

Another major problem (which I still haven&#8217;t resolved) is an issue with the Twitter search. Certain users just return no search results. The first user I found with this was the BBC News Twitter account, it had over 70,000 tweets so I thought maybe the search just didn&#8217;t index large accounts. However I then found a few more accounts that only had a couple of hundred tweets. I still haven&#8217;t got this resolved, mainly because I have yet to ask for help from the gods of Twitter :P

So that about sums up Tweeted Links. I&#8217;m quite happy with the results so far, and am looking to expand it a bit further when I get time (I&#8217;m currently focussing on some Android work, which I&#8217;m sure there will be a few posts on over the next couple of weeks). I expect I will probably rewrite the system from scratch though, as to be honest, I&#8217;m not really too happy about how this key-value stuff has worked out so far. The rewrites will also involve some big data restructuring, so I don&#8217;t think it is a bad time to do so. Back to MySQL I say, yep I just said no to NoSQL!
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Unicorns and Rainbows]]></title>
    <link href="http://www.stackednotion.com/blog/2010/07/22/unicorns-and-rainbows/"/>
    <updated>2010-07-22T00:00:00+01:00</updated>
    <id>http://www.stackednotion.com/blog/2010/07/22/unicorns-and-rainbows</id>
    <content type="html"><![CDATA[Last week I gave what we call a &#8220;Munch &#8216;n&#8217; Watch&#8221; at work. If anyone comes across a new technology they like the look of, over lunch they give a presentation about it. I have been playing with the <a href="http://unicorn.bogomips.org/">Unicorn server</a> recently, and I am using it to serve one of my <a href="http://www.tweetedlinks.com/">side projects</a>.

<iframe src="http://docs.google.com/present/embed?id=ajh57dctftcs_221gsvk4ff5&size=m" frameborder="0" width="555" height="451"></iframe>

It is also available as a <a href='http://www.stackednotion.com/wp-content/uploads/2010/07/Unicorns_and_Rainbows_Munch_And_Watch.pdf'>PDF version</a>.

(On a side note I have been using Google Docs for everything recently. The number of features has grown enormously since I first tried it out. No more Open Office. Yay!)
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[What are BFS and CFS?]]></title>
    <link href="http://www.stackednotion.com/blog/2010/06/04/what-are-bfs-and-cfs/"/>
    <updated>2010-06-04T00:00:00+01:00</updated>
    <id>http://www.stackednotion.com/blog/2010/06/04/what-are-bfs-and-cfs</id>
    <content type="html"><![CDATA[A couple of weeks ago I was browsing the XDA Developers forums looking at custom kernels for my Nexus One. I came across a kernel that looked good, however I was a bit confused about the two different versions on offer. One was called BFS and the other CFS. At the time I must have been having a bit of a blonde moment as the two acronyms completely passed me by&#8230;..

BFS and CFS are both different types of task schedulers used by the Linux kernel. CFS (Completely Fair Scheduler) is the default scheduler in the majority of distributions, however it isn&#8217;t though to be great.  I won&#8217;t go into the details, however being relatively old it has built up quite a lot of bulk and the algorithms used are rather complicated.

BFS (Brain Fuck Scheduler) is the new kid on the block. It was written in 2007 after the author became annoyed with the random stalls experienced while using a Linux-based desktop machine. The scheduler is designed to offer low latency when used interactively, for example on a desktop machine, or a phone!

As stated latency is usually reduced, and random stalls should be reduced. However BFS also has another trick up its sleeve. In benchmarks it performed 80% better when encoding a video in x264 format!

BFS however isn&#8217;t (yet) going to make your Linux based systems super fast. Benchmark results are rather mixed, and discussions around it are rather heated. It is not currently included in the mainline Linux tree, and doesn&#8217;t look likely to be included anytime soon.

Either way, if you want to try it on your Android device, it is a quick flash away. Cyanogen Mod includes it by default, and there are plenty of different kernels out there you can try. Go ahead and try it, YMMV!
 
<b>Further reading</b>
<ul>
<li>
<a href="http://ck.kolivas.org/patches/bfs/sched-BFS.txt">BFS - The Brain Fuck Scheduler by Con Kolivas</a> - An introduction by the author
</li>
<li>
<a href="http://ck.kolivas.org/patches/bfs/bfs-faq.txt">FAQS about BFS</a> - More details
</li>
<li>
<a href="http://x264dev.multimedia.cx/?p=185">Open source collaboration done right</a> - Thoughts of a codec developer on BFS
</li>
</ul>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[ext4 options for a media drive]]></title>
    <link href="http://www.stackednotion.com/blog/2010/05/25/ext4-options-for-a-media-drive/"/>
    <updated>2010-05-25T00:00:00+01:00</updated>
    <id>http://www.stackednotion.com/blog/2010/05/25/ext4-options-for-a-media-drive</id>
    <content type="html"><![CDATA[At the moment I am reinstalling my desktop PC, and setting it up to be a media server / HTPC. One of the things that has baffled me is the best options to use for ext4 on the media partition. A quick search revealed nothing definite, hence this post. It is mainly as a reminder for when I reinstall (although I&#8217;ll probably use brtfs when it is more stable), however hopefully someone else will find it useful!


<b>Intro</b>
I have a 1TB drive which I use as a media drive. I currently have it partitioned as follows:
<code><pre># fdisk /dev/sdb -l

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xffffffff

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1         608     4883728+  83  Linux
/dev/sdb2             609      121601   971876272+  8e  Linux LVM
</pre></code>

Yeah nothing fancy, a small 5GB partition at the start and the rest setup in LVM. The small partition is to serve as a simple recovery partition if I want to access the contents of the drive on another OS; I can do so just by booting that up in a virtual machine. 5GB is probably a bit big, however it isn&#8217;t as if space is scarce.

In terms of LVM I just have a volume taking up the full size of the disk:
<code><pre># lvdisplay
  --- Logical volume ---
  LV Name                /dev/vg/media
  VG Name                vg
  LV UUID                2OJIN6-sAx8-KRIz-SNvl-RU0I-2Xgl-nzUH4V
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                926.85 GiB
  Current LE             237274
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0
</pre></code>

I have previously setup different partitions for certain things, however in the end that just got a pain when one partition got too small. This setup kind of defeats the point of LVM, however if I want another partition (e.g. to dual boot) or to add another disk I can easily do so.

<img src="http://www.stackednotion.com/wp-content/uploads/2010/05/default.aspx_.jpeg" alt="" title="default.aspx" width="499" height="374" class="aligncenter size-full wp-image-274" />

<b>ext4</b>
Using the default options, on the face of it, ext4 doesn&#8217;t provide any significant advantages over ext3, or even ext2 when used for a media drive. However there are some nice features behind the scenes:

<ul>
<li>Larger maximum filesystem size (ext3 is limited to 16TB)</li>
<li>Extents (a set of contiguous blocks; improves performance and leads to decreased fragmentation)</li>
<li>Multiblock allocation (as opposed to single block allocation; improves write performance for large files)</li>
<li>Delayed allocation (doesn&#8217;t write the file to disk immediately, waiting until more of the file is in the cache, and then allocating a larger number of blocks; leads to decreased fragmentation)</li>
<li>Faster fsck (Try running fsck on a 1TB ext2 volume ^_^)</li>
<li>Persistant preallocation (Reserves a large number of blocks, which aren&#8217;t going to be used yet but will be at some point; on par with what modern P2P applications do by filling a file with zeros, however implemented into the filesystem so much more efficient)</li>
</ul>

A good introduction to ext4 (which these were taken from) is the <a href="http://kernelnewbies.org/Ext4">ext4 article on Kernel Newbies</a>.

<b>Creating the filesystem</b>

The options for mkfs.ext4 are basically unchanged from ext3, in order to enable the high performance options most of the work will be done in tune2fs and mount options. Even so for now

<code><pre>

</pre></code>

The b option sets the block size (this will most likely default to 4096 bytes), the M options set the percentage of space reserved for the super user, and the L option sets the filesystem label. This command shouldn&#8217;t take more than a couple of minutes to run.

<img src="http://www.stackednotion.com/wp-content/uploads/2010/05/funny-pictures-kitten-erases-your-hard-drive.jpeg" alt="" title="funny-pictures-kitten-erases-your-hard-drive" width="400" height="300" class="aligncenter size-full wp-image-276" />

<b>Optimising</b>

Next up is to pass some options to tune2fs to enable the advanced features. These options could have been passed to the previous command, however to easily explain they have been listed separated. You can also run this command to upgrade an existing ext3 file system. A lot of these are enabled by default, however they are listed here for completeness sake.

<ul>
<li>has_journal - Enables the ext4 journal</li>
<li>extent - Enables extents (see above)</li>
<li>huge_file - Enables files over 2GB in size</li>
<li>flex_bg - Allows inode metadata to be placed anywhere on the partition (as opposed to traditionally at the start)</li>
<li>uninit_bg - Enables new blocks to not be initialised and enables block checksumming. Significantly speeds up creation and fsck</li>
<li>dir_nlink - Enables unlimited sub directories</li>
<li>dir_index - Enables a hashed B-tree for linking subdirectories</li>
<li>extra_isize - Enables nanoseconds to be stored in timestamps</li>
</ul>

<code><pre>
# tune2fs -O has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,dir_index,extra_isize /dev/vg/media 
tune2fs 1.41.12 (17-May-2010)
</pre></code>

As this just enables various options on the file system it will execute rather quickly, especially if the file system is empty. Note that if you are migrating an existing partition, most of these options will only apply to newly created files.

<b>Mount options</b>

The real killer performance can be obtained by setting certain mount options. Note that these seriously increase the likelihood of corruption if a system crash occurs, however in the case of a media drive, where there are a limited number of writes, I don&#8217;t feel that this is an issue.

<ul>
<li>barrier=0 - Disables a protection option that ensures everything is written to the journal before being committed, however decreases performance by ~30%; this is the default on the majority of systems</li>
<li>commit=60 - Only commits the journal to disk every 60 seconds</li>
<li>noatime - Disables the access time attribute which causes the metadata to be updated every time a file is accessed</li>
<li>data=writeback - Enables journaling of metadata only; can cause files to become corrupt if a system crash occurs</li>
<li>journal_async_commit - Write the journal to disk asynchronously</li>
</ul>

These can be set in your /etc/fstab, e.g.:

<code><pre>/dev/vg/media	/media	ext4	defaults,user,barrier=0,commit=60,noatime,data=writeback,journal_async_commit	0	0
</pre></code>

So thats it! If you find any other options that you deem useful, feel free to post them in the comments!
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Back to my roots]]></title>
    <link href="http://www.stackednotion.com/blog/2010/05/10/back-to-my-roots/"/>
    <updated>2010-05-10T00:00:00+01:00</updated>
    <id>http://www.stackednotion.com/blog/2010/05/10/back-to-my-roots</id>
    <content type="html"><![CDATA[Over the last couple of months I&#8217;ve been feeling there is something I&#8217;m lacking in life. Well actually there is quite a lot I&#8217;m lacking: a porsche, a fancy studio flat and a posh cat are just to name a few. But yeah, anyway in case you didn&#8217;t realise I am a developer. I love writing code, and I have a pretty cushy job that lets me do so with a certain amount of freedom. Even so, the stuff I am working on isn&#8217;t my own: I think that I am missing something which I can call my own. After one of the guys at work got his <a href="http://www.likumobile.com/">app published in the App Store</a>, I have felt it even more so.

<a href="http://www.flickr.com/photos/pokeweed/534123146/"><img src="http://www.stackednotion.com/wp-content/uploads/2010/05/posh-lolcat.jpeg" alt="" title="posh-lolcat" width="375" height="500" class="alignnone size-full wp-image-254" /></a>

So I have decided to start work again on an old project. I first started on this around 2003 (I think), and <a href="http://www.stackednotion.com/2009/08/26/new-project-ysflight-organiser">started on a rewrite</a>  in August last year. This was mainly to have something fancy to put on my CV, and at that time I thought I would be working in C# (I managed to dodge that one nicely!).

At the moment there isn&#8217;t much to show, it is nicely summed up in the previous post, and as always, there is <a href="http://github.com/lucaspiller/ysflight-organiser">a GitHub page</a> to get the codez. I don&#8217;t know really why I am starting on this project, and I don&#8217;t even have a machine to code it on (I use a Mac mainly nowadays). However, there is <a href="http://www.yspilots.com/yspf/viewtopic.php?f=7&t=2656">some interest from the community</a>, and as when I first started back in &#8216;03 there is still a need for this tool. Hopefully this time around with less tension!
]]></content>
  </entry>
  
</feed>

