Sunday, 26 November 2017

Installing Shiny Server on Cent OS

First install R base

sudo yum install R

Install some R packages

sudo su - -c "R -e \"install.packages(c('shiny', 'rmarkdown', 'devtools', 'RJDBC'), repos='')\""

Install Shiny Package

sudo su - -c "R -e \"install.packages('shiny', repos='')\""

Now install Shiny server:
Check latest download version at here
sudo yum install --nogpgcheck shiny-server-

Start Shiny server service:
sudo start shiny-server

Check your installation :


Installation path:
just like all files for php at /var/www/html, similarly in case of shiny it will be at
/srv/shiny-server/ on server

Saturday, 14 October 2017

add title to Ubuntu terminal in 16.04

Open terminal

sudo gedit ~/.bashrc

paste below code in end of the file
# function to set terminal title
function set-title(){
  if [[ -z "$ORIG" ]]; then
# end of function


save and close the file

source ~/.bashrc

Now use set-title command to add title any terminal

set-title "MY Title name"

Thursday, 29 June 2017


Command Magento2 Shell

sudo chmod -R 777 pub/ var/ && bin/magento cache:clean && bin/magento setup:upgrade && bin/magento setup:di:compile

Cache namespace issue

sudo rm -rf var/di/* var/generation/* var/cache/* var/page_cache/* var/view_preprocessed/* var/composer_home/cache/* && sudo chmod 777 var -R && sudo chmod 777 pub -R && sudo php bin/magento setup:static-content:deploy && sudo chmod 777 var -R && sudo chmod 777 pub -R

Correct permission for folders and files

sudo find . -type f -exec chmod u+x {} \; && sudo find . -type d -exec chmod 755 {} \; && sudo chmod u+x bin/magento

Friday, 4 March 2016

Magneto 2 installation

1. Download Magento 2.02 from

2. Put your downloaded folder in www/html
suppose my folder name is m2

go to
cd /var/www/html/m2

3. Make webdata in you user list
chown -R  :www-data .

4. Set file permission:

  sudo find . -type d -exec chmod 770 {} \; && sudo find . -type f -exec chmod 660 {} \; && sudo chmod u+x bin/magento

5. Create virtual host
suppose we created http://local.m2/

6. Start installation

sudo php bin/magento setup:install --base-url=http://local.m2/ \
--db-host=localhost --db-name=magento --db-user=magento --db-password=magento \
--admin-firstname=Magento --admin-lastname=User \
--admin-user=admin --admin-password=admin123 --language=en_US \
--currency=USD --timezone=America/Chicago --use-rewrites=1

Installation will complete after a while and it will give you admin url

7. Give full permission to some public folder
sudo chmod -R var/
cd pub/
sudo chmod -R media/ static/

Thats all
go to your url


Monday, 18 January 2016

adding conditional css for firefox

var j = jQuery.noConflict();
if ( j.browser.mozilla == true ) {
      document.write('<link type="text/css" rel="stylesheet" href="">');
 } else {
document.write('<link type="text/css" rel="stylesheet" href="../css/font-awesome.min.css">');

Wednesday, 30 December 2015

Creating a jquery function to make all class with same height

 //Creating a jquery function to make all class with same height

function equaliseDivOnClass(class1){
                    var j = jQuery.noConflict();
     var divheights = 0;
j("."+class1).each(function( i ) {
  if(j(this).height() > divheights){
divheights = j(this).height();

Usage: equaliseDivOnClass("f-desc");

//Creating a jquery function to make 2 div with different id same height

function equaliseDiv(div1, div2){
               var j = jQuery.noConflict();
x = j(div1).height();
y = j(div2).height();
if (x > y) {
j(div2).height(x); }
else {


Usage: equaliseDiv("#s1", "#s2");

Thursday, 26 February 2015

Logging all the sql in Magento for debug

In Magento development you need some time to check the sql query running in the background

For this you can insert a code into the lib/Varian/Db/Adaptor/Pdo/Mysql.php

$code = 'SQL: ' . $sql . "\r\n";
if ($bind) {
       $code .= 'BIND: ' . print_r($bind, true) . "\r\n";
$this->_debugWriteToFile("[".date('Y-m-d H:i:s')."] ".$code);

in your query method of the page.
now your query method look like

    public function query($sql, $bind = array())
        try {
            $this->_prepareQuery($sql, $bind);
/* Inserted code Starts */
           $code = 'SQL: ' . $sql . "\r\n";
           if ($bind) {
                $code .= 'BIND: ' . print_r($bind, true) . "\r\n";
          $this->_debugWriteToFile("[".date('Y-m-d H:i:s')."] ".$code);
/* Inserted code Starts */

            $result = parent::query($sql, $bind);
        } catch (Exception $e) {
            $this->_debugStat(self::DEBUG_QUERY, $sql, $bind);
        $this->_debugStat(self::DEBUG_QUERY, $sql, $bind, $result);
        return $result;

You can find the log at /var/debug/pdo_mysql.log

Mage::log("MyArray:".print_r($arr,true), null, 'logfile.log');