Tuesday, 13 February 2018

Adding Syntax highlighter in Blog

It is very import to add Syntax Highlighter in the Blog which is related to Programming and Software development.

So here is way to do.

Go to you head section
In Blogger to goto Theme - > Edit and find paste following code before end of head

<link href='https://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/>

<link href='https://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/>

<script src='https://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'></script>

<script src='https://alexgorbatchev.com/pub/sh/current/scripts/shBrushCpp.js' type='text/javascript'></script>

<script src='https://alexgorbatchev.com/pub/sh/current/scripts/shBrushCSharp.js' type='text/javascript'></script>

<script src='https://alexgorbatchev.com/pub/sh/current/scripts/shBrushCss.js' type='text/javascript'></script>

<script src='https://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js' type='text/javascript'></script>

<script src='https://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js' type='text/javascript'></script>

<script src='https://alexgorbatchev.com/pub/sh/current/scripts/shBrushPhp.js' type='text/javascript'></script>

<script src='https://alexgorbatchev.com/pub/sh/current/scripts/shBrushPython.js' type='text/javascript'></script>

<script src='https://alexgorbatchev.com/pub/sh/current/scripts/shBrushRuby.js' type='text/javascript'></script>

<script src='https://alexgorbatchev.com/pub/sh/current/scripts/shBrushSql.js' type='text/javascript'></script>

<script src='https://alexgorbatchev.com/pub/sh/current/scripts/shBrushVb.js' type='text/javascript'></script>

<script src='https://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js' type='text/javascript'></script>

<script src='https://alexgorbatchev.com/pub/sh/current/scripts/shBrushPerl.js' type='text/javascript'></script>

<script language='javascript'>

SyntaxHighlighter.config.bloggerMode = true;

SyntaxHighlighter.config.clipboardSwf = 'https://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf';


After this we can add code snippet inside

// comment
echo "Hello, Enjoy using Syntax Highlighter";
Cortesy http://alexgorbatchev.com/SyntaxHighlighter/
You can use this code in any type of blog Bloggers, Wordpress etc.
As per the js is included you can use class "brush:"
language can be cpp (for c++), csharp, css, java, jscript, php, python, ruby, sql, vb, xml, perl

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='http://cran.rstudio.com/')\""

Install Shiny Package

sudo su - -c "R -e \"install.packages('shiny', repos='https://cran.rstudio.com/')\""

Now install Shiny server:
Check latest download version at here
wget https://download3.rstudio.org/centos5.9/x86_64/shiny-server-
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 https://www.magentocommerce.com/download

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-email=user@example.com \
--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="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">');
 } 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");