A computer thinks I write like
David Foster Wallace
Sat 2010-07-10 ( In En pr )

I’m sure I’m not the first one to find this, but here’s a working example for a i18n version of Integer#ordinalize.

Setup

First, you need to define <locale>.rb files in you lib/locales folder for each language. Here are examples for English, German, and French:

# lib/locales/en.rb
{
  :en => {
    :ordinal => proc { |number| number.ordinalize }
  }
}

This is using the built-in ordinalize extension, which does the English job.

# lib/locales/de.rb
{
  :de => {
    :ordinal => proc { |number| "#{number}." }
  }
}

German ordinalization is really easy.

# lib/locales/fr.rb
{
  :fr => {
    :ordinal => proc { |number| "#{number}#{number == 1 ? 'er/re' : 'e'}" }
  }
}

You’ll have to find out how to apply the correct genus all by yourself if you don’t like the self-service-slash :P

More languages can be added, but it gets really complicated for Spanish or Finnish.

Usage

After you restart your server (also in development mode!), I18n.t('ordinal') will return a Proc object. You can use it in your view like this:

<%= I18n.t('ordinal')[count] + ' ' + I18n.t("article") %>

Notice the use of [] for the object returned by the I18n.t call: It’s calling the Proc, passing the number argument, which is then ordinalized according to the current locale. You could also use .call(count), or even .(count) in Ruby 1.9, but I prefer the brackets.

Wed 2010-07-07 ( In En De pi fu )

source

Edit: Ich glaube, das war eine Zitronenpresse. Mist.

Tue 2010-06-29 ( In fu pi )
Sun 2010-06-27 ( In De fu )

Vuvuzela die Du bläst zum Himmel
Getrötet werde Dein Vuuuu
Dein Angriff komme
Dein Tor geschehe

Wie im Strafraum als auch im Mittelfeld
Unseren täglich Lärm gib uns heute
Und vergib uns unsre Fouls
Wir auch wir vergeben unseren Schiedsrichtern

Und führe uns nicht in die Verlängerung
Sondern erlöse uns vom Abseits
Denn Wir sind die Besten und die Gruppensieger und im Halbfinale
In Süd Afrika
World Cup

Fri 2010-06-25 ( In En fu ma ra )

Wed 2010-06-23 ( In En ma )

Apple didn’t manage to provide real photos of the iPhone 4’s new display’s quality on their website. 960×640 pixels sure sounds a lot (almost iPad resolution), but I wasn’t convinced, because those digital demos look nothing like a real display.

Thankfully, Engadget has now provided this great comparison photo:

That’s the icon for the Maps app, of course, on iPhone 3GS and 4. Its actual size on the display is 9mm (0.354in), or the width of a typical paperclip, or the height of those arrow keys on a modern Apple keyboard, or the distance between strings on a 6-string guitar, or half the width of my middle finger. It’s really small.

If you have an iPhone or iPod touch (any generation), look at that icon. Can you see the white line between the red and blue parts of the road sign? That’s almost 2 pixels high on an iPhone 4. See the number “280”? The lines are a little more than 2 pixels thick there. See the pin’s head? That’s about 20 pixels in diameter now. The vertical road is about 15 pixels wide.

Sun 2010-06-20 ( In De ra )

Ziemlich nichtsagende Statistiken, zumindest kann man anhand der Grafiken nicht erkennen, woher die Entwicklungen kommen. Durch Gurtpflicht mehr Autounfälle? Wohl kaum. Mehr Verkehrsunfälle durch Rentner? Natürlich, es gibt ja auch mehr Rentner!

Infografiken, die komplexe Zusammenhänge einfach darstellen, sollten nicht ganz so offensichtlich unlogisch sein.

Tue 2010-06-15 ( In De ra )

Sowas kommt bei uns über die Mailinglisten der Uni an alle Informatik-Studis:

Hallo liebe Studenten,

in der Beschreibung zur Anmeldung zu der Windows Phone 7 Veranstaltung im Microsoft Office ist ein kleiner Fehler unterlaufen.

Der Anmeldelink führt zu einer Fehlerseite. Der richtige Link ist der folgende:

http://www.stnc.de/Events/Register/3084

und hier nochmals die Beschreibung zu dem Event:

http://www.stnc.de/events/2010/05/25/3084-Student-Partners-Usergroup-zu-Windows-Phone-7.aspx

Entschuldigung dafür nochmals!

Grüße
Sebastian Schütze
Microsoft Junior Student Partner
Humboldt Universität zu Berlin

