The Hyperpessimist

The grandest failure.

My Mobile Toolbox

I’ve learned my share of things since starting to cycle. One of the more important points is: never leave house without the bare essential of tools. You will need it when you don’t have it. I had my share of flats, broken tubes, broken hangers, punctures etc.

In case you’d like to learn from my mistakes, I made a photo of the contents of my saddlebag:

You see, there is a spare tube, in case I have a huge blowout in my tubes or can’t locate a tiny hole on the quick. I rarely have to use it, but when I do it spares me walking home my bike, which could be quite far in the middle of nowhere. Then I have a multitool, can be used to adjust all kinds of things. I had to use it often in Japan when taking my bike on a train. Back in Germany not so much. Then there is a puncture fixing kit, because I just feel bad throwing a tube out that can be fixed easily. Not because tubes are that expensive, but I just don’t like the idea of throwing perfectly fine things away that can be fixed easily.

Next up, tire levers. Oh boy, these are a game-changer. If you have ever tried taking off your tire, you’ll know how annoying it can be. These help immensely. Left to it there is a miniature swiss knive. I like the small scissors most. Below the swiss knive you can see tire boots: if your tire has a hole, you can glue these to the inside of your tire to protect your tube, to get home safely. I think I used them once of a shitty Giant tire and another one on a cross bike tire of a friend.

Then some cable straps, cause you could always use some. A more exotic part is the dereilleur hanger. I broke off my first one and my current one was already bent, so for safety’s sake I bought a spare. You probably don’t need one if you can manage riding a bike without falling over all the time. I know I can’t. Last but not least 5 AAA batteries for my lights. My front light needs 3, the one on the back takes 2. I had to abandon trips after dark just because my lights decided to run out, so I am preparen now.

Hope that helps you and stay safe on the streets.

On Standing Up

This one is a story on personal failure, but heck, maybe it’ll help me to improve.

A couple of days ago I was taking the subway and since there is a construction site on the line, parts of the trip are replaced by bus connections. So you get out of the subway, go to a bus, take the bus to where the subway resumes and continue.

It was a rainy day and I got out, along with the couple people travelling at night. Among these was a girl with a bike. She was taking the subway because it was actually raining pretty terribly and getting all wet kinda sucks and cycling in the dark while it is raining can be dangerous. She looked like an avid cyclist, with a “proper” bike, a cycling backpack, helmet and clipless shoes. Actually, it is mostly the latter at which you can judge how serious people are riding. In other words, she was definitely part of us, serious cyclists.

While getting on the bus, the driver started to complain that bringing bikes on the bus is not allowed and was trying to get her to leave the bus.

So of course I did the only possible thing… exactly nothing.

I could have told the driver that it is not a problem, that nobody has a problem with her and the bike, that there is definitely enough room, that it is a subway-replacement ride and this should include bikes, because what, should she leave the bike at the station and risk it being stolen? All valid points that I could have said, but I didn’t do anything.

Sorry, fellow cyclist.

(In the end, somebody else pointed out that there were people with bikes the day before and the girl was able to continue on the bus with her bike.)

Debian 7 Update Experiences

A couple of days ago Debian 7.0, “wheezy” came out so I decided to update my servers. Updating servers is something I don’t really look forward usually, since the fact that they are remote and breaking their network connections means I’ll have a hard way fixing this. That said, it is necessary because support does not last forever and the sooner I update the better.

So I have the following setup: one host system running KVM managed by libvirt and running two VMs, basically one for PHP/MySQL and one “safe” VM for the rest, all of them running Debian 6.

I started with the PHP VM, since it was the least critical one to get some initial experiences. When following the release notes you’ll end up… perfectly fine. The nginx server got updated to a much newer version and hopefully the update scripts will not forget starting it anymore, PHP was updated from 5.3 to 5.4 which doesn’t seem to have caused any regressions as far as I know and MySQL was updated from 5.1 to 5.5 which restarted and continued to work just fine. That part went quite well.

The second system took quite a bit longer, since I had to update PostgreSQL from 8.4 to 9.1 and this is a royal pain in the ass because Postgres can’t migrate old databases on its own, but rather needs a script called pg_upgradecluster to dump data from a running 8.4 server to import it in a running 9.1 server. Now this is the part where it failed.

