C++11 – Part 1: Automatic Types

My C++ skills are getting a bit rusty as I have not done much programming in that language lately. So I thought what better way to refresh my skills and learn new stuff than to go through the C++11 changes and write something about them. I will not cover all additions and changes to the standard, but instead focus on those I am likely to use, (which means they must be implemented in GCC). And even those I do focus on, will likely miss some subtleties that I find unimportant (or more likely am unaware of…). For those wanting actual detail, a late working paper that is a near final draft of the C++11 standard can be downloaded here.

This first post is going to focus on type deduction and its uses.

auto
In C++98, you have to declare the type of every variable being used. C++11 introduces the auto keyword, which lets the compiler deduce the type of a variable given its initializer. So you could write:

auto x = 5;

and you would get that x is declared to be an int. Like everything in programming, there is times when you should use a feature and times when you should not… This is an example of a time where you should not. The use of auto should be reserved for situations where you really do not know the type of the result or that the type is unwieldy to write. For example:

template<class T, class U>
void dot_product(const vector<T> vt, const vector<U> vu)
{
  //...
  auto tmp = vt[i] * vu[i]
  //...
}

A bit of a contrived example, but it should be clear that the type of the result depends on the template parameters U and V so is unknown. I will get to the return type in the next post…

A more useful example where the type of the variable is known but unwieldy is:

