Monday, December 1, 2008

classic template tag cloud

Since I'm hosting this blog on my own server I'm not able to use the blogger's new "Layouts customization" and thus can't display these fancy tag clouds which usually appear in the sidebar. However, I've found some solutions which add labels functionality to classic blogger templates, the most flexible of which seem to be using a PHP script which can be used in the template. So I've modified the script found on this blog, fixing a minor bug and adding two new features. First, the script now takes care of the actual amount of tagged articles under a certain label which can optionally be displayed next to the label (check the second source code snippet and uncomment the appropriate lines):

if(preg_match("/\/labels\//", $_SERVER['PHP_SELF'])) {
$files[$file] = substr_count(
file_get_contents($file),'<!-- End .post -->');
} else {
$files[$file] = substr_count(
file_get_contents(PREFIX.$file),'<!-- End .post -->');
}

Second, result pages invoked from links in the label cloud now correctly link to other results by conditionally removing the prefix to the label directory:

if(preg_match("/\/labels\//", $_SERVER['PHP_SELF'])) {
$output .= "<a style=\"".
get_style($low_end, $high_end, $size) . "\"".
"href=\"". htmlentities($name)."\">".
# Uncomment the next and comment the following line in order
# to display the number of posts for each given label.
#htmlentities(str_replace('.html','',$name))."(".$size.")</a> ";
htmlentities(str_replace('.html','',$name))."</a> ";
} else {
$output .= "<a style=\"".
get_style($low_end, $high_end, $size) . "\" ".
"href=\"".PREFIX. htmlentities($name)."\">".
# Uncomment the next and comment the following line in order
# to display the number of posts for each given label.
#htmlentities(str_replace('.html','',$name))."(".$size.")</a> ";
htmlentities(str_replace('.html','',$name))."</a> ";
}

The complete file can be downloaded here. Follow these steps to set it up and running:
  1. Copy the script to the root folder of your blog.
  2. Modify the SEARCH_DIR define in line 4 to suit your setup.
  3. Create a directory called cloudtemp in the ./labels directory of your root folder:
    # mkdir labels/cloudtemp
  4. Add the directive
    AddType application/x-httpd-php .html
    to your VirtualHost file, e.g. to the section.
  5. Reload your apache server:
    # /etc/init.d/apache2 reload
  6. If you'd like to display the number of related articles in brakets behind the label's name just follow the directives in lines 52 and 60.

Labels: , ,


Tuesday, December 18, 2007

Espain

Spain is a country like any other, it has its history and culture, its nice and its ugly spots - and its language. While languages in Europe usually have a lot in common, be it grammar or vocabulary wise, they definitely also have their little problems of alphabet incompatibility to each other.

For example most nations excluding English speaking ones (and maybe the Netherlands) tend to have their problems with the English 'th' and especially the 'r'. The French for all I know might from time to time find it difficult to properly pronounce words starting with or including an 'h' which makes 'Hotel' sound like 'Otel'.
This phenomenon is obviously based on the fact that the mother tongue doesn't contain or doesn't pronounce some bits and pieces of the other language and thus makes it difficult to master them. As many European nations have problems like this, people often just smile when they encounter them, knowing that oneself might sounds equally funny.

As I've got reasons to be in Spain quite regularly, I could explore the nation's culture, lifestyle and language mostly from a non-touristic point of view. This yielded many interesting facts. Like the French, they've got their problem with the 'h' but even more noticeable is one habit which I haven't encountered anywhere yet. This time the source is not unpronounced or non-existent letters in the speaker's native language but the enforcement to add letters where they don't belong.
The letter in question is the 'e' which, for a Spanish speaker, must be prefixed to double consonants like 'sp', 'st' or 'sm'. The first serious encounter I've enjoyed was a cinema advertising the movie 'Espiderman' followed by the famous alcoholic drink 'Esmirnoff'. I've met Spanish persons who, even by trying hard, couldn't possibly emit such words without leaking an 'e' first.
Well, I've just accepted that my sir name doesn't sound like 'Schmidt' but rather like 'Esmit' - which is totally acceptable considering the excessive use of consonants in this name.

Finally, another amusing finding:


As a side note, there are non-European languages which yield a similar behavior. An example is the Japanese way of appending vowels to consonants in foreign words, such that words ending in 'l' or 'r' actually would end in 'ru'. But that's mainly because the alphabet only contains syllables except for the 'n'.

Labels: ,


Saturday, October 20, 2007

Our dorm's pool

Who could ever claim that Stuttgart's student dormitories aren't luxurious? Not only has the Pfaffenhof dorm on the campus Vaihingen a sauna, it also has a swimming pool for the warmer seasons. Well, it wouldn't be big enough if you actually tried to swim in there, but it's a pool after all. Naturally it attracts huge quantities of water which in turn gets distributed all over the corridors downstairs by its users and thus might not be all that fancy if it starts raining in front of your apartment one day.
I guess it's a privilege as only our house got one and it's not as publicly available as other people might want it to be. If only I could overcome myself and use it one day...

Update: Google maps' image data got refreshed. Now that it's winter there's no pool visible.

Labels: ,