Bitch Lands!

bitch3Playing Magic is always fun, but sometimes you have to make it even more fun. And how could you do that any better than adding your own custom stuff to it? Of course, you are not allowed to use home-made/custom cards but for a round of kitchen table magic me and my playgroup agreed that it’s perfectly fine to add some beautification to simple cards such as basic lands. I really liked some of the older artworks and the new Zendikar Expedition land frames. Sadly you can not get both in a single card from Wizards of the Coast, so I made them myself.

(more…)

Fixing Gimp’s “green antialiasing” bug

 Recently I ran into a strange bug: Adding (white) text to an image in Gimp 2.8 adds a strange green border to the text for as long as antialiasing is turned on. Well turning it off is definitely not an option and workarounds like creating a floating selection from the text to fill it with the desired color is so bad, i wouldn’t even call it a workaround…

(more…)

Tablet testing for humans.

Today i am little short on time, so I think this article is perfect. I recently got three high-end tablets devices for testing purposes and I want to share my thought on them with you guys. The tablets I was testing were all Android-based and since you can check out plain technical specs nearly anywhere on the web, I am going to focus on the usability parts.

(more…)

Junkblade for weekly casual Magic

Once a week we meet to play a few matches of (pretty casual) Magic. This week I am going to bring a mix of Junk/Stoneblade to the board. Check out this post to get the list.
(more…)

Minimalistic tattoo tokens for Magic

If you are playing Magic: The Gathering, you will know that you sometimes need tokens to represent basic creatures in the game. And yes, there are official ones but you might be bored of them (although I really the recent Goblin tokens from KTK…). If so, you should have a look at the tokens I created for our playgroup.

(more…)

Bitshift Mayham

Recently I ran into a problem while extracting a IPv4 netmask from an IPv4 address in CIDR slash notation. My idea was to make use of bitshift. Since an IPv4 addresse is 4 bytes long it can be considered as an C++ integer. The following approach seemed promising:

If you left-shift a 1 n times, you get a 1 followed by n zeros. Now substract 1 to invert the result and you got the netmask. This seems to be working as the following example shows. Let’s say we want to generate the netmask of a /8-network:

However this seems to fail if the bitmask equals 32. Actually one would expect a result of 1, but the computer returns 0: (1 << bitmask(32)) - 1 = 0
This can be fatal. Just imagine passwordless login to your server for anyone from the machine which would be a /32 network …

Another funky thing: If you replace “bitmask” by the hard coded number 32, the result will be correct (netmask = (1 << 32) - 1 = 0xFFFFFF). This seems broken…

A look at the generated assembler code reveals that it’s actually working (stripped down to the relevant part for the ease of understanding):

Seems valid. So what’s going wrong. Well, Intel reveals the answer (IA-32 Intel Achitecture Software Developer’s Manual):

The 8086 does not mask the shift count. However, all other IA-32 processors (starting with the Intel 286 processor) do mask the shift count to 5 bits, resulting in a maximum count of 31. This masking is done in all operating modes (including the virtual-8086 mode) to reduce the maximum execution time of the instructions.

So it seems that all processors since the 286 do not allow a shift count greater then 5 bits, thus resulting in a maximum shift count of 31!
My further investigations showed that the compiler’s optimizer generates SAL instead of SHL instructions. So not only is the result of a SHL undefined (under certain conditions, as stated in the C language standard) and should not be relied on, but also it’s maximum shift width is 5 bits.

Damn. Lesson learned: Read the docs

Hot-swapping SCSI-devices in linux

Recently I often had issues with failing hard disks. And sadly, it isn’t even something special. At first I didn’t mind too much about it but the older the drives became, the more recently the hard drives died. During the last weeks they started dying by a daily rate. Oh hardware failures are so annoying. Walking all the long way down to the darn cold server room, put a new drive in a frame, plug out the old drive, put in a new drive. So far I won’t be able to change something about it. And then…reboot the machine. On the internet are people being proud of their machines rebooting in a few seconds from BIOS to Windows, but the machines I have to use do certainly not offer a chance to be proud of them. Booting takes ages. Around 5 minutes I’d say. And yes, I have to stand right there and check that the new drive works. What a waste of time. Since the hardware theoretically supports hot-plugging, I thought I could at least get around the last step – and thus save me roughly 5 minutes of time and certainly a terrible cold – if I manage to hot-plug the device not only theoretically but practically.

(more…)

Resources in Magic: Card Quality

I recently played an enemy that constantly complained about me being so lucky and always drawing the right card when I need to. Well, this made me think. He was right, I usually got the cards I needed but I don’t think it was all about being lucky. I just was able to constantly improve the quality of cards I was going to draw, of the cards in my hand and finally the amount of cards I was going to draw. I was simply able to use my card resources in a more efficient way.

(more…)

Linux & Ralink’s RT5392

Last weekend I visited my parents. And as always, they had some computer stuff to fix for me. Something with the printer which wasn’t printing. Ok, the printer was fixed quite quickly but while I used that Notebook I really thought I could need some updates. The installed OS was Ubuntu 10.04 “Lucid Lynx” which is around 2 years old. Well, Ubuntu can do release upgrades pretty comfortable via one simple command, so hey, what could possibly go wrong? It turns out: Wifi can.

(more…)

dwm on duty ‒ Part 2

Ok, so last time I wrote part one of my mini series of how I switched from XMonad to dwm. Following today is – and what else could it be – part two. As promised, this post will explain a bit more in detail how dwm is meant to be extended and what patches I am currently using.

(more…)