std::vector<std::pair<std::string, int>> v;
//...
for(auto i = v.begin(), i != v.end(), ++i) {
//...

Here the type of i is known (std::vector<std::pair<std::string,int>>::const_iterator), but writing that would quickly become tedious and error prone. I guess most situations like this were previously handled with a typedef statement.

There are other uses of auto that will be covered in later posts when the relevant features are introduced.

decltype
The decltype operator takes an expression and returns it type. A trivial example:

int x = 5;
decltype(x) y = x;

This declares the variable y to have the same type as x. Of course you could use auto here (or preferably neither in this case…), but the use of decltype comes into its own when you actually need a type – for example, a return type, which will be covered in the second post in this series.

Posted in C++11 on May 16th, 2012 by Allan – 1 Comment

Classic Gaming – Part 3: Crystal Caves

Ignoring everything I had said in the previous posts in this series about Commander Keen being next (stupid rat things still kill me…), I have instead worked my way though Crystal Caves.

Like many other Apogee software games, this came in three episodes – Trouble with Twibbles, Slugging it Out and Mylo Versus the Supernova – with the first game being free and the other two requiring a purchase. An interesting fact I found out about these games was that a patch was released for the original game 14 years and one day after its original release, fixing a bug when run on Windows XP. That is what I call support!

Meet our hero, Milo Steamwitz. He knows exactly how he is going to make his fortune, but needs to generate some money to invest first. So it is off to some remote planet where large crystals are just lying about in caves waiting to be harvested. You start off in some sort mine shaft that provides access to 16 caves to be explored. In each cave you have to run around, jumping between platforms, flicking switches on and collecting all the crystals while avoiding various obstacles and shooting aliens. Each cave has a bit of a theme to it, with some having continuously falling rocks to avoid and others having “low gravity” (which does not let you jump higher, but does mean you get forced back whenever you shoot – interesting…). Once all the crystals are collected, the exit door unlocks.

I had played the first episode many times when I was younger so I zoomed through to the end quite quickly. For each level there is a key that you can collect which allows you to open all the treasure chests scattered throughout the level, but having no siblings around to eliminate from the high-score board, my motivation to do so was limited… At the end of the first episode, Milo sells up his collected crystals and invests in a Twibble farm. It turns out that Twibbles are prolific at eating and breeding so the planets resources are soon used up. Also, no-one wants to buy Twibbles any more, so I guess he just abandoned them all to die of starvation.

The second and third episodes are very similar to the first. I think there is a slight difficulty increase, but it is hard to judge given how much I had played the first episode previously. The difference I did notice was that a lot of levels required you to do the crystal collecting for different sections in a defined order. There were many places where the only way to go back to collect a crystal you missed was to die and restart the level. What is worse, there is a bug in the third game where in the mine shaft there is an area where you can not escape (pictured). So the two levels there must be left until last, otherwise you have to restart the game.

The second episode ends with Milo buying a slug farm. For some reason, everybody wants slugs and he is in danger of running out. But then the slugs burrowed underground to avoid the heat of the day and ended up in an old salt mine. So Milo’s profits quickly “dried up”. Oh, the hilarity…

The final episode see Milo giving up on farming. Instead he wants to buy a solar system to set up a vacation resort based on some perfectly legitimate sounding scheme he saw on TV. Sure enough, once he signs the contract, the whole solar system gets destroyed in a supernova (I bet you could have never guessed that would happen from the game title…). Luckily, the supernova left a nice looking backdrop for a space burger joint. It is now quite popular and Milo can sell his burgers at a price that looks expensive even accounting for inflation.

I was slightly disappointed at the lack of additional game-play elements in the second and third episodes. The two episodes I had not previously played were entertaining enough, but that is influenced by nostalgia. Overall, I think these games are worth playing, but if you finish the free episode and are not impressed, do not think things will improve.

So… will I finish Commander Keen: Vorticons for the next post? Not likely… But I am running out of ideas for old DOS games to play, so make me some suggestions.

Posted in Games on May 13th, 2012 by Allan – 4 Comments

Installing Arch on a MacBook Pro (8.1)

My earlier post about installing Arch Linux on a MacBook Pro 5.5 is one of the most accessed posts on my site, so I figured I should write an update for the newer model.

The basic specs of my MacBook Pro 8.1 (13″) are:

  • Intel Core i7-2620M @ 2.7 GHz
  • 8GB (2x4GB) 1333MHz DDR3 SDRAM
  • 750GB SATA @ 5400 RPM
  • Intel HD Graphics 3000
  • Broadcom BCM4331 802.11a/b/h/n

Installation: I have gone for a pure x86_64 install this time. The initial install was “fun”… So much so, that I would have probably abandoned Arch altogether if I did not have a vested interest in it. The latest official Arch Linux install CD (2011.08.19) does not even boot so I had to grab a testing iso. The install is fairly routine as far as a single OS install on a MacBook Pro goes. I followed the same strategy as my previous install and changed the partition table format and blessed the partition /boot was on for a faster boot-up. I could have tried GRUB2 with its EFI support, but I just stuck with what I knew worked. But “worked” is a funny term as the current Arch Linux installer will only allow you to install GRUB on the hard-drives MBR and not onto an individual partiation (which is required on MacBook Pros). So I did my first manual GRUB installation and everything booted fine!

Video: Just pacman -S xf86-video-intel and everything works.

Screen Brightness: Worked out of the box.

Keyboard Backlight: I recommend learning to touch type… but I read it works.

Touchpad: Sort of worked out of the box using xf86-input-synaptics-1.5.99.902 (see my previous post about what I consider “bugs” in synaptics finger distance calculations). That includes two/three finger right/middle clicks and two finger scrolling. Also, click with thumb and drag with finger no longer required a patched kernel module.

Wifi: Requires b43-firmware from the AUR.

Suspend to RAM: I set xfce4-power-manager to suspend on lid close it worked fine.

Webcam: Worked out of the box.

Sound: Use alsamixer to unmute the speakers.

Keyboard: Screen brightness keys worked fine. Needed to add shortcuts to XFCE for volume control and disc eject.

Fan: Appears fine out of the box, but I need to test it under more variety of load.

Anything else (bluetooth, thunderbolt) has not been tested because “meh”.

Overall, this install took me far less time to do compared to installing on the 5.5 model. There were no patched modules for the touchpad or screen brightness control and no compiling a proprietary module for the wireless. In fact, after the initial dramas with the installation media, everything basically just worked. I guess some of the reason for that is that the 8.1 model I am using was released some time early in 2011, so many of the issues people may have faced early on appear to have already been fixed.

Posted in Arch Linux on April 27th, 2012 by Allan – 6 Comments

Converting Video On The Command Line

I recently acquired an iPad for work purposes… so the most important thing to know is how to convert video to play on it. Use handbrake, done – short blog post.

But, that would be all too simple. Often I want to watch an entire season of a show that I have collected from various sources over the years and these often have widely varying sound levels. That is quite annoying if you set the season to play and then have to adjust the volume for every episode.

Here is a simple guide to convert your videos into a format suitable for the iPad with equalized volumes. I somewhat deliberately used a variety of tools for illustration purposes, but I think the one I selected tended to be the quickest for each step. The following code snippets assume that your videos have extension “.avi”. They also destroy source files, so make a backup.

Step 1. Extract the audio track using mplayer:
for i in *.avi; do
  mplayer -dumpaudio "$i" -dumpfile "${i//avi}mp3"
done

Step 2. Make sure all audio is mp3 and convert using ffmpeg if not:
for i in *.mp3; do
  if ! file "$i" | grep -q "layer III"; then
    mv "$i" "$i.orig"
    ffmpeg -i "$i.orig" "$i"
    rm "$i.orig"
  fi
done

Step 3. Normalize the audio levels using mp3gain:
mp3gain -r *.mp3

Step 4. Stick the adjusted audio back into the video file using mencoder (part of mplayer):
for i in *.avi; do
   mv "$i" "$i.orig"
  mencoder -audiofile "${i//avi}mp3" "$i.orig" -o "$i" -ovc copy -oac copy
  rm "$i.orig" "${i//avi}mp3"
done

Step 5. Convert to iPad format using the command line version of handbrake:
for i in *.avi; do
  HandBrakeCLI -i "$i" -o "${i//avi/m4v}" --preset="iPad"
  rm "$i"
done

This is probably not the most efficient way of doing this and will become less so once handbrake can normalize volume levels by itself (which appears to be being somewhat worked on by its developers…). But when you have several seasons of a show, each with more than 50 episodes (only a few minutes each), you quickly become glad to be able to make a simple script to do the conversion automatically.

Posted in Software on April 19th, 2012 by Allan – 2 Comments

Getting My Touchpad Back To A Usable State

I was happy to note the following in the release announcement of xf86-input-synaptics-1.5.99.901:

“… the most notable features are the addition of multitouch support and support for ClickPads.”

As a MacBook Pro user, that sounded just what I needed. No more patching the bcm5974 module to have some basic drag-and-drop support. I upgraded and everything seemed to work… for a while. I began noticing weird things occurring when I was trying to right and middle click (being a two and three finger click respectively). Specifically, my fingers would sometimes be registered in a click and sometimes not.

The two finger “right” click was easy enough to figure out. If my fingers were too far apart, the two finger click was not registered. It turns out I am what I have decided to call a “finger-spreader”, as my fingers can be quite relaxed across the touchpad when I click. Fair enough, I thought… I just have to train myself to click with my fingers closer together. Then came the three finger click. All three fingers close together did not seem to register as anything. A bit of spreading and a three finger click got registered, but too much spreading and it was down to two fingers. Also, it was not actual distance between fingers that mattered as rotating my hand on the touchpad with my fingers the same distance apart could result in different types of clicks registered.

A bit of looking in the xf86-input-synaptics git shortlog lead me to this commit as a likely candidate for my issues. The commit summary starting with “Guess” and it having a comment labelled “FIXME” were the give-aways… The first thing I noticed was that the calculation of the maximum distance between fingers to register as a multitouch click was done in terms of percentage of touchpad size. That means that the acceptable region where your two fingers need to be for a two finger click is an ellipse, which at least explains why physical distance appeared not to matter.

Attempted fix #1 was to increase the maximum allowed separation between fingers from 30% to 50%. That worked brilliant for two finger clicking, but made three finger clicking even worse, which lead me to another interesting discovery… The number of fingers being used is calculated as the number of pairs of fingers within the maximum separation, plus one. For two fingers, fingers 1 and 2 form one pair, plus one is “two fingers”. However, for three fingers, there are three possible pairs: (1,2), (2,3) and (1,3). This explains the weirdness in three finger clicking; finger pairs (1,2) and (2,3) must be withing the maximum allowed separation while finger pair (1,3) must be outside that. That explains why having fingers too close together did not register as a three finger click (as it was being reported as four fingers – three pairs plus one) and why things became worse when I increased the maximum allowed separation. I filed a bug report upstream and a patch to fix that quickly appeared.

After applying that patch, multifinger clicks all work fine provided your fingers are close enough together. I do not find the required finger closeness natural so I got rid of the finger distance restrictions altogether using this patch. I am not entirely sure what I break removing that, but it appears to be something I do not use as I have not noticed an issues so far. As always, use at your own risk…

Posted in Software on April 11th, 2012 by Allan – 6 Comments

How Secure Is The Source Code?

With the addition of source code PGP signature checking to makepkg, I have began noticing just how many projects release their source code without any form of verification available. Or even if some form of verification is provided, it is done in a way that absolutely fails (e.g. llvm which was signed by a key that was not even on any keyservers meaning it could not be verified). If code security fails at this point, actually signing packages and databases at a distribution end-point instills a bit of a false sense of security.

To assess how readily validated upstream source code is, I did a survey of what I would consider the “core” part of any Linux distribution. For me, that basically means the packages required to build a fairly minimal booting system. This is essentially the package list from Linux From Scratch with a few additions that I see as needed…

For each source tarball I asked the following questions: 1) Is a PGP signature available and is the key used for signing readily verified? 2) Are checksum(s) for the source available and if they are only found on the same server as the source tarball, are they PGP signed? The packages are rated as: green – good source verification; yellow – verification available but with concerns; red – no verification. Apologies to any colour-blind readers, but the text should make it clear which category each package is in…

