pythonaro.com

Pythonaro blog

09 March 2010

The joys of Python and Qt

I'm currently working on a tutorial regarding MeeGo, the new Linux-based embedded platform born by the merging of (Nokia-sponsored) Maemo and (Intel-adopted) Moblin. MeeGo is probably the closest thing we'll ever get to a real "Linux for the masses": differently from Android, where Linux is just a kernel for Java to run on top, here we'll have the full GNU toolchain, X display, desktop technologies based on FreeDesktop standards, RPM packages, etc etc.

The main development toolkit for MeeGo, from now on, will officially be QT. This seems to fly in the face of reason, having two existing GTK-based codebases from both "parent" systems which have already been deployed on production devices, but it's actually a very smart choice, as I was reminded just today.

This morning, I was working on a laptop running Windows XP. I built a couple of forms with Qt Designer, then fired up my trusty IDE and wrote the main code, about 150 lines of Python that will download some files, manage a few controls and then display a web page.

After completing a full set of tests on the local machine, I copied it to my (Maemo) phone, and again it was working perfectly -- without any change, recompilation, deployment, anything. Then I went home and copied it back to a different laptop running Kubuntu Linux, and again it was running just fine. Had I had a Mac (or iPad?) laying around, I'm confident it would have run there as well without any change. Consider that the version of QT and PyQt was slightly different on all machines, just to give it a further twist.

Obviously this level of portability has a price. I had to write my code using constructs like QSettings and QNetworkAccessManager rather than messing directly with the Windows Registry or HTTP_PROXY variables. I have yet another (leaky) abstraction layer on top of the OS, which may or may not be to everyone's taste, and the program runs in a sandboxed runtime, which might be slower than natively-compiled code (although this is debatable, these days); but I didn't have to write three different codepaths for each and every interoperation with the OS. I didn't have to worry about having a $HOME or a %HOME%. If I have to worry about packaging is just because I have to write about the ins and outs of a particular platform; in other circumstances I could have simply relied on python tools to do the right thing.

Python and QT could finally deliver the dream of portability that Java promised, if only we give them a sporting chance.

Labels: , , , ,

posted by GiacomoL @ 8:30 PM   0 comments links to this post

03 March 2010

CallBlocker for Maemo

Last week, Vinu Thomas came up with an ingenious script that will silently drop calls on your N900 if they come from a list of "blocked" callers. I never thought you could do that, but apparently there have been quite a few apps for this sort of things on more established platforms like Symbian and iPhone.

