A weirdly named site with lots of boring content!

Xbox 360 Controller in Wine

Sunday, 24th May 15
compton

The xpad kernel driver works pretty well for gamepads in Linux these days, with the wired Xbox 360 controller the recommended choice. This controller should work without need for configuration in most native Linux games.

When running Windows games under Wine, you are quite likely to find that the buttons and axes do not do what they're supposed to, or even don't function at all. This is because gamepad button mapping is different in Windows, Linux and even Mac. Don't worry though, it's not hard to fix this, by simply remapping the buttons to the correct inputs and then Wine games will recognise it properly and assign the right actions to the correct buttons.

xboxdrv is one way to do this. It's a pretty powerful program but is also quite a hassle to configure. The big advantage it offers is that it allows you to map gamepad (or joystick or steering wheel) buttons to keyboard presses, enabling you to use a gamepad in games that don't offer built-in


 ... ...

Living in Europe in a Campervan

Sunday, 17th July 16
compton

Buying a Vehicle in the EU

In Germany, like many other EU countries, the number plate on a vehicle indicates its registration and insurance status. German residents register their vehicle to their home address: when they move house, they have to update their registration, and up until 2015 this meant getting new plates. Since that date, I think new plates are only required when you move to a new state. Anyway, this is no good if you don't live in Germany. In that case, you can get special 'export plates' when you purchase the vehicle. These plates allow residents of other countries to buy vehicles in Germany. As with normal residents plates, you must have insurance before you can register a vehilce this way. Export plates normally valid for three months, in which case you do not need road tax. You can get export plates which are valid for up to a year, as long as you can show you have insurance for that period, and you are then required to pay German road
 ... ...

How to Stop Thunderbird Showing 'Me' or 'You' instead of Your Own Email Address

Monday, 19th November 12
compton

There's this annoyingly patronising habit that I blame Microsoft for, where items on your computer are labelled using possessive pronouns e.g. 'My Computer', or 'My Documents'. It's annoying because it is your computer, there is no need to label it, and it is patronising because the computer has no idea who is reading the label - it could be your girlfriend, dog, or even a laptop thief, in which case it should say 'Absolutely NOT your documents'. But it doesn't, it just says 'My' all the time, because you're just a stupid dribbling moron who appreciates being spoken to like a child.

A few updates ago, Mozilla started doing a similar thing with the Thunderbird email client. Since then, messages in your inbox no longer show the email address they were sent to, and just show 'Me' (previously 'You'). This is such a bad idea on so many levels. To begin with, many people have multiple email addresses, and need to easily see what email a particular message was sent to. It's also sometimes


 ... ...

Reading Email with PHP and IMAP/POP3

Friday, 20th April 07
compton

Sending email is very simple in PHP, thanks to the mail() function. So what about receiving it? Obviously this would be useful for webmail, but my intention is to allow remote control of a PHP app, which is restricted to specific IPs.

The idea is this:

  1. Check at set intervals for email from a specific sender containing a specific phrase
  2. Send an email to that sender containing a unique code and asking for confirmation by reply (this is to guard against emails with false sender info)
  3. Check for a reply from that sender containing the unique code
  4. Allow the user remote access
