My Ideal Operating System

What would my ideal Operating System look like?

  • Really small minimal installation. You know, like OpenBSD.
  • Thorough and comprehensive help pages. You know, like OpenBSD.
  • The ability to simply administer the OS remotely. You now, like SSH on OpenBSD.
  • Excellent, easy to configure firewall. You know, like pf on OpenBSD.
  • Easy to configure network redundancy. You know, like CARP on OpenBSD.
  • All communications between servers to be on well-determined ports.
  • Easy to manage centralised authentication. You know, like Active Directory on Windows.
  • Redundancy of authentication servers. You know, like Active Directory on Windows.
  • Automatic replication between authentication servers. You know, like Active Directory on Windows.
  • Automatic discovery of authentication servers using a simple system like DNS. You know, like Active Directory on Windows.
  • The ability to configure settings on clients centrally. You know, like Group Policy on Windows.
  • The ability to manage disks in almost any way imaginable. You know, like Veritas Storage Foundation.
  • The ability to replicate disks between systems. You know, like Veritas Volume Replicator.
  • Easy to use clustering. You know, like Veritas Cluster Server.
  • The ability to simply install OS updates. You know, like freebsd-update on FreeBSD.
  • The ability to centrally manage OS updates across the organisation, downloading only once. You know, like WSUS on Windows.
  • Centralised logging.
  • Built-in monitoring of hardware sensors. You know, like sysctl hw.sensors on OpenBSD.
  • Everything monitorable by SNMP.
  • A clear support lifetime policy. You know, like OpenBSD.
  • And finally, I want it Open Source. You know, like BSD-type open.

Is that too much to ask?

Posted in Computing, FreeBSD, Windows | Leave a comment

The problem with renaming a model in Rails

So you’ve decided to rename a model in Rails. What could be simpler than renaming and editing a bunch of files? You make your edits in development, run migrations and so on.
There’s a potential issue you might hit though. Suppose you have model Foo, which you want to modify (e.g. add a column). So you create a migration with:
add_column :foo, :quantity, :integer
…and you run your migration.
Then you decide you want to rename the model to Bar. So you use rename_table in your migration, and rename and edit the appropriate files. All works beautifully.
Now you come to deploy, and it all goes wrong when you migrate the database, saying it can’t find the model. The reason? Well your first migration now refers to a model that doesn’t exist, because the new model file is in place.
The messy solution is to perform the migration yourself, by renaming the database table directly in the database.
The clean solution is to avoid making changes like this in the first place. I guess it’s an example of where “deploy often” can reap benefits.

Posted in Rails | Leave a comment

Renaming a model in Rails

When renaming a model in Rails (2.3), there are a range of files you may need to change:

Create a migration to rename the database table:

(rename_table :oldname, :newname)

Rename the model.
Edit any associations in other models.
Rename the controller (if required)
Modify routes.rb
Modify any links in views.
Rename views.
Rename the model in controllers and views.
Rename and modify any tests.

Moral of the story – name your models correctly from the start. Keep them as generic as possible. This post came about because I initially had a model for appointments for training sessions, so the model TrainingSession was created. Then I needed to store appointments which were for a different type of session, but I kept the model name the same, as it was only seen internally, and used a named scope. Now I need to store appointments of any type, so having code referring to TrainingSession will still work, but it makes it counterintuitive to refer to generic appointments as TrainingSession.generic. Instead, Appointment.generic and Appointment.training are so much more logical.

Posted in Rails | 1 Comment

Grumpy Old Men

I’ve long been a fan of BBC’s Grumpy Old Men. Almost everything that is complained about is something you can sympathise with. However, tonight, for the first time I noticed that they class Grumpy Old Men as being from 35 to 54 years old. Given that I’ve only got two years until I fall into this bracket, I’m not sure whether I should be offended by this, or actually feel a little bit proud.

Posted in Uncategorized | Leave a comment

Frustrating companies – Cisco

