Nicholas FitzRoy-Dale's personal journal. I also write a programming blog. Contact me at wzdd.blog@lardcave.net or subscribe to my RSS feed.

Sep 24, 2008
The Swedish model for the US financial crisis

I don't know much about banking, but I know what I like, and one thing I like is the Swedish model. During crises, more economists should consider the Swedish model. Cast your eyes upon the Swedish model and have a personal revelation! About banking. (I just thought I'd get these out of the way early.)

In 1992 Sweden was in the middle of a finanical crisis rather similar to the current U.S. one. It was also partially precipitated by a housing bubble collapse, and they responded with a government bail-out along the same lines as the proposed U.S. solution. However, the Swedish bailout came with conditions: in some cases, the government only bought a bank's debt in exchange for equity in that bank, resulting in banks that were partially publicly owned (the government has since sold its stakes, recovering at least half its bail-out money).

From what I understand, equity isn't part of the current plan (it is a "no-strings-attached" bail-out). This concerns Bo Lundgren, architect of the Swedish model. He believes that the threat of giving the government a stake inspired some banks (such as SEB) to arrange private recapitalisation, obviating the need for governmental payments. For the banks which did need government money, the return on sales of their share in the banks returned at least some money to the public. The governmental oversight also restored confidence in the Swedish financial market more quickly than expected.

References: New York Times, Time, The Local.

Sep 14, 2008
Grar, Python

Update: This problem is fixed in Python 3.0. Hurrah!

Python’s nested scopes suck, because you can’t modify (well, rebind) variables in an outer scope unless it’s the global scope. Here’s some code:

def f1():
    blah = 0

    def f2():
        if blah == 0:
            print 'hi'

    f2()

f1()

This prints ‘hi’, as you’d expect. Here’s some more code:

def f1():
    blah = 0

    def f2():
        if blah == 0:
            print 'hi'
        blah += 1

    f2()

f1()

This prints ‘UnboundLocalError: local variable ‘blah’ referenced before assignment’. This is because any rebinding must be either local or global — it can’t reference a nested scope. What happened here is that the interpreter looked at the definition of f2, saw an assignment to “blah”, and made a new local variable.

The details are in PEP 0227. The workaround is to use a container class. For example, with blah = [0], the statement blah[0] += 1 doesn’t rebind blah, it just references it, so it is allowed.

Guido’s justification for this behaviour is that if you’re rebinding things in non-local scopes you should be using a class. I think he’s right if you’re doing anything complex. The trouble is that writing classes involves a lot of syntax: for simple tasks (say, involving a counter and some helper functions), a function local and some helper functions are easier to read. Here’s the same thing as a class:

class Adder(object):
    def __init__(self):
        self.blah = 0

    def f2(self):
        if self.blah == 0:
            print 'hi'

        self.blah += 1

    def f1(self):
        self.f2()

Adder().f1()
Sep 9, 2008

Nationals leader Peter Ryan, on abortion:

It seems intrinsically wrong somehow that a pregnant woman can go to a hospital and, depending on what room she goes into, her child could well be born, looked after carefully and lovingly in a neo-natal ward, and survive and grow on the one hand; or if she were to go into another room, the child could be killed.

Emotive language aside, the issue is actually a lot worse than this: if this pregnant woman goes into a still different room she could end up with, say, her tonsils removed, or an artificial leg! Mr. Ryan seems a little unclear about what goes on inside hospitals, and I hope that for his sake that his advisers introduce him to the concept gradually. (source)

Sep 6, 2008
I learned a new word! It’s nystagmus, rapid involuntary movements of the eyes.
Sep 4, 2008

There’s been a lot of talk recently about the brain’s “default network” — an area which (if I have got this right (I almost certainly haven’t)) becomes active when the brain isn’t focused on the external environment. Planning the future, thinking about yourself, and daydreaming all involve this region.

Anyway. Based on the number of times I’ve got distracted recently, started browsing the Web, and then realised I’ve visited the same page twice in a row, I think I’ve managed to train my default network to type Web addresses into a browser. Good job, those neurons. It’s a pity brains aren’t like computers and I can’t get what is essentially the screen saver to search for aliens or fold proteins or something.

Aug 25, 2008
I just discovered I can get rid of the unsightly hand-marks on my laptop using an eraser. Nifty!
Aug 24, 2008

Driving to Sydney, I passed a sign saying "Sydney 90". Some time later, I passed another sign saying "Sydney 91". When driving my mind tends to wander a little, so perhaps that's why my first thought was "Crud! I've gone back in time. Now how am I going to get home by 5?"

My second thought was "Wait, that says '51'". Time to get some more sandbags for that grounding to reality.