Between 8.4 and 9.1 the word new ceased to be a keyword, so the 9.1 version of pg_dump does not quote it. But when running against an 8.4 server, it is a keyword, so the server returns an error because of invalid SQL. I am not quite happy how the Postgres developers handle the behaviour of pg_dump because always quoting identifiers would avoid this problem once and for all, but that’s how it is. Fortunately, 9.1 pg_dump got an option --quote-all-identifiers so I copied pg_upgradecluster and added this option myself. This worked… fine, well, except that such an update of a database that was some modest 1 GB large took about 5 hours and was thrashing the server really hard. I suppose it managed to hit both a worst-case algorithmic complexity in Postgres and maybe also an ext3 failure, since kjournald was running like crazy. Anyway, in the end I am happy this worked after all, I also filed a bug. It seems to be fixed in PostgreSQL now, we’ll see whether it makes its way back to Debian Wheezy.

That was my second machine. The rest of the failures were only virtualenv, because mkvirtualenv copies the python binary, so it copied the old Python 2.6 from squeeze which was built against OpenSSL 0.9.8. As I deleted this library, since Wheezy comes with 1.0.1, all copied Python binaries failed to start. Recreating the virtualenvs was not a big deal, this way they could also be made to use Python 2.7 directly. I don’t blame Debian on this, maybe there is a reason why virtualenvwrapper does this, but it is something to keep in mind.

The last machine was the host system. I was worried about this one, since I didn’t feel like fixing something that might have broken inside libvirt. libvirt is a huge beast and I frankly am happy to leave it alone as long as it runs. So first I tested saving and restoring VMs, which worked really fine. Then I ran the update which went smoothly until it came to the point where it was unable to write GRUB2 to /dev/md0, the RAID1 that holds my /boot partition. I was getting really worried about this, because debugging a failing bootloader over the internet is something that takes forever and I could be sure that the previous GRUB-legacy wouldn’t be able to boot the system. So I backed up the partition, thought about replacing it with a non-RAID version, tried resizing the partition to fit a small GRUB2 partition and finally I decided to recreate it and restore it as a RAID1 again. In the process I realized that there seems to be multiple RAID metadata formats nowadays: 0.9 and 1.1 as well as 1.2. mdadm notified me that only 0.9 is supported for /boot partitions, but it seems current versions of GRUB2 also have modules for the newer formats. Anyway, I chose to use the 0.9 format, ran grub-install /dev/sda and grub-install /dev/sdb, hoped for the best and rebooted.

Lo and behold, the system came up again without problems. The only issue is that desipte disabling auto-start for my VMs libvirt seemed to have started them, so they lost their uptime and I couldn’t just restore them from file. So they went through a forceful poweroff but besides this, everything is fine. Overall, I’d say this update went rather smooth and I’ve bought myself some years until Debian 8.0, “Jessie” comes out.

Google, That Ghost Just Isn’t Holy Anymore

This is a somehow personal observation. Since years now, Google used to be the non-plus ultra cool place to work. Not that I and probably great amounts of fellow-nerds care too much about web and such, but it seemed like a genuinely cool place for people to work at since you were surrounded by great people.

They are doing tech-talks and invite students to come over and see how cool the Google offices are. And they indeed are. They send recruiting mails after checking GitHub accounts. This is more than any other company I know does. The german office of Microsoft is also around the corner from here, but they never do cool things. And the office is a normal boring corporate office, at least the part that I saw.

Google also used to do cool things, like putting up bearable free email service (remember all these crappy web mailers of ye olden days?), published SDKs for Linux users, had probably the biggest XMPP server, opensourced a decent web browser and contributed to a great browser engine. There’s really a lot of cool and some less cool stuff that Google published.

But lately, my admiration faded. Especially the last two years, where Google started to discontinue a lot of services. Now of course, they can discontinue whatever they want, but the outcry of the readercalypse was quite huge. Google often open sourced stuff after they shut it down (Etherpad, Wave), but Reader just went away. That’s not tragic, since a number of replacement services have popped up (I use NewsBlur, generous free tier, available on web and mobile, free software), but Google effectively discontinuing GTalk to push Hangouts is quite a thing.

GMail/GTalk was propably the most useful service for me since many people had it and chatting with them was very easy: no need to convince them to use XMPP in addition to whatever they already have (Facebook, Whatsapp, what-have-you), no need to tell them how to install an XMPP client. You just contacted them. This possibility is gone.

