Ben's Pro Tips

Tech Tips Made Easy

Adding a RAID1 array to an existing Ubuntu 13.10 installation

I recently had the joy of adding a RAID1 array to my Ubuntu 13.10 server. I came across a number of problems setting it up, the foremost being the lack of an up-to-date guide for Ubuntu. Most of them, including Ubuntu’s own documentation were woefully out of date.

After several failed attempts, I was able to successfully install a two-drive redundant RAID1 array. Here are the steps I used.

1) Make sure both drives are roughly the same size and installed on the system, your live drive will be /dev/sda for this example and your new drive /dev/sdb. I’d highly recommend backing up /dev/sda before you start.

Continue reading “Adding a RAID1 array to an existing Ubuntu 13.10 installation” »

February 7, 2014 Linux Server Tips hard disks, linux mint, raid, storage, ubuntu

Online Cloud backup reviews: JungleDisk, SpiderOak, Wuala, and Crashplan

Cloud Backup Review Face Off

SpiderOak: Horrible

I’ve used SpiderOak for all my remote backups for years. I’ve tolerated it despite its awful client software. The client software is SLOW and laggy even on a fast machine. The OS X version is odd in that you can’t alt-tab to it, if you lose the window behind another window you have to open it up again. If you add a new machine, it takes DAYS to even install the software as it demands to load every block you have saved on their network during installation. Each time you reboot or restart the program, it ignores your schedule and runs a whole new backup, maxing out your bandwidth.

Despite those and many other issues, I’ve continued to use it for backups. A couple weeks ago, I had a hard drive crash on a local development machine. No problem, I have them all backed up on SpiderOak. For the first time the hundreds of dollars I’ve invested in backing up is going to pay off.

So I found the files in the client, clicked Restore, and nothing. It’d download a few files, then flatline refusing to finish. Even trying to get just 20MB of files was rendered impossible. I let it run overnight, I restarted it, I tried everything.

Continue reading “Online Cloud backup reviews: JungleDisk, SpiderOak, Wuala, and Crashplan” »

February 6, 2014 Everything Else, Linux Server Tips

Adding canonical URLs to your OpenCart pages (for free)

OpenCart is a pretty good free PHP shopping cart system. Despite its popularity, some of its missing features are glaring, especially when it comes to SEO. OpenCart does implement the rel=”canonical” tag on its product pages. However, there’s no canonical tag on any of the category pages or the all important homepage. If you install OpenCart without fixing this problem, a Google site:yourdomain.com search will show a million variations of each category diluting the results, “link juice”, and earning relegation to the “See this search with duplicate pages”.

A quick search online found a number of SEO plugins that fix this, however most of them are in the $15 – $75 range. Not one to drop $75 on a single meta tag, I dug into the source looking for a solution. Fortunately, I found a relatively easy one.

1) Edit your catalog/controller/product/category.php file
2) Find this line:

if ($category_info) {

3) Immediately after it, add the following lines:

$can_url=$this->url->link("product/category","path=".$this->request->get['path']);
$this->document->addLink($can_url,"canonical");

4) Now edit catalog/controllers/common/home.php
5) Find this line:

$this->document->setDescription($this->config->get('config_meta_description'));

6) Immediately after it add:

$can_url=$this->url->link('common/home');
$can_url=str_replace('index.php?route=common/home', '', $can_url); 
$this->document->addLink($can_url,'canonical');

7) Presto! You have canonical urls!

If you don’t want to edit any source files and would rather have a convenient vqmod plugin version of this update, you can buy it on CodeCanyon by clicking here. It’s just $5 and also includes canonical URLs on your info pages and a fix for the strange default behavior of OpenCart product canonical urls. Update: buildmyecommerce.com put together a demo video, you can see it here.

eCommerce, PHP Tips canonical, opencart

Looking for a Regent or Halex Electronic Dartboard Manual?

halexdartboard

I recently lost the manual for my electronic dartboard. You say, big deal. Well it just so happens that the ten billion built in darts games become positively useless unless you can match up a cryptic numeric code with a set of rules. And what does “Cybermatch” mean anyway?

No problem, I say, I’ll just hop online and download it from the manufacturer. Well, apparently that is a problem, as Halex’s parent company was recently bought out and they took down the old support site with PDF instruction manual downloads. Continue reading “Looking for a Regent or Halex Electronic Dartboard Manual?” »

January 9, 2014 Everything Else

Memcache sessions keep resetting themselves with CakePHP

Quick tip here for CakePHP users using memcache finding their sessions are randomly resetting at annoying intervals.

