Friday, June 22, 2007
Dev : HTML Comments
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
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
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
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
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
|
ftp_cmd.bat
|
Method 2:
Create 1 batch file (ftp_cmd.bat).
ftp_cmd.bat
|
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
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,
- Go to projects tab.
- Locate the project you wish to change the heap size, expand it.
- Look for a folder call nbproject.
- In nbproject, open the file called project.property.
- Locate a line in the file called "runmain.jvmargs=".
- Add in parameters. Make it "runmain.jvmargs= -J-Xms128m -J-Xmx256m".
- Save the file and rebuild your classes.
In Eclipse,
- Go to Package Explorer.
- Locate the project you wish to change the heap size, right click it.
- In the menu, find Run As > Run... .
- A new windows will pop up. Go to the Arguments tab.
- In VM Arguments text box, Add in parameters"-Xms128m -Xmx256m".
- Click Apply and rebuild your classes.
Sunday, January 28, 2007
Dev : Variables On Shell Script
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
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 :
- Login SQL*Plus with sqlplus "/ as sysdba".
- In SQL*Plus, type sql > create user user_name identified by user_password;.
- 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.
- In console, type cd /oracle/home/bin/.
- To start the oracle process, in console, type ./lsnrctl start.
- 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
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. :)