VAT registration and the flat rate

Disclaimer: I’m not an accountant, this is not tax advice, this contains assumptions and simplifications. Also, apologies to the accountants I know for mangling accounting theories and terms.

When the time comes to register for VAT, there are two schemes available to register for: The standard VAT scheme, and the flat rate VAT scheme.

The purpose of VAT is for HMRC to charge tax on all the value you add in the course of your business.

The standard rate VAT scheme requires you to charge VAT on all your sales, and in return you can reclaim VAT on all your purchases. This requires you to keep track of the VAT on your expenditure. At the end of this exercise, you should have collected VAT on behalf of HMRC equivalent to your expenditure less your purchases. You then pay this difference to HMRC.

The flat rate scheme is supposed to be simpler. This requires you to charge VAT on all your sales, and you then pay a proportion of your VAT-inclusive turnover to HMRC. The proportion you pay depends upon your industry. For IT consultancy this rate is 14.5%, and for your first year there is a 1% discount on the rate you pay.

At first glance, the flat rate scheme sounds attractive. 14.5% is certainly less than 20%, so it sounds like an incentive to go on the simpler scheme. A 1% discount sounds like an additional bonus. So what are the downsides of the flat rate scheme? The biggest difference is that you aren’t able to reclaim the VAT on your expenditure (except for certain capital purchases over £2000, but let’s try and keep this simple). So which scheme should you choose? Let’s work out which is better.

First, let’s make some assumptions and definitions:

  • All our example company’s expenditure will be VAT rated at 20%
  • All our example company’s sales will be VAT rated at 20%
  • The flat rate is 14.5%
  • There is no capital expenditure on which VAT is reclaimable
  • We’ll call our gross sales figure S
  • We’ll call our gross expenditure figure E
  • We’ll call our profit P, this being the value we’re left with after selling our goods & services, paying our expenditure, and dealing with VAT. Pf is profit on the flat rate scheme, Ps is profit on the standard scheme.

On the flat rate scheme, we charge VAT on our sales (S), we pay VAT on our expenditure (E), and we get to keep 85.5% of our sales-plus-VAT.

Pf = (S * 1.2) * 0.855 – E * 1.2

On the standard scheme, we get all the VAT on our expenditure back, and while we charge VAT on our sales, we don’t get to keep it!

Ps = SE

So how do these schemes compare in two extreme scenarios: When a company has no expenditure, and when a company’s expenditure is equal to its sales?

When we have no expenditure (i.e. E = 0):
Pf = S * 1.2  * 0.855 = S * 1.026
Ps = S

So in this contrived scenario the flat rate scheme is equivalent to a 2.6% income bonus! What about when expenditure is equal to sales (i.e. E = S)?

Pf = (S * 1.2) * 0.855 – S * 1.2 = -0.174 * S
Ps = SS = 0

So in this scenario the flat rate will leave you 17.4% worse off!

A consultant will at first glance appear to be closer to the first scenario than the second, as there are no goods being resold to lose VAT on. However, it’s not like there is no expenditure, such as accountants, telephone costs, hotel costs.

So the next question for enquiring minds is at what expenditure/sales ratio are the two schemes equal? Knowing this ratio will allow us to estimate what our own future ratio might be, and therefore which scheme might be better for us.

So if the expenditure/sales ratio, E/S = x, we want to solve x where Pf = Ps.

E/S = x
E = S * x

Pf = Ps
(S * 1.2) * 0.855 – E * 1.2 = S – E
(S * 1.2) * 0.855 – S * x * 1.2 = S – S * x
1.2 * 0.855 – x * 1.2 = 1 – x
1.2 * 0.855 – 1 = x * 1.2 – x
0.026 = x * 0.2
0.13 = x

So for any expenditure/sales ratio below 0.13 we expect the flat rate scheme to be more beneficial for us, up to 2.6% better than the standard scheme.

For any expenditure/sales ratio above 0.13 we expect the flat rate scheme to be worse for us.

Hopefully this will help others decide which scheme may be better for them, and there is enough information to adjust for different flat rates for different industries and introductory discounts.

Happy VATting!

Starting out alone in Information Security and IT consultancy

After 10 years with my previous employer I was made redundant at the end of January.

Rather than rush straight to the job boards in a state of panic, I’m looking at this as an opportunity.

For several years I have considered Information Security and IT consultancy as a career path, but never been in a position to take the first big step. Now I have that opportunity.