At first I suggested a few minor improvements to the script, then I thought I might as well repackage it in a proper application with a proper GUI. I asked permission to Vinu (something the author of "pycallblocker" didn't bother to do), and then I went ahead and put it on Garage.

So there you have it: CallBlocker 1.0 for Maemo 5. Note that it relies on the python2.5-qt4-gui package, currently available only in the extras-testing repository.

The current feature-set is quite limited: you basically enter a list of phone numbers, and callers (exactly) matching them will be sent a busy signal or redirected to voicemail.

It did get quite a warm reception on talk.maemo.org, so I'm motivated to keep development ongoing (at the expense of other, still-unreleased stuff I have almost ready). The current plan is to release a 1.1 version with support for suffix wildcards (e.g. entering +441234*, all numbers beginning with +441234 would be matched and dropped) and better daemon management. Then, time permitting, I'd like to have a 2.0 with features like blocking all withheld/private numbers, blocking SMS texts, blocking specific contacts from address book, blocking all numbers not in addressbook, blocking only during some hours, and possibly even a "whitelist" mode.

Once it reaches a certain maturity, I'll probably consider moving it to the Ovi Store, at which point PyQt licensing issues might arise, but we'll cross that bridge when we get to it.

Labels: , , , ,

posted by GiacomoL @ 3:25 PM   0 comments links to this post

21 February 2010

KDE 4.4.0 on Kubuntu Karmic 9.10 -- a note of warning

I just upgraded my Kubuntu 9.10 "Karmic Koala" from KDE 4.3.4 to 4.4.0 using the backports repository. A note of warning: take a backup.

It took me something like 4 or 5 runs of apt-get dist-upgrade / apt-get -f install to get back a working setup. APT complained about a couple of things (python-qt3-doc conflicting with some newer package which includes the same examples, and Bilbo having been renamed Blogilo) but eventually pulled it through.

I was smart enough to backup the .kde home directory before launching a 4.4 session, and I'm glad I was. First run: Plasma crashed hard on a segfault, and didn't restart. Ok, this happened with some past upgrade already, let's just move away the old .kde home... got back a default desktop. Playing around with widgets, I hit another crash. And another. The culprit was always the Plasma Desktop, actual applications were running fine. Eventually, I moved back the old .kde home except the plasma* files under .kde/share/config/. This gave me back all my old KDE settings, except for Plasma. Win, I thought, and merrily set out to recreate my previous desktop arrangement.

Another crash.

So uhm. I'll try to track down what exactly Plasma doesn't like in my setup (which was, for the record, with two panels on left and right edge; Lancelot and a couple of QuickAccess widgets on the left, task manager and shutdown button on the right; two Plasma "views" and 4 virtual desktops), but if you are planning a similar upgrade, make sure you put aside some time for it, and get a good backup beforehand.

(I guess the question now would be "is it worth it?". Well, KDE does look more polished, applications are faster to launch and more responsive... it does look like we're finally at the point where one could upgrade from a 3.5.x release to 4.x and feel a bit awestruck.)

Labels: , ,

posted by GiacomoL @ 11:56 PM   0 comments links to this post

09 February 2010

Mobile applications for Nokia phones with... javascript ?!?

A few days ago the lovely folks at NSManchester, an Apple user group, gave a chance to "the enemy" (i.e. Nokia) to present their technology stack and business strategies for attracting developers.

The two presenter were a bit underwhelming (understandable after they went through the usual, hellish experience with British railway services), and there was little talk of my beloved Maemo, but it's hard to dismiss the technology stack they have chosen to go forward. Key element seems to be the QT library they acquired last year, which I know and love through the original Python bindings. It's powerful and as cross-platform as it can be, with a lot of mindshare in the Linux and Windows communities; this said, it's still C++, and it's hard to get excited about C++ these days. Also, the runtime will gradually appear on new and recent phones but probably won't make it to older ones.

The second development platform they are pushing, however, was more of a surprise to me. Apparently, you can use JavaScript to write applications for recent smartphones (S60 5th ed. -- N97 and 5800 -- and S60 3rd ed. FP2 -- e.g. E72, N85, N96 etc). You can access GPS coordinates, contacts and calendar items, as well as having complete freedom to design the UI with standard HTML and CSS. You don't need to sign the resulting packages, the barrier to entry is lowered dramatically. This is potentially a game-changer, and I don't know why Nokia are not shouting it from the rooftops. Early adopters include Netflix, which uses a basic JavaScript interface to stream their Flash content (!) -- so yes, you can use flash as well. My head simply went "boom"; I must look into this stuff.

One other thing I noticed was the presenters' style, typically European: self-deprecation and brutal honesty about things that work and ones that don't. It was refreshing, after weeks of Yanks propaganda from Google and Apple pushing their new gadgets as "fantastic", "amazing", "revolutionary" etc etc etc...

Labels: , , , , , ,

posted by GiacomoL @ 8:16 AM   0 comments links to this post

29 January 2010

Backupify

Thanks to the lovely gPodder on my Nokia N900, I've recently discovered the net@night podcast by Leo Laporte. Like many regular podcasts, it's mostly full of random chatting and showmanship. In this respect, "new media" tend to be exactly like "old media": forced by their own schedule to blabber for the sake of it. But I digress.

The best segment of Laporte's show is usually an interview with someone from a startup, which is a good way of finding out about new services. Yesterday, it made me sign up for Backupify, a "social media backup tool" which will scrape your GMail / Delicious / Facebook / Flickr / Twitter / Blogger / Wordpress etc etc and store all the resulting data in a safe place on Amazon's cloud. Not a bad idea: the first 20 years of the Age of the Internet should have taught us, if anything, that data is ephemeral and can disappear at the flick of a switch. What happened to Geocities is proof that today's giants won't necessarily be with us tomorrow. Conscious of this state of things, Backupify gives you the option to drop your data on your own Amazon server, so that it will still be available if they go belly-up; quite a honest approach for a startup. It used to be a pay-only service, then went free to accelerate growth and get some venture capital; they will move to a freemium model after January 31, so you better try it out now if you can.

Good "Web 2.0" services usually expose APIs that make backups relatively easy for a programmer, but who's got time to write dedicated scripts AND the foresight to run them regularly? Myself, I've probably written half a dozen GMail scrapers, but I hardly ever ran them more than once. I've exported this Blogger-powered site once, and it was a nightmare. Backupify makes it very easy to "set up and forget", and that's good. The data will only be as good as what the various sites will allow; for example you will never be able to "restore" a Twitter account, so Backupify will only give you a PDF of your (and your friends') twits, which is the best you can expect. For Google Spreadsheets you get XLS files, for Blogger you get a big XML containing all your posts, etc etc.

The only problem with the site is the password anti-pattern: in order to get at your data, they often have to ask for your login details, and will store them on their servers. They do use OAuth if the service supports it (like Facebook or Google), but otherwise you'll have to trust them with your credentials. This makes them a very good target for black-hat hackers, among other things. I do hope they know what they are doing.

Labels: , ,

posted by GiacomoL @ 11:17 PM   0 comments links to this post

25 January 2010

How the Nokia N900 is improving my life

(Small things, but...)

Today I had to took my car to the garage, so had to tell my manager I'd likely be late (public transport is not terrible in our area, but it still takes me about twice the time to get to the office than it would with the car). I'm also down with a laryngitis and I can barely whisper.

I could have booted my home laptop to send an email or IM, but meanwhile the bus would have come and gone. So I hit the road anyway, and thought I would somehow email from the phone.

But then, the Nokia N900 is no Blackberry; it's a full-fledged linux desktop in your pockets. When I enabled the 3G data connection, the button nearby was the one to set your IM status(es) to Online; so I fired that up, looked up my manager in the wonderfully integrated address book, and she was online, so while I sit on the bus, we had a friendly chat about things to do, without having to share them with other commuters or strain my poor throat.

All the while, I was listening to the latest Python 411 podcast about the (apparently terrific and currently-slashdotted) Sikuli project, updating expenses on the little program I've developed (which I'll upload to the Ovi Store in a few weeks, I promise), and browsing Google Reader. The 30-mins commute was over in what seemed like seconds, and the experience was basically the same I could have had while sitting at my desk with a regular laptop.

This little thing is simply outstanding. Apple's new "iWhatever" better have a SIM slot, or they can kiss goodbye to their iPhone marketshare.

Labels: , , , , ,

posted by GiacomoL @ 11:18 AM   1 comments links to this post

19 January 2010

Remote shutdown on Windows

This might sound useless or obvious to many, but i didn't know it and it made my life easier today...

If you ever need to shutdown a remote Windows machine, and you can't access it with Remote Desktop or similar tools, you can use Shutdown.exe from another Windows machine, like this: shutdown /m \\my-remote-host

Additional parameters can be seen with /? but the most useful ones are:

/r
reboot after shutdown
/f
force shutdown -- useful when the machine looks stuck, which is what happened to me today...
/d xx:yy
give a reason for reboot. See /? for the available codes.

I hope this means I can say goodbye to dangerous hard-reboots...

Labels: ,

posted by GiacomoL @ 10:54 AM   0 comments links to this post

18 January 2010

Nokia Ovi Store Policies on SaaS / subscriptions: fail

(Chances are that nobody will answer this question, like it happened to this developer on forum.nokia.com, but what the hell)

I have an interesting business idea. I'll develop a mobile application with some interesting functionality, and I'll give it away for free. The application will contain an option to upload some data to a remote server, which you will then access from any computer as a regular site. The website will have some advanced features to analyze the data etc etc. The site will operate as SaaS, with a free 30-day trial. Basically, the site will make the real money, in a way similar to what FeedDemon and NewsGator tried a few years ago in a different market.

Now, if I wanted to do that on Nokia platforms, I would try and put my mobile app on the Ovi Store as a free download, right? After all, it will be a useful program in its own right, with the online services being 100% optional. Nokia / Ovi get a free, useful app enriching its (crappy) customer experience, the developer gets a big distribution channel, it's a win-win!

Except that landlords don't like uppity sharecroppers. From the Ovi Terms & Conditions:

4.7. Free Content Restriction

You are prohibited from collecting future charges from end users for Content that those end users were initially allowed to obtain for free. This is not intended to prevent distribution of free trial versions of Your Content with a later upsell option to obtain the full version of the Content. Such free trials for Content are permitted. However, if You want to collect fees after the free trial expires, You must collect all fees for the full version of Your Content through the Program. In this Agreement, "free" means there are no charges or fees of any kind for use of the Content. All fees received by You for Content distributed via the Program must be processed by Nokia.

Now, I can see the motive behind such a "racket clause". Nokia doesn't want Ovi to end up a cesspool of trialware, or to be associated with "click once and pay forever" scams. But the rule is too broad, and it reads like any SaaS scenario is simply out of the question (especially when you consider that Ovi does not support "subscriptions" at the moment, only one-off payments). SaaS is probably the best revenue model in the software world at the moment, and Nokia is telling developers they can't use it.

I honestly do not know if Apple put similar restrictions in place on their store. They probably did (and then some), control-freak as they are, and this is why I wouldn't want to touch the iPhone ecosystem with a barge pole. But Nokia was supposed to be trying hard to regain developer mindshare...

So the question I'd like to ask, before I shell out for the Ovi "publisher" license, is: dear Nokia, my application does something useful on your mobiles. It will then, optionally, send some data to my server, and I will personally collect money to have people access that data on the web, aggregated in various ways. Can I put the app on Ovi?

Labels: , , , , ,

posted by GiacomoL @ 2:51 PM   3 comments links to this post

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.

Labels: , ,

posted by GiacomoL @ 8:17 AM   0 comments links to this post

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.

Labels: , , ,

posted by GiacomoL @ 3:20 PM   0 comments links to this post

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.

Labels: , ,

posted by GiacomoL @ 7:50 PM   0 comments links to this post

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.

Labels: , ,

posted by GiacomoL @ 8:01 PM   1 comments links to this post

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.

Labels: , , ,

posted by GiacomoL @ 5:23 PM   2 comments links to this post

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.

Labels: , ,

posted by GiacomoL @ 3:26 PM   1 comments links to this post

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.

Labels: , , , , , ,

posted by GiacomoL @ 8:15 PM   5 comments links to this post

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?)

Labels: , , ,

posted by GiacomoL @ 8:26 PM   0 comments links to this post

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...

Labels: , ,

posted by GiacomoL @ 12:22 PM   0 comments links to this post

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...

Labels: , , ,

posted by GiacomoL @ 10:29 PM   1 comments links to this post

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.

Labels: , ,

posted by GiacomoL @ 12:51 AM   2 comments links to this post

15 August 2009

Django 1.1 help file CHM version

This is a funny story.

I happen to think Microsoft's proprietary CHM format is lovely. So I went looking for a CHM version of docs for Django, and google found it for me on this blog. I duly downloaded it, tried to to open it and... it wouldn't display. I could only see the TOC, but not the actual documents. I thought this might be a corrupted version, and it was for an alpha release of Django anyway, so I though I'd compile a version myself. After all, these docs are built with Sphinx, which apparently can generate all sorts of formats...

So here's the procedure to compile django's docs:

  1. download and install Sphinx.
    Easy_install Sphinx
    was all I needed. Hurrah for Python.
  2. Run Sphinx to generate the initial files:
    cd Django-1.1/docs
    mkdir _build/html
    %PYTHONDIR%\scripts\sphinx-build.exe -b htmlhelp -d _build\doctrees . _build\html
    
  3. Download and install Htmlhelp.exe from the Microsoft site. This will give you the HTML Help Workshop.
  4. launch the workshop, File -> Compile..., select the file Djangodoc.hhc which should now be in _build/html, and this will produce the chm.
  5. ...??? Profit!

... Then I found out the reason that downloaded CHM didn't work was a stupid patch from Microsoft. Ouch.

Anyway, if you need it, here's the file: Djangodocs 1.1 in CHM format. If it doesn't work, make sure you follow this suggested procedure, and save yourself some time...

Labels: , ,

posted by GiacomoL @ 10:19 AM   2 comments links to this post

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.

Labels: , , ,

posted by GiacomoL @ 3:00 PM   0 comments links to this post

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 ;)

