Monday, December 31, 2007

Start up Oracle XE in Ubuntu

I'm currently studying Oracle 10g express edition with a new book I just bought, called the Hands-On Oracle Database 10g Express Edition for Linux. Picking up this book perhaps might give me some speed to adopt oracle as my company was using oracle 9i for pl/sql development. However, there are couple of problems.

Starting up Oracle XE:
There one problem in starting up oracle 10g in Ubuntu after you restart the computer, which is it wouldn't start(if you didn't enable the "Start Oracle on logon" option) unless you login as Oracle user account. One way I found out to start the listener and database, without login as Oracle, is to run the restart command.
sudo /etc/init.d/oracle-xe restart
I don't know whether this is a security bug because firing the command start and stop doesn't work using your own login.

Check the database status using the following code:
sudo /etc/init.d/oracle-xe status
Sometimes, the database won't start after firing the restart command even the listener is active. Start the database using the menu path and check the status again. error

/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/[[:not found
This also a common error if the terminal is set with the oracle environment or execute the sqlplus command. The solution is to edit the line from [[ to [ in the file.
#if [ -n "$LC_ALL" ]; then
#elif [ -n "$LANG" ]; then
Update: Running SQLPlus in Terminal
1. Copy the content in /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/
2. Open the file .bashrc in your home folder using text editor.
3. Paste the content from to .bashrc at the end.
4. Restart your terminal and type sqlplus.

Edit Object Code Error

From the screen shot, it shows triggers edit code page but there is no code in test area (and it doesn't allow me to edit either). I'm not sure whether this is a bug even after I ran update on oracle. Perhaps this edit object page works for other Linux distro but it sure didn't work on Ubuntu Gusty.

The workaround to solve this medium bug is to download the Free Oracle PL/SQL Developer and edit it from there. Or I can just drop the trigger and recreate again.

Update: Thanks to BigO for the alternative way to set up the configuration and Thanks to Halil-Cem for providing a better way to start and shutdown the database. Please check the comments for information.

Reference: Oracle-xe on Ubuntu, Oracle Express Online Documentation, Oracle 10g Express Edition

5% that makes the difference

I happen to bump into this article, The Mythical 5%, from digg.

My favorite quotes in the article:
"It's a commonly held belief in our profession: if you're not smart enough to deal with the technology, you go into management. Over time I very slowly learned that the task of management wasn't stupid, it's just very, very hard. That's why all those stupid decisions are still being made; management is much harder than technology because it involves virtually no deterministic factors. It's all guesswork, so if you don't have good intuition you'll probably make stupid decisions."

Books highlight in the article:
Waltzing with Bears

Learning is a never ending process. Not just to gain more skill or knowledge but also maintain yourself in the 5% group.

Sunday, December 16, 2007

Wake up from the perfect code world

I caught an interesting article regarding programming from reddit. It's about programming should not be taken lightly as those books on the shelf "Programming XXX in 24 hours" since there are no such books for mathematic or physic. It is a long term effort of learning to achieve not just to code for yourself but also for others programmer who is going to maintain your code.

On the next article, which is a reply to the first one, stated that programming should be master on the foundation. Practices on programming should be done on daily basis to improve the skill, just like a musician.

I agree on both articles and I really support the ideas of they provided; if you're always working on a new project or perhaps pick up a language on your leisure. So what happened if you join a company to maintain their existing system and found out their product is written with bunch of junk code and hard to maintain. Highly skill programmer will not able to do a thing and here is why:

1. Cost: You will be stop if you're trying to refactor the code to make it more easier to maintain or perhaps improve the performance. Because by doing so, no revenue generated for the company as customer didn't notice or request for it. You will be costing the company valuable man hour if you attempt to do so. Beside that, most of the time will spent on supporting the software as it has generate so much of bug report that you don't have time to refactor it.

2. Risk: You can't refactor as it might cause new bug on a the transactional system. A system where money is involved and having a bug causing the whole system down will be big lost for the customer. Nobody wants to take that risk. There are also a mindset of "If it is working, don't touch it", which proves to be right.

3. Management: You have the idea, the solution, the plan to make the whole thing worked and presented it to the management to approve it. Due the 2 factors above, your idea will nevertheless be washed down to the drain. However, there always a exceptional cases where large company with enough money to spend on for such project. I have seen in done before but chances like this does not usually happened.

The 2 articles above, for me, is more suitable for solo experience and long term skill improvement. Both shows the essential idea of how to become a great programmer. However, both good and bad programmer does exists. No matter how highly the skills are, there no way to run from dealing with bad codes.

So, wake up from the perfect code imagination world and welcome to the real world.

Update - Related artiecle: Nobody Cares What Your Code Looks Like