Friday, August 29, 2008

Hex Editor for GNome

Lately, I have been working on a project to parse a binary log file into text format. The requirements are that logs with 30 000 + records must parse quickly with low overhead on the production server.

In order to achieve this, I needed to know how the binary log was formatted. This was the most difficult part and I quickly realised I needed a descent Hex Editor. I settled on GHex ( Hex Editor for Gnome. ) Fedora 9 ships GHex in the Yum repositories.

# yum install ghex
HEX data can be viewed as bytes, words or long words. The data can be selected and there is a search tool.

Find the project's home page here:

Sunday, August 24, 2008

Google Gadgets on Fedora 9 x86_64

If you have Fedora 9 64 bit and want to check out the google gadgets then read on.

Google Gadgets is very much like the Windows Vista sidebar. You can add all sorts of little toys to the side bar. I have a resource meter, news feed and pictures gadget.

Installing the gadgets application was relatively simple.

Here are some links to get you started:
  1. - The homepage
  2. - Official Build instructions
  3. - Build instructions for different distros.
So here is a little command line script to make the instructions work.

( I executed this a root - and I run gnome so didn't worry about the QT stuff. )
# yum install dbus-devel js-devel libxml2-devel gstreamer-plugins-base-devel gstreamer-devel libtool-ltdl  xulrunner-devel xulrunner-devel-unstable gtk2-devel librsvg2-devel curl-devel
I decided to ignore the comments on the addendum about requiring a patched version of js-devel and I am glad I did. It worked fine without it.

The next step is to get the latest version from the subversion repository. I followed the second half of the instructions from

# cd /usr/local/src
# svn checkout google-gadgets-for-linux-read-only
# cd google-gadgets-for-linux-read-only/
# sh autotools/
# cp /usr/share/automake-1.10/mkinstalldirs ./libltdl/

# ./configure
# make
# make install
If you ever want to uninstall it again, then leave the source directory in place and remove it with the following:
# cd /usr/local/src/google-gadgets-for-linux-read-only/
# make uninstall
Once it is all installed, you will find launcher in the Applications -> Accessories menu.

Have fun.

Sunday, August 17, 2008

Allow httpd ( apache ) to write to files and folders with SELINUX

You may have read my previous post about configuring apache for public_html with selinux. Now today we look at extending this a little with enabling write permissions on special folders with SELinux enabled. There is sweet little help on this available on google so I thought I would throw in my two cents.

In summary the file context needs to be changed for folders where the httpd daemon needs write access. These would folders that contain cache, images, logs and other things...

To recap:
Step 2 - Ensure that selinux is enabled for user_dir
#> setsebool httpd_enable_homedirs true

Step 3 - Ensure the correct access permissions are set on the home directory
As normal user in home directory
~> chmod a+x ~
Step 5 - Create the public_html directory
~> mkdir public_html
Step 6 - Set the selinux type label for public_html
~> chcon -t httpd_sys_content_t public_html

Now your installer script for modx ( say for example ) tells you that it can not install because the cache folder is not writeable. You scratch your head and wonder why... You need to make a change to the file context for the cache folder ( and any folders you wish httpd to be able to write to ).

Setp 7 - Turn on the boolean switch for allowing httpd access to files.
#> setsebool allow_httpd_anon_write true

Step 8 - Set the selinux type lable for public_html/assets/cache
~> chcon -t chcon -t public_content_rw_t ~/public_html/assets/cache
Step 9 - Set file permissions to everyone ( I have yet to work this out properly. ) It may be better to provide ownership to the apache user and group to the home directory... I just do a chmod 777 to give all permissions to all users on the public files.
~> chmod 777 -R ~/public_html_assets/cache

So that should about cover it then. Apply to all folders or specific files if you want httpd to have write access.

Wednesday, August 6, 2008

VMWare Server on Fedora 9 x86_64

A little while ago ( like when I first installed my 4Gb of RAM ) I thought I might give VMWARE server a try. VMWARE server is available for free from

Needless to say it didn't work. There was an issue with compiling the 64bit modules for networking with the kernel and kernel-devel packages at the time.

Happily, Fedora has updated the kernel and kernel-devel packages and the issue is gone! Last week I gave it another go and now have VMWare Server running smoothly on my Fedora PC. I use it for a range of different things and prefer it to Qemu for a range of different reasons.

My list of VMWare pros over Qemu:
  1. VMWare is very good at sharing host resources amongst the guests. One can assign more virtual memory to each guest and have them run concurrently without incurring exorbitant overhead costs.
  2. VMWare deals with bridged networking without much input from the person behind the keyboard. All I had to do was tell VMWare server that my guest should use bridged networking and the software simply made it so.
  3. VMWare can be run as a regular user because its services are started up as part of xinetd during boot time. Guests are executed as the user that started them or made available to all users.
  4. VMWare provides greate commandline access to both the host and the guests allowing for all kinds of nifty scripting. The guests can be pinged to check if they are alive. This is handy in a high availablity environment where one might have a cron that checks for a live ping and notifies to an email address if a guest is found to be down.

The install process was relatively smooth. The required dependancies were the kernel-devel package matching kernel version: There was one dependancy that I had to install manually.

# yum install libXtst-1.0.3-3.fc9.i386

ASIDE -> if you are using Fedora and need to remember what was installed a week ago when you were filling in missing dependancies, you should have a look at /var/log/yum.log
Usually when I receive an rpm package I install it like this:

# cd /path/to/downloaded/rpm/file.rpm
# yum localinstall --nogpgcheck file.rpm

Sometimes yum will also let you know that it needs to fill some dependancies in order to install the package correctly. It makes sense to allow yum to manage all installs of rpms for you. You can then use yum to remove stuff and find a history of installed applications in /var/log/yum.log

So why should you try VMWare Server?
  1. Its free now and it might not be forever.
  2. You will have the ability to try out other linux distro's or if you have a licensed copy of one of the Microsoft Operating Systems you might wish to have it run inside your Linux. There seems always to be one or two MS apps that one can't do without. For me it's Cashbook Complete!
  3. You may wish to try your hand at setting up a domain, a network, a dns server, or simply a 3 tiered web/app/data suite which you wish to set up with PHP or Python...
  4. The list goes on. Why do you use VMWare? Comments welcome.

So all in all, I am happy with my VMWare Server experience on Fedora Linux. The 4 gb RAM definately helps. I would not recommend it for anyone with less than 2gb ram.