Christian Biggins Design, Technology, SEO, General Ramblings. Something for everybody.

22Dec/086

What happened to all my hard drive space?

Recently I was trying to upgrade using Yum on my Fedora 9 machine and I got an awful message that I did not have enough space to complete the upgrade. What the hell? My / partition has a huge 10GB, how can this be so?

[root@Garth Download]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2             9.5G  8.7G  312M  97% /
tmpfs                 722M   80K  722M   1% /dev/shm
/dev/sda4              17G   12G  4.2G  75% /home
/dev/sda1              28G   25G  3.1G  90% /mnt/Winxp

As you can see, my laptop has a 60GB hdd, so I am consistently having this argument with it.

The problem with most command line utilities is that it is difficult to see what you have installed and how much space each has. Then I remembered a little script that I used a few years back that told me what RPM's I had installed and how big each was. Eureka! Just what I need.

So, I had a little fun, did a little search and found the beloved rpmhogs script.

Check this out;

[root@Garth Download]# perl rpmhogs.pl
  246,007,784  java-1.5.0-gcj-javadoc-1.5.0.0-21.fc9.x86_64
  246,902,300  java-1.6.0-openjdk-javadoc-1.6.0.0-0.13.b09.fc9.x86_64
  231,068,455  openoffice.org-core-2.4.1-17.4.fc9.x86_64
  114,684,216  texlive-texmf-fonts-2007-22.fc9.noarch
   91,189,935  glibc-common-2.8-3.x86_64
   87,927,623  compat-gcc-34-c++-3.4.6-9.x86_64
   84,367,402  git-1.5.5.1-1.fc9.x86_64
<snip>

How good is that? I love it. Now I need to uninstall a crap load of stuff I dont use.

And, yes, my Laptop's name is Garth. My media PC is named Cassandra and my wifes laptop is named Wayne. Who can guess my theme?

24Nov/083

The common grep –exclude problem

grep is a file content searching tool for Linux. It is loved by programmers for its ease of use and swift search results (with customisable output). For example, if you forgot where you left your debug code, you can quickly display a list of the files that contain the code like so;

grep -ril 'var_dump' *

But, the problem with grep is that it is not possible to limit the subdirectories it searches within based on a pattern. A lot of people misunderstand the "-exclude" option, thinking that they can stop grep from returning results from SVN directories using it like so;

grep -ril --exclude=".svn/*" 'var_dump' *

Little do they realise that exclude is for file names only and grep has no functionality for restricting search based on directory names. grep can invert the found rows and only show the non-matching lines using the '-v' parameter and can remove the .svn directories but it is very slow;

grep -ril "'var_dump' * | grep -v svn

So, in comes ack. ack is much faster than grep (it uses perl regular expressions) and searches recursively and ignores revision control subdirectories (.svn) by default. Also, it displays the found code in a much easier to read format (if you opt to display the lines as opposed to just the file names);

ack To make things easier, ack is available in a lot of repo's for different Linux distributions.  I was able to get ack this easily;

sudo apt-get install ack

Done. Its also available as a perl script incase you cannot install it due to dictator sys admins (you know the type.).

If you code and use grep for your line-level searching, do yourself a favour and get ack.

21Nov/080

ER Diagrams from SQL files

A lot of people these days use graphical clients for creating their database schema's and therefor start with the Entity Relationship diagram and then have it generate the SQL for them. I prefer to write SQL directly as I seem to have an ongoing misunderstanding with most graphical clients but then I would need to somehow create an ER diagram for the SQL I wrote and this meant I'd double up on work a little bit. Today while searching for another application to do just what I want (and not cost me a cent) I found a post about something that will be extremely handy.

SQL Fairy SQL Fairy is an ER Diagram creator for Mysql and other databases but uses the raw SQL files and includes relationships (like foreign keys etc).

Sample Schema Its not perfect by any means, but its easy and gives a great representation of the database relationships. The lines representing relationships actually go over the tables which is a bugger and as it outputs directly to an image, you cant edit it. But, for a quick and easy ER, its bloody good.

As noted in the post I found this little gem at, its super simple to install and use, particularly if you are using Linux. I am on Kubuntu (for the record, my distro of choice is Fedora) and installed it as easy as this;

sudo apt-get install sqlfairy

Then, to generate the diagram was as easy as this;

sqlt-diagram -d=MySQL -o=sample_schema.png schema.sql --color

Unfortunately, it did fall over when my schema contained a SOURCE within the SQL, but apart from that it was quick and simple enough for me.

