mengetuk keyboard untuk mencari sesuap nasi

and you are?

"Rajin Berkerja, Rajin Bercakap" – Bagus
"Rajin Berkerja, Malas Bercakap" – Kena Buli
"Malas Berkerja, Rajin Bercakap" – Wayang Cina
"Malas Berkerja, Malas Bercakap" – Tak Guna
"Malas Berkerja, Suka Mengadu" – Lalat Hijau
"Malas Berkerja, Suka Ponteng" – Lebih Baik Berhenti
"Malas Berkerja, Suka Termenung" – Lebih Baik Mati
"Rajin Berkerja, Rajin Mengadu" – Kaki Bodek

quote by Royal Prof Ungku Aziz

Installing Nginx on CentOS

Step 6, 7 & 8 are entirely optional
1) sudo yum install pcre-devel zlib-devel openssl-devel
2) mkdir ~/sources
3) cd ~/sources
4) wget http://nginx.org/download/nginx-0.9.5.tar.gz
5) tar -zxvf nginx-0.9.5.tar.gz
6) mv nginx-0.9.5.tar.gz nginx
7) cd nginx
8) [if gcc not available] yum install gcc
9) ./configure –sbin-path=/sbin/nginx –conf-path=/usr/local/nginx/nginx.conf –pid-path=/usr/local/nginx/nginx.pid –with-http_ssl_module –with-md5=auto/lib/sha1
10) make
11) make install
12) cd /usr/local/nginx/
13) vi nginx.conf
14) nginx

The Death of Superman

Superman is dead

Real-time database replication (almost!)

  1. Been fortunate enough to join the first batch (i think!) of Oracle GoldenGate (OGG) in Malaysia.
  2. OGG is the real-time database replication app which enhance Oracle Data Integrator (ODI).
  3. I’ve seen the reason why database replication are important nowadays. One that I can relate is the emerging of cloud computing which need replication geographically.
  4. Replication used by Disaster Recovery (DR) not usually replicate real-time.
  5. OGG in my oppinion is not suite for DR eventho it can do the job well.
  6. It suite well for real-time ETL in Data Warehousing and it can be geographically available in almost real-time.
  7. The interesting idea that can be archive via OGG is something like, you can separate heterogeneous database for different function (like oracle for write and mysql for read) and make the data available realtime. This architecture help when lots of reading needed on the data.
  8. Replication can be bi-direction, heterogeneous and multi master multi slave.

CakePHP Cookbook updated!

After almost 3 year using the old design, the team decide make a major facelift to the cookbook. They even put local cache function. kudos!

Google Image Upgrade!

Ooh! Ahh! Google recently upgrade the image search. ;)

Google Image Search upgrade view on "Malaysia" keyword

New view on Google Image Search

More to fine on official Google Blog

PHP5.3 : goto

Pernah guna fungsi goto? last time aku guna mcm 4-5 tahun dlu. sebab dulu PHP memang takde.

/* function lock */ function lock() { $file = fopen("file.txt","r+"); retry: if(flock($file,LOCK_EX)) { fwrite($file, "Success!"); fclose($file); return 0; } else goto retry; }

loop dalam function. nice?

CakePHP: Ternary condition

Kalau selalu guna if and else, langkah seterusnya mesti tahu ternary condition. ade alternative lain nak guna dalam CakePHP, contoh:

/* ife in cakePHP */ ife($condition, $true, $false)

jadi, kalau statement ternary tu cam ni:

/* ternary condition */ echo ($x)?'x = true':'x = false';

ble ubah jadi macma ni. mudah sket

/* replace ternary with ife in cakePHP */ echo ife($x, 'x = true', 'x = false');

urm.. dapat?

CakePHP: Kenapa layout masih tak tukar?

Kalau malas asik nak declare layout di cakephp, aku akan guna code macam ni.

/* before Render */ function beforeRender() { parent::beforeRender(); $this->layout = 'plugin'; .... }

lepas tu aku nak tukar stail layout, misalnya nak guna layout “ajax”. jadi aku declare macam ni..

/* children */ function children($id = null) { .... $this->layout = 'ajax'; }

tapi tak jadi!? kenape? perasan function beforeRender tu?

/* before filter */
function beforeFilter()
{
parent::beforeFilter();
….
$this->layout = ‘plugin’;
}

baru jadi! sebab beforeRender akan override balik variable sebelum render! sebab tu tak jadi.

Html helper, link untuk plugin

Aku ada masalah nak buat link dari plugin page ke page biasa.

mula² jumpa cara macam ni..

$html->link(__(‘Home’, true), array(‘root’ => false, ‘plugin’ => false, ‘controller’ => ‘users’, ‘action’ => ‘home’), array(‘class’ => ‘menu’));

tapi still tak menjadi.. aku check cake version betul.. 1.2.5

jadi.. setelah mencari² cara macam mana nak reroute balik (kejalan yang benar) siap bukak source asal. rupa² nyer kena guna null. jadi seperti ni.

$html->link(__(‘Home’, true), array(‘root’ => false, ‘plugin’ => null, ‘controller’ => ‘users’, ‘action’ => ‘home’), array(‘class’ => ‘menu’));

kenapa false tak ok? pelik tapi benar