Zum Kotzen.

Sat 2010-06-12 ( In En mu )

Very cool music video from Mr Scruff:

Actually a remix of Kirsty Almeida’s Spider.

He draws and animates those videos himself, I read. Is this done with Adobe® Flash®?

Available from Ninja Tune on 12" only. Thanks for releasing it officially on YouTube, too!

Tue 2010-06-08 ( In En ma )

Apple claims:

It works like this: As you browse the web, Safari detects if you’re on a web page with an article.

Something like Reader might actually turn Safari into my main browser – depending on how well it works.

So, how does this magical “detection”-thingy work? It works on sites like heise, SPIEGEL, or The Wall Street Journal. But it doesn’t work on TUAW or on my blog. Does Safari 5 have a list of well-known mainstream media news sites? Is this what Steve Jobs meant when he said:

I don’t want to see us descend into a nation of bloggers.

I mostly read blog articles nowadays, and Safari Reader is pretty useless to me for now.

Update: Funny thing, it works on Daring Fireball. Maybe this is because John Gruber is considered mainstream now ;)

Update: ars technica claims (Safari Reader enabled):

Safari 5 contains heuristics that will detect if a webpage contains an article and it will present a “Reader button” in the Smart Address field.

Well, how nice for your site. Which heuristics? I couldn’t find any hints in the Safari Dev Center.

Update: It gets funnier :-) With the last update, this article just became a Safari Reader heuristic winner. So it’s about content length?

Update: It looks like it. Yay :-D

Wed 2010-06-02 ( In De ra )

No way.

Die machtgeile, verfassungsfeindliche CDU-Politikerin, inzwischen Arbeits-, früher Familienministerin wird wissen, dass das Amt des Bundespräsidenten eine Sackgasse ist. Danach kommt nichts mehr. Und sie ist auf gutem Wege, wichtigeres zu werden: Außenministerin einer neuen Koalition mit schwächerer FDP oder SPD, oder gar Angies Nachfolgerin.

Im übrigen ist mir nicht klar, wie die FDP zulassen kann, dass eine Ministerin mit derart bürgerrechts-feindlichem Profil hier ernsthaft in Erwägung gezogen wird. Ob die Ministerin Themen von SPD und Grünen besetzt, kann der Koalition herzlich egal sein, denn sie hat eine komfortable Mehrheit in der Bundesversammlung.

Und überhaupt, wer wird denn dann Arbeitsminister? Roland Koch?

Mon 2010-05-17 ( In De fu pi )

Die folgenden Bilder sind offensichtlich Collagen:

Vampir-Pinguin ohne Reflektion!

Was Science nicht davon abhielt, das erste davon zu drucken. Ein Bild sagt ja bekanntlich mehr als tausend Worte.

Wahrscheinlich kommt demnächst noch ein Tiger auf die Scholle.

Wed 2010-05-05 ( In En ra )

Commercial advertising: I hate ads. I hate them. Lipstick commercials, infomercials, placards, Greenpeace booths, Spam. I hate them from the bottom of my heart. They are distracting, stupid, ugly brainwashers, lies and propaganda which reduce my ability to consume information or do work through any media. They are the reason I stopped listening to FM radio. They are turning my mailbox (the real one and the virtual ones) into a wastepaper bin. They make me angry. Like cigarette smoke.

The main reason I switched from TV, magazines, and radio to the computer is, apart from interactivity, that you can actually live pretty ad-free in there. I rarely see ads on my MacBook (mostly MSNBC ones that I simply mute). I installed anti-ad plugins on every browser I use (except one, see below). I uninstall every application that tries to ad me.

Tue 2010-05-04 ( In En pr )

Licenser:

(defn <3 [love & loves]
  (loop [l (str "I love " love) loves loves]
    (let [[love & loves] loves]
      (if (nil? love)
        (str l ".")
        (if (empty? loves)
          (str l " and " love ".")
          (recur (str l ", " love) loves))))))
(<3 "cookies" "cake" "chocolat") ;; =>  "I love cookies, cake and chocolat." 

murphy:

I = Object.new
def I.<(three, *args)
  puts "I love " + args[0..-2].join(', ') + ' and ' + args.last + '.'
end
I.<3, 'test', 'foo'
#~> I love test and foo.

I like the Clojure one better, even without syntax highlighting :)

Update: Licenser complained, so here’s an improved version:

Tue 2010-05-04 ( In En pr fu )

Here’s the ultimate reason why Ruby is better than Python:

Jus ried o clean my keyboard, and now he key is suck. I can no longer run my Pyhon programs, bu I can sill run Ruby scrips. A definiive improvemen.

A gem from Fredrik Lundh, 2003.

Thu 2010-04-29 ( In De fu )

Kam gerade über hu-an-studis@lists.hu-berlin.de.

Hallo liebe KommilitonINNEN,

ich studiere Psychologie und bin dabei meine Diplomarbeit zu schreiben. Dazu
brauche ich EURE Hilfe.

Ich suche noch MÄNNLICHE Probanden, die Lust haben an einem wissenschaftlichen
Trinkversuch (Einzelexperiment) teilzunehmen. Ich untersuche die Auswirkungen
von Alkohol auf die Aufmerksamkeit.

Das Ganze läuft folgendermaßen ab:

1. Voruntersuchung
2. Aufmerksamkeitstest nüchtern
3. Alkoholisierung (entweder 0,5 oder 1,1 Promille)
4. Aufmerksamkeitstest betrunken
5. Ende

Aus ethischen Gründen kann ich leider kein Versuchspersonengeld ausgeben.

Wer Lust hat teilzunehmen, muss folgende Vorraussetzungen erfüllen:

- keine Erkrankungen des Herzens, der Blutgefäße, der Leber oder anderer Organe
- keine bestehende oder vergangene Alkohol- oder Drogenabhängigkeit
- kein Alkohol- oder Drogenmissbrauch
- keine Abstinenz
- mindestens 18 Jahre alt.

Ich hoffe, dass sich zahlreiche Interessenten melden. Bislang hatte jeder
Teilnehmer Spaß an der Untersuchung.

Die Termine können wir individuell absprechen.

Falls es noch Fragen gibt, erteile ich gern per Telefon oder E-Mails Auskunft.

Tel: -
Email: -

Ich danke euch herzlich für eure Hilfe.

Caroline

Verspäteter Aprilscherz?

Fri 2010-04-23 ( In En De pi )


Nature 2.0 // Dux in a row

See more of her art on her website (sadly, it uses FRAMEs).

Fri 2010-04-23 ( In En ma )

Well, Gizmodo spoiled a lot of secrets about the next iPhone in the last week. But I think this won’t hurt Apple, or Gizmodo, or anyone. It’s already internet history.

An interesting side of this is that this might be the first time that we actually see new Apple hardware from inside before we see how it looks to the average user. Apple always focuses on user experience, and never flaunts with tech specs without connecting them to real-world benefits. This is especially true about the iPhone; they don’t even mention the CPU’s speed or the size of the RAM anywhere on their side. Apple doesn’t provide specs for the iPad’s A4 – they just state that it’s fast and efficient. This time, Gizmodo has stripped down their next child before we saw her face. It’s tech porn. I prefer Apple’s reality distortion field.

Fri 2010-04-16 ( In En ob )

As Howard Fineman said on Tuesday in Countdown about Barack Obama’s Nuclear Security Summit:

And I think [Obama] also wants to show that in the 21st century, security is about links. It‘s a different paradigm from the Cold War. It‘s almost like the Internet in which you prosper, you profit by the links you make to the other people on the net. He‘s trying to do that in terms of diplomacy globally.

More and more world leaders really get globalization. We share enemies and threads. We are sitting in the same boat. We need to paddle together, and the US wants to be the cox.

Fri 2010-04-16 ( In En )

I didn’t know where the strange name “Wizengamot” in the Harry Potter books came from (the Supreme Court of the Wizarding world). Now I found out about the Witenagemot: It was a ring of advisors to the Anglo-Saxon kings of the 7th – 11th century.

Interestingly, J.R.R. Tolkien’s term Entmood is also related to the terminology. Thing is another, earlier type of such political institutions and meetings.

Wed 2010-04-14 ( In En ma )

I don’t know yet.

According to the first Geekbench results, the Intel i7-620M at 2.66/3.33 GHz in latest flagship MBPs is about 30% faster than the previous Core 2 Duo T9900 at 3.06 GHz. Compared to my early 2008 MacBook (which has a T8300), that’s a 70% speedup. That’s huge, but it’s just a synthetic benchmark. Still, it’s clear that the new MacBooks are speedy, and the new CPUs are not the only reason.

Cupertino finally dumped the crappy NVIDIA chipset in favor of Intel’s integrated graphics. It was a bad deal for MacBook Pros all along: While the MacBook really benefits from a more powerful GPU, especially when some applications use OpenCL, the Pros already have a good graphics chip built-in! All Apple achieved in the late 2008 update was to nullify the speedup that updating to DDR3 would have meant.