Package Verification
autoconf-2.68 PGP signature, key ID in release announcement, key readily verifiable.
automake-1.11.3 PGP signature, key used to sign release announcement.
bash-4.2.020 PGP signature for release and all patches, link to externally hosted key from software website.
binutils-2.22 PGP signature, key used to sign release announcement (containing md5sums).
bison-5.2 PGP signature, key ID in release announcement, externally hosted keyring provided to verify key.
bzip2-1.0.6 MD5 checksum provided on same site as download.
cloog-0.17.0 MD5 and SHA1 checksums in release announcement posted on off-site list.
coreutils-8.15 PGP signature, key used to sign release announcement.
diffutils-3.2 PGP signature, key used to sign release announcement.
e2fsprogs-1.42.1 PGP signature, key readily verifiable.
fakeroot-1.18.2 MD5, SHA1 and SHA256 checksums provided in PGP signed file, key readily verifiable.
file-5.11 No verification available.
findutils-4.4.2 PGP signature, link to externally hosted key in release announcement.
flex-2.5.35 No verification available.
gawk-4.0.0 PGP signature, key difficult to verify.
gcc-4.6.3 MD5 and SHA1 checksums provided in release email. MD5 checksum provided on same site as download.
gdbm-1.10 PGP signature, key ID in release announcement (with MD5 and SHA1 checksums), key readily verifiable.
gettext-0.18.1.1 PGP signature, key readily verifiable.
glibc-2.15 No release tarball, download from git (PGP signature available when release tarball is made).
gmp-5.0.4 PGP signature, key ID and SHA1 and SHA256 checksums on same site as source, key difficult to verify otherwise.
grep-2.11 PGP signature, key used to sign release announcement.
groff-1.21 PGP signature, key difficult to verify.
grub-1.99 PGP signature, key used to sign release announcement.
gzip-1.4 PGP signature, key used to sign release announcement.
iana-etc-2.30 No verification available.
inetutils-1.9.1 PGP signature, key readily verifiable.
iproute-3.2.0 PGP signature, key readily verifiable.
isl-0.09 No verification available.
kbd-1.15.3 File size available in file in same folder as source.
kmod-0.05 PGP signature, key readily verifiable.
less-444 PGP signature, key posted on same site as download, key difficult to verify otherwise.
libarchive-3.0.3 No verification available.
libtool-2.4.2 PGP signature, key readily verifiable, MD5 and SHA1 checksums in release email.
linux-3.2.8 PGP signature, key readily verifiable.
m4-1.4.16 PGP signature, key used to sign release announcement.
make-3.82 PGP signature, key used to sign release announcement.
man-db-2.6.1 PGP signature, key used to sign release announcement.
man-pages-3.35 PGP signature, key readily verifiable.
mpc-0.9 (libmpc) PGP signature, key readily verifiable.
mpfr-3.1.0 PGP signature, key readily verifiable.
ncurses-5.9 PGP signature, key used to sign release announcement.
openssl-1.0.0g PGP signature, key readily verifiable.
pacman-4.0.2 PGP signature, key readily verifiable.
patch-2.6.1 PGP signature, key difficult to verify.
pcre-8.30 PGP signature, key readily verifiable.
perl-5.14.2 MD5, SHA1, SHA256 checksums provided on same site as download.
pkg-config-0.26 No verification available.
ppl-0.12 PGP signature, key readily verifiable.
procps-3.2.8 No verification available.
psmisc-22.16 No verification available.
readline-6.2.002 PGP signature for release and all patches, link to externally hosted key from software website.
sed-4.2.1 PGP signature, key difficult to verify.
shadow-4.1.5 PGP signature, key readily verifiable.
sudo-1.8.4p4 PGP signature, key difficult to verify.
sysvinit-2.88 PGP signature, key difficult to verify.
tar-1.26 PGP signature, key used to sign release announcement.
texinfo-4.13a PGP signature, key difficult to verify.
tzdata-2012b Many checksums provided in release announcement.
udev-181 PGP signature, key readily verifiable.
util-linux-2.21 PGP signature, key readily verifiable.
which-2.20 No verification available.
xz-5.0.3 PGP signature, key difficult to verify.
zlib-1.2.6 MD5 checksum provided on same site as download (although download mirrors available).