Labels: , , ,

posted by GiacomoL @ 7:37 PM   0 comments links to this post

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.

Labels: , ,

posted by GiacomoL @ 1:40 PM   0 comments links to this post

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.)

Labels: , , ,

posted by GiacomoL @ 7:54 PM   2 comments links to this post

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.

Labels: ,

posted by GiacomoL @ 9:08 AM   2 comments links to this post

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.

Labels: , , , ,

posted by GiacomoL @ 2:50 PM   0 comments links to this post

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 :)

Labels: , ,

posted by GiacomoL @ 9:57 AM   3 comments links to this post

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?

Labels: , , , ,

posted by GiacomoL @ 2:39 AM   0 comments links to this post

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...

Labels: , , ,

posted by GiacomoL @ 10:03 PM   0 comments links to this post

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.

Labels: , , ,

posted by GiacomoL @ 9:42 AM   6 comments links to this post

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)

Labels: , ,

posted by GiacomoL @ 9:22 AM   0 comments links to this post

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.

Labels: , , ,

posted by GiacomoL @ 7:22 AM   1 comments links to this post

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.

Labels: , ,

posted by GiacomoL @ 6:43 AM   0 comments links to this post

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).

Labels: , , , , , , , , ,

posted by GiacomoL @ 2:27 PM   0 comments links to this post

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.

