Saturday, June 20, 2009

Happy Father's Day

Happy Father's Day to all fathers..

Selamat hari bapa kepada semua bapa-bapa...

td aku dpt SMS dr kenalan. ditujukan utk bapa2 sekalian..

PENGUMUMAN HARI BAPA.
Semua bapa layak menuntut REBET
dari isteri anda bermula jam 10 malam ini.
Kepada bapa-bapa yang memiliki isteri berusia
18-29 tahun boleh tuntut 3 kali
30-45 tahun boleh tuntut 2 kali
45 tahun ketas boleh tuntut 1 kali.
MONOPOUSE tidak layak menunutu. Pndai2lah bawa diri.
SELAMAT HARI BAPA..

hehehhehehehhe nice dude... hahaha

Thursday, June 18, 2009

Reverse Proxy

Aku start kenal/bermain dgn reverse proxy setelah diperkenal kan oleh sepupu aku, bro sazly.

byk kegunaan dia, but yg pasti dia solve kan problem aku bermain dgn multiple web server utk satu2 project.

biasanya aku bermain reverse proxy sekitar apache, sambar server & IIS.

  • Apache -> Sambar server
  • Sambar server -> Apache
  • Sambar server -> IIS
  • Apache -> IIS

    Apache:
    setting di httpd-vhosts.conf

    ProxyPass / http://somesite.mysite.com:8080/
    ProxyPassReverse / http://somesite.mysite.com:8080/
    

    Sambar server:
    setting di vhosts.ini

    Reverse Proxy Server = http://somesite.mysite.com:8080
    

    loading time akan lebih skit sebab setiap request akan diproses oleh 2 web server.

    kegunaan lain nya adalah utk membenarkan request masuk melalui single port sahaja utk http or ftp. kemungkinan sesetengah organisasi hanya benarkan capaian ke port 80 je dari luar.. so utk applikasi yg dohostkan di port selain port 80, kita leh gunakan reverse proxy.

  • Civic 1.7

    surfing di mudah.my.. terjumpa ada sebijik honda civic antara yg aku minta nak dijual. http://www.mudah.my/Honda-civic-1.7-vti-3272475.htm

    harga jual : RM 55,900

    ermm... kalau la aku ada cukup duit... mmg dah lama aku sambar model ni... aku suka simple design dia...

    teringin nak bekereta baru... tapi tu la... financial aku x stable lg... mengharap janji manis yg ntah bila tertunai...

    kadang2 naik bosan... tunggu dan lihat dulu.... this year ada balance lg 6 bulan+-... kalau x da apa2... it's time......

    Auto Generate Subdomains form a Subdirectory of a Site

    this script will automatically(on the fly) translate/resolve subdomian into dedicated folder path.
    without touching web server config(

  • only touch the config for 1st time config only la...).

    eg:

    main domain name:
      http://mysite.com

    main vhost doc root:
      /usr/local/www

    Folder inside:
      /usr/local/www/brother
      /usr/local/www/sister
      /usr/local/www/mother
      /usr/local/www/father
      /usr/local/www/inlaw
      /usr/local/www/cucu
      /usr/local/www/cicit
      /usr/local/www/oneng2
      ........

    so

    when browser open url:
      http://mysite.com/

    it will display:

  • brother
  • sister
  • mother
  • father
  • inlaw
  • cucu
  • cicit
  • oneng2

    But when browser open url:
      http://brother.mysite.com/

    it will display:
      content inside folder 'brother', and can view everything inside this folder.

    The Script:

    #!/usr/bin/perl
    ########################################
    use CGI::Carp qw(fatalsToBrowser set_message);
    BEGIN {sub handle_errors { my $msg = shift;
    print qq|Server Error
    

    Web Server Error!

    $msg

    Please inform the mbek about this error.\n|;} set_message(\&handle_errors);} ######################################## use CGI; ## Set a few variables ############################################################## my $hostname = "site.williams"; my $perlexe = "c:/programs/perl/bin/perl.exe"; my $phpexe = "C:/Programs/server/php/php.exe"; ############################################################## if (exists $ENV{'PATH_INFO'}) { $uri_info = $ENV{'PATH_INFO'}; $uri_info =~ s/alias\.pl//; $uri_info =~ s/^\///g; } elsif (exists $ENV{'DOCUMENT_URI'}) { $uri_info = $ENV{'DOCUMENT_URI'}; $member_url =~ s/^http:\/\/.+?\///; $uri_info =~ s/^\///g; $uri_info =~ s/^$member_url//; } else { $uri_info = ''; } my $hosts = $ENV{'HTTP_HOST'}; my $sysdir = $ENV{'DOCUMENT_ROOT'}; my $script = $ENV{'DOCUMENT_NAME'}; my ($hostid,$host) = split /$hostname/, $hosts, 2; $hostid =~ s/\.$//; $sysdir =~ s/\/$//; $sysdir .= "/$hostid" if $hostid; $uri_info =~ s/$script//; $uri_info =~ s/^\///; $uri_info =~ s/\/$//; my $file = "$sysdir"; $file .= "/$uri_info" if $uri_info; $file =~ s/\/$//; if(!-e "$file"){ print "Content-type: text/html\n\n"; print "Invalid Path ($file)"; exit; } if(-d "$file"){ print "Content-type: text/html\n\n"; # load all files of the "data/" folder # into the @files array opendir(DIR, "$file"); my @files = readdir(DIR); closedir(DIR); if(@files){ print "

      "; foreach $file (@files) { next if ($file eq "." or $file eq ".."); my $folderpath; if($uri_info){ $folderpath = '/' . $uri_info . '/' . $file; }else{ $folderpath = '/' . $file; } $folderpath = "/". $script . $folderpath if $script && $uri_info ne $script; print "
    • $file
    • "; } print "
    "; }else{ print "Folder is empty"; } exit; }else{ if($file =~ /\.pl$/i || $file =~ /\.cgi$/i){ #handle perl/CGI my $result = `$perlexe $file`; print "$result"; exit; }elsif($file =~ /\.php$/i){ #handle PHP my $result = `$phpexe $file`; print "$result"; exit; }else{ use File::MMagic; my $mime = File::MMagic->new(); print "Content-type: " . $mime->checktype_filename($file) . "\n"; #The Content-Disposition will generate a prompt to save the file. If you want #to stream the file to the browser, comment out the following line. #print "Content-Disposition: attachment; filename=$filename\n"; print "\n"; binmode STDOUT; if($mime->checktype_filename($file) =~ /image\/png/i){ use GD; my $contents = GD::Image->new( $file ); print $contents->png; }else{ my $fh = new IO::File($file, "r"); my $contents = get_contents($fh); print $contents; } exit; } } exit; ############################ sub get_contents { ############################ my $in = shift; my $ret = ""; while (<$in>) { $ret.= $_; } return $ret; }

    and this apache httpd-vhost.conf

    <VirtualHost *:80>
            ServerAdmin me@mysite.com
            DocumentRoot "/usr/local/www"
            ServerName mysite.com
            ServerAlias mysite.com
    
            ErrorLog "logs/mysite.com-error.log"
            CustomLog "logs/mysite.com-access.log" common
            Options +Includes
            AddHandler server-parsed .html
    
            <Directory "/usr/local/www">
                    AllowOverride None
                    Options Indexes FollowSymLinks ExecCGI
                    Order allow,deny
                    Allow from all
            </Directory>
            
            RewriteEngine On
    	RewriteRule /(.*)$ /alias.pl/$1 [L]
    </VirtualHost>
    

    use at your own risk...

    happy coding..

  • Wednesday, June 17, 2009

    Target

    my Next target
    • My Own House
    • Toyota Wish/Caldina
    • Integra Type-R
    • Holiday to New Zealand/Japan
    • Mobile Phone complete with GPS and latest tech
    • Home Theatre
    • Mountain Bike
    amin...

    Monday, June 15, 2009

    Birthday @ 18SX

    aku nak tergelak dgn kek hadiah yg makcik wife aku bg kat hubby dia...Creative

    Dia mmg pandai buat kek... so dia buat special utk hubby dia... hahahhahaha...caya la mak wa... leh la ajaq along lak lepas ni.... hahahahha

    for more pic.. go to... http://anirzam.fotopages.com

    Memasak

    My wife tgh menempuhi morning sickness... memandangkan dia x berapa larat utk memasak.. kadang2 kalau ada kerajinan... aku yg mencuba masak apa2 yg ada didapur...

    hahahha setakat ni wife aku masih boleh telan apa yg aku masak... walaupun x sesedap mana... hehehhehe... ataupun dia sengaja nak menyedapkan hati aku... hahahha

    sebenarnya aku suka memasak... cuma x reti jer... aku fail bab nak merasa... yg aku tau x sedap... kurang garam or kurang apa aku x tau... kekadang wife aku jadi tukang rasa... hahahhaa....

    semalam aku buat nasi lemak... hehehhe wife aku masak nasi aku buat sambal tumis ikan bilis... ermmmm wife aku komplain manis katanya... hahaha... aku main tabur je gula takut terpedas sgt... hehehhehe...

    Tapi kalau aku kat dapur wife aku mesti begang... dapur besepah... hahahahhaa...