uWSGI and MySQL Connections

Written on Mar 10, 2014 about Python, MySQL and uWSGI.

The other day, I was investigating a minor performance issue with an internal API serivce. This service is implemented with python running via uWSGI whose main purpose is: fetch data from MySQL, process it, and then return result to caller. For some reason, exactly 1% of all calls to this service intermittently took 20-50ms longer than the rest.

...
Continue Reading

Sub-Second Sleeping in Perl

Written on Feb 21, 2014 about Code, Golf and Perl.

In perl, we can’t use the sleep function to do a sub-second sleep, because it takes an integer argument as the number of seconds. Normally, the cleanest way to do this is via the Time::HiRes module. For example if I wanted to sleep for a 100th of a second I would write:

...
Continue Reading

SGF.js

Written on Feb 16, 2014 about Code, JavaScript and Baduk.

When I started this blog I had intended that there would be a fair amount of Go content. As I sat down to write the first article, I had to embed a game record in the form of an SGF file in here. Currently there’s a wonderful open source SGF view/player/creator call eidogo. But when I tried embedding it here, the theme didn’t feel just right, and the mobile UX was a bit poor.

...
Continue Reading

A Typical Golfing Session

Written on Feb 14, 2014 about Code, Golf and JavaScript.

My last post was about why I golf. Now, I will explain the how and my personal thought process. As a side note, golfing isn’t for the impatient there are many times I will fruitlessly stare at 40 characters for an hour only to concede that there is not shorter representation. But now for some code, the program I will be golfing the Sieve of Eratosthenes up to 100,000 in javascript.

...
Continue Reading

Why I Code Golf

Written on Feb 13, 2014 about Code and Golf.

Let’s start off by defining what code golfing is. It is the challenge of “writing a piece of code as concisely as possible.” More technically, it is to minimize the number of characters or bytes need to represent that program. In practice, this means first writing some code, and then gradually reducing it bit by bit until we can’t anymore.

...
Continue Reading