Saturday, July 30, 2011

php possible datetime gotcha

Initially, i thought it was a bug in php...
but i think thats how its suppose to work.

If any month with 31days, and the last month has less days than current date,
the strtotime("-1 month", mktime())
will return this month date, instead of last month.

Example: strtotime("-1 month", strtotime("2011-07-01"))
results: time of 2011-06-01.
But,
Example: strtotime("-1 month", strtotime("2011-07-31"))
results: time of 2011-07-01.

This is because minus 1 month of 2011-07-31 in math => 2011-06-31,
which results to 2011-07-01 due to no 31 days in june.


Wednesday, July 27, 2011

Concurrency / Que with clustering

I realize a lot of people depends on existing framework or infrastructure to achieve concurrency or Que system to achieve what they need.
Basically if one need to get multiple server to be synced for write, and read, its possible to do it manually by coding it with combination of python or php scripts to connect between nodes...

But faster way to achieve so is by using open source combination such as zookerper with cassandra and cage.

But Case have issue when you are using more than 3 nodes.
This issue with zookeeper having to sync all the nodes together to have the transaction to run.
But after reading an article, its nice to have 2 or 3 nodes for transaction of 1 group of zookeeper process and separated zookeeper for read process. But do we need zookeeper for all nodes?
I think its better to have cassandra to sync those data to those server passively instead...
Only maintain between 2-3 nodes for transaction update to ensure uptime.

Monday, July 4, 2011

jQuery 1.6 buggy on IE 7

Ive been trying to figure out why my jquery colorbox seems to make ie 7 browser to hang,
and then i realize it wasnt colorbox issue, but jquery 1.6.
jQuery 1.6.1 seems to have fixed it... luckily :)