Archive for May, 2008

PHP: Multi-byte-safe number_format function

I recently ran into a problem with PHP’s built-in number_format function. The function is actually quite handy: It allows you to format a number in a manner that is appropriate for the language your website is currently in.

Example: To write the number 4505 and 31 hundredths in English, you’d write “4,505.31″. In German or Spanish however, the comma is the decimal separator, in turn using the point as the “digit group separator”: “4.505,31″. Swiss German, however, uses an apostrophe-like character as a digit group separator: “4′505,31″. And so on, and so forth.

All of these are supposedly addressed by using the number_format() function, feeding it the number to be displayed and the regionally appropriate separator characters.

Sadly though, when you do this for Russian and other eastern European languages, your result looks like this: Read the rest of this entry »

Half taken off

Pittsburgh (source: Wikipedia.org)My take-off to Pittsburgh is coming closer and closer, and in the meantime, my to-do list seems to be getting longer and longer, but I am bravely fighting through it :).

What’s kind of weird is the housing situation in Pittsburgh: I’ve been writing emails to a bunch of landlord and landladies that I found on craigslist, but most people want to rent out their rooms for a 12 months lease, minimum, and 9 months is not acceptable.

Others just want me to send a check from a distance, rather than making an appointment to look at the place. Riiight. I am going to give you money just like that.

The last group posts quite appealing ads with descriptions of how their apartment is, what the room to be rented is like, how conveniently it’s located, etc etc, and once you reach the end of the ad, it say “females only”. Noooo…

In spite of these little problems, I am looking forward to go to Pittsburgh soon. I’m sure it’ll be fun.

Daily currency exchange rates

I was just trying to find out how many Euros a specific US invoice equaled last year at the time that I paid it.

Where can I find the exchange rate from 10 Dollars to Euros on April 1, 2007?

Sadly, just entering it into Google won’t work of course, since over the last year the Dollar-to-Euro exchange rate has changed more drastically than a beer lover’s facial expression after a sip of Coors Light: Searching for “10 dollars to euros” there reports 6.42 Euros at the moment.

After a little digging however, I found Bank of Canada’s currency conversion page, where you can request daily conversion rates dating back until 1997.

According to that page, in our little example above, 10 US Dollars equaled 7.48 Euros at the time.

Very useful, indeed!

The Principles of Economics

What is the key skill of a bored student? Exactly: creativity. But see for yourselves.

(Source, via stumbleupon).

Back in town

Long time no see, everybody. I was quite busy lately, and I also spent a few days on vacation in Krakow, Poland. But I am back now and getting ready for leaving to Pittsburgh soon. Here are some pictures of Krakow for your enjoyment (click!):

During the course of our stay, we also went to see the Auschwitz and Auschwitz-Birkenau memorial sites. I took some pictures there also:

I think these two flights to Krakow and back were the perfect “practice” for my upcoming intercontinental flight. By the way, I have to say, Poland having joined Schengen is awesome. Traveling all over Europe has never been that easy. Thumbs up for the European Union!