(Ken Struys' Blog)

web-developer, serious schemer

Just Let Me In: Hacking with the Twilio API

My apartment has a fairly standard phone system. You dial an extension, my cell is called and I can allow the caller to enter the building by dialing nine.

To let myself in I have a dongle that it's hooked into the system and to let you in. Unfortunately, when my girlfriend and I moved into the apartment, we were only given one dongle and were told we we're not able to get a second one.

For three months I've been using the system to call my own cellphone and letting myself in. The biggest problem with this solution is my android phone dies all the time and I've been left a couple times stuck outside.

I decided I needed a better system to just let me in my own building. Twilio provides the perfect service to solve the problem. Twilio is a web service API for building Voice and SMS based applications. When you signup, you get a San Francisco phone number for development and you can code simple XML documents to automate Dialing other numbers, Messaging, Playing audio, etc for basically pennies. Once you've coded you application you can pay around $1/month for a local number.

When I dial into my front door, audio is played asking whether you want to speak to myself (press one) or my girlfriend (press two). When you press either key, one of our two numbers are dialled and the system works as normal. Since I don't want to dial myself anymore, I also added a pin (some other combination of keys) that just opens the door by fooling the system into thinking I've dialed nine.

The Twilio code was really simple (it was about 20 lines of PHP). The only difficultly I had was getting the dialling 9 to work. Twilio does support dialling keys, but only after Dialing out to another number. I emailed the Twilio team and they said the easiest way to get it working was to use a program called audacity to record a 9 key tone. Playing this tone tricked the door system into thinking I had actually pressed the key. I was a little surprised to find out such a hacky solution would actually work, but then again a lot software solutions are hacks :P.

In the future I think I'll try to port my PHP solution over to a more Rackety approach. You could very easily use send/suspend provided by the web server to make the script even shorter/more clear.

Overall my experience with the Twilio API was fantastic, it's probably the easiest API I've ever had the pleasure of using and it's really impressive in it's simplicity.

Tips for a Canadian Developer moving to San Francisco

I moved to San Francisco about 3 months ago. Before moving I read Ian Chan's Tutorial about developers moving to the US and found it very useful. Step 1, read Ian's post, his post saved me a lot of trouble. I had a very similar experience and I decided I would share some of my advise as well.


Joel on Fogbugz and Kiln Presentation

Last week I had the pleasure of attending Joel Spolsky's talk on the work he's been doing at Fog Creek software. The two projects that were presented were FogBugz and Kiln. Fogbugz is a project management tool designed with a very high emphasize of project delivery dates. Kiln is a DVCS tool that is integrated with Mercurial.


Mobile Web Development

Recently I've been doing a lot of Mobile Web Development, and I decided I would write down a couple of the lessons learned buildng mobile web applications.


Mobile is generally a very different style of layout. You're restricted with the amount of information you want to put on a page and you have to consider things like browser resolution. Mobile web apps are portrait site with little to no fixed width/padded/margined elements. You avoid fixed width to make sure your product works on as many phones as possible. By fixing the width of an element, you create a minimum width of the page. You also want to make sure you fill the browser window and make use of the entire screen.


The Their, There and They're of Programming

Programming languages was my thing in University. I would look up every language I could find. I constantly asked myself why one language was different from another? Why do people have different opinions about how we should express solutions to problems? From COBOL to Java to Clojure, I’ve seen at least syntax and understand at least one reason why the language is/was needed.


Setting up PLT-Racket Hosting

Hosting for PLT-Racket (formally PLT-Scheme) can be very hard to find. Most hosting companies only support languages like PHP/Perl/Ruby and Python. I had a very difficult time finding a hosting that would actually support this site. In the end the solution was a Virtual Private Server (VPS). With a VPS you are given a VM with root access on a server that is shared by other VMs. Usually VPS is a really expensive option for hosting but I found real cheap VPS for $17US/m from Ultra Hosting.


Building a Scalable Web Architecture

A lot of people talk about building a scalable web architecture but don't actually explain what they mean. "Oh well you know use memcache and stuff", "No, that doesn't explain anything, how do you actually do it?". I'm sick of hearing it, so I'm going to explain how I do it. The best part about it is, other then server cycles/memory all the software I use are free. Here's a diagram of everything in the stack and that I will cover:


PLT-Scheme Web Development

I really hate having another blog on the web that explains how to make a blog but I do think mine is a little unique. My entire site is written in PLT-Scheme. I'm a really big fan of scheme especially for web development and I thought it would be hypocritical to write about how great scheme is for web development and have it hosted on wordpress.


Robocup Client

My last project at U of T was with Jonathan Doda, Daniel Lister and Philip Patchin. In 3 months we were given the task of making a reasonable soccer client (in fact an entire team of clients) for the Robocup Simulation League. Most clients in the league are developed by MSc/Phd students and are ready for competition within 2 years. The course was setup to get some ground work done and allow future students to fork our work.


Processing Raytracer

For a final project in a university course I completed a simple raytracer in C++. The raytracer included a couple different objects (Planes, Spheres and Cylinders), anti-aliasing, shadows, reflection and motion blur.

Over the summer I decided to wanted to hack with Processing and I partially re-implemented the project. I have posted my processing version here.

See Older Posts