Note that some of these packages have additional methods of verification available (e.g. those that are PGP signed may also provide checksums and file sizes), but I stopped looking once I found suitable verification. When I label a key as “readily verifiable”, that means it is either signed by keys I trust, that it is used to sign emails that I can find or it is posted on the developers personal website (which must be different from where the source code is hosted). I personally found my preferred method of verification was packages whose release announcements were signed by the same key as the source.

While you might look at that table and think there is a lot of green (and yellow) there so everything is in reasonable shape, it is important to note that the majority of these are GNU software and all GNU software is signed. Also, 15% of the packages in that list have no source verification at all. From some limited checking, it appears the situation quickly becomes worse as you move further away from this core subset of packages needed for a fairly standard Linux system, but I have not collected actual numbers to back that up yet.

Posted in Software on April 7th, 2012 by Allan – 3 Comments

Anime Guide 2011

Last year’s anime list appeared in July, so I am definitely making progress at getting this done earlier in the year. Who knows, by next year it might appear in January! Then again, it could happen in August…

As always, this is not a review of all of the year’s anime as there is far too much crap out there. Instead it is a collection of my opinions on the anime that I thought were good enough to watch in the first place. There was definitely a lot of decidedly average anime during this year. There was not necessarily anything bad about them, just there is nothing to make them stand out as worthwhile either.

Anime of the Year

Steins;Gate

Steins;Gate
(TV, 25 episodes)

It took me until at least the eighth episode to have some sort of idea what was going on here. Bananas in microwaves that turn into green goop… But even though I had no idea what was happening, the early episodes still are intriguing enough that you want to watch more and it gets even better once the plot points all begin coming together.

Recommended

Black Lagoon - Roberta's Blood Trail

Black Lagoon – Roberta’s Blood Trail
(OVA, 5 episodes)

If you like the two previous series of Black Lagoon, then you will probably like these episodes. It is just more of the same thing, but given the previous series were very, very good…

Mawaru Penguin Drum

Mawaru Penguin Drum
(TV, 24 episodes)

This series made it into my Recommended list based entirely on its uniqueness. And I am sure there is some deep underlying meaning in there (probably something about abandoned children being able to find happiness) and there appears to be a large number of metaphors too (the boxes, the apple). But there were too many twists and turns for me to fully grasp what was being implied. I still have no idea what the penguins were…

Tiger and Bunny

Tiger and Bunny
(TV, 25 episodes)

Remember those days of getting up early on a Saturday morning to watch cartoons? Tiger and Bunny is like an American superhero cartoon, but with more awesome. Almost enough awesome for me to select it as the anime of the year. I even found the shameless sponsor promotion to be quite amusing. But in the end, there is nothing amazing or original about this series, it is just damn entertaining.

Usagi Drop

Usagi Drop
(TV, 11 episodes)

Not the usual style of show for me to watch, but it was a solid drama so the risk paid off. However, if you like this show and want to find out more by reading the manga, then you should wipe that thought completely from your mind. Pretend the manga never existed. Seriously… No arguing. Just don’t. As one blogger wrote, he should have just let sleeping, scrotum-eating, rabid dogs lie.

