Archive for June, 2009
June 24th, 2009 | 5 Comments »
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
[...]
Published in Uncategorized |
June 19th, 2009 | No Comments »
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
multiply(5) # returns [...]
Published in Uncategorized |
June 17th, 2009 | No Comments »
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 all [...]
Published in Uncategorized |
June 8th, 2009 | No Comments »
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 collecting many [...]
Published in Uncategorized |
June 3rd, 2009 | 5 Comments »
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 font-size only within the scope of this block.
</cssisland>
more html code… Here h1 has font-size bigger [...]
Published in Uncategorized |