Sunday, May 31, 2009

B-daman

ni kali keberapa ntah belikan B-daman utk abg hairi & danish...

semua end-up berkecai.... ada x sampai 5 min pun dari masa bukak dari kotak...

hari Khamis abg hairi ikut abah pegi opis. lunch time abah bawak hairi g makan KFC kat giant shah alam... sambil makan mata abg hairi melekat kat 1 booth jual mainan... hahahha... dia dah nampak B-daman tersusun kat meja kedai tu...

lepas makan terus tarik tangan abah ke kedai tu... lastly... abah kopak RM20 belikan B-daman Baru utk Hairi & Danish.

kali ni abag bg last warning... x bleh pecah2 & cerai2 kan lg... kalau x abah x nak belikan lg...

Abah beli gam gajah... gam kan semua cantuman biar x tercabut... hahahhaha.... pastu semua yg lama2 tu abah cantumkan mana yg boleh... hasilnya dpt dua B-daman yg bodypart nya bercampur2... hahahah janji ada bentuk B-daman.

Abg hairi siap tanya lg... "Abah... abah buat B-daman yg mana tu... x pernah tgk pun... " ... hahahhahhaha ..

kat bawah ni B-daman campuran.. hehehehe

untuk Ibu, Hairi suruh abah belikan loceng dgn bentuk Love utk gantung kat HP ibu... gambar x da... hehehhe

Danish's new bike

semalam belikan danish basikal roda 3 baru. sian dia asyik berebut dgn basikal abg hairi jer.

mlm td danish tdo lewat... dia nampak je basikal.. mcm x percaya jer muka dia... siap dtg kat ibu & baha dulu .. mcm nak mintak confirmation yg tu basikal utk dia...diapunya senyum... meleret..

abg sentuh pun x boleh basikal dia... hehehhe..

Friday, May 29, 2009

SDRAM 512Mb PC133

at last.... found this thing for only RM70... most of available in market either used or new price will be more than RM100... damn ... this is consider historical item... so expensive. so after this, Ibu, Hairi & Danish can surf youtube without lag anymore. hahaha.. abah dont hav much money to buy u all new PC... hehehe.. just used the old mine.

Sesat....

kelmarin ... while having my late lunch... some one kat meja sebelah bercerita ttg dia sesat dari shah alam nak balik shah alam tp end up pusing2 kat berjaya time square x jumpa jalan balik... pegi balai polis kene gelakkan dgn polis.... wakakkaka..

tetapi cerita mereka buat aku teringat kisah2 sesat aku...

antara yg paling aku x lupa... my abg ipar nak g sarawak.. dia suh aku hantar dia ke KLIA. aku yg 1st time bawak kete kat KL. balik dari antar dia aku salah jalan... padahal nak balik kajang... aku salah masuh jalan pusing ikut elite... kuar ikut shah alam... masuk kesas... sampai bandar tasik selatan.... masuk cheras kajang highway baru sampai rumah... abg ipar aku dah landing kat kuching aku x sampai2 rumah lg.... &^%$

sesat kat melaka... plan asal nak masuk tol simpang empat dari bandar melaka... ikut la sign board semua masuk ntah mana hala jln... last2 kuar kat jalan air keroh... *&^%$#... punya la jauh pusing... last2 ke situ gak aku tembus... tension x hingat...

cita lawak... masa baru bawak kete kat kl... opis kat cheras... kene g PJ antar laptop service kat teledynamic(skrg teledynamic dah pindah shah alam)... on da way balik nak ke cheras... aku salah masuk simpang... hahahha... aku masuk parking mid valley... hampeh... parking keta beli air.. bayar parking... kuar semula balik opis... tiba opis kene gelak ngan membe.. hampeh...

yg lain mostly aku sesat/terlepas jalan bila seronok bersembang... wife aku paham dah aku punya perangai... terlebih/xcited sembang ... ada la nanti tu terlepas simpang... hahahahhaha...

Tuesday, May 26, 2009

Syntax Highlighter

HAhahahaha... finally... too lazy to cofig this... but seem like every time i'm posting code, it'll screwed by HTML tag... hehehehe... enjoy

PHP OrgChart

last night, there's somebody add me at YM. asking for help. need to build simple org chart using PHP.

at 1st, i just give him a url tutorial from mysql dev at http://dev.mysql.com/tech-resources/articles/hierarchical-data.html to get some basic idea how to build simple but dynamic orgchart.

normaly i done this using perl, but i decide to take a try to write this using php...

here the result... hahha i manage to build basic engine with only basic structure/position of chart. i let him proceed with the code... hopefully it'll help him solve hihs problem..

and here the PHP code:

 
 
 $query  = "
SELECT node.*
FROM nested_category AS node,
nested_category AS parent
WHERE node.lft BETWEEN parent.lft AND parent.rgt
AND parent.name = 'ELECTRONICS'
ORDER BY node.lft;


 ";
 
 $users = Array();
 $result = mysql_query($query);
 while($row = mysql_fetch_array($result, MYSQL_ASSOC))
 {
  $users[$row['parent']][] =  $row['category_id'] . "|"  . $row['name'];
 }
 
 
 
 function recursive($parent,$array)
 { 
  $pcount = count($array[$parent]);
        
  for ($u = 0; $u < $pcount; $u++) {  
   list($id, $name) = split('\|', $array[$parent][$u]);
   $count = count($array[$id]);
   if($count > 0){
    echo "";
    echo ""; 
    echo ""; 
    recursive($id,$array);
    echo "
$name
|
"; }else{ echo "
$name
"; } } } echo ""; recursive(0,$users); echo "
";

and here the sql code:

CREATE TABLE IF NOT EXISTS `nested_category` (
 `category_id` int(11) NOT NULL AUTO_INCREMENT,
 `name` varchar(20) NOT NULL,
 `lft` int(11) NOT NULL,
 `rgt` int(11) NOT NULL,
 `parent` int(11) NOT NULL,
 PRIMARY KEY (`category_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;

--
-- Dumping data for table `nested_category`
--

INSERT INTO `nested_category` (`category_id`, `name`, `lft`, `rgt`, `parent`) VALUES
(1, 'ELECTRONICS', 1, 20, 0),
(2, 'TELEVISIONS', 2, 9, 1),
(3, 'TUBE', 3, 4, 2),
(4, 'LCD', 5, 6, 2),
(5, 'PLASMA', 7, 8, 2),
(6, 'PORTABLE ELECTRONICS', 10, 19, 1),
(7, 'MP3 PLAYERS', 11, 14, 6),
(8, 'FLASH', 12, 13, 7),
(9, 'CD PLAYERS', 15, 16, 6),
(10, '2 WAY RADIOS', 17, 18, 6);

And Css:

.parentnode{
 margin: 5px;
 position: relative;
 width: 200px;
 text-align : center;
 border: 1px solid #ffcc33;  
 padding: 10px;
}
.childnode{
 margin: 5px;
 position: relative;
 width: 200px;
 text-align : center;
 border: 1px solid #000000; 
 padding: 10px;
}

i make some changes from MySQL Dev tutorial... as using parent child column make it easier to construct the chart. and lft & rgt column make it easier/faster to query/select required row/wing.

happy coding..

Monday, May 25, 2009

Book Flipping Effect

try a lot of book flipping effect o the net.. free/open source version from flash to javascript... most of them fail when dealing with large number of pages. it getting slow... for flash it take amount of time to compile... for javascript... it will crash ur browser...
if doesn't flip... it's not like a book... arghhh!!!! 
i only manage to make it view like a book... but flip...like a &^%$#.... damn...