Home Kanban board

January 29th, 2012 robin Posted in Home, Project Management | Comments Off on Home Kanban board

I hate having to remember stuff… so I applied some tried and tested work practices and made a home kanban board.

 

The example above has 4 tasks

  • Feed the dog
  • Feed the fish
  • Get bread and milk
  • Water the plants

Daily tasks are blue/red

Weekly tasks are yellow/green.

Every day we can slide the marker below along one field (there’s two weeks shown, because 7 days aren’t evenly divisible by 2, but 14 are… :)).

At the end of the day, all the pegs should have the colour of the day showing.

In the example above, today is Monday, and it’s a blue day, and a green week.  Whoever fed the dog and the fish already turned the cloths pegs around to show the blue side.  Milk and bread hasn’t been bought yet (so the peg is still showing red from the day before), and the plants haven’t been watered yet this week.

Construction is pretty straight forward.  For the pegs, get cheap plastic cloths pegs in four colours.  Take them apart and reassemble them so that each peg has two colours:

The board is just a piece of 3mm MDF (cardboard will do too) with a spacer on the back to give it some distance to the wall.  On the bottom area, make 14×2 rows, and colour them in with the four colours of the cloths pegs you have.  The only complicated bit is making the slider.  I used a piece of over exposed film for a nice frame, and a strip of transparent folder as the strip for it to run on.  If you use something smooth for your board, you can probably get away with whiteboard markers, or just cut a piece of paper to size and write/draw your tasks on it – the handy thing about the pegs: you’ll only be turning one at a time, and the rest will hold the paper for you!

The advantages of having a board like this in your household:

  • Everyone automatically knows what has been done, and what has to be done without asking each other
  • Nothing gets done twice (feeding animals too much can be bad for them)
  • Your mind is free to think about more productive things than “what did I still have to do today?”

Say begone to confusion and forgetfulness in your household and go Kanban today! 🙂


Interface to EFA (Elektronische Fahrplan Auskunft)

January 23rd, 2012 robin Posted in Ironman, Perl, Travel | Comments Off on Interface to EFA (Elektronische Fahrplan Auskunft)

I’m publishing this module now, even though it’s not complete because I foresee not getting round to developing it much in the near future, and maybe others can benefit from it in its current state, or continue development.

What is EFA?

EFA is a product from Mentz Datenverarbeitung in Munich which is used my many municipal travel providers such as the MVV in Munich to provide travel data for their patrons.

Unfortunately there is no documentation to the interface available, so my implementation is mostly reverse-engineered to their RESTful API.  A lot of ground work which helped me get ahead was done by Andreas and friends in Java with the public-transport-enabler (see AbstractEfaProvider in there for more details) which incidentally is the code behind the hugely popular android App Öffi.

What can I WWW::EFA for?

Querying travel times between locations, and stops within a municipal transport network.

Which municipalities will it work for?

There are loads of transport authorities which use EFA (London, Munich, Basel, San Francisco, …).  I have only tested it with the MVV…

Where are all the unit tests and examples?

Sorry… it’s a work in progress… I’d be really grateful for any contributions you want to make to make it more complete!!

What other similar perl modules are there?

Code example

use WWW::EFA::Provider::MVV;
use WWW::EFA::Coordinates;
use WWW::EFA::Location;
use Class::Date qw/now/;
my %efa_params;
my $efa = WWW::EFA::Provider::MVV->new( %efa_params );
my $search_to_location = WWW::EFA::Location->new(
 coordinates => WWW::EFA::Coordinates->new(  lat => 48.171606, lon => 11.498899 ),
 );
my $search_from_location = WWW::EFA::Location->new(
 coordinates => WWW::EFA::Coordinates->new( lat => 48.140267, lon => 11.557302 ),
 );
my( $from_location ) = $efa->coord_request(
 location => $search_from_location,
 max_results => 5,
 max_distance => 100,
 );
my( $to_location ) = $efa->coord_request(
 location => $search_to_location,
 max_results => 5,
 max_distance => 100,
 );
printf "##### Getting trips between\n%s\n%s\n",
 $from_location->string, $to_location->string;
my $trips = $efa->trips(
 from => $from_location,
 to => $to_location,
 date => now(),
 );
print $trips->string;

My first Dancer webapp

January 9th, 2012 robin Posted in Ironman, Perl | 1 Comment »

Dancer is YAPWF (Yet Another Perl Web Framework), in the same bucket as Catalyst.  To date I’ve done most of my webapp development on Catalyst, but at the last German Perl Workshop @bano99 introduced me to Dancer, so I wanted to give it a try.

This is the webapp which resulted.

The backend

Behind the scenes I have a home built micro-controller web server controlling the temperature in a refrigerator to bring our turtles into a healthy winter hibernation.  A perl script regularly (once per minute) queries the current status from the micro-controller, and logs the data (temperature in the tank, the refrigerator, room, humidity, and switch state) to a (SQLite) database.  So, I have some interesting data, and want to make that web accessible – how well suited is Dancer to the task?

Turns out: very suitable!

Dancer is

  • super quick and easy to get started with: 2 minutes tops to get a basic web application running, including installing Dancer with cpanplus.
  • very intuitive for the basic stuff – in my case I had a template for the webpage, a database handler to get the data, and a method to do some basic analysis and pre-processing on the data before returning it to the client as json.
  • a bit procedural… it is possible to develop an OOP app with Dancer, but with its background singleton and plethora of new syntax it feels like, and encourages procedural practices.

Dancer is not (IMHO)…

  • a framework which will force/cajole you into using good design practices (OOP, MVC).  You can be quick’n’dirty with Dancer, which depending on your standpoint can be a pro or a con.
  • easy to understand the inner workings.  You may hate the global $c in Catalyst to which everything is bound, but … you do know what to bind stuff to, and you do know where to find it.  In Dancer there is (even) more hidden magic.
  • for special wishes.  For example for something as simple as having “Expires” http headers for static files, I had to add a after_file_render hook.

Better, Faster and Cooler

Some other stuff I did on the way to make it BFC:

  • Used jqPlot for the graphs.  I really like it!  I used to be into OFC, but jqPlot is faster, more versatile, and the big kicker: doesn’t require Flash!  Try out the zooming and mouse-over effects!
  • Data compression: originally the data for the charts weighed in at over 2MB…
    • Reduce repetition: for the graphs, the data requires an array-of-arrays with each value paired with the relevant date.  Rather than transmitting the 5 finished array-of-arrays (each with its own set of date data), I now transmit just the 4 data arrays, and the date array, and then build them as jqPlot requires them with javascript clientside.  This reduced the transmitted data from 2MB to ~400KB.
    • Deflate the data – by using Plack::Middleware::Deflater I was able to further reduce the transmitted data to ~40KB
  • Using Plack and Starman to easily put the webapp online.  Wow… that makes the transition from development on localhost to full deployment serverside childsplay!
  • Using Varnish to cache the pages server-side.  Some people make the effort of serving the static elements of a web app via a light web server, and while this has its merits, I prefer a contiguous web app which is complete in itself, and by applying the appropriate Expires http headers, let a reverse proxy do the grunt work.  I set the headers for this webapp so the worst-case load on the back-end will only be 1 request every 7 Days for any of the javascript/css files, 1 per hour for the html page, and 1 per minute for the json data.  Go ahead and slashdot me… I think I can take it, even though there’s only 3 worker processes and it’s running off a SQLite database. 🙂

Summary

I will definitely be using Dancer again.  For any corporate and larger web applications I’d still prefer Catalyst, but for applications like this where I want to put something small online quickly, it’s the bees knees!