Today, Apple corrected their mistake. The i5 and i7 chips seem to be the fastest that Intel makes for the 35W class. I’ll be visiting a Mac shop in the next days to try out some my-world benchmarks. Hopefully, I can get what I have been searching for over a year now: More Speed™.

Update: Geekbench has confirmed my results.

Mon 2010-04-12 ( In En ma )

A very minor point in the list of new APIs was this one:

Interesting. They didn’t have this feature before? Apple seems to realize that every weapon they give to developers, even if it’s just an optimized API for something you could also implement on your own, is another selling point against Android. Because Google can’t optimize that deeply: Android is polymorph, and hardware-level fine tuning is a lot of work. Or money, that is. Windows 7 and the other systems will have to fight the same uphill battle.

Having really fast text pattern matching on a mobile device is a feature in itself. Keep in mind that even the iPad is still an order of magnitude behind on raw processing power compared to current laptops. Everything can become a bottleneck in the iPhone OS world.

By the way: CodeRay for iPhone OS, anyone? :D Regular expressions are the core of every good syntax highlighter.

Sat 2010-04-03 ( In En )

A short story by James Thurber, read by Countdown anchor Keith Olberman.

I’ll be hiding in the middle of nowhere (Rädel, Brandenburg, Germany) for the next 8 days with my Boy Scout Patrol “Berglöwe” (Mountain Lion) on an Easter camp. No computers, no internet, no electricity. Just cooking over the campfire, sleeping in black tents and singing to guitars.

Happy Easter holidays to you all!

Fri 2010-04-02 ( In En pr )

Revision 534 of my syntax highlighting library updates the HTML output to HTML5 and CSS 3, which means IE users will need to install a browser to see CodeRay highlighted code.

Yes, I’m radical. Feels so good.

(By the way: Microsoft can choose to support CodeRay again if they wish :)

Mon 2010-03-29 ( In En ma )

(See also my initial thoughts.)

I wondered why the latest Apple devices, including MacBooks (especially the Air), iPhones, and now the iPad all have rounded backs/bottoms. Well, the answer is very simple: Remember the last time you had problems picking up change from a counter? It would be nearly impossible to pick up a 700 gram (1.5 pounds) metal slate lying flat on a table without being able to put a fingertip under it:

It’s so simple that you don’t notice. Like some kind of industrial design typography. Sure, it doesn’t look nice from the back – but who cares? The only important part is the front.

Sat 2010-03-27 ( In De fu ra )

Das ist ja nun das Albernste überhaupt:

Wachs aus Teelichtern zu verbrennen erzeugt CO2. Das Bild ist ungefähr so, als würde man für die Abrüstung Leute erschießen.

Atmen erzeugt übrigends auch CO2. Wenn die Öko-Romantiker auf dem Foto also mal bitte für eine Weile die Luft anhalten könnten…so ungefähr 10 Minuten lang. Danke.

Thu 2010-03-25 ( In En fu pi )

Fri 2010-03-19 ( In De pr )

Man sollte allerdings bedenken, dass manche Männer sich als Frauen ausgeben und umgekehrt. Aber im Allgemeinen beantwortet das die Frage, wo die Frauen abgeblieben sind – zumindest frage ich mich das oft, wenn ich mich durch die Tech-Blogosphäre bewege.

Soziale Netzwerke sind offenbar nichts anderes als die weibliche Seite des Internets. Männer haben es lange Zeit nur dafür benutzt, Informationen auszutauschen (oder Pornos). Kommunikation über das Web (Twitter, Facebook, Gästebücher auf MySpace, das Gebrabbel auf StudiVZ usw.) ist aber heute mindestens so grundlegend wie Information (Wikipedia, Blogs, News, Google).

Es war auch überfällig :) Mails sind nämlich Mist, da sie aus der Gedankenwelt technischer Beschränkungen (nur Text, international eindeutige E-Mail-Adressen, die viel zu lang sind) und Bürometaphern (interne Post, Empfänger/Absender, Blindkopie, Briefform) stammen.

Die Idee mit dem IE8-Frauenbrowser hingegen ist peinlich. Frauen brauchen keine voreingestellten Favoriten, sondern einen schnellen, zuverlässigen Browser und moderne Webstandards – genau wie alle anderen auch.

Thu 2010-03-18 ( In De fu )

Sun 2010-03-14 ( In En pr )

I have written a little TextMate command (download) that allows you to count Lines of Code of the current file:

