PHP: Validate Email, Name, Price, Age using Regular Expression & filter_var

This article contains PHP code with regular expression to validate different numbers and strings. Integer validation can be done for validating age. Decimal validation can be done for validating price. Simple String validation can be done for validating name. Email validation can be done for validating email. preg_match PHP function is used to perform the … Read more

Making a tree navigation menu in PHP

Below is the code with sufficient comments on making a tree navigation menu (hierarchical menu) in PHP. A single page holding different links. The navigation links are present at the left sidebar of the page. I have not used any dynamic approach over here. Have not used any loop. It’s just a static and straight-forward … Read more

MySQL: Backup/Export and Restore/Import Database & Table

This article shows how to backup/export and restore/import single & multiple databases and tables in MySQL. Backup/Export 1) Backup/Export single database mysqldump -h hostname -u username -p database_name > /path/backup.sql 2) Backup/Export multiple databases mysqldump -h hostname -u username -p –databases db1 db2 db3 > /path/threedb.sql Here: db1, db2, db3 are three different database name. … Read more

MySQL Installation Problem: Can’t create pid file – no such file or directory

Problem: can’t create pid file: no such file or directory I had this problem and had a very tough and frustrating time with it. While I was installing a fresh copy of MySQL 5 in Windows XP, I got this problem. (I was installing it from the installer i.e. setup file.) The server was not … Read more

Fun with Regular Expression

Fun with perl regular expression A) $st = “The programming republic of perl”; $1 = ?, $2 = ? and $3 = ? 1) if($st =~/(.*)(e|r)(.*)$/) 2) if($st =~/(m{1,2})(.*)$/) 3) if($st =~/(.*)(m{1,2})(.*)$/) 4) if($st =~/(.?)(m{1,2})(.*)$/) 5) if($st =~/(.+?)(e|r)(.*)$/) 6) if($st =~/(m{1,2}?)(.*?)$/) 7) if($st =~/(m{1,2}?)(.*?)/) 8 ) if($st =~/(.*})(.*)$/) Answer: 1) $1 = The programming republic … Read more

Cryptography: Public-key Encryption & Digital Signature

History Public-key encryption makes key-management much easier. It was invented in 1976 by two Stanford mathematicians, Whitfield Diffie and Martin Hellman. Their discovery can be phrased simply: enciphering schemes should be asymmetric. For thousands of years all ciphers were symmetric—the key for encrypting a message was identical to the key for decrypting it, but used, … Read more

Free .np domain registration

NP domain registration service is provided by Mercantile Communications completely free of charge to people and company in Nepal. This article shows step-by-step procedure to register and host a free .np domain/website. Here is the step-by-step guide: 1) Go to domain registration website: http://register.mos.com.np 2) Check Domain Availability Note that, you should choose domain with … Read more