These days, I am hesistant to even try any Google service. They rolled out Google Keep, but who knows how long it will exist?

I think I preferred the non-Google+ Google, the old-skool-cool. And I am not the only one.

Iozone3 for Raspbian

Lately I was thinking about SD card performance on the Raspberry Pi. The crazy long benchmarking thread complains about the duration to compile iozone3, so I went ahead and added it in my repository:

1
2
3
4
5
wget http://xivilization.net/~marek/raspbian/xivilization-raspbian.gpg.key -O - | sudo apt-key add -
sudo wget http://xivilization.net/~marek/raspbian/xivilization-raspbian.list -O /etc/apt/sources.list.d/xivilization-raspbian.list

sudo aptitude update
sudo aptitude install iozone3

(packaged the same as upstream Debian in the non-free section, which I just added to the repo)

Have fun benchmarking!

Go for Raspbian

Update: I updated the builds, binaries for the Go 1.1 final release are available.

I am a perfectionist. Therefore, after reading the instructions on how to install Go I was kinda annoyed: the Go release that is currently in Raspbian is 1.0.2 which is missing the improvements from Go 1.1. So I decided to create an APT repo with more current packages.

You have to run these two commands to add my repository and key to your system and then the other two commands to update and install the Go compiler.

1
2
3
4
5
wget https://xivilization.net/~marek/raspbian/xivilization-raspbian.gpg.key -O - | sudo apt-key add -
sudo wget https://xivilization.net/~marek/raspbian/xivilization-raspbian.list -O /etc/apt/sources.list.d/xivilization-raspbian.list

sudo aptitude update
sudo aptitude install golang

No compiling required, no Mercurial, no messing with $PATH, you have a go binary right in your path. Happy hacking.

This is my first “proper” repository, which means it looks kinda like a proper Debian archive is supposed to look like and is signed, so you can trust these packages to come from me. It also offers source packages, so if you want to build your Go yourself you can do that as well. The repository was built with reprepro and while I am not yet completely familiar with the tool it seems to generate a valid APT repository.

Keep in mind that these packages are backports from Debian experimental and not affiliated with Debian, Raspbian and Go, just provided by me for your convenience.

Go Does Right Where D Goes Wrong

After not being too impressed with Go, I thought I’ll give D a shot. So I went to the university library and got myself “The D programming language”. The book is quite great but I haven’t been able to write any single line of D code.

Because it is neigh-impossible to actually use D. The DMD compiler is not free software, so this thing is out immediately. I don’t plan to use a language with only a proprietary compiler. LDC doesn’t seem to care much about ARM (see Raspberry Pi) and GDC missed inclusion for GCC yet again (and the GDC instructions for Raspbian are awful).

Contrast that with Go. After it got released, a gcc-go frontend got included into GCC 4.7. Also, the Go compiler can be built easily on a Raspberry Pi. I can install Go on my Arch Linux without problems as well as about any other relevant platform.

Whereas D struggles for years.

Ten Years of Python

When I check out the date I signed up at the Python-Forum, it says 20th of June, 2003. Whoa, that’s quite some time. Time for some retrospective, because Python got quite popular since then and maybe people are interested in how it was in the “early days”. Or well, earlier days.

The early days 2003-2007

Initially I started with Turbo Pascal and moved to Visual Basic 6. Visual Basic 6 used to have quite an awesome german-speaking community and since my english wasn’t that good some decade ago, I was doing my save game managers and stuff any high school student might do. Later I signed up for a programming course in school where we used Java. I got interested and bought Bruce Eckel’s Thinking in Java. If you check a footnote in the introduction, Bruce mentions Python. I remember this being the first time I heard about Python.

The first time I used Python was some time later, the polish edition of Chip ran a tutorial on Pygame. That was back then when the magazine was any good. I was quite impressed with how easy things were compared to the struggling I did with C++ (I still have one or two bad books on C++ on my shelf). Back then Python 2.2 was state of the art and I developed on Windows.

Needless to say that my game didn’t work out, I had no idea how to structure my code back then. The world missed out on a great Zelda clone with sprites borrowed from “Link’s Awakening”. Or not.

