Linux command to find file names for matching pattern

Here is command to get files which contains the given pattern. For example, if you are trying to find "Got my text" in current directory and its sub directories, then following command will give line numbers along with file names that contains that text:

grep "Got my text" -nr ./*

Installing git-svn on Mac

git-svn can be installed on Mac using macports. Just this will do:
sudo port install git-core +svn

[MySql] How to add/delete a column from commandline

Following command is used to delete a column from a table:

ALTER TABLE <table_name> DROP COLUMN <column_name>;



Following command is used to add a column in table:

ALTER TABLE <table_name> ADD <column_name> <datatype> ;


[MySql] How to export MySql database schema using command line

Following command dumps MySql database's schema into a file:


mysqldump -u<username>i -p<password> -h<host> --databases <database1> --no-data > dump.sql

Above command exports single or multiple databases into dump.sql. This only exports database schema without any table contents.


This exported schema can be restored using following command:


mysql -u<username>i -p<password> -h<host> <database_name> < dump.sql

Uploading files to Remote Server


There are different ways we can upload files to remote servers. Few command line tools are listed here"
1- Securely Copy files (scp):
scp -v -r -o IdentityFile=<cert.pem> <source folder> <user>@<remoteserverip>:/home/<user>/<destination folder>

Note: If a certificate is needed, then IdentityFile=<cert.pem> should be used.

2- rSync: 
rsync -vcrz --delete-after <source folder> <user>@<remoteserverip>:/home/<user>/<destination folder>

jQuery Chaining Interview question

Which one of the following will break the chain and Why?
A-

$(…)
.html('Breaks chain')
.addClass('chainbreaker')

B-

$(…)
.html()
.addClass('chainbreaker')

Solution:
In A, .html('Breaks chain') behaves like a setter and returns object, on which .addClass(…) adds the given class. But in B, .html() behaves like a getter and returns a string, on which .addClass(…) methods fails to perform and gives runtime error.

How to get File Extension in PHP ?

Very Simple! This command should do that:
$ext = pathinfo($filename, PATHINFO_EXTENSION);

Scheduling Repeating Local Notifications using Alarm Manager

Learn about Scheduling Repeating Local Notifications using Alarm Manager in this post .