Average

A Certain Magical Index II

A Certain Magical Index II
(TV, 24 episodes)

Worse than the first series and far worse than Railgun. But given both of those were very good, that is not bad in itself. However, my overall impression was that they were running out of ideas so they had to stretch out the little that they had, which resulted in a fairly slow pace. And the superpower that only negates other superpowers gets boring.

Blue Exorcistt

Blue Exorcist
(TV, 25 episodes)

There was a few quite good episodes in this series. However, its storyline is overly predictable and has too much filler (including a beach episode…).

Broken Blade

Broken Blade
(OVA, 6 episodes)

I have never been a fan of mecha anime, but this was one of the better ones. Well, it was for the first four episodes anyway. I found the finish was bland. Almost as bland as the characters… But at least they were not teenagers because the addition of boring teenage coming of age crap (that normally is in mecha anime), would have killed this for me.

Deadman Wonderland

Deadman Wonderland
(TV, 12 episodes)

The theme park style prison where inmates have to compete in fights in order earn points to buy their continued living is not particularly original… But at least the superpowers were interesting. The ending is also far too non-conclusive, but I am not sure if it was because there was nothing to conclude or if everything was kept open to make a sequel.

Dragon Ball Kai

Dragon Ball Kai
(TV, 97 episodes)

I watched this mainly for nostalgia reasons and because I have never seen the final 50 or so episodes from Dragon Ball Z. While this version was significantly more fast paced than the original (the 97 episodes covered what took 193 in DBZ), I think it could still have moved faster in lots of places. Also, the remake is not complete and so I still have not seen the second half of the Majin Buu Saga. Maybe one day…

Fractale

Fractale
(TV, 11 episodes)

This anime started off well, but got progressively worse. But I can not actually say how it got worse… it just became bad. And I think I mean genuinely bad and not just bad because it did not live up to the potential shown in the first episode.

Gosick

Gosick
(TV, 24 episodes)

This tries so hard to be a good show. But I think I am already bored of shows that involve some sort of detective with a side-kick. The first few cases are examples of entirely amateur writing. I think someone just jumped on the internet and searched for “crime cases with minor twist when solving”. It all just seemed too familiar. But the series was rescued as story did go beyond a pure detective drama and turn into something much more interesting.

No. 6

No. 6
(TV, 11 episodes)

After lots of war, only six pieces of land remain. Guess which number this is? This is another series that I think started off strong but just did not go anywhere spectacular. Just a typical Dystopian Society storyline.

Subpar

The Mystic Archives of Dantalian

The Mystic Archives of Dantalian
(TV, 12 episodes)

You can always tell a show is bad when there is some sort of super power transformation sequence that lasts so long that you starting thinking to yourself that you could have killed both of the lead characters multiple times by now and that would not necessarily be a detriment to the show. It is even worse when that superpower is unlocking a girls chest with a key and then reaching in a pulling out a book. That takes forever, but then the book has to be read aloud for it to work. With only minor exaggeration, in total this sequence takes about three quarters of every episode.

Posted in Anime on March 31st, 2012 by Allan – 3 Comments

Ten Years of Arch Linux

Today marks the 10 year anniversary since the first release of Arch Linux. I have been involved in Arch for only about half that time, but I thought it might be quite interesting to make a time-line of the major things I remember being involved with in my history with Arch Linux.

I actually first used Arch Linux in a virtual machine for quite some time prior to the start of this time-line. I was running a Linux From Scratch install and was looking to add better package management. Then I realized that it was quite a waste of time building my own packages when Arch was actually quite similar to what I was trying to achieve in a Linux install. The toolchain was the part I liked dealing with the most in LFS and now I get to play with it anyway, so things worked out well!

Here is a brief summary of my involvement with Arch Linux:

2007-06-09 – Joined forums
2007-06-20 – First non-VM Arch install
2007-12-04 – First patch to the pacman project (fixed compressing man pages in makepkg)
2008-01-09 – Applied to be a Trusted User (TU)
2008-01-23 – Voted in as a TU (23 yes, 1 abstain!)
2008-06-03 – Joined the forum moderation team.
2008-06-04 – Became a Arch Linux developer!
2008-08-17 – First big rebuild. I made all ncurses applications use the wide-character library for better locale support.
2008-09-01 – Interviewed in the Arch Newsletter – yes, there used to be one of those…
2009-04-04 – Resigned as a TU
2009-04-22 – First complete toolchain build after becoming the toolchain maintainer (gcc-4.4 update)
2009-06-07 – Broke module-init-tools due to missing a file failing to compile in the PKGBUILD. (makepkg would catch such an error these days and the missing file would be noted using the checkpkg utility)
2009-07-17libjpeg-7 rebuilds enter [extra]. I think this was the first major rebuild to severely break KDEmod.
2009-08-02pacman-3.3.0 released with package splitting support in makepkg
2010-03-05 – Fix a bug introduced by my first patch to makepkg… In true Allan style, the commit message contains a typo so does not point at the right bug!
2010-07-02 – Resigned as forum moderator. Mainly because I wanted to be able to be grumpy on the forums when…
2010-10-18python3 transition – Probably the single most controversial thing I have done in Arch…
2011-02-28 – A minor bash update resulted in non-booting systems
2011-03-16pacman-3.5.0 released for which I contributed reading the sync databases directly from the downloaded tarball, disk space checking and storing package information in a hash table.
2011-10-13pacman-4.0.0 release with full PGP signing support for packages and databases.

