30 November 2008

A Big F*** You to Paul Graham, From Worldwide Software-Support People

Paul Graham: "They'd have sacrificed hundreds of thousands of dollars, perhaps millions, just to be able to deliver more software to users. And you know what? It would have been perfectly safe to let them."

I'm sorry Paul, as a representative of tech-support people worldwide, I have to say: f*** you.

Developers, even fantastically smart ones, don't test enough as it is. If you let them have "push-button release" privileges, the software industry would have an even worse reputation for terrible reliability than it already has, and companies would have to spend millions more in order to support all that crappy code that couldn't wait for two more weeks of testing and certification.

The world would be a better place if developers had to wait two weeks more than they do now, or even two months; maybe there would be less s**t around for others to pick up afterwards.

How to disable access keys in Konqueror

Well, this suggestion by Dimitri on how to disable access keys in Konqueror made my day:

kwriteconfig --file khtmlrc --group "Access Keys" --key Enabled --type bool false

"Now press enter and voilà the access keys are sent to the eternal lands of /dev/null."

Failure of imagination

I really wish I knew what to do.

For the last week, I really wanted to code something up, something new and fresh, and I couldn't figure out what. I periodically feel like this, and I'm reminded that there's tons of things (started and never finished) which would need attention... and even finished ones, like kdelicious, really need some maintenance. But these are boring things; since coding for me is just a hobby, I should really spend it on something fun, right?

Eventually, I decided to install dbxml, something I had postponed for a long time. Following Zeth's excellent guide, I avoided the horrendous pitfalls (typos in testing code? Left there for months?) and managed to set it up properly, even though checkinstall failed to debianize it. (BTW, why don't we have a .deb somewhere? It was originally released in 2003, one would expect that in 5 years somebody would have come forward...)

The good thing about Oracle products is that they come with plenty of documentation; it can be terse, but it's there. (b)dbxml is no exception, so I went through the (excellent) introductory tutorial in a few minutes. Fine. Then I thought "this seems cool, I wonder how could I use it for, maybe some webservice or something"... and the thought died there. My mind had a complete (and utter) failure of imagination. So now I have a very cool xml storage engine with good python bindings, and I don't know what to do with it.

I ended up playing MAME for much of the day.

Bring on Christmas, I need a reboot.

20 November 2008

Python "global" weirdness

I'm sure there's a rational explanation for this behaviour, but at the moment is slightly baffling.

class SomeObj:
 def __init__(self):
  self.prop = 1

class SomeClass:
 global objInst
 def __init__(self):
  self.reference = objInst
  self.reference.prop += 1
if __name__ == '__main__':
 global objInst
 objInst = SomeObj()
 clsInst = SomeClass()
 print "original:" + str(objInst.prop)
 print "clsInst:" + str(clsInst.reference.prop)

# output:
# >>> x:2
# >>> y:2

This is all good, and expected: you get a reference to a global object and manipulate it. But what happens if you try to rebind that global name straight in the __init__ method?

class SomeClass:
 global objInst 
 def __init__(self):  
  self.reference = objInst
  self.reference.prop += 1
  objInst = SomeObj()
# output:
Traceback (most recent call last):
  File "test.py", line 16, in 
    clsInst = SomeClass()
  File "test.py", line 9, in __init__
    self.reference = objInst
UnboundLocalError: local variable 'objInst' referenced before assignment

And it gets even more weird! If you move the "global objInst" declaration inside the __init__ method, it works as expected: objInst is bound to a new object with a different state from the one in self.reference. But if you keep the declaration at class level, and simply move the rebinding out in a new method (separated from __init__), you don't get an error but python does not bind the global to a new object.

I guess it's somehow all a matter of context, and it probably makes perfect sense to programming-language scientists; it just doesn't to me :)

16 November 2008

I'm impressed

Finally we have a Linux system where suspend/resume and even HIBERNATE work out of the box. AND the X-server works as it should, including console-switching. AND it comes with a polished KDE (with a properly-configured kdm), plus an easy upgrade path to KDE4.

Thanks, Kubuntu.

15 November 2008

KMyMoney "proper" builds

Just found out that Clay Weber maintains a lovely personal archive of KMyMoney .deb builds, very up-to-date and (more importantly) packing several optional plugins that standard Ubuntu and Debian builds don't carry -- in particular, the all-important OFX importer. Thanks Clay!

Oh, and I moved to Kubuntu Hardy. Feels nice.

13 November 2008

Please stop spamming FB apps

Seriously, this is getting ridiculous:

Every time you add a FB application, a third party gets access to your data, so I stopped accepting all invitations.

09 November 2008

Crunching Numbers

During the last couple of day, I spent my free time trying to sort out the family finances; big (good) changes are on the horizon, we need to plan a bit better from now on, and it's amazing how "bad" expenses stick out straight away when you aggregate them, instead of relying just on rough day-by-day cash-flow estimates ("how much money is still in my account?").

I tried to use KMyMoney for this sort of thing several times in the past, but I was always inevitably thwarted by the effort required to copy records one-by-one from online bank statements, because the sort of bank accounts I use don't allow any desktop clients to automatically pull data. So this time I thought I'd fix it once and for all, and set down to write a few scripts to do that, albeit in a somehow indirect way.

KMyMoney can natively import transactions in the legacy (and wildly non-standard) QIF format, while OFX requires a plugin (why? No idea). Unfortunately, on my Debian Etch, the bloody plugin somehow never gets installed correctly, but hey, maybe one day it will, and OFX is the way of the future anyway (it's XML-based and much more exactly specified than the old plaintext-based, informal QIF). So I wrote a Python script to convert the HTML or CSV produced by my online accounts to OFX, then passed the output to ofx2qif, a handy script included in the libofx-dev package (at least in the 0.8.2 version I'm using). The result is ready to be imported in KMyMoney. Slightly cumbersome, but it does the trick. I need to add a bit more intelligence to the scripts, to speed up the categorisation effort that follows (which is the whole point of the exercise), e.g. "LINK xxxxxx" payees should all be set to "cash machine" etc, but it's already working fairly well.

The effect was startling; finally, all my expenses are tracked and I can properly budget and forecast. (...How the hell I'm spending so much on mobile-phone calls??)

I'm actually slightly pissed off that cash transactions are now so opaque; I've no idea why £50 were withdrawn from an ATM on that January day (even though I'm sure it made sense when I first checked the statement 6+ months ago), but I know for a fact that those £37.68 from last December were for a delicious Japanese dinner, as I paid for it with my debit-card.
In a way, this goes against the "classic" principle that "by using plastic, you never really know how much money you don't have" (so you tend to spend more). I still believe in that principle, and I'm slightly baffled by the evidence.

I'd strongly recommend this sort of exercise to everyone, anyway. You don't need to use a dedicated program like KMyMoney (even though it helps), Excel might be enough, as long as you can easily add transactions from your online account (via CSV or cut&paste).

05 November 2008

The American Dream is back

I left the office at the beginning of October saying "When I'm back, Obama will be the President Elect!"; people laughed and said it was too early to call. Well, I called the Democratic primaries for Obama in February; that was difficult.

Note: I'm slightly pissed off that the BBC is giving space to John Bolton.

Back to the cold shores of England...

... and jet-lagged enough to follow yet another USA presidential show. After two episodes with villains winning, it's about time for the good guys to score one, or it will become a cliché.

Someone is liveblogging on dailykos, if you can't stand the usual round of useless TV pundits.