Variable scope in Ruby

One big difference between Perl and Ruby is that Ruby has no lexical variables. This confuses me when programming Ruby, because I’m used to thinking ifwill create a new scope. It doesn’t. Variables defined inside if will be available outside, because they belong to the method scope. For example, in Ruby you can do this:… Continue reading Variable scope in Ruby

The Heartbleed bug

On reading about the Heartbleed bug bug, my first thoughts were: This sounds quite simple, is it really easy to spot? Why wasn’t this noticed during review? The bug is in the Heartbeat Extension for TLS, as described in this draft. Interestingly, this document does actually highlight the importance of checking the payload length: If… Continue reading The Heartbleed bug

10 Singlish phrases I would actually use in the UK

Possibly not everyone knows that English is an official language of Singapore (one of 4.) What’s more, there is an unofficial (and sometimes frowned upon) mini-language called Singlish, derived from bits of Hokkien, Teochew, Malay, English and Tamil. Most of these words exist either to express something that does not have an English equivalent, or… Continue reading 10 Singlish phrases I would actually use in the UK

Free tissue packs

This is a common sight at lunchtime in Singapore: tissue packs, often several next to each other, seemingly left behind on the table. One might, upon first encountering this phenomenon, assume this is the generous act of kind strangers. But it is not. You must not take the tissues. For they have an important message,… Continue reading Free tissue packs

Settling in Singapore

So I’ve been in Singapore just over a week, and so far it’s going pretty great. It’s ridiculously easy to settle in here. Everything is crazily efficient and convenient. I think even if you’d never been here before and wandered around aimlessly for a whole day, you’d still find everything you needed. I kept my… Continue reading Settling in Singapore

On moving

In a little over 4 weeks I’ll be starting an exciting new chapter in my life. I’ll be moving to Singapore, staying in an area called Sengkang, to be with my girlfriend Brin. And strangely, I’m not feeling nervous about it. Perhaps I will nearer the time. But I’ve had a lot of time to… Continue reading On moving

Writing a poker server in Ruby: part 1

About a month ago I embarked on the project of writing a poker bot. It has all the things I enjoy about programming: it’s open-ended and can always be improved, it can be played against, and AI features heavily. There’s also a wealth of research on the topic: poker-ai.org and The University of Alberta Computer… Continue reading Writing a poker server in Ruby: part 1