Of course there have been lots of other things I have contributed to Arch, including 1000s of package updates and about 400 patches to pacman. But these are the ones I found most memorable.

Posted in Arch Linux on March 11th, 2012 by Allan – 8 Comments

Windows Service Center

I just had an interesting phone call from someone at the “Windows Service Center”. Note I spelled “Center” the non-Australian way, because I do not think they were based here. Anyway, I get these calls about once a month so I get to have a bit of fun. The conversation went like this…

Caller: “Hello. Is Mr. Mac-Rae there?” (my name was pronounced with a discernible gap…)
Me: “Yes”
Caller: “(pause…) Are you Mr Mac-Rae?”
Me: “Yes”
Caller: “I am calling from the Windows Service Center.”
Me: “My windows are quite clean from all the rain we had lately and they are showing no leaks.”
Caller: “Um… as in Windows on your computer.”
Me: “Oh, right. That would make lots more sense.”
Caller: “Are you the main user of the computer?”
Me: “Which one?”
Caller: “You have more than one?”
Me: “Yes. Six” (which is technically correct – the best kind of correct – but most of them are broken and serve as door stops)
Caller: “We will start with the one you mainly use.”
Me: “OK then. Yes, I am the main user of the computer I mainly use.”
Caller: “There are lots of viruses on the internet these days and our records indicate that your computer is infected.”
Me: “Which one?”
Caller: “Excuse me?”
Me: “Which computer is infected?”
Caller: “Probably all of them, but I will help you check.”
Me: “How would I know such a thing?”
Caller: “Have you ever seen a ‘This page can not be displayed’ message in Internet Explorer?”
Me: “I can honestly say I have never seen that message from Internet Explorer on my computer.”
Caller: “OK. We better check your computer anyway. Can you go to the Control Panel?”
Me: “I don’t think my computer has one of those.” (XFCE calls it a “Settings Manager”)
Caller: “I will guide you to it. Is your computer on?”
Me: “No. I just turned it off because I was told it might be infected with a virus.”
Caller: “Can you please turn it back on?”
Me: “OK, but it will take a while. It seems to be booting really slowly lately for some reason…”
Caller: “OK, I will wait.”

(a few minutes interlude while I respond to an email)

Me: “OK, my computer is on.”
Caller: “Good. Now click on the button in the lower left corner of the screen.”
Me: “I do not have a button there.” (slight lie… I have a “Show Desktop” button there)
Caller: “What operating system do you use?”
Me:“Plan 9″
Caller: “Sorry, what was that?”
Me:“Plan 9″
Caller: “…” (hung up)

So I probably went a bit overboard with choosing Plan 9 as the operating system I was running, but I was getting bored. One day I really should follow instructions and see what they try to get me to do to my computer.

Posted in General Rant on March 7th, 2012 by Allan – 11 Comments

International Rare Disease Day

I normally do not put much personal information on this blog, but given today is International Rare Disease Day and I have experience with a very rare disease, I thought I would make an exception. In fact, this disease is so rare, it often appears in lists of the top ten rarest diseases (although my suspicion is that those lists are crap… but it is still extremely rare).

My issues first started in July 2010 when I began getting ulcerations on my tongue and cheeks. I initially thought that these were caused by biting in my sleep and figured that it would go away eventually. But it did not, and when I ended up spitting out more blood than toothpaste when brushing my teeth I decided it was time to see a doctor. The doctor I saw also thought it was bruxism and sent me to a dentist. The dentist decided that my wisdom teeth were a probable cause given where the damage in my cheeks was and that they were a bit out of line. So I had them pulled out and was put on various antibiotics to resolve any potential infection that could be involved. When I went back to see the dentist a couple of weeks after the second set of wisdom teeth were removed, he took a look in my mouth and decided there was something else going on.

I then was referred to an oral and maxillofacial surgeon. She took one look at my mouth and then got her receptionist to call an oral pathologist and get me an urgent appointment. Urgent, not because she though it was going to kill me, but because it looked quite bad (basically a direct quote…). She also sent me to get blood tests done to rule out a wide variety of infectious diseases. I did find it kind of amusing that she actually asked me if it was fine to test for some STDs rather than just saying this is what you are being tested for… Anyway, unsurprisingly I was all clear on that front.

Then I was onto seeing the oral pathologist. He spent a lot of time holding out my lip and staring at it. By this time I was starting to get blisters on the inside of my bottom lip and on the roof of my mouth. On the first visit he took two hole-punch biopsies from my mouth – and they are what they sound like… Your mouth gets numbed and a “small” cylinder of tissue is removed. This is also when I started on prednisolone (but more on that later…). Those biopsies came back suggesting I had an autoimmune disorder called lichen planus. The level of prednisolone I was taking was increased but this made little difference. I am fairly certain that the oral pathologist was not convinced of the diagnosis because he did much more lip staring and decided more biopsies were needed. Those came back as general ulcerated tissue (i.e. completely non-diagnostic) and so he sent me back to the oral surgeon so she could take a larger sample. Again, this was non-diagnostic as the tissue was just too damaged to get a clear view of which layer of the dermis the blistering was occurring in. By this stage, I had started getting blistering on my skin so I was sent to a dermatologist.

