Installing munin on Ubuntu

I like munin.  It’s an old school pluggable server monitoring framework that suffices well for my current purposes.  This week I installed it on a new ubuntu box and it wasnt as straight forward as I’d hoped so here are some notes

These instructions will get you up and running but you wont get the rather useful dynamic zoom behaviour on the graphs and you’ll have added an unnecessary level of indirection when you changed the web directory from /var/cache/munin/www /var/www/munin.  To get the dynamic zoom you need the fcgid (fast cgi daemon) apache2 mod which in turn needs the libapache2-mod-fcgid package.   Also you’ll need the libcgi-fast-perl package.  With these installed you just need to make a couple of small adjustments to the provided apache config and you’ll be good to go.  I’ve created an ansible playbook to do this for you if that’s your thing.

Coffeescript constructor options with defaults

Coffeescript has a nice way of destructuring assignment in a class constructor, e.g.

class Person
  constructor: (options) ->
    {@name, @age, @height} = options

This is elegant and efficient and has the additional benefit of explicitly communicating anticipated class attributes, cf:

class Person
  constructor: (options={}) ->
    for key, val of options
      @[key] = val

which allows any old thing to be added to your object (although admittedly this is sometimes desirable).

Coffeescript also has a neat way of setting default values for functions, e.g.

fill = (container, liquid = "coffee") ->
  "Filling the #{container} with #{liquid}..."

But this pattern doesnt seem to transfer to destructuring class assignment.  I can’t for instance use any of these approaches:

class Person
  constructor: (options) ->
    {@name = "Ken", @age, @height} = options # (yields an "UNEXPECTED=" error) or
    {@name: "Ken", @age, @height} = options # (yields a "Ken" CANNOT BE ASSIGNED error)
    {@name ?= "Ken", @age, @height} = options # (yields an "UNEXPECTED COMPOUND ASSIGN" error)
    {@name? "Ken", @age, @height} = options # (yields an "UNEXPECTED LOGIC" error)
    {@name || "Ken", @age, @height} = options # (yields an "UNEXPECTED LOGIC" error)

It turns out that the best way (IMO) is:

class Person
  constructor: (options={}) ->
    {@age, @height} = options;
    @name = options.name ? "Ken"

Note that the default value for options is included, so as not to force a parameter on the constructor.  As always, stack overflow provides a deeper picture.

Home NAS

So I’m looking at acquiring some network attached storage (NAS) and wondering how best to get a cute, quiet, efficient box that will store and share the family pictures / emails / music / files (not videos) within a mixed environment (Windows, Ubuntu, Android, Smart TV) and not be a burden to maintain.  Software-wise I like Ubuntu (for the OS) and Subsonic (for the music streaming) but I’m not especially attached to either. This home built server matches these “requirements”  but the diy angle is a little too onerous for me right now.

Linus Torvalds went through a similar process earlier this year and has some nice suggestions in the comments on his google+ thread.  In particular people seem to like the drobo, qnap, synology offerings but most vendors get a mention.  After this first pass I’m quite taken with the Synology DS213+ as it’s linux, it seems to do all I require and people are almost raving about it in the comments, but I’ll look into the options a little deeper before jumping in…

[Edit – seems Linus came to the same conclusion re: vendor after his post]

Woodentrack

woodentrack-bendLast year in a slow period I knocked up a javascript library for making wooden toy train designs as a useful/interesting exercise.  After getting some implicit feedback on it last week (somewhat baffled), I decided to review it, give it a spruce up and add some more explanation.  It’s still barely a proof of concept but you can see the results here.

The next pieces of work (should I get the chance) will probably focus on:

  1. finessing the API, i.e.   “Create a track at the browser command prompt, attach a track painter and watch the drawn track change as you add/remove pieces and edit the track properties” and
  2. adding annotations to the free ends of track drawn in the DSL demo so it’s clear how to add more track to them.

Presentation smells

In software development, code reviewers sometimes talk about smells – observations about a piece of code that, while not damning, are signs that the code may not be very good. I saw a presentation last week that suggested the idea of smells could be applied more widely. Presentation smells that I can think of include:

  • Apologising for not having enough sleep due to being up all night preparing the talk
  • Not having a narrative for your talk – why are you doing it? – why do you think it might be interesting to your audience?
  • Suggesting that there is too much content to fit into the talk
  • Reading your own (very dense) slides
  • Not following time cues from the facilitator

I’m sure there are more. Any suggestions?

Netbeans file type integration tutorial comments

Netbeans 7.1rc1 has been released. When I went through the file type tutorial (which has been updated for 7.1) I found a couple of minor niggles which needed more than a couple of lines in a comment to express, hence this post.  In Summary, it’s a good tutorial, but there a few rough edges that could be ironed out:

  • A design bug in the properties window section,
  • Missing the visual library api dependency,
  • Excessive overiding the default action on file context menu,

and it would really benefit from some extensions, particularly:

  • implementing a navigation window instead of a node tree under the file node,
  • real-time synchronisation across all views.

Continue reading Netbeans file type integration tutorial comments

Installing Padrino on Ubuntu / Debian

I’ve been tinkering with Padrino this week. Padrino is a ruby web framework built on top of the delightful sinatra microframework. I found it attractive because

  • it appears to have a simple design, as you’d expect of something built on top of sinatra,
  • it rolls in the various elements that you’d expect for a fully fledged web framework (i.e. orm, database, mailer) but makes no commitments to the particular modules used for each *
  • it had a default Admin interface (which is a huge win for Django IMO).

There’s quite a bit of supporting material on the web, but my impression after a few hours is that it’s still pretty beta and has a strong leaning towards RHEL linux. So this post details the steps I had to take to be able to work through the basic project guide with Ubuntu Lucid Lynx. Continue reading Installing Padrino on Ubuntu / Debian

some personal argumentation