Spellchecking in Vim

Here’s something I didn’t know.

I have used Vim to write text files in the past and, when I do so, I use aspell check to catch my multitude of typing errors. It turns out that Vim is also able to support spell checking, so I no longer need to keep dropping back to the command line.

Joe ‘Zonker’ Brockmeier goes into detail, but I am reposting the highlights here so that I can easily find them again.

:setlocal spell spelllang=en_gb turns on the spell checker.
:set nospell turns it off again.

]s and [s moves to the next and previous spelling errors respectively.
z= brings up a list of alternatives for the typo under the cursor.
zg adds the word to the dictionary.
zw allows you to mark a word as incorrect.

This post was entirely written in Vim.

flattr this!

Quote of the Day: Consequences

Stated very simply, I face reality and admit that not only isn’t there anyone at home upstairs, there isn’t even any upstairs. I have one life and I intend to make the most of it. Therefore it follows naturally that if I firmly believe this, why then I cannot deprive another person of their turn at existence. Only the very self-assured political and religious zealots kill people in order to save them.

- Harry Harrison, from The Hutton Delusion by way of Pharyngula.

I also like this bit (from the same Hutton Delusion post) on the value of life:

Like diamonds, like gold, like principled politicians and non-libertarian hard SF, life is precious because it is an irreplaceable and finite commodity. Those who assert an eternal afterlife do not, as they claim, give our lives more worth and more meaning. They turn them into meaningless, relatively short precursors to the main event.

In fact, the whole post is worth reading. Go take a look.

flattr this!

Kamikaze coalition

Belgian politics are wonderful

Kamikaze Belgian Government?

The inclusion of the liberals opens the way for talks on the formation of a centre-right federal government with Flemish nationalists, Flemish Christian democrats and Flemish liberals. The Francophone liberals will be the only Francophone party in what has been dubbed the ‘Kamikaze Government’ as it does not possess a majority among Francophone lawmakers and in Francophonia the Francophone liberals will have to carry the can for everything.

Informateur Charles Michel is reporting back to King Filip in the course of today. It’s likely he will step aside. He can propose which parties can form the new federal coalition government. A Flemish Christian democrat could be appointed as formateur to form the next federal government.

Marc Van de Looverbosch: “The Flemish Christian democrats could propose outgoing Flemish PM Kris Peeters as the new federal Prime Minister. In this way the Christian democrats are not squeezed between the nationalists and the liberals. He is a figure of compromise. The Francophone liberals of MR will be able to say they are not entering an administration dominated by the Flemish nationalists.

The Kamikaze coalition holds 85 seats out of 150 in the federal parliament, but only 20 seats are held by Francophones.

flattr this!

Firefox 31 and the New Tab tab

Firefox 31 hit the Arch repos at some point today and now I have it. Since Mozilla moved to their 42 day release cycle, most of the changes from one release to the next have been incremental and not really worth noting. But I did notice something new when I opened a new tab.

That search bar immediately above my most recently used tabs is new. And handy.

And, for the borg-averse, you can change your default search engine by clicking on the logo. This gives you a drop-down showing your currently installed search engines and an option to manage the same.

flattr this!

Exponential Origami

Raju Varghese (via Sploid) claims that if you fold a piece of paper 103 times, the thickness of your paper will be larger than the diameter of the observable universe: 93 billion light years. The explanation is simple enough – every time you fold a piece of paper you double its thickness and when you start doubling things they get very large very quickly – but I couldn’t leave this without checking the numbers for myself.

Of course, I couldn’t resist checking this for myself and pulled out a calculator. I soon found that the mental juggling needed to get from fractions of millimetres to kilometres was too much for my little brain and converting between millimetres and light years was going to be impossible.

So I wrote a script. The code is pretty simple, as you can see below, although I did have a four fold discrepancy when I first ran it (I came up with 107 folds needed, rather than 103). It turned out that my initial thickness of the paper was out by a factor of 10. Once I fixed this, everything matched.

#!/usr/bin/env python
""" Foldpaper
    Calculates the thickness of a piece of paper after n folds """

thickness = 0.1
folds = 0
meter = 1000
kilometer = 1000000
lightyear = 1000000 * 9000000000000
size_of_universe_in_mm = 93000000000 * lightyear

while thickness < size_of_universe_in_mm:
    thickness *= 2
    folds += 1
    if int(thickness / lightyear) > 1:
        print(folds, int(thickness/lightyear), 'light years')
    elif int(thickness / kilometer) > 1:
        print(folds, int(thickness/kilometer), 'kilometers')
    elif int(thickness / meter) > 1:
        print(folds, int(thickness/meter), 'meters')
        print(folds, thickness, 'mm')

And then, with a slight edit, I dumped the results into a table so that I could add a few comparative distances.

Folds Height Notes
15 3 metres Taller than the average human
22 419 metres Taller than The Shard in London
27 13 kilometres We’re now standing higher than Mount Everest
42 439804 kilometres Now we’ve just passed the Moon
51 225179981 kilometres And the Sun
56 7205759403 kilometres And finally we reach Pluto
69 6 light years With a single fold, we have shot past Alpha Centuri
83 107460 light years And now the thickness of our piece of paper is larger than the Milky Way
88 3438722 light years And in a few short folds, we pass Andromeda
103 112680053353 light years And with that final fold, we have exceeded the size of the Universe

Exponentiation is awesome.

flattr this!

Digital nostalgia: Gauntlet


I am not a gamer, certainly not in the modern sense of the word, but I have played plenty of tabletop RPGs and have spent a not insignificant percentage of the 1980s in various amusement arcades. Consequently, a recent article in The Register looking back at Gauntlet had my nostalgia circuits all fired up before I’d even reached the end of the headline.

Gauntlet was a massive game, one that allowed up to four adventurers (a warrior, a valkyrie, a wizard and an elf) to explore a never-ending dungeon, kill monsters and collect treasure. The game had several nice touches, one of which was that people could join in at any time. So one person could start playing and others could join in, play until they had fed the machine enough coins and then drop out in favour of the next player.

It was also the case that each of the four characters had different strengths and weaknesses. The wizard was physically weak (and easily hurt) but very effective with the potions that he picked up, the elf was nimble and annoying and the valkyrie was a good all-rounder. My preferred character, however, was the warrior who was tough enough to trudge through level after level, blasting everything in his path.

Indeed, I became good enough with this character that I could play the game endlessly. I would literally walk into an arcade in the early afternoon and keep going – on the strength of a single coin – until the management turned off the machines.

That’s not to say that Gauntlet was easy – it wasn’t. But it was one of the very few games that hit the sweet spot of being challenging enough for me to want to keep going without becoming frustratingly impossible.

Part of this, I think, is one of the elements that The Register touched on – namely the non-linear game play. You entered a dungeon level and had to keep going until you reached the exit to the next dungeon but, within those constraints, you were pretty much free to go where you wanted. The problem-solving part of the game, therefore, really was a case of figuring out how to get stay alive long enough to find the exit, which was a refreshing change from the usual challenge of figuring out
what sequence of steps the game designer wanted you to follow.

Gauntlet was a fun and well designed arcade game and a fixture of many of my teenage years. Apparently, a PC version is slated for release later this year, but it won’t be the same.

flattr this!

Born in Belgium

flattr this!

On trust and deference

On the subject of the seemingly endless series of scandals, Andrew Rawnsley observes:

What is often called the decline of trust is really an evaporation of deference. Where once there was a reflexive respect for authority and a willingness to give it the benefit of the doubt, there is now a default to distrust.

While we do need to be wary of descending into cynicism, the evaporation of deference is undoubtedly a good thing.

flattr this!

Better out than in

Fart smells have health benefits (via Sploid)

When cells become stressed by disease they try to draw in enzymes to generate their own minute quantities of hydrogen sulfide.

The chemical helps to preserve mitochondria, which drive energy production in blood vessel cells and regulate inflammation, and without it the cell can switch off and die.

Fellow researcher Dr. Mark Wood added: “Although hydrogen sulfide is well known as a pungent, foul-smelling gas in rotten eggs and flatulence, it is naturally produced in the body and could in fact be a healthcare hero with significant implications for future therapies for a variety of diseases.”

That’s my excuse but if you want an alternative view, Dean Burnett speculates on what would happen if a mainstream science report was actually true.

flattr this!