Cisco make plenty of networking hardware, ranging from the small stuff for small business (let’s ignore the Linksys stuff badges as Cisco for now), to the really big stuff, suitable for the busiest networks. Within each product type (routers, switches etc) there are many products. Each product can then have many different models, with differing hardware capabilities. Each model can then have several software levels, each unlocking differing levels of functionality. Each product can also have many accessories, such as interface cards for connection to different network types. In short, there’s a lot of choice, which gives a lot of flexibility, which is obviously a good thing. However, there’s almost no useful help for the uninitiated on Cisco’s website. If you have a simple requirement (e.g. wanting a router for small business with an ADSL interface suitable for the UK, which has both VPN and IDS capabilities), then there’s virtually nothing to help you. If you try to work it out on your own, you’ll need to spend a lot of time reading the product specifications a documentation on the Cisco website. Sadly all this information is scattered all over the website in what seems like a shotgun approach.
So if you’re a small business, and you’re time is too precious to spend doing all this research, then surely Cisco will have a range of partners who will be able to answer the question for you. Well yes, they have authorised partners, but you get the distinct impression that these are partners for people who want to implement a substantial network infrastructure, and are happy to spend five or six, or maybe even seven figure sums doing so. At least in the UK.
Cisco also seem to be missing a trick with Smartnet, their support service. Some companies push their support services from the moment you start looking at their products, which Canberra annoying if you don’t the additional support. With Cisco it’s almost the opposite. Their support offering does appear to be good (it has a reputation for being superb), although unsurprisingly it’s not the cheapest. However it barely gets a mention, and you virtually have to hunt for it on the website. Additionally, some products support a “call home” feature, where Cisco will proactively alert you to problems. If you don’t stumble across this by accident, then you probably never find out about it.
Finally, you know when you buy a Cisco product that it won’t be cheap, but £60 for a router rackmount kit, which consists of two pieces of bent steel and eight small screws really is taking the piss!

Posted in Uncategorized | Leave a comment

Joomla! is dead! Long live WordPress!

Joomla! is no more here. For a bit of a change I’ve decided to move to WordPress. Why?

  • Easier to keep up-to-date
  • Seems more friendly on mobile devices (both front end and back end)
  • Comments built in
  • A change is as good as a rest

I’ll get round to moving the content over from Joomla! “soon”. Your idea of what “soon” is is as good as mine.

Posted in Uncategorized | 2 Comments

2 years of the iMac

After 2 years of using the iMac, what do I think of it?

Hardware

After 2 years I’m really quite happy with the Mac. Hardware-wise, the Mac itself has been fine. The only negatives are that there is a speck of dust behind the screen glass. I don’t feel like taking the iMac apart, and it’s up in the top right-hand corner, so I’ve lived with it for quite some time now. The Mac itself is very quiet. The only time it’s been anything louder than a whisper was during summer, when the sun had been shining on the black back for hours. I know have an external drive (more on that later), and that’s louder than the Mac itself.

As far as the included peripherals are concerned (keyboard, mouse and remote control), it’s a mixed bag. The remote control doesn’t get used, and the keyboard is fine, although there is some wear or discolouring around the arrow keys. The mouse however is not so good. Apple came in for plenty of criticism for the Mighty Mouse, and in my mind it’s deserved. The scroll ball now no longer works, regardless of how much you clean it. The side-squeezing buttons never get used, because with my big hands I have to adjust my grip on the mouse. I’d replace the mouse with the Magic Mouse if it weren’t so damn expensive. At least that has no moving parts.

When I bought the iMac, I chose the entry-level model, with a 250GB disk and 1GB RAM. Since then I’ve upgraded the RAM to 4GB, which was a painless procedure, once you’ve found the right sized screwdriver! The disk space is getting low though, with around 20GB free, although the machine is only used for internet email, iPhoto and iTunes. The next one will have to have a much bigger disk.

Mac OS X

Leopard seemed fine to me. There were some niggles that were sorted out after a few months, such as occasionally refusing to connect to the wireless network first time after waking from sleep, and losing text labels on stacks. Since then I’ve upgraded to Snow Leopard. Once you’ve got over the excitement of having about 7GB more disk space free, the biggest differences between Snow Leopard and Leopard can be summed up in one line.

Mail starts faster

