05 December 2009

Plasma + Python + QThread = bad

DOM manipulation performed in a QThread launched from a KDE Plasma applet written in Python is officially a very bad idea. Minidom: crash. QDomDocument: crash. !Fun.

30 November 2009

If you can't fix it, rebrand it

The reputation of the KDE ecosystem was tarnished by a crappy release process for KDE4. Essential desktop components simply weren't ready for release in 4.0 and 4.1 (some of them still are mostly vaporware) after a huge barrage of hype had massively raised expectations, and this generated a lot of (well deserved) bad publicity. The answer?

Go and rebrand it, so that the development process can be broken up more easily and people will be persuaded to blame the right developers for each component. And while we are at it, let's throw out KDE's well-earned reputation for deep integration, the idea of the DE as a complete platform for users and developers. Let's give users the idea that KDE is just a "compilation" of bits and bobs thrown together for no particular reason, on the way overlapping as much as possible with the concept of "distribution", making it fun for companies to explain the difference and for developers to understand what they can and cannot rely on for their apps. Now KDE is supposed to be just a "community", a "club" of like-minded (C++) people hanging out in Gran Canaria and the like.

Yeah, that will be fun.

Honestly, I've been a big KDE fan for ages, but the development process for KDE4 was clearly wrong on so many levels. Developers' reactions to user feedback in the last two years have been astonishingly patronizing, and this is just another instance of it. Just admit that errors were made and get to work, please, instead of wasting time jet-setting from one "conference" to another (preferably in remote islands with good nightclubs), talking about marketing b*llocks.

29 November 2009

Akonadi vs Plasma: a tale of disorganized, randomic development

The Akonadi::ItemView class, which should provide a default, out-of-the-box view of data stored by Akonadi (KDE 4 technology), depending on the type of resource it represents, cannot be included in a Plasma.Applet (KDE 4 technology) but only in a KXmlGuiClient or KXmlGuiWindow (KDE 3 technology).

Clearly dogfood isn't as tasty as apple pie.

25 November 2009

Passaporto obbligatorio per i bambini da oggi?!? Classico caso di cattivo giornalismo

(Apologies, this post is only in Italian)

Questa mattina il Corriere della Sera ha fatto risparmiare qualche litro di caffe' ai poveri genitori di bambini italiani all'estero. Il pezzo "Anche i bimbi avranno il loro passaporto", infatti, conteneva abbastanza allarmismo da provocare diversi casi di tachicardia acuta in adulti con prole, quasi tutti in fase di preparazione per l'inevitabile rientro natalizio sul Suolo Patrio.

Tutto grazie alla seguente affermazione (screenshot per i posteri):

"Dal 25 novembre, tutti i bambini in viaggio all'estero avranno in mano il loro documento con nome e foto, così come prevede la nuova disciplina comunitaria."

Panico. Fino a ieri per i minori bastava essere presenti sul passaporto dei genitori. Per avere un nuovo passaporto ci vuole piu' di un mese! Natale e' il 25 dicembre e il nostro aereo e' fra X giorni! Possibile che il Ministero degli Esteri si sia creato dal nulla una montagna di lavoro proprio sotto Natale?

La risposta e' no. Peccato che il giornalista/scribacchino/redattore che si e' preso la briga di riportare la notizia (probabilmente di agenzia) non abbia nemmeno provato a fare un minimo di verifica o integrazione, magari sul sito della Polizia di Stato (organismo preposto al rilascio dei passaporti), magari leggendo un aggiornamento dal titolo "Nuova disciplina in materia di passaporti":

"I passaporti contenenti l'iscrizione di minori rilasciati fino ad oggi rimangono comunque validi fino alla scadenza e tutte le richieste di iscrizione del figlio minore sul proprio passaporto pervenute fino a ieri saranno evase fino al 15 dicembre."

Ergo, l'affermazione che "dal 25 novembre, tutti i bambini in viaggio [...] avranno in mano il loro documento" e' palesemente falsa. E il preoccupato genitore puo' finalmente rilassarsi con una bella tazza di caffe' fumante, magari (per oggi) decaffeinato.

24 November 2009

How to Replace VmWare Server 2.0 Console with VNC

VmWare Server 2.0 ships with a web-based user-interface that is, to put it bluntly, an abomination. Supposedly, it is that way in order to simplify requirements: gone is the command-line API-based interface of 1.0 (which is now only available in the pricier products, what a coincidence), now the only thing you need is a web browser and a plugin that will display the consoles of virtualized instances.

This is all well and good when the plugin works. Which is, considering the constant flow of browser updates, not quite often. In particular, it seems that after upgrading to Firefox 3.5, the plugin stopped recognizing my arrow keys (of all things). I tried running it as a standalone client, which is surprisingly simple (just locate vmware-vmrc in your Firefox profile folder and use it to connect to the main server on port 8333), with no success. I've even followed some blog advice to add something to /etc/vmware/config, but that didn't do it for me.

Then I remembered what everyone in the VmWare world knows: these virtual consoles are VNC-based. So there must be a way of using a "proper" VNC client, bypassing the godawful plugin. And indeed there is, just drop the following lines in the .vmx file of the virtual machine you want to VNC-enable:

RemoteDisplay.vnc.port = "5900"
RemoteDisplay.vnc.enabled = "TRUE"
RemoteDisplay.vnc.password = "password"

Reboot the instance and voilà, you will be able to connect with a better client, like xTightVnc, where arrow keys do work properly. You can obviously change the port and password to suit your needs.

23 November 2009

Amarok 2 revisited