Labels: , , , ,

posted by GiacomoL @ 6:58 PM   0 comments links to this post

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).

Labels: ,

posted by GiacomoL @ 11:19 PM   0 comments links to this post

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.

Labels: , , , ,

posted by GiacomoL @ 4:53 PM   0 comments links to this post

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

Labels: , , ,

posted by GiacomoL @ 9:10 AM   2 comments links to this post

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.

Labels: , ,

posted by GiacomoL @ 10:59 AM   2 comments links to this post

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...)

Labels:

posted by GiacomoL @ 5:07 PM   4 comments links to this post

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.

Labels: , , , , ,

posted by GiacomoL @ 4:10 PM   1 comments links to this post

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

Labels: , ,

posted by GiacomoL @ 11:51 AM   1 comments links to this post

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.

Labels: , ,

posted by GiacomoL @ 11:24 PM   2 comments links to this post

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.

Labels: , , ,

posted by GiacomoL @ 10:36 AM   0 comments links to this post

29 December 2008

Guido van Rossum on speed and the array module

Giulio (through his feed on Delicious.com) pointed me to a nice post from "benevolent Python-dictator" Guido van Rossum. The essay describes a few general rules for improving performance of Python programs, and it also reminds us of "an odd corner of Python", the array module. Go and read it, it's worth it.