But I joined a web BBS and I learned a lot. At the beginning I was reading a lot of threads and answering questions. Usually this involved googling for answers, since the questions were often on the easy side. On the tricky topics, I read the responses of more experienced people in the BBS. I learned lots back then in very short time.

The Python landscape looked quite different back then. While Python 2.2 is certainly quite similar to the Python 2.7 we have today (minus decorators, list comprehensions were optional and generator expressions only came in 2.3), the ecosystem looked quite different. In 2003, nobody was speaking about the web very much. There was Zope and Plone but the programmers didn’t like it that much. Everybody else used CGI, which still exists today. Oh and there was a small fraction of Twisted users. Twisted, after all, invented the internet.

There was excitement in GUI frameworks, Qt 3 at that time and GTK+. GTK+ 2.x was in the process of obsoleting GTK+ 1.x and the binding required selecting which version to import. Much like GTK+ 3 is compatible to GTK+ 2, and Qt 4 is incompatible to Qt 3.

When Python 2.3 came out, many C modules were lacking Windows builds, so I started building stuff and publishing it and many people were happy. I’m not sure what the situation on Windows is, these days.

Community wise, there were many people complaining about significant whitespace in block indentation. As these discussions have mostly died down these days, I suppose that was uninformed bullshit by people who never tried. Also, dynamic typing was looked down upon from users holy-grail static typing languages like… Java. No interfaces, how could this possibly work?

The web years 2007-2010

I wouldn’t say 2007 is a hard break, as there was always some experimentation in using Python for the web. I, coming from PHP didn’t know better and experimented with Spyce which was a way to embed Python in HTML. There was also Karrigell which supported roughly the same thing as well as mod_python which could also run Python Server Pages (although it never really worked for me, I was expecting something like mod_php).

Then there was Webware, an application server. It was kind-of like the Java Enterprise Servers. Then the WSGI standard came along and Ian Bicking ported it to WSGI, dubbing it WSGIKit. Then it wasn’t good enough and Ian renamed it to Paste and after trying to explain it one, two, three, four times, probably everybody just moved on.

I think Paste was too ambitious at this time. Consider most people coming from a PHP background and WSGI went right over everybody’s head. Especially as Paste seemed to solve a problem that noone could see.

Roughly the same time, Colubrid surfaced, a WSGI helper library from Armin which made WSGI easier. Think of it as the spiritual predecessor of Werkzeug. If I remember correctly, Colubrid was used in Pocoo. Because in the beginning, Pocoo was meant to be a BBS to replace the phpBB used in the german Python forum. I think it died after the 0.1 release, possibly for being too ambitious and possibly for being too much ahead of its time. But Pocoo remained and became an umbrella organisation, kind of like Edgewall.

Hosting Python web code was terrible back then. I’d even say that classical PHP shared hosters never improved, they just got obsolete with the dedicated hosters that began surfacing.

Then Rails appeared. Let me rephrase: THEN RAILS APPEARED. If I were to pick one disruptive technology in the Python universe, I’d say Rails. After it got massively popular, a lot of Python frameworks inspired by Rails started appearing. And by a lot I mean a crazy lot: web.py (by Aaron Swartz), WebCore, Pylons, TurboGears, Grok (building on Zope 3), Repoze (kinda like Zope with WSGI), Paste, Aquarium, Nevmod Nevow, Snakelets, Django and a million others. At some point you saw a new framework every week and though “no, not yet another stupid ripoff”.

At the beginning, TurboGears looked like the most promising alternative, with a “best of breed”-approach on components. Unfortunately, Python didn’t really have decent components back then, so TurboGears was burning through template systems, ORMs and other small parts quite fast and the documentation was never up to date. Plus, it started having more and more dependencies.

On the other hand, Django seemed quite polished from the beginning. In the beginning there was no release so everybody ran the SVN version and even after they did releases, the pace of releases was too slow. But it worked, had great documentation and while not best of breed, it was Good Enough™. Plus, the strangest things were fixed before the 1.0 release (magic-removal, anyone?). The automatically generated admin was certainly the cherry on the pie and while many projects tried to mimick it, no decent alternative ever surfaced.

So yeah, we got Django. Good think that we converged on something.

The community years 2010-now

This is another semi-arbitrary division, but at some point, the web stuff was “solved”. These days, it is less about choosing the base technology but rather on integrating stuff and building things with Python.

