My favourite song ever

Kak Ramlah

Ketentuan by Ramlah Ram

Tak semudah kau sangka
Melepaskan kau pergi
Hati yang meronta, hampa kecewa
ku tekad sembunyikannya dari pandanganmu

Ku rela begini
Berakhirnya di sini
Dari bersamamu terus berpura
Setelah cinta tiada lagi di hatimu

Chorus

Ku hapuskan airmata dari mengiringi
Kesengsaraan mengharung perpisahan ini
Ku pujuk jiwa nestapa
Pendamkanlah duka
Pasrah pada lara ketentuan ini

Tak semudah kau rasa
Melepaskan kau pergi
Hati yang terluka dikunjung jua
Kerinduan yang tidak tertanggung terhadapmu

*Bridge

Sesungguhnya
Ku tahu betapa sukar untukku
Menempuh hidup
Walau sehari tanpamu
Ku terseksa

Add comment May 28, 2008

Our new house is in progress

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

Add comment May 11, 2008

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.

The error may caused by a missing curly bracket in PHP script coding. Beside, it may also caused by error in PHP coding in class definition, as in PHP, a class definition cannot be broke up and distributed into multiple files, or into multiple PHP blocks, unless the break is within a method declaration.

To solve it. Open PHP.ini and change the variable below
short_open_tag = Off

change to

short_open_tag = On

Add comment May 8, 2008

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();
}
}

Add comment May 7, 2008

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) {
}

Add comment May 7, 2008

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

Add comment April 4, 2008

Getting Yesterdays or Tomorrows day with shell date command

Don’t know how to get yesterdays date in linux


$ date –date=’2 year ago’ # past
$ date –date=’3 years’ # go into future
$ date –date=’2 days’ # future
$ date –date=’1 month ago’ # past
$ date –date=’2 months’ # future

Use it in your shell script

Add comment March 7, 2008

Create functions to join and split strings in SQL

Please refer to this article , it is to complex for me to explain back
http://articles.techrepublic.com.com/5100-9592-5259821.html

Add comment March 2, 2008

Another way of manipulating large amount of data in oracle (Remove duplicate)

Below example explains, 1 way to remove duplicate data. tmp_data table contains 6millions of record, but with duplicate. Table tmp_duplicate contains all duplicates data that exists in tmp_data.

create or replace procedure delete_duplicate is

cursor c is select sn from tmp_data a where a.sn in (select sn from tmp_duplicate);

type c1_type is table of c%rowtype;

l_c1 c1_type;

begin

open c;

loop

fetch c bulk collect into l_c1 LIMIT 1000;

for i in 1 .. l_c1.count

loop

–Expecting to do the delete

dbms_output.put_line(‘Delete this ‘ || l_c1(i).sn);

end loop;

dbms_output.put_line(‘———————-’);

exit when c%notfound;

end loop;

close c;

end delete_duplicate;

Add comment January 30, 2008

Seperate certain data in file to another file.

Let say, i have many raw files, example data files generated from system. Every day the system generates the raw files, with pipe | seperated. At the end of the month i want to extract certain data from each of the files. Another problem arise is, these files contains more 100K of lines.

List of files in my unix server
mixed_raw_data_20080101.csv
mixed_raw_data_20080102.csv
mixed_raw_data_20080103.csv
mixed_raw_data_20080104.csv
mixed_raw_data_20080105.csv
mixed_raw_data_20080106.csv
…..

Content of the file
Hello|amy
Hello|amy
Hello|amy
Hello|amy
Hello|aby
Hello|aby

e.g:
Extract aby from all the listed files. Manually i can do each files like this
more mixed_raw_data_20080101.csv | grep ‘|aby’ > mixed_raw_data_20080101.csv.extract

But what if i have to extract for the whole month which has 30 files….

for f in mixed_raw_data_*.csv; do more $f | grep ‘|aby’ > $f.extract ; done;

Add comment January 30, 2008

Previous Posts


Categories

Calendar

July 2008
M T W T F S S
« May    
 123456
78910111213
14151617181920
21222324252627
28293031