Wednesday, March 20, 2013

cpanel compiling php 5.4 modules

/usr/local/bin/phpize ./configure --with-php-config=/usr/local/bin/php-config make clean make make test make install this works well with mongodb Example for mongodb: git clone cd mongo-php-driver /usr/local/bin/phpize ./configure --with-php-config=/usr/local/bin/php-config make clean make make test make install vi /usr/lib/php.ini add

Tuesday, March 19, 2013

PHP facebook logout?

//for some reason, facebook getlogouturl does not seems to be able to populate access_token byitself.
//Therefore this method forces it to attach the access token:
$logoutUrl = $facebook->getLogoutUrl(array(
        "next" => "", "access_token" => $facebook->getAccessToken()



Prestashop smarty cache

Do not enable smarty cache on prestashop,
or all your screen will appear the same as last accessed screen, including admin screen.

its pretty messed up.

Sunday, March 17, 2013

Kloxo custom php.ini per domain

sudo cp /etc/php.ini /home/httpd/
#edit /home/httpd/ as required

sudo vi /home/apache/conf/domains/
#and add this line in <ifmodule mod_php5.c="">
PHPINIDir /home/httpd/

#restart apache
/etc/init.d/httpd restart

This shall allow you to set allow passthru or system or exec call per domain.

Saturday, March 16, 2013

axlsx vs simple_xlsx


text = getRandomString(15)
serializer ="test2.xlsx") do |doc|
  doc.add_sheet("Report") do |sheet|
      row = []
        row.push text
      sheet.add_row row 

text = getRandomString(15)
package =
workbook = package.workbook
workbook.add_worksheet(:name=>"Report") do |sheet|
    row = []
      row.push text
    sheet.add_row row 

Memory Usage: 17836kb, elapsed: 61.828213seconds.
Memory Usage: 2118256kb, elapsed: 177.089469seconds.

17+Mb vs 2+Gb, 61s vs 177s

File output seems to result in same size: 14+Mb

it would be nice if axlsx could write to file directly instead of serialize in the end.

Friday, March 15, 2013


jQuery("#treeidhere").bind("move_node.jstree", function (e, data) {
  console.log("from id: " + data.rslt.obj.attr("data-id"));
  console.log("to id: " +  (data.rslt.parent === -: data.rslt.parent.attr("data-id"));
  console.log("position: " + data.rslt.position);//starts from 0


Thursday, March 14, 2013

Social shares in php

Example of social share: twitter, Facebook, linkedin

Note: if url contains ? might cause linked in share to fail...     ---HEADER---
<meta property="og:title" content="Title here">
<meta property="og:description" content="Description here">
<meta property="og:image" content="http://your here">

Thursday, March 7, 2013

Prestashop redirect to module configure

When you need to create an AdminTab to redirect to a module configure,
create a class which extends AdminTab

class Admin[NameHere]Tab extends AdminTab

public function display() {

  Tools::redirectAdmin("index.php?controller=AdminModules&configure=[NameHere]&token=" . Tools::getAdminTokenLite("AdminModules"));

this will pass in the admin token as required...

prestashop jquery version

to upgrade,
copy jquery min file to js/jquery/

and then edit config/

define('_PS_JQUERY_VERSION_', '[version here]');


define('_PS_JQUERY_VERSION_', '1.9.1');

Tuesday, March 5, 2013

cpanel retrieving mail log

sudo grep [domainname] /var/log/exim_mainlog

Sunday, March 3, 2013

prestashop disable right column via hook?

need to disable right or left column via hook?
do these:

create a module,
makesure to hook onto displayFooter

$this->context->smarty->assign("HOOK_LEFT_COLUMN", "");
$this->context->smarty->assign("HOOK_RIGHT_COLUMN", "");

Alternative way is to go into Modules > Positions And edit the module, and add in exception page name onto the exception box. It's separated by comma.