I think we got vastly more Python programmers than a decade ago, using Python has become quite the no-brainer. A startup using Python these days? Hardly even worth mentioning. But the people using Python started to be more and more. When I started, there was a EuroPython (one of the organizers even asked me to do a talk but going to Sweden was not really financially possible for 16-year old me), but now PyCons appear in many countries. 2012 was the second PyCon DE and there were enough people attending to warrant another one. Also, there are Django conferences in Europe.

Apart from conferences, there are some user groups. I can only speak for Germany, where there are two or three larger user groups with regular meetings, but they are there and doing well. The Munich user group that started as a meeting of three people from the forum back in the Pocoo days still exists today and meetings are held every second week.

The position of Python has changed in the last 10 years. With Ubuntu making Python their lingua-franca (while Debian was more focussed on Perl) Python got some boost, but nowadays Python bindings are usually not just a bonus but more like a first-class feature. I can’t remember searching for some library and finding half-assed code or nothing at all. These days, software is written in Python from the get-go and if not there are bindings. The Raspberry Pi community has embraced Python. PyPI and setuptools/distribute have made it possible to reuse vast resources of code. Maybe not yet up to the variety of CPAN, but we’re getting there.

My personal involvement has lowered, though. In the beginning I rapidly became moderator and then co-administrator of the German forum (which also celebrated its 10th birthday 2012 on the PyCon DE with beers and obligatory cake), but studying has taken a lot of time and I often dabble in other technology where Python is not popular or even feasible.

Python on mobile phones is, well, “kinda” possible. Python in the browser is even less “kinda” possible. Systems programming is not a strong point of Python either. But don’t let that discourage you, for the rest it is hard to find any reason not to use Python. Maybe we are getting close to “nobody got fired for using Python”.

What changed? The indentation debates are basically dead and buried. The feasibility of using Python was demonstrated. Also, I believe many developers switched to Linux or Mac systems since 2003, so Windows (and the awful recompiling stuff) has lost importance. Or maybe the fact that Python 2.7 is out for a really long time now and everything is compiled for it has played its part. Or that platforms have lost their importance since web apps only need a browser and the backend system doesn’t matter much.

There is now a lot of resources on Python, free eBooks, paper books. Yet somehow more beginners manage to call the language “Phyton” or “Pyhton”. No idea why. Gotta be this terrible youth, when I was young…

Masterminds of Programming

After neglecting the book for some months due to finals season, I managed to finish “Masterminds of Programming” by O’Reilly. It is a somehow unusual book, since it consists entirely of interviews. I was sceptical at first, because interviewers usually pose the same set of stupid questions to everybody and see what happens but the authors fortunately went another way: it seems like they really prepared the questions that they wanted to pose each interviewee specifically after learning at least a bit on the topic.

The interviewees were by the way creators of several popular and also not-so popular languages. And the variety was quite astonishing. The funny part is, that from the interview you could judge the author pretty well in his technical views.

My favorite interviews where these that were surprising, that explained some historical quirks or context instead of just trying to plug the respective language. One of my favorite interviews was the one with Charles Geschke and John Warnock about PostScript, why PostScript is like it is. I also quite enjoyed reading Gosling about (not only Java) and he seems like a really smart person. Anders Hejlsberg of C# surprised me too, by not bashing on Java but instead on highlighting how to grow a language and how LINQ fits into C#. Then there’s the people who think their creation is the bees knees like Meyer’s Eiffel but does not convince very much. The interview with Larry Wall was also quite good, Larry Wall does not dabble too much in promoting Perl but he does not get lost in talking about blurb either.

The only interview that I ended up skipping was Robin Milner (of ML). This guy seems to be insanely smart but I have no idea what they were talking about in the firt part of the interview apart from not being very interesting for me. But the interviewers did a great job, they sounded like they understood Milner, so that’s a plus, I guess.

The biggest surprise was maybe UML. Jacobson raves on how UML is great and the second part of the interview is with Rumbaugh who seems to be desillusioned and sees the faults of UML and in I ended up agreeing a lot with him in just about every topic. Did not expect him to be so reflective and in the end kinda pessimistic about UML. Booch is somewhere in the middle ground.

