Videos from first Node.js meetup in Dublin

Thanks to Cian O’Maidin, the videos from the first Node.js meetup in Dublin are available!

A couple of weeks ago, we presented a short (~15m) talk about how we use Node.js to render Javascript charts to SVG and PNG images.

At this event, we announced three things:

Watch the video for some details on how and why we run Highcharts server-side under Node.js, what we liked/didn’t like about Node, and for the open sourcing announcement.

Sorry about the poor audio – hopefully we’ll have a better recording setup for the next event.

In case you’re wondering, yes, that is our Big Red Button being used as a slide advancing tool. :D

Building the Big Red Button

Metricfire's Big Red ButtonEveryone loves our giant red button. We’ve used it at three events so far – a Dublin Beta startup demo evening, our PyCon 2012 booth, and most recently as the most awesome slide advancing controller ever at the first Node.js meetup in Dublin.

We get a lot of questions about how we made it and how it talks to the computer. It’s about time we did a little show and tell, with lots of pictures and code!

Image from SparkFun.com - go buy one of their buttons!

The main element, the actual button, is one of SparkFun’s “Big Dome Push Button” units. Two of these have been sitting in Charlie’s electronics parts boxes for a year or so, waiting for just the right project.

Inside the button

 

PCB from a small USB numeric keypad

The second major component is deceptively simple and cheap – the PCB from a small USB numeric keypad. Modern membrane keyboards have a row of contacts that mate with the flexible plastic sheets with conductive traces that form the key contact points.

After some trial and error with a piece of wire, you can identify the pair of contacts that correspond to any key on the keyboard. If you solder those up to a big push-to-make switch, you’re basically done. A press of the big button will cause the controller board to send a USB keyboard event to the OS.

 

1W white LED on a custom mount

A little poking around with a multimeter will find you a good point on the PCB to pull 5v to power the light inside the button. Though SparkFun now sell a version with an LED, our one used an older incandescent bulb, which requires 12v and would probably draw more power than the keyboard controller was designed for. Charlie built a suitably shonky mount for a 1W white LED and it replaced the incandescent bulb.

 

 

 

Vinyl sticker inside the button

How’d we get our logo in there? We had some spare vinyl stickers for the backs of our macbooks, and one just happened to fit perfectly inside the button. If you need excellent decals/stickers, talk to Jeff and Neece of SmartDecals and tell them Metricfire sent you!

After that, the easy bit was making a wooden case for the whole thing. A grotty concrete-encrusted wooden plank turned out to make a solid enclosure, once it was cleaned up a bit!

 

 

Where’s the code?

As promised, there’s some code involved here. Sometimes, having the button appear to the OS as a regular HID keyboard is undesirable. When we’re demoing our (almost) real-time graphs and dashboards at events like Dublin Beta and PyCon, we don’t want button presses to be interpreted by the browser running the demo. We need something a little deeper catching those button presses so we can generate metric events.

For this, we use Python, libusb, and some hardcoded magic numbers. The code:

So there you go. If you’d like a Big Red Button of your own, you have complete instructions and sample code. Quick, to the workshop!

Node.js Client for Metricfire

We’re big fans of Node.js here at Metricfire – our open source highcharts rendering service Dali is written in Node and we’ve been happily using it in production for several months. As I prepared this blog post, my co-founder Charlie was giving a talk over the other side of the world at the first Node JS Dublin meetup and it seems as good a time as any to announce our Node.js client for Metricfire.

As with our other clients, this is a fast non-blocking client that will not compromise the speed of your application and allow you to send thousands of events per second.

We’ve already found our Node client useful – it helped us identify a memory leak:

This sort of “up and to the right” behaviour is desirable in many things, but not memory usage. The code for getting this data out of Node and sending it to Metricfire is very simple:

Our node.js client can be installed right from npm:

$ npm install metricfire

If you like documentation, you can find it on docs.metricfire.com, along with docs for all the other client libraries and the HTTP API.

Check out our free trial and see how you can easily measure and graph what’s happening in your application.

New Feature – Metric Deletion

Behind the scenes in Metricfire we’re constantly at work building new features and improving old ones, but a feature we’ve deliberately held back on until now is the ability to delete a metric. Our philosophy is that you should measure everything that your application does, and figure out the most useful data points later. That said, it’s human nature that mistakes will happen when creating a metric – typos in a metric name, test sites sending data you’re not interested in, or anything else that creates metrics that aren’t useful to you.

We’ve finally added an interface to quickly and easily determine which metrics are not used, and then delete them. A simple spark line chart will show whether the metric has been collecting data, and a summary screen will tell you whether it’s used on any graphs before you make a decision to remove it.

Just select “Apps and Data” from the main navigation menu and you’ll see all your applications, metrics, and a spark line of the data from each.  See our 30-day free trial and try it for yourself.