Sunday, 28 December 2008

Using LaTeX for your dissertation - part 1 (On my soapbox)

Why use LaTeX?

I don't know whether I'll ever be able to finish my dissertation for my MSc, but even if I don't, I thought I'd document the LaTeX environment I set up for myself. It might just be of use to someone else and save them all the time I wasted to discover things.

I could thank the Open University (in England) for wasting all of this time since they have never heard of anything other than Microsoft Word. They do say that you can use Open Office, but off course tutors HAVE to mark assignments using Word and if you've seen what Word can do to a Word document formatted by itself you'll know it is a somewhat futile gesture trying to get it to sensibly display a Word doc created with Open Office.

The OU will let you know with great enthusiasm that you can buy Microsoft Office for about £35. But if I'm going to spend £35 it will be on shoes for my daughter and not to enrich Bill Gates any further, even if he is going to give the money away to some unfortunate soul somewhere else. The reality is that my daughter still needs school shoes. The OU folks, as sincere as they might be, seem to be as out of touch with reality as the judges in this country.

Since I discovered many years ago that many academics (not those from the OU though) use LaTeX, I thought it would be great if I could use it for my dissertation. I'm always game for learning something new and if there ever is an opportunity to rebel against the blind, numbskull use of Microsoft applications, I'll go for it!!

I have two main reasons for using LaTeX. Firstly, it can be used cross-platform. I like being able to freely switch between Windows and Linux. It allows me to work anywhere and at any time. Secondly I like not to be forced to work in a GUI environment. It is faster and it is much more stable and again it allows me to work anywhere and at any time. Even if I don’t have any LaTeX stuff installed where I happen to find myself, my work doesn’t have to stop because I can use a plain editor to carry on writing. I can generate a pdf or RTF document whenever I get to a computer with my LaTeX apps installed.

Forums for getting help

Firstly I have to mention the forums I only discovered a week ago. I can’t believe that I didn’t come across them at the beginning of the year. I have done searches on Google for LaTeX related information for hours and hours but I never came across these forums. If I did, it would have save me a tremendous amount of time. So the first thing to do is to bookmark this site:

Choosing the right applications

I did try MikTex, but in the end decided to use a Linux environment for assembling my documents. I just open a terminal onto one of my Linux servers and run my scripts to create my document. The drive is Samba shared so I can edit my tex files with my GUI applications too.

Vi is my favourite text editor. I chose to use Texmaker as my editor when I do work in a GUI environment for the same reasons as previously stated. Texmaker is available for both Windows and Linux.

For my bibliography I decided to use JabRef. JabRef is written in Java and thus offers the same portability. JabRef creates a BibTex file and thus, when not in a GUI I can use vi to carry on working.

To give an example how these choices served me right I can relate to you my holiday story of August 2008. It was probably not the best time to go in terms of finances and considering the fact that I desperately needed to work on my dissertation. But, I haven’t seen my family for 5 years and I was desperate to see them and for them to meet my children. It was the best holiday that my daughter, my son and I have ever had, so it was the right choice.

However, three days before we were due to leave I switched my laptop on and for no apparent reason, all Windows could give me was a blue screen of death. I honestly did not have the time, energy or inclination to figure out why. I was just not interested.

Fortunately I had a choice of three operating systems on my laptop. With Windows failing, I was left with Ubuntu and Puppy Linux. Ubuntu off course would work, but so would Puppy. My preference was Puppy, just because it is so much smaller and quicker to do things. The only thing I haven’t bothered to get working on Puppy is JabRef because I haven’t bothered trying to get Java installed. I’ll get around to that sometime.

While on holiday I thought I’d ask friends and family who have more interest in Windows than me whether they have any ideas how I could restore the broken system. A friend suggested a Linux based utility for recovering Windows systems. It didn’t work because apparently there was no space in the registry to set an administrators password and one needed to log in as administrator to do the recovery. Then three weeks later I was going to show my cousin what the installation was doing. At this point it decided to start working again - for no apparent reason. Just in case you think I was mistaken, I did boot into Windows a few times over the three weeks to try things people suggested and every time I got the blue screen of death.

In the next few posts, I’ll discuss the scripts I wrote, software applications and LaTeX packages I use in more detail.

Friday, 1 August 2008

Getting Zoneminder to work as quick as possible

About a week ago I decided to see if there was any Linux software available for setting up a security system in one's house. It didn't take much searching to find Zoneminder. My time is quite restricted and thus I was looking for the quickest way to get something working.

I have a server available consisting of:
  • a 1400 MHz Intel Celeron,
  • 640 MB of RAM
  • 120 GB hard drive
  • a USB Aiptek Pencam
  • a USB Logitech QuickCam Express

