Thursday, December 27, 2007

Car Ownership Transfer

They say that it would take all day for the procedures to be done. Well, not so accurate. I would say "almost a full working day", that should be it. I've been through the hustle because I just did a car ownership transfer without bank loan recently.

Simple say, there are only 3 steps to get your transfer done. But yet, 2 among the 3 steps will kill your time. Ok, nothing is free and each steps require you to pay, pay and pay. Here is my experience.

Firstly, get your car to Puspakom. Bring your car registration card and RM30. Be sure that you be there early, else you would need to wait in the queue and it took me 2 1/2 hours to get through 5-7 cars queuing in front of me. They will inspect your windscreen (where your front windscreen transparency level must not be less than 70%, and 50% for the side windows and rear windscreen), car chassis number, car engine number and kereta-potong (which simply means 'cut-and-joint' cars in Malay).

After the long wait has been settle in Puspakom, you need to get your car insurance ready. Either you buy a new policy or get an insurance policy transfer from the previous owner. Transfer price will vary according to the available NCD/NCB. Get your insurance agent for the fee.

Lastly, the 2nd waiting session. Bring your car registration card, RM100, insurance policy/transfer letter of proof, Puspakom inspection result, K3 form, the owner and the new owner to JPJ to have your name printed on the car registration card. You can print your own K3 form at home and fill it up before going there. Well, I did called JPJ Putrajaya regarding this and they told me that neither the owner nor the new owner need to be there, Just get your photostated Identification Card verified by commissioner of oath. But it seems like JPJ Melaka is different. From their look (most are quite friendly, only one at the counter 29 seems scary and snobbish), they seem looking for both person. And I too heard that JPJ Melaka really do require both of them to be there from a friend. How true is that, I dare not challenge. I would not want my time wasted for nothing.

Wallah... Done... The formula on how to waste 1 full working day! Sigh... Driving from one place to another, which is certainly not near really waste much of the time.

But somethings I cannot understand why must we send our car to Puspakom for checkup before ownership transfer. It is really a waste of time. By the way, Puspakom is a member of DRB-HICOM, which is a private company. I guess it is just a way to make more money to team up with the government?

Wednesday, December 05, 2007

Dev : Telnet-ing

A simple tips to share to everyone. As we know, each program that dwells through the network will be communicating through a certain specific port. For example, MSSQL2000 is using port 1433, SMTP is using port 25 and ssh is using port 22.

If we fail to connect, lets say, the mail server of the company, we can actually do a quick check on the problem. Using windows telnet to connect to the network port would be a great start. It will just take a couple of steps to check on the SMTP port of the mail server. Although telnet is defaulted to connect to port 23, but with an additional parameter, we can also telnet to any desire port.

Steps (Make sure your firewall is off and network is up for clearer picture)
1. Open your Command Prompt (Start --> Run --> cmd).
2. Type telnet mailserver 25.
3. If you receive such message Connecting To mailserver...Could not open connection to the host, on port 25: Connect failed, this means most probably the mail server itself is down or maybe the mailserver daemon is not running. Daemon is a small program running in the background either waiting for command or run on its own on a specific port.
4. If you success, you will be brought to a new blank page (normally). This means the mailserver and port is running fine. You will need to check your mail browser instead. Press keyboard ctrl+] to disconnect the telnet.
5. Type quit to exit the windows telnet.

This is very useful, esspecially if you are trying to set up a program such as Apache webserver but you are not sure whether it is running fine or not. You can try connect Apache webserver on the local machine by using telnet localhost 80.

*Keep in mind that normal telnet is telnet ip_or_hostname_of_machine. Telnet checking should be telnet ip_or_hostname_of_machine port_used.

Wednesday, November 28, 2007

Dev : Getting HTML Dropdown/Combobox Label, Not Value

Something quite interesting on combobox my colleague had just asked me. Using javascript, how do we get the label value, instead of the real value of a combobox. well, umm... har.... how har? :-) I am not an expert in HTML and javascript, so scratching my head is the only thing I can do.

But after some research on the Net, I've found some resources that helped to solve the problem. You don't need to hide the label value somewhere or in the html option tag, just create your dropdown/combobox as normal, using this three tiny line of code in your javascript, and you're done!

