<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" xml:lang="en-gb"><title type="text">Barking Iguana</title>
<subtitle type="text">Tests are for life, not just when you feel like it</subtitle>

<link rel="alternate" type="text/html" href="http://barkingiguana.com/?source=feed" />
<id>tag:barkingiguana.com,2005:49231934267467cd6f9473e1d60d3904</id>
<generator uri="http://textpattern.com/" version="4.0.5">Textpattern</generator>
<updated>2010-03-08T21:21:16Z</updated>
<author>
		<name>Craig Webster</name>
		<email>craig@barkingiguana.com</email>
		<uri>http://barkingiguana.com/</uri>
</author>
<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/BarkingIguana" /><feedburner:info uri="barkingiguana" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry>
		<author>
			<name>Craig Webster</name>
		</author>
		<published>2010-03-03T17:31:02Z</published>
		<updated>2010-03-08T15:12:34Z</updated>
		<title type="html">Creating a new Subversion branch from an existing local Git branch</title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BarkingIguana/~3/bD4pclTa1eY/creating-a-new-subversion-branch-from-an-existing-local-git-branch" />
		<id>tag:barkingiguana.com,2010-03-03:49231934267467cd6f9473e1d60d3904/bf4f84ebdd16ed391e31a30faf308c2f</id>
		<category term="Version-Control" />
		
		<summary type="html">
&lt;p&gt;When I'm coding I frequently have to work with Subversion repositories. I'm a Git user, so I use &lt;code&gt;git-svn&lt;/code&gt; for this. Usually I do my work in local branches, using a fairly regular Git workflow, then checkout the integration branch, merge in my changes and &lt;code&gt;git svn dcommit &lt;/code&gt; to push the code to Subversion.&lt;/p&gt;

&lt;p&gt;Sometimes however I need to share changes that I've made on an existing local branch in my Git repository with a Subversion user before they're ready to integrate back into the mainline. It takes me a while to hunt down and work out exactly what to do whenever I want to do this, so here are the instructions for my future reference. Hopefully they help you too.&lt;/p&gt;

&lt;pre&gt;&lt;code class="bash"&gt;git checkout master
git svn branch &amp;lt;new_svn_branch_name&amp;gt;
git svn fetch
git branch -r # make sure &amp;lt;new_svn_branch_name&amp;gt; exists
git checkout -b tmp/svn-rebase-target &amp;lt;new_svn_branch_name&amp;gt;
git rebase --onto tmp/svn-rebase-target master &amp;lt;existing_git_branch_name&amp;gt;
# That should have checked out &amp;lt;existing_git_branch_name&amp;gt;.
git svn dcommit -n # This should say it'll commit to &amp;lt;new_svn_branch_name&amp;gt;.
git branch -D tmp/svn-rebase-target # clean up the temporary branch.
git svn dcommit&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This time mainly I used comments on a blog post that asked how to do this. Thanks &lt;a href="http://blog.venthur.de/2009/02/27/git-svn-branch/#comment-132890"&gt;Björn Steinbrink&lt;/a&gt; and &lt;a href="http://blog.venthur.de/2009/02/27/git-svn-branch/#comment-132911"&gt;Cameron&lt;/a&gt;.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/BarkingIguana/~4/bD4pclTa1eY" height="1" width="1"/&gt;</summary>

<category term="git" />
<feedburner:origLink>http://barkingiguana.com/2010/03/03/creating-a-new-subversion-branch-from-an-existing-local-git-branch?source=feed</feedburner:origLink></entry>
<entry>
		<author>
			<name>Craig Webster</name>
		</author>
		<published>2010-03-02T11:04:21Z</published>
		<updated>2010-03-02T11:04:21Z</updated>
		<title type="html">Installing the MySQL gem on OSX 10.6 (Snow Leopard) with MacPorts MySQL5</title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BarkingIguana/~3/Uhe9qEPlX5w/installing-the-mysql-gem-on-osx-106-snow-leopard-with-macports-mysql5" />
		<id>tag:barkingiguana.com,2010-03-02:49231934267467cd6f9473e1d60d3904/9d924b65452474cc3c950132ae1fa7f9</id>
		<category term="Systems" />
		<category term="Software" />
		<summary type="html">
&lt;p&gt;Took a while to work this command out. Hopefully it can save someone else some time.&lt;/p&gt;

&lt;pre&gt;&lt;code class="bash"&gt;sudo port install mysql5-server
sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql--config=/opt/local/bin/mysql_config5&lt;/code&gt;&lt;/pre&gt;
&lt;img src="http://feeds.feedburner.com/~r/BarkingIguana/~4/Uhe9qEPlX5w" height="1" width="1"/&gt;</summary>

<category term="snippets" />
<category term="ruby" />
<feedburner:origLink>http://barkingiguana.com/2010/03/02/installing-the-mysql-gem-on-osx-106-snow-leopard-with-macports-mysql5?source=feed</feedburner:origLink></entry>
<entry>
		<author>
			<name>Craig Webster</name>
		</author>
		<published>2010-02-23T12:20:11Z</published>
		<updated>2010-02-23T12:25:35Z</updated>
		<title type="html">London Tech Meetups</title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BarkingIguana/~3/ripH84iithM/london-tech-meetups" />
		<id>tag:barkingiguana.com,2010-02-23:49231934267467cd6f9473e1d60d3904/755476d833c7503d2d36a16bea26d045</id>
		
		
		<summary type="html">