So, Option 13 is now available to service the Information Security and IT needs of small and medium businesses looking for an experienced consultant.

BitTorrent Magnet links for FreeBSD

Since the FreeBSD torrent tracker has been taken offline, and it appears that it won’t be coming back, you may be able to use a magnet link, so here they are. Each magnet link announces to three public trackers, to try and increase the size of the swarm.

Current FreeBSD versions

FreeBSD-7.4-RELEASE-amd64-all
FreeBSD-7.4-RELEASE-amd64-bootonly
FreeBSD-7.4-RELEASE-amd64-disc1
FreeBSD-7.4-RELEASE-amd64-disc2
FreeBSD-7.4-RELEASE-amd64-disc3
FreeBSD-7.4-RELEASE-amd64-docs
FreeBSD-7.4-RELEASE-amd64-dvd1
FreeBSD-7.4-RELEASE-amd64-livefs
FreeBSD-7.4-RELEASE-i386-all
FreeBSD-7.4-RELEASE-i386-bootonly
FreeBSD-7.4-RELEASE-i386-disc1
FreeBSD-7.4-RELEASE-i386-disc2
FreeBSD-7.4-RELEASE-i386-disc3
FreeBSD-7.4-RELEASE-i386-docs
FreeBSD-7.4-RELEASE-i386-dvd1
FreeBSD-7.4-RELEASE-i386-livefs
FreeBSD-8.3-RELEASE-amd64-all
FreeBSD-8.3-RELEASE-amd64-bootonly
FreeBSD-8.3-RELEASE-amd64-disc1
FreeBSD-8.3-RELEASE-amd64-dvd1
FreeBSD-8.3-RELEASE-amd64-livefs
FreeBSD-8.3-RELEASE-amd64-memstick
FreeBSD-8.3-RELEASE-i386-all
FreeBSD-8.3-RELEASE-i386-bootonly
FreeBSD-8.3-RELEASE-i386-disc1
FreeBSD-8.3-RELEASE-i386-dvd1
FreeBSD-8.3-RELEASE-i386-livefs
FreeBSD-8.3-RELEASE-i386-memstick
FreeBSD-9.1-RELEASE-amd64-all
FreeBSD-9.1-RELEASE-amd64-bootonly
FreeBSD-9.1-RELEASE-amd64-disc1
FreeBSD-9.1-RELEASE-amd64-dvd1
FreeBSD-9.1-RELEASE-amd64-memstick
FreeBSD-9.1-RELEASE-i386-all
FreeBSD-9.1-RELEASE-i386-bootonly
FreeBSD-9.1-RELEASE-i386-disc1
FreeBSD-9.1-RELEASE-i386-dvd1
FreeBSD-9.1-RELEASE-i386-memstick
FreeBSD-7.4-RELEASE-pc98-all
FreeBSD-7.4-RELEASE-pc98-bootonly
FreeBSD-7.4-RELEASE-pc98-disc1
FreeBSD-7.4-RELEASE-pc98-livefs
FreeBSD-7.4-RELEASE-sparc64-all
FreeBSD-7.4-RELEASE-sparc64-bootonly
FreeBSD-7.4-RELEASE-sparc64-disc1
FreeBSD-7.4-RELEASE-sparc64-disc2
FreeBSD-7.4-RELEASE-sparc64-disc3
FreeBSD-7.4-RELEASE-sparc64-docs
FreeBSD-8.3-RELEASE-pc98-all
FreeBSD-8.3-RELEASE-pc98-bootonly
FreeBSD-8.3-RELEASE-pc98-disc1
FreeBSD-8.3-RELEASE-pc98-livefs
FreeBSD-8.3-RELEASE-sparc64-all
FreeBSD-8.3-RELEASE-sparc64-bootonly
FreeBSD-8.3-RELEASE-sparc64-disc1
FreeBSD-8.3-RELEASE-sparc64-dvd1
FreeBSD-8.3-RELEASE-sparc64-livefs
FreeBSD-9.1-RELEASE-powerpc64-all
FreeBSD-9.1-RELEASE-powerpc64-bootonly
FreeBSD-9.1-RELEASE-powerpc64-memstick
FreeBSD-9.1-RELEASE-powerpc64-release
FreeBSD-9.1-RELEASE-sparc64-all
FreeBSD-9.1-RELEASE-sparc64-bootonly
FreeBSD-9.1-RELEASE-sparc64-disc1