This back-and-forth palava is overkill for most operations but for my situation it provides sufficient security to prevent a reasonably determined hacker exploiting it to gain remote access (even if they did manage to fool it, they would still need the user's loginname and password to get in).

Receiving email in PHP is possible with the IMAP set of functions. For
 ... ...

Linux Steams Onward

Sunday, 13th January 13
compton

Good old Valve. Now I'm not someone you'll ever hear fawning over a company or its products, maybe it's the generation I come from or just my inner idealist. A little mistrust of capitalist enterprise is healthy even though capitalism is way better than either of the two big statist experiments of the 20th Century i.e. communism and fascism. Still, it's not perfect. The bottom line is that companies exist by exploiting their customers for profit, and as a customer, it's wrong or even foolish to expect more.

Sorry about that, went off on one a bit there. Where was I? Oh that's right, good old Valve. They've released Steam for Linux - well, it's currently in public Beta, so it's available to all. Only Ubuntu is officially supported, but I've had no problems running it in Arch using the package from AUR.

There's nowhere near as many games available compared to what you're used to with Steam in Windows: the


 ... ...

Taking a Dump with MySQL

Monday, 1st December 08
compton

The mysqldump command is widely documented because it really can be very useful, and also because it offers a blistering array of options. Its most obvious use is for dumping databases for backup or relocation purposes:

mysqldump [options] [database [tables]]
It can either dump a whole database in one go, or you can specify a list of specific tables to be dumped.

Dumps are simply SQL statements which when executed will recreate the database (or specific tables or rows). This makes the command potentially useful for cross-platform data-exports, should that ever be important. Consequently though, mysqldump's output will benefit hugely from compression, which is easily accomplished by piping the output into gzip:
mysqldump --extended-insert=FALSE --compact -c -C --single-transaction --add-drop-table --quick -u dbuser -p myDatabase myTable1 myTable2 myTable3 | gzip > export.sql.gz
The small c -c option creates complete insert
 ... ...

Stuffs for India Trip

Friday, 15th February 13
compton

About 50 miles out of Vasco da Gama are Dudhsagar Falls. It's not far from the Supra Dam reservoir in Anshi National Park.

makemytrip.com's routeplanner is the best way to plan routes around india. It will give you journey options between any two places, using a combination of train, airplane, bus and car.

The Indian railway company has this static map of rail routes around the country - useful for getting an overview of where different places are.

Ooty Timetable

"In fact there is only one express train that extends to Mettupalayam , which is the Chennai to Mettupalayam Nilgiri Express (also called the Blue Mountain Express)."

"Mettupalayam to Ooty there is one train a day. It waits for the Chennai-Mettupalayam (Blue Mountain Express) to reach to


 ... ...

Random GIFs

Monday, 28th January 13
compton










Installing Proprietary nVidia Drivers on Ubuntu Linux

Saturday, 22nd December 07
compton

This article refers to Ubuntu Gutsy Gibbon (7.10, 32-bit), but the upgrade to Hardy Heron (8.4) also messed up my screen resolutions, as I expected it would. At least this time I was prepared, and I was relieved that the script here works just as well with Hardy. It also appears to work on Debian - at least, it worked great for me on Debian amd64.

I had had a load of problems getting the default restricted drivers running when I upgraded to Gutsy, and at the time I'd tried the drivers from nvidia and found it an uphill struggle. During the process I realised that the default option in my Grub boot menu was causing Ubuntu to run with the older Feisty 2.6.20.16 kernel. Once I corrected that, I was able to switch on the restricted drivers (via System > Administration > Restricted Drivers) and enable compiz fusion with no further problems.

Since then Gutsy had been running great, with compiz silky smooth with max effects. World of Warcraft also runs fine, as does steam:- Team
 ... ...

Javascript Snippets

Friday, 5th September 08
compton

Preventing Users Entering Certain Characters

 
<input id="checkinput" onkeypress="return checkValid(this, event);">
 
<script>
function checkValid(inputfield, e) {
   if (!e) var e = window.event
   var keycode;
   if (e.keyCode) {
      keycode = e.keyCode;
   } else {
      if (e.which) {
         keycode = e.which;
      }
   }
   if ((keycode < 32 || keycode > 126) && keycode != 8 && keycode != 9 && keycode != 8 && keycode != 13 && keycode != 27) {
      alert('Sorry, "' + String.fromCharCode(keycode) + '" is an illegal character');
      return false;
   } else {
      return true;
   }
}
</script>

Finding an Element's X and Y Position


The following JavaScript function will return an array containing the X position of an element's left edge, the Y position of the element's top edge (these two are the element's top left corner), the element's right edge's X value and its bottom edge's Y value (and these two are the element's bottom
 ... ...

Software Development Employers in Birmingham, UK

Monday, 25th October 10
compton

Rather than go through agencies, who charge a big fat fee and often only serve as an obstruction between employer and potential employee, you can apply direct to the company, if you can find them. Coder Stack only posts jobs direct from employers.

Below is an independent list I've put together of software development firms in Birmingham, UK. If you know any I have missed, please do let me know in the comments. Thanks, and good luck in your search.

Proteus Software is based at Birmingham Business Park, B37 7YD, and they produce warehouse management software using Progress infrastructure software.

Borwell Software is a Small, Professional Software House based in Malvern that creates bespoke applications


 ... ...

XML Parsing and Display of GPX data in Java

Monday, 26th January 09
compton

With all these GPX recordings of routes I'm collecting, I wanted to view and compare details of past routes in a more user-friendly manner than poring through reams of XML output. The Google Maps API would be great to incorporate somehow, and it is freely available for JavaScript use. However I decided to be awkward and write a desktop application in Java. I'm figuring that I'll find some way around the problem of getting graphical map imagery later.

So far I have a small Java Swing/AWT application which reads an XML file of GPS points from a recording of a cycle ride and displays the route in a JPanel within a JFrame:


There are three primary classes - quickChart which extends JFrame, chartPanel which extends JPanel, and gpxParser which extends
 ... ...

Convert GPX to OpenGIS KML Encoding Standard (OGC KML)

Sunday, 21st December 08
compton

There are a myriad of XML formats for encoding GPS data. Google has a preference for Keyhole Markup Language (KML) and its zipped form, KMZ. gpsbabel, an open source tool for interacting with GPS devices that is compatible with Linux, Windows and Mac OS-X, has GPX (GPS eXchange Format, an XML schema designed for the transfer of GPS data between software applications) as its preferred format.

As these are both XML formats, it should be possible to write XSL stylesheets to transform one to the other. These stylesheets would allow you to both design training routes on Google Maps, and also view recorded training rides on Google's online mapping tool.

GPX is fairly simple. Here's a sample file:

<gpx version="1.0">
   <time>2008-12-20T18:06:08Z</time>
   <bounds minlat="52.446012469" minlon="-2.031685989"


 ... ...

Spooky Case of the Wem Ghost

Tuesday, 18th May 10
compton

There's an interesting story doing the rounds which you may or probably won't have seen recently. The Shropshire Star reports on an old chap who spotted what appears to be a very uncanny resemblance between a 1920s B&W photograph and a famous picture of an alleged local ghost.

See the story with full images here.

I was intrigued, and decided to compare the two images a bit closer, and there does seem to be a striking resemblance. See what you think using the image below. Click and drag the Fade control to fade from the 1990s image of the so-called Wem ghost to the 1920s image of a very much alive and sulky looking girl. You can use the other slider to zoom in or out on the image for a closer peek.

These images are both taken from the Shropshire Star story, and are untouched except to shrink the 'ghost' one so that it is the same size as the girl. I didn't process


 ... ...

Compiling and Installing Freespace 2 on Ubuntu Linux

Sunday, 30th December 07
compton

The first thing to do is install Freespace 2 under WINE (you will need WINE already installed and configured for this step). If you have the retail CDs, insert the first disk, browse to it in nautilus and double click the setup.exe file. As a Windows executable, it should start up using WINE. If you don't own the retail disks, read up on the open freespace wiki and forums for other methods of getting hold of the necessary data files for the game.

Proceed through the setup as if on Windows, but without the nagging feeling of nausea. I installed to the default location, although you may be able to install to another location. The only thing you may get stuck on is when it asks for the next disk - here you just need to put in the required disk, and change the path in the dialog accordingly (eg when you put in the 2nd disk, change the path from /media/cdrom/FREESPACE2_1/ to /media/cdrom/FREESPACE2_2/).

Once installed, you can try to run the retail .exe using WINE if you


 ... ...

A Simple 2D Terrain Model

Tuesday, 5th June 07
compton

I now want to look into how terrain can be modelled in a 3D game. My feeling is that the terrain model must support a couple of functions, as a minimum. These are elevation(x,y,z), which returns the height of terrain below the co-ordinates passed in, and slope(x,y,z), which returns the slope of the terrain at the specified point.

If we consider a simple single-level terrain, then we can say y = elevation(x,z). In other words the elevation function returns the height (y) for a point at (x, z).

The slope at a given point can be thought of as the rate of change of y with respect to x and z, ie the differential of y = elevation(x,z). 2D differentials are fairly straightforward to calculate using Newtonian calculus. I'm not so sure about 3D ones however.

There are other ways to get the slope though. If the terrain is represented as a triangular mesh, which is pretty much the only way to do it, the slope is the slope of the triangle at a given point.


 ... ...

Garmin Edge 205 GPS Cycle Training Tool

Saturday, 20th December 08
compton

The Garmin Edge (image stolen from www.tramsoft.ch) is a pretty cool little bicycle gadget. It is basically a cycle-mounted GPS receiver. It has no maps - you can't use it to plot a route along the public roads like you can with a car sat nav.

You can however program it with a route which you've planned elsewhere (e.g. Google maps), and you can also record a route which you can download on to your PC. As well as this it's also an accurate speedometer - which is what I was really looking for when I came across it.

To download data to and from the device, I use a program called gpsbabel, which runs under Linux, Windows and Mac OS-X. To download a recording of a route, use:

gpsbabel -t -i garmin -f /dev/ttyUSB0 -o gpx -F /tmp/track.xml

The -t option


 ... ...

Nasa's Space Shuttle Atlantis Transiting the Sun

Saturday, 16th May 09
compton

The following image shows the space shuttle Atlantis in transit across the sun. It was taken on Tuesday, 12th May 2009, by some froggy-sounding geezer called Thierry Legault, about 100 Km south of the Kennedy Space Center in Florida, USA:



Here's another image from the sequence, which lasted 4 seconds in total, the shutter firing four times every second with an exposure of 1/8000 sec, ISO 100:



In the lower left of the above picture, the Atlantis appears close to the Hubble Space Telescope, in the process of docking in order to perform repairs.

The time the shuttle actually spent in transit across the sun as viewed from Earth was a miniscule 0.8 seconds, the image only being possible thanks to the predictive accuracy of modern computer software.

Also of interest are his


 ... ...

Future of Computing: Silent, Capable, Low Power

Friday, 13th March 09
compton

In the early days of home PCs, back in the days of the 386 CPU, the machines ran almost completely noiselessly. The processor itself required no fan, and there was no call for case fans. The only fan would be found in the power supply, where it cooled the large step-down transformers.

Not so any more. Start up your home PC and you might as well be transported to the deck of an aircraft carrier. You have a CPU cooling fan, often another fan on your graphics card, and more and more frequently case fans are needed too. A typical PC can easily make enough noise to drown out low volume dialogue in movies and to mask the subtler nuances of the music you listen to.

But there is an alternative - a low spec processor that is able to run without a fan and only a heatsink, something like the VIA C7. It is fully x86 compatible, and can operate at 800 to 1500 MHz. The systems draw very little power in operation - typically around 20W, which is comparable to a modern low-energy lightbulb.


 ... ...

Joomla Templates

Thursday, 23rd November 06
compton
The Joomla Template system is very powerful and seemingly elegant. It will be essential for our graphic designers to be able to create templates that give the required professional, and unique, look and feel to our clients' sites. Part of this will necessitate an awareness of exactly how the templates work, so that new ones can be built and deployed smoothly.

There are actually two sets of templates on a site - the public ones which determine how the public pages appear, and the admin ones, which only apply to the back-end admin pages.

Each template has its own subdirectory within the templates folder (or administrator/templates). In this location, there is typically an index.php page, an XML file called templateDetails.xml, a thumbnail preview image, and two folders called css and images.

Making Joomla Modules

Monday, 4th December 06
compton

There are two essential files: one the XML descriptor, and two the PHP code. Both filenames begin mod_, then are followed by the name of the module, and the appropriate file extension of course.

So, to make a new featured items module (or really a special offers module) is fairly straightforward. The problem is how to mark products for display in this module. It would require some new field in the database, say an extra column in the #__{vm}_product table. A way to mark products, which sets this column, is then required in the admin panel.

The current featured items module appears to use the product_special column of this table. So we need to add a second checkbox for setting the new column.

The admin page where this checkbox is to be added is defined by the page=product.product_form parameter. The tabs on this page must be controlled by JS as the querystring is not changed when the active tab is changed.

Let's find where the content for the product


 ... ...

xorg.conf Settings for a 5-button Mouse in Linux

Sunday, 23rd December 07
compton

Replace the existing entry for your mouse in /etc/X11/xorg.conf with the following and restart X:

Section "InputDevice"
   Identifier   "Configured Mouse"
   Driver      "mouse"
   Option      "CorePointer"
   Option      "Device"   "/dev/input/mice"
   Option      "Protocol"   "ExplorerPS/2"
   Option      "Emulate3Buttons"   "false"
   Option      "Buttons"   "7"
   Option      "ZAxisMapping"   "4 5"
   Option      "ButtonMapping"   "1 2 3 6 7"
   Option      "Resolution"   "300"
EndSection


Linux should now be able to respond to the 'forward' and 'back' buttons on your mouse. Firefox should not need any further configuration, however few other apps make use of these buttons out of the box. This is where imwheel comes in.

Install this and you can map the extra mouse buttons to different key-presses in different applications. For Debian and Ubuntu distros, do sudo apt-get install imwheel.

It installs to /etc/X11, where you'll find a couple of config files living in a subdirectory called imwheel. Set up


 ... ...

Tank Wars in G3D

Wednesday, 2nd August 06
compton
This little game will be a simple two player effort, where each player controls a tank within a restricted environment. The environment is a simple rectangle, where the players' tanks can only move within that rectangle. Also within the rectangle would be various static obstacles. The obstacles would be implemented as an array of Wall instances, à la space-station interior in my first OpenGL game.

The player controls their tank in Battlezone style - each side's tread can be moved independently forwards or back. They'll also be able to fire of course. Perhaps more than one fire mode could be available?

It's a nice and simple game, and it should be possible with my current level of knowledge of the G3D library.

Here's a rough time-line:
  • Make the bounding box using debug camera
  • Add the player tank and POV camera
  • Add the obstacles
  • Add the second player tank
  • Allow control of second tank over network

Formating the Category Listing

Monday, 11th December 06
compton

The category listing is displayed on the VirtueMart 'home page', ie option=com_virtuemart on the URL, but no page or other parameter.

Going into the /templates/soinnovate/index.php file, and uncommenting the call to mosMainBody(), reveals that the content of the page I'm looking at is built by this function.

Searching for function mosMainBody in Windows Explorer locates the code in /includes/frontend.php. I know I've looked at this a few times before, I just can't immediately recall how it does its thing.

The key code is echo $GLOBALS['_MOS_OPTION']['buffer'];. In the admin side, this is populated by the index2.php page. On the public side, there is an index2.php page which does the same thing. It does not appear to be related to the actual code generated though, and the page we're interested in is index.php. Like index2.php, it has code to populate $_MOS_OPTION['buffer'].

It appears to work the same


 ... ...

Finally Fixing the Broken Spoke on my Bicycle

Friday, 6th April 07
compton
Since early last week, my pushbike has had a broken spoke: the first spoke to break on this bike. My previous bike was always getting broken spokes - for normal people, this is apparently unheard of. I put it down to a combination of the facts that I rode that bike regularly - daily to work pretty much every day for 2 years, plus pretty much everywhere else: swimming pool, pub, shops... It had done well over 1000 miles of pretty tough urban riding. Also, I weigh somewhere around 15 stone, and as it was a hybrid bike, I don't think it was really designed for people of that weight thrashing it about so much.

This bike however is a regular 26" wheel mountain bike, and the shorter spokes are tougher, so I was surprised at the broken spoke.

Fixing it isn't a major job - I need to remove the back wheel, remove the rear cassette (the gears), extract the remnants of the old spoke, and replace with a new one. I happen to have a new one that seems to be the correct length so I hope it'll fit.

Honda CX-500 Maintenance

Saturday, 26th January 08
compton
My 1981 Honda CX Custom has served me well for many happy years, but unfortunately it came to the end of the road this summer when something broke inside the engine that was not worth fixing.

Reluctantly I broke it up and sold it for parts, at least this way the majority of it has now found new life on someone else's bike. I'm selling what's left on ebay. Contact me if you're interested in any parts.

Here are some useful forums I found with good discussions and knowledgeable bike people:

CX500 GL500 650 Global forum

Chopper Charles CX500 / GL500 forum