var comboList = document.myform.combolist;
var comboValue = comboList.value;
var comboLabel = comboList.options[comboList.options.selectedIndex].text;

Monday, October 01, 2007

Dev : Tracing Users

My Gosh! Where is the file I have just created? It was here a minute ago....

So someone had log in and done something to your file. Who is it? You have over 100 co-workers here. So how do we actually see who had done something wrong? By using the command "finger" and "w", we might be able to get something straight.

Generally, the mighty "w" will help you to trace who had login to this server and what are they doing currently. "finger" instead, will let you see the list of logged in users, what time they are already in and from where (IP address) these users come from.

These are some commands that might help you to trace the culprit. There should be some other way to get a better "result" and I am still trying to study and find the best way, but for the time being, just bear with me. :-)

Monday, September 17, 2007

Dev : EUC_CN

Wow... something so alien to me. I encounter this encoding error during a test run on a project.

java.io.UnsupportedEncodingException: EUC_CN at sun.io.Converters.getConverterClass(Unknown Source) at sun.io.Converters.newConverter(Unknown Source) at sun.io.CharToByteConverter.getConverter(Unknown Source) at java.lang.StringCoding.encode(Unknown Source) at java.lang.String.getBytes(Unknown Source) at
:
:

I have no idea what is wrong and I definately didn't have any problem on my browser's encoding because I have run this projects million of times on my workstation. I turned in to my sifu when my brain juice started leaking out. Unlike me who had use the whole morning trying to figure out what the f*** is this, my sifu just took 5 minutes to solve my misery, and he told me that it is actually the problem of my jdk. I am using 1.4 for this particular tomcat and if I change to 1.5, it will definately work. He showed me an article of the problem too.

Yeah. It really works! Cool...

Friday, August 10, 2007

Dev : Failure of server APACHE bridge

This morning was an havoc when one of our web portal was not accessible.

We got something similar to this when accessing the portal.

This in a way was useful for the developers to understand what is happening.It could only mean one thing. Apache could not connect to weblogic. But for customer point of view, it is some mambo jumbo stuff that they would just say "Server Crash!".

I would suggest to all the developers and to those who concern, when webridge Apache to Weblogic (or might work for other webserver as well), to add in some stuff to make the "error" look more beautiful.
The steps are:

1. Add in your error page in apache_path/htdocs.
2. When setting your weblogic IfModule Location for your system, add in theErrorPage parameter.
E.g.:
    <location /myportal>
      SetHandler weblogic-handler
      WebLogicHost 192.168.1.152
      WebLogicPort 7004
      ErrorPage errorpage.html
    </location>
3. Restart apache.

Currently I see that some of us do not have this practice yet. It is always better that to let our client and customer see something useful, rather than rocket science stuff.

Friday, June 22, 2007

Dev : Checking Disk Usage on Unix

It is easy to use a UI to help you. Just like Microsoft Windows, right click and click properties from the list.

But how do we do it on the Unix console? Especially when your server does not have any UI installed. Just use df command and du command.

df is to check the disk free space from each mount point. Normally we would just
df -k
To see the list of mount points, the allocated, used and available disk space. It will also show some useful information such as percentage used and such. -k is to show the unit in 1024-byte, or in kilobyte form. In Linux, we can even use df -g or df -m to show in Gigabyte and Megabyte form.

du is known as Disk Usage. It can roughly let you know the disk usage of a certain directory, or directories. The easiest way of using it is as
du -ks /your/directory
where -k stand for 1024-byte unit, or in kilobyte form, and -s is the option to show the summarize usage of your directory. Else, every directory in the directory you specify will be shown.

Dev : HTML Comments

"Ok guys. The below HTML code is for displaying table.". So how would you write it in your HTML?

Normally, it should be something like this:
<!-- Ok guys. The below HTML code is for displaying table -->

But have do you notice that the number of hyphen, "-", at the end is always even? Else, you will commented those needed part as well. This is about something called Legal Comment. To read more, go here.

Thursday, June 21, 2007

Dev : Java Spring + Valuelist