It also made me discover "an odd corner" of the Python website: the collection of Guido's essays. As demonstrated by the original post, this page is much more interesting than Guido's own blog, and so it's very disappointing that it doesn't have a feed to monitor. Mmhh... Edit: well, stuff there looks a bit stale, I guess Guido doesn't use it very much anymore. Still, it's the sort of thing that should have a feed. Maybe python.org should move to django? ;)

Labels: ,

posted by GiacomoL @ 2:36 PM   4 comments links to this post

11 December 2008

Yes, I'm schizo

The last two posts show complete opposite attitudes. The one on Python shows my better self: rational, positive, calm. The one on Amarok shows my "bad" self: melodramatic, irrational, sarcastic.

Maybe I seriously need medication...?

Labels:

posted by GiacomoL @ 4:11 PM   0 comments links to this post

On Amarok 2, Or: How You Can Always Find A Way Of Shooting Yourself In The Foot

At the beginning, it was WinAmp. And Linux people saw it was good, and lo, XMMS was born. But then XMMS grew old, as it was built with obscure graphic libraries for X-server that no-one knew anymore, and its interface was kludged by too many broken skins. So the desktop-people spawned dozens of their own players, all broken in one way or the other, and the Linux people grew sad.

One day, from the sky a new player fell, and it had excellent playlist and collection management, and it would read your mind and find music you didn't even know you had anymore. They called it Amarok, and started spreading the good news to the unfaithful, and lo, even the barbarian "windowsers" started being converted by the power of the Loved Wolf.

