.htaccess Redirect all request to index file

Redirect all request to index.php using .htaccess file. 

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php?$1 [L]

URI value after root folder will be set as SCRIPT_URI OR QUERY_STRING.

Tags: Rewrite, Htaccess

Find External or Internet IP address from Linux and Windows

Find External/Public IP Address using windows

From windows command prompt you can find the internet address of your system or modem address using the following command.

C:\>nslookup myip.opendns.com resolver1.opendns.com
           Server:  resolver1.opendns.com
           Address:  xxx.xxx.xxx.xxx
           Non-authoritative answer:
           Name:    myip.opendns.com
           Address:  xxx.xxx.xxx.xxx

Above command output two ipv4 address. Address shown for myip.opendns.com highlighted will be you external ip or internet/modem ip address.

Find External/Public IP Address using Linux

In linux it can be find using dig command. It will output lost of information. Can be filtered using +shot options.

:~$ dig +short myip.opendns.com @resolver1.opendns.com

Command ouptus the your external internet IP address.

Tags: Nslookup, Dig, Public IPv4

What is Material Design

Material Design is a design language developed in 2014 by Google. Expanding upon the "card" motifs that debuted in Google Now, Material Design makes more liberal use of grid-based layouts, responsive animations and transitions, padding, and depth effects such as lighting and shadows.

Material is the metaphor

Material is a metaphor, a system for uniting style, branding, interaction, and motion under a consistent set of principles. With Material we believe product teams can realize their greatest design potential.

A material metaphor is the unifying theory of a rationalized space and a system of motion. The material is grounded in tactile reality, inspired by the study of paper and ink, yet technologically advanced and open to imagination and magic.

Surfaces and edges of the material provide visual cues that are grounded in reality. The use of familiar tactile attributes helps users quickly understand affordances. Yet the flexibility of the material creates new affordances that supersede those in the physical world, without breaking the rules of physics.

The fundamentals of light, surface, and movement are key to conveying how objects move, interact, and exist in space and in relation to each other. Realistic lighting shows seams, divides space, and indicates moving parts.

Material Design for Android

Material design is a comprehensive guide for visual, motion, and interaction design across platforms and devices. Android now includes support for material design apps. To use material design in your Android apps, follow the guidelines defined in the material design specification and use the new components and functionality available in Android 5.0 (API level 21) and above.

Android provides the following elements for you to build material design apps:

  • A new theme
  • New widgets for complex views
  • New APIs for custom shadows and animations

More Information >>

Tags: Android, Material Design, UI Design

What is SonarQube

SonarQube is an open source platform for continuous inspection of code quality to perform automatic reviews with static analysis of code to detect bugs, code smells and security vulnerabilities on 20+ Programming language including Java (including Android), C#, PHP, JavaScript, C/C++, COBOL, PL/SQL, PL/I, ABAP, VB.NET, VB6, Python, RPG, Flex, Objective-C, Swift, Web and XML.SonarQube is the only product on the market that supports a leak approach as a practice to code quality.

SonarQube offers reports on duplicated code, coding standards, unit tests, code coverage, code complexity, comments, bugs, and security vulnerabilities. SonarQube can record metrics history and provides evolution graphs. SonarQube's greatest asset is that it provides fully automated analysis and integration with Maven, Ant, Gradle, MSBuild and continuous integration tools (Atlassian Bamboo, Jenkins, Hudson, etc.).

Back in 2007, when first lines of code were created, the founders of SonarQube (originally called Sonar) had a dream to one day provide every developer the ability to measure the code quality of his projects. Their motto: “Continuous Inspection must become mainstream as Continuous Integration”.

Fully integrated with DevOps tool chains it comes with:

  • built-in integration with most build tools, which enables in most cases a no configuration approach
  • easily integration with continuous integration engines such as Jenkins, TFS/VSTS, TeamCity, Bamboo, etc.,
  • support for numerous source configuration management tools such as Git, Subversion, CVS, Mercurial, etc.,

Tags: SonarQube, Code Analysis, Open Source

How to reset root MySQL

If you have forgotten MySQL root password and have root access to linux system follow the below steps.

  • Stop the MySQL server process as root users using command
$ sudo service mysql stop
  • Start MySQL serve rin safe mode with skip grant table command
$ sudo mysqld_safe —skip-grant-tables —skip-networking &
If it throughs any error saying mysqld folder not found. Create the folder
$ sudo mkdir -p /var/run/mysqld
  • login with MySQL server using command, it won't ask for password.
$ mysql -u root -p
  • Once logged in follow below MySQL sql query to change new password
mysql> use mysql;
​mysql> update user set authentication_string=password('NEWPASSWORD') where user='root';
​mysql> flush privileges;
​mysql > quit
  • Now stop MySQL server using kill command
$ killall mysqld_safe
  • Start MySQL server using default service and login with new password.
$ sudo service mysql start  


$ sudo /etc/init.d/mysql start

Also can be reset using temporary file using below steps

  1. Kill/Stop running MySQL server first
$ sudo  kill `cat /mysql-data-directory/host_name.pid`


$ sudo killall mysqld
  1. Create a temporary file (init_mysql.tmp) with following sql with new password in place of "MyNewPassword" in current folder.
    1. For MySQL 5.7.6 and later:
      ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPassword';
    2. For MySQL 5.7.5 and earlier:
      SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPassword');
  2. Start MySQL server using temporary file created in previous step.
$ mysqld --init-file=/home/me/init_mysql.tmp &
  1. After the server has started successfully delete the temporary file /home/me/init_mysql.tmp
  2. Now login in to MySQL server with the pemoprary password give in file and reset using the below SQL commands
mysql> UPDATE mysql.user SET authentication_string = PASSWORD('MyNewPass'), password_expired = 'N'     WHERE User = 'root' AND Host = 'localhost';
  1. Once set restart the MySQL server and all done.

Tags: MySQL, Reset Password

Copy files using scp from one system to remote system

Linux administrator should be familiar with CLI environment. Since GUI mode in Linux servers is not a common to be installed. SSH may the most popular protocol to enable Linux administrator to manage the servers via remote in secure way. Built-in with SSH command there is SCP command. SCP is used to copy file(s) between servers in secure way.

scp stands for secure cp (copy), which means you can copy files across ssh connection. That connection will be securely encrypted, it is a very secure way to copy files between computers. scp uses by default the port 22, and connect via an encrypted connection or secure shell connection. (ssh for short).


scp [-12346BCEpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l limit] [-o ssh_option] [-P port] [-S program] [[user@]host1:]file1 ... [[user@]host2:]file2


Copy one single local file to a remote destination

scp /path/to/source-file user@host:/path/to/destination-folder/
scp user@host:/path/to/source-file /path/to/destination-folder

Command copy's local fource file to remote system /path/to/destination-folder/ folder and also vice versa.

Copy one single file from a remote server to another remote server

scp user1@server1:/path/to/file user2@server2:/path/to/folder/

above command copy a file from one server to another server. This command is executed from thrid server.

Copy multiple files with one command

scp file1.txt file2.txt file3.txt pete@host.example.com:/home/pete/

Copies multiple files with file name mentioned, to another server named host.example.com

Copy all files with wildcard

scp /path/to/folder/*.ext user@server:/path/to/folder/

Command copies list of file with extension .txt with in a folder.

Copy all files in a folder recursively to a remote server

scp -r /path/to/source-folder user@server:/path/to/destination-folder/

Command copies all files and folders with-in source-folder recursively to remote server with same folder structure.

For more scp command options use man page using below man command.

man scp


Tags: SCP, Remote Copy, SSH