Installing latest PHP and CentOS 5.2 for Virtualmin AMIs on Amazon EC2

If you are trying to upgrade PHP to the latest version (5.2.10 as I write this article) and MySQL and mcrypt (for the latest phpmyadmin) and you are using a server instance on EC2 running virtualmin AMI. Here is some help for the upgrade process which works for me.

Copy and paste these into terminal window
rpm -ivh http://software.virtualmin.com/bleed/centos/5/i386/virtualmin-bleed-release-1.0-1.rhel.noarch.rpm
yum upgrade php
wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm
yum install mysql-server
yum install mcrypt
yum install php-mcrypt

There might be some redundant commands up there, but its exactly what worked for me. Feel free to exclude some statements if they are not used.

iPhone and Linksys WRT54G2

If you are using iPhone to connect to the Linksys router WRT54G2 on WPA2 Personal. Make sure that the encryption scheme is TKIP+AES and not AES alone. Otherwise the iPhone will not connect. Incidentally other machines (notebooks) on the network has to reconnect to the router as well upon the new security settings.

Facebook Connect Logout not working (Wordpress FBConnect plugin)

If you are having troubles with the Logout function of Facebook Connect using the wp-fbconnect plugin for Wordpress. Head into the wp-fbconnect plugin folder, open up fbconnect.js and modify the following code (add the code in red):

logout : function() {
FB.ensureInit(function() {
FB.Connect.logout();
setTimeout(function () {
window.location = FBConnect.home_url;
}, 3000);

});
},

I have tried a couple of numbers for the delay and 3 secs seems to be rather reliable for now. You might find other numbers more suitable for yourself. I have no explanation for this behavior currently. A wild guess might be when the logout is called, there is a delay between the data being updated and synchronised across the Facebook servers, hence when the page refreshes too fast, the user is read as being still logged in and FB resets his status to being connected. If you know whats going on, please contact me via the comments below. Thanks and Cheers.

Plexiglas Endlighten

I have been crazily busy these days and have not had the time to update on my adventures in multi-touch. The rear DI table has already seen some publicity on a few occasions.
This post will briefly show the new material that I had just received which will employ the DSI technique (Diffused Surface Illumination) that uses the Plexiglas Endlighten from Evonik. I took delivery 1 week back and just got the chance to test it out. Results were awesome and solves a lot of problems inherent with Rear DI.

Here are the photos (sorry for some of the blurred photos because I took them in a rush)
Also note that the protective sticker was on the endlighten so the blobs would have been diffused and don’t appear as clear as they would have. Edges were also not polished and were rough.

PHP Session lost after header redirect

I was just working on some PHP and encountered a problem where my session was lost after doing a header redirect. After googling and doing some read up, I realised that the problem lies with using simplexml with the session variables:

For example:
$name = $simplexml -> table[0] -> name
$_SESSION["name"] = $name;

if you attempt to do a header redirect thereafter: header(”anotherpage.php”); , and try to access the session variable in anotherpage.php like

echo $_SESSION["name"];

Then an error might occur which says “Warning: session_start() [function.session-start]: Node no longer exists in …”

The solution to this problem is simple, simply cast the $name above to (string)$name so it looks like:

$name = $simplexml -> table[0] -> name
$_SESSION["name"] = (string)$name;

Rear DI Multi touch Set Up Part 2

With the camera set up in the previous part I proceeded to IKEA in search of a suitable cabinet which I found a perfect one that has an open top (Its supposed to be for the kitchen, but it fit the purpose of a multi touch anyways :) )

Here is the IKEA code for the cabinet I bought:
IMG_6312

IMG_6315

The table with makeshift cardboard to hold the mini acrylic piece I got from Art Friends at Bras Basah Complex for around $8 SGD:
IMG_6319

The projector and materials in the cabinet, notice the cables running out from a small hole through the top, it was pretty convenient without having to manually drill a hole
IMG_6326

The first run of the initial set up:
IMG_6329

The blurry projection on about 40 pieces of laminating pockets as diffuser, acrylic at the bottom of those sheets
IMG_6331

Close up view from under the cabinet:
IMG_6333

In this iteration of the set up, there were basically loads of problems
- Hot spot from the IR illuminator
- Hot spot from the projector
- Floppy disk filter largely not effective (only discovered later on when the infrared cut filter arrived and made the magical difference)
- Double image from the standard mirror used (explained below)
- Lack of a proper holder to hold the mirror
- The laminating sheets were very poor diffusers

Explanation for double image:
In a standard mirror, there are two layers

| <- layer A | <- layer B

layer A is the glass layer and layer B is the reflective surface, because of refraction at the glass layer, some of the light slows and bends and causes another faint image to be projected beside the original image on the projection surface. The answer to this would be an industrial front surface mirror. These front surface mirrors are pretty fragile so special care has to be taken not to scratch its delicate surface.

Eventually the PS3 eye could not capture any blobs at all with the projector on. With the projector off, it was better and blobs could be registered. The PS3 eye is removed from its case and embedded in the makeshift Styrofoam holder (which is bad as I found out later on because the camera sat on the projector and the Styrofoam basically hits everything up a lot and caused the projector to overheat and shut down automatically after just 3 - 5 minutes)