But in their hearts, people knew that the good times would end sooner or later. Because it was written that decent programs, when condemned to upgrade cycles, will inevitably be subject to feature creep and unneeded refactoring. And so it was, once again: Amarok 2 was unleashed onto the world, and people could see its brokenness. The program had been corrupted (like many before) by the temptation of integrating "with the web", renouncing playlists and smart features in order to pander to brainless chavs -- people more interested in seeing an album sleeve or reading about the sex life of boybands than listening to the actual music. And the Linux masses were left stranded, once again, without a decent media player, condemned to wander forever in the land of sadness and broken players.

(All this to say that Amarok 2 sucks -- they've taken away good features in exchange for eye-candy which reminds me of the terrible Windows Media Player. I'm staying on Amarok 1.x forever.)

Update: a year later...

Labels: ,

posted by GiacomoL @ 2:24 PM   8 comments links to this post

06 December 2008

If only we could re-use stop-energy...

I confess: I'm a whiner, a moaner, a reactionary bitch. I like to pundit and joke about new things, it's actually much easier than making new things, isn't it... You can just wait there and shoot from the hip, it'll make you feel all righteous and smart, and it's free!

Italians are champions at moaning.
Fat lot of good it does to our GDP.

You probably already know that Python 3.0 was released a couple of days ago. After the first 24 hours of joy, the inevitable wave of stop-energy hit the crap-blogo-sphere, mostly in the form of classic concern-trolling or uninformed criticism. Now, this is inevitable; for every big action (and releasing Py3k was a huge step) produces a reaction.

The transition to Python 3 was announced eight years ago, discussed in detail for ages and eventually implemented in the last two years. Dedicated tools helping the porting effort have been developed and work pretty well, certainly better than most VB6-to-.NET wizards released by Microsoft around 2001. The old codeline will be maintained and updated for well over a year from now, with at least another major release planned, so there's no hurry to upgrade, no pressure whatsoever. Documentation of the changes is pretty exhaustive. Major third-party apps and libs have been ported already or are in the process of being ported.

So, what's left to moan about? Breaking backward compatibility. The very first thing that was announced 8 years ago, and since discussed in the most excruciating details, to the point where the "major changes" seem almost banal.

"Yeah, we got great Unicode support and the with statement, but so what? print is now a function! That's it, I'm switching to Ruby!"
"Wait, did you ever actually use Python? Do you know how much painful it was to work with Unicode? Or all that crap about new-style and old-style classes?"
"Well, I don't really know the language much..."

Stop-energy is for losers and trolls. Ignore the bitching, Python 3 will rock.

(now, if only I can manage to compile the flipping thing...)

Labels: , ,

posted by GiacomoL @ 1:09 AM   3 comments links to this post

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.

Labels: , , ,

posted by GiacomoL @ 11:39 PM   0 comments links to this post

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."

Labels: , ,

posted by GiacomoL @ 10:09 AM   0 comments links to this post

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.

Labels: ,

posted by GiacomoL @ 12:06 AM   2 comments links to this post

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 :)

Labels: ,

posted by GiacomoL @ 1:26 PM   2 comments links to this post

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.

Labels: , ,

posted by GiacomoL @ 11:40 AM   0 comments links to this post

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.

Labels: , , ,

posted by GiacomoL @ 1:26 AM   0 comments links to this post

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.

Labels: ,

posted by GiacomoL @ 1:50 PM   2 comments links to this post

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).

Labels: , , , , ,

posted by GiacomoL @ 12:17 PM   2 comments links to this post

11 October 2008

Notes on Google Finance API

