I took a reasonably deep dive into JsonLogic recently, evaluating it as a possible drop-in replacement for expression evaluation in proformajs. In the process I got my hands dirty with vue3 and bootstrap5 to create a JsonLogic sandbox along with a library for serialising JsonLogic expressions that maybe useful.

The library is indeed a suitable drop-in but the evaluation process has made me think twice of leveraging javascript expression semantics. Though it was a prudent time saving strategy at the time it was made, it may need reviewing.

Colour Diary

My family spent a week in Finland this summer as part of our summer holiday. One of the many highlights was a visit to the design museum in Helsinki which is excellent and well worth a visit if you go there. The ground floor was dedicated to the work of Margrethe Odgaard, an artist/artisan from Copenhagen who has an exquisite eye for colour, particularly, but not exclusively, in textiles. One of the things presented were colour diaries that she’d kept on visits to Morocco and Cuba that were fascinating and beautiful. It gave me an idea for a simple phone app that I could build that would allow me to do the same thing, so I created it using Meteor. If you have an android phone, you can download it for yourself from the Google Play store. It’s in beta because Ive not done this before and at the moment I only know that it works on my phone. I’d love to hear any feedback you might have.

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]


Last 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”