Sunday, December 22, 2013

How to create a new facebook app and to be attached to facebook tab

1) you need to register as facebook developer
a) Login as kwonghong@yahoo.com
b) Refer to the

c) create a new app and choose the Facebook app and page tab app type.

Now you need to specify the URL for your app ? next step ..

2) You need to create a new app via heroku.
Login to a ubuntu server and create a directory as show below

Since this is a free acount, you can only create up to 5 applications

cd ~/heroku/cornery4
git init
git add
git status
git commit -m "add app"
heroku create
git push heroku master

if you want upload a new code, do the following

git add
git commit -m "add app"
git push heroku master

3) one of the requirement is able to send email from heroku. The latter doesn't allow SMTP server hence you need to install "add on". For this example, I have installed "SendGrid" add on and also need to add the following into your code.

$url = 'http://sendgrid.com/';
$user = 'app20508217@heroku.com';
$pass = '9wfghcrn';
$params = array(
      'api_user' => $user,
      'api_key' => $pass,
      'to' => 'info@cornery.com.my',
      'subject' => 'Franchise Enquiry',
      'html' => $email_message,
      'text' => 'Franchise',
      'from' => $iemail,
   );
$request = $url.'api/mail.send.json';
 // Generate curl request
 $session = curl_init($request);
 // Tell curl to use HTTP POST
 curl_setopt ($session, CURLOPT_POST, true);
 // Tell curl that this is the body of the POST
 curl_setopt ($session, CURLOPT_POSTFIELDS, $params);
 // Tell curl not to return headers, but do return the response
 curl_setopt($session, CURLOPT_HEADER, false);
 curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
 // obtain response
 $response = curl_exec($session);
 curl_close($session);
4) I have created two facebook tabs - franchise and special events.
Franchise is at ~heroku/cornery3
Special Event ~heroku/cornery4


Thursday, August 29, 2013

Steps required - Upon the Elastix 2.4 successfully startup

You still need to re-install the DAHDI module with the following steps

315  wget http://elrepo.org/linux/elrepo/el5/x86_64/RPMS/kmod-dahdi-xen-2.3.0-2.el5.elrepo.x86_64.rpm
  317  rpm -Uvh  kmod-dahdi-xen-2.3.0-2.el5.elrepo.x86_64.rpm

Friday, August 16, 2013

Setup Elastix Server on EC2

Install Oracle Virtual Box on Windows 7
Create 64 bits Ubuntu Server Download the Elastix 2.4 64 bits iso file
Start the virtual server and select the Elastix iso CentOS 5.9 and Elastix 2.4 installed on virtual server


1. My virtualbox image is the vanilla Centos 5.8 installation. Amazon needs the xen kernel installed:
yum install kernel-xen
2. The hard disk consists of a boot partition, and a logical volume located on the second partition.  This means that the menu.lst file will be different than any of the examples out there – the key is root=/dev/VolGroup00/LogVol00.  Symptom: kernel panic at AWS.  Settings which worked for me below:
default=0
fallback=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-308.4.1.el5xen)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-308.4.1.el5xen ro root=/dev/VolGroup00/LogVol00
        initrd /initrd-2.6.18-308.4.1.el5xen.img