I recently started dabbling in shares (yeah, I know, I like swimming against the flow), and so I looked around for good stock-price trackers for KDE3. To my surprise, I couldn't find anything apart from the usual KMyMoney (which I like and use, but it's not really something you can keep open all day on your desktop). I had already put my stock info on Google Finance, and lo, the service has a GData API, so I decided to write a small script in Python to retrieve my portfolio and the daily variations.

The good thing about GData APIs is that they are all the same at a basic level, so even when client libraries don't explicitly expose new features (like in this case, as Finance is quite a new service), you can still use the APIs to get easy authentication and feed-parsing. So I went and downloaded the official (and excellent) gdata-python-client package, which is dead-easy to use:

from gdata.service import GDataService

client = GDataService()
client.email = 'your_email@gmail.com'
client.password = 'your_password'
client.service = 'finance'

client.ProgrammaticLogin()

baseURL = "http://finance.google.com/finance/feeds/%(email)s/" % {'email':client.email}

# to get all data in one go:
#  bigFeed = client.GetFeed(baseURL + "portfolios?positions=true&returns=true")
# and then positionsFeed is included in each Entry
#  positionsFeed = gdata.GDataFeedFromString(bigfeed.entry[0].FindExtensions('feedLink')[0].children[0].ToString())

# ... but I really just want the first portfolio
positionsFeed = client.GetFeed(baseURL + "portfolios/1/positions?returns=true")

for entry in positionsFeed.entry:
 details = entry.FindExtensions('symbol')[0] 
 symbol = details.attributes['symbol']
 name = details.attributes['fullName']
 
 data = entry.FindExtensions('positionData')[0]
 totalReturn = round(float(data.attributes['returnOverall']) * 100,2)
 gainPerc = round(float(data.attributes['gainPercentage']) * 100,2)
 
 print name + " (" + symbol + ") Return: " + str(totalReturn) + "% - Gain: " + str(gainPerc) + "%" 

One should really make an applet or something for KDE, but I'm leaving for Japan in about six hours so I can't be bothered...

Labels: , , ,

posted by GiacomoL @ 9:31 PM   0 comments links to this post

05 October 2008

Horrible Hack to get Python 2.6 on Debian or Kubuntu

I wanted to try out the newly-released 2.6 version of our beloved Python, but unfortunately Debian didn't have a package for it yet (and it still doesn't). I wasn't too afraid of screwing up my laptop, as it's probably going to be formatted very soon anyway, and I didn't want to mess around with deb build scripts, so this is what I've done:

  1. got the official source distribution, untarred and cd in the resulting dir Python2.6
  2. got some additional packages: apt-get install tk8.4-dev libgdbm-dev libdb-dev libreadline-dev libsqlite3-dev libncurses5-dev (and possibly a few others)
  3. ./configure --prefix=/usr --enable-ipv6
  4. make
  5. checkinstall -D --pkgname=python2.6 --pkgversion=2.6 --maintainer=g.lacava@gmail.com --inspect --backup=yes --install=no make altinstall
    This command allowed me to review the package contents and remove what I didn't need, which is basically everything outside the "python2.6" directories and which might already exist on my system (so I didn't want to overwrite it).
    I took out the lines /usr/bin/pydoc, /usr/bin/idle and /usr/share/man/man1/python.1
    UPDATE: when checkinstall asks if you want to create a default set of docs, say "yes", or you might get an error about ranlib further down (see comments).
  6. installed the produced .deb package
  7. copied back pydoc and idle (from the build directory) and /usr/share/man/man1/python.1 (from the Misc directory), all with "2.6" appended. I then set up alternatives with update-alternatives --install symlink name alternative priority (mainly in order to "redebianize" my impure karma); UPDATE: well, using alternatives (a 100% Debian solution which works perfectly well for loads of other multi-version script engines) will break your system, because some developers absolutely must reinvent the wheel every 5 minutes and then proudly announce that bugs won't be fixed. The stupidity of it all is staggering.

First impressions: 2.6 seems fast as hell. I don't know if this is due to the custom compilation though, rather than improvements in the runtime.

Labels: , , ,

