Wednesday, February 28, 2007

Important task completed - lessons learnt

Finally completed the important task early this week, the tight deadline didn't allow for much room for errors, but this year's job seems especially problematic. The documentation is quite outdated, and the scheduled timing of the jobs are way off. This affected with the planned execution, and the problem was exacerbated by the shorter working days due to Chinese New Year. Then the network was constantly disconnecting, so there was a need to constantly monitor and rerun the jobs. And it's my first time running the jobs, so needed a lot of help from users, colleagues and some trial and error.

Overall, I did learn some things:

  1. Creating an index on database tables is not sufficient to ensure fast queries. Always check the execution plan to see if the index is being used, as sometimes overindexing will cause Oracle to use a full table scan instead.

  2. Be careful of ending commands and statements in SQL Plus with "/" instead of ";". If a command such as "spool C:\file.txt" is ended with "/", the last run statement will be run again, which can be a problem.

  3. If the rollback segment is insufficient, it may be possible to split the query into smaller batches to run and thus not trouble the DBA.

  4. Always check if an object with the same name already exists when creating new objects in scripts and do not commit in the script to save some headaches.

  5. Check if CPU usage in Win XP is a bottleneck by checking if the TaskManager constantly reports a usage of 100%.

Wednesday, February 14, 2007

Tang Lingyi on “Way To Go”

Way To Go

Even though Tang Lingyi (汤灵伊) was eliminated in the first round of Project Superstar, you can still get to watch her on TV  on Channel U's "Way To Go". She's the one in orange, for those who don't know. She's not the only cutie on the show, watch out for Macy Chen (陈美心) too. Macy is also appearing on "On The Beat".

Monday, February 12, 2007

Broken stuff for Chinese new year

Chinese New Year is usually associated with bringing it the new and chucking out the old. But this his not especially true for of this year. Let me count the number of spoilt stuff in my house. Desktop, printer, DVD player, TV set, laptop, hand phone. And the new stuff I have? A Nokia E60, from which I am making this post. At least I'm not completely unconnected.

Wednesday, February 7, 2007

SCJP Prep - when dividing by zero is ok

One of the most common examples used to illustrate exceptions is the "division by zero" example.
Exception in thread "main" java.lang.ArithmeticException: / by zero
I think I've seen it in a few Java books, so I've always had this impression that it's never ok to divide a number by zero. Until I started preparing for the SCJP, that is. I ran the code below.

[java]
import java.io.*;

class TestDivideByZero
{
public static void main(String[] arg) throws IOException
{
System.out.println(1/0.0); //prints "Infinity"
System.out.println(1.0/0); //prints "Infinity"
System.out.println(-1/0.0); //prints "-Infinity"
System.out.println(-1.0/0); //prints "-Infinity"
System.out.println(1/0); //runtime error here
System.out.println(-1/0); //runtime error here
}
}


So what's up? According to Sun:


Despite the fact that overflow, underflow, division by zero, or loss of information may occur, evaluation of a floating-point division operator / never throws a run-time exception.