Rafael Baptista
Fixing File Descriptor Leaks in Long-Lived Servers

Fixing File Descriptor Leaks in Long-Lived Servers

May 21, 2013

So you’ve created a socket server that opens sockets over TCP/IP. After running it for a few hours under heavy load the operating system kills your process with the message “Too many open files”. What happened? The problem On most…

Binary distribution code

Fast Generation of Non-Uniform Random Numbers

April 3, 2013

Suppose you want to chose between several values randomly with uniform probability. That is, you might have 5 options, A, B, C, D, E. You want to chose among them with equal probability. You generate a random number from [0-1),…

Compressing Unit Vectors into 16-bits

Compressing Unit Vectors into 16-bits

March 27, 2013

Some years ago I posted an article about how to compress unit vectors, or normals, efficiently into 16 bits. The original article is getting harder to find, so I’m reposting a version of it here. Since the original article this…

Implementing Read/Write Locks Portably

October 13, 2012

In multi-threaded programs you often find a usage pattern where many more threads need to read a shared resource than write to it, and where reading the resource would be thread-safe without mutexes if it is not being written. (…

Detecting Crashes in Multi-Threaded Programs

October 12, 2012

Detecting crashes in multi-threaded systems can be difficult. Often the crashes are difficult to reproduce, and when they happen the faulty operation could have happened many calls ago and so the you don’t get a stack trace at the time…

Get USB Drive Serial Number on Os X in C++

August 10, 2012

Getting the serial number for a USB Serial drive on Os X is tricky just like it is to get a USB serial number on Windows. We want to get the serial number of a USB Flash disk that is…

Overloading Global operator new and delete

June 7, 2012

Programmers are often advised not to overload global operator new, and to stick to overloading just class specific operator new. The arguments against are many, but they basically boil down to that it is difficult to do it correctly. But…

Get USB Drive Serial Number on Windows in C++

June 1, 2012

Getting the serial number of a USB device in Windows is a lot harder than it should be. ( But it’s a lot easier than getting the USB serial number on Os X!) It is relatively simple to get USB…

Pseudo Functors and Template Magic

May 29, 2012

A functor is an object that works like a function. That is it overloads operator(). They are useful when you need to create a series of functions each of which works mostly the same way, but you want that instance…

Implementing Portable Threads and Mutexes

May 26, 2012

Implementing a portable framework for multi-threading doesn’t have to be difficult or error prone. With the right framework, implementing multi-threaded programs can be pretty simple, and you can hide all the platform dependent functions. You can also implement your threading…

About Me

My name is Rafael Baptista. I lead teams who build iconic digital products used by millions of people every day.

I'm currently working on an online travel agency called SkyMonde.

I was previously Head of Product at KAYAK. I built a very successful multi-brand SEO program for them that also included brands like OpenTable, Momondo, CheapFlights, Swoodoo, Checkfelix, and HotelsCombined.

I occasionally advise startups on SEO, the most successful of which is Insurify.

Previously I was CTO of Mimoco and worked on SEO at TripAdvisor focused on flights and vacation rentals.

For many years I was a game developer, helping make games for Harmonix, Apple, THQ, LucasArts, Nickelodeon, Ubisoft and many others. My biggest selling game was the Rockband Series.

I've worked on speech recognizers at Kurzweil, and genome mapping at the MIT/WIBR Human Genome Center.

I wrote the web server that this site runs on.

Social

linkedin icon stackoverflow icon

Projects

SkyMonde

An online travel agency

Demangler.com

Automatically demangles gcc C++ symbols

KJam Build Tool

A build tool like make or bjam