1) Check your config.php and make sure you security.level setting is low or medium, a high setting causes session ids to regenerate with every page load, leading to conflicts if you have more than one page open in the browser.

2) Check your memcache server to make sure you’re not running out of space (causing older values to get purged) or having connection resets.

3) Make sure nothing on your page is coming up as a 404 not found error. Use Firebug or Chrome’s developer console to double check each page load. A 404 on an image or CSS file can reset the session causing sporadic session losses. In my case a javascript library was attempting to load a non-existant image file, leading the session to drop out randomly.

If this still doesn’t solve the problem, post in the comments, maybe somebody else will have an answer.

November 24, 2012 Uncategorized

Facebook Graph PHP API: Post to page call returns false or null

What a frustrating problem. A call to $facebook->api() to post to your fan page is failing silent, just returning false. Fortunately it could be a simple fix. Check the following two items:

1) Make sure there are no age/country restrictions on your fan page. If any exist, remove them and try it again.

2) Make sure you’re POSTing to the right Graph URL. For example don’t:

$result = $facebook->api(‘/00000000′,’POST’,$parameters);

Instead call with the /feed switch:

$result = $facebook->api(‘/00000000/feed’,’POST’,$parameters);

December 20, 2011 Uncategorized facebook api, open graph, php

Running Compiz with Xubuntu (XFCE) on Natty 11.04

In Ubuntu 11.04, Compiz isn’t enabled by default with XFCE. Fortunately, it’s reasonably easy to enable it, it just takes some command line trickery.

To enable it, open a Terminal window and type:

sudo apt-get install compiz-core compiz-plugins compiz-fusion-plugins-main compiz-fusion-plugins-extra compizconfig-settings-manager

Now open CCSM by right clicking the Desktop / Applications / Settings / CompizConfig Settings Manager, and make sure Window Decorator is checked. Next click the Window Decorator button and make sure the Command field is set to “/usr/bin/compiz-decorator”.

Next run:

compiz --replace

You should now see Compiz working. If there are any issues, you can log out and back in to restore the XFCE window manager as before.

If that test worked OK, run:

sudo sed -i “s/xfwm4/compiz/” /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-session.xml

Once this is done, log out and log back in to your Xubuntu session and you should have a working Compiz installation!

You can customize your Compiz installation to enable Desktop Zoom, Wobbly Windows, etc, by using the CompizConfig settings manager as above.

As far as I know these same settings will work with 11.10 as well. Post in the comments if you find otherwise.

September 28, 2011 Uncategorized compiz, desktop zoom, ubuntu, xubuntu

Show full hostnames with Netstat

Sometimes netstat’s automated hostname truncating can be annoying. If you ever need the complete hostname of machines your computer is connected to from netstat, simply supply the WIDE parameter:

netstat -W

March 6, 2011 Uncategorized

Setting up SSL and installing a Certificate with Apache 2 on Ubuntu

Fear not, it’s pretty easy to enable HTTPS on your Apache 2 server running under Ubuntu. I’ll walk you through it step by step.

  1. Configure Apache and install the SSL module: Type: a2enmod ssl
  2. Create a Certificate Signing Request (CSR): Change to the /etc/apache2/ssl directory (create it if it doesn’t exist) and type:
    openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr

    It will prompt you for information about your site. If your site is www.example.com, make sure the CN (Common name) includes the www.

  3. Get your certificate: Go to the website of your favorite certificate issuer, submit the contents of your newly-created  server.csr file, pay the fee, and download your CRT certificate file which you’ll need to upload to your /etc/apache2/ssl directory as well.
  4. Edit your site’s config file: It’s probably named something /etc/apache2/sites-available/yourdomain.com. Copy the entire <VirtualHost *> section and duplicate it within the file, changing <VirtualHost *> to <VirtualHost *:443>. You’ll need to add a few lines within the new VirtualHost section to enable SSL:
    SSLEngine on
    SSLCertificateFile /etc/apache2/ssl/example.com.crt
    SSLCertificateKeyFile /etc/apache2/ssl/server.key
    SSLCertificateChainFile /etc/apache2/ssl/intermediate.crt
    

    Make sure you adjust the paths and filenames to point to your certificate and key files. The SSLCertificateChainFile is only necessary if your certificate issuer supplies an intermediate cert (which you’ll need to obtain from them and upload to your server). If not, you should omit it from your configuration.

  5. Restart Apache: type: service apache2 restart
    If Apache fails to restart, check the error log (probably in /var/log/apache2/error.log) for messages to help you debug the problem.
  6. Test the configuration: You should now be able to connect to your server over https://

March 4, 2011 Uncategorized