moeffju.net

Getting rid of the 'www' prefix

[lang_de]Dieser Eintrag ist nur auf Englisch verfügbar.[/lang_de]

You may or may not have heard about the no-www movement. All my sites have always been reachable with and without the www prefix, and I personally never use the www prefix if I can avoid it. I won’t get into the details of why it is a bad idea, but consider this: no one calls the web ‘WWW’ anymore, and this ‘abbreviation’ is a lot longer than the expansion (‘double-you double-you double-you’ vs ‘world wide web’). If anything, the prefix should be ‘web’.

Starting today, I’m having all my domains permanently redirect to the non-www version of the hostname.

Here’s a simple mod_rewrite recipe that should work for any domain:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L,NS]

Put it inside a <Location "/"> block in the appropriate VirtualHost block, or inside a .htaccess in the document root of your site (it doesn’t seem to work in a VirtualHost block in the server config, any ideas why?).

It’s like magic.

MasterCard [lang_en]r[/lang_en][lang_de]R[/lang_de]ebranding

[lang_de] MasterCard rebranden. Von ihrem bekannten, zwei-farbige-verzahnte-Kreise-Logo zu einem neuen, das grundsätzlich sehr ähnlich ist, aber gerade unterschiedlich genug, um eine schlechte Idee zu sein.

Neues und altes MasterCard-Logo

Das neue Logo behält die zwei bewährten Kreise bei, rückt sie aber weiter auseinander und verkleinert sie. Die Verzahnung wird durch ein einfaches Überlappen mit Farbwechsel ersetzt, die Teile greifen also nicht mehr ineinander, sondern … invertieren sich? (Welche Message steckt hier bloß dahinter?) Als Zuckerguss auf dem Ganzen liegt dann ein dritter Kreis aus halbtransparenten Farbverläufen, so dass das Logo am Ende meiner Meinung nach eher nach einem Unfall beim Vektorzeichnen aussieht als nach einem passenden Image für eines der größten Kreditkartenunternehmen der Welt.

Zwei wichtige Punkte, die mir auf Anhieb einfallen:

  • Brand Awareness: Das MasterCard-Logo ist von überragender Bekanntheit. Zufällig ausgewählte Versuchspersonen konnten das Logo auf Anhieb fast immer recht genau wiedergeben. Sowas sollte man nicht leichtfertig aufs Spiel setzen.

  • Einfachheit: Das alte Logo benutzte drei Farben: Rot, gelb, und schwarz, konnte also mit nur zwei Schmuckfarben einfach wiedergegeben werden und skalierte auch gut “nach unten”, z.B. für zwei- oder einfarbigen Druck. Die Linien sind klar definiert und “easy on the eyes”.
    Das neue Logo hingegen klotzt gleich mehrere Farbverläufe in die Mitte des Logos und wird wohl immer nach Rasterung und Offsetdruck verlangen. Es ist auch schwer, sich das neue Logo z.B. einfarbig auf Textilien vorzustellen.

Letzlich entgeht mir wohl der Sinn des Rebrandings. MasterCard sagt dazu:

[die drei Kreise] reflect the company’s unique, three-tiered business model as a franchisor, processor and advisor

Ich schätze nur, dass es dem weit größeren Teil der Welt völlig Schnuppe ist, wie viele Geschäftsbereiche MasterCard hat - und dass der Teil, den es interessiert, es auch ohne das neue Logo wusste.

[/lang_de] [lang_en] MasterCard are rebranding. From their old, well-known, two-color interlocked circles logo to a new one which is basically the same, but just different enough to make the move stupid.

New and old MasterCard logos

The new logo keeps the two well-known circles, but moves them further apart and sizes them down. The interlocking is replaced by simply drawing the overlapping part in a different color, so the parts don’t intertwine anymore, instead they… invert? (What message are they trying to convey here?) The icing on top of it - literally - is a third circle filled with half transparent gradients, which results in the logo looking more like an accident in a vector graphics program than a fitting new image for one of the largest credit card issuers world wide.

Two important points that come to mind immediately:

  • Brand Awareness: The MasterCard logo is outstandingly well-known. Randomly selected persons could almost always reproduce the logo at first go. That’s not something one should risk lightly.

  • Simplicity: The old logo used three colors: Red, orange, and black, and could thus be reproduced using two spot colors. It also ‘scaled’ well to two color or even single color printing. The lines are well defined and easy on the eyes.
    The new logo instead uses multiple gradients in the middle of the logo and will always require rasterization and offset printing. It’s hard to imagine the new logo on fabric, for example.

Maybe I’m just missing the whole point of the rebranding. MasterCard state:

[the three circles] reflect the company’s unique, three-tiered business model as a franchisor, processor and advisor

I suppose, though, that the larger part of the population is completely uninterested to the number of business tiers of MasterCard - and that the part that is actually interested knew anyway.

[/lang_en]

MasterCard® is a registered trademark of MasterCard Worldwide.

Ocean wide, Ocean wide