&lt;p&gt;It can be quite hard to find groups in your area that share your interest, and even if you find out that they exist it can be pretty hard to work out when the next meetup is. Some of the meetup groups have frankly &lt;em&gt;mental&lt;/em&gt; scheduling rules.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://johnstewartsutherland.com/"&gt;John Sutherland&lt;/a&gt; has solved this problem for &lt;a href="http://edinburgh2.com/"&gt;Edinburgh tech community meetups&lt;/a&gt; by listing when various groups meet and who they'd be of interest to. After asking and receiving permission I've duplicated this idea for &lt;a href="http://london2.org/"&gt;London tech community meetups&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If your meetup isn't listed and you'd like it to be, email me at &lt;a href="http://barkingiguana.com/mailto:craig@barkingiguana.com"&gt;craig@barkingiguana.com&lt;/a&gt; and let me know.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/BarkingIguana/~4/ripH84iithM" height="1" width="1"/&gt;</summary>

<category term="london" />
<category term="meetup" />
<feedburner:origLink>http://barkingiguana.com/2010/02/23/london-tech-meetups?source=feed</feedburner:origLink></entry>
<entry>
		<author>
			<name>Craig Webster</name>
		</author>
		<published>2010-02-17T17:49:37Z</published>
		<updated>2010-02-17T17:49:37Z</updated>
		<title type="html">Decoupling Nagios Host and Service check events for fun and profit</title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BarkingIguana/~3/zWOmhsboa4A/decoupling-nagios-host-and-service-check-events-for-fun-and-profit" />
		<id>tag:barkingiguana.com,2010-02-17:49231934267467cd6f9473e1d60d3904/b7835ebb3e2096cfe89dcdee35cc9322</id>
		<category term="Monitoring" />
		<category term="Systems" />
		<summary type="html">
&lt;p&gt;Nagios does a pretty good job of watching over my services and hosts, but I want to do a little more with the events it creates &amp;#8211; when it checks a service and something is wrong, or when something recovers. In particular I want to give my clients the ability to select at an incredibly high resolution what sort of notifications they get, for what services, how often, and at what level of technical detail. Coupled with this I want to up-sell the services that &lt;a href="http://xeriom.net/"&gt;Xeriom&lt;/a&gt; offers &amp;#8211; if the disk is getting full or the transfer quota is being consumed so fast that it wont last until the end of the month I want to make it easy to upgrade plans. I&amp;#8217;d also like to be able to try out some fun things &amp;#8211; iPhone push notifications, &lt;span class="caps"&gt;SMS&lt;/span&gt; gateways, audible alarms, whatever &amp;#8211; without worrying that I might destroy Nagios and bring my monitoring setup to its knees.&lt;/p&gt;

&lt;p&gt;Message queues are a great way of decoupling systems, moving risk and complexity elsewhere. Nagios shouldn&amp;#8217;t have to worry about all of the stuff I want to build around the monitoring system, it should focus just on the core features that I like it for: monitoring my hosts and services.&lt;/p&gt;

&lt;p&gt;Luckily, &lt;a href="http://barkingiguana.com/2008/12/13/deploying-activemq-on-ubuntu-810"&gt;I already have ActiveMQ running&lt;/a&gt; for other tasks, &lt;a href="http://barkingiguana.com/2009/01/01/writing-rubystomp-clients-with-smqueue"&gt;writing a &lt;span class="caps"&gt;STOMP&lt;/span&gt; client using &lt;span class="caps"&gt;SMQ&lt;/span&gt;ueue&lt;/a&gt; is pretty trivial, and Nagios has several ways to execute external commands when events happen including the &lt;a href="http://nagios.sourceforge.net/docs/3_0/configmain.html#global_host_event_handler"&gt;global host and service event handlers&lt;/a&gt;. All I need is a command to have Nagios run that&amp;#8217;ll accept a bunch of information from Nagios and stick it on the message queue.&lt;/p&gt;

&lt;p&gt;Here&amp;#8217;s what I came up with:&lt;/p&gt;

&lt;pre&gt;&lt;code class="ruby"&gt;require 'rubygems'
require 'smqueue'
require 'json'

message = {
  :hostname =&gt; ARGV[2],
  :service =&gt; ARGV[3],
  :state =&gt; ARGV[4],
  :state_type =&gt; ARGV[5],
  :state_time =&gt; ARGV[6].to_i,
  :attempt =&gt; ARGV[7].to_i,
  :max_attempts =&gt; ARGV[8].to_i,
  :time_t =&gt; Time.now.to_i
}

configuration = {
  :host =&gt; ARGV[0],
  :name =&gt; ARGV[1],
  :adapter =&gt; :StompAdapter
}

broadcast = SMQueue(configuration)
broadcast.put message.to_json, "content-type" =&gt; "application/json"&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You&amp;#8217;ll need Ruby and RubyGems installed. Once you have those, install the script like this:&lt;/p&gt;

&lt;pre&gt;&lt;code class="bash"&gt;sudo su -
gem sources -a http://gems.github.com/
gem install seanohalpin-smqueue json --no-ri --no-rdoc
cd /usr/bin
wget http://gist.github.com/raw/306765/2a3e9cbade88b4c6dd430e108bc8a28f95047462/notify-service-by-stomp.rb
chmod +x notify-service-by-stomp.rb&lt;/code&gt;&lt;/pre&gt;

Once it's installed tell Nagios to use it by adding this to your Nagios configuration:

&lt;pre&gt;&lt;code&gt;define command {
  command_name notify-service-by-stomp
  command_line /usr/bin/notify-service-by-stomp.rb mq.example.com /topic/foo.bar.baz.quux $HOSTADDRESS$ "$SERVICEDESC$" $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEDURATIONSEC$ $SERVICEATTEMPT$ $MAXSERVICEATTEMPTS$
}

global_service_event_handler=notify-service-by-stomp&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Change &lt;code&gt;mq.example.com&lt;/code&gt; to be the hostname of your message broker, and &lt;code&gt;/topic/foo.bar.baz.quux&lt;/code&gt; to be the topic or queue that you&amp;#8217;d like notifications to be sent to. Restart Nagios and you should start receiving notifications on that queue or topic.&lt;/p&gt;

&lt;p&gt;If you don&amp;#8217;t receive notifications form Nagios very often then a simple way to test that this is working is to attach stompcat &amp;#8211; a &lt;code&gt;cat&lt;/code&gt; type tool that uses &lt;span class="caps"&gt;STOMP&lt;/span&gt; as a source &amp;#8211; to the topic or queue, then send a few test notifications to the same queue by manually running the same command that Nagios would.&lt;/p&gt;

&lt;p&gt;Here&amp;#8217;s a simple stompcat tool in case you don&amp;#8217;t have one handy:&lt;/p&gt;

&lt;pre&gt;&lt;code class="ruby"&gt;#! /usr/bin/env ruby

# Run me like this:
#
#   ./stompcat.rb mq.example.com /topic/foo.bar.baz.quux
#

require 'rubygems'
require 'smqueue'

configuration = {
  :host =&gt; ARGV[0],
  :name =&gt; ARGV[1],
  :adapter =&gt; :StompAdapter
}

source = SMQueue(configuration)
source.get do |m|
  payload = m.body
  puts "&gt;&gt;&gt; #{payload}"
end&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Here&amp;#8217;s how to send notifications to the queue or topic:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;/usr/bin/notify-service-by-stomp.rb mq.example.com \
  /topic/foo.bar.baz.quux service-host.example.com "SERVICE NAME" \
  WARNING HARD 86492 6 6&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If it&amp;#8217;s working you should get an entry like this showing up where you&amp;#8217;re running the &lt;code&gt;stompcat&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code class="javascript"&gt;{
  "time_t":1266427384,
  "state":"WARNING",
  "state_type":"HARD",
  "state_time":86492,
  "attempt":6,
  "hostname":"service-host.example.com",
  "max_attempts":6,
  "service":"SERVICE NAME"
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You should be able to change the stompcat example to perform more complex and interesting actions &amp;#8211; looking up clients in a database, sending text messages if an account has enough credit, whatever you fancy. If you come up with something fun, please let me know!&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/BarkingIguana/~4/zWOmhsboa4A" height="1" width="1"/&gt;</summary>

<category term="messaging" />
<category term="monitoring" />
<category term="ruby" />
<category term="snippets" />
<category term="system" />
<category term="xeriom" />
<feedburner:origLink>http://barkingiguana.com/2010/02/17/decoupling-nagios-host-and-service-check-events-for-fun-and-profit?source=feed</feedburner:origLink></entry>
<entry>
		<author>
			<name>Craig Webster</name>
		</author>
		<published>2010-02-11T23:15:49Z</published>
		<updated>2010-02-11T23:24:01Z</updated>
		<title type="html">Keeping the software on your Ubuntu server up-to-date</title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BarkingIguana/~3/T7LAnrj3cMs/keeping-the-software-on-your-ubuntu-server-up-to-date" />
		<id>tag:barkingiguana.com,2010-02-11:49231934267467cd6f9473e1d60d3904/5325860bdb60ed41ebcd9f3e13e93198</id>
		<category term="Systems" />
		
		<summary type="html">
