Check For Email pattern

Posted by Mohammad Forgani under Linuxi:

check for email pattern

if( !preg_match( “/^(([^<>()[\]\\\\.,;:\s@\”]+(\.[^<>()[\]\\\\.,;:\s@\”]+)*)|(\”([^\”\\\\\r]|(\\\\[\w\W]))*\”))@((\[([0-9]{1,3}\.){3}[0-9]{1,3}\])|(([a-z\-0-9áàäçéèêñóòôöüæøå]+\.)+[a-z]{2,}))$/i”, $email ) ) {
$msg = ‘Email address was not recognized as a valid email pattern’;

get the mx host name

if( preg_match( “/@\[[\d.]*\]$/”, $email ) ) {
$mxHost[0] = preg_replace( “/[\w\W]*@\[([\d.]+)\]$/”, “$1”, $email );
$msg = ‘Email address contained IP address ‘.$mxHost[0].’ – no need for MX lookup’;
// get all mx servers – if no MX records, assume domain is MX (SMTP RFC)
$domain = preg_replace( “/^[\w\W]*@([^@]*)$/i”, “$1”, $email );
if( !getmxrr( $domain, $mxHost, $weightings ) ) { $mxHost[0] = $domain;
$msg = ‘Failed to obtain MX records, defaulting to ‘.$domain.’ as specified by SMTP protocol’;


Clean up the Ubuntu

Posted by Mohammad Forgani under Linuxi:


Install the Debian menu to make all installed applications

Missing Icons & Fix Broken Icons

sudo apt-get update
sudo apt-get install menu menu-xdg


Keeping Ubuntu clean

Install deborphan with command:
sudo apt-get install deborphan

To delete unnecessary libraries just execute:
sudo deborphan | xargs sudo apt-get -y remove --purge

To delete unnecessary data

use command:
sudo deborphan --guess-data | xargs sudo apt-get -y remove --purge

To see all

which aren’t required by any others use command
deborphan --guess-all

There is another tool to delete orphaned

packages, it’s  GtkOrpha:
sudo apt-get install gtkorphan

Once it’s installed go to System –> Administration –> Remove Orphaned

Packages, enter your password and proceed with cleaning up.

Another nice tip is to clean partial and orphaned

packages by commands:
sudo apt-get autoclean
sudo apt-get autoremove


increase the screen resolutions

Posted by Mohammad Forgani under Linuxi:

Enter in root terminal:
$ sudo dpkg-reconfigure -phigh xserver-xorg

Select your video card by scroll up or down keys on your keyboard) and then hit enter.
the next select the resolutions that you would like to be available for Ubuntu by using the arrow keys to scroll up and down, and the Space Bar to select them.

Restart X by clicking Control+Alt+Delete (backspace). to set up new resolutions.

This starts the Xorg config process.

sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf_backup
sudo dpkg-reconfigure xserver-xorg
sudo xinit — :2

Look for errors:

tail -f /var/log/Xorg.0.log

Restart all servers by bouncing XDM (or gdm or kdm):

sudo /etc/init.d/xdm start

This starts a new X server — usually on tty8 or tty9 (CTRL-ALT-F8). You can go back to the original X server by pressing CTRL-ALT-F7.



See more website here...

  • Odlinks
  • Farsi-News
  • Advertise Here