[lang_de] Deine Lakaien touren mit Orchester: “20 Jahre electronic avantgarde”.
Ein Muss. [/lang_de]

[lang_en] Deine Lakaien tour with an orchestra: “20 years electronic avantgarde”.
A must. [/lang_en]

IP to country: ip2countryd using hostip.info data

[lang_de]Dieser Eintrag ist nur auf Englisch verfügbar.[/lang_de]

hostip.info is a free GeoIP service. Unfortunately their webservice is slow and they are in the middle of a backend change (from 256 ip_X tables to one table listing all /24 nets…). However, their information is more exact than that of countries.nerd.dk.

To convert the data from hostip.info’s format into something remotely sane usable, you have to merge the ranges into CIDR-blocks per country. If you don’t do that, you’ll get a 160MiB result file which will take ages for ip2countryd to process. With proper optimization and merging, though, the resulting file is barely 4MiB in size and ip2countryd loads like a breeze.

  • ip2countryd-r3.tgz 12KiB
    Revision 3 of ip2countryd, minor changes, includes a script to convert hostip.info CSV dumps to rbldnsd format.
  • hostip-data.tgz 1.1MiB
    The current dump from hostip.info in rbldnsd format, including the cached version.

The test service at udp://ubermutant.net:8000/ has been updated to r3 with the hostip.info db.

Now, for the rant. hostip.info used to use 256 tables in their DB - one for each class A network. Inside each of these tables were two columns for the second and third octet of the IP. Luckily, they got better and away from this inane structure, switching instead to one table that holds the IP in a single INT column, as a long. But they still store one record for each /24 subnet in existence, plus some invalid and reserved ones (0.0.0.0/24? righto!). I don’t know how they query this monster, since the new site source is not yet available in their SVN, but I’m not sure if I even want to know. The sanest possibility I can think of right now is to take the lower 24 bits of the query and look that up. That still leaves one question, though: Why, oh why, must this be done in gigantic MySQL tables and for every single class C subnet?

Sometimes, a database just isn’t the best solution.

IP to country

[lang_de]Dieser Eintrag ist nur auf Englisch verfügbar.[/lang_de]

If you need to find out what country an IP is in, but are forced to use PHP or some other language without proper DNS querying features (but which can do UDP), here’s a little something for you.

ip2countryd-r2.tgz 344KiB - ip2countryd revision 2
Includes the required data file (~2MiB) and the cached data (~432KiB).

Runs a daemon on UDP port 8000 (by default) that responds to an input IP address with the ISO country code of the IP’s country, or ‘error’ if anything goes wrong (no mapping, not an IP, etc.). There is a test server at udp://ubermutant.net:8000/.

$ nc -u ubermutant.net 8000
207.13.77.53
us
212.227.57.11
eu

Idea from WP-ShortStat and the associated ip2country service. I wrote this just for the fun of it and because I wanted to see how long it would take me.

Total time required: ~1 hour.

[lang_en]WordPress Statistics[/lang_en][lang_de]WordPress-Statistiken[/lang_de]

[lang_en] I recently installed WP-ShortStat to gather blog statistics, and especially to make them more easily accessible (compared to webalizer). WP-ShortStat claims that one should just drop it in the plugin directory and enable it and it would work. Well, guess what happened. [/lang_en] [lang_de] Ich habe vor kurzem WP-ShortStat installiert, um mal einfach verfügbare und lesbare (im Gegensatz zu Webalizer) Blog-Statistiken zu haben. WP-ShortStat behauptet, man müsses nur einfach nur ins Plugin-Verzeichnis legen, das Plugin anschalten, und es würde funktionieren. Ratet, was statt dessen passiert ist. [/lang_de] [lang_en] At first, no stats showed up. I didn’t think much of it, since I was logged in as admin and it really shouldn’t track my own visits. Then I tried with another browser, but still got no stats. I thought of blaming WP-Cache, which might prevent the tracking function from ever getting called, but didn’t have the time to look into it. Time passes. It still doesn’t work. The author seems to have disappeared off the face of the earth. Looking into the source, I fixed a few obvious bugs ($wpss->$tz_offset, rrrright!), but still, no go. Lots of googling later, I find a bugfix (the admin detection broke with wp2.x), and just after implementing it, a maintained version of the plugin… which actually works! It still looks broken though, because the columns don’t wrap right (a relic from the original version). Also, it’s slow since every request results in another request to an ip-to-country webservice. I kid you not. All that to save shipping with a “2mb ip-to-country file” (quote from the original author). Even with HappyArts’ optimizations, I prefer to use local data. Exit WP-ShortStat.

Enter WP-SlimStat. It’s a rewrite/conglomeration/bastardization/whatever of WP-ShortStat and something else, and it claims to fix all the bugs WP-ShortStat, have more features, be equally easily installed, and not break the WP admin area. Plus it can import WP-ShortStat data. Installation really is as easy as promised, and the admin panel looks neat and doesn’t break things.

