My new house is ready …

Half baked red brick

Leave a Comment

How to check Linux version

[root@siodb mysql]# cat /proc/version
Linux version 2.4.20-20.9smp (bhcompile@stripples.devel.redhat.com) (gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)) #1 SMP Mon Aug 18 11:32:15 EDT 2003
[root@siodb mysql]#

[root@siodb mysql]# cat /proc/version

Linux version 2.4.20-20.9smp (bhcompile@stripples.devel.redhat.com) (gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)) #1 SMP Mon Aug 18 11:32:15 EDT 2003

[root@siodb mysql]#

Leave a Comment

How to check Linux OS type

[root@siodb mysql]# cat /etc/issue
Red Hat Linux release 9 (Shrike)
Kernel \r on an \m
[root@siodb mysql]#

[root@siodb mysql]# cat /etc/issue

Red Hat Linux release 9 (Shrike)

Kernel \r on an \m

[root@siodb mysql]#

Leave a Comment

Removing numbers from a string

select translate(<column>,
         'ABCDEFGHIJKLMNOPQRSTUVWXY0123456789',
         'ABCDEFGHIJKLMNOPQRSTUVWXYZ') from dual;

Leave a Comment

My favourite song ever

Kak Ramlah

Ketentuan by Ramlah Ram

Tak semudah kau sangka
Melepaskan kau pergi
Read the rest of this entry »

Leave a Comment

Our new house is in progress

Just went back from visiting and checking our house progress. So far so good, can’t wait to see the finishing

Leave a Comment

PHP Parse Error: syntax error, unexpected $end on wordpress

You might encounter this error

Parse error: syntax error, unexpected $end in C:\Program Files\Apache Group\Apache2\htdocs\wordpress\wp-content\themes\hemingway\functions.php on line 647

when installing new themes for WordPress. I did encounter this when i have

  • Apache 2.0.63
  • PHP 5.2.6

running on my server.

Read the rest of this entry »

Comments (1)

Extracting tar file using JAVA

At last i found a library to untar / tar files using JAVA. Here i provide an example how to use the library. Some of the codes have been taken from other users in forums to enhance the code.

import com.ice.tar.TarInputStream;
import java.io.File;
import java.util.zip.GZIPInputStream;
import com.ice.tar.TarEntry;
import java.io.FileOutputStream;
import java.io.FileInputStream;
import java.io.*;
//————–
public void execute() {
TarInputStream tin = null;
try {
tin = new TarInputStream(new GZIPInputStream(new
FileInputStream(new File(tf.getTarFileName()))));
TarEntry tarEntry = tin.getNextEntry();
while (tarEntry != null) {
File destPath = new File( +
File.separatorChar +
tarEntry.getName());

if (!tarEntry.isDirectory()) {
// start of new code
String pathStr = destPath.getPath();
int idx = pathStr.lastIndexOf(File.separatorChar);
if (idx > 0) {
File destDir = new File(pathStr.substring(0, idx));
destDir.mkdirs();
}
// end of new code
FileOutputStream fout = new FileOutputStream(destPath);
tin.copyEntryContents(fout);
fout.close();
}
else {
destPath.mkdir();
}
tarEntry = tin.getNextEntry();
}
tin.close();
}
catch (IOException ex) {
ex.printStackTrace();
}
}

Leave a Comment

Uncompressing a File in the GZIP Format

Basically JDK1.4 has provided a library call java.util.zip for compressing and uncompressing gzip files.

try {
// Open the compressed file
String inFilename = “infile.gz”;
GZIPInputStream in = new GZIPInputStream(new FileInputStream(inFilename));

// Open the output file
String outFilename = “outfile”;
OutputStream out = new FileOutputStream(outFilename);

// Transfer bytes from the compressed file to the output file
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}

// Close the file and stream
in.close();
out.close();
} catch (IOException e) {
}

Leave a Comment

Creating a daily backup MySQL database in Windows

You may using Windows as your database server, but don’t know how to backup it, and some of you may use tools. You can actually do it by running this command

“C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqldump.exe” –host=localhost -uroot -ppassword –opt mydatabase > “C:\helmy\backup\%date:~10,4%_%date:~4,2%_%date:~7,2%_backup.sql”

It will create a file 2008_04_04_backup.sql

If you want to schedule it, put it on a backup_db.bat and ask Windows Task Scheduler to run it

Leave a Comment

Older Posts »