And there is the interviews you can’t agree at all. Brad Cox of Objective-C was raving about SOA all the time. And in general, his observations were weird and I wouldn’t recommend taking his advices. What’s als funny: later in the book somebody else dismisses SOA as useless, which made me smile.

Overall, I can recommend the book. I got it from the university library, so I didn’t pay anything so the payoff was somewhere in the region of infinity, but well, the book is unique and the selection of topics is good. So if you have some spare time and money, get it.

The Things I Miss From Japan

Today The 7 Odd Things I’ve Missed About Japan was published and this prompted me to think back to my stay in Japan. I didn’t like many things, but I try to be fair and have to agree that I also liked a great deal of things.

1. Public toilets

Not so much the toilets themselves, I can do quite well without a heated toilet because in Germany bathrooms are usually warm enough. But I loved the fact that Japan had toilets accessible to the public everywhere. Every train station had a toilet, every combini had a toilet. And these toilets were free. And I mean free with a capital F, no black woman sitting there trying to guilt-trip me into paying for a toilet at a restaurant where I eat. No I mean really free - go there, use it, leave. For me free public toilets are a cornerstone of a great civilization. If we can manage to have free toilets everywhere, all other issues can be solved eventually :) In the end, I think combinis profit a lot from the free toilets, I was much more inclined to pay their markup for the product for all occasions where a combini saved be.

Well, I should also add that these toilets are clean. Or well, clean enough. German public toilets are most of the time totally awful.

2. Opening times

This only applies to shops not to banks or the dreaded ATM opening times, but here in Germany, especially in Bavaria shops close at 20:00 (22:00 in other states). And they are closed on Sundays. In Japan, I had no problem to go shopping on Sunday and I was aware of this good fortune so I went shopping on Sundays. And Aeon was open till 23:00, so go to a party, leave earlier, go shopping, go home. Super-convenient.

3. Combinis

I haven’t met anyone who doesn’t just love these. For the uninitiated: they are small supermarkets that are open 24/7 and usually have a rather great choice of products. Food is fresh, there is always a curious selection of softdrinks and a perhaps even more curious selection of alcohol. You can get your Amazon packages delivered there or pay your Amazon stuff there as well as order tickets. They also offer fast-food as well as food that you can prepare with a microwave or water cooker. I think I ate countless breakfasts at combinis, sometimes because I was out camping and sometimes because I didn’t feel like making food.

In the end, you pay maybe 30% markup on the products, but in my experience it is usually even less. I think this is very good deal.

Visiting a combini at night with a bunch of friends to buy some beers also became a cool ritual. That is the one occasion where you don’t mind the ridiculously high beer prices.

4. Trains

Oh how I loved the subway system in Nagoya. It is a number of lines crossing through the city and one ring line that enables you to reach every place in a decent time. In munich, to go anywhere, you have to go into the city and then ride out again. This takes ridiculous amounts of time and is incredibly inefficient.

And Japanese trains are never late. Never. There is this joke: “In Heaven: the cooks are French, the policemen are English, the mechanics are German, the lovers are Italian and the bankers are Swiss. In Hell: In Hell: the cooks are English, the policemen are German, the mechanics are French, the lovers are Swiss and the bankers are Italian.”. No idea what the Japanese would be in Hell, but in Heaven they would certainly run the trains. I suppose, they would also do a decent job of running trains in Hell.

5. The Logistics

I could set the delivery date and also the desired time. Back in Germany I have to be happy if the delivery-man even bothers ringing our door. For me it is quite ok still, but if you live in a dorm, too bad because getting a package delivered to a dorm is near impossible.

Added bonus: Amazon delivers just about everything for free, without the need for Amazon Prime.

6. Cheap Sushi!

I had a friend from Japan over and she was surprised how horribly expensive sushi in Munich is. And yeah it is, because everything Japanese in Munich is automagically 20% more expensive. No more cheap “50% off” sashimi from Aeon, sigh. Of course, expensive sushi is probably more expensive in Japan, but cheap sushi is cheaper in Japan, too (and also pretty tasty!).

7. The all-you-can-eat-sweets

Haha, I’m a glutton. Sweets Paradise offers a deal where you can eat as much cake and sweets as you can for 1480 Yen (about 14,80€) for 90 minutes. Turns out, 90 minutes are enough to eat enough sweets until you won’t be able to eat anything sweet for the next two or three months.