Archive for June, 2009

Beware of the Singleton

The Singleton design pattern is well known and used among programmers. It is so easy to use that unfortunately it often gets misused. In Java a singleton usually looks like this: public class Singleton { private static final Singleton INSTANCE = new Singleton(); // Private constructor prevents instantiation from other classes private Singleton() {} public [...]

Defaults – a convenience or a time bomb?

All programmers at all languages are familiar with the concept of default values. Many languages allow default parameter values when calling a functions, some provide a function overloading mechanism which is an expansion of this idea. For example in python you can have named parameters with default values: def multiply(v, mult=2.0) return v * mult [...]

Yet another visual diff for git

I’m relatively new to git and I’m already in love with it, but there was one thing that bugged me and I couldn’t get a good answer anywhere else, so I wrote my own thing, posting it so maybe you can find it helpful. The problem: Use a visual diff tool for git; and view [...]

Flash and encryption? No way dude!

I was asked by a fellow worker whether flash can be? Short answer: no. Long answer below. But why would you even want to encrypt flash? I asked. He told me about a product he’s working on, some kind of hook for online games which identifies cheaters and bots as they play in real-time  by [...]

Required: CSS islands

Hey CSS guys, how about a CSS island tag?! This is what I’m talking about: <html> <style> h1 { font-size: bigger; } </style> <body> lots of html code…. <cssisland resets=”h1;h2;div.img;#id”> <style> h1 { font-size: smaller; } </style> here all page css code is preserved except for h1, h2, div.img and #id h1 has a smaller [...]