Date with PHP

One of the site I am working on needs to hide a promotion ads after 12:00 midnight local time at the end of October. At first, it looks straight forward as comparing the current date to Nov 1 and hide the ads. This can be easily done as below on the php page concerned:

< ?php if (strtotime(date("Y-m-d")) < strtotime("2010-11-01")) { ?>
Ads to hide after midnight Oct 31st goes here...
< ?php } ?>

Well, it was fine if the server is located here in HK, but it’s not. Noticed this when I was checking the code and tested it for today’s date. It turns out that the server is in a time zone in GMT -4 hours and HK is in GMT +8 hours. This means a difference of 12 hours.

Option 1, hard code the difference in the date being compared. This is the easiest and fastest. but not elegant and might be cause error for other coders maintaining the code later…might not be really a big deal…it’s only 12 hours difference. After noon it will work…It’s ok right? well maybe not…people will not be happy with that! 🙂

Option 2, capture the server’s offset from GMT and and adjust for HK offset of 8 hours and add to the date being compared. This is more complicated.

As it turns out, my solution is even much simplier, I end up using ISO 8601 date format which was added in PHP 5 and represented the date as 2010-11-01T00:00:00+08:00 with the +08:00 the GMT offset of Hong Kong. Here’s the code:

< ?php if (strtotime("now")) < strtotime("2010-11-01T00:00:00+08:00")) { ?>
Ads to hide after midnight Oct 31st goes here...
< ?php } ?>

Posted in Web Development | Leave a comment

Christmas Song – Frosty the Snowman

A fun christmas song for kids, Frosty the Snowman is one of Bryce favorite Christmas song … midi and the PNG for this song are all created using MuseScore from

Frosty the Snowman

Here’s the MIDI file here

You can also download the musescore file here. Frosty the Snowman

Posted in Music | Leave a comment

Christmas Song – Deck the Hall

Request by Bryce, here’s Deck the Halls … midi and the PNG for this song are all created using MuseScore from

Deck The Halls

Here’s the MIDI file here

You can also download the musescore file here. Deck The Halls

Posted in Music | Leave a comment

Outlook Anywhere

Are you using your exchange email on your iPhone? If so, your exchange server supports Outlook Anywhere. This means you can access your email in Outlook anywhere you have an Internet access. What? You need to VPN first to access your email? You might just need to make some minor configuration changes to your outlook account settings to enjoy the convenience of accessing your email without the need to VPN back to the corporate network! If it didn’t work, your Windows XP might be less than SP2. And you should update your XP to SP2 or later, we’re on SP3 (Yes, we do have some laptops running XP and in the process of moving to Windows 7 … hopefully soon!)

Here’s a step by step guide to enable Outlook Anywhere access in MS Outlook.

  1. In your MS Outlook, go to Tools, and Account Settings...
  2. Double click your account or choose your account and clich Changes...
  3. Click the More Settings... Button
  4. Go to the Connection tab and under Outlook Anywhere, make sure the checkbox Connect to Microsoft Exchange using HTTP is checked. Then click on the Exchange Proxy Settings button. If you do not see these option, your XP is not patched to SP2 or later. Have it patch or contact your admin for help
  5. Enter the connection setting given by your administrator as shown. Most likely, it will be something like and also input for the proxy server. Make sure Connect using SSL is checked and choose the proxy authentication given by your admin.

Click your way out of the dialog boxes to complete. Enjoy Outlook when you travel without the need to login to VPN.

Posted in Email Infrastructure, Exchange | 1 Comment

Hitachi Information Forum 2010 Hong Kong

I attend the Hitachi Information Forum 2010 at JW Marriott yesterday. As this year is Hitachi’s 100 Years anniversary, one of the presenter was Mr. Toshio Nakano, the General Manager, Global Business Operation, Disk Array Division at Hitachi Ltd.

He described there how Hitachi started out from developing and selling 5hp motors to the present where in Hitachi is in most high tech products, which includes high speed trains, Information Technology, and much much more.

The then described the latest evolution in storage systems. How the HDS Virtual Storage Platform (VSP) differs and faster than the cometition and even the older generation of HDS’s own USP and USP-V.

Another presenter I quite find entertaining in their presentation is Edward Joe, the Regional Manager for Hong Kong, Taiwan and Macau for Brocade Communication. He has his style of telling you how Broade switches are in the networks in Hong Kong. How they are very significant from the TV boradcasting networks, the banking network and even in the government networks here in Hong Kong and in Asia Pacific.

Falconstor VP Eric Chen also presented how Falconstor help enterprises solve their backup by using Falconstor advanced Virtual Tape Library with Data Deduplication.

It truly was an energy pack day. Really looking forward to join their event next year.

Posted in Uncategorized | Leave a comment

Christmas Song – Angels We Have Heard On High

Here’s another Classic Christmas song, Angels We Have Heard On High. Both the midi and the PNG for this song are created using MuseScore from

Angels We Have Heard On High

Here’s the MIDI file here

Here’s you can download the musescore file. Angels We Have Heard On High

Posted in Music | Leave a comment

Christmas Song – Oh Christmas Tree

Both the midi and the PNG for this song is created using MuseScore from

Oh, Christmas Tree

you can listen to the midi format here

You can also download the musescore file here. Oh, Christmas Tree

Posted in Music | Leave a comment

Christmas Song – Silent Night

Christmas is just around the corner and my son Bryce asking how to play Silent Night …. so I used the free music composition and notation software MuseScore which you can download from and create one.

Here’s the save as PNG version for Silent Night.

Silent Night score

you can listen to the midi format here

You can also download the musescore file here. Silent Night

Posted in Music | Leave a comment

Free System Information on Windows Boxes

Sometime we want to find out the specs of a PC and fumbles around the control panel or computer properties to find the information we need. However, it turns out Windows has a nice utility that comes for free! From Windows XP to Windows 7, there is a software you can run on the Run Diag by pressing Win+R and entering MSINFO32. There are lots of useful information you can see in here.


As most PC comes with Direct-X now a days, we can also use dxdiag especially if we are interested with the display and sound, you can use Direct X Diagnostic tool by running dxdiag on the dialog that pops up pressing Win+R


Posted in Windows | Leave a comment

Mobile Email and Exchange 2010

I attend the seminar by PCCW Mobile yesterday afternoon about upgrading Exchange 2010 which focus on how mobile email is shaping up in HK.

Before joining this seminar, I though there was less incentive to learn the new feature in Exchange 2010 as it is said that Exchange 2010 should have been Exchange 2007 R2. And with cloud based email offering, especially the hosted exchange that crops up with so mane different vendor to choose from at a very attractive prices, enterprises will slowly move to that model and finding work with our Exchange skill will become more and more difficult.

Makes me think again and I think I should revisit what’s new with Exchange 2010 when I have some free time. What I liked is the idea of RAID less high availability afforded by the new architecture offered by Exchange 2010. Gone are the requirements of share storage for clustering (READ: Expensive SAN storage) and you can even use JBOD (Just a bunch of Disk, no RAID configuration) because the mailbox server are replicated real time. Mailbox server can be brought offline without noticeable downtime for the mail user! Looks like a dream even with the Exchange 2007 we have. Just imagine the havoc of loosing one of those mailstore!

I definitely need to add this to my “MUST READ” list… good night for now…got to sleep, have work early tomorrow!

Posted in Email Infrastructure, Exchange | Leave a comment