&lt;p&gt;New exploits are found just about every day in software both old and new. To combat this, software vendors release security updates which the Ubuntu team package up and use to release new, more secure packages of the software that you install.&lt;/p&gt;

	&lt;p&gt;It&amp;#8217;s very hard to provide software updates for all versions of all software packages ever built for a platform like Ubuntu so the Ubuntu team produce releases of Ubuntu Linux which they offer to support for a known period of time. These support periods are currently one of two lengths depending on the release of Ubuntu you use. Long Term Support (usually noted by including &amp;#8220;&lt;span class="caps"&gt;LTS&lt;/span&gt;&amp;#8221; in the name) releases for the server are supported for 5 years after the release date. Regular releases are supported for 18 months. Beyond these windows support for the release is dropped and you won&amp;#8217;t be able to upgrade or update any packages without a lot of work, so it&amp;#8217;s important to upgrade before support for your release is stopped.&lt;/p&gt;

	&lt;p&gt;The current commonly used releases, their release date, and their end of support window are as follows:&lt;/p&gt;

	&lt;table&gt;
		&lt;tr&gt;
			&lt;th&gt;Version    &lt;/th&gt;
			&lt;th&gt;Name           &lt;/th&gt;
			&lt;th&gt;Release Date  &lt;/th&gt;
			&lt;th&gt;Support Ends &lt;/th&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; 10.04  [LTS] &lt;/td&gt;
			&lt;td&gt; Lucid Lynx       &lt;/td&gt;
			&lt;td&gt; April 2010      &lt;/td&gt;
			&lt;td&gt; April 2015     &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; 9.10         &lt;/td&gt;
			&lt;td&gt; Karmic Koala     &lt;/td&gt;
			&lt;td&gt; October 29 2009 &lt;/td&gt;
			&lt;td&gt; April 2011     &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; 9.04         &lt;/td&gt;
			&lt;td&gt; Jaunty Jackalope &lt;/td&gt;
			&lt;td&gt; April 23 2009   &lt;/td&gt;
			&lt;td&gt; October 2010   &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; 8.10         &lt;/td&gt;
			&lt;td&gt; Intrepid Ibex    &lt;/td&gt;
			&lt;td&gt; October 30 2008 &lt;/td&gt;
			&lt;td&gt; April 2010     &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; 8.04.4 [LTS] &lt;/td&gt;
			&lt;td&gt; Hardy Heron      &lt;/td&gt;
			&lt;td&gt; January 28 2010 &lt;/td&gt;
			&lt;td&gt; April 2013     &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; 8.04.3 [LTS] &lt;/td&gt;
			&lt;td&gt; &amp;#8220;                &lt;/td&gt;
			&lt;td&gt; July 16 2009    &lt;/td&gt;
			&lt;td&gt; April 2013     &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; 8.04.2 [LTS] &lt;/td&gt;
			&lt;td&gt; &amp;#8220;                &lt;/td&gt;
			&lt;td&gt; January 22 2009 &lt;/td&gt;
			&lt;td&gt; April 2013     &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; 8.04.1 [LTS] &lt;/td&gt;
			&lt;td&gt; &amp;#8220;                &lt;/td&gt;
			&lt;td&gt; July 3 2008     &lt;/td&gt;
			&lt;td&gt; April 2013     &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; 8.04   [LTS] &lt;/td&gt;
			&lt;td&gt; &amp;#8220;                &lt;/td&gt;
			&lt;td&gt; April 24 2008   &lt;/td&gt;
			&lt;td&gt; April 2013     &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; 7.10         &lt;/td&gt;
			&lt;td&gt; Gutsy Gibbon     &lt;/td&gt;
			&lt;td&gt; October 18 2007 &lt;/td&gt;
			&lt;td&gt; April 2009     &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; 7.04         &lt;/td&gt;
			&lt;td&gt; Feisty Fawn      &lt;/td&gt;
			&lt;td&gt; April 19 2007   &lt;/td&gt;
			&lt;td&gt; October 2008   &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; 6.10         &lt;/td&gt;
			&lt;td&gt; Edgy Eft         &lt;/td&gt;
			&lt;td&gt; October 26 2006 &lt;/td&gt;
			&lt;td&gt; April 2008     &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; 6.06.2 [LTS] &lt;/td&gt;
			&lt;td&gt; Dapper Drake     &lt;/td&gt;
			&lt;td&gt; January 21 2008 &lt;/td&gt;
			&lt;td&gt; June 2011      &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; 6.06.1 [LTS] &lt;/td&gt;
			&lt;td&gt; &amp;#8220;                &lt;/td&gt;
			&lt;td&gt; August 10 2006  &lt;/td&gt;
			&lt;td&gt; June 2011      &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; 6.06   [LTS] &lt;/td&gt;
			&lt;td&gt; &amp;#8220;                &lt;/td&gt;
			&lt;td&gt; June 1 2006     &lt;/td&gt;
			&lt;td&gt; June 2011      &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; 5.10         &lt;/td&gt;
			&lt;td&gt; Breezy Badger    &lt;/td&gt;
			&lt;td&gt; October 12 2005 &lt;/td&gt;
			&lt;td&gt; April 2007     &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; 5.04         &lt;/td&gt;
			&lt;td&gt; Hoary Hedgehog   &lt;/td&gt;
			&lt;td&gt; April 8 2005    &lt;/td&gt;
			&lt;td&gt; October 2006   &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; 4.10         &lt;/td&gt;
			&lt;td&gt; Warty Warthog    &lt;/td&gt;
			&lt;td&gt; October 26 2004 &lt;/td&gt;
			&lt;td&gt; April 2006     &lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;

	&lt;p&gt;Currently supported are 6.06, 8.04, 8.10, 9.04 and 9.10. Ubuntu 10.04 will be released in April.&lt;/p&gt;

	&lt;h4&gt;Your responsibilities&lt;/h4&gt;

	&lt;p&gt;There are two things that you as a server operator need to know how to do to stay up-to-date with the software on your server and make sure that it&amp;#8217;s always supported. One is upgrading installed packages, and one is upgrading to the next release of Ubuntu. I&amp;#8217;ll cover them both one at a time, but first we&amp;#8217;ll do a little setup to make sure that both operations are nice and fast.&lt;/p&gt;

	&lt;h5&gt;Using a package mirror&lt;/h5&gt;

	&lt;p&gt;A very time consuming part of the update and upgrade process is downloading a large quantity of files from the servers that host the latest software packages. To make this faster &lt;a href="http://xeriom.net/"&gt;Xeriom Networks&lt;/a&gt; provide a mirror of the software packages for 8.04, 8.10, 9.04 and 9.10. If you&amp;#8217;re not hosted on Xeriom Networks (why not?) you should ask your current provider if they supply a package mirror for your release. If they don&amp;#8217;t you should skip this section and hope that your connection is fast enough to cope.&lt;/p&gt;

	&lt;p&gt;Using the package mirror is simple and requires you to edit just one file. A nice simple editor is nano. Install it by connecting to your server by &lt;span class="caps"&gt;SSH&lt;/span&gt; and using sudo and apt-get to install it:&lt;/p&gt;

  &lt;pre&gt;&lt;code&gt;sudo apt-get install nano --yes&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;The contents of the file is determined by which release of Ubuntu you are running. Find out which release you run by typing this:&lt;/p&gt;

  &lt;pre&gt;&lt;code&gt;cat /etc/lsb-release&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;You should then match your release up with the appropriate box on this Wiki page: &lt;a href="http://wiki.xeriom.net/w/XeriomUbuntuPackagesService"&gt;http://wiki.xeriom.net/w/XeriomUbuntuPackagesService&lt;/a&gt;&lt;/p&gt;

	&lt;p&gt;Copy the text from within only the box that&amp;#8217;s matched with your release. Now we can edit the file to add the local package server:&lt;/p&gt;

  &lt;pre&gt;&lt;code&gt;sudo nano -w /etc/apt/sources.list&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Delete all the existing lines in that file and replace them with the text you copied from the Wiki page. Now press &lt;span class="caps"&gt;CTRL&lt;/span&gt; and X and say that you do want to save the file.&lt;/p&gt;

	&lt;p&gt;Now we tell Ubuntu to refresh the list of software packages so it knows what&amp;#8217;s available on the local package mirror:&lt;/p&gt;

  &lt;pre&gt;&lt;code&gt;sudo apt-get update&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Congratulations, you&amp;#8217;re now using the Xeriom Ubuntu package mirror.&lt;/p&gt;

	&lt;h5&gt;Upgrading installed software&lt;/h5&gt;

	&lt;p&gt;Keeping your software up-to-date is an important part of keeping your server secure but since these new packages may break existing functionality it&amp;#8217;s best not to install them automatically. You should sit down and do this yourself, only applying the updates if they&amp;#8217;re appropriate and necessary.&lt;/p&gt;

	&lt;p&gt;To update the software installed on your server you use a set of tools called apt &amp;#8211; and specifically you use apt-get.&lt;/p&gt;

	&lt;p&gt;To make sure you get the latest updates you should first update your servers package database:&lt;/p&gt;

  &lt;pre&gt;&lt;code&gt;sudo apt-get update&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Then you should ask it to upgrade your existing packages:&lt;/p&gt;

  &lt;pre&gt;&lt;code&gt;sudo apt-get upgrade&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;This will calculate everything that needs upgrading, show you a list of those packages and ask you if you want to continue. Most of the time this command will run smoothly and you&amp;#8217;ll get the latest version of the software on your server, but you should check the list of packages that it will upgrade and be sure that you know what&amp;#8217;s going to change before you let it complete.&lt;/p&gt;

	&lt;h5&gt;Upgrading to the next release&lt;/h5&gt;

	&lt;p&gt;Upgrading Ubuntu is a slightly more time consuming process with a small increase in risk because of the huge number of packages that will be upgraded. It will usually also require you to reboot your server since the kernel is likely to be upgraded so you should plan for a little downtime.&lt;/p&gt;

	&lt;p&gt;To upgrade you should use a package called update-manager-core. If this is your first time upgrading your Ubuntu release you may need to install it:&lt;/p&gt;

  &lt;pre&gt;&lt;code&gt;sudo apt-get install update-manager-core&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Next configure it to target releases based on your preferred strategy. This is either lts, normal or never.&lt;/p&gt;

  &lt;pre&gt;&lt;code&gt;sudo nano -w /etc/update-manager/release-upgrades&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Change the line that starts &amp;#8220;Prompt=&amp;#8221; to be whichever strategy you choose. For example, if I choose the lts strategy which should give me 5 years of support for each release I update to I&amp;#8217;d enter &amp;#8220;Prompt=lts&amp;#8221; here. Now press &lt;span class="caps"&gt;CTRL&lt;/span&gt; and X and tell it that you want to save the file if it asks.&lt;/p&gt;

	&lt;p&gt;Now, before you upgrade, read the &lt;a href="http://www.ubuntu.com/getubuntu/releasenotes/"&gt;release notes&lt;/a&gt; for the version of Ubuntu that you&amp;#8217;re going to upgrade to and make sure you understand all the current issues and caveats surrounding it.&lt;/p&gt;

	&lt;p&gt;Once you&amp;#8217;re happy that you understand what you&amp;#8217;re doing and you&amp;#8217;ve scheduled a time to upgrade your server you can start the upgrade:&lt;/p&gt;

  &lt;pre&gt;&lt;code&gt;sudo do-release-upgrade&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;This will calculate all the packages that will be upgraded and ask you if you want to continue. Don&amp;#8217;t just say yes &amp;#8211; read the list of packages and make sure you understand what upgrading them means to your setup.&lt;/p&gt;

	&lt;h4&gt;If it all goes pear-shaped&lt;/h4&gt;

	&lt;p&gt;Sometimes things get messed up. Maybe the release wasn&amp;#8217;t tested enough (rare these days) or perhaps the new release doesn&amp;#8217;t support the same software as the one you upgraded from and you need that to run. If this ever happens we can create you a brand new image of the release you need as long as it&amp;#8217;s still supported. Of course, your data won&amp;#8217;t be on the new release so make sure your backups are up-to-date!&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/BarkingIguana/~4/T7LAnrj3cMs" height="1" width="1"/&gt;</summary>

