Change order of PATH entries on Mac OS X

I wanted to have /usr/local/bin to be listed before /usr/bin in my PATH environment variable.

One way to achieve this would be to add a ~/.profile file with a line like this:

export PATH=/usr/local/bin:$PATH

This would result in /usr/local/bin being listed twice. It wouldn’t hurt but it’s not pretty either.

If you look at /etc/profile, you will see that the initial value of PATH is set by path_helper(8).

The right way to change to order of default paths is to edit /etc/paths. It contains one path per line, in descending order. Mine looks like this:

/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

Using Python Packages – An Overview

Yesterday I gave a presentation at PyCologne about Python packages. It was meant as a kind of sequel to the “Cooking Eggs” talk given by Christopher Arndt (in German) in September. While he presented ways to create Python packages, I focused on how to use Python packages.

Python comes with batteries included, but sometimes, battery power is not enough. Thankfully, there are countless packages available for use. Given that there “should be one– and preferably only one –obvious way to do it,” using Python packages can be quite intimidating. The documentation of your package might say to download, unzip und run python setup.py install. Meet distutils. Or just do easy_install MyPackage, which is uses setuptools. But then you hear that setuptools is superseeded by distribute and instead of easy_install, you should use pip. And then there is virtualenv, which is awesome, but can be even more awesome with virtualenvwrapper. What a mess!

My conclusion: use distribute, pip, virtualenv and virtualenvwrapper.

You can download the slides or view them with Slideshare:

Verify AWS free tier

Starting from November 1st, Amazon offers a free usage tier for new AWS customers. After finishing the horrible signup process, I was left wondering wether the free usage tier was activated for my account.

To find out, just start an EC2 micro instance*. Don’t forget to stop it. After some time, go to the account activity page and click on “expand all services”. You should see something like this:

* This will cost you a few cents if you don’t have a free usage tier.

Howto clear Solr index


If you want to delete all items from Solr index, use the query

<delete><query>*:*</query></delete>

as described in the FAQ on the Solr Wiki.

But how do you actually send this query? You can use this command:

curl http://<host>:<port>/<solr_base>/update?commit=true -d '<delete><query>*:*</query></delete>'

Just replace the placeholders with the right values, e.g.

curl http://localhost:8983/solr/update?commit=true -d  '<delete><query>*:*</query></delete>'

If Solr responds with something like this:

HTTP Status 400 - missing content stream
Status report
message missing content stream
description The request sent by the client was syntactically incorrect (missing content stream).

then you are probably missing the commit parameter i.e. ?commit=true

Apple deals some blows with iPhone OS 4

"Kajyn Club - Boxing" by Olivier Ciappa - CC by-sa

As I was reading the coverage of the iPhone OS 4 event on engadget, I couldn’t help thinking: some people will be really, really pissed. Or scared. Or both.

No, I’m not talking about iPhone 3G users who won’t get to enjoy multitasking, I’m talking about numerous companies whose right to exist is seriously questioned by Apples innovations.

But let’s start at the beginning and look at the seven features Apple presented and the effect they will have.

Folders. Nice to have, but not really a game changer.

Enhanced mail, together with the new enterprise features, make the device more attractive for business people. Blackberry and Windows Mobile will have to watch out.

Reading long texts on the iPhone doesn’t work for me. But for a lot of people, it does work. There are numerous ebook apps in the app store which serve that market and with iBooks, they suddenly have a strong competitor. With iBooks built into the OS, Apple might even play the duplicating functionality card and ban these apps from the store.

Game Center provides convenient solutions for game developers, like achievements, leaderboards, match making. Now look at the feature list of multiplayer gaming platform Z2Live. It’s almost identical. Ouch, that must hurt.

Long awaited, multitasking arrives on the iPhone plattform – but only on the latest devices: iPhone 3GS, iPod Touch 3G and iPad.

Many applications, which were kind of pointless under the One App At A Time policy, finally make sense with multitasking. Pandora and Skype are great examples and I think creative developers will come up with countless other ways to blow your mind.

Of course, other platforms had multi tasking for a long time, but it had its downsides as well. Sluggish performance, low battery runtime. If Apple really solved the energy and performance solution with their approach, they have not only caught up to the other guys, they have overtaken them.