Opening Mail went from about 15-30 seconds to about 2 seconds for me. Apart from that there are some changes to Expose (and I’m not sure they’re changes for the better), and a few other small things you notice, but nothing to write home about. I still think Preview for PDFs blows Adobe Reader out the water, and I hate using Reader, waiting for it start on a Windows machine.

One thing that is fantastic is Time Machine. Setup couldn’t be much easier. Plug in a hard disk, get asked if you want to use it for Time Machine, switch it on. Then get told you need to format it. Then get asked to switch TiMe Machine on again. OK, so maybe it’d be simpler if you bought a drive that came HFS+ formatted.

Posted in Apple | Leave a comment

Installing OpenNMS on FreeBSD

OpenNMS a network monitoring system,and is in some ways a competitor to Nagios. Having been a Nagios user for a while now, I was intrigued to see the alternatives were like. I last tried installing OpenNMS many years ago, and struggled installing it on FreeBSD. Now that it’s had a few more years to develop, I wondered if it was any easier to install, as there’s no port for it. Here are the notes I made to get it installed…

The installation environment was a VMWare environment (using VMWare Fusion on an iMac). The virtual machine was given an 8GB disk and 512MB RAM. In retrospect I should have allocated more RAM, as there was a lot of swapping going on during the build process. I installed packages rather than ports, to minimise the amount of disk space used and time taken.

  1. Install FreeBSD 7.2 (or later in the 7 series – 8 doesn’t have a functioning Java binary yet). I used the amd64 version.
  2. Ensure that the system can resolve its own name, either in DNS or an entry in the hosts file. OpenNMS will not start without this.
  3. Install PostgreSQL server.
    # pkg_add -r postgresql83-server
    This will also install libiconv, gettext and postgresql83-client. We install PostgreSQL 8.3 because 8.4.0 has a bug, and there isn’t a package for 8.4.1 yet.
  4. Edit /etc/rc.conf and add the line postgresql_enable=”YES”
  5. Initialise the database.
    # /usr/local/etc/rc.d/postgresql initdb
  6. Start the database.
    # /usr/local/etc/rc.d/postgresql start
  7. Install some packages needed by Java.
    # pkg_add -r javavmwrapper
    # pkg_add -r xtrans
    # pkg_add -r xproto
    # pkg_add -r xextproto
  8. Go to http://www.FreeBSDFoundation.org/downloads/java.shtml and download Diablo Caffee JDK 1.6.0-7 for FreeBSD 7 amd64. Then transfer it to the machine you’re building OpenNMS on.
  9. Install the Java package.
    # pkg_add /usr/local/opennms/diablo-jdk-freebsd7.amd64.1.6.0.07.02.tbz
    Agree to the license when prompted. You will get some warnings about version mismatches. These warnings can be safely ignored.
  10. Install python 2.5. This is a prerequisite package for jicmp, but is not marked as such, so it won’t be automatically installed by pkg_add.
    # pkg_add -r python25
  11. Install jicmp.
    # pkg_add -r jicmp
    This also installs xcb-proto.
  12. Fetch the OpenNMS source.
    # fetch http://downloads.sourceforge.net/project/opennms/OpenNMS%20Source/stable-1.6.7/opennms-source-1.6.7-1.tar.gz
  13. Untar the OpenNMS source.
    # tar xfz opennms-source-1.6.7-1.tar.gz
  14. Change to the source directory.
    # cd opennms-1.6.7-1/source
  15. Build OpenNMS, telling it that it will be installed in /usr/local/opennms.
    # ./build.sh -Dopennms.home=/usr/local/opennms install assembly:attached
    This stage may stop with errors about running out of java heap memory. If this happens, simply re-run the command, the build will commence from the error.
  16. Create the /usr/local/opennms directory.
    # mkdir /usr/local/opennms
  17. Change to the /usr/local/opennms directory.
    # cd /usr/local/opennms
  18. Untar the OpenNMS package.
    # tar xfz opennms-1.6.7-1/source/target/opennms-1.6.7.tar.gz
  19. Change the permissions on some files that are incorrectly set by the build.
    # chmod +x bin/*
    # chmod +x contrib/*
    # chmod -x contrib/*.README
    # chmod -x contrib/opennms.mib
  20. Run the runjava command.
    # /usr/local/opennms/bin/runjava -s
    This should find the java binaries you installed earlier.
  21. FreeBSD uses pgsql as the database user, rather than postgres, so edit the file /usr/local/opennms/etc/opennms-datasources.xml and change the database user from postgres to pgsql.
  22. Set up the database.
    # /usr/local/opennms/bin/install -dis
  23. Start OpenNMS.
    # /usr/local/opennms/bin/opennms start

