Monkey on a Keyboard

my online scrapbook of scrambled thoughts

In the old days, synchronizing php and javascript date and time functionality is a real pain. You need to detect the client timezone offset with javascript, and then convert it to a format which is php friendly, and transform it as a cookie, and so on. That's a really hard process for a new programmer.

However, thanks to John Nylander, we can now have a rather convenient system. He made the JsTimezoneDetect javascript library.

Below is a quote form

To simply store away a user's timezone in a variable, you can simply import timezone_detect.js and do the following.

var timezone = determine_timezone().timezone;
// Now you have an instance of the TimeZone object.

// Offset in minutes from UTC

// Olson database timezone key (ex: Europe/Amsterdam)

// bool for whether the tz uses daylight saving time

This gives you an Olson database key you can use for datetime calculations in most programming languages.

After declaring the timezone variable in javascript, it's time to transfer it into php. because the timezone.olson_tz is already in a php friendly format, we can then directly save it in a cookie with setCookie("timezone_js", timezone.olson_tz, 365).

When the data is stored in a cookie, the php script can start to take over. we can call the cookie by simply calling the $_COOKIE["timezone_js"] and putting it in date_default_timezone_set($_COOKIE["timezone_js"] ). That way, your web is now in the same timezone as the client.

That's all from me, happy blogging!

   Posted in Web        Yohanes Mario Chandra        0 Comments

I've been talking a lot about music blogging, paint blogging, etc. Now, I want to get real with it. Let's talk first about paint blogging, the easiest one. It's as simple as painting on a real canvas, but instead, you're doing it at an online canvas, yes, an online "canvas", literally. Canvas is the new html element introduced in HTML 5 capable of rendering 2D/3D graphics without the need of any plugin. It's like having an interactive flash paint application in your website without having to download and install flash plugin! Isn't that great? Let's kill Flash!

This canvas will be needed the most when you're dealing with flash-uncapable devices such as iPhone, iPad, and the other iDevices. However, their built in web browser already support HTML 5 AFAIK, CMIIW.

Well, enough with the chit-chat and let me show you the concept of this kind of blogging. Below is the online canvas. You can check in the source of this page, it literally is a canvas.

Unfortunately, your browser does not support the HTML5 canvas element.


Imagine if you can pick your palette, your type of drawing tools (pencil, brush, etc), and imagine if you can save it and blog about it right away. Imagine if you can make an animation out of it. What a delightful experience.

Well, that's a glimpse of what the web is capable of doing in the time being and what we can do about it. Of course there's a lot of great things beside this simple paint blogging capability, but that's all I can share for now. So, set your dream high as the web might surprise you for the next couple of months.

Thank you for reading, and happy blogging!

   Posted in Web        Yohanes Mario Chandra        0 Comments

If you are a web developer, you wont need to read the rest of this page, as I'm still learning towards making a good SEO for my own blog. But if you're still getting started to make your blog or website, this is some information that you might want to consider before posting a post in your blog.

Sometimes, we make a blog just for logging our thoughts, and keeping our experiences from being forgotten. However, for an informational blog like mine, visitors do counts. What's the point of writing an informational post if no one reads it?

The way which most visitor come is through the search engine like Google, Yahoo!, Bing, etc. Those search engine will send their crawler (or spider, just a different name) to you blog, and index every page available. The best way to make our website more friendly to these crawler is through a good url. An url like is better than However, I still haven't figured out any way to implement it to a single file blog (my blog consist of only index.php). Making many directories is tiresome, but it worth the effort.

Search engines hate image and flash, they love text. That's why every image needs to have an alt component to give some clue to the search engines of what the image is about. A title tag and meta tag in your document head will also be a good friend for search engines. Make sure these tags have no duplicates by making them dynamically change in every page with php.
As for flash, never use it if it's unnecessary. The worst website that search engines won't be liking is a website filled with flash animation but have no actual text. If you want to make a flash website, make sure that the texts in your flash animation always synchronized with the actual text. If you don't know how to do that, simply don't use Flash in your website.

The most important thing to get traffic to your website is through link sharing, and lots of it. You can do that by actively commenting in another blog or website (no spam, of course) and by actively contributing in forums. You can also do this by sharing your posts in social networks such as twitter and facebook. Do this regularly, 7 times a week, and you will sure get traffic for your website.

That's all I know, I'm not an SEO master anyway. Hope that helps.
Happy blogging!

   Posted in Web        Yohanes Mario Chandra        0 Comments