Just don’t look at the main page.

For WP-SlimStat to work, you must have WPLANG defined and it must not be empty, lest you get a fatal error “Cannot instantiate non-existent class: CachedFileReader”. Most non-english blogs should be fine, the others should define('WPLANG','en'); in their wp-config.php.

I’m happy to report that after this little fix, things work. But the original author of WP-SlimStat still hasn’t incorporated the fix. What is it with writing stats plugins and disappearing?

I sense a conspiracy. [/lang_en] [lang_de] Zuerst erschienen einfach keine Statistiken. Ich hab mir nicht viel dabei gedacht, weil ich noch als Admin eingeloggt war, und das Plugin meine eigenen Besuche wirklich nicht mitzählen sollte. Also hab ich es mit einem anderen Browser versucht, aber immer noch keine Stats gekriegt. Ich dachte mir, dass es an WP-Cache liegen könnte, weil die Tracking-Funktion vielleicht nie aufgerufen würde, hatte aber keine Zeit, mir das ganze genauer anzusehen. Ein paar Tage später. Es geht immer noch nicht. Der Autor scheint vom Erdboden verschluckt worden zu sein. Im Source finde und behebe ich ein paar offensichtliche Bugs ($wpss->$tz_offset… äh, nein), aber mehr als leere Stats kriege ich trotzdem nicht. Viel googlen später finde ich einen Bugfix (die Admin-Erkennung geht mit WP 2.x nicht mehr), und kurz nachdem ich damit fertig bin, eine aktualisierte Version des Plugins… die sogar funktioniert! Leider sieht’s immer noch mies aus, weil die Spalten nicht richtig umbrechen (ein Relikt aus der Originalversion des Plugins). Außerdem ist es recht langsam, weil jeder Request eine Anfrage bei einem IP-to-Country Webservice nach sich zieht. Ernsthaft. Alles nur, um kein “2mb ip-to-country file” (Zitat Original-Autor) zu brauchen. Auch wenn HappyArts da noch einiges optimiert haben, ich mag lokale Daten. Abtritt WP-ShortStat.

Auftritt WP-SlimStat: Ein Rewrite/Zusammenballen/Bastardisieren/whatever von WP-ShortStat und anderen Scripts, behauptet, alle Bugs von WP-ShortStat zu beheben, mehr Features zu haben, genauso leicht installierbar zu sein, und das Admin Panel nicht zu zerhauen. Außerdem kann es die Daten von WP-ShortStat importieren. Die Installation ist auch wirklich so leicht wie versprochen, und das Admin Panel sieht nett aus und ist vor allem nicht völlig zerstört.

Die Hauptseite ist eine ganz andere Angelegenheit.

Damit WP-SlimStat funktioniert, muss die Konstante WPLANG definiert und nicht leer sein, weil man sonst einen Fatal Error “Cannot instantiate non-existent class: CachedFileReader” kriegt. Die meisten nicht-englischsprachigen Blogs sollten kein Problem haben, alle anderen sollten define('WPLANG','en'); in ihre wp-config.php eintragen.

Nach diesem kleinen Fix funktioniert netterweise endlich alles. Leider hat der Autor von WP-SlimStat den Bugfix immer noch nicht eingebaut. Warum verschwindet jeder, der Statistik-Plugins für WordPress schreibt, plötzlich?

Ich wittere eine Verschwörung. [/lang_de]

UX UX UX (in multiple languages)

You are HP-UX. You're still strong despite the passage of time.  Though few understand you, those who do love you deeply and appreciate you.
Which OS are You?

[lang_de] Hurrah. Hat irgendwie was von Horoskopen.

Eigentlich teste ich nur das Polyglot-Plugin. Es funktioniert, aber der Code schreit eigentlich nach einem Rewrite… später.

Augen nach oben rechts wenden, lustige kleine Flaggen sehen, ausprobieren, und hoffentlich keine Fehler finden… jetzt. ;) [/lang_de]

[lang_en] Huzzah. Feels a little like horoscopes.

Actually I’m just testing the Polyglot plugin. It works, but the code is literally screaming for a rewrite… later.

Look to the upper right corner, see the nifty little flags, try them, hopefully don’t find any bugs… now. ;) [/lang_en]

Computer God, and cute too

[lang_de]Dieser Eintrag ist nur auf Englisch verfügbar.[/lang_de]

My computer geek score is greater than 100% of all people in the world! How do you compare? Click here to find out!

And all this just because freedb.org shut down.

Vegetarische Drogenkuh

Pfefferminz darf ja seit einer Weile raus. Jetzt habe ich beobachtet, dass er eigentlich immer sofort zur Treppe läuft, sich halb hinlegt - und Gras frisst.

Mögliche Erklärungen:

  • er hat eine Abhängigkeit von Gras entwickelt;
  • er ist in Wirklichkeit eine kleinwüchsige Kuh mit verstärktem Haarwuchs;
  • er ist Vegetarier;
  • all of the above.