Digital Spaghetti

Point generating code monkey

Callbacks, Curry and the Craic

| Comments

I’ve just returned from speaking from NodeJSDublin and what turned out to be a great event! First off I want to say thanks to Cian Ó Maidín for organising a great set of speakers for the evening, and EngineYard Dublin for hosting the event in their amazing work space.

NodeJS Dublin NodeJS Dublin NodeJS Dublin NodeJS Dublin

The first talk was kicked off by Richard Rodger introducing NodeJS to the crowd and lots of practical advice on how it can fit into your organisation.

Next up was Charlie Von Metzradt with a fast paced and practical talk on how Metricfire are using NodeJS to create a utility called Dali to use within their application ecosystem to solve a unique problem with rendering large volumes of data with Highcharts. Best of all it’s been open sourced on Github and is available to download now so make sure you check it out.

NodeJS Dublin NodeJS Dublin NodeJS Dublin NodeJS Dublin

Then there was little old me and I gave a overview of the NodeJS ecosystem - from mailing lists and documentation through to NPM and getting the most of out it. Finally I did some live code examples of the Express, Request and Underscore modules to show some of the power and simplicity available using NodeJS as your network and IO stack.

Finally we were joined by Mikeal Rodgers live from West Coast US via Skype - who told us why we should be using NodeJS, and then floor was opened up to a Q&A session on the question couch with some interesting insights into what we can expect to see coming up in Node, and some interesting usecases.

Overall I was highly impressed by both the quality of the event, and the turnout from the Irish tech community - it’s great to see such a buzz be generated around the first event and here’s to more great events like this in the future.

It was interesting getting too and from the event as well - I was flying from Edinburgh and on the way there, DISASTER! Somewhere in the airport I dropped my boarding pass and was bricking it that I wouldn’t get on the plane - luckly I did a web checkin the night before and it saved my life because I had a PDF copy. On the way back it was even more of a lark with an engine failure on the plane - forcing us to turn back to Dublin and be put on a later flight.

The community itself was awesome, and I met some great people who’s hospitality was second to none - and 3.30am Vindaloos are interesting, if not good for my stomach (although the discovery of garlic chips more than makes up for that!). I can’t wait to go back and catch up with everyone I met, and meet some more new people. I hope many of them can make it over to Scotland too so I can return the hospitality.

You can follow all the chat from the night by checking out the #nodejsdub hashtag

Speaking at NodeJS Dublin This Thursday

| Comments

This Thursday I’ll be speaking at NodeJS Dublin - starting around 7pm at the Engine Yard offices (2nd Floor, 35 Barrow St, Dublin) - talking about the NodeJS ecosystem, important core modules and some of the more useful 3rd-party modules available.

I believe there are still tickets available, so if you are in Dublin and interested in hearing about how NodeJS could be a useful fit in your organisation make sure you come along.

Oh My! ZSH Is Awesome

| Comments

Earlier today I switched to zsh as my primary shell environment. For a while now I had seen that other Mac owners had much prettier iTerm terminals and wondered how - today I finally found out via a tweet:

Other than ZSH itself, what also make it awesome is the oh-my-zsh package that provides all completions I need more visual keys in things like git. So far it looks like this:

A picture of a zsh shell in iTerm

If you’re not using it already, you should be!

Socket.io and Flickr Image Widget

| Comments

In my previous post I outlines some plans to use Octopress as my blogging platform and at the same time use Nodejs and Socket.io to add some interactivity to the site in a stack I am more comfortable with.

The first of these additions is my new Flickr widget to the right. When the site connects over the socket, it initialites a function that will fetch a users latest 6 photos and cache them locally to the server - it then generates a fragment of HTML that is returned via the Socket.io connection and jQuery puts it in to the widget component in the page.

The code currently looks like this (and could do with a good refactor):

This code introduces a few new libraries - request, moment.js for time checking and seq for some flow control around some of the more async operations. The code does a few pre-checks - first it checks to see if the cache file for the HTML fragment exists, then does a mtime check using moment.js for some easy time-based functionality. If the file does exist then it serves up the fragment as is.

If the cache file however doesn’t exist or is over 30 minutes old, it then checks to see if the image thumbnail and original have already been downloaded, and if not uses request to pipe them via a stream into cached files accessable on the client side. It uses Seq to do some parallel flow control, itterating over each photo to fetch the files and generate the HTML fragment for the client, finally spitting it out a string.

The next bit is to connect this up to the Socketio session - I do this through a configuration file and naming convention with the files. Below is the function called from the updated server code:

On the client side, I need to start the process off via the connection process that gives the HTML fragement back, and using jQuery it is injected into the page, with [fancybox][fancyboxy] being used to finish it off:

I’ll be releasing the source code soon via github and would really like to see feedback.

Upgrading Octopress With Nodejs and Socket.IO

| Comments

I’ve been playing around with the look and feel of my website using Octopress I’ve decided I’d love to add some functionality to the blog using some of my favourite tools - Nodejs and Socket.io.

I’m running an initial test an Expressjs server running behind a nginx server being a proxy.

Below is a small library I have that creates an instance which initial has only the express server attached - but by using call by reference I can pass it through to functions to attach extra features like a database, socket.io or something like the request library.

I’m planning to add some interactive functionality like updating the twitter feed and putting Instagram pictures in the sidebar, as well as serving the app through the express server and proxied through nginx. I’ll be updating the blog with progress on this work.

Octopress Migration

| Comments

This week I have been slowly moving all my existing hosting to one box with Linode. With that I’ve decided that it’s time to bring my blog back on to my own server as well, hosting it simply with Octopress. I’m also reverting back to my old blog name, Digital Spaghetti, while retaining my existing URL.

I’m not the most prolific blogger and I was using Posterous for a while - but I found myself hating using it quite a lot in the end, especially after they switched to the spaces interface which just seemed slow and clunky, and it put be off blogging.

I’ll be blogging more here - I find writing things in Markdown much easier. It fits in with my work flow and can be done straight in my favourite editor without too much WYSIWYG fannying about.

I’ll be covering my adventures in some new areas including iOS/MacOS development with Objective C, learning Ruby (a bit late to the game but my employer is a ruby shop so it seems a no-brainer) - as well as covering JavaScript, both client and server side as well as anything else that takes my fancy.

While I am doing the migration I’ll be tinkering with the theme a little as well - so it might look at little odd in places for a few days.