Android DHCP IP Release

Written by

Just because I spent about 2 hours looking for this info…

A rooted android device with busybox can easily release the DHCP allocated IP with the following commands

dhcpcd -k wlan0
dhcpcd -n wlan0

turn wifi on and off and now you should have a new DHCP IP rather than a renewed IP.

Sublime 2 GPLv3 Snippet and SMARTY

Written by

I’ve stared using the very powerful yet minimalistic text editor Sublime Text 2, one of the great features is the ability to customise it to your personal needs.

GPL v3

Some of the code I write I license under the GPL v3 but because the code is only a small function, I don’t want to include the full GPL in the source so I use the minimal header. To ease my life and make it quicker to include this minimal header in my code I have written a small snippet for Sublime to insert the minimal GPL.

Just type


and press tab to comete the code. This will then move the cursor to the program and description part where you pop the name and a brief description. You’ll probably want to change the copyright name to your own in the snippet.

To install the snippet just download it, open Sublime click Preferences > Browse Packages and put it in the user folder in there, then restart Sublime.


Sublime SMARTY Support

It took me a while to find the forum post so I’m reposting the info here, sublime actually supports smarty semi-natively but its not turned on, so here’s how to turn it back on…

  1. Open file “Packages\HTML\HTML.tmLanguage”, if you search for string “<!–” you will notice that (currently) there is two references to “Smarty language” commented. Un-comment these.
  2. Download the SMARTY.PLIST and rename it “Smarty.tmLanguage” and place in the user folder (Packages\User\).
  3. Some colour schemes may not support it properly but idlefingers does so very well too.

Update to GimpFM

Written by

I have just updated one of the many sites I help maintain, GimpFM, to bring it into a more modern web standard.

For those interested, I have used bootstrap as the base framework. I typically use Zurb’s Foundation but after a bit of hype I thought I’d give bootstrap a go.

Overall I’m pleased with the outcome of the site and bootstrap has potential and is very well featured but foundation seems faster and easier to make the site responsive during development.

Anyway, that’s all for now.

X-Cart Cleanup and XCache

Written by

So my work’s site has X-Cache setup and so any changes made to the site is usually cached in two places, X-Cache and with X-Carts Smarty.

So to make things simple, I’ve integrated the cleanup of the cache’s into the default x-cart cleanup page.

So just edit cleanup.php to include these lines:


// Remove XCache cache if it's installed.
if (function_exists("xcache_clear_cache")) {
	echo "XCache ";
	while ( $i < xcache_count(0)) {
		@xcache_clear_cache(0, $i);
		echo "php#".$i.", ";
	while ( $i < xcache_count(1)) {
		@xcache_clear_cache(1, $i);#
		echo "var#".$i.", ";
	echo " Removed.";

X-Cart Product Images with a Static Cookieless Domain

Written by

So today, I was working on an older x-cart site after implementing some of the previous CDN / static domain hacks, I looked at the product images which were being displayed via the main domain. Because CleanURLs were enabled, I couldn’t just edit the thumbnail template file but rather edit the CleanURL creator function. So here’s my edits for X-Cart 4.3 and xcart 4.5.

Edit /func/func.files.php

approx. line 254 (xcart 4.3) or line 374 (xcart 4.5)

return $current_location.str_replace(DIRECTORY_SEPARATOR, "/", substr($image_path, strlen(preg_replace("/".preg_quote(DIRECTORY_SEPARATOR, "/")."$/S", "", $xcart_dir))));


if ($_SERVER['HTTPS'] != 'on') {
    return "http://cdn.domain.tld".str_replace(DIRECTORY_SEPARATOR, "/", substr($image_path, strlen(preg_replace("/".preg_quote(DIRECTORY_SEPARATOR, "/")."$/S", "", $xcart_dir))));
} else {
    return $current_location.str_replace(DIRECTORY_SEPARATOR, "/", substr($image_path, strlen(preg_replace("/".preg_quote(DIRECTORY_SEPARATOR, "/")."$/S", "", $xcart_dir))));

The issue that needs to be then addressed is how to balance the previous edits with this one over x number of domains so the file requests can be parallel and not blocking, after looking, putting javascripts and css files on one domain, catalogue images on anotherand possibly any remaining requests manually written in via a third? in this scenario, {$skin}/{$alt_skinDir} and {$images}/{$alt_imagesDir} (being remembered from memory) could be over two domains and then the catalogue images on the third.

Ideally you want to even out the requests (no less than 5 to 10 requests) over the domains with upto 3 sub-domains maximum to reduce the number of DNS lookups but depending on what’s being serviced and checkign with online tools will help test which is the best layout.