And now the real sucker punch: iAd. Mobile advertising is a big market and Apple just has bitten a huge chunk off the pie. Now it seems to pay off that Apple rules their platform with an iron fist. Just recently, use of location data for advertising  was just restricted and guess what they presented: ads with location data! If I had just forked over a nine figure sum for a mobile ad provider, like Google for AdMob, I would be massively unhappy.

With iPhone OS 4, Apple once more changed the playing field. We will see how the other players react.

And the Nobel Peace Prize goes to: Teh Internetz

It made the news that the Internet has been nominated for this year’s Nobe Prize.

The Internet? Seriously? Just think about all the flame wars the Internet caused. I think some people have to check there calendar, it’s not April 1st yet. What were they thinking?

- “Ok, last year we gave it to Obama, because was so popular. That didn’t really make everyone happy. We need someone more popular.”
- “How about the Internet?! Everyone likes the Internet!”

This just ridiculous. Why not nominate swords? After all, you can hammer them into plowshares.

"Let Us Beat Our Swords into Ploughshares" by United Nations Photo - CC by-nc-nd

Why I decided to spam you on Twitter

Like almost everybody I know I despise the useless updates by apps like Fourspare and Farmvill that clutter Twitter and Facebook with useless information.

But if you follow me on Twitter, you might have noticed that I myself allowed the Hundred Pushups iPhone app to post updates to my Twitter feed. Why this change of mind?

Doing a pushup (not me)First, let me explain what the app does. The goal of the Hundred Pushups iPhone app is, who would have guessed, to enable you to do 100 consecutive pushups. It offers a six week training program* and allows you to log your workouts. It’s definitely not the greatest app ever and has lots of room for improvement but  it gets the job done: when I started training with the app on the 25th of January, I could do 37 consecutive pushups. Today, about 6 weeks and 15 workouts later, this number has more than doubled to 77.

That’s all well and good, you might intervene, but why boast with these numbers on Twitter?

Guess how I heard about the 100 pushups app for the first time? A status update on my Twitter feed caught my interest, I googled, found the site, bought the app and started training. I don’t remember who posted that update, but I’m really glad that person decided to do so. While the mere fact that you can do 100 pushups buys you nothing, a strong upper body definitely has its benefits.

At first, I was reluctant to allow the app to post on Twitter, because I didn’t want to annoy my followers with useless updates. But after seeing good progress, I decided that posting my progress to Twitter might be actually of value to somebody.

If my tweets motivate only one of my 197 followers to complete this training program, it is well worth pissing of the other 196.

* 100 pushups in six weeks sounds to good to be true? Well, calling it a six week program is a bit, let’s say, optimistic. It would be more accurate to call it a six level training program. The levels, which are named week 1 to 6, get more and more difficult and at some point, your progress will stagnate. I was able to keep up with the first three weeks, but I’m struggling to complete week 4. Still, a 100% increase in 6 weeks isn’t to bad and I’m confident that I’ll achieve the 100 in the not so far future.

Image adapted from  “I Knew Pushups Would Pay Off Someday” by reid.gilman, licensed under Creative Commons BY-NC

21st Web Montag in Cologne

Yesterday evening, the 21st Web Montag Cologne took place. The list of participants had already been growing constantly during the last days before the event, but when @fbz, @scompt and me arrived at ~19:30, I was surprised anyway how many people where already there and engaged in lively discussions. Starting from 8 o’clock, three talks were given.

Jörn Zaefferer (@bassistance) presented the newly released jQuery 1.4. It offers new features and also an improved performance. If you use jQuery, it might be worth upgrading, despite some backwards-imcompatibilities. A lot of work has also been done on the website and the documentation.

Christoph Beckmann (@cbek) talked about his experiences surviving a traffic peak caused by TV appearance with the help of Amazon Web Services. The solution involved migrating the Loo2Go server to a big EC2 instance and using several caching servers. While the costs were marginal, the approach seems very labour intense to me.

Michael presented a new MVC framework written in PHP which was heavily influenced by his experiences working with Ruby on Rails.

After the talks, the discussions continued. All in all, it was once again a very interesting evening, thanks everybody for participating.

The next Web Montag in Cologne will probably be on the first or second Monday in March, so mark these dates in your calendar.