On the ubiquity of morality

It's not often that one has the pleasure to write about topics that concern both programming and philosophy (to a certain degree).

Yesterday, Coraline Ada Ehmke announced on Twitter her incorporation to the GitHub team (source). Thought I didn't know anything about her until today, she seems to have been polarizing people in the open source community for a while, regarding her views about people's stance and declarations concerning LGBT. One of the top comments about this on reddit links an issue in which she demands the removal of a contributor from the project on the basis of a transphobia accusation. She links a thread of tweets of the aforementioned contributor.

Anyway, let's get started with the interesting question.

Read more

My experience in Sweden

It's been a really long time since I last wrote, so I'd like to share what I've been up to.

Read more

2d trees

I have uploaded a new snippet to Proving Ground: 2d tree. I just wanted to implement a k-d tree in JavaScript. There are some things which are not necessary (storing the rects in the nodes for instance) but that make some of the operations easier to implement (range and nearest neighbours queries for instance).

Read more

Getting rid of the spam

In the last two weeks the spam has run rampant in the comments of the blog, even though I have not linked it from anywhere, Google managed to find it and probably is a gateway to the bots. I decided not to include (again) a reCaptcha in the comments submission form because it is quite annoying, so it was time to set up a spam filter.

I came up with the idea of using a statistical, content-based approach on this, and very little googling led me to find Paul Graham's A Plan For Spam, which made me decide for this method.

I have coded a simple Bayesian classifier which takes into account which words appear in spam comments and which don't. So far it has been effective in filtering spam (no false negatives), but since I have no readers yet (this web is taking too long to publish) I cannot speak for false positives.

Anyway, I am sure that as false positives arise (if they do) and I flag them as not spam, the classifier will train correctly on recognizing spam and not spam.

Isolating a bug

Bugs are all over the tinyest piece of code. There is a reason why we need to test our code: in most cases, our code does not behave as we expect it to do. Causes range from poor understanding of the language internals (integer overflow, floating point rounding error, implicit type conversion aka coercion...) to bad algorithm implementations (e.g. forgetting to initialize a list of distances or not considering corner cases). A good test base will help us find most of these errors, by telling the test runner what we expect will happen given certain conditions.

However, tests won't tell how to fix an error, but they provide useful feedback to help us find its source (and most importantly, they assert that indeed there is an error). That's the reason why many code repositories won't accept a bug fix unless a test is provided for the error that it addresses. That's the case of this story.

Read more