These are the equipments I used above
- 1 x Sanyo PLC-XW60
- 1 x IR illuminator (domed shape, 180 degrees illumination, bought from Jia Ying at Sim Lim Square)
- 1 x normal mirror from IKEA (they don't sell single pieces, but set of 4s)
- 1 x PS3 Eye modified with floppy disk visible light filter
- 1 x Frosted acrylic from Art Friends
- Many pieces of laminating sheets
- 1 x cabinet
- 1 x multi plug extension
- 1 x Sony TZ notebook

* not in the list but it helps to have a wireless mouse/keyboard

More to come in part 3..

* I have managed to create the working table and a video of which is available at youtube
Video of the completed table running demo from touchlib:

A special post (Non-technical)

I am writing this special post to bring attention to this outstanding young lady who is fighting a disease known as neuroblastoma. I came to know about her condition through a friend and was deeply saddened that a three year old has to put up with these cruel facets of life. So I urge anyone who is reading this post to (stop coding) for a moment, head over and help by clicking the banner in the site which contributes to the funds that helps the girl. Or even just offer a word of sincere encouragement.

Feisty Char needs bullets to fight!

Get this badge to help Char! (Copy the following code and paste in your blog in HTML mode to get the badge)

<a href="http://ourfeistyprincess.blogspot.com" target="_blank"><img src="http://shootingpixie.com/wp-content/themes/nishita/i/charbanner.jpg" alt="Feisty Char needs bullets to fight!" /></a>

The blog is at http://ourfeistyprincess.blogspot.com/

On the road to my first Rear DI Multi touch table

Thanks to the help and advice from the guys over at NUI Group (www.nuigroup.com) forums especially the wonderful information supplied by PeauProductions (http://peauproductions.blogspot.com/), I have embarked on a project to build my own Rear DI Multi Touch table. I will be posting photographs and the progress of the building of the table.

This is the Playstation 3 EYE camera that will be modified to become IR capable. For people residing in Singapore, this is the packaging for the correct version of the camera to get. You can buy this at any Sony Style shop locally. Do note that some local game shops sell the European version of which I am unsure whether it is “friendly” towards modification.
PS3 Eye packaging in Singapore

The Camera removed from its shell
PS3 Eye dissection front of circuit board

The dismantled pieces:
Dissection of the PS3 Eye

The lens mount removed from the circuit board:
Lens mount front

I think I did a pretty lousy job in removing the IR blocking filter from the rear of the lens mount, look at those jaggy edges:
Lens mount

This is the IR blocking filter removed. It was damaged when it was removed.
IR Blocking filter

The visible light filter installed (cut out from floppy disk). This filter functions by blocking out visible light and letting infrared light through.
lens mount

And this is my work desk where all the mess is. The top right corner is a wide angle (180 degrees) IR illuminator that I am using for the Rear DI set up.
Messy Work desk

Next I will be making the box to sit the small piece of acrylic I got from a local art and craft shop (12″ x 18″ x 3mm(T)). It is available at Art friends for all you Singaporeans out there and costs around $8 only. Great for testing and fiddling around. I will be running tests soon using tbeta once I find time and I will post the tracking results.

On a side note: I am also intending to build a DSI table which uses a special acrylic called Endlighten. If you are living in Singapore/Malaysia and are interested in getting a piece of this very hard to get acrylic please contact me and let me know. I have managed to find a local manufacturer who has kindly indented and offered to laser cut the standard sheet (120″ x 80″ to 10 pieces of 39″ x 22″ x 10mm(T)) at $200 USD per piece. There are 4 pieces left for reserve as of this posting.

RIAction - The first RIA conference in Singapore

Its here! Singapore’s first RIA conference. There will be many exciting topics that will be presented by the “various RIA factions” such as Google, Adobe and Microsoft. Microsoft will also be setting up XBox 360 booths to entertain the attendees. So pop over to RIAction.sg and register your place now, registration is free.

Promotional video for RIAction (Homemade :))

Spaces added into email subject

If you are experiencing an issue where spaces are added into your email subject especially for dynamically generated subjects, consider using base64 encoding for your subject field in the email you send out or if you use non-latin characters or even binary data.

This problem occurs if you use xpertmailer for php which uses Quoted-printable encoding by default.

I quote one important information from the wikipedia page on Quoted-printable:

ASCII tab and space characters, decimal values 9 and 32, may be represented by themselves, except if these characters appear at the end of a line. If one of these characters appears at the end of a line it must be encoded as “=09″ (tab) or “=20″ (space).

If you are using xpertmailer, you can set the encoding in the following manner:

$m = new MAIL5();

$m->From(’you@example.com’);

$m->AddTo(’recipient@example.com’);

$m->Subject(’Look at this example, it is a very’ .
‘ long subject line which may be subjected to ‘ .
’spaces added unknowingly.’, ‘utf-8′, ‘base64′);

$m->Html = array(’content’ => ‘Your email HTML content here’);

echo $m->Send(’sendmail’) ? ‘Mail sent !’ : ‘Error !’;