I've been wondering, my other Valuelist seems fine when I try to call the page. But there is one page, each time when I submit my request, it will return me:
java.lang.NullPointerException
at net.mlw.vlh.web.ValueListRequestUtil.getRequestParameterMap(ValueListRequestUtil.java:71)
at net.mlw.vlh.web.ValueListRequestUtil.buildValueListInfo(ValueListRequestUtil.java:123)
at net.mlw.vlh.web.ValueListRequestUtil.buildValueListInfo(ValueListRequestUtil.java:106)

Where the error comes from? It is from a my line of coding as below:
ValueListInfo oValueListInfo = ValueListRequestUtil.buildValueListInfo(request);

What could have been the problem? After changing here and there, finally, I've found the caused of my misery:
<form name="aForm" enctype="multipart/form-data">

Don't know what is the reason, but hoping soon to find out when free, after I remove the enctype="multipart/form-data", everything is running as usual. Ha!

Wednesday, May 23, 2007

SSH and FTP on Ubuntu

My home pc is finally free from windows. I have formatted my pc for linux, more specifically Ubuntu, from the debian family. Unfortunately, after the installation, I have failed to SSH and FTP to my newly installed machine.

What should I do? After getting suggetion from Steven to install the service because most probably it is not in by default, it works! Thanks sifu~~

There are 2 websites that I refer to, NBLUG and Cyberciti, and thanks to them, I manage to run both services.

To make it simple, to install SSH and FTP, just type "sudo apt-get install ssh" and "sudo apt-get install vsftpd" respectively for each services. To change the setting of SSH, you may go to "/etc/ssh/" directory to find out more. If you are wanting to modify FTP setting, you may want to modify "/etc/vsftpd.conf".

Monday, May 21, 2007

Dev : Oracle Export and Import

Basic backup and restoring user in oracle using console is rather easy. First of all, what is a user? User in Oracle should be something we call a "database" in most relational database, such as MySQL and MSSQL.



So now, how do we backup a user? Some simple step will do.

Lets say we are tring to backup the user "newDB" and the password is "12345".

1. Go to console.
2. type "exp newDB/12345" and enter.
3. follow the steps. Normally by clicking "enter" will do. If you wish to change the name of the backup file, you may change it in one of the option.

Ok. Once your backup is done, you may want to store it to another location. So, in case of natural disaster, choi... We can get the dump file and recreate our database. But how?

1. Go to console.
2. Create new user, grant DBA permission.
3. type "imp newDB/12345 FILE=/get/dump/file/directory/dbdump.dmp FULL=y LOG=newlog.log" and enter.

See? Really as easy as 1-2-and-3! :)

Friday, April 06, 2007

Dev : FTP-ing In Windows Using Script

Have you ever using FTP in Windows? Commands are almost similar with Unix. You may have use Unix Shell script, but have you tried using Windows batch file to help you do the job, for example, getting some log files from a Unix Webserver, without the hassle of typing repeating ftp commands?

There are 2 method.

Method 1:
Create 2 files. 1 is a text file (ftp_cmd.txt) , another is a batch file (ftp_cmd.bat).

ftp_cmd.txt


FTPuserLogin
FTPuserPassword
cd /user/define/location
mget userlogfile.log
y
bye



ftp_cmd.bat


@echo off
ftp -s:ftp_cmd.txt serverhostname



Method 2:
Create 1 batch file (ftp_cmd.bat).

ftp_cmd.bat


@echo off

echo FTPuserLogin> ftp_cmd.txt
echo FTPuserPassword>> ftp_cmd.txt
echo cd /user/define/location>> ftp_cmd.txt
echo mget userlogfile.log>> ftp_cmd.txt
echo y>> ftp_cmd.txt
echo bye>> ftp_cmd.txt

ftp -s:ftp_cmd.txt serverhostname

del ftp_cmd.txt



Please take note that the batch file cannot be named as ftp.bat. This will cause confusion between your batch file and ftp command and it will keep on displaying a loop. Every details must not end with a white space.

Monday, April 02, 2007

Dev : Adding New User

In Solaris, adding user is not as 'too' simple as in Linux.

When we use "useradd -d /home/unixuser unixuser" in Linux, we will be automatically create a user called unixuser and a new directory call /home/unixuser will be created.