<category term="ubuntu" />
<category term="system" />
<category term="security" />
<feedburner:origLink>http://barkingiguana.com/2010/02/11/keeping-the-software-on-your-ubuntu-server-up-to-date?source=feed</feedburner:origLink></entry>
<entry>
		<author>
			<name>Craig Webster</name>
		</author>
		<published>2010-02-11T13:54:07Z</published>
		<updated>2010-02-11T13:59:05Z</updated>
		<title type="html">The correct OID for system uptime</title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BarkingIguana/~3/Lr8CWg4Mt4g/the-correct-oid-for-system-uptime" />
		<id>tag:barkingiguana.com,2010-02-11:49231934267467cd6f9473e1d60d3904/011bb16ead89bd321acb0b81d29bdba4</id>
		<category term="Monitoring" />
		<category term="Systems" />
		<summary type="html">
&lt;p&gt;I use &lt;a href="http://www.net-snmp.org/"&gt;SNMP&lt;/a&gt; to track system uptime so I know when my hosts have recently rebooted, but I keep making a mistake when picking which OID to monitor and using &lt;code&gt;sysUpTime.0&lt;/code&gt; which is wrong I should be using &lt;code&gt;hrSystem.hrSystemUptime.0&lt;/code&gt;.&lt;/p&gt;

