The best kittens, technology, and video games blog in the world.

Monday, June 09, 2014

UK income tax bands

Presenting His Royal Highness King Milo the First! by Malingering from flickr (CC-NC-ND)
You'd think that a question like - what are the income tax bands and rates in UK - would have an extremely straightforward answer you can check on government websites or Wikipedia. And you'd be wrong.

Between income tax, National Insurance (second income tax), and personal allowance phaseout the rates are nothing like what they seem at first (20%, 40%, 45% - yeah right).

Here are the rates I calculated:
  • £0-£7955 - 0%
  • £7955-£10,000 - 12%
  • £10,000-£41,860 - 32%
  • £41,860-£41,865 - 22% (yes, it's a £5 wide tax band)
  • £41,865-£100,000 - 42%
  • £100,000-£120,000 - 62%
  • £120,000-£150,000 - 42%
  • £150,000+ - 47%
In other words - WTF?

The tiny 22% tax band is an artifact caused by the primary income tax being calculated based on annual income, and the second income tax based on weekly income. Assuming 52 work weeks a year, their bands are just slightly misaligned, but if you work fewer weeks a year, this band can widen and you could be paying a lot less in taxes. I'm not entirely sure how that works in practice.

Conversely, 12% band is due to much larger misalignment between two income taxes, and it could widen a lot if you have high weekly wages, but work less than full year, so you'd end up paying no income tax, but lot of NI.

Even weirder case is the 62% band. It's regular 40% rate + 2% NI rate + 50% reduction of personal income allowance which gets retaxed from 0% rate into 40% rate, which is de facto third income tax of 20% applicable only for income between £100k and £120k.

Now, there are many legitimate arguments against income taxes in general, including:
  • high income taxes (especially that 62% rate) generate serious disincentive to work
  • taxing annual income means self-employed people whose income changes from year to year end up paying a lot more than people with stable income
  • taxing income instead of wealth means rich people can technically have low "incomes" and pay very little, while people with just salary and no wealth whatsoever and paying a ton
  • tax bands make no adjustment for cost of living depending on region - so a person living in London will end up in higher tax band at standards of living much lower than a person living in the middle of nowhere - resulting in another way how London subsidises the rest of UK
  • bankers making millions are probably all paying much lower rates than the middle class since they can hire some tax avoidance lawyers and there are convenient tax shelters located just next to the UK.
But even ignoring all that, why the hell can't we just fold three taxes all into a single tax, with monotonic bands?

In all these calculations I'm ignoring 4th income tax - employer's NI contribution, as it's technically not part of gross wages, even though economically it doesn't matter what numbers are printed on the payslip, only how much employer pays before taxes, and how much employee receives after taxes.

And a bonus question for behavioural economics exam: Would marginal income tax rates be more or less disincentivizing if people have no idea how much tax they're paying because taxes are so damn complicated?

Monday, June 02, 2014

Fun and Balance minimod for EU4 1.6.1

Wild Kitty 5, 30 May 14 by Castaway in Scotland from flickr (CC-NC)
Here's updated version of the Fun and Balance minimod. 1.6.1 introduced a lot of changes to the game, unfortunately also breaking it in half. Here I'm trying to salvage whatever is good about it while fixing the rest as much as possible.

The goal of this minimod is not to make any sweeping changes - just do the least necessary to make the game balanced and fix unfun mechanics.

I sometimes feel I do more balance playtesting of my minimod than Paradox does of their patches (as in - some is more than zero).

Download link.

New changes in this version

  • Coalitions - previous versions of the mod removed them, but I'm going to keep them this time. AE levels got totally rebalanced, and they seem to be much less excessive, so it might be worth a try. If they turn out to be still broken, AE could be tweaked, or they could just go away completely again.
  • Free relations increased from 4 to 8 (previously 6), all bonuses which got nerfed from +2 to +1 in the patch back to +2. Even increased it was pretty low, and the patch makes acquiring and keeping vassals more expensive than before.
  • Diploannexation costs reduced from completely ridiculous 15/bt to 1/bt
  • Cost to move primary trade port reduced from 300 to 100 dip, mostly because so many countries start with misplaced trade ports (and moving capital is only 200 adm)
  • No diplovassalization base tax cap - since penalty is quadratic in size, it's very hard to abuse this.
  • Muscovy/Russia does not get free colonist from national ideas. They got massive boost by annexing Perm a lot faster, which ends up in them colonizing all of Siberia much earlier than in previous patches. This somewhat balances that out, but even with the nerf Muscovy is still way too strong way too early.
  • You don't need any idea groups to reform tribal government, just 200 adm, 90 legitimacy, and +3 stability. Forming Mughals / Qing / Persia also reverted to not require reformed tribal government. It was already extremely hard for AI to do that.
  • Pirates who annoyed me so much are no longer there, replaced by the new privateer system! (well, if you have all the DLCs at least)

What I couldn't fix about the new patch

I wanted to make diploannexation to take longer (that why I want it cheap and with high limit - so you keep more vassals longer instead of mass annexing them ASAP), but that's hardcoded. This isn't really a huge deal, and if annexing vassals turns out to be too easy vassal annexed diplomatic penalty can simply be tweaked higher to make things right.

I also wanted to allow wider selection of rivals, but that's hardcoded as well. I really like power projection system, the only problem with it is how narrow and forced rival selection is. If you could choose from more potential rivals, it would be really good, but right now it only gets halfway there.

Previous changes

Detailed explanation in older posts - 1.5.0, 1.5.1.
  • Buildings level 1-4 not destroyed on change of ownership
  • Important religious center penalty reduced from -5% to -2% missionary chance
  • Steppe Horde bonuses increased to +100% manpower, +100% land force limit, -50% land maintenance.
  • Non-accepted culture penalty increased from +2RR to +4RR - this might be too much with new nationalism system
  • Can't reduce war exhaustion while at war
  • No naval attrition due to time at sea at any tech
  • Cleansing of Heresy CB doesn't allow any province taking, but allows forced conversion at 25% cost
  • Imperial Ban CB only generates 10% AE for illegally held provinces
  • EU3 style republican elections (3 random candidates + incumbent, no skill changes or tradition loss on reelection)
  • No Burgundian inheritance events
  • High OE events increase with OE smoothly instead of massive cliff at 101% OE
  • Foreign rebel support increased to 6% (3% in old patches, 4% in current patch)
  • Accepted culture gain/loss thresholds both 10% for greater predictability
  • Monarch point pool increased to 1500 to reduce tech micromanagement
  • Culture change cost reduces from 25/bt to 10/bt
  • Cores and claims last twice as long
  • Coring time does not depend on size (supposedly new patch already does it)
  • No protectorates, can vassalize anyone
  • Vassals allowed to fabricate claims
  • Vassals will buy provinces from overlord if they would as independent countries (it seems new patch already has that)
  • Vassals will buy provinces up to 50% OE just like independent countries (limit was bugged in previous patch and they'd buy at any OE)
Enjoy. I fixed what I could, but for truly balanced experience we'll need a lot more modding support from Paradox.

Saturday, May 31, 2014

Bechdel test and Magic: the Gathering

Warning: Do not treat this post seriously.

Bechdel test is a famous test for female presence in movies, but it can apply just as well to any other work of fiction.

So I had this thought - Wizards of the Coast has pretty good reputation when it comes to gender balance in their storyline, but how well would actual Magic: the Gathering decks do at passing the Bechdel test? So here's the equivalent test for decks:

  • It contains cards representing at least two female characters - creatures, planeswalkers, or spells clearly featuring female characters in name, art, and/or flavor text (multiple cards representing the same character like Chandra, Pyromaster and Flames of the Firebrand only count once); the character does not have to be named or human (but it should generally be some kind of humanoid at least)
  • which interact with each other
  • and the interaction is not about some man (like both counting as devotion to the same male God)
And let's now evaluate a bunch of decks.
The deck is one big sausagefest - all of its creatures are either male or monstrous and of unspecified gender, and their only interaction is being devoted to Erebos, God of the Dead and his Gray Merchant of Asphodel.

The only female presence in the deck is an occasional Pharika's Cure sideboard, but that card doesn't really count since it actually shows Solon, (male) acolyte of Pharika, and even if it did it won't be curing any of course creatures.

Score: Fail. (and its Bg and Bw variants aren't any better)
The central character in the deck is Thassa, God of the Sea, and some of her supporting characters like Tidebinder Mage and Hypnotic Siren are female as well, and between their devotion, and Thassa making them unblockable and helping them with her Bident, interactions are pretty strong.

Score: Pass.
This deck depends on the build. The deck is very light on creatures, and central two characters are Elspeth, Sun's Champion and Jace, Architect of Thought. Other popular characters are Aetherling, Nyx-Fleece Ram, Mutavault - none of them female.

The deck occasionally plays sideboard Archangel of Thune, and Elspeth's ultimate sort of interacts with her, or Archangel's ability can help Elspeth's soldiers (but not Elspeth herself). This could count if Archangel was a common mainboard card, but it feels too weak.

Score: Fail (some builds arguably weak pass).
The deck doesn't feature them directly, but Chandra and Aurelia both feature in art of many cards.

Cards in the deck rarely interact with each other, other than by all burning opponent's face, but Warleader's Helix bringing back Chandra's Phoenix from the grave technically counts. 

Score: Pass.
People were totally obsessed asking if Domri Rade is a boy or a girl, but word of god is that he's a he - it would have made matters simpler if they decided otherwise, since Domri interacts with every creature in your deck, but let's look at the rest of it.

Sylvan Caryatid and Courser of Kruphix seem female, as far as I can judge plant and centaur anatomy, and Caryatid can tap for mana to cast Courser, which is a fairly weak interaction.

Looking at sideboard, the deck sometimes features Nylea's Disciple, Vraska the Unseen, and Chandra, Pyromaster. Nylea's Disciple interacts with all your green cards via their shared devotion to Nylea, God of the Hunt, and Chandra's synergy with Courser of Kruphix is just amazing.

These interactions aren't very strong or involve SB-only cards, but there's lot of them.

Score: Pass.
This deck is just filled with creatures but except for Thrill-Kill Assassin (also knows as Massacre Girl) none of them are women.

Score: Fail.
The deck features Bassara Tower Archer and Gladecover Scout, but the very point of the deck is that they're hexproof and don't interact with anybody ever. They only make exception for Ajani.

Score: Fail
The deck generally includes Pharika, God of Affliction, and all the creatures in it are devoted to her, and she returns the favour by turning their dead bodies into poisonous snakes... People can be weird like that sometimes.

Some builds try to work without Pharika, and while there are some minor interactions, I'd say they generally fail the test.

Score: Pass (for Pharika builds).

Summary

Of decks I checked 4/8 passed. That's honestly a lot more than I expected.

While I was checking various decks another thing became clear - while other colors have decent cast of female characters, black seems to be very heavily male-dominated. Think of it what you will.

Friday, May 30, 2014

Gain more time by consuming media faster

TJ by mag3737 from flickr (CC-NC-SA)
Pretty much everybody spends inordinate amount of time consuming various forms of media. In the era of TV and paper books you had very little choice about the pace at which you can consume the media, and they were designed with low speed so that even people who process things more slowly (like all the old people) could handle it.

Fortunately we moved way past that era, and now you can simply speed things up.
  • For podcasts / audiobooks, your mp3 player (here's one I use) probably already has a function to speed things up. Use it.
  • If it doesn't, or it provides insufficient control, you can also use external utilities to adjust speed. I wrote a really simple one for OSX / Linux. 1.4x speedup is a sensible default for me.
  • For youtube videos, first download them (also saves you all the time waste of youtube UI), then play them in any video player which supports faster playback, like mplayer. For artsy stuff like movies 1.2x is probably the most you want before it starts to derail artistic intend, for informational stuff like news and let's plays 1.4-1.5x is fine.
  • If you want to watch on your phone, there are player for that too. (YMMV here, DicePlayer did some crashing for me, so feel free to recommend any alternatives)
  • Ebooks are typically faster to read than paperbooks due to less physical manipulation necessary.
  • Audiobooks might not be as fast than paperbooks/ebooks, but there's a lot more time a typical day when you can't really read a paperbook or ebook, but can listen to something, which is another way to increase your media consumption speed. Make use of all the commuting / shopping / waiting for tests to finish time. A big problem with that kind of segmented time is that books which were not designed for it might be really difficult to keep track of what's going on, since you're basically reading a few pages at a time. Most podcasts, lectures, and other nonfiction work perfect, as does quite a bit of fiction depending on writing style.
  • If you spend a few hours a week doing low/medium intensity exercise (as recommended by the doctors etc.), it's often possible to setup some audiobook or (for stationary exercises like treadmills) some relevant video to keep your mind engaged. Even if you exercise in the gym and not at home you can probably bring a tablet and wireless headset with you - something which was not realistic even just a couple years ago. It depends on what kind of exercise that is, and if it requires high intensity or high focus just stick to music for your safety. 
  • Speeding up video is straightforward and doesn't cause any issues. Many simpler and older methods for speeding up audio alter its pitch, which takes some getting used to, but is really not a big deal. Mplayer speeds up any audio or video without altering pitch - you'll still hear some distortion at 1.5x or faster speeds.
That's going to save you so much time which you'll be able to use to do amazing things you never had a chance to, right? Well, not quite... You're most likely just find a lot more new fun media to consume instead, ending with as little time as you had before, but once you speed things up going back to "normal" speed is like going back to Internet with ads on it.

Enjoy.

Saturday, May 24, 2014

Medieval 2 Total War Concentrated Vanilla on github now

Caithlin resting by Finn Frode (DK) from flickr (CC-NC-SA)
I did a bunch of fixes to mod builder:
  • The mod builder searches in a few standard locations for game installation in addition to checking Windows registry
  • included cheri gem manually updated to work with Ruby 1.9/2.0 syntax, so it's now compatible with new versions of JRuby
  • concentrated_vanilla.reg file included so you can tell Steam launcher about the mod even if mod builder doesn't work for some reason
and uploaded it to github together with all the history.

The mod itself didn't change in any way.

Friday, May 23, 2014

Why I'm not voting in the 2014 European Parliament elections

Snow White helps out (2012), 5 by Finn Frode (DK) from flickr (CC-NC-SA)
All the choices are unacceptable, and there's not even a protest vote option.

Pro-euro parties guarantee Eternal Recession

Polish mainstream political establishment (all the way from far-left to center-right) is pro-EU to the degree that everything EU does is thoughtlessly accepted as amazing - and completely ignores all the genuine problems EU suffers from like creation of eurozone and lack of any real democratic accountability.

Euro was the single biggest mistake in the history of EU, and either abolishing euro or replacing ECB with something less disastrous are the only ways EU can ever exit its eternal recession and return to healthy economic growth.

In case you need the background - unlike most other central banks which are changed with keeping the whole economy in good order, European Central Bank has single mandate of "price stability", and by design is meant to ignore everything else about the economy. To make matters worse while "price stability" was traditionally understood to mean core (excluding highly volatile prices like food and energy) inflation of about 2%, ECB reinterpreted it to mean "as close to 0% inflation as possible". The last time core inflation was over 2% was in 2003, so ECB was not doing its job properly long before the crisis, and since then it's been a total disaster.

Such single-minded focus on inflation is a recipe for turning any kind of economic difficulty into an endless recession with ever-increasing debt levels and massive unemployment (which by unemployment hysteresis becomes pretty much permanent), which is exactly what happened.

Regardless of their mandate, all other central banks in the world have some kind of democratic accountability - if they're screwing too hard their mandate will be adjusted or central bankers replaced. This occasionally resulted in politicians intervening in monetary policy directly, so central banks typically balance this with some degree of operational independence, but ECB got the level of independence so extreme that they are completely unaccountable to anybody - it's just a dictatorship by committee deciding the fate of European economy.

Eurozone is also a horrible as an optimal currency area - without local currencies or capital controls capital flows freely between banks of different countries, which would be perfectly fine if some kind of banking union existed. Instead governments of each country implicitly guarantees private debt of all banks within their territory, with even a suggestion of creditor haircut considered a heresy.

This is a recipe for exactly the kind of disasters we've seen during the Great Recession - German banks lend ton of money to banks in eurozone periphery with no regard for risk, then when things got tough periphery countries became accountable for 100% of these risky loans (with their citizens never being consulted on any of that - if there's one thing EU bureaucrats hate the most, it's any kind of genuine democracy), which required massive austerity, which together with massive capital outflows led to the level of economic deterioration which made debts completely impossible to repay.

Any kind of common sense relief - like banking union, fiscal transfers, bond haircuts, accepting higher eurozone inflation, bonds guaranteed by all of eurozone members, letting insolvent banks fall without government guarantees etc. - are all instantly rejected by the EU bureaucracy, and EU bureaucracy has absolute control over eurozone monetary policy, voters be damned.

The only countries which came out relatively well out of recession were ones outside eurozone like Poland and UK, and ones who basically used it to steal money from the periphery countries like Germany did by forcing them to guarantee private banking loans.

And imagine that - half of Polish political parties want Poland to join euro. Even if this recession ends somehow, and so far nothing suggests that it ever will (Japan's lasts over two decades now with no end in sight), current structure of euro pretty much guarantees another, most likely even worse.

It would make some sense in Latvia maybe - 20% unemployment is not so bad compared with Russian tanks, but for Poland adopting euro would be an unrecoverable disaster.

Anti-euro parties are all basically crazy

Between Smoleńsk and Korwin... OK, that was a cheap shot, but the right wing side of Polish politics took a massive turn into crazy direction lately. Even Korwin used to be a useful voice of dissent in early 90s back when he was just a low-government libertarian instead of going basically full neoreaction.

Even ignoring the crazies and the nationalists, the only people who don't think everything about EU  are ones who want to pretty much dismantle the whole thing, and kick out all the foreigners while they're at it.

There's nobody who wants to turn EU into something workable - which at a minimum means ditching euro in its current form, and introducing an order of magnitude more democratic accountability than it currently has.

Does that mean I'm never voting again?

Not really. It makes sense to vote in elections to European Parliament based on policies parties have towards EU issues, since that's what they'll be doing. In national elections, domestic issues matter a lot more.

Not voting is a totally legitimate choice in any elections. When all choices are horrible, and my vote matters very little (since European Parliament has very little power), there's really no point in endorsing one or another of the horrible choices by voting for it.

To double check my decision I took the quiz on Latarnik Wyborczy website - and it seems I disagree with every single political party pretty much equally. Give it a try as well, maybe you care about other matters and don't consider euro or Smoleńsk as nonnegotiable issues like I do.

Saturday, April 19, 2014

Fun and Balance minimod for EU4 1.5.1

Kawaii ne? by KayVee.INC from flickr (CC-NC-SA)
Here's just a slightly updated version of my Fun and Balance minimod.

Changes:
  • all files updated to 1.5.1 version
  • non-accepted culture penalty scaled down from +5RR to +4RR (vanilla has +2RR). It was just a bit too much.
  • religious center missionary strength modifier down from -5% to -2%. That's a modifier Rome and Mecca got around 1.4 patch, I hate it, and I'm really tempted to just kill it completely, since it makes Rome close to impossible to convert even with very big stack of positive modifiers. Rome has such a high base tax (which only grows as game goes), and such a small and unlikely to be accepted culture, that it's very difficult to convert anyway, even without this penalty. Mecca has lower base tax, more common culture, but it's Sunni for an extra penalty, so it's also pretty hard to convert. Why either of them needs such extreme penalties to switch makes no sense.
Everything else worked sensibly, so I'm not introducing any major changes. Perhaps larger rebalancing will be due once 1.6 is out, we'll see.

Beeminding the unbeemindable

It's going to be pretty awesome a couple decades in the future when all this will just be common knowledge, but we're just starting all this and we all need to go through the process of discovery what works and what doesn't individually.

And we should definitely hold ourselves to a much higher standard than "doesn't suck any more than it would otherwise". It's a good thing I don't have that particular problem, for which I don't really have a good solution, and I'm perfectly aware how poor track record of all existing "solutions" is when they are put to actual rigorous trial.

Anyway, as I said before, things that have good beeminder goal and measure go well and quite reliably so for me, but everything else - well, sometimes it does, often it doesn't. And I have a huge number of extremely important projects I need to keep pushing forward, and many of them haven't been moving as much as I'd like. Of course I can take the nuclear option of just dropping everything and taking a few months off mo get things I want done, but it's a good idea to try a few less drastic courses of action first. And for that matter to make sure if I ever go all the way, it will be highly efficient use of my time.

Idea #1: Per-project measures. One way would be to setup twenty or whatever number of measures, one for each project, but that's a ridiculous overkill, especially on beeminder which doesn't work that amazingly for things that move forward less often than once a week. One sort of workable thing would be to setup tracking for top 3 projects, and for the rest, well, "it won't suck any more than it would otherwise". I never seriously attempted that, and even beeminder discourages having too many beeminder goals.

Idea #2: Tracking time. What I actually tried at first was getting pomodoro timer and counting time spent on any project on the projects list, with beeminder target. This was a miserable failure, since time has very little relationship with progress, and such system just assumes single-tasking and no interruptions - both things which are just completely incompatible with my reality. It was a miserable failure for me.

Idea #3: Track everything. For this I skipped beeminder, since I wanted tracking, not necessarily a target, at least not initially. Everything, on my lists or not, which changed state of the world in direction I wanted, got a +1. It was extremely broad definition on purpose, and I did it for a month with +163/day average. And things were sort of moving forward fast, just not the important things. I'd say it way not very successful, and I don't think adjusting point criteria or explicit target would make much difference.

Idea #4: Priority tasks. Finally I took the opposite approach, lowered all other beeminder targets by about 1/3 to make sure I have time for it, set up a very short list of extremely high priority tasks, with a target of 1/day. 3 weeks later, it's not amazing, but it's been working considerably better than any of my earlier attempts, which were total failures. My first idea was to limit the priority list to just 3-5 items, but it has tendency to grow, and I have to trim it back regularly, moving things back to regular todo lists.

That's it for today. No real solution, but I hope my self-experiments will be useful to others as well.

Sunday, April 13, 2014

Zombie Survival Guide review

I feel a headache coming on! by ucumari photography (Valerie) from flickr (CC-NC-ND)
I was really happy to get my hand on a book that claimed to be a compendium of knowledge necessary to survive close encounter with the living dead - The Zombie Survival Guide: Complete Protection from the Living Dead by Max Brooks. Unfortunately while the guide has many good points, it also commits far too many mistakes to be a reliable source, so I feel obligated to write this review and refutation, which will hopefully prevent countless unnecessary deaths by naive civilians trying to follow flawed advice.

Zombie Science

The book nearly implies without stating it outright that zombies violate Law of Conservation of Energy. Let's get serious here - zombies don't feel tired, they don't feel pain, they don't waste energy on all the functions necessary for long term survival of the body, so they can keep going far longer than a human, and it might seem to a naive observer that they can go forever, unless they rot away away.

This is of course a total nonsense, a captured zombie could be used to build a perpetual motion machine by just keeping in environment where body rot is unlikely. All zombies will run out of energy eventually. Assuming an average human is 80kg, 60% water, 20% body fat, 20% lean mass, and uses 2500kcal/day, that person will be left with literally not 1 gram of tissue in their body in 83 days. Even if we assume zombies can be far more efficient by shutting down nonessential body functions, a lot of this mass is still necessary for structural purposes. There's pretty much no way a zombie can remain active for more than a few months - not years like the author frequently claims.

A zombie could plausibly remain in a semi-dormant state for much longer, but visions of multi-year zombie sieges author sometimes draws need to be treated as fairy tales. If you can survive 3-6 months, you're basically saved.

The author makes other claims about zombies - that they're slow, clumsy, can't climb, can't throw things, can't use tools, can't coordinate, are not afraid or aware of fire and so on. These should be treated with caution. They might be true of a typical zombie, but how confident are you in risking your life on a bet that zombies you're facing are of the most vanilla variety? Different people had different abilities in life, and while zombification definitely generated massive brain damage, what was left might just be an exception. So prepare accordingly, but always have a backup plan just in case.

Weapons

It's hard to describe advice about weapons given by the book as anything less than ridiculous. It's centered around use of silencers and long distance headshots. Both aspects are completely ridiculous.

Contrary to Hollywood portrayals, "silenced" weapons are still quite loud - and if zombies are attracted to slightest sound like the author portrays them to be (advising not even talking loudly just in case zombies might overhear that), any use of silencers is completely futile. And for untrained civilians able to reliably shoot a (even slowly) moving target in the head from long distance while shitting their pants? Such attempts are just the best way to waste all your ammunition.

Fortunately there are far more realistic solutions to the zombie menace - like shotguns. Sure, they are loud, but your chance of hitting zombie's head from a short to medium distance when your life is in danger is far better than with anything else unless you had years of training.

And contrary to author's claims, I would not completely ignore all targets except the head. Severed zombie head might be dangerous for a while, but your priority is survival, and it won't chase you. Mobility kill is good enough to save your life. Any hit that severs spinal column, shatters limb bones, breaks major muscles, and so on can ensure the zombie thus hit will not be following you. That's why grenades, molotovs, and all kinds of explosives are your friend. Of course the author is right - don't be stupid and approach the immobilized zombies, but your priority should be survival, not being a hero.

What to do if you have no firearms? If you had adequate training and quality equipment available, a polearm or a sword might be very viable - but let's be serious here, that's even less likely than sharpshooter training. If you have nothing better available, improvised spears are relatively easy to make, and can be adequate protection of last resort - they were used successfully for thousands of years against much bigger, stronger, and faster wild animal, than a stray zombie. Anything shorter like improvised knives and swords, baseball bats, hatchets, crowbars, and so on leads to far too great risk of infection even if you manage to eliminate the attacker, so only use in real desperate situations.
Abby contemplates the meaning of string by DirtBikeDBA (Mike) from flickr (CC-NC-ND)

Armor

The best thing you could possibly get, if your budget is unlimited is a shark suit. It costs about $5000 and protects from shark bites. Zombies have basically human anatomy, and any armor that protects you from sharks will also definitely protect you from zombies with a huge margin of safety.

If you don't have that kind of money to spare, or zombies caught you unprepared, you should still try to armor up. Any kind of motorcycle helmet and heavy leather clothing (of the kind bikers wear) will offer at least some degree of protection from zombie attack. It's not going to make you invulnerable of course, but every little helps.

Short Term Survival - Get on the Roof

I feel the book covers that well - just get on the fucking roof, and get rid of the ladder. Zombies can't use ladders, can't climb, and even struggle with staircases, so heigh is your saviour.

I'd put much more trust in doors than the author. Plenty of doors are flimsy and will fall in minutes to even a single zombie, but depending on where you live, heavy fire doors routinely installed in all new buildings can stop zombies just as well as fires. Not forever perhaps, but your priority is not to die now. Time is on your side, and even if hundreds or thousands or zombies might be in the neighbourhood, they can't all try to break the doors at once due to physical constraints and zombies' lack of coordination.

Hopefully you'll only need to survive for a few days, and then help will come. But what if help doesn't arrive?

Medium Term Survival - Zombie Demographics

The author inexplicably ignores demographics of zombies, but that's the key to your medium term survival. There are currently about 47 humans per square kilometer. Even in the worst kind of outbreak, where very few people survived, most will likely die without turning into zombies, and every day, significant percentage of zombies will die to delay, loss of energy, accidents, human resistance and so on. Within weeks their numbers will fall real low - even in apocalypse scenario after 3 months it's difficult to imagine more than 1 zombie per square kilometer worldwide, falling to maybe 0.1 per square kilometer after 3 more months.

So what do you need to do? Get the hell out of the city. A single zombie or a handful is not very dangerous, and in the countryside that's the most you're likely to encounter. It's only in densely populated urban areas where you're likely to find literal hordes.

In apocalypse scenario, you won't really have to worry about food and supplies - zombie numbers are falling rapidly, and any store will have huge amounts of nonperishable food for the few survivors. Store trips are extremely dangerous places in the first days of the outbreak, especially for stores located in more populated areas, but a couple weeks or months in, in broad daylight, with prior reconnaissance and cleanup of the surroundings, it's manageable level of risk.

Long Term Survival - Rebuilding Humanity

It's exceedingly unlikely that any kind of outbreak would get all of humanity - most likely it will be geographically isolated and even if a large region falls to the zombies, the military will soon intervene (hopefully not with weapons of mass destruction or carpet bombing), and thing will go back to normal before a year passes.

Still, if we're considering apocalypse scenarios, we might as well consider the worst case of all.

And here the author goes completely off base - recommending setting up the new society for your group in tho most inhospitable environment possible - like deep Siberia, or a desert, or even a jungle. That's just insane. Zombie numbers will be falling rapidly, so your first problem is shifting from eating non-perishable pre-apocalypse food to growing new food - and for that you'll need either coastline for fishing, pastures for livestock, or decent arable land (wildlife hunting can supplement your food, but it's unlikely to work as its primary source) - it won't give the yields modern agriculture, but then the number of survivors will be much less than seven billion.

Bandits are a risk of course, but people can and will defend their homes, and bandits won't last very long in such an environment, just like they didn't in ancient times. Historically, small scale bandits mostly robbed travellers, not farms - you need a small army to setup a successful long term farm robbing operation, and if you have an army you might just as well call yourself President for life, wipe out all other bandits, and start collecting taxes. Of course history doesn't reliably tell what might happen to the society after a catastrophic zombie outbreak, but it very reliably predicts what's going to happen if a bunch of fat urbanites try to set up new life in environment where even natives living there for generations can barely make ends meet.

It's still far safer to deal with some potential bandits than with near certain starvation.

History of Zombie Outbreaks

The book also narrates important historical zombie outbreaks. Since it's based on inference from highly unreliable information, definitely don't take them at face value (especially the alleged multi-year siege), but it's still interesting to read, and can better prepare you for the day zombies come for you.

Summary

4/5 stars - It's really important that someone finally wrote such guide, and it contains a lot of useful information, but using it as your sole source is going to get you killed.

Saturday, April 05, 2014

Review of Ruby Under a Microscope: An Illustrated Guide to Ruby Internals

Cat Pimp by nicora from flickr (CC-NC-ND)

I've been digging my way out of an overwhelming pile of book at pace of about 3 a month - a pace at which I have no chance whatsoever to ever catch up with all the absolutely must read stuff. One book I recently found in my pile was a review copy of Ruby Under a Microscope: An Illustrated Guide to Ruby Internals I got a few months ago, which turned out to be by far the best Ruby book I've ever read.

I'm a little jealous of how easy kids have it these days. I learned Ruby internals back in the 1.6 days - that was the time when most programmers have never even heard of this "Ruby" thing (I'm not kidding you here). To learn anything about Ruby internals you had to dig through macro-heavy and very idiosyncratic C codebase (C/C++ codebases tend to be highly idiosyncratic in general, much more than Java or Ruby or Python codebases), and what little documentation there was was mostly in Japanese. And here someone bothered to write a quality book that explains it all, and well just like that. I've learned a lot about 2.0/2.1, JRuby, and Rubinius from it, even if I was already very familiar with 1.8 series (and had some nonzero level of familiarity with others).

I can see two target audiences for this book. First, advanced Ruby programmers who want to learn Ruby internals - to work on one of the Ruby implementations, or write complex C extensions, or to heavily optimize performance of their Ruby apps.

And second, people who want to write their own programming languages. Ruby implementation is uniquely well-suited for study if you're such a person. It's relatively simple, but implements a highly modern language with all the goodies. Studying something like JVM is basically a waste of time - it's a monstrosity implementing a monstrosity, and half of the features you'll absolutely need in your language you'll have to brutally hack into an unsupportive environment, instead of just cleanly implementing them from first principles. And trying to build your language on top of JVM/LLVM or whatnot, while highly pragmatic, robs you of all the learning experience of writing your own first VM - something I believe any serious CS student should go through at least once.

The book itself assumes you're reasonably familiar with Ruby, but nothing out of ordinary, and as far as C goes it assumes you understand pointers, struct declarations, and basic syntax, and that's about it. That makes it surprisingly approachable considering its subject matter, but I found it really useful even already being familiar with all that (or how it was a few years ago at least). It doesn't bore you with compiler theory, but focuses on actual solutions to actual problems, and invites you to think about how things could possibly be solved. Contrary to what you'd expect, it's meant much more for a cover-to-cover reading than as a reference manual - it's over 300 pages, but it's very heavily illustrated, so it doesn't take that much time.

One big weakness of the book was its chapter about Garbage Collection, which spent far too much time on GC theory and far too little about explaining the interesting bits (like write barriers implementations). I don't think it kept up with standards set up by the rest of the book. And of course many subjects could use some elaboration, but you only get that many pages, and its priorities are relatively sensible.

I'm not sure how complete the book is for someone with no prior exposure to Ruby from the inside - it seems to cover all the basics except maybe C extensions (which would require a lot more C knowledge than the book assumes), but even if something you need to know isn't covered, the hardest part is getting started without being overwhelmed by all the interconnected pieces, and the book will definitely give you that.

If you're in one of two audiences I mentioned, it's practically a must read. I don't think it's terribly useful for people who just hack some Ruby on Rails at work, and aren't terribly interested in going deeper. Sample chapter is available on author's website if you're interested.

tl;dr 5/5 stars