However, in Solaris, "useradd -d /home/unixuser unixuser" will only create a user call unixuser, but no user home directory will be created. To make it easy, just add in an extra parameter called "-m", as in create home directory. So the better command for created user in Solaris should be "useradd -d /home/unixuser -m unixuser".

For more information on unix useradd, see here.

Tuesday, March 20, 2007

Dev : Increasing Heap Size Memory

Ever been in a situation where when you try to compile your projects, and all in a sudden, out of memory error occurs. Funny, I have sufficient memory on my pc, but what could have gone wrong? My task manager was showing low memory usage.

This probably could be caused by the heap size memory setting. Most setting, by default, is low. So how do we increase this so call memory? I have been using netBeans and Eclipse IDE for my development. So what I known of is in netBeans and Eclipse only.

Lets say we would like to increase the size to a minimum of 128Mb and maximum 256Mb,

In netBeans,

  1. Go to projects tab.
  2. Locate the project you wish to change the heap size, expand it.
  3. Look for a folder call nbproject.
  4. In nbproject, open the file called project.property.
  5. Locate a line in the file called "runmain.jvmargs=".
  6. Add in parameters. Make it "runmain.jvmargs= -J-Xms128m -J-Xmx256m".
  7. Save the file and rebuild your classes.

In Eclipse,

  1. Go to Package Explorer.
  2. Locate the project you wish to change the heap size, right click it.
  3. In the menu, find Run As > Run... .
  4. A new windows will pop up. Go to the Arguments tab.
  5. In VM Arguments text box, Add in parameters"-Xms128m -Xmx256m".
  6. Click Apply and rebuild your classes.

Sunday, January 28, 2007

Dev : Variables On Shell Script

A=100
B= $A+100
echo $B

What will the next line show?
a) 200 b)100100

If you answer b, then congratulation! But is there any way of making the answer a? Yes, there is. By using the keyword 'expr', the problem is solved. But how?

In the second line, instead of B=$A+100, change it to B=`expr $A + 100`. Remember the white spaces between the '$A', '+' and '100'. We can also use it for subtraction, comparison and other useful usage as well. You can either use the unix man expr, or click here for more information.

Thursday, January 25, 2007

Dev : Installing Oracle 9i on Solaris 8

Whew... It's really a mess to install oracle in Unix machine. Lucky for me, I've found some steps online where it has reduce many white hair growing on my head.

It make me sweat when asking me to change the Solaris Kernel Parameters. After some troublesome findings, I finally manage to change the kernel parameters at /etc/system and manage to get the oracle 9i installed and database created. If not, you will always get oracle error complaining "Out Of Memory". Remember, it is the kernel parameters' fault. Not your RAM, not your SWAP (because I have increase my RAM from 512Mb to 1Gb and SWAP from 500Mb to 1.5 Gb :D ).

After installing and created a database, you need to create at least a user.
To create a user :
  1. Login SQL*Plus with sqlplus "/ as sysdba".
  2. In SQL*Plus, type sql > create user user_name identified by user_password;.
  3. Grant some access for the user.
    sql > grant connect to user_name;
    sql > grant resource to user_name;
    sql > grant create any snapshot to user_name;

After that, to access oracle from other workstation, you should start the oracle process first.

  1. In console, type cd /oracle/home/bin/.
  2. To start the oracle process, in console, type ./lsnrctl start.
  3. To start the database, in console, type ./dbstart.

And there you go! The very basic of oracle. :)

Wednesday, January 17, 2007

Dev : Swap for Solaris

How do we add extra swap space in Solaris version 5.x? For the ease of most users, follow the steps as below...

1. Log in console as root.
2. In console, type root: /usr > df -k to see the available space and the available swap by typing root: /usr > swap -l in console.
3. Locate a suitable location, create a file for swapping. Eg, to create an empty 1 Gb file call swapfile: root: /usr > mkfile 1g swapfile
4. Add the swapfile to the swap. Eg: root: /usr > swap -a /usr/swapfile (must use absolute path)
5. Edit the /etc/vfstab, add in a new line call /usr/swapfile - - swap - no - to enable the swap file at the next boot.
6. Check your swap again by by typing root: /usr > swap -l in console. You will find that there is a new swap available and you are ready to use it. :)