Tom Hallam

Programmer, Drummer, Technical Writer, Occasional Speaker

Read this first

Building a voice app with Node, Twilio, Compose and Heroku - Part 2

So in my previous post I gave you a brief overview of what it was that I was trying to achieve here. Use a load of decent APIs to create a service that doesn’t exist right now (probably for a reason?).

The idea is to create a service that I can call from a phone and retrieve phone numbers that I’ve put in to a website, and be connected. You enter in a user ID and your PIN code, and you can choose from a list, and eventually be put through. This could be useful if your phone has run out of battery or you can’t get to your contacts for some reason. As I said, this might not be useful to anyone - but my phone is always giving up on me so I thought might as well try.

 Setting up the project

So when express-generator creates your project - it gives you a load of scaffolding structure for your site - and for us, that’s perfect. The structure looks like this:

-- bin/

Continue reading →

Building a voice app with Node, Twilio, Compose and Heroku - Part 1

I’m challenging myself today. My hangover Saturday. It’s just no good sitting around in my dressing gown watching the same Simpsons episodes I did when I was hungover last week. It just doesn’t warm the soul.

My challenge was to use some of these incredible APIs I read about every day, these APIs that I look at and thing - wow, I could make something really good. But do I? No. Thinking about doing something and doing something are two very separate things, unfortunately.

But this stops now.

Picture the scene, you’ve agreed to go and meet some friends somewhere, but its the end of the day and you forgot your phone charger. Your phone slowly splutters out of charge, looking up at you with its big flat face, wondering what went wrong in your relationship together that lead to you not taking even basic precautions to ensure your phone remains charged and loyal to your needs. Luckily...

Continue reading →

Dokku & DigitalOcean

I’ve just got round to exploring Dokku. It seems these days all I need to do is type <name of cool nerdy thing> digitalocean into Google, and invariably I am greeted with a plethora of handy, in depth tutorials that tell me how to install, configure, scale and secure it.

All of these one click installs, while incredibly convenient, are certainly eating into my money for food. But who needs sustenance when you’ve got a fully container-based Platform for deploying self-contained apps?

Not me.

Something I’m looking at more and more is the Devops side of things. I think it’s really important to fully understand your environment when you’re developing anything server side, and especially as those apps need to scale, or involve seperate moving parts like realtime, queuing and all that.

For me, the holy grail is to have a versioned application (which I generally host on a private Github...

Continue reading →

Debugging with Node.js and debug

One of the things I find most useful when creating complex Node.js applications is easily seeing what component of the code is generating console output.

Now, it’d be pretty easy for me to simply bash in a command such as this:

But there are a couple of problems here:

  • The log is output as a nondescript white line of text. If there’s a few of these in an application that processes it’s data in a matter of milliseconds, it’s easy for them to get lost
  • The log output from my User Model is no different from the log out from my Socket Component. If you have similar debug traces it soon becomes a bit of a confusing affair.
  • The time between these logs is impossible to tell.. Did it take two seconds? Did it take 5 minutes?

These problems and probably more can be solved using one pretty simple NPM Plugin - Debug.

Install with the following command:

npm install debug

Continue reading →