Using Gmail for the Gnome Send To menu

Ever want to be able to right-click a file in Nautilus and send it to an email contact through Gmail? The “Send To” menu uses the system’s default email client to send files, and it’s kind of hard to set a web-based client as a system default. So how would you accomplish this?

By using the Gnome Gmail package.

Simply download the most recent package, and open it so your system’s package handler can install it.  Then, go to Applications -> Internet -> Gnome Gmail, and set it as your default application.

Now, when you right click an item and select Send To, you’ll fill out the recipient’s email address as normal.  Once you click next, the first run will ask you for your Gmail Credentials.  If you’re using Google Apps for your domain, be sure to click the “Configure” button and add your domain to the “Apps Domain” key.  The rest of the options available have a good, thorough explanation of what they do – I also opted to enable the “suppressnotification” option.

Once the configuration is complete, click the OK button, and a browser window will appear that takes you to your Gmail Drafts folder.  From there, select the the draft that was created by Gnome Gmail (the subject will be Sending {file}), modify whatever you would like in the message, and then send away!

WordPress custom 404 not found

In a previous post I outlined how to redirect all 404 errors to your WordPress home page.  However, this can confuse Search Engines as they would think content sits at the page that doesn’t actually exist any more.  How can you eliminate the confusion, while expediting the remove of theses pages from search engines AND keeping visitors on your site?

By using an http status code of 410 Gone and a custom page.

For WordPress blogs, you can simply edit your theme’s 404.php page (see my previous post to find or create this file) and add the following PHP function in front of any content:

<?php
header("HTTP/1.1 410 Gone");
?>

If you wanted to add content, just add the following after the above:

<?php get_header(); ?>
Add Content Here
<?php get_footer(); ?>

This will ensure your custom 404/410 page is consistent with your them.  You can list your most recent posts, place a search box, whatever your heart desires.

 

Redirect all HTTP error 404 to your main page in WordPress

What happens if a user accesses a page or a post on your WordPress site that no longer exists?  Do they simply get directed to an ugly page that says “Not found?”  This may deter users from remaining on your site, and can also work against you for your pagerank.  Wouldn’t it be better if the user saw your homepage instead, which would include a search bar (for most) and a nice, new list of posts?  How would you do that?

Most themes come with a 404.php file that WordPress calls in the event of a not found error.  This can be found in you WordPress installation directory, under wp-content/themes/{theme folder}/404.php.  If there is already a file there, you can over write it, and if not, create a new one and insert the following code:

<?php
header("HTTP/1.0 404 Not Found");
header("Location: ".get_bloginfo('url'));
exit();
?>

Ensure that this is the only code in the file.  This will redirect the user back to the url that is configured in Settings, and no more ugly 404 page.  It will also properly inform search engines that the specified URL does not exist. I would also recommend keeping a backup of this file, perhaps in the base themes folder, just in case you change or upgrade your them and the 404.php file gets overwritten.

Use WordPress functions in a static site

Sometimes, you may want a landing page that’s entirely different from your WordPress site, perhaps for a business. But, you want to advertise your blog as well on your site, with more engaging content than a link that points a user to your blog. Wouldn’t it be nice if you could list your most recent blog posts, or maybe even a snippet of your last post?

You can. And it’s really simple.

All you have to do is insert the following code above your <head> tag:

<?php
define('WP_USE_THEMES', false);
require('/path/to/wp-blog-header.php'); //ex: /var/www/wordpress/htdocs/wp-blog-header.php
?>

Once inserted, you can use any of the WordPress functions in your template that you want, wherever you want.

Wasn’t that easy?

 

Linux Chromium and personal identity certificates

I’ve recently switched to using Chromium as my default browser in Ubuntu.  I have a personal certificate provided by StartSSL that is actually required to log in to my StartSSL Control panel.  When I went to import my certificate to Chromium, I was redirected to this not so intuitive page:

http://code.google.com/p/chromium/wiki/LinuxCertManagement

Awesome! Another manual procedure for Linux – actually, I love it!

However, the instructions provided at the above link only detail how to add SSL Certficates, not personal (.p12) certificates.  So how do you add your personal certificates?

First, you need to add the NSS tools. Run the following from shell:

sudo apt-get install libnss3-tools

Then, we can import the certificate with the following command (again, from shell):

pk12util -d sql:$HOME/.pki/nssdb -i /location/to/certificate

Type in your password, hit enter, and your cert should now be imported. Access a site that asks for certificate authentication, and your personal certificate should now be in the list.