Find and replace a word from a file

Sometimes, you might want to find and replace a bunch of word from a file and you do not actually needed a word editor such as vi, pico, nano or emacs to open and modify it.

From Linux, you could directly using perl to replace them.
perl -pi -e ’s/wordToFind/replaceWithThisWord/g’ *.fileExtension

For example, you have all word linux want to replace with mickgenie, you may use the command as below.

perl -pi -e ’s/linux/mickgenie/g’ bogo.txt

How to repair your MySQL databases

If you are using MySQL databases as your database engine, you surely ever get the error message as below if your database grown day by day.

Table “table” is marked as crashed and should be repaired.

To understand MySQL database table with MyISAM type, you will have .frm, .MYI and .MYD type, so the data stored from MyISAM type is storing to .MYI file extension.

To repair the database, open your SSH Console, type the following command.

myisamchk -o /path_to_mysql/database_name/table_name.MYI

where the table_name is the table name.

If you got tmp drive too low, you may add the following command from the my.ini or my.cnf.

[mysqldump]
tmpdir = /home/mysql/tmp

assume you assign the path to /home/mysql/tmp/.

Your website shall working without any issue now.

Why my 3GP file not serve by IIS?

By default, 3GP file extension is not understand and serve by the IIS, hence you might get the error as below when you try to browse to your 3GP file from your IIS web services engine.

The problem is IIS handler mapping do not have 3GP file extension format by default. To get this fixed, you could add the extension through the handler mapping from IIS 7.x.

Alternatively, you may run the following command to add the extension.

%windir%\system32\inetsrv\appcmd set config /section:staticContent /+"[fileExtension='.3gp',mimeType='video/3gpp']"