&lt;dl&gt;
  &lt;dt&gt;&lt;code&gt;sysUpTime.0&lt;/code&gt;&lt;/dt&gt;
  &lt;dd&gt;Timeticks (0.01s) since the snmpd started.&lt;/dd&gt;
  &lt;dt&gt;&lt;code&gt;hrSystem.hrSystemUptime.0&lt;/code&gt;&lt;/dt&gt;
  &lt;dd&gt;Timeticks since the hardware started.&lt;/dd&gt;
&lt;/dl&gt;
&lt;img src="http://feeds.feedburner.com/~r/BarkingIguana/~4/Lr8CWg4Mt4g" height="1" width="1"/&gt;</summary>

<category term="monitoring" />
<feedburner:origLink>http://barkingiguana.com/2010/02/11/the-correct-oid-for-system-uptime?source=feed</feedburner:origLink></entry>
<entry>
		<author>
			<name>Craig Webster</name>
		</author>
		<published>2010-01-21T19:15:00Z</published>
		<updated>2010-02-08T11:43:15Z</updated>
		<title type="html">Getting started with node.js</title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BarkingIguana/~3/-RqqWWcuMbg/getting-started-with-node-js" />
		<id>tag:barkingiguana.com,2010-01-21:49231934267467cd6f9473e1d60d3904/bda665fbae8552fa4d3a05767714648d</id>
		<category term="Software" />
		<category term="Javascript" />
		<summary type="html">
&lt;p&gt;Tonight I'm giving a talk to the &lt;a href="http://javascript.meetup.com/3/calendar/12285246/"&gt;London Javascript User Group&lt;/a&gt; where I'm introducing &lt;a href="http://nodejs.org/"&gt;node.js&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;My slides are available here: &lt;a href="http://barkingiguana.com/~craig/talks/2010/javascript-london/getting-started-with-node-js"&gt;http://barkingiguana.com/~craig/talks/2010/javascript-london/getting-started-with-node-js&lt;/a&gt;. There's a script if you print it out or there's a &lt;a href="http://vimeo.com/9125286"&gt;video&lt;/a&gt; on Vimeo if you'd like to watch it.&lt;/p&gt;

&lt;p&gt;If you have any feedback please feel free to leave a comment.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/BarkingIguana/~4/-RqqWWcuMbg" height="1" width="1"/&gt;</summary>

<category term="javascript" />
<feedburner:origLink>http://barkingiguana.com/2010/01/21/getting-started-with-node-js?source=feed</feedburner:origLink></entry>
<entry>
		<author>
			<name>Craig Webster</name>
		</author>
		<published>2009-12-10T18:13:21Z</published>
		<updated>2009-12-10T11:55:28Z</updated>
		<title type="html">Telnet 101</title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BarkingIguana/~3/SUSqOsWuVgo/telnet-101" />
		<id>tag:barkingiguana.com,2009-12-10:49231934267467cd6f9473e1d60d3904/122ebf0e30f386ef5b5df5fd6714b4b3</id>
		
		
		<summary type="html">
&lt;p&gt;Telnet has been around since before the dawn of (&lt;a href="http://en.wikipedia.org/wiki/Unix_time"&gt;Unix&lt;/a&gt;) time but surprisingly few people know how to use this extremely useful tool to track down problems with many popular services. A few seconds with Telnet can save hours of frustrating searching, trial and error, and screaming at the computer.&lt;/p&gt;

&lt;p&gt;Telnet can be used to simulate many plain-text protocols. I've used it to talk to &lt;a href="http://barkingiguana.com/2008/07/07/high-availability-mysql-on-ubuntu-804"&gt;MySQL&lt;/a&gt;, &lt;a href="http://barkingiguana.com/2009/03/04/memcache-statistics-from-the-command-line"&gt;Memcached&lt;/a&gt; and &lt;a href="http://barkingiguana.com/2008/06/22/a-simple-email-hub-for-your-local-network"&gt;Postfix&lt;/a&gt;. Here I'll show how to use it to test that an HTTP daemon can serve content over HTTP/1.1.&lt;/p&gt;

&lt;h3&gt;What is HTTP?&lt;/h3&gt;