Previous FreeBSD versions

5.5-RELEASE-alpha-all
5.5-RELEASE-alpha-bootonly
5.5-RELEASE-alpha-disc1
5.5-RELEASE-alpha-disc2
5.5-RELEASE-pc98-all
5.5-RELEASE-pc98-disc1
5.5-RELEASE-sparc64-all
5.5-RELEASE-sparc64-bootonly
5.5-RELEASE-sparc64-disc1
5.5-RELEASE-sparc64-disc2
6.1-RELEASE-alpha-all
6.1-RELEASE-alpha-bootonly
6.1-RELEASE-alpha-disc1
6.1-RELEASE-alpha-disc2
6.1-RELEASE-ia64-all
6.1-RELEASE-ia64-bootonly
6.1-RELEASE-ia64-disc1
6.1-RELEASE-ia64-disc2
6.1-RELEASE-ia64-livefs
6.1-RELEASE-pc98-all
6.1-RELEASE-pc98-disc1
6.1-RELEASE-sparc64-all
6.1-RELEASE-sparc64-bootonly
6.1-RELEASE-sparc64-disc1
6.1-RELEASE-sparc64-disc2
6.2-RELEASE-alpha-all
6.2-RELEASE-alpha-bootonly
6.2-RELEASE-alpha-disc1
6.2-RELEASE-alpha-docs
6.2-RELEASE-ia64-all
6.2-RELEASE-ia64-bootonly
6.2-RELEASE-ia64-disc1
6.2-RELEASE-ia64-disc2
6.2-RELEASE-ia64-docs
6.2-RELEASE-ia64-livefs
6.2-RELEASE-pc98-all
6.2-RELEASE-pc98-bootonly
6.2-RELEASE-pc98-disc1
6.2-RELEASE-sparc64-all
6.2-RELEASE-sparc64-bootonly
6.2-RELEASE-sparc64-disc1
6.2-RELEASE-sparc64-disc2
6.2-RELEASE-sparc64-docs
6.3-RELEASE-alpha-all
6.3-RELEASE-alpha-bootonly
6.3-RELEASE-alpha-disc1
6.3-RELEASE-alpha-disc2
6.3-RELEASE-alpha-disc3
6.3-RELEASE-alpha-docs
6.3-RELEASE-pc98-all
6.3-RELEASE-pc98-bootonly
6.3-RELEASE-pc98-disc1
6.3-RELEASE-sparc64-all
6.3-RELEASE-sparc64-bootonly
6.3-RELEASE-sparc64-disc1
6.3-RELEASE-sparc64-disc2
6.3-RELEASE-sparc64-disc3
6.3-RELEASE-sparc64-docs
6.4-RELEASE-pc98-all
6.4-RELEASE-pc98-bootonly
6.4-RELEASE-pc98-disc1
6.4-RELEASE-sparc64-all
6.4-RELEASE-sparc64-bootonly
6.4-RELEASE-sparc64-disc1
6.4-RELEASE-sparc64-docs
7.0-RELEASE-ia64-all
7.0-RELEASE-ia64-bootonly
7.0-RELEASE-ia64-disc1
7.0-RELEASE-ia64-disc2
7.0-RELEASE-ia64-disc3
7.0-RELEASE-ia64-docs
7.0-RELEASE-ia64-livefs
7.0-RELEASE-pc98-all
7.0-RELEASE-pc98-bootonly
7.0-RELEASE-pc98-disc1
7.0-RELEASE-pc98-livefs
7.0-RELEASE-powerpc-all
7.0-RELEASE-powerpc-bootonly
7.0-RELEASE-powerpc-disc1
7.0-RELEASE-powerpc-disc2
7.0-RELEASE-powerpc-disc3
7.0-RELEASE-powerpc-docs
7.1-RELEASE-ia64-all
7.1-RELEASE-ia64-bootonly
7.1-RELEASE-ia64-disc1
7.1-RELEASE-ia64-disc2
7.1-RELEASE-ia64-disc3
7.1-RELEASE-ia64-docs
7.1-RELEASE-ia64-livefs
7.1-RELEASE-pc98-all
7.1-RELEASE-pc98-bootonly
7.1-RELEASE-pc98-disc1
7.1-RELEASE-pc98-livefs
7.1-RELEASE-powerpc-all
7.1-RELEASE-powerpc-bootonly
7.1-RELEASE-powerpc-disc1
7.1-RELEASE-powerpc-disc2
7.1-RELEASE-powerpc-disc3
7.1-RELEASE-powerpc-docs
7.1-RELEASE-sparc64-all
7.1-RELEASE-sparc64-bootonly
7.1-RELEASE-sparc64-disc1
7.1-RELEASE-sparc64-disc2
7.1-RELEASE-sparc64-disc3
7.1-RELEASE-sparc64-docs
7.2-RELEASE-ia64-all
7.2-RELEASE-ia64-bootonly
7.2-RELEASE-ia64-disc1
7.2-RELEASE-ia64-docs
7.2-RELEASE-ia64-livefs
7.2-RELEASE-pc98-all
7.2-RELEASE-pc98-bootonly
7.2-RELEASE-pc98-disc1
7.2-RELEASE-pc98-livefs
7.2-RELEASE-powerpc-all
7.2-RELEASE-powerpc-bootonly
7.2-RELEASE-powerpc-disc1
7.2-RELEASE-powerpc-docs
7.2-RELEASE-sparc64-all
7.2-RELEASE-sparc64-bootonly
7.2-RELEASE-sparc64-disc1
7.2-RELEASE-sparc64-docs
8.0-RELEASE-ia64-all
8.0-RELEASE-ia64-bootonly
8.0-RELEASE-ia64-disc1
8.0-RELEASE-ia64-disc2
8.0-RELEASE-ia64-disc3
8.0-RELEASE-ia64-dvd1
8.0-RELEASE-ia64-livefs
8.0-RELEASE-pc98-all
8.0-RELEASE-pc98-bootonly
8.0-RELEASE-pc98-disc1
8.0-RELEASE-pc98-livefs
8.0-RELEASE-powerpc-all
8.0-RELEASE-powerpc-bootonly
8.0-RELEASE-powerpc-disc1
8.0-RELEASE-powerpc-disc2
8.0-RELEASE-powerpc-disc3
8.0-RELEASE-sparc64-all
8.0-RELEASE-sparc64-bootonly
8.0-RELEASE-sparc64-disc1
8.0-RELEASE-sparc64-dvd1
8.0-RELEASE-sparc64-livefs
8.1-RELEASE-ia64-all
8.1-RELEASE-pc98-all
8.1-RELEASE-powerpc-all
8.1-RELEASE-sparc64-all
FreeBSD-7.3-RELEASE-pc98-all
FreeBSD-7.3-RELEASE-pc98-bootonly
FreeBSD-7.3-RELEASE-pc98-disc1
FreeBSD-7.3-RELEASE-pc98-livefs
FreeBSD-7.3-RELEASE-sparc64-all
FreeBSD-7.3-RELEASE-sparc64-bootonly
FreeBSD-7.3-RELEASE-sparc64-disc1
FreeBSD-7.3-RELEASE-sparc64-disc2
FreeBSD-7.3-RELEASE-sparc64-disc3
FreeBSD-7.3-RELEASE-sparc64-docs
FreeBSD-8.1-RELEASE-ia64-bootonly
FreeBSD-8.1-RELEASE-ia64-disc1
FreeBSD-8.1-RELEASE-ia64-dvd1
FreeBSD-8.1-RELEASE-ia64-livefs
FreeBSD-8.1-RELEASE-pc98-bootonly
FreeBSD-8.1-RELEASE-pc98-disc1
FreeBSD-8.1-RELEASE-pc98-livefs
FreeBSD-8.1-RELEASE-powerpc-bootonly
FreeBSD-8.1-RELEASE-powerpc-disc1
FreeBSD-8.1-RELEASE-sparc64-bootonly
FreeBSD-8.1-RELEASE-sparc64-disc1
FreeBSD-8.1-RELEASE-sparc64-dvd1
FreeBSD-8.1-RELEASE-sparc64-livefs
FreeBSD-8.2-RELEASE-ia64-all
FreeBSD-8.2-RELEASE-ia64-bootonly
FreeBSD-8.2-RELEASE-ia64-disc1
FreeBSD-8.2-RELEASE-ia64-dvd1
FreeBSD-8.2-RELEASE-ia64-livefs
FreeBSD-8.2-RELEASE-pc98-all
FreeBSD-8.2-RELEASE-pc98-bootonly
FreeBSD-8.2-RELEASE-pc98-disc1
FreeBSD-8.2-RELEASE-pc98-livefs
FreeBSD-8.2-RELEASE-powerpc-all
FreeBSD-8.2-RELEASE-powerpc-bootonly
FreeBSD-8.2-RELEASE-powerpc-disc1
FreeBSD-8.2-RELEASE-powerpc-livefs
FreeBSD-8.2-RELEASE-sparc64-all
FreeBSD-8.2-RELEASE-sparc64-bootonly
FreeBSD-8.2-RELEASE-sparc64-disc1
FreeBSD-8.2-RELEASE-sparc64-dvd1
FreeBSD-8.2-RELEASE-sparc64-livefs
FreeBSD-9.0-RELEASE-ia64-all
FreeBSD-9.0-RELEASE-ia64-bootonly
FreeBSD-9.0-RELEASE-ia64-memstick
FreeBSD-9.0-RELEASE-ia64-release
FreeBSD-9.0-RELEASE-powerpc-all
FreeBSD-9.0-RELEASE-powerpc-bootonly
FreeBSD-9.0-RELEASE-powerpc-memstick
FreeBSD-9.0-RELEASE-powerpc-release
FreeBSD-9.0-RELEASE-powerpc64-all
FreeBSD-9.0-RELEASE-powerpc64-bootonly
FreeBSD-9.0-RELEASE-powerpc64-memstick
FreeBSD-9.0-RELEASE-powerpc64-release
FreeBSD-9.0-RELEASE-sparc64-all
FreeBSD-9.0-RELEASE-sparc64-bootonly
FreeBSD-9.0-RELEASE-sparc64-disc1
5.5-RELEASE-amd64-all
5.5-RELEASE-amd64-bootonly
5.5-RELEASE-amd64-disc1
5.5-RELEASE-amd64-disc2
5.5-RELEASE-i386-all
5.5-RELEASE-i386-bootonly
5.5-RELEASE-i386-disc1
5.5-RELEASE-i386-disc2
6.1-RELEASE-amd64-all
6.1-RELEASE-amd64-bootonly
6.1-RELEASE-amd64-disc1
6.1-RELEASE-amd64-disc2
6.1-RELEASE-i386-all
6.1-RELEASE-i386-bootonly
6.1-RELEASE-i386-disc1
6.1-RELEASE-i386-disc2
6.2-RELEASE-amd64-all
6.2-RELEASE-amd64-bootonly
6.2-RELEASE-amd64-disc1
6.2-RELEASE-amd64-disc2
6.2-RELEASE-amd64-docs
6.2-RELEASE-i386-all
6.2-RELEASE-i386-bootonly
6.2-RELEASE-i386-disc1
6.2-RELEASE-i386-disc2
6.2-RELEASE-i386-docs
6.3-RELEASE-amd64-all
6.3-RELEASE-amd64-bootonly
6.3-RELEASE-amd64-disc1
6.3-RELEASE-amd64-disc2
6.3-RELEASE-amd64-disc3
6.3-RELEASE-amd64-docs
6.3-RELEASE-i386-all
6.3-RELEASE-i386-bootonly
6.3-RELEASE-i386-disc1
6.3-RELEASE-i386-disc2
6.3-RELEASE-i386-disc3
6.3-RELEASE-i386-docs
6.4-RELEASE-amd64-all
6.4-RELEASE-amd64-bootonly
6.4-RELEASE-amd64-disc1
6.4-RELEASE-amd64-disc2
6.4-RELEASE-amd64-disc3
6.4-RELEASE-amd64-docs
6.4-RELEASE-i386-all
6.4-RELEASE-i386-bootonly
6.4-RELEASE-i386-disc1
6.4-RELEASE-i386-disc2
6.4-RELEASE-i386-disc3
6.4-RELEASE-i386-docs
7.0-RELEASE-amd64-all
7.0-RELEASE-amd64-bootonly
7.0-RELEASE-amd64-disc1
7.0-RELEASE-amd64-disc2
7.0-RELEASE-amd64-disc3
7.0-RELEASE-amd64-docs
7.0-RELEASE-amd64-livefs
7.0-RELEASE-i386-all
7.0-RELEASE-i386-bootonly
7.0-RELEASE-i386-disc1
7.0-RELEASE-i386-disc2
7.0-RELEASE-i386-disc3
7.0-RELEASE-i386-docs
7.0-RELEASE-i386-livefs
7.1-RELEASE-amd64-all
7.1-RELEASE-amd64-bootonly
7.1-RELEASE-amd64-disc1
7.1-RELEASE-amd64-disc2
7.1-RELEASE-amd64-disc3
7.1-RELEASE-amd64-docs
7.1-RELEASE-amd64-dvd1
7.1-RELEASE-amd64-livefs
7.1-RELEASE-i386-allv
7.1-RELEASE-i386-bootonly
7.1-RELEASE-i386-disc1
7.1-RELEASE-i386-disc2
7.1-RELEASE-i386-disc3
7.1-RELEASE-i386-docs
7.1-RELEASE-i386-dvd1
7.1-RELEASE-i386-livefs
7.2-RELEASE-amd64-all
7.2-RELEASE-amd64-bootonly
7.2-RELEASE-amd64-disc1
7.2-RELEASE-amd64-disc2
7.2-RELEASE-amd64-disc3
7.2-RELEASE-amd64-docs
7.2-RELEASE-amd64-dvd1
7.2-RELEASE-amd64-livefs
7.2-RELEASE-i386-all
7.2-RELEASE-i386-bootonly
7.2-RELEASE-i386-disc1
7.2-RELEASE-i386-disc2
7.2-RELEASE-i386-disc3
7.2-RELEASE-i386-docs
7.2-RELEASE-i386-dvd1
7.2-RELEASE-i386-livefs
8.0-RELEASE-amd64-all
8.0-RELEASE-amd64-bootonly
8.0-RELEASE-amd64-disc1
8.0-RELEASE-amd64-dvd1
8.0-RELEASE-amd64-livefs
8.0-RELEASE-amd64-memstick
8.0-RELEASE-i386-all
8.0-RELEASE-i386-bootonly
8.0-RELEASE-i386-disc1
8.0-RELEASE-i386-dvd1
8.0-RELEASE-i386-livefs
8.0-RELEASE-i386-memstick
8.1-RELEASE-amd64-all
8.1-RELEASE-i386-all
FreeBSD-7.3-RELEASE-amd64-all
FreeBSD-7.3-RELEASE-amd64-bootonly
FreeBSD-7.3-RELEASE-amd64-disc1
FreeBSD-7.3-RELEASE-amd64-disc2
FreeBSD-7.3-RELEASE-amd64-disc3
FreeBSD-7.3-RELEASE-amd64-docs
FreeBSD-7.3-RELEASE-amd64-dvd1
FreeBSD-7.3-RELEASE-amd64-livefs
FreeBSD-7.3-RELEASE-i386-all
FreeBSD-7.3-RELEASE-i386-bootonly
FreeBSD-7.3-RELEASE-i386-disc1
FreeBSD-7.3-RELEASE-i386-disc2
FreeBSD-7.3-RELEASE-i386-disc3
FreeBSD-7.3-RELEASE-i386-docs
FreeBSD-7.3-RELEASE-i386-dvd1
FreeBSD-7.3-RELEASE-i386-livefs
FreeBSD-8.1-RELEASE-amd64-bootonly
FreeBSD-8.1-RELEASE-amd64-disc1
FreeBSD-8.1-RELEASE-amd64-dvd1
FreeBSD-8.1-RELEASE-amd64-livefs
FreeBSD-8.1-RELEASE-amd64-memstick
FreeBSD-8.1-RELEASE-i386-bootonly
FreeBSD-8.1-RELEASE-i386-disc1
FreeBSD-8.1-RELEASE-i386-dvd1
FreeBSD-8.1-RELEASE-i386-livefs
FreeBSD-8.1-RELEASE-i386-memstick
FreeBSD-8.2-RELEASE-amd64-all
FreeBSD-8.2-RELEASE-amd64-bootonly
FreeBSD-8.2-RELEASE-amd64-disc1
FreeBSD-8.2-RELEASE-amd64-dvd1
FreeBSD-8.2-RELEASE-amd64-livefs
FreeBSD-8.2-RELEASE-amd64-memstick
FreeBSD-8.2-RELEASE-i386-all
FreeBSD-8.2-RELEASE-i386-bootonly
FreeBSD-8.2-RELEASE-i386-disc1
FreeBSD-8.2-RELEASE-i386-dvd1
FreeBSD-8.2-RELEASE-i386-livefs
FreeBSD-8.2-RELEASE-i386-memstick
FreeBSD-9.0-RELEASE-amd64-all
FreeBSD-9.0-RELEASE-amd64-bootonly
FreeBSD-9.0-RELEASE-amd64-disc1
FreeBSD-9.0-RELEASE-amd64-dvd1
FreeBSD-9.0-RELEASE-amd64-memstick
FreeBSD-9.0-RELEASE-i386-all
FreeBSD-9.0-RELEASE-i386-bootonly
FreeBSD-9.0-RELEASE-i386-disc1
FreeBSD-9.0-RELEASE-i386-dvd1
FreeBSD-9.0-RELEASE-i386-memstick