The dermatologist took a look at me and decided it was most likely a form of oral lichen planus that I had. But to make sure, more biopsies were taken from my lip… As the prednisolone was not helping a lot, it was time to get me onto some immune suppressing medication. That sort of medication is quite expensive so I was brought into the public hospital system where the doctor could apply to get the medication at a greatly subsidized rate. I was started on cyclosporin in February 2011. A biopsy from my finger (local anesthetic to the hand is really painful!) and some antibody tests appeared to confirm the diagnosis of lichen planus. Some antibody levels that would indicate another auto-immune disease affecting the skin were slightly raised, but not enough to change the diagnosis as these levels would not be unexpected given all the damage I had to the skin.

Around this time I started noticing I was getting shortness of breath while exercising. As I was told, you are suppose to get a bit puffed while doing exercise… but it was different. The best I could explain it was that I was feeling wheezy. So I was referred to the thoracic department where I had breathing tests and an ECG done. From those results, I was scheduled to have an echocardiogram and a CT scan of my chest.

While this was happening, there was not much progress in the healing of my mouth, so I was put on acitretin – a drug normally used to treat psoriasis, but also shows some evidence of helping lichen planus. And things did start to improve while on both medications.

I went for the echocardiogram and, from what I now know of how a normal one goes, things were not right. The ultrasound person had their supervisor come in and I was scanned while drinking water. A few days later I received a phone call saying the echo has shown a large mass behind my heart (“fist sized”) and I really should not miss the CT scan in the next couple of days. Also they were arranging for me to be admitted to hospital right afterwards so they could arrange further treatment. At this time it was decided I would probably need an immune system to deal with whatever that mass was, and given the acitretin appeared to be working, I was taken off the cyclosporin.

The CT scan did not give a clear diagnosis about what the mass was, although it did show it was not attached to my esophagus, which was good as I knew from various seminars I attended for work that cancer there is very high on the “not a good thing” scale. While I was in hospital I had a bronchoscopy performed with biopsies taken from my lung, which did not provide anything diagnostic to why I was having difficulty breathing. There was some Pneumocystis bacteria seen at levels that were not really a concern. I was brought back in the next week for an endoscopy where they were going to punch a small hole through my esophagus to get a sample from the mass. That was aborted mid-procedure as instead of having just a small hole punched through the esophagus, a tear occurred instead. The doctor doing the endoscopy had not seen anything like that before.

It was decided to just go in and look at the mass directly and, if it seemed a good idea at the time, to then remove it. So I was scheduled for surgery a couple of weeks later, which was late May 2011. During that two week period, I got an extensive flare-up of the blistering of my mouth and what looked like conjunctivitis in my eyes. When I say extensive, it was really extensive… the entire lining of my cheeks and roof of my mouth was gone and my tongue has extensive ulceration. The best way I have of describing it is to think of the blisters you get on the roof of your mouth when you eat a hot slice of pizza. Now extend them to everywhere. I completely lost all skin on my lips and started getting blistering over my face and ears. The blistering on my hands became a lot more extensive and my fingernail beds became swollen and the base of the nails became thin to the point of not being there. I also had an itchy rash covering most of my body. My endocrine/bone doctor actually wrote on my chart that I looked “horrid” and that the issues I was having due to being on prednisolone for the last eight months (low testosterone levels, bone density dropping…) were the least of my problems. I was also starting to lose a lot of weight given I had difficulty eating anything substantial, but luckily I had backup weight so that never became too much of an issue. I spent a few nights in hospital being put on various drips and having tests done to make sure I got to the surgery in a reasonable condition.

When I went to hospital for the surgery to remove the mass, the surgeon took a look at me and became very concerned to the point where I think he was considering delaying. I think the fact that I was not going to get any better without going on immune suppression again and that it would be better if we knew what the mass was before that happened is what convinced him to go ahead (and probably my wife crying had an influence…). The surgery was successful, with the entire mass removed and leaving me with an awesome looking scar (there are 26 staples there). The doctors could not tell what the mass was when they removed it but a week or so later it came back as being Castleman’s disease. That diagnosis in itself was quite good as removal is usually curative. And while that is very rare, I can still do “better”!

It was with this diagnosis that things started to get placed together. When I saw the dermatologist next he took one look at me and admitted me to hospital. I definitely did not have lichen planus… Taking the Castleman’s into account, it was very likely I had paraneoplastic pemphigus. Another couple of biopsies from my hand and more antibody tests and this was confirmed. That antibody that previously had levels slightly elevated above normal was now off the charts so there was no doubt in the diagnosis. This was also confirmed by the eye symptoms I was having which on close inspection showed the surface of the eye eroding, which is common with paraneoplastic pemphigus.

I was going to need some quite extreme immune suppression. The short term treatment is extremely high doses of prednisolone and all its side effects… But before doctors hammer your immune system to the extent needed, you are checked for every infection they can think of. The infectious diseases team came and saw me and asked questions about my lifestyle that I never think I will be asked again! Anyway, I was once again cleared of all infectious disease tested for. The only concern was the bacteria observed during the bronchoscopy as it can cause a type of pneumonia in people with reduced immune systems. So once a treatment for that was sorted out (because I am potentially allergic to the usual medication), I was back on immune suppressants; this time mycophenolate. After a bit more than two weeks in hospital, it was decided that I no longer needed daily testing and I could manage my treatment at home.