Considering the sort of negative person I am (I'm sure scientologists would classify me as "suppressive personality" in zero time), it doesn't come as a surprise that one of the most popular items on this blog is a rant about Amarok 2. Having recently upgraded my Linux laptop, however, I found that Amarok was also upgraded to release 2.2.1, and I decided to give it a go. The experience was, overall, a positive one, so I thought I owed to the developers a follow-up to my previous rap.

Amarok 2.2.1 finally addresses 99% of the problems and regressions that plagued 2.0. The terrible default layout is now highly customizable (click on View -> Lock Layout to unlock the widgets, then drag&drop them where you want), so you can recreate the much-saner 1.x disposition. You can also customize the top toolbar (which by default is wasting so much screen real-estate, you could probably display three different applications in the same amount of space) to be more compact, by selecting View -> Slim Toolbar. Support for radio and podcasting is now first-rate (I don't know about external disks/mediaplayers), and plugins for various Internet services are quite good. MySQL is back to being an optional back-end for the internal music catalog. In short, if you still are on 1.x and can upgrade to KDE4/Qt4, you should probably give it a go.

So, 18 months down the line, Amarok is basically back to where it was in release 1.4, plus some eyecandy and (we are told) a better, more modular infrastructure. In order to achieve this, developers endured a year of bad publicity and hate-mail from their own users, lost market share, and basically looked hapless at prioritizing features and designing interfaces.

Was it worth it? To me, it still looks like another proof that benefits of "big rewrites" are dubious at best, like Joel Spolsky said so many years ago. I suspect we will eventually come to say the same about the whole KDE4 process, but I guess the jury is still out on that one.

22 November 2009

Programming children

Children are to parents what Big Rewrites are to programmers: the occasion to start from scratch after taking into account all the hacks and bad decisions from previous versions, resulting in a superior implementation of a well-known solution. Or so parents (and programmers) like to think.

Except that children and programs tend to have a life of their own, and the most successful strategy is often to just get along doing whatever the little monsters are successful at, which may or may not be what the previous release intended to do.

20 November 2009

How to demotivate your workforce

  • tell them they are "high cost" compared to Egyptian, Indian or Rumanian counterparts.
  • tell them that, despite the company being afloat in cash, there's no money for pay increases for the N-th year running.
  • tell them that the money is "reserved to the mergers&acquisitions strategy". We don't reward our workforce, we reward our competitors; as soon as you can, please go and become one.
  • tell them that "promotions with no pay increase" are perfectly normal. Same for workload increases. Imply that you should count yourself lucky to still have a job. The beatings will continue until morale improves.
  • tell them that, if you don't like it, they have a choice (i.e. walking). But at the same time, "we have to get better at sharing knowledge". Sure, I'll get to that right away (not).
  • give them new internal systems that don't work. When workers complain, dismiss them as whiners. Make sure there is no plan-B after The Big Go-Live. Once TBGL results in complete customer-affecting disaster, panic.
Time to work on personal projects. Big time. Dear SUN employees in Europe, you really really should cheer for the EU. May you be spared a terrible fate.

17 November 2009

Kubuntu Karmic Koala and Radeon 9600 Mobility M10 (RV350) xorg.conf magic

The upgrade to Kubuntu 9.10 "Karmic Koala" threw me back to the glorious 90s, when installing Linux would invariably require long battles with the infamous XFree config files. Hours and hours wasted trying out magic incantations in order to escape the brutal world of command-line interfaces. !FUN

Anyway, here's a bit background: basically, ATI stopped releasing proprietary Linux drivers for their old cards. So you can either use the old drivers, or move to the open-source ones (a complete rewrite, which only recently got good enough for real use). But here's the problem: the version of (KDE window manager) KWin shipped with Karmic crashes horribly with the old ATI drivers, and recent Xorg releases don't really work well with them anyway. So you haven't much of a choice: move to the free drivers and thank Stallman for inventing the cure to the annoying problem of manufacturers dropping support for products after less than five years.

The problem with the open-source drivers, however, is that running with default parameters will give you shockingly bad perfomance, especially for 2D (weird). I was forced to delve into xorg.conf and turn on all the "turbo-boost" switches I could find. At the moment, I'm getting decent result with the following parameters:

Section "Device"
Identifier      "Configured Video Device"
Driver  "radeon"
Option  "AccelDFS"              "on"
Option  "AccelMethod"           "XAA"
Option  "MigrationHeuristic"    "smart" # "greedy" works well also
Option  "EnablePageFlip"        "on"
Option  "EnableDepthMoves"      "on"
Option  "ColorTiling"           "on"
Option  "FBTexPercent"          "0"
Option  "AGPMode"               "4" # this is the real kicker
Option  "TripleBuffer"          "true"
EndSection

Note AccelMethod being set to XAA. In the future that will probably be EXA (which apparently is a newer algorithm), but my experiments with it included too many crashes for my taste.

There are a few other parameters that I scavenged from Google and man radeon, but they mostly resulted in crashes on my machine (tbh, I'm not sure they were always the guilty party, but better safe than sorry):

  • "AGPSize" "128" -- from what I understand, this should just be the amount of video RAM you have.
  • "EXAOptimizeMigration" "on" -- relevant only if you use EXA
  • "XAANoOffscreenPixmaps" "on" -- no idea what this is, but my card doesn't like it
  • "BIOSHotkeys" "on" -- my screen-related Fn-* hotkeys work anyway, even without this parameter
  • "AGPFastWrite" "on" -- this hangs X on my laptop (Rock Pegasus Ti)

I put this here so I may remember to search my blog next time instead of wasting time going through random forum threads, but I hope it may be of help to fellow Radeon linuxers. All in all, KDE 4.3 is lovely, but it kinda reminded me that five years is quite a long lifespan for a laptop.

15 November 2009

Kubuntu 9.10 / KDE 4.3.3 first impressions

  • Upgrade installer choked on finding out that python2.6 was already installed. Had to fall back on hardcore dpkg commands to fix it. I understand most "upgraders" had similar issues. -1
  • Keeps complaining that it can't find my uid-identified partitions straight away (slow HAL?). Considering it eventually manages to mount them just fine (and that the uid scheme was forced upon me by a previous Kubuntu), it just seems stupid. Any idea how I could stop the nagging? Meanwhile, -1
  • Sluggish. Maybe because KWin would crash on ATI drivers and I had to switch back to the free ones. -5
  • Eyecandy is fabulous, and very consistent. Much better than Vista.+1
  • Managed to recreate my old desktop setup almost flawlessly. Most 4.0 regressions due to Plasma have finally been addressed. +1
  • Many (most?) widgets are useless. Only few of them "get" what Plasma is about. I guess this will be fixed in time. +0
  • The Widget Dashboard, once you "get it", is fantastic. Makes things like Quick Launcher absolutely redundant. +1
  • Configuration utilities have been somewhat cleaned up, in a long-overdue effort. +1, but for the love of God stop with the Gnome-like zealotry.
  • Looks like KNetworkManager won't properly manage my wifi. Somewhat balanced by forcing people (me) to rediscover the joys of full-speed cabled access. Still, -1 (and I'm being generous)
  • KPackageKit finally gives us a Qt-based alternative to Synaptic. +1
  • the gmail-plasmoid. Never found a decent counterpart for 3.5. +1
  • UI to Power Management features is finally as good as anything in the Windows world. Maybe better. +1
  • Shortcuts every-flipping-where. One day, I might even use them. +1
  • Lots of good repositories for fresh software, without having to jump through hoops. And the ppa/apt-add-repository combo is a winner. +1

Total: +1. So I guess it was all worth.

(posted with this newfangled Bilbo / Blogilo thing. Could this be the day I get a decent blog-writing application?)

12 November 2009

Berkeley hills

(on music from Weezer's "Beverley Hills")

Where I come from isn't all that great
My mailserver is a piece of crap
My admin scripts are a little whack
And my friends are just as screwy as me

I didn't go to any cool schools
tech startups never looked at me
Why should they?
I ain't nobody and got nothing in my webblog

Berkeley hills
That's where I want to be
Livin' round Berkeley hills
Berkeley hills
Coding like a celebrity
Livin' round Berkeley hills

Look at all those geeky stars
They're all so intelligent and smart
When their companies get floated
they get more buyers than Wal-Mart...

22 October 2009

Baroness Sayeeda Warsi Is The Perfect Example Of Why The BNP Can Win

Baroness Sayeeda Warsi, the current Tory Shadow Minister for Community Cohesion, exemplifies why we will always have racist and intolerant fringes in any civilized country.

Her Pakistani parents were allowed to settle in Britain and prosper, so much so that she could go to university in Leeds (when tuition fees were capped, by the way, thanks to public subsidies), then attend the York "Collage" [sic] of Law and rise among the ranks of a Tory party desperately looking for credibility with previously-shunned Asian communities. She's one of the sharpest careerists in the country, and was recently nominated as the most powerful Muslim woman in Britain by a magazine poll.

So you have this fantastic example of positive immigration/integration/equality story, a first-generation Pakistani-English woman (!) making waves in a traditionally white/male-dominated right-wing party.

Then she goes on TV, in a debate with the leader of the Inbred Party, and she says "we need to have a cap on immigration numbers, we need to drastically reduce the amount of immigrants". In other words, she wants to stop other people from enjoying the sort of opportunities that her parents (and herself) enjoyed.

The astonishing short-sightedness of her statements would be ironic, if it weren't so incredibly sad. It fits very well in a certain stereotypical profile: the American Bush-supporting hardcore Republican with an unmistakably Italian or Irish surname; the Italian member of the Northern League with a Southern face and lots of money from Northern businesses; the Israeli farmer with a Russian accent that won't let Palestinians work his land... Even my Italian-Japanese wife, who studied and settled in Britain thanks to EU subsidies, constantly falls in this sort of rhetorical trap, this idea that there is an emergency (there isn't), social services are collapsing (they aren't), and the country is too full of people (it isn't), so we have to "defend" our hard-earned wealth by kicking out a few poor souls who are slightly different from "us". We "made it", and we have to stop people from competing with us on an equal foot. Jesus and his thing about casting stones has to be "temporarily" put aside.

All this clearly illustrates the age-old concept that the last minority to be oppressed is often the first to oppress another, when given the opportunity. Baroness Warsi, in her political brinkmanship, is playing the inbreds' own game. The inbreds' leader Nick Griffin lost the personality battle tonight (he was clearly shaking and twitching throughout the entire programme, and was forced to admit his dabbling in racist and fascist ideologies), but he won the political battle: a tired Jack Straw was at pains to point out that Labour did not start any policy of migration and inclusion, Baroness Warsi clearly illustrated Tory policy as "inbreeding light" (on the much-exalted -- and highly discriminatory -- Australian model, also recently introduced in the UK by the Labour government), and the very intelligent LibDem guy kept as silent as he could on the subject. No one dared to defend the right of future generations to enjoy the same (very few) opportunities as previous ones, the right to fairness. They all waxed lyrical on the rights of current minorities not to be gassed and deported, but not one word was spent on the minorities of tomorrow. This was a political Dunkerque.

Mainstream parties, if they really want to tackle the inbreds, cannot linger in their trenches; they must get to the offensive. The real problem is how to stop people fighting across racial lines what it's always been (and will always be) first and foremost an economic battle for wealth, a war among the poor. This concept has been lost when traditional Socialism was banished from politics in the 90s, but it's the only way to keep tribalist tendencies at bay. Unless we get back to it, the inbreds will keep winning, because people like Baroness Warsi will always be happy to act as the inbreds' own tool.

22 September 2009

Metaversing

Every once in a while, we get an ironic reminder of how mass-literature is fundamentally formulaic. Cartoonists are especially (but not exclusively) fond of this sort of joke, probably because the nature of their work is often dismissed as "repetitive" and they have to get back at (mostly disingenuous) critics. Or maybe they just like playing the smartass.

It is then customary, on my part, to faithfully print the cartoons in question and then point it out to whoever gets around my desk. Some leave in a troubled state of mind, suddenly faced by the emptiness of a universe they hitherto happily inhabited. A few laugh at the old joke. Some think I'm just weird.

Last May, Aaron Diaz's Dresden Codak gave us the already-legendary 42 essential 3rd-act twists by Harvet Ismuths. Today, David Maliki's Wondermark built the phantasmagoric Electro-Plasmic HydroCephalic Genre-Fiction Generator 2000. They sit perfectly among the other stuff I hang around my pseudo-cubicle, like words by Carlos Williams, Borges and Piñero. Why keeping beauty out of the office, when there is so much of it?

20 September 2009

"The Web Startup Success Guide" review, and how to tie-in better

Yesterday, I bought Bob Walsh's latest book, The Web Startup Success Guide. It's the only thing I've found in "mainstream" bookshops that seemed really relevant to my current project, and indeed it is.

As "self-help-business" books go, this is a good one: the fluff is kept low (could have done with a few less interviews maybe, especially from bloody Guy Kawasaki -- if you're thinking of starting up and don't know him already, you haven't done your homework), and there's something for everybody, with plenty of practical advice and real tools you can use. A few ones are very US-centric (like mint.com, which is a real shame), but that's par for the course in this area.

You can also see that Walsh practices what he preaches, and that's always a good sign. Minutes after I twitted on the subject, he "@replied"; he really monitors social media for marketing purposes as much as he says you should do.

Walsh also couldn't miss the chance to pimp his latest shot at startupping, StartupToDo.com; after all, he's a good friend of Joel Spolsky, a master of self-publicity. Clearly the book and the site are part of a coordinated marketing effort. Nothing wrong with that: the book is NOT simply a brochure for the site, it's all good content, probably coming from the extensive research Walsh did while building the site as well as his personal experience (which was also enshrined in his previous effort, the famous Micro-ISV: from Vision to Reality). What I've found a bit disappointing was that the effort is missing the very last bit. StartupToDo is due to launch next week, but has been in private beta (invite-only) for a while now. The book was published in July. It would have been cool for readers to get some sort of password, a "backdoor" to the beta program, so they could sign up while they're still fired up from the book. For two months, "faithful" followers were just able to leave an email to be reminded when the real launch would actually happen. I'm lucky as I have to wait just a few days, but in the age of Internet-time and instant gratification, that's still a lot. So, Bob (and whoever goes for the next book/website combo): you should try to increase your conversion rate by making sure that readers can get in straight away.

UPDATE: StartupToDo.com is now live, as Bob correctly points out below. I'm "toyg" on the site, feel free to "friend me"! I've wandered a bit around the site already... lots of good info, recommendations and links which I'm still trying to get my head around. I'll post a better review later.

And now, back to plotting my startup...

19 September 2009

oops I did it again

Designed a very simple website. Looks wonderful in Firefox 3, Opera 9, Chrome 4, Safari 3, Konqueror 3. Yay, ready to upload then! Wait, I think I forgot something... oh yes, Internet Explorer! I'm working on Linux after all. Let's see... IE6: looks shit but who cares, nobody uses it anymore. IE7: looks marginally less shit, but still shit. Damn. Back to the css... this is why I left webplumbing.

14 September 2009

On Secrecy

It's been almost a month since my last blogpost. Many, many things happened, but unfortunately I can't talk about them here, as much as I wish that wasn't the case. Hopefully circumstances will get better in 2010. Meanwhile, check out this classic movie, completely unrelated to my situation (oh yeah).

10 August 2009

Apparently, US bureaucrats hate bilingual kids

Bilingual children surely must be stupid. The reasoning behind the process is typical of laws promoted by George W. Bush: if you are not a white man from a privileged "amurrican" background, you surely must be stupid. In this case, it's the "No Child Left Behind" act, which results in "subtle" discriminatory practices towards children of immigrants regardless of their actual skills.

27 July 2009

Oracle (Red Hat) Enterprise Linux 5 on VMware Workstation 5.5.x

Just wasted an hour trying to understand why VMware Tools wouldn't properly fix the X server on Oracle "Unbreakable" Enterprise Linux 5. The answer is: because the Tools coming with VMware Workstation 5.5 don't really work with such a modern distribution. So the answer was:

  1. get hold of a newer release (Workstation 6.0.2 did it for me)
  2. find the file "linux.iso", and copy it across to the old Workstation (you might want to rename/backup the original, just in case) in the same position.
  3. perform a regular installation of VMware Tools. It should correctly detect your X.Org 7.1 and fix it properly. (Note: if you get errors coming from VFS, it means that VW was too quick in unmounting the drive. Remount it, then copy the rpm to the local filesystem before reinstalling.)

If you haven't got a newer version of VMware, try adding the following lines inside the "Monitor" section of your /etc/X11/xorg.conf:

HorizSync 1-10000
VertRefresh 1-10000
It might just be enough.

05 July 2009

First impressions of OpenSolaris 2009.06, Windows Server 2008, and other various OSes

Having recently installed VMWare Server, I went on a "installfest of one": Windows Server 2008, Kubuntu 9.04, OpenBSD 4.5 and OpenSolaris 2009.06 are now happily chugging along on my server (which is apparently handling the situation without breaking a sweat -- impressive), with Arch Linux next on the list.

I have to say that I've been surprisingly impressed by the two "most commercial" offerings.

Windows 2008 feels really fast and lean. I don't like the new filemanager, but it looks like some of the infamous Windows bloat has been removed here and there. Getting asked for the Administrator password every 5 seconds is irritating, but at least the "Run as Administrator" menu item is more accessible than it used to be, so you can (mostly) preempt it. Also, it seems to work better with Samba, but this might be because Samba itself improved a lot (probably thanks to certain EU antitrust actions, but I digress).

I was even more impressed by OpenSolaris. Booting in a LiveCD before installation is always nice. The customized Gnome 2.24 (aka "Java Desktop System") is the most polished Gnome I've ever seen. The package manager makes it easy to get additional software (and to get rid of unwanted megabytes of localization files for all sorts of languages). It was a breeze to install NetBeans and its plugins (Python support!), I'll have to give it a spin. It's also curious to see in action Sun's typical "network philosophy": for example, /home folders are NFS mountpoints, which makes a lot of sense if you think about it. The drawbacks are that some things don't make sense: e.g. the Gnome utility to track free disk space goes bonkers (34 free gb when the disk is only 10...?). But these are details. I'd really like to spend some time learning permissions, ZFS, zones and all that; I hope I'll get some time at work.

In retrospect, configuring my first DNS server on OpenBSD 4.5 was almost uneventful. I'm not sure I even understand what I did, but it works :) I plan to expose this box to the Big Bad Internet at some point in the future, does anyone need a bit of space?

I guess the moral of the story is: VmWare server is very nice, when you have the right iron to run it on ;)

29 June 2009

Earth to VmWare: make some DEBs, please

I've recently installed VmWare Server on a new box. For some reason, VmWare packages RPMs but not DEBs, so I had to do a nonstandard local install from the generic .tar.gz installer. That's not difficult, but now there is no way for me to track updates, including security-related ones.

Come on VmWare, get your act together: it's 2009, people expect this sort of feature these days. Since you bother to build RPMs, it's clear that you can package stuff properly if you want to. If you are not sure what distribution to pick in the sea of available Debian-clones, just track Debian-stable and let the community do the rest.

07 June 2009

The pains of backward-compatibility

Problem:
  • you have several ZIP and TAR archives
  • you have to replace ONE FILE in each of them
  • you only have Python 2.5

From what I see, the only solution in this situation is to completely branch off the two cases, because the relevant Python modules (tarfile and zipfile) have such a completely different interface.

None of them can simply replace or delete one single file, so you have to unpack the entire archive, edit the file, repack. Inefficient, but consistent approach.
Then ZipFile object will read bytes, whereas TarFile objects will extract files.
Finally, ZipFile doesn't feature a method to extract all files in one go, like TarFile has. To be honest, zipfile sucks in pre-2.6 VMs.
This means that what you can really do (more or less) in the same way (with some essential metaprogramming) is opening/closing archives, listing the contained files, and adding new files.

Things are much, much better in 2.6 and 3.0, where both interfaces are almost the same, but if you are stuck with 2.5 (like me) then you'll have to do with inelegant solutions. And if you are reading this, maybe you'll waste less time.

(Memo to self: always, ALWAYS do the easiest thing that could possibly work, no matter how inelegant it is. Premature optimization really is the root of all evil.)

01 June 2009

note to self

When you start writing hacks like this:

for attr in ['Something1','someThing2'...'SomeThing215']:
    self.__dict__[attr.lower()+'Widget'].do_something(someValue)
    self.__dict__[attr.lower()+'Widget'].set_parameter(someparameter)
... it's probably time for a subclass.

30 May 2009

"Sigh. I really wish I could vote Labour, but..."

"...then they go and put Arlene McCarthy top of the ticket in the North West".
"Do you mean that Arlene McCarthy? The one who pushed so hard for software patents?"
"Yes, that Arlene McCarthy."
"Man, that must hurt."
"Indeed. And the other ones in the list look more of the same: people concerned mostly with the welfare of big business."
"But at least the campaign message will surely be about your 'sweet spots': fair opportunities, workers' rights, social Europe..."
"Er, no, actually. It's a riff on protectionist themes: fight for the UK, defend the country, etc. You would easily confuse them for BNP or UKIP material."
"I see."
"So it's gonna be Green again, I guess."
"F*ck me, the tree-huggers! Man, you even hate recycling schemes! Are you all right? Let me check your temperature..."
"Actually, their policies are quite sensible these days. They really get it on technology issues. They even have people in the Open Rigths Group."
"Well, ain't you a single-issue voter."
"Single-issue? Labour got it wrong on ALL the issues in the last few years: DRM, net filtering, open source, software patents... they even fought to be exempted from directives on workers' rights!"
"Yeah, but I mean, the enviro-nazi are full-on plane-haters..."
"I don't agree with their shenanigans on Heathrow either, but I think they started to understand that being anti-planes is a lost cause. And we do need more anti-nuclear activists, the original generation basically sold out to Blair."
"What about the Lib-Dems? Apart from Nick 'David Cameron wannabe' Clegg, they do have good people on."
"Yeah, I'm checking them out, but they always leave me underwhelmed. The best one they have, Chris Davies, is top of the ticket and is going to get a seat anyway."
"What about the Tories? David Cameron looks like a nice fellow."
"I'm actually worried by how much I agreed with the Conservative spokesperson on the last BBC Question Time, very intelligent man. But I'm still convinced they'll pull a GWB-style U-turn as soon as they are in government."
"And I guess you wouldn't consider UKIP..."
"Are you serious? Their motto is 'we're just xenophobes, not full-on racists like the BNP'. If they had free reign, I probably couldn't live here."
"That settles it, then. Not that I care, I'll campaign for the one with the bigger tits and beat your silly people anyway."
"Eh. Gotta run now, that's enough politics on the blog for at least another year. It's always so nice talking to you, Mr.Murdoch."

[UPDATE: If you still don't know who to vote for in UK constituencies, have a look at the Open Rights' Group page listing candidate positions on technology issues. It's fantastically simple and well-designed.]

29 May 2009

BNP: the inbred party

I try not to worry about political issues too much these days, but this post is not really about politics. Comedy, rather.

David Ottewell, aggravated by people doubting the veracity of reports depicting BNP members as full-on racists, reposted part of their constitution.

  1. The British National Party represents the collective National, Environmental, Political, Racial, Folkish, Social, Cultural, Religious and Economic interests of the indigenous Anglo-Saxon, Celtic and Norse folk communities of Britain and those we regard as closely related and ethnically assimilated or assimilable aboriginal members of the European race also resident in Britain. Membership of the BNP is strictly defined within the terms of, and our members also self define themselves within, the legal ambit of a defined ‘racial group’ this being ‘Indigenous Caucasian’ and defined ‘ethnic groups’ emanating from that Race as specified in law in the House of Lords case of Mandla V Dowell Lee (1983) 1 ALL ER 1062, HL.
  2. The indigenous British ethnic groups deriving from the class of ‘Indigenous Caucasian’ consist of members of:
    1. The Anglo-Saxon Folk Community;
    2. The Celtic Scottish Folk Community;
    3. The Scots-Northern Irish Folk Community;
    4. The Celtic Welsh Folk Community;
    5. The Celtic Irish Folk Community;
    6. The Celtic Cornish Folk Community;
    7. The Anglo-Saxon-Celtic Folk Community;
    8. The Celtic-Norse Folk Community;
    9. The Anglo-Saxon-Norse Folk Community;
    10. The Anglo-Saxon-Indigenous European Folk Community;
    11. Members of these ethnic groups who reside either within or outside Europe but ethnically derive from them.
  3. Membership of the party shall be open only to those who are 16 years of age or over and whose ethnic origin is listed within Sub-section 2

The Anglo-Saxon-Norse Welsh-Scottish and Norse-Irish Celtic "Folk Communities" didn't make the list; was it an oversight, or is it because everyone knows they're a bunch of lazy asylum seekers? I'd also be curious to understand how they can check these prerequisites before admission, but I guess this is an implementation detail.

What really matters, though, is the typical trademark of nazi paranoia: the obsession to precisely classify races on the basis of imaginary concepts. The classic result is this exact sort of documents, produced by people who fail to see the absurdity of their own statements and the self-offensive message they really communicate. What this document really says is that "BNP members are all inbred". I wonder if that is appealing to their target demographic.

Notes on Mercurial / MQ and Subversion

I am currently working on some patches for a project. The project uses Subversion for version control; I won't have commit rights, but I still want to track the original sources as well as my changes. Rather than configuring svn externals (which are really thought out for different usecases, typically libraries), I decided to try my hand at one of the newest Distributed Version Control Systems, which are built exactly for this sort of scenario.
Being a Python-whore, I obviously picked Mercurial. Here's a little memo with what I've done, mostly following the page on the Mercurial wiki dedicated to Subversion interop. Note that this may not be the optimal solution, it's a work-in-progress:
  1. enable the MQ extension in .hgrc or Mercurial.ini
  2. check out the original Subversion repository
  3. in the checked-out copy, do
    hg init
  4. in the same place, create a file called .hgignore, listing the files we don't want to track; typically, this means the .svn/ directory and .hgignore itself
  5. add all the files to Mercurial:
    hg ci -Am "Original svn checkout"
  6. initialize MQ:
    hg qinit -c
  7. if you have existing patches, you want to start applying them now. If they create new files, you'll need to "hg add" them
  8. when you want to save state, use
    hg qnew -f mynewpatch
    This will create a patch called "mynewpatch" in the MQ stack, listing differences with the original version, and it will consider it as applied.
In this way, I can always resync the svn repository (using svn itself), commit the new "upstream" revision to the local hg repository, then reapply the patch queue. At least in theory :)

22 May 2009

The Future of Journalism, Today.

Seeing how everyone and his dog is nowadays concerned with "the future of Journalism", I'm throwing this idea to the wind, because obviously I won't have time to implement it, I've been saying it for ages, and it's not very original anyway (I'm surprised nobody built it yet, but the Guardian is getting there). It can be done today, in a couple of months, leveraging existing tools. It's not a start-up project though, mainly because you need contacts in the journos community to get a few high-profile hacks to attract critical mass... The Huffington Post could do it, once they burn through their current venture capital. But I digress.

The Model:
  • Author has a site (e.g. at http://content.someauthor.name) where he publishes his content.
    • public feed is free, summary-only, with ads. (To view the full article, pay $0.49, or get free article with ads, or pay for "big" stories / analysis)
    • private feed is full, no ads, $1.49 for 4 articles, $3.99 or $4.99 for 10 articles, $49.99 per year.
    • subscription gives you full revision history (something the "pro" will want)
    • subscription gives you sub-by-email
    • articles can include trackback-like links to aggregators ("published in NewZine on 21/03/2009" etc)
  • "NewZine" aggregates feeds from various authors
    • articles are free to view with ads
    • aggregated feeds are summary-only, with ads.
    • aggregator pays author 40% of ad revenue on "his" page-articles, or agreed flat.
    • aggregator pages include canonical links to author site.

Pro:
  • Author gets much more visibility. You can have Toynbee without The Guardian, Monbiot without Monde Diplo, Mura without La Repubblica, etc.
  • Author is not subject to "gatekeeping", can potentially "make it" on his own. Platform is very open and flexible.
  • Author can potentially get more money-per-article, especially if the content is good. See how the iTunes model is making people pay more for music even though they don't realize it. This is the main selling point, because you need to persuade authors, not companies, to switch. As long as authors will crave the (limited but generous) safety net from the current (oligarchic and scarcity-based) setup, the revolution won't happen.
  • Lower incentives to work for "agencies" like Reuters, which are bad for the market and will die anyway. Aggregators become real-time agencies.
  • Aggregator can filter good/bad articles, keeping quality high, without risking much.
  • Aggregator has extremely low costs, and very high traffic (== money from ads).
  • Feeds can have all sort of metadata (location, tags..), making it possible to have automated semantic services ("get me all the local news for Stockport", "give me all movie reviews" etc) without any further editorial efforts.

Cons:
  • can take a while to break even
  • newsreaders might not support private feeds (like GoogleReader)
  • Authors will need help setting up their feeds / sites.
  • You need buy-in from a couple of big names, or a scoop, to get initial visibility.
  • must be implemented very quickly (as usual!) before other models appear. (My bet is that Murdoch will find a way of screwing everyone else, as usual, and make it a de-facto standard.)

As much as new models for music are act-based rather than company-based (bands are now supposed to build their fanbase through the net before they get signed), new models for journalism will be journalist-based rather than journal-based. Middlemen will tend to disappear, acting only as (unobtrusive) filters/aggregators. Hacks will have to produce a bit more, but they will see a much bigger share of the profits. Pricing can be tailored per feed (sports news: expensive / celeb-gossip: cheap, etc).

You couldn't have done this in 1999, when only a handful of geeks knew what RSS was; but you can very easily do it today. I'd say a decent hack would easily rake in $20K/30K per month (plus books etc), news quality would improve (as incentives for good and regular material would be higher), and the aggregator's costs would be so low that they'd basically be printing money. What's not to like?

21 May 2009

Problems with ICQ ? Use 443

Note to self: switch to port 443 on login.oscar.aol.com if port 5190 is giving you grief. Works a charm.

Now, if only I find why MSN keeps going offline...

02 May 2009

You should update to NoScript 1.9.2.6

Quick recap:
  1. NoScript is a Firefox extension. Its author makes money from ads on his webpages (from what he says, pretty much his entire income depends on those adsUPDATE: from his bio: "I'm currently teaching Web Programming at the University of Palermo"... yet another blow to his credibility UPDATE: the bio was outdated).
  2. AdBlock Plus is a Firefox extension that stops ads. It also allows users to subscribe to third-party lists of sites to block.
  3. The maintainer of one of those services, "EasyList", took a very zealous approach and targeted NoScript.net (and other sites from the same author) because he found that it implemented some basic workarounds to avoid AdBlock Plus.
  4. Escalation ensued, and after a series of tit-for-tat eventually the NoScript developer went too far. NoScript, when installed in Firefox, would now check if AdBlock Plus was installed, and if so, force it to whitelist its sites... basically "hacking" ABP client-side.
  5. The ABP developer (who up to now was not involved who apparently instigated the whole thing) got angry, and denounced the behaviour in various forums, including Slashdot.
  6. The NoScript author backtracked, removed the offending code in the latest update (NoScript 1.9.2.6) and apologized

Now, I'm sympathetic to the NoScript author's circumstances -- he has a family to feed, he gives his work away for free, and NoScript really is a piece of extremely useful and complex code that most Firefox users enjoy (including me). It seems fair that he should get some compensation for his effort.

However, clearly NoScript can be (and is) used as an ad-blocker, and the developer even runs AdBlock himself, but then he gets all worked up when these technologies are used against his own sites. There is a bit of hypocrisy there.

In any case, client-side modification of other people's extensions is just unacceptable, no matter how "transparent" it is. There is a line, and the NS author crossed it. Kudos to him for the eventual backtracking, but he shouldn't have put himself in that position in the first place. NoScript is a security-related extension, and in the security world trust is precious currency. His reputation is now tarnished, and it will take time for people to forget.

All this, someone pointed out, highlights the need for a mechanism to reward extension authors. I agree. Mozilla could easily implement a micropayment system on addons.mozilla.org (like the iPhone AppStore), or build some sort of subscription infrastructure in FF (so that people can install extensions, then decide if they are worth paying). My guess is that the world of extension development would literally explode, and that would make FF even more attractive.

30 April 2009

zipfile quirk

In Python 2.6.0, a bug in the zipfile module makes the newly-acquired extractall() method basically useless. The function is supposed to extract all members of a zipfile, "no questions asked", like Windows would do with a right-click "Extract All..."; unfortunately, the original implementation makes it fail when the zipfile contains subdirectories. The behaviour was corrected in one of the 2.6.x maintenance releases (and 3.0.x, and 2.7), but if you have the misfortune to be stuck with 2.6.0, here's the banal workaround:
zf = zipfile.ZipFile(zpath)
zlist = zf.namelist()
for filename in zlist:
 if filename.endswith("/"):
  destpath = os.path.join(path_to_extract,filename[:-1])
  if not os.path.exists(destpath): os.makedirs(destpath)
 else:
  zf.extract(filename,path_to_extract)

27 April 2009

Braindead policies of Libero.it

I have had a @libero.it email address for more than 10 years. I stopped using it regularly when they disabled POP/IMAP for people connecting through other providers, but still logged in occasionally every once in a while.

Today I went there and my saved emails were all gone. Apparently I didn't log on for three months (which may or may not be), and this "authorized" them to go and delete all I had left there for 10 years.

This policy is braindead and guaranteed to piss off people. Storage is cheap; if they really wanted to "temporarily disable the account" (in their words), they could have simply bounced incoming mail, and compressed the few megabytes (!) of data, ready to be restored the first time I logged in again.

This act of destruction was unnecessary, and carries the risk of being sued by angry people. This is the sort of decisions that made Libero.it (once at the forefront of internet-adoption waves in Italy) a fringe player; while Google and others ate their lunch, they were all busy penny-pinching, pissing off old-time users faster than they were making (very few) new customers.

21 April 2009

On Toggl

I started tracking my activities using Toggl. The concept is very simple: the site gives you a timer that you can "toggle" to signal when you are starting a certain task. You define different tasks and group them into projects, and you can mark "billable" hours as such (clearly a feature for consultants / freelancers). It features reports (obviously) and other workgroup-related options, a dotNet-based offline tracker, and premium options for paid subscribers.

The first day I used it, it was enlightening: it turns out that I only spent about 3 hours doing actual "core" work. Most of the remaining time was wasted being sidetracked by other internal projects, plus random chitchat. Ok, it was the day Oracle bought Sun, and we were pretty psyched about it (especially me, as the first thought I had when news emerged about the botched IBM/SUN deal was "well, [Oracle] would be a much better fit than IBM; db appliances would be very sexy, and most of [Oracle]'s stack is Java-based already", and the others were all "yeah, keep dreaming!"... then Larry vindicated me), I expect the numbers to get better. If they don't, it means my routine needs improving and I'll work on that, but I feel that without Toggl I probably wouldn't have the sort of hindsight that gives a sense of achieving, which is necessary to maintain continuous efforts.

All in all, Toggl feels cool. Other project-management sites should take note.

15 April 2009

Phorm/Webwise must go down

Phorm / Webwise is a disgusting ex-spyware maker now intent in profiteering from your browsing habits without your consent, as described by this exhaustive explanation of the Phorm system and why it is bad for everyone. They will basically spy on all your network request and then inject their own advertising on somebody else's pages. This is bad for users (spied on without consent, with very low guarantees of anonymity), and extremely bad for any website holder (whose content is modified and exploited, again without consent, and probably infringing copyright laws).

Yesterday the European Union, usually so despised by British citizens, formally accused Britain of infringing the EU directive on data protection by implementing Phorm. Today, Amazon opted out of the system, as previously did Google, Facebook and many others. I personally opted out a few minutes ago, by sending an email to website-exclusion@phorm.com listing all my domains.

For the sake of the net, Phorm/Webwise MUST fail. If the system goes live, I will ask my ISP whether my traffic will go through BT, and if so, I will switch to a provider who can guarantee they will NOT take part in the system (i.e. not Virgin and not TalkTalk).

13 April 2009

One of the (many) problems of modern education...

...is that logic and rhetoric are not taught well, or (like in my experience) not taught at all.

This is reflected in the political debate, which is getting dumbed-down to the point where rational arguments can be completely absent; and it can be seen all over "teh intarwebs", where multitudes of well-intentioned individuals routinely end up acting like trolls.

One should be able to understand when he is losing the rational argument, and either retreat, reformulate, move the subject onto a different field, or try to bluff his way through. By banging on about the same, lost point over and over again, one doesn't do himself any favour; he might be able to appeal to the basest instincts of some individuals, but he won't be able to win intelligent men to his cause.

I have to admit, I have been guilty of this behaviour several times during the years. I put it down to my lack of knowledge of the abovementioned fields. At school, they taught us how to analyse sentences for syntactical structure, but rarely for meaning, and never for logic. They told us how to write in a readable style, but didn't really ask us to understand where we are in a debate, how to interact strategically during a verbal confrontation, how to step back from the heat and think hard about your next rhetorical move.

Is it a form of large conspiracy, where upper classes try to maintain old privileges by "forgetting" to properly teach these subjects to the uninitiated? Or could it be that these are considered too dangerous a weapon, too prone to abuse, to be widely taught? Or is it simply that education topics are constantly squeezed by the furious pace of technological advancement, to the point where you need to teach kids how to work with newer and newer devices which are fundamental to the current way of life (computer, tv, ipods etc etc)?

In any case, it feels like some of the oldest fields of study ever taught ended up being victims of accomplished mass-scholarisation. I don't think this is helping the masses or anyone else, though.

10 April 2009

How to get precompiled documentation for Qt4

Memo to self: if you ever need to download the Qt4 documentation on Windows, instead of scraping the official site, just download the qt4-doc package for Debian, open it with 7-Zip and extract the .qch files to use with QtAssistant (which also gives you indexing etc).

06 April 2009

ODBC proxy/rewriter

I have several ODBC (and JDBC) requests, all pointing to the same server. They are all queries coming from the same database user. However, depending on who the caller is, requests should be "rewritten" to point to a different schema (for Oracle) or database (for SQLServer). In short, the identity should be proxied, because I cannot manually change it client-side.

Can this be done transparently? Does anybody know of a tool that does it, even commercial ones?

I thought about using a simple network proxy and redirecting to different RDBMS instances, but that is not a scalable solution for us; we must be able to separate these requests but still keep them on the same instance.

I can't find anything on Google, I wonder if the LazyWeb can help...?

UPDATE: I realized I need something similar to Context Switching in SQLServer 2005/2008, to wrap all my requests with a "EXECUTE AS" request. I wonder what the equivalent is for Oracle.

02 April 2009

Come on Bosnia!

    P W D L F A GD PTS
1 Spain 6 6 0 0 13 2 11 18
2 Bosnia-Herzegovina 6 4 0 2 18 7 11 12
3 Turkey 6 2 2 2 6 5 1 8
4 Belgium 6 2 1 3 10 11 -1 7
5 Estonia 6 1 2 3 5 15 -10 5
6 Armenia 6 0 1 5 3 15 -12 1

Only Germany and Poland managed to score 18 goals. After champagne-football, will we have cevapcici-football ?

01 April 2009

Eric4 startup crash on Windows

This post is for google.

If your Eric4 for Windows keeps crashing on startup, try the following:

  1. Start eric4-tray.py (which should be in your PYTHON_HOME\Lib\site-packages\eric4)
  2. Right-click on the Eric icon tray, and select Preferences
  3. Change something in the Application section, and click Apply then Ok
  4. Right-click again on the icon, and select "Eric IDE". This time it should start ok.
  5. Now you should be able to quit the tray application and start Eric as usual

20 March 2009

2 minutes of hate: Channel4 Windows-only streaming

Channel4 "free catch-up" streaming service only works with Windows Media Player. And not even any WMP, you need version 11, the most DRM-infested version ever released.

If even C4 doesn't get it, then the entire industrial-media complex deserves to die as soon as possible.

17 March 2009

Money for Nothing, the IT version

"[...] I shoulda learned to play the Python
I shoulda learned to play them Java
Look at that geek, he's got it runnin' on the server
Man we could have some fun
And he's up there, what's that, a COM object?
Throwing code 'round but they can't do a b-tree
That ain't workin', that's the way you do it
Get your money for nothin', get your laptop for free

We gotta check our registry keys
Custom deploys troubleshootin'
We gotta move these webservers
We gotta register more libraries...

(I'm sure I've seen a "proper" geek version somewhere, but google is not helping today, so I made my own...)

04 March 2009

On The Burden Of Legacy

I recently thought it would be good to write a few utilities for one of the products I support. This product was built on DCOM (don't ask me why). Obviously, being a pythonaro, I just had to use Python. And so my tribulations began.

Python supports COM objects thanks to the lovely Win32 package by Mark Hammond. When you have a DLL that you want to use in python, run "makepy.py yourlib.dll" (or just makepy.py, and browse through the registered libraries to choose one) and lo, it's available as a first-class python module. So I do that, and start poking around with various stuff, and eventually I call a method that returns an object whose definition is in another DLL, so it only comes up as a PyIUnknown object. Ah well. I run makepy.py on the second DLL, to no avail.

After a bit of googling and fiddling, I finally stumbled on the right incantation.

myobj = win32com.client.Dispatch(myobj.QueryInterface(pythoncom.IID_IDispatch))
myobj = win32com.client.CastTo(myobj,'MyIClassName')
Basically, I have to find the right interface ID for the object, dispatch it, and then recast the object with a different type which is specified by a string. Man, isn't that ugly. Not because of having to recast (which I can understand) but because the recasting needs the class name as a string, you can't somehow derive it from the object. If you don't know the "secret" class name, you can't use its methods even if you know it's of the right type. From a modern OOP point of view, this is quite absurd... but there is an explanation.

COM was built when reflection was not yet mainstream, and types were static and immutable. Programmers were used to declare types for each variable, and if the type wasn't right, the compiler would cry. Polimorphism, reflection and dynamic interpreters were slowly reaching mainstream acceptance, but Microsoft had to retrofit them on top of existing frameworks, one feature at a time. The result was the incomplete hybrid I now have to deal with.

Well, I thought, this open-source CPython stuff in Redmond is considered akin to communism, no wonder it doesn't play well with old MS frameworks. Let's try to move further down "the Microsoft Way" and see if things improve: I shall use IronPython. After all, it's just a thin layer on top of the .Net CLR, right? Certainly it will be able to guess types a bit better...

So, a few installs later (you need at minimum the "Windows SDK 6.0" for good interop tools for .Net 2.0, plus the IronPython installer), there I was, trying to do the same thing.
The .Net version of makepy.py is called "tlbimp.exe", and it will basically build a new DLL to wrap the old one. You then import the new DLL in IronPython and lo, you can use the objects. But what happens when a function returns a reference to an object not defined in the DLL? Well, more or less the same thing as for win32com -- you get an unknown interface. So again,you have to wrap all the other DLLs, and explicitly instance these objects with the right type. Slightly better but not really that much different (so I'll stick to CPython, thank you).

As I said, this sort of explicit casting was perfectly acceptable 15 or even 10 years ago. But honestly, don't we live so much better without ? Why win32com and (more damning) IronPython cannot yet look up this sort of thing automatically? I understand that I'm working with legacy interop, but still... this sort of "programmer usability improvement" would help a lot in real-world situation where The Big Rewrite is simply not an option.

23 February 2009

On Piracy

From Slashdot:
"We shall go on to the end, we shall fight in .com.fr, we shall fight on the web and on usenet, we shall fight with growing confidence and growing strength in the air, we shall defend our Internet, whatever the cost may be, we shall fight on the servers, we shall fight on port 443, we shall fight in the VPNs and on P2P, we shall fight in the darknets; we shall never surrender, and even if, which I do not for a moment believe, this Internet or a large part of it were subjugated and censored, then our digital Anarchy beyond the web, armed and guarded by ThePirateBay fleet, would carry on the struggle, until, in good time, the New Internet, with all its power and might, steps forth to the rescue and the liberation of the old."

06 February 2009

I hate you, Sam Mendes

Dear Sam,
I have to say, I really hate you. You keep shattering my little dreams of suburban happiness, my little delusions of American Dream; you keep poking your nosey finger at my fears, my neuroses, my false hopes... and for what? For a few bucks more? A few awards more? Didn't you get enough of those with American Beauty and whatnot? No, you had to come back here, you clever bastard, ruining our little and insignificant lives just so that you can keep happy your coke dealer. And this time even with good actors! You really have some gall, I tell you.

Well, I have to say your Revolutionary Road really is "working the magic" (even though the plot is slightly predictable, but we got to expect that from you). I hope you are happy.

Now take those big bags of money and get the f**k off my lawn. I'm still paying for it, y'know.

02 February 2009

On being 30

... like all writers, he judged others on their works while expecting to be judged entirely on his unexpressed feelings and plans.

Thanks a lot for all the wishes and messages! They were all lovely.

I must absolutely report the most "pythonesque" one I got from (obviously) Giulio:

Welcome into the 30s or, if you want, your '3.0' version. How incompatible do you feel from yesterday?

Chapeau, my friend.

16 January 2009

jEdit macro to add encoding declaration to python files

This is a little macro to add a PEP263-compliant string at the top of all open buffers in jEdit. It should probably be improved to skip the shell declaration line (if there), and not operate if the line is already there -- feel free to send patches ;D

Download Add_Encoding_Decl_to_Buffers.bsh

15 January 2009

"See the market and then die"

From medical journal TheLancet:

"Mass privatisation programmes were associated with an increase in short-term adult male mortality rates of 12·8%"

(via Astrit Dakli, who translates that percentage to real numbers: 1 million dead.)

07 January 2009

Adventures in Windows - Subinacl, Cscript and how I wasted an evening

My wife's desktop machine died a couple of days ago, and now Windows won't boot for some reason. After a few unsuccessful attempts at reviving it, I decided that it would be better to simply move her stuff to a spare machine we had laying around (which actually has better specs, but I digress).

So I duly connected the old disk to the new machine, and tried to copy across a few files. Windows said "Access is denied". Apparently, the account names between old and new machine where different, so Windows would show her files as belonging to an unknown account, and refusing access even to an Administrator.
I could have worked around this by booting a Knoppix livecd and taking over, but that would have been slow; I thought that surely there was a pure-Windows solution, some "admin command-line magic", that would fix things. And so the googling started...

There are basically two main elements in Windows file security: the Owner account, and the Access Control Lists (ACL) applied to the object (or inherited). So the first step was taking ownership of all the objects; I accomplished this with a simple script using WMI:

Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colFolders = objWMIService.ExecQuery("Select * From Win32_Directory Where Name LIKE 'F:%'")
For Each objFolder in colFolders
    ' Add the input parameters.
    Set objInParam = objFolder.Methods_("TakeOwnerShipEx")._
        inParameters.SpawnInstance_()
    objInParam.Properties_.Item("Recursive") =  true
    objFolder.TakeOwnershipEx
    wscript.echo objFolder.Name
Next

The script uses a WQL query to retrieve all the directory objects, then takes ownership of them, using the Recursive option in order to take over all files included in the directory as well. I ran this from the command line with "cscript myfile.vbs" and it worked. (I have to say that for some reason this script failed on a few directories under "Program Files", but I simply ignored them.)

Now I could open any directory and set permissions on any object, but I still could not copy several files; this was because the ACL on these objects were set to refuse access to everyone but the old user. Unfortunately, I didn't know how to do that with WQL (I honestly don't know whether it's even possible); so I used SubInACL instead. This is a little tool you can download from Microsoft; it "enables administrators to obtain security information about files, registry keys, and services, and transfer this information from user to user, from local or global group to group, and from domain to domain." Exactly what I needed!

subinacl.exe /subdirectories "F:\*" /grant=Administrators=F

This one-liner simply grants Full (F) rights to any object under the F drive. A few minutes later, and I was finally able to copy the files.

And they say Unix is complicated? If this was an ext2 drive, I could simply have mounted the drive as root to do whatever I wanted. Windows administration is really a bitch.

04 January 2009

NoScript + PingFire = problems

Note to search engines: the PingFire extension for Firefox doesn't work when NoScript is also installed. Check the official PingFire support thread for more info.

Update: I removed PingFire and replaced it with a simple bookmark-in-sidebar hack:

  1. Create a bookmark pointing to http://ping.fm/m (the "mobile" site for Ping.fm) and place it on your Bookmarks Toolbar
  2. right-click on it, select Properties
  3. check the option to "Load this bookmark in sidebar"
This is one of the very few occasions in which I found the Firefox sidebar quite useful.