Installing sqlite3 ruby gem on FreeBSD

If you try to install (or update) the sqlite3 ruby gem on FreeBSD, you might get the following error:

sudo gem update sqlite3
Updating installed gems
Updating sqlite3
Fetching: sqlite3-1.3.5.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.

/usr/local/bin/ruby18 extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite-devel' and check your shared library search path (the
location where your sqlite3 shared library is located).
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/ruby18
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
--enable-local
--disable-local

Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/sqlite3-1.3.5 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/sqlite3-1.3.5/ext/sqlite3/gem_make.out
Nothing to update

The gem doesn’t include the correct locations to check for the sqlite3 headers, so we’ll have to tell it where to look ourself:

sudo CONFIGURE_ARGS="with-sqlite3-include=/usr/local/include" gem install sqlite3

Job done.

Netgear DGN1000 review

After an intermittent failure of my previous ADSL router, I thought long and hard about whether I could justify spending many hundreds of pounds on a nice Cisco 1800, I decided to go cheap and buy a bottom-of-the-range Netgear. After all, I’d had Netgear routers in the past, with few problems. So I bought the Netgear DGN1000.
The best thing about this router is that it has a power button. This is useful because you’ll be using it a lot.
The biggest problem with this router is that it randomly stops routing data between the WAN and the wireless network. Or sometimes it does route data, but at around 1Kb/s. Sometimes this failure to route data happens after several hours, sometimes it can happen within minutes. The only resolution is to reboot the router.
So apart from the constant failures, it’s fine. Except the automatic firmware update doesn’t work (it fails to recognise that there’s a newer firmware available), and WPS doesn’t appear to work at all.
This is the first piece of IT hardware I’ve ever felt like driving over in my car.
On this occasion I’ll return it as faulty instead.