posted by GiacomoL @ 2:14 PM   13 comments links to this post

16 September 2008

on PyconUK 2008

Great conference, like last year. Interesting talks, nice people, spotless organization. Go to the PyconUK wiki if you want slides and (in a few days) recorded audio.

Next year the same bunch of great guys will host EuroPython, in June. I'm sure it will be fantastic, but I don't know whether I'll be able to attend, as it will happen during weekdays and I probably couldn't justify the absence from work. Apparently it's all because the French don't go to conferences during weekends; it's always their fault, isn't it ;)

Anyway, it was all good energy to start messing again with Django on a magnatune-inspired project. Also, we'll try to "reboot" Python North-West and see if we can stabilise it a bit. It's all fun :)

Labels: , , ,

posted by GiacomoL @ 12:13 PM   0 comments links to this post

14 September 2008

Fact.

Jacob Kaplan-Moss looks like a young Robin Williams.

Labels: ,

posted by GiacomoL @ 4:24 PM   0 comments links to this post

11 September 2008

Off to PyconUK

So, tomorrow night I'm off to Birmingham to attend Pycon UK. I don't think I'll liveblog like last year, I'll try to be more social. To be honest, I'm not as excited as last year, probably because the conference was so good in 2007 that I doubt they'll be able to top it. This said, let's hope I'm wrong (as usual).

Labels: , ,

posted by GiacomoL @ 9:17 PM   0 comments links to this post

06 September 2008

Goodreads Collapse Folders

This is yet another greasemonkey script for Goodreads, this time to deal with a minor annoyance.

A GR group (basically a forum) can have "folders" of topics (basically different areas/sub-forums). When you look up a group, you will get a list of all folders, with the last 4 discussions for each folder; on a group with dozens of folders (e.g. the SciFi and Fantasy Book Club) it means you might have to scroll quite a bit to get the (small) link to the folder you're interested in.

So this script will make the folders "expandable", and collapse them by default if they are more than a certain amount (by default 2, but you can customize this threshold). Preview:

Labels: , , ,

posted by GiacomoL @ 6:07 AM   0 comments links to this post

02 September 2008

Goodreads Exploder

Another little script for fellow GoodReaders: GoodReads Exploder will add a link to "Explode" all the books on the shelf in different tabs. It saves having to CTRL-click on each book or losing the original shelf page while you browse the books.

Since this might be a bit dangerous with lots of books, if the shelf contains more than 10 books, the script will warn you and give you the option to cancel the operation before your browser "melts". You can change the limit to suit your machine.

This script uses several of the most recent Greasemonkey features (GM_openInTab, getValue, setValue...). It was a lot of fun to write, Greasemonkey really is a fabulous toolkit; the FF Extensions framework is, in comparison, very complicate and burdensome (which I guess is the trade-off for all the power they give developers).

Labels: , , , ,

posted by GiacomoL @ 11:26 AM   0 comments links to this post

01 September 2008

a question of Snopes

Somebody you love (or in your family) forwards one of those email-chains. It's not even too bad, the content is not racist or virulently conservative, even though it might be interpreted as a veiled anti-Muslim piece. Quite a few people are CCed in the email. What do you do?

  1. You just ignore the email. Nobody "on the net" pays attention to those anyway.
  2. You reply only to the sender, pointing to the relevant Snopes link, and admonishing on the perils of forwarding this sort of chain.
  3. You hit "reply to all", pointing to the Snopes link. The level of "flamin' & shamin'" in the reply will depend on your willingness to maintain a friendship with the original person.

This just happened to me, and the sender was... my mother, who increasingly uses email (without being particularly techno-inclined).

After careful consideration, I went for option 3, keeping the tone as soft as possible. I have to say I've done it because it explicitly mentioned "UK schools" in a negative tone for something they are not, in fact, doing at all. I also thought this might teach my mom never to forward this sort of things, no matter how good they seem, in a stronger way than just admonishing "behind the scenes". However, I now feel a bit guilty.

What would you have done in my situation?

(This is clearly material for a comedy sketch...)

Labels: ,

posted by GiacomoL @ 2:42 PM   1 comments links to this post