Mar 26, 2015

PHP - preg_match: Compilation failed: unknown option bit(s) set at offset 0

preg_match issue encounter after one admin update one service, unfortunately some common library need to update. Until those common library need by php thats why php also included on update.

After trying to figure out and googling the error, I found the preg_match uses prce as its library. One article on said he/she can able to work on php 4.x with prce 8.x. Since my prce still 7.8 I decide to update to 8.x and miracle happen(Issue was fixed).

NOTE: After you update your prce make sure to restart your apache.

Nov 6, 2014

TipS: Know the right pronunciation one a word - Power by google

Most the time I do google search on every english words that I don't understand, by typing on search box.
And most the time audio icon was displayed to get hear the how the word pronounce. But in some case you cant see the Audio Icon Button. Try this one.


NOTE: WORD must replace with word you looking for.

Sep 18, 2014

JS - Infinite scroll sample code.

var base_url = config.base_url;
var offset = 1;
var request_ajax = true;
var ajax_is_on = false;
var objHeight = $(window).height() - 50;
var last_scroll_top = 0;
var type = '0';
var csrftoken = $("meta[name='csrf-token']").attr('content');
var csrfname = $("meta[name='csrf-name']").attr('content');
$(window).scroll(function(event) {
  var st = $(this).scrollTop();
  if(st > last_scroll_top){
    if ($(window).scrollTop() + 100 > $(document).height() - $(window).height()) {
      if (request_ajax === true && ajax_is_on === false) {
        ajax_is_on = true; 
          url: base_url + 'category_more',
          data:{page_number:offset,id_cat:'459',type:type, parameters:'[]', csrfname : csrftoken},
          type: 'post',
          dataType: 'JSON',
          onLoading:jQuery(".loading").html('<img src="/assets/images/orange_loader.gif" />').show(),
          success: function(d) {
            if(d == "0"){
              ajax_is_on = true;
              if(d.substring(0,5)  == ""){
                ajax_is_on = true;
                ajax_is_on = false;
                offset += 1;   
  last_scroll_top = st;

Sep 10, 2014

How to resize/increase tmpfs partition.

Increasing linux tmpfs partition have two way to do.

1. Modify you /etc/fstab and put the below. Setting below set the tmpfs size to 2GB
LABEL=/     /           ext4    defaults,noatime  1   1
tmpfs       /dev/shm    tmpfs   defaults        0   0
devpts      /dev/pts    devpts  gid=5,mode=620  0   0
sysfs       /sys        sysfs   defaults        0   0
proc        /proc       proc    defaults        0   0

Add size=2G inline to tmpfs besize defaults.
tmpfs       /dev/shm    tmpfs   defaults,size=2G        0   0
After you modify and save your changes, remount the partitions by issuing command below
# mount -o remount /dev/shm
And you done. Or try easier way below.

2. Or if you want the easier way, issue command below to set the tmpfs to 2GB.
sudo mount -o remount,size=2048M tmpfs /dev/shm
NOTE: The breakdown of doing this, this setting will revert after the system was rebooted, so I recommend to modify the /etc/fstab