&lt;p&gt;Before we can use telnet to simulate HTTP we need to know more about HTTP - what is it and how it works.&lt;/p&gt;

&lt;p&gt;HTTP/1.1 - HyperText Transfer Protocol - is a plain-text protocol defined in &lt;a href="http://www.w3.org/Protocols/rfc2616/rfc2616.html"&gt;RFC2616&lt;/a&gt;. It's used for a great many things, but the most visible one for most people is as a transport mechanism for web pages.&lt;/p&gt;

&lt;p&gt;When you request a webpage a few special operations are performed (which I'll gloss over because they're beyond the scope of this article). After those have completed your web browser connects to the web server and sends it a requests for a page. A typical request for a web page looks something like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;GET / HTTP/1.1
Host: example.com

&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The format of the request is:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[HTTPMETHOD] [PATH TO WEBPAGE] HTTP/1.1
Host: [SERVERNAME]
[BLANK LINE]&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The server responds with something similar except after the blank line there's usually the page you requested.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
Server: Apache/2.2.3 (Red Hat)
Last-Modified: Tue, 15 Nov 2005 13:24:10 GMT
ETag: "b300b4-1b6-4059a80bfd280"
Accept-Ranges: bytes
Content-Type: text/html; charset=UTF-8
Connection: close     
Date: Thu, 10 Dec 2009 10:37:33 GMT
Age: 7114   
Content-Length: 438

&amp;lt;HTML&amp;gt;
&amp;lt;HEAD&amp;gt;
  &amp;lt;TITLE&amp;gt;Example Web Page&amp;lt;/TITLE&amp;gt;
&amp;lt;/HEAD&amp;gt; 
&amp;lt;body&amp;gt;  
&amp;lt;p&amp;gt;You have reached this web page by typing &amp;quot;example.com&amp;quot;,
&amp;quot;example.net&amp;quot;,
  or &amp;quot;example.org&amp;quot; into your web browser.&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;These domain names are reserved for use in documentation and are not available 
  for registration. See &amp;lt;a href="http://www.rfc-editor.org/rfc/rfc2606.txt"&amp;gt;RFC 
  2606&amp;lt;/a&amp;gt;, Section 3.&amp;lt;/p&amp;gt;
&amp;lt;/BODY&amp;gt;
&amp;lt;/HTML&amp;gt&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The format of the response is:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;HTTP/1.1 [RESPONSE STATUS]
[RESPONSE HEADERS]
[BLANK LINE]
[REQUESTED WEBPAGE]&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;There's a &lt;em&gt;lot&lt;/em&gt; more to the HTTP protocol, but it's all document in rather a lot of (rather dry) detail in &lt;a href="http://www.w3.org/Protocols/rfc2616/rfc2616.html"&gt;RFC2616&lt;/a&gt;. Mostly you can just skim the RFC for the parts you're interested in.&lt;/p&gt;

&lt;h3&gt;Simulated Awesome&lt;/h3&gt;

&lt;p&gt;Okay, so now we've got an idea how HTTP can be used to request a webpage. How do we go from that to using telnet to show it works?&lt;/p&gt;

&lt;p&gt;The &lt;a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?telnet"&gt;telnet manpage&lt;/a&gt; says that the telnet command can take arguments for host and port. In the above example we were requesting a page from example.com so that's the host we'll use. Typically HTTP is served on port 80, and this is true of example.com so we'll use that as the port.&lt;/p&gt;

&lt;pre&gt;&lt;code class="bash"&gt;telnet example.com 80&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;With that we're connected to the HTTP service - the web server - on example.com. You'll see output something like this as connects:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Trying 192.0.32.10...
Connected to example.com.
Escape character is '^]'.&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Once connected you'll be left with your cursor on a blank line. This is where you can start pretending to be a web browser.&lt;/p&gt;

&lt;p&gt;Type in the GET request shown in the "What is HTTP?" section above (including the blank line at the end). After a short delay you should get back the example.com webpage.&lt;/p&gt;

&lt;h3&gt;How is this useful?&lt;/h3&gt;

&lt;p&gt;Requesting a webpage by hand can quickly expose several common problems.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Misconfigured firewalls mean telnet won't connect.&lt;/li&gt;
  &lt;li&gt;The status code returned can tell you a lot about what the server did with your request. &lt;a href="http://www.w3.org/Protocols/rfc2616/rfc2616.html"&gt;RFC2616&lt;/a&gt; contains a &lt;a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"&gt;list of HTTP status codes and their meaning&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;You avoid problems which may be caused by your browser caching the old version of files you request.&lt;/li&gt;
  &lt;li&gt;You can easily check all the headers that the server sends back.&lt;/li&gt;
  &lt;li&gt;By adding headers such as &lt;a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3"&gt;Accept-Encoding&lt;/a&gt; you can check that your assets are being served gzipped when it is requested.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Telnet isn't limited to checking just HTTP either. SMTP, IMAP, POP and many others can be simulated using telnet. It's not a silver bullet, but it's a very useful tool.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/BarkingIguana/~4/SUSqOsWuVgo" height="1" width="1"/&gt;</summary>