Daily Mail corrects incorrect facts, but not the biggest ones

The BEA released a briefing about the loss of Air France flight 447 today. The flight involved a descent of 3 minutes 30 seconds, during which the aircraft was stalled. All 228 on board lost their lives. The briefing specifically says

the engines were operating and always responded to crew commands.

Earlier in the day, the Daily Mail published an article with the headline “Terrifying final moments of doomed Air France flight revealed: Passengers endured three-minute plunge before crash”, and the sub-headlines include “…engines began to fail…” and “…engines stalled…”, so it’s downright incorrect.

Screenshot of Daily Mail story
The early version of the story (thanks to istyosty.com)

Don’t worry though, because they’ve corrected it. The headline now says “FOUR MINUTE plunge”. Rounding up is better than rounding down, after all, and the use of capitals emphasises the difference. The sub-headlines mentioning engine failure are still there though. I wonder if it will ever be corrected.

Screenshot of Daily Mail story
The updated version of the story

To the Daily Mail – people in glass houses shouldn’t throw stones

The Daily Mail try to have a laugh at the expense of The Independent in this article.

The article points out that on The Independent’s site you can alter the URL as long as you retain the article number. Of course, The Independent “were embarrassed”. Ho ho, we’re The Daily Mail, other newspapers aren’t as good as us and all that…

I wonder if the journalist who wrote the article (it’s not even credited to Daily Mail Reporter) thought to try it on the Mail’s website.

http://www.dailymail.co.uk/sciencetech/article-1378504/This-paper-is-written-by-a-bunch-of-twunts.html

http://www.dailymail.co.uk/sciencetech/article-1378504/We-will-find-any-excuse-to-tag-a-story-with-kate-middleton.html

Well would you believe it?

As long as you retain the original URL up to the final “/”, and the “.html” at the end, you can put almost anything in between them (no spaces, no apostrophes) and you’ll be redirected to the original article.

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?

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.

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.