Tuesday, August 23, 2011

Kloxo /script empty!

For some freaking vps problem, i was facing very slow processing with vps from ds.my as usual.
running /script/upcp seems to somehow run halfway and hang...

So i decided to stop it, and realize, the entire folder /script is empty!...

To fix it:
cd /usr/local/lxlabs/kloxo/httpdocs
sudo lphp.exe ../bin/update.php

And wait for it to complete.. duh...

Saturday, August 20, 2011

MODx Revolution and UTF8

If you ever need to insert in latin symbol or unicode into modx title or content...
Modify modx_site_content fields:
+ pagetitle, longtitle, description, introtext, content
to unicode_general_ci encoding.
(Note: This is a fulltext index, so you will have to execute 1 statement to alter all 5 fields)
And also modify template variable content:
ALTER TABLE  `modx_site_tmplvar_contentvalues` CHANGE  `value`  `value` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL

Next, modify core/config/config.inc.php and change the line:
+ $database_connection_charset = 'utf8';
+ $database_dsn = 'mysql:host=...;dbname=...;charset=utf8';

And you may start testing it it works :)
In my setup, its somehow in njis charset... (im not sure why)

Tuesday, August 9, 2011

MODx Revolution Root resource alias / path?

I tried google around on this, and find it difficult to find the result.
I've found a solution to based my resource alias to the root of the site.
By going to system > settings
use_alias_path : no

This will change all your resource alias to be based from root.
Example:
Container1 > My page (resourcealias: mypage)
now become:
http://www.example.com/mypage

If you need the container path, just put the full folder path:
Example:
Resource alias: container1/mypage

Monday, August 1, 2011

convert pdf to image in linux

convert -density 150 file.pdf outputname.png

-density to set pixel / resolution, the bigger the number, the bigger the image size

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 :)