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

Aug 28, 2014

How to download facebook video without special software?

Simple tutorial how to download facebook videos without install some special software for it.

* Chrome/Firefox Browser. For firefox you need to install FireBug.
* Internet connection and you must be logged-in(Common sense)
* Ability in read, interpret and imagine(I'm not a good writer)

Lets try this video as a sample. Mocha Gurl - Umay Boy Part 2

1. Inspect the element

2. Find embed tag for the specific video.

3. Get/copy the value of flashvars attribute. Value normally start params=


4. The data is URL encoded and you need to decode in human readable data. For you to decode check URL Dencoder Tools

5. Find the sd_src, and copy the value. Important: You must understand JSON but, if you cant understand JSON just try to check and understand the image below.

In the image representation you can get the value.

6. Replace all \/ with a single slash only and your done.

7. Open the URL in your browser and press CTRL + S to save the video.
Instruction sample video can be download @Mocha Gurl - Umay Boy Part 2.

NOTE: If you encounter error message
An error occurred while processing your request.
Reference #50.3d34d417.1413363911.56c6c7
from the Download URL(w/c the .mp4) I provide try to follow the step #1 to #6. This reason is like security from facebook from creating automated call/request. I just notice that the parameters value after question-mark(?) is change every user login.

Hope you able to follow that simple instruction.

Jul 27, 2014

Magento - Customize your error page by store view.

In your magento home directory you can find file/folder structure.

File description and uses.
404.php       -> I guess 404 page but seems not calls when i encounter.
503.php       -> Mostly for maintenance page(check your index.php)
report.php    -> this file calls when encounter un-handle exception.
processor.php -> Main class for error handling
local.xml     -> Error Handling configuration
    404.phtml -> 404 page template
    503.phtml -> Maintenance error handin template.
    page.html -> Main page or layout of the error excemption
    report.phtml -> Exception error template

Above info is just a head up about the file/folder structure and information. Now lets assume that you have store view with store code mobile(that simplify the store is for mobile). To create custom error for your store(Store front). Best way copy the default error and name it same to your store code.
$ cd MAGENTO_PATH_DIR/errors/
$ cp default mobile

Now is time for you to customize the mobile custom error page. For this to able to use, you have to modify MAGENTO/errors/local.xml

    <skin>default</skin> <!-- Change default in to mobile-->
    <!-- Some other setting below -->

Aside from modifying your local.xml. You can also access the site with a parameter skin and is your store code.
Example: http://localhost/magento?skin=mobile
or you can modify the MAGENTO/index.php and the code before below.
$_GET['skin']='mobile'; // Add aditional parameter on every request.
Mage::run($mageRunCode, $mageRunType);

Jun 26, 2014

How to setup media wiki one lighttpd.

Assume the lighttpd already installed.

Add the configuration below for settings.

#fastcgi.server = (".php" =>("localhost" =>("host"=>"","port"=>"1026","bin-path"=>"/usr/bin/php-cgi")))
url.rewrite-once = (
         "^/wiki/upload/(.+)" => "/wiki/upload/$1",
#        "^/wiki/config/(.+)" => "/wiki/config/$1",
         "^/wiki/skins/(.+)" => "$0",
#        "^/$" => "/wiki/index.php",
         "^/wiki/([^?]*)(?:\?(.*))?" => "/wiki/index.php?title=$1&$2"
#url.rewrite-if-not-file = (
#   "^/wiki/(mw-)?config/?" => "$0",
#    "^/wiki/([^?]*)(?:\?(.*))?" => "/w/index.php?title=$1&$2",
#    "^/wiki/([^?]*)" => "/w/index.php?title=$1",
#    "^/wiki$" => "/w/index.php", # to avoid 404 when the user types /wiki instead of /wiki/
#url.redirect = ( "^/(?!w|wiki|robots\.txt|favicon\.ico)(.*)" => "/wiki/$1" )
#$HTTP["remoteip"] !~ "" {
#    $HTTP["url"] =~ "^/wiki" {
#      url.access-deny = ( "" )
#    }
# }

Jun 24, 2014

Mysql - ERROR 1148: The used command is not allowed with this MySQL version

This happen when you try to use the LOAD command.

How to Fixed.
* Add the --local-infile in you mysql command.
mysql -u root -pfatword test --local-infile
* Or Add the local-infile=1 in [mysql] section in your my.cnf file.

TIPS: my.cnf commonly found in /etc/my.cnf

kdenlive: cannot find your MLT profiles

This problem commonly encounter after you update you libmlt. Normally the popup suggest the path /usr/share/mlt/profiles, but after re-install/update the mlt path will commonly become /usr/share/mlt-5/profiles and /usr/share/mlt-6/profiles. But in my case i use /usr/share/mlt-6/profiles as my profile path.

Opensuse - KDENLIVE not working on on MPEG file.

KDENLIVE avformat module(FFmpeg) not working.
Opensuse version - 12.3

Root of problem:

libmlt5 has no avformat.


Update libmlt5 to libmlt6

Updating libmlt

* Add Packman repositories.
zypper ar -f -n packman-essentials Packman-Essentials
zypper ar -f -n packman-multimedia Packman-Multimedia
Since Im using openSuse 12.3, above urls put as example. However if your not using same as mine, you can check the specific url for system here.

* Open YAST ans search libmlt6. While attempting to install ibmlt6 expect a prompt/comfimation to install libmlt6 and uninstall libmlt5.

After you updated libmlt to libmlt6, i suggest to reboot your system to fully reload any possible services that was affected. And if your encounter kdenlive: cannot find your MLT profiles follow the links.

Jun 11, 2014

Magento - Adding existing product to new category via SQL

Most the time you edit the the product to assign the category or edit category and assign the products. Since magento admin is some too small on thousand product of catalog. Adding via SQL Query will faster to assigned.

Adding the Product into a category
catalog_category_product(category_id, product_id,position ) 

Adding the Product to webstore
INSERT INTO catalog_category_product_index(
    48, -- CategoryID 
    85545, -- Product ID
    1, -- Posistion Normaly 1(1)
    1, -- Parent category ID
    3, -- Store ID
    4, -- Visibility

May 12, 2014

Magento: X_FORWARDED_FOR not recorded on core_session data.

If your site are behind proxies/LoadBalancer. x_forwarded_for will be use to determine the where is the original request came from. But suddenly magento can't able to log this data in you core_session data. To fixed this one find Mage_Core_Model_Session_Abstract_Varien class and getValidatorData method.

In the code section below
if (isset($_ENV['HTTP_X_FORWARDED_FOR'])) {

Add an inline elseif statement
}elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {

Lets take look the original code.
public function getValidatorData()
  // Some codes here ....
  if (isset($_ENV['HTTP_X_FORWARDED_FOR'])) {

  // Some codes here ....        
  return $parts;

After adding the inline elseif statement section this will be output
public function getValidatorData()
  // Some codes here ....
  if (isset($_ENV['HTTP_X_FORWARDED_FOR'])) {
  }elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {

  // Some codes here ....        
  return $parts;

NOTE/Disclamer: I don't know why magento developer didn't realize the _ENV global variable, only store data that set by server using setEvn method, and didnt event try to test and get the data in _SERVER global variable. BTW I just saw this bug on magento 1.5.X.

Apr 28, 2014

Apache - httpd dead but pid file exists

In your apache status command, you will receive message httpd dead but pid file exists. Below are possible, solution to fixed.

Restart your apache.
# /etc/init.d/http restart
services httpd restart

TIPS: To stop this possible errors, After you install shared libraries in system. Try to restart this service, or reboot your system to sure that all possible services affected, will include in the affected module.

Apr 27, 2014

CRON - NOT WORKING FAILED to authorize user with PAM (Module is unknown)

Scenario: After I install and update some modules,I notice that my CRON is not working anymore and receive message.

FAILED to authorize user with PAM (Module is unknown)

After I google the message I found the restarting the CRON Service will made the miracle..

# /etc/init.d/crond restart
# services crond restart
TIPS: In every time you made update on you system, please find a time to reboot your system.

Apr 11, 2014

CSS scrolling at horizontal behavior

Your HTML data.

<div class="wrapper">
  <div class="scrolls">
       <img src="" />
       <img src="" />
       <img src="" />

CSS Data
.wrapper { 
        box-shadow: 1px 1px 10px #999; 
        margin: auto; 
        text-align: center; 
        position: relative;
        -webkit-border-radius: 5px;
        -moz-border-radius: 5px;
        border-radius: 5px;
        margin-bottom: 20px !important;
        width: 800px;
        padding-top: 5px;
    .scrolls { 
        overflow-x: scroll;
        overflow-y: hidden;
        height: 80px;
    .imageDiv img { 
        box-shadow: 1px 1px 10px #999; 
        margin: 2px;
        max-height: 50px;
        cursor: pointer;

See Reference output here

Apr 9, 2014

Simplified version on how to download videos in

Let say this one from Will There Be a Spinoff From The Mentalist?

Here the pattern of the download URL{1ST_FIVE_DIG_OF_VID_ID}/{VIDEOID}/1_{CHANNEL_ID}_{VIDEOID}.flv

Given data/URL VIDEOID is 41138669. Now our problem is what is the CHANNELID? To get this one try to press CTRL+U to view the source code.
Here what you see in image below

Now two unknown data already exist. Just to check sure that that you know where the I get the video id. Check below datas.
VIDEOID: 41138669
CHANNELID: 7262640

And now what is the
? In our video id(41138669) the First Five(5) digits are 411386

Finally all data need to download the video already define. See summary below.

VIDEOID: 41138669
CHANNELID: 7262640

See the pattern and the output/outcome url.{1ST_FIVE_DIG_OF_VID_ID}/{VIDEOID}/1_{CHANNEL_ID}_{VIDEOID}.flv

URL To Donwload.

Try to download the file here.

Jan 14, 2014

How to override magento model.

Overriding magento model is some tricky base, that's why I want to share how this models Override.

First Mage_Reports_Model_Event_Observer

Second Mage_Reports_Model_Mysql4_Product_Index_Viewed_Collection
<!-- You configs -->

// Your PHP class
class Globe_Reports_Model_Mysql4_Product_Index_Viewed_Collection extends Mage_Reports_Model_Mysql4_Product_Index_Viewed_Collection{

// Put possible override methods or 
//  addition methods you want here

Jan 12, 2014

SVN - treat text file as binary.

When I add xml to my SVN I got this one

A (bin) config.xml

To fix this one issue svn command.

svn propset svn:mime-type "text/xml" config.xml

and get an output
property 'svn:mime-type' set on 'config.xml'