If you want the additional features provided by jrrd, then you can install it by running pkg_add -r jrrd. Note that this installs a lot of other packages (renderproto, kbproto, font-util, encodings, expat, perl, gio-fam-backend, pango, rrdtool, bitstream-vera, cairo, font-bh-ttf, font-misc-ethiopic, font-misc-meltho, font-util, fontconfig, freetype2, gamin, glib, libX11, libXau, libXdmcp, libXft, libXrender, libfontenc, libpthread-stubs, libxcb, libxml2, mkfontdir, mkfontscale, pcre, pixman, pkg-config, png, xcb-util, xorg-fonts-truetype and xtrans).

Posted in FreeBSD | Leave a comment

Headphones

When I bought my iMac, a year ago, I also bought a new iPod Nano with it. The Nano comes with headphones, but they are really uncomfortable in your ear. So new headphones were required.

I have a pair of Sony MDREX71s. I had the MDREX70s before, and was happy with them, but the wire came loose making one headphone crackly, so I got the 71s as a present, thinking they’d be better. They’re not. The sound is muddy, and the mini plug on the wire is at a really annoying length (too short to go in your pocket, and with it out of your pocket the weight pulls the headphone out of your ear if your ear is sweaty and at an odd angle (you’ve never had your iPod on when washing your car on a hot day?). On the plus side the 71s are comfy.

I also have a pair of Grado SR60 headphones that I got a few years ago. Sound quality blows the Sonys away, and they’re very comfy to wear. The cord is made for listening to home hifi though, as it’s about 6 feet long. They also make you look like a WW2 radio operator. Since I moved house (a year ago) I haven’t got round to connecting up my CD player and amp, but every time I switch from the Sonys to the SR60s, it reminds me that I should, as the SR60s let you hear every bit of noise from a less-than-perfect MP3.

6 weeks ago I bought a pair of Grado iGrado headphones, as a compromise between the two. They look really cheap and horrible, with nasty shiny black plastic, and a really thin, weak looking cable, but the sound quality (and clarity) is almost as good as the SR60s. There’s a bit less bass though, and they don’t look as good as you’d think from the pictures. The cable length is just right to have the iPod in your pocket. The biggest downside is that they squeeze your head fairly tightly, and if you wear glasses, the headphones might interfere with them more than normal. After an hour or two’s listening you want to take them off to stop your head being squeezed. As far as the fit is concerned, it’s pretty good, but there’s no adjustment at all, so your mileage may vary.

Now, who wants to buy me a pair of GS1000s to review?

Posted in Uncategorized | Leave a comment

The Newport Branch

The Newport Branch is entirely closed today. It was originally built as a branch of of the Birmingham and Liverpool Junction Canal, linking to the Shrewsbury Canal.

From reading articles on the web, you might be lead to believe that much of it is gone. Maybe because it passes through such a desolate area, it hasn’t been built on, so restoration along the original line seems feasible (though of course expensive and slow, as progress on the Montgomery has shown). The section between Norbury Junction and Newport seems like it might be restored relatively easily. The problem with section is the high number of locks, which means a lot of expense (a set of gates for a single lock in in the tens of thousands of pounds range), and also a lot of water supply needed, which would have to come from the Shropshire Union main line. Also, the dry dock at Norbury Junction would have to go.

No restoration is taking place on this canal currently, though the Shrewsbury and Newport Canals Trust have started to make some progress at restoring Wappenshall Junction.

The overlay below was based on information gained from old Ordnance Survey maps, combined with the maps on the Shrewsbury and Newport Canal Trust’s website.

Download the Newport Branch overlay (Google Earth required)

Posted in Canals | Leave a comment