I was out of hospital for a couple of weeks and then had my lungs tested again. Since my previously measurement, there was quite a substantial drop in lung function (for example, the FEV1 measure was now around a third of the expected value). Combined with the diagnosis of Castleman’s disease and paraneoplastic pemphigus, this lead to the diagnosis of bronchiolitis obliterans, which takes the entire situation from being awful to life threatening. In bronchiolitis obliterans, the small airways in your lungs become scarred which prevents the flow of air through them (from what I understand, it is mainly the outwards flow that is affected). I describe it as being like having a permanent severe asthma attack, although that might be entirely incorrect medically.

So it was back to hospital for another two weeks while the best course of treatment was decided. Bronchiolitis obliterans is irreversible, so the best that could be hoped for was stopping the decline in lung function. The immune suppression I was already on is a good start at controlling this, so it was doubled. That also allowed the dose of prednisolone I was on to be dropped quite a bit (I was on 75mg a day, which is a very high dose, for over a month and I had all the usual side effects – moon face, rapid weight gain particularly around the stomach, severe acne, mood swings…). It was also decided that I should do a four week course of Rituximab, which is a type of chemotherapy, but one that specifically destroys B-cells so you do not get side-effects people tend to think of with chemotherapy. I am also given a dose of IVIG monthly.

While this was going on, I was referred to a lung transplant doctor. With how my lungs are, there is not much room for further damage to be done before I would have significant difficulty doing every day tasks. There is only one case in the literature of someone having a lung transplant due to the follow-on effects of Castleman’s disease, so there is not much information to go on. The summary of my meetings with the lung transplant people was that I would not be a good candidate if my condition continued getting worse because there was nothing to say that my immune system would not just destroy the “new” set of lungs too. But if my condition stayed stable, I would have enough lung function to not warrant the risk of having a lung transplant now, particularly because living ten years with a lung transplant is a very good success. So ideally, the progress of my lung function decline due to the autoimmune condition would be halted now and I would only require a transplant later in life when the effects of the natural decline in lung function hits me earlier than most people because I will be starting from a worse base.

As my lungs no longer work very well and the sitting around in hospital and at home recovering did nothing to help my fitness, I was sent to a pulmonary rehabilitation program. This is a combination of cardio training and muscle building (as the fitter you are, the better you can handle low oxygen levels) and education (e.g. in how to manage shortness of breath, nutritional advise, some group counseling). Regaining fitness is particularly difficult when you have difficulty breathing on any moderate exercise. An interesting thing that I found out (although is really quite obvious when you think about it) is that the large muscle groups in your legs require a lot of oxygen, and they are used in everyday activities, so strengthening them can help you coping with shortness of breath. I also found out that a side-effect of being on high doses of prednisolone is muscle atrophy (wasting) so that would not have helped me in that regard.

And that about sums up where I am up to now. My lung function tests over the last six months have been quite stable so it looks like my current medication regiment is working. I have also noticed some improvement in my ability to do things like walk up a set of stairs without becoming short of breath, but I still have difficultly walking up hills or even walking fast on the flat. Hopefully keeping up with the exercise routine I am doing will see some more improvement, but there are really no guarantees there. My skin issues have mostly cleared up, leaving only a couple of small ulcerations on my tongue. The surface of my eyes also healed, but I am left with extremely dry eyes and have to continuously put in eye-drops. The only new issue I have had lately is an increased resting pulse rate (compensating for a lack of oxygen getting to my bloodstream). But multiple scans of my heart show there is no heart disease or any other issues so that is not too bad.

What can you do to help? There is not a lot that can be done for me personally, but I recommend the following:
1) Support medical research for rare diseases. Rare diseases are hard to diagnose, hard to treat and, as someone who does medical research, I know they are near impossible to get funding to do research into. If you see someone collecting for research into a rare disease and can spare a bit of money, give a donation.
2) Donate blood if you can. The monthly treatments of IVIG I receive comes from the plasma of a large number of donors. And like all blood products, there is a greater demand that what is donated, so help out if you can. Needles are not all that scary…
3) Sign up to donate your organs. The number of people needing organ donations far exceeds the number that donate. Your organs are not that much use to you once you are dead and with more people donating the organ matches will be better and the success rates higher. Also, tell your family that you want to donate your organs as with the current laws in most countries they will get the final say. I have always supported the idea of changing the law to make donation an “opt-out” process rather than the current “opt-in” and even removing the families right to override your decision.

And probably being more optimistic than anything…

4) Support stem cell research. I do not think the approach of “inject stem cells and hope for improvement” will work in my case but the growing of new organs from an individual’s own stem cells is a promising area of research and it would completely remove transplant rejections. Making a set of lungs would be very difficult, but recently a person had their trachea replaced with one built artificially from stem cells, so progress is being made.
5) Support artificial lung research. If I can not get a genuine pair of second-hand lungs in the future, then I will settle for being part machine. That would be cool!

Posted in General Rant on February 29th, 2012 by Allan – 3 Comments