3. Even if you have the right kernel installed with the correct menu.lst file, it doesn’t matter if it’s not associated correctly.  Get this wrong you get a kernel panic. We need the magic mkinitrd command to make it work:
mkinitrd -f  –preload=xenblk –preload=xennet /boot/initrd-2.6.18-308.4.1.el5xen.img 2.6.18-308.4.1.el5xen
4. Because I’ve got /boot in it’s own partition, Amazon will not end up looking in the correct location for my kernel.  You need to copy the /boot stuff into /boot/boot (really):
cp -Rp /boot /boot
5. Now just because you’re set up correctly doesn’t mean that Amazon will recognize this. You need to boot up your instance with a special Amazon kernel.
Amazon can boot a Xen kernel using pv-grub which we installed at step 1, then you need to find which of Amazon’s initial kernels will allow you to boot your kernel.  Here’s the list:http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/UserProvidedkernels…– there are 4 kernels per availability zone, 2 for 32 bit versions, 2 for 64 bit versions:
Separate /boot: kernels with “hd00” in their name like pv-grub-hd00_1.03-i386
One big disk: kernels with “hd0” in their name like pv-grub-hd0_1.03-i386
Once you’ve located the correct kernel, in the correct availability zone, permanently associate it with your snapshot using the ec2-register command - otherwise if you launch your kernel from the AWS dashboard with the defaults, you’ll get, wait for it, Kernel panic:
ec2-register -n “centos5.8″ –kernel “aki-b2aa75db” -d “Centos 5.8″ –root-device-name /dev/sda2 -b /dev/sda=SNAPSHOTID:10:true`
6. If you’re paranoid like I am, then you’ll be taking all sorts of snapshots of your Virtualbox instance, just in case things go badly.  Good practice.  Of course, when we need to get a copy of the running machine’s disk we use the following command:
vBoxManage internalcommands converttoraw centos5.8.vdi centos5.8.img
This command takes a copy of the virtual hard disk, and converts it to an img file, which we can then compress and transfer up to AWS and write onto a volume which we snapshot and turn into an AMI.  I’ll outline this process later, don’t panic.
I did everything correctly.  What did I get?  Kernel panic. It’s especially heartwarming since this happens after having waited the excruciating amount of time to upload 500mb to Amazon.  So this debugging is a slow and painful process, which is why I’m documenting it.
Here’s what went wrong.  If you’ve snapshotted a Virtualbox machine, the changes are not reflected at the “top level” in my case, centos5.8.vdi.  That file is still the state of your machine before any snapshots.
You must delete all snapshots from the top, down.  Each time you delete a snapshot, your changes are merged with the later snapshots.  When you no longer have any snapshots, your changes have been rolled into the top level machine instance, which you can now copy and send to Amazon.  You can verify this by checking the date on your .vdi file.
This pearl of wisdom can be found in the Virtualnbox blog here:https://forums.virtualbox.org/viewtopic.php?f=2&t=20810
* * *
Here’s a step by step guide
Steps done on your local machine
  1. default install of Centos 5.8 on virtualbox 4.1.12
  2. Download netinstall isohttp://mirrors.bluehost.com/centos/5.8/isos/i386/CentOS-5.8-i386-netinstall.iso    
  3. Select HTTP and these parameters for the rest mirror.centos.org / centos/5/os/i386
  4. yum -y update
  5. yum -y install kernel-xen
  6. Edit /boot/grub/menu.lst (see note 2 above)
  7. cp -Rp /boot /boot
  8. Powerdown your Centos virtual machine
  9. cd to the location of your virtual images (under Virtualbox VMs/YOURMACHINE)
  10. vBoxManage internalcommands converttoraw YOURMACHINE.vdi YOURMACHINE.img
  11. gzip YOURMACHINE.img
  12. scp -i YOURKEY.pem YOURMACHINE.img.gz YOURSERVER.amazonaws.com
Steps done on Amazon AWS
For this part you’ll need an instance on AWS running some form of linux, and a volume at least as big as your Centos image – mine was the default 8mb so…
  1. Create a 10 gb volume on AWS
  2. Associate it with your running instance – note it’s name, like /dev/sdg
  3. cat YOURMACHINE.img.gz | gzip -d | dd of=/dev/sdg bs=10M
  4. Snapshot your volume
  5. Create an AMI from your snapshot
  6. Run the AMI
script: volume to running instance (steps 4-6 above)
This script is run from your local machine – make any changes to your volume, then run the script and it’ll try to fire up an instance… which may or may not work.  At least you’ll know what the steps to follow are.
You’ll need to have the EC2 tools for AWS installed:http://aws.amazon.com/developertools/351
And for the script, you’ll need to have your volume-ID from above, plus a keypair.  The stuff you need to set is shown inside the shell script.  No warranty, public domain, enjoy.
****refer to the above link for the sshd setup and other useful infomation

Thursday, August 15, 2013

2013 Q3 Year School Holiday with Kids in Cameron Highlands

Normally, Q3 school holiday is a week but this year is longer due to conjunction of Hari Raya was on a week prior. Hence, the kids enjoyed two weeks school holiday with the replacement classes planned later this year. It's also the best moment for the parents to spend time with their kids. For this round, I have chosen Cameron Highlands. Our trip was scheduled on Mon - Tue 12-13 Aug and taken leave to avoid the Raya / Holiday traffic. We were using the Simpang Pulai Route as per advised by many that this is a better route compare to the old road which is curve and narrow. I started our journey at 9-10am and arriving in Simpang Pulai around 11:30am. We spent an hour uphill, cut through the Hills, and valley before arriving at the Brinchang. The road was busy at the Brinchang pasar pagi and malam. We enjoyed the scenery throughout the journey and also the fresh air. We checked in to Smoke House at per planned - 2pm and settle down for 30 minutes before heading to for lunch at a Cha Siew shop. The food was cold and price was terrible RM102 for 5 ppl. Perhaps, the duck dumpstick cost me RM22 alone. After lunch, we head tea farm and had our tea break at their station. Few photos were taken and then to the Lavender Park which I believe was newly opened with entry fee. Jasmine, Baby and Brandon had their good time with the strawberry self pick and also bought another box RM10 from the shop. After Lavender, we went to a bee farm (small size) and purchase few bottle of honeys. As the sky is drawing dark, we stopped by at the pasar malam. Jasmine and Victor went to purchased some vege. Then we head to the Tanah Rata for steamboat dinner. The served meal is acceptable with good price. We arrived back to hotel at 9pm and spent another hour on family time / checking mail etc before to bed. the next morning, I was always the first to woke up and then Victor followed suite. Both of us had to wait for the next door (2 rooms - Room 4 & 5) and I was in shock when I saw baby face was full of mosquito bites. Then I noticed that there were few big mosquito still hanging around in the room. I slapped on them and my hands were full of blood. I was not happy with the hotel facilities with the kind of high price that I am paying. Each room cost me RM350 x 2. Whilst Jasmine is putting up her make up, I brought the kids to the other farm at the way to Tapah. It was a much better tea farm and better view. We took a walk and it was slippery till I fall off and injured on right hand. the mud was on our hand and also shirt. We head back to hotel and meet up with Jasmine. Get ourselves ready for the check out. After the checkout, we arrived at the pasar pagi for another round of vege shopping. One of the thing that you shouldn't never miss is their vege, flower and corn. After the last round of shopping, we heading back to KL using the same route - simpany pulai. Upon crossing thru Brinchang, Jasmine noticed that her diamond ring was not on her finger. We were panicking and realised that she was still wearing on the photo taken during the 1st day tea farm visit. Without hesitation, we u turn back to pasar pagi and I drop off to search for the ring. Sadly, I unable to find the ring and then we go back to the hotel and search in the room. Still unable to find. As we had gave up and I also decided to use the Tapah road as we were running late. The road was curve and Z for an hour before we arrived at Tapah. From Tapah, we head to Sg Buloh for our dinner. We found the ring when Yati was house keeping our luggage Although it was an eventful journey - lost ring, fall off, con on expensive food, one room becomes two etc. But it's still a good short break with the family.

Sunday, December 9, 2012

Good outing with My kids and their primary school mates

I had been promising my eldest son Victor to bring him and his friends to the laser tag battle since middle of this year after the examnination but due to busy schedule and others, I didn't fulfil the promise not till yesterday. Even that, the laser tag booking was done through the groupon.my and it reminded me that I need to fulfil the promise although it's a little bit late. However, the kids were excited when I informed them that I had booked 8 tickets (30 minutes each with 10 minutes per game) and the venue is e@curve.
In total, there were 6 of us - Victor, Brandon and their school mates - Kelvin, Chen Hao, Kim Yip and I. All of them stayed at our home a night before Sat (8th Dec) excep Kevin only joined in at 5pm on the day itself. The whole family departed from home at 5:30 and arrived at the War Zone counter around 6:20pm. We were asked to wait for 10-15 minutes as there was another game going on. We sat in a room and watching the CCTV displayed on the battle happening inside. After much anxiety, we were called to go into the departure room and armed with the laser gun and jackets (heavy ~2-3 KG). An Malay instrutor was given us the instruction of how to using the gun and also when to press the shot hurdle and when you are shot by others, the color turn white, and 5 seconds you will be normalised. etc. The 1st game was fight against another group of Malay friends. We are Green and our opponent is Blue. We walked inside the war room (literally dark) with laser lighting and also many blades which allows you to hide behind and avoid visibility by others. We were asked to be on standby and game will start when the music play. Since, it was our first game and without much experience, we were beaten badly by our opponent although few of them are much younger than our group. We were by far in term of scoring behind them. but it was a good game. After 1st game, we want to continue with 2nd game but were told that our opponent needs to rest hence, the instructor told us that we will go with solo game fighting among ourselves. When the music started again, I was like the little chick running around without hen and shooting at each others. I scored badly among the kids when the result displayed on the LCD screen outside the glass entrance. Kevin emerged be the winner with the higher points. I prefered to war game with opponent rather than solo and we decided to take a rest as well since some of us require a break and twisty since runnin around non stop for 20 minutes. The break had given me some breathing space and allowed to re-strategise the game. I was frustrated especially in the 1st game where I was always shot by others without given a chance to re-venge. The 1st rule of thumb is that I must find a secure space to hide myself from others and at the same time, enables me to shot at others with greater impact. We went for a drink at the same floor and opted for the bubble tea kiosk. after the drink, we went back to the waiting room and wait for 10 minutes. When come to our turn, we were against the same opponent. But this time, I run toward the far corner when stepping inside the war room. I received resistent from the opponent as they also want to take the same corner. But with much resistent as I standstill as same positive and unwilling to move else where. Few of them came over and attacking me but I took my own sweet time to return armour at them and they run out of patience and give way to me and move to other places. By hiding at the corner, I had much of efficiency on shooting the opponent as they tend to forget that I was staying at far corner and not hiding away my attack on them. There were few occasions where I managed to shot few opponents at the same times. they were frustrated and revenge on me but I used the same mind game to avoid them taken our the uppper hand corner - territory. The end result turned out to be fruitful and although we still the loser but our score was much closer to the opponent especially the last game (4th) where we were just 2000 points behind. We enjoyed the game and gave ourselves and opponent a round of applause. Well done and kudo to all the kids. I can see the kids are sweating and the game was not only entertaining but also burning calories. All hard work was wasted when we go for the McD after the game with two order large big MAC and fatty foods. Not to rest our laurel, we proceed to Mine convention centre for big bad wolf book fair. we reached home after book fair at around 1am and the kids stayed up till 4am. I hope that victor and his closed friends still keep in touch as they are moving on to different secondary schools next year. It was a moment for appreciate and value their friendship for the past few years. I sincerely wise all of them success in future.

Tuesday, July 5, 2011

Registered enterprise by myself - only RM70

Few years ago, I assigned an agent to register the JAsDecor for me and I remembered that price is expensive between RM300-400. I collected info from the lowyat forum and understand that I can register by myself in "The Mall". This morning, I decided to do it myself and arrived in the Mall shopping center around 9am. The main escalator to the shopping hall was still closed but there is a side lift. I checked on the directory and noticed that SSM is at 16th floor. I took the lift and come out from 16th Floor. Surprisingly, there was no crowd and I can go straight to the collect the queue no. the guard was telling us to photostat the IC, so I went down to 4th flr, paid 40 sen for the photocopy of IC and went up to 16th Floor again.

My no is 2009 and wait for 10 minutes, my no was called. I filled in all the necessary data into the application form and paid only RM70 for the processing fee. My first choice for the company name was TuitionAds but it's not valid since it carried the word "Tuition". the officer told me that she chosen the 2nd option - Vision Cloud
I wanted to revise the name but it seems like she was not very friendly and didn't give me a chance to make any last minute change. Upon signed off, I was asked to wait for 30-60 minutes to collect the company cert at another counter.

Finally, within one hour I managed to get the company registered and I went to 4th Floor to print name card which cost me RM25 only for one box. Overall, it was a good experience and save me a lot by doing it myself. I spent less than RM100 for registration and card printing. Now, I am the proud owner of this start up company and full of ambitious to expand and make it a success !!

Sunday, June 12, 2011

Step to check Apache port 80 status

Please find the following command to check on the 80 status in Windows 7
netstat -o -n -a | findstr 0.0:80
You should able to see the port 80 being listened by the Apache server.

upon installed the PHP, there are two things that need to be inserted into the httpd.conf


LoadModule php5_module "c:/php/php5apache2_2.dll" under the module section

AddType application/x-httpd-php .php .php5 under the section

Insert the "index.php" into the DirectoryIndex section.