Aug 19, 2008
feminine |ˈfɛmɪnɪn|
adjective
3 Music (of a cadence) occurring on a metrically weak beat.
Sorry about the weak beats, ladies. :(
Aug 16, 2008

I read a lot of RSS feeds! Many of them are nerdy or quite specialised, but there are also a few general ones. Here are a few which I think you will like. Penelly, now it's your turn! :)

Idle Words: Maciej Ceglowski's writing has, in the past, covered Argentine culinary tradition, the tango, the Polish police force, bedbugs, and the sublime mundanity of Milan Kundera. He's hilarious. Check out "Argentina on Two Steaks a Day", or "Attacked by Thugs", linked off the front page.

Emily Short's Interactive Fiction: "Interactive Fiction" is the new, less interesting, but (to be fair) more accurate name for what were once called text adventures. Modern IF is quite complex, particularly when it comes to interacting with non-player characters, and some of the stuff that Emily blogs -- such as her recent post on beats -- could easily apply to traditional literature or other game forms. She's a good writer and one of my favourite IF authors.

Ironic Sans: One of my nerdier blogs, David Friedman seems to spend quite a bit of his time coming up with crazy ideas, such as thsrs, the thesaurus that only returns words shorter than the one you typed in; or "keming" (the result of improper kerning), which recently memed its way around the Internet. He also did a study relating the method people use to push up their eye glasses to their personalities, which I thought very thorough.

Mimi Smartypants: Ms. Smartypants writes about her life, her husband, and (especially) about her young daughter in a way that always makes me smile. I especially loved Nora's guide to recognising good vs bad cats (link) and the associated commentary on huffing air freshener.

Spidercamp: Sarcastic, funny, slightly strange. I love her series of post office stories. I need to hang around in more post offices and wait for hilarity, I think.

The Beard Team USA Blog: These beards are a permanent source of inspiration to me.

Aug 13, 2008
1421: The Year China Discovered the World  […] was first published in 2002 in Great Britain and was published in the United States under the title 1421: The Year China Discovered America

*snicker*

Wikipedia article

Aug 6, 2008

My new super awesome chain chomp hat, knitted by Catie! :)
Jul 30, 2008
More like the Centre for Crackpot Studies

I had a blog post half-written about a "paper" (scare quotes because the referencing is really poor) recently put out by the Centre for Independent Studies. It proposes that people be allowed to declare themselves immune to "nanny state" (their term) laws such as being required to wear helmets when cycling, in exchange for having to pay for any consequences of their actions entirely out of their own pocket. Unfortunately, it was so tedious pointing out the problems with the argument that I got bored. You know it's bad when you can't even get past definitions (such as "consequences of your actions").

I apologise for my laziness. However, if you are interested in an entertaining example of the stereotypical "big government bad" political-conservative idea taken to a literal and almost self-parodying extreme, I recommend the paper.

Jul 29, 2008
My major problem with the Facebook Vampires application

...is that it refers to its victims as "chumps".

My experience with victims of vampire attack is mainly of the Anne Rice / delicate maiden / skin pure as alabaster / her exposed neck so slender and vulnerable school, a set that I can't really reconcile with the word "chump".

Jul 21, 2008

Looking at the giant stack of 2-minute noodles in the ERTOS kitchen, I started wondering if it would be possible to grind them up and use the huge amount of energy contained within to, say, power a car.

Unfortunately petrol has an energy density of 44.4 megajoules per kilogram, whereas the noodles provide about 1300 kilojoules per pack. You get about 12 packs per kilogram, but that’s still a serious energy deficit. So scratch that idea.

On the other hand, I suspect I use energy equivalent to less than ten packs’ worth of noodles per day. If I could somehow modify myself to run on petrol, I’d only need, like, a spoonful daily!

Jul 16, 2008
BeautifulSoup

Beautiful Soup is a fun Python library that screen-scrapes HTML, even if the HTML isn’t very good (the technical term here being “valid”). I finally got around to giving it a try, and while browsing the source I learned that it provides a bunch of other classes that aim to parse different varieties of broken HTML (which would seem to defeat the purpose somewhat, but anyway). They’re named ICantBelieveItsBeautifulSoup, MinimalSoup, and BeautifulStoneSoup. There’s also a SOAP (remote procedure call protocol designed by committee) parser, named BeautifulSOAP. The code then includes this section:

#Enterprise class names! It has come to our attention that some people
#think the names of the Beautiful Soup parser classes are too silly
#and "unprofessional" for use in enterprise screen-scraping. We feel
#your pain! For such-minded folk, the Beautiful Soup Consortium And
#All-Night Kosher Bakery recommends renaming this file to
#"RobustParser.py" (or, in cases of extreme enterprisiness,
#"RobustParserBeanInterface.class") and using the following
#enterprise-friendly class aliases:
class RobustXMLParser(BeautifulStoneSoup):
    pass
class RobustHTMLParser(BeautifulSoup):
    pass
class RobustWackAssHTMLParser(ICantBelieveItsBeautifulSoup):
    pass
class RobustInsanelyWackAssHTMLParser(MinimalSoup):
    pass
class SimplifyingSOAPParser(BeautifulSOAP):
    pass

For coming up with the enterprise class name of RobustInsanelyWackAssHTMLParser, the Beautiful Soup guy is my favourite guy du jour, and as a reward (to borrow from Language Log) he wins a year’s free subscription to this blog.

Jul 6, 2008

Today I made this delicious margherita pizza, which helped to soothe the pain of failing to claw my way back to the top of my friend&#8217;s scoreboard in <a href="http://www.handdrawngames.com/DesktopTD/Game.asp">Desktop Tower Defense</a>.
Jul 3, 2008
Today I told Bryn that his blog should support comments and he replied that my Tumblr made him feel like not allowing them was acceptable. I told him that I hated myself for legitimising this anti-community attitude, and then I thought I’d blog about it.
Jun 16, 2008

I made sourdough! It was delicious, and really fun to make.
Jun 13, 2008

Drains to Space, from <a href="http://www.flickr.com/photos/seanbonner/2573107467/in/photostream/">seanbonner</a> via <a href="http://io9.com/5016046/save-the-aliens-dont-litter">io9</a>.
Jun 12, 2008

I just discovered AM radio. It’s like podcasts, but it comes over the air using some sort of voodoo system. It’s pretty great! When I turned it on this evening, I heard a pleasant, middle-aged female voice saying “… so it’s not a great superhero movie, but not a terrible one either, and I must say, as someone who’s been taking a large quantity of steroids for medical reasons, that I looked upon the Hulk breaking out with a great deal of sympathy.”

Then a man came on and started talking about Grote Reber.

Newer entries | Older entries