Ning Ma blog

my technology tips

August, 2013

php quick debug code by error log

js form validation with JQuery

Here is good tutorial for js form validation with JQuery

jquery render with object javascript and ajax example



Ajax return data(JSON)

Magento: Difference between Mage::getSingleton() and Mage::getModel() in Magento

Some people ask about the difference between Mage::getModel() and Mage::getSingleton() in Magento. Here is the difference between these two: Mage::getModel(‘module/model’) will create a new instance of the model object (if such object exists in configuration) So if we write: Mage::getModel(‘catalog/product’), it will create new instance of the object product each time. So, $p1 = Mage::getModel(‘catalog/product’); […]

linux apache fix folder security issue

ls -Z, –context Display security context so it fits on most displays. Displays only mode, user, group, security context and file name. chcon – change file SELinux security context

mysql production server and development sync

UPDATE! Code moved to bitbucket: Often times, you need to pull down an up-to-date version of Magento from your production server to your development or staging servers. This involves: Executing a mysqldump on production. Zipping it up. Secure copying the zipped file from production to development (or staging). Unzipping the file locally. Updating the […]

Magento form validation front/end

Here is an example:

another one

For the backend, we can use zend validator

Here is the link how to install and configration varnish 3 to CentOS6

fix apache 2 on centos 6 gives permissions denied error

Usually that comes from Selinux not giving access to the folder. do

and if the html folder doesn’t have the context system_u:object_r:httpd_sys_content_t, fix it with chcon