Quit Seems to be the Hardest Word

Posted on August 16, 2010 at 16:12 Sweetest Downfalls 5 Comments

A while ago I came by the office where I was a trainee for the last three weeks. On my way, I wasn’t able to control my nervousness. But when I stepped out of the elevator, there was definitely no turning back. The receptionist gave me way and asked, “You’re that trainee, right?” I don’t know; yet sometimes, I just feel like getting close to people only when I’m already on the verge of “leaving” them.

My talk with the HR employee was so comforting that I could’ve talked to her for the rest of the day. The sad part? I was talking about not getting hired. Upon hearing a word from my fourth language, she gladly told me that it’s okay if we converse with it. Funny how the receptionist added, “I’ll just go out, so that you two could talk. I bully him, y’know.” It would’ve been nice, actually, but I think it just won’t work out in the end. Sayang… I never went out with them.

Java Implementation of “Inception”

Posted on August 14, 2010 at 21:14 Java 2 Comments

Inception

Feedback from friends, positively spoken and written (statuses), kept me wondering what the movie really was all about. I never set my eyes on it because the trailer didn’t intrigue nor enlighten me as a layman. But as it turns out, it’s way more nerve-wracking than you can think of.

After seeing a pseudocode post from my adviser and visiting the big screen, I knew I just had to make my own — a recursive one. To experience euphoria, I dug an implementation. What the program does is very simple. It asks for the levels of dream you wish to experience, and then prints out the time spent on each level. You’ll see…

Inception.java

void dream(int level) {
   if(level <= 0) {
      return;
   }

   try {
      System.out.print("Level " + level + ": ");
      long startTime = System.currentTimeMillis();
      Thread.sleep(1000*level);
      long endTime = System.currentTimeMillis();
      System.out.println((endTime-startTime) + " ms");
   } catch(InterruptedException ie) {}

   dream(level-1);
}