That by my standards is a lot for a server :-)

Firstly I donwloaded the ZoneMinder liveCD. That was quite painless. I burnt the downloaded image to a CD and did a reboot. The server started and both my USB webcams were working. The only thing I did have to do was to increase the minimum and maximum amounts for shared memory. I then had the liveCD install to my hard drive. Even this went smoothly but it does take at least a couple of hours to install. After the installation I changed the shmall and shmmax values in /etc/sysctl.conf. I just squared the number a couple of times. The proper way of calculating the amount of shared memory you should allocate is available on the Zoneminder website (see the FAQs), but I was lazy.

I'm quite religious about a server not having a GUI and being headless. So when I was sure everything worked well I set my default runlevel to 3 in the inittab.

I guess this was way too painless for my liking. They always say be careful what you wish for and I guess things couldn't be easier than that.

So, I started wondering whether I could add to my cameras by using my Hauppauge card. However, Zoneminder didn't pick this up too well. It did recognised the card but obviously lacked some drivers because the video devices were never required.

I thought I'd give Ubuntu a go. I'm not going to get into the Ubuntu effort too much because although Ubuntu picked the Hauppauge card up really well I then discovered there were some issues using the card with Zoneminder. There are workarounds that you can find more information on in the forums, but I didn't have time for that. My main problem was that Ubuntu didn't want to work well with my Logitech Quickcam. Ubuntu also managed to break my liveCD installation so I couldn't boot into that anymore.

I even tried re-installing the liveCD, but I still couldn't get the liveCD installation to boot - it just resulted in a kernel panic. Playing around with GRUB didn't help.

I thought I'd try one more alternative and if this didn't work I'd just delete all partitions and do a liveCD installation from scratch. This time I was going to try Fedora Core 8. Of the Linux distros, I'm the most familar with Fedora, hence my choice.

Once again everything went so smoothly I couldn't have asked for anything better. Here is what I did:

Step 1:

Install Fedora 8 from DVD. Make sure to install MySQL, Apache with PHP and (unless you have another installation for development) a C++ development environment because you are going to have to compile some drivers. I'm usually quite religious about not having development environments on servers too, but this is just my own little server and if it does ever move into a production environment I'll remove it again.

Step 2:
After the Fedora installation, install ZoneMinder. At the command prompt type: yum install zoneminder

Step 3:
Set the services to be started at startup
chkconfig --levels 345 httpd
chkconfig --levels 345 mysqld
chkconfig --levels 345 zoneminder

Step 4:
Create the ZoneMinder database with the following commands:
cd /usr/share/zoneminder/db
mysql < style="font-weight: bold;">Step 5:
Modify the following configuration file for Apache:
In /etc/httpd/conf.d/zoneminder.conf, remove the line containing: Deny from all

Step 6:
Change the shared memory by editing /etc/sysctl.conf and add the following lines or if they are modify them appropriately:

kernel.shmall = 134217728
kernel.shmmax = 134217728

Step 7:
If you are going to try everything before rebooting you will have to changes this manually. Do this with the following commands:
echo 134217728 >/proc/sys/kernel/shmall
echo 134217728 >/proc/sys/kernel/shmmax
sysctl -p

Step 8:
Fedora Core 8 detect my Aiptek Pencam quite happily, but it does not have the drivers for the Logitech QuickCam Express. I firstly tried the gspca driver, but that didn't work. I then downloaded and compiled the quickcam driver and that works perfectly. Following are instructions for compiling and installing both drivers:


tar -xzf gspcav1-20071224.tar.gz
cd gspcav1-20071224
make install
/sbin/modprobe gspca


tar xvzf qc-usb-0.6.6.tar.g
cd qc-usb-0.6.6
make all
make install
modprobe quickcam

Step 9:
Start zoneminder, apache and mysql with the following commands:
/etc/rc.d/init.d/httpd start
/etc/rc.d/init.d/mysqld start
/etc/rc.d/init.d/zoneminer start

Things might or might not work at this point. Rebooting though, would be your safest bet to make sure everything is properly installed for future use.

Saturday, 23 February 2008

An implementation of the Web Economy Bullshit Generator

There exists a synergistic attitude in the market to revolutionise the use of vocabulary into a science of expressing cutting-edge senselessness to be perceived by the gullible as models to success .

Reference: Web Economy Bullshit Generator

Monday, 21 January 2008

Giving credit ...

If, in another few hundred years, we have perfected the computer and re-invented the human brain, I wonder who we will be attributing the invention to?