Here, this command is being used to verify that blokk stays at 318 LoC.

It needs CodeRay 0.9.1 or later.

Fri 2010-03-12 ( In En )

My homepage was about:blank for over a year now. I was sick of slow-loading start pages, and I just don’t have any site I really frequent so much that I want to look at it every time I open a new browser window.

But today, TPUTH became my Home Page in Firefox. It’s a metablog about “tech and design”.

What got me? The whole digital yellow-press newspaper style combined with Socialist party medals of geek gods, a Cyrillic-looking title that you can’t pronounce (try it!)…it’s just cute, and funny, and stylish. It has daily funny pictures, and only features ironic headlines that link straight into the blogosphere.

Thu 2010-03-11 ( In En pi )

Ever needed a or a ?

Here’s a nice generator by the French team Country and Kath. It produces animated GIFs for a style and background color you select. You can download them, and they are Public Domain (at least that’s how I understand totally free for use).

I know I’m contradicting myself here:

Seriously, drop animated GIFs. They stink.

AJAX loading indicators may be the only valid excuse for using an animated GIF. And maybe writing a blog post about them.

Tue 2010-03-09 ( In De fu )

Ich finde, ein Artikel über den Vollpfosten wäre eine sinnvolle Ergänzung zur deutschen Wikipedia gewesen. Stattdessen gab es zehn Löschungen in den letzten Jahren, mit scheinheiligen Begründungen:

  • 02:20, 2. Nov. 2006 Xocolatl (Diskussion | Beiträge) hat „Vollpfosten“ gelöscht ‎ (Inhalt war: ‘umgangssprachliche Bezeichnung für einen deutlich unterbemittelten Menschen’ (einziger Bearbeiter: ‘Benutzer:84.141.221.180’)
  • 16:11, 28. Apr. 2007 Felix Stember (Diskussion | Beiträge) hat „Vollpfosten“ nach „Benutzer:Mycroft Holmes“ verschoben und dabei eine Weiterleitung überschrieben
  • 15:41, 29. Jun. 2008 Tafkas (Diskussion | Beiträge) hat „Vollpfosten“ gelöscht ‎ (Unsinn)
  • 14:58, 17. Okt. 2008 Maclemo (Diskussion | Beiträge) hat „Vollpfosten“ gelöscht ‎ (Kein enzyklopädischer Inhalt)
  • usw.

Die Konkurrenz Stupidedia bietet hingegen ausführliche Informationen.

Sun 2010-03-07 ( In En pr ma )

In January, I wrote about my thoughts on the iPad:

Somehow, I’d like to code on that thing! TextMate 2 for iPad?

Some weeks later, I realized that this might have been a stupid idea. Isn’t the iPad a media viewer, with editing capabilities for visual things like presentations at most?

On third thought…

Well, now Matt Gemmell writes about iPad Application Design. The first line that got me was:

Look like a viewer, and behave like an editor.

Wow, what a statement :) Isn’t that what TextMate is all about?

Wed 2010-02-24 ( In En pr )

If something has more than, say, 5 parameters, it should be divided into components that have less.

Less is more. Hierarchies, if sensibly applied, can manage complexity.

Think LEGO.

Mon 2010-02-22 ( In En pr )

1 puts, p, print

2 require

3 raise, throw, warn

4 new

5 to_s, to_i, to_f, to_sym

6 private, protected

7 class

Sun 2010-02-07 ( In En bl )

Why did I name my blog “(almost) murphy.de”? Two reasons:

  • My internet nickname is murphy, and I’m German. However, murphy.de was taken. I thought I could use that as an idea for the name.
  • I’m an incomplete being. There’s a great Blues Brothers song called Almost (original by Downchild) which gave me the idea. I think “almost” is a nice word, too.

So, this is my explanation :) What about your blog’s name?

Sat 2010-02-06 ( In En fu pi )

Thu 2010-02-04 ( In En ob )

Here’s a good article about the recent discussion about finally allowing gays (and lesbians) to serve openly in the US military. I hope Obama and the Admirals get this through.

And what about you, Turkey? Serbia? Greece? Singapore, Malaysia, Myanmar? North and South Korea? Sri Lanka, India, Pakistan? Western Asia (except Israel)? Venezuela, Chile? Cuba? And, for god’s sake: Jamaica.

Thu 2010-02-04 ( In En fu pi )

Or, the original version:

Tue 2010-02-02 ( In En pr )

They do. As do Germans, Spaniards, Californians, Czechs, Polish, Indians, and propably some Japanese. I think that’s cool :)