Agile Programming

Truquitos

Written on November 21st, 2010

Get back your disk space in a Debian-based Linux

4242576451 39b4be5d76 b 300x214 Get back your disk space in a Debian based LinuxThere are some actions you can perform to achieve if you can get back disk space in your Debian/Ubuntu based box. Most packages contain files that aren’t necessary. For example, UI and documentation translations in languages you don’t use. Wouldn’t it be nice if you could get rid of them and get back a few megabytes? Well, since dpkg 1.15.8 you can.

dpkg has two options --path-include=glob-pattern and --path-exclude=glob-pattern that filter what files are installed or not. You can get the format of the pattern from the glob man page: glob(7).

But this just works if you issue dpkg command from the shell but not if you are using apt or aptitude. So the best way to use them is to write them down in a file in /etc/dpkg/dpkg.cfg.d/.

A comon usage is: first exclude a directory and then re-include parts of that directory that you want to keep. For example if you want to delete gettext translations and translated manual pages except Galician, you could write down this in /etc/dpkg/dpkg.cfg.d/excludes:

# Delete locales except Galician
path-exclude=/usr/share/locale/*
path-include=/usr/share/locale/gl/*
path-include=/usr/share/locale/locale.alias

# Delete translated man pages except Galician
path-exclude=/usr/share/man/*
path-include=/usr/share/man/man[1-9]/*
path-include=/usr/share/man/gl*/*

This rules will apply to packages you will install/upgrade from now, but if you want to save space immediately, you have to reinstall all the packages in your system.

aptitude reinstall

or

apt-get --reinstall install

NOTE:
Concerning locale deleting you can get the same results by using localepurge. But this tool is strongly discouraged because this tool is a hack which is *not* integrated with Debian’s package management system and therefore is not for the faint of heart (other examples of tools that is strongly disacouraged are: dpkg-repack, reportbug, etc). Responsibility for its usage and possible breakage of your system therefore lies in the sysadmin’s hands.

NOTE 2:
The package management system on Linux makes installing and upgrading software a snap, but it also caches every package in a local folder in case it’s needed again. Here’s how to clear that cache and save loads of drive space.

sudo apt-get clean

Written on October 6th, 2010

Debugging PHP with XDebug and Komodo IDE

Captura de pantalla 1 Debugging PHP with XDebug and Komodo IDEWhen you develop a very important web app it is pretty sure you will need debugging it. The best way to do this is using XDebug so in this article I am going to explain how to setup and use XDebug with Komodo IDE or Edit, but you can use it for Netbeans or Eclipse as well.

The first step is install XDebug in your system (I assume that you have already installed a LAMP server in your system). Read the rest of this entry »

Written on June 24th, 2010

MacBook Pro keyboard backlight keys on Ubuntu GNU/Linux

macbook keyboard1 MacBook Pro keyboard backlight keys on Ubuntu GNU/Linux

Recently I have purchased a new MacBook Pro 15″ and the first thing I do was install Ubuntu Lucid Lynx on it. After some readying I have all the hardware working properly but the keyboard backlight wasn’t integrated into system and unfortunately after searching on the web for something that could do this, I decide to write a simple script with Bash and use Ubuntu-tweak to bind the keyboard keys to invoke the script. So let’s go…

Read the rest of this entry »

Written on June 3rd, 2010

Speed up Google Analytics js by caching it locally

rect2818 Speed up Google Analytics js by caching it locally

The big problem of use Google Analytics is that you have to get its javascript to get to work statistics. For me this causes that my sites takes a lot of time to end the load. For this reason I always recommend put the GAnalytics code at the bottom of the page, but for me this is not enought.

One solution to this is to cache the external javascript locally but what if the external javascript changes? Here I go to explain how to store GAnalytics javascript locally and peridiocally check that is the lastest version.
Read the rest of this entry »