Author: gpanther

  • On benchmarks

    Numbers every programmer should know and their impact on benchmarks Disclaimer: I don’t mean to be picking on the particular organizations / projects / people who I’ll mention below. They are just examples of a larger trend I observed. Sometimes (most of the times?) we forget just how powerful the machines in our pockets /…

  • Proxying pypi / npm / etc for fun and profit!

    Package managers for source code (like pypi, npm, nuget, maven, gems, etc) are great! We should all use them. But what happens if the central repository goes down? Suddenly all your continious builds / deploys fail for no reason. Here is a way to prevent that: Configure Apache as a caching proxy fronting these services.…

  • Programming advent calendars for 2013

    Programming advent calendars are posts/articles for a particular topic posted daily between the 1st and 24th of December. They are modeled on the advent calendars received by children on some countries which contain 24 doors for the 24 days of advent and behind each door is a piece of chocolate or other surprise which the…

  • Cleaning up Google AppEngine Mapreduce Jobs

    Do you use the Google MapReduce library on AppEngine? And do you have a lot of completed tasks which clutter your dashboard? Use the JS below by pasting it into your developer console to clean them up! (use it at your own risk, no warranty is provided :-)) schedule = function() { window.setTimeout(function() { var…

  • Capturing your screen on Ubuntu – with sound

    Today I have a short script which I cobbled together from Google searches to do screen captures / screen casts with Ubuntu (including audio in so that you can narrate what is going on): #!/bin/bash Xaxis=$(xrandr -q | grep ‘*’ | uniq | awk ‘{print $1}’ | cut -d ‘x’ -f1) Yaxis=$(xrandr -q | grep…

  • Tips for running SonarQube on large / legacy codebases

    Crossposted from the Transylvania JUG website. SonarQube (previously Sonar) is a quality management platform aimed mainly at Java (although other programming languages are supported to a varying degree. Here are a couple of tips to get it working on legacy projects: There is an Ant runner and a standalone runner, it is not mandatory to…

  • Nested fluent builders

    Crossposted from the Transylvania JUG website. Builders have become commonplace in current Java code. They have the effect of transforming the following code: new Foo(1, 5, “abc”, false); Into something like Foo.builder() .count(1) .priority(5) .name(“abc”) .canonical(true) .build(); This has the advantage of being much easier to understand (as a downside we can mention the fact…

  • Passing UTF-8 trough HTTP

    These days we should write every code as if it will be used by international people with a wide variety of personal information (just look at Falsehoods Programmers Believe About Names for some headscratchers). I would like to do add my small contribution to this by showing how UTF-8 encoded strings can be passed into…

  • Connecting to the MtGox market data feed using Perl

    For a recent project I needed some realistic market data for an electronic exchange. Seeing how MtGox provides free and open access to theirs (thank you!) I chose them. However none of the examples floating around the internet seemed to work, so I whipped one up using Net::Async::WebSocket::Client. Enjoy: use IO::Async::Loop; use Net::Async::WebSocket::Client; my $client…

  • Converting datetime to UTC in python

    So you need to convert a python datetime object which has a timezone set (“aware” in the Python nomenclature) to an UTC one with no timezone set (“naive”), for example because NDB on GAE can’t store anything else. The solution will look something like this: date = date.astimezone(tz.tzutc()).replace(tzinfo=None) For searcheability: the exception thrown by NDB…