Now, if I can find an app that does the same thing but allows me to edit my ER first and give me multiple saving options (XML, SQL, etc) then I'd be extremely happy.

sqlt Man page
sqlt-diagram Man page

EDIT: About a year ago, MySQL released an application named 'Workbench' for this very purpose. An ER diagram program with reverse engineering capabilities from .sql files. The application was used by me on Windows for a while before a Linux friendly version was released. But, when Sun bought MySQL earlier this year, they made most of the MySQL applications commercial and were charging for licenses. Thats why Workbench was not mentioned above.

I am pleased to announce that it appears Workbench is free for download again. More information on Workbench can be obtained at its website.

This is the same schema as the above diagram done in Workbench using reverse engineering from an SQL file.

workbench MySQL Workbench

12Jun/080

Firefox 3 gets a release date.

That's right and we don't have long to wait either. 17th of June. 5 Days away.

Read the release statement.

8May/080

Are Microsoft catching up?

For years and years I was an avid Windows user. I loved everything about Windows and Microsoft in general. I did use Linux in some environments, for eg, I used ssh to log into the server that hosts my site (www.skylinesaustralia.com) and I had dabbled with Linux distro's on old machines around my house, but never really got into it.

Then, about 18 months ago I got a job in a Linux-only environment. The only Windows machine was used by the receptionist. It was my first taste at Linux from a no-alternatives approach. It didn't take me long to really appreciate it and what it could do. In my opinion, well managed, properly funded Linux desktop distributions (Fedora, Ubuntu, Debian, etc) are far superior to Windows and I feel they have been that way for quite some time. The great thing is that they are now receiving more exposure than ever before for whatever reason. People are trying and experimenting with Linux. Linux doesn't seem to be viewed as a 'server only' OS, but as a full fledged Windows and MacOS alternative.

While I feel that Linux is still far from being an option for non technically minded individuals (such as my Mother in law) it is getting much better. With distributions like Ubuntu which has been known as the first distro a Windows user should try due to its ease of install and use. I must say that my experiences with Ubuntu have always been good, but Fedora remains my distro of choice.

I fear I have started rambling as I tend to do when I try to write anything that covers more than a paragraph or two. So, lets get back to what I started writing this about...

I loved using Fedora. I still do. Its on my laptop that goes everywhere with me, its on my media PC and if it wasn't a bit touchy as a Guest OS under VirtualBox, it would be a VM on my windows machine (Ubuntu replaced it). But, after a good, solid, 18 months of not using Windows and being in a strong Linux-oriented environment, I moved into a new job where the only OS is Windows (talk about turning on your heels). I was devastated and wished I had asked what OS was used in my interview. But, after a few weeks (and installing Ubuntu on a virtual machine) I am coming around a bit. I am not going to say that I enjoy using Windows as much as Linux, I dont think that will ever happen, what I am saying is that I dont hate it as much as I used to.

I think what has helped me, is that there are so many things out there that you can apply to your Windows installation to assist you in making it feel more like Linux. Alas, Windows command prompt will never be as good as shell but from a GUI / usability approach, its not too bad.

I think that it is this recent growth in Linux users along with the fantastic work of my favourite company in the world, google, that has forced Microsoft to rethink its approach. While it is still a software giant, it is not the software giant. Google has taken the world by storm and it has done it by offering its services, products and anything else, for free. Using simple UI's and no-frills approaches, it has grown by leaps and bounds. It has taken the free email market from Microsoft, it has taken the search engine market from Yahoo and it has taken many other markets from other's too (Open Source project hosting from sourceforge, etc).

This revolution in free computer services from Linux Distributions to online applications (and offline applications, see Googles sketchup, earth, desktop, picasa, etc) has opened a lot of people up to the world of alternatives and it is forcing Microsoft to rethink its approach to the software user market. I am writing this post as a test on Microsoft's free 'Live Writer' (that integrates with Googles 'blogger' service). I have, for the first time, a windows 'Live' account. I browse Microsoft's Open Source site. Never before has such a revolution occurred in computers. Nothing has been 'taken by storm'. At least not for a long time. And this new freedom to choose a commercial product or an open-source, free-to-use alternative is fantastic. Finally users have a choice and the free-alternative is equally as good as the commercial option, if not better.

As the late Big Kev would say, "I'm Excited".

EDIT: I thought I would also mention that both Microsoft and Google have contributed to the Zend Framework (Open source PHP Framework).