Open With Application Duplicate

If you’re a Mac user, you can open up a file by right-clicking on it, and choosing “Open With,” and selecting an application. If you see duplicates, you can remove multiple entries by running the following script. The script restarts the Launch Register called lsregister and removes the duplicates.

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user

Right click the file again. The duplicates should be gone.

PHPMailer and GMail SMTP

Although PHP comes with its own email() function, it lack features. There’s an alternative called PHPMailer that’s easy to implement. PHPMailer is a library class used by many popular PHP projects. In this article, I’ll show how PHPMailer is used to send out notification emails via GMail’s STMP server. Using GMail SMTP server requires an account as well as the need to authenticate. So, here’s the code using PHPMailer and GMail SMTP server.

// email class
require_once('class.phpmailer.php');
 
$mail             = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host       = "domain.tld";          // SMTP server
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->SMTPSecure = "tls";                 // sets the prefix to the servier
$mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
$mail->Port       = 587;                   // set the SMTP port for the GMAIL server
$mail->Username   = "name@gmail.com";      // GMAIL username
$mail->Password   = "password";            // GMAIL password
$mail->Subject    = "Your Subject";
$mail->Body       = "Your message.";
 
// recipient      
$address          = "name@domain.tld";
$mail->AddAddress($address, "Your Friend");
 
// sender
$mail->SetFrom('name@gmail.com', 'Your Name');
$mail->AddReplyTo("name@gmail.com","Your Name");
 
// send out email
if(!$mail->Send()) {
  echo "Mailer Error: " . $mail->ErrorInfo;
} else {
  echo "Message sent!";
}

Include the code in your projects. You can also create a function and call the function each time you need to send out an email notification. Off course, you’ll need to pass variables such as recipients, body message, etc to complete your function.

Install Samba Shared Drive

What’s not to like with Samba. If you’re not familiar with Samba, it’s an open-source file and printer services which allows disparate clients to share files via SMB/CIFS standard, meaning there’s interoperability between Linux/Unix servers and Windows-based clients. This article will show you how to install a Samba shared drive on an Ubuntu Server.

Install Samba Server

sudo apt-get install samba

Configure Samba by editing /usr/samba/smb.conf. Uncomment and add the following.

security = user
 
[share]
comment = Ubuntu File Server Share
path = /home/ulysses/share
browsable = yes
guest ok = yes
read only = no
create mask = 0755

Create the shared drive.

sudo mkdir /home/ulysses/share
sudo chown nobody.nogroup /home/ulysses/share
sudo chmod -R 0777 /home/ulysses/share

Restart Samba Server

sudo restart smbd
sudo restart nmbd

Test the shared drive by accessing it from another computer or from another OS like a Mac or Windows.

530 Incorrect Login Error On Vsftpd

I installed a FTP server called vsftpd on my Ubuntu Server recently. After the install, I’ve been unable to login at all. It turned out to be a bug within the vsftpd program. I found a fix here. Essentially, the fix was removing the vsftpd program first, deleting the /etc/pam.d/vsftpd file and forcing the application to recreate the file. The third step is to reinstall the vstfpd once again.

From the Terminal, type the following commands.

sudo apt-get remove vsftpd
sudo rm /etc/pam.d/vsftpd
sudo apt-get install vsftpd

After making the changes, I was able to log in successfully using the Filezilla client. Success.

Linode Doubled Its Disk Storage

A week ago, Linode doubled the storage for all its VPS plans. It now boasts 48GB of disk storage. This came at the heels of a RAM upgrade back in May. A month before that, Linode doubled its CPU from 4 to 8 cores. All of these upgrade are for the same monthly price of just $20 per month. Not bad at all. So overall, here are the details.

Linode 1 GB

  • 8 cores
  • 1 GB RAM
  • 48 GB disk
  • 2 TB transfer
  • $20 per month

I’m loving all these upgrades. I’m glad I switched to Linode more than a year ago. It’s the best thing I ever did.

In addition, you also get full ssh and root access. That means you can install any software or application that you want on your Linode. You also get a dedicated IP address and a choice of where to host your server from any of the 6 data centers around the world. The only complaint I have is the backup. I wished it was included with the plan instead of the extra $5 per month. Otherwise, I’m one happy Linode customer.