Wednesday, 13 April 2011 - 3:20 AM GMT

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 https://bitbucket.org/pellepim/jstimezonedetect/wiki/Home:

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.

alert(timezone.utc_offset);
// Offset in minutes from UTC

alert(timezone.olson_tz);
// Olson database timezone key (ex: Europe/Amsterdam)

alert(timezone.uses_dst);
// 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!

Wednesday, 06 April 2011 - 11:45 PM GMT

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.

Color:  

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!

Monday, 04 April 2011 - 4:10 AM GMT

A 3D graphics in a web browser has been many people's dream. Imagine what we can build using this technology. People no longer have to download client application to play 3D online game, or we can even make a 3D UI for our website. This technology exist. It's called "WebGL".

Currently, I'm still in the process of studying this thing, so I don't have much to share. All I know so far is that this stuff is not very much different from OpenGL, so people who have studied and understood OpenGL should be able to understand WebGL with virtually no problem at all.

With that being said, The progress of this CMS' development will be on halt for a while, because I need to study WebGL for future developments of this CMS. If you want to study WebGL, you can learn from the lessons provided here.

Hopefully, I'll understand this quickly, and then I can continue developing this CMS. I'll post something if I find interesting things during my study.
Thanks for reading and happy blogging!