W3TC and .htaccess path manipulation

I had an issue recently with some shared hosting and W3 Total Cache; basically the root path wasn’t being declared correctly via the default configuration of the plugin. I came up with a slight modification to the /inc/define.php file (DISCLAIMER: this is a hack, if you use this your warranty is void / bad things may happen):

Original code:

function w3_get_home_root() {
if (w3_is_network()) {
$path = w3_get_base_path();
} else {
$path = w3_get_home_path();
}
$home_root = w3_get_document_root() . $path;
$home_root = realpath($home_root);
$home_root = w3_path($home_root);
return $home_root;
}
Code language: PHP (php)

 Modified code:

function w3_get_home_root() {
if (w3_is_network()) {
$path = w3_get_base_path();
} else {
$path = w3_get_home_path();
}
//$home_root = w3_get_document_root() . $path;
//$home_root = realpath($home_root);
//$home_root = w3_path($home_root);
<em>$home_root = '/var/sites/YOURSITE/public_html';
</em>return $home_root;
}Code language: PHP (php)

As you can see; it basically involves hard-coding the path to your root directory. 9/10 this won’t affect you but on some shared hosting this problem can occur (you’ll get errors in the W3TC control panel about root paths not being set).

Enabling read/write on external drive shared between OS X and Linux (Ubuntu)

Okay, so i’ve had a 1TB external USB for a while which has been formatted for OS X use (HFS+). I’ve been doing a lot of work on Linux (Ubunut 14.04) recently and wanted an easy, fast way to be able to read/write on both operating systems. I dabbled with this briefly a while back but was unsuccessful, but recently I found a little trick to enable read / write on both OS’s! This may seem like basic setup to some, but judging from the amount of forum posts i’ve read on this, it does seem to fox a lot of people…

NOTE: there is a caveat to this; I don’t share this drive with any other computers. If you move a drive between machines then this solution isn’t for you. Read on to find out how to enable this!

More

Adalight, Arduino, Boblight, Ubuntu and XBMC

After seeing my friend build his own Ambilight-esque LED backlight for his TV, and him kindly giving me a spare set of LEDs to construct my own (he bought too many sets); I’ve gotta say…

IT’S AWESOME:

If you’re looking to build your own; its not immensely straightforward but if you know your way around Arduino and the Ubuntu terminal, then this guide will help.

More