Category: programming

  • 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 […]

  • The wrong time to update software…

    is when the user is the busiest, for example when s/he just started your application. See for example the screenshot below with Adobe Air (click trough to see it in its full beauty). The mistakes it makes: It tries to do the update when I’m trying to start Grooveshark (it interferes with my intention) It […]

  • Is hand-writing assembly still necessary these days?

    Some time ago I came over the following article: Fast CRC32 in Assembly. It claimed that the assembly implementation was faster than the one implemented in C. Performance was always something I’m interested in, so I repeated and extended the experiment. Here are the numbers I got. This is on a Core 2 Duo T5500 […]

  • Java has some surprising amount of dinamism in it

    Not long ago I saw some java code from Simone Tripodi. It generates synchronization wrappers around arbitrary objects at runtime in a typesafe manner with a couple of easy to understand lines of code. The heavy lifting is done by the dynamic proxy mechanism available from Java 1.5 if I recall correctly. The downside is […]

  • Java Date objects can mutate, even when read

    Ran into this problem a couple of months ago, when we saw some strange dates in production. So I dug into the Java library sources (thank you Sun for providing those!) and found that Date objects aren’t always “normalized”. Rather, sometimes a “denormalized” value is stored which is later (lazily) normalized. The normalized value isn’t […]

  • Putting the eval into Java

    “eval” (short for evaluate) is usually the name given to the method in dynamic languages which makes it possible for the programmer to access the compiler / runtime. Here are a few links to the documentation for the function in different languages: Javascript Perl PHP Python Ruby LUA They are usually used to quickly evaluate […]

  • Updated YARPG

    This has been sitting in my queue for some time: almost four years ago (it’s incredible how time flies!) – amongst the first posts I’ve published on the blog – I’ve written a random password generator in Javascript which I’ve named YARPG (for “Yet Another Random Password Generator”). The advantages to using it are the […]

  • Sending an X-Face email with Perl+GMail

    In the latest Software Freedom Law Show Bradley mentioned the X-Face email header and challenged listeners to send them an email containing the X-Face header. So here is the small Perl script I’ve whipped together to send them an email trough GMail: use strict; use warnings; use Net::SMTP::TLS; my ($from, $password) = (‘…’, ‘MySuperSecretPassword’); my […]

  • Performance optimization techniques for Java code

    Yesterday I gave a presentation at the Transylvania JUG about using profilers and different techniques which you can use to work around the discovered performance problems. Below you can find the embedded presentation. If you are interested in the code samples (as you most probably are, since a big part of the presentation were demos), […]

  • Solving mathematical puzzles with brute-force and Perl

    After talking a lot about optimizations and selecting the right algorithm, here is a little brute-force code. This particular one gives the answer to the following puzzle from Richard Wiseman’s Blog (one well worth following BTW): Can you make the number 24 with the number 5, 5, 5, and 1 (again, you cannot join the […]