<category term="debugging" />
<feedburner:origLink>http://barkingiguana.com/2009/12/10/telnet-101?source=feed</feedburner:origLink></entry>
<entry>
		<author>
			<name>Craig Webster</name>
		</author>
		<published>2009-12-04T17:55:11Z</published>
		<updated>2009-12-04T14:10:15Z</updated>
		<title type="html">Simulating slow or laggy network connections in OS X</title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BarkingIguana/~3/apbS5R-3tR0/simulating-slow-or-laggy-network-connections-in-os-x" />
		<id>tag:barkingiguana.com,2009-12-04:49231934267467cd6f9473e1d60d3904/da49a4f954517bf813c13656c1d35b9a</id>
		<category term="Software" />
		<category term="Systems" />
		<summary type="html">
&lt;p&gt;A client recently said that their site was loading slowly from remote sites. We got the specification of the network connection used, but I always forget how to do bandwidth limiting and latency simulation on OS X. This is a note for myself so I don't have to go searching again.&lt;/p&gt;

&lt;p&gt;Configure a pipe that has the appropriate bandwidth limit and delay.&lt;/p&gt;
&lt;pre&gt;&lt;code class="bash"&gt;sudo ipfw pipe 1 config bw 16Kbit/s delay 350ms&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Attach it to all traffic going to or from port 80.&lt;/p&gt;
&lt;pre&gt;&lt;code class="bash"&gt;sudo ipfw add 1 pipe 1 src-port 80
sudo ipfw add 2 pipe 1 dst-port 80&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now traffic coming from or going to port 80 anywhere is limited by the pipe that you specified. Do your testing and once you get frustrated with slow access to the web remove the rules like so:&lt;/p&gt;
&lt;pre&gt;&lt;code class="bash"&gt;sudo ipfw delete 1
sudo ipfw delete 2&lt;/code&gt;&lt;/pre&gt;
&lt;img src="http://feeds.feedburner.com/~r/BarkingIguana/~4/apbS5R-3tR0" height="1" width="1"/&gt;</summary>

<category term="debugging" />
<category term="testing" />
<category term="system" />
<feedburner:origLink>http://barkingiguana.com/2009/12/04/simulating-slow-or-laggy-network-connections-in-os-x?source=feed</feedburner:origLink></entry>
<entry>
		<author>
			<name>Craig Webster</name>
		</author>
		<published>2009-11-11T08:32:17Z</published>
		<updated>2010-01-22T11:35:22Z</updated>
		<title type="html">Returning explicitly is slower</title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BarkingIguana/~3/yhhYmv7p3lo/returning-explicitly-is-slower" />
		<id>tag:barkingiguana.com,2009-11-10:49231934267467cd6f9473e1d60d3904/a75e8ed98cbf0191aec46e613990ec90</id>
		
		
		<summary type="html">
&lt;p&gt;My main concern about &lt;a href="http://barkingiguana.com/2009/10/21/you-dont-need-to-return-explicitly"&gt;returning explicitly&lt;/a&gt; is readability. It's a very subjective thing, but in general whenever I see an unnecessary return statement my internal &lt;a href="http://www.osnews.com/story/19266/WTFs_m"&gt;WTF counter&lt;/a&gt; increments.&lt;/p&gt;

&lt;p&gt;Less subjective though, it has been &lt;a href="http://barkingiguana.com/2009/10/24/the-truth-speaks-for-itself#c000073"&gt;pointed&lt;/a&gt; &lt;a href="http://barkingiguana.com/2009/10/21/you-dont-need-to-return-explicitly#c000074"&gt;out&lt;/a&gt; that returning explicitly is slower.&lt;/p&gt;

&lt;p&gt;Benchmarking in Ruby is easy. Here's how:&lt;/p&gt;

&lt;pre&gt;&lt;code class="ruby"&gt;require 'benchmark'

def explicit
  return "TEST"
end

def implicit
  "TEST"
end

n = 100_000_000
Benchmark.bmbm do |x|
  x.report("Explicit return") { n.times { explicit } }
  x.report("Implicit return") { n.times { implicit } }
end&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And here are the results of this particular benchmark:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Rehearsal ---------------------------------------------------
Explicit return  50.380000   0.210000  50.590000 ( 51.000510)
Implicit return  36.200000   0.100000  36.300000 ( 36.454038)
----------------------------------------- total: 86.890000sec

                      user     system      total        real
Explicit return  47.650000   0.070000  47.720000 ( 47.744167)
Implicit return  35.900000   0.070000  35.970000 ( 35.985493)&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This shows that while returning explicitly is slower, like the to_proc hack it's &lt;a href="http://barkingiguana.com/2008/11/18/symbol-to_proc-is-slow-is-it-slow-enough-to-matter"&gt;not slow enough to matter&lt;/a&gt;. You need to return a huge number of times to see any significant difference.&lt;/p&gt;

&lt;p&gt;Does this change my mind? No. Returning explicitly is still ugly.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Update:&lt;/em&gt; The above benchmark was run on Ruby 1.8.6. &lt;a href="http://tomafro.net/"&gt;Tom Ward&lt;/a&gt; has provided &lt;a href="http://tomafro.net/2009/08/the-cost-of-explicit-returns-in-ruby"&gt;similar benchmarks&lt;/a&gt; for Ruby 1.8.7, 1.9 and jRuby 1.1.6 (using n = 10,000,000) which show that the cost of explicitly returning on these platforms in negligible. Still ugly though.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/BarkingIguana/~4/yhhYmv7p3lo" height="1" width="1"/&gt;</summary>

<category term="coding" />
<category term="ruby" />
<category term="snippets" />
<category term="rant" />
<feedburner:origLink>http://barkingiguana.com/2009/11/11/returning-explicitly-is-slower?source=feed</feedburner:origLink></entry></feed>
