Archiv für Juli 2009

Vorsicht bei Ökostrom

Auch bei Oköstrom kann man was falsch machen, wie nzz.ch nun online berichtet:

Pflanzenöle gelten als umweltverträgliche Alternative zu Erdöl im Energiebereich. Doch wenn Palmöl eingesetzt wird, stimmt dies laut Umweltschutzexperten nicht mehr. Denn um Palmölplantagen anzulegen, werden enorme Mengen an Kohlenstoffdioxid freigesetzt.

slz. In der Klimadebatte verweisen deutsche Politiker oft und gerne auf das Erneuerbare-Energien-Gesetz (EEG), dank dessen Förderungsmechanismen der Anteil erneuerbarer Energien an der Stromerzeugung im Jahre 2006 bereits 11,8 Prozent betragen habe. Doch Umweltexperten weisen in letzter Zeit immer öfter darauf hin, dass für die Produktion des Ökostroms vermehrt Palmöl in Blockheizkraftwerken verbrannt werde. Und dieses Palmöl stamme keineswegs aus nachhaltigem Anbau. Dabei werde tropischer Regenwald vor allem in Südostasien vernichtet.

Der ganze Artikel ist hier zu finden.

Ich verweise nochmal auf meinen derzeitigen Stromanbieter Naturwatt, die mit 19.90 Cent/kWh und 7,50 € Grundpreis im Monat eine der günstigsten Ökostrom-Anbieter sind die ich kenne. Dort wird der normale Haushaltsstrom zu 100% aus Wasserkraft gewonnen!

5 gute Gründe gegen Nachtspeicherheizung

Da ich mich im Moment etwas nach einer neuen Wohnung umschaue, treffe ich häufig auf Wohnungen mit Nachtspeicherheizungen, die für mich aus unten aufgeführten Gründen nicht in Frage kommen:

  1. Heizen mit Strom ist teuer
  2. Heizen mit Strom ist umweltschädlich (-er als Gas)
  3. bei Wetterumschwüngen ist die Wohnung kalt (oder warm)
  4. durch Verschwelen von Staub und Verwirbelung der Asche kann die Wohung stark verdrecken
  5. nicht alle Anbieter bieten Nachtstromzähler und -tarife. Ich möchte nicht wieder bei RWE landen.

My sports playlist

I like Sebastians idea to post his sports playlist, but instead of showing you my playlist, I list some bands+albums, because my player has an internal flash memory of… umm… 4 GB?

  1. Metallica – Death Magnetic (rocks hard)
  2. Pantera – Far Beyond Driven (woohey!)
  3. Dream Theater – Falling Into Infinity (nice, but slow music)
  4. In Extremo – Sängerkrieg
  5. Subway to Sally – Kreuzfeuer

Tip des Tages: Korrekte Benutzung von Klopapier

(Entweder JavaScript ist nicht aktiviert, oder Sie benutzen eine alte Version von Adobe Flash Player. Installieren Sie bitte den aktuellsten Flash Player. )

Ohne Worte…

Die Innung der Pferdekutscher…

… erwägt erneut Klage gegen den Automobilkonzern Daimler wegen
Unterwanderung ihres Geschäftsmodells und Diebstahl von Fahrgästen
mit Verlusten in Höhe von mehreren Millionen Goldmark.

Näherer Hintergrund: Heise News

Quelle des Zitats: Heise News – Kommentare

Bug in Maven 2.2.0

Due to a bug in Maven 2.2.0, I am not able to add a 3rd-party-dependency to my local repository. I’m running Windows 7 with the Windows PowerShell/CMD and it does not recognize the parameter -Dversion=4.0.1, obviously because of some escape problems with the dot.

That is quite annoying because it’s only able to read -Dversion=4 => not the point of a dependency management tool :-)

I filed a bug to the Apache JIRA bugtracker and hope I’ll get an answer soon.

UPDATE: The “=” seems to be a special/reserved character in Windows PowerShell, we have to put the parameters containing “=” in quotes, ie. “-Dversion=4.0.0″.

SEO-friendly URLs in PHP (5) w/o mod_rewrite

I showed Sebastian my little SEO-friendly PHP example, so why shouldn’t I share it with you people?

Many of you know one or more PHP frameworks like Zend, CakePHP or Symfony which provide SEO-friendy URLs via so called routing functions. Routing it is, because there is a centralized object instance, which delegates function calls to the appropiate class. Implementing this is quite easy with PHP 5 which provides autoloading of classes and (due to its typeless language structure) function loading on demand via “string” variables.

Lets start with a simple class named booking:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
class booking
{
	private $params;
 
	function __construct($params)
	{
		$this->params = $params;
		echo 'Constructor of class booking. <br />';
	}
 
	function sayHello()
	{
		echo 'Hello World in class booking. <br />';
		echo var_dump($this->params);
	}
}
?>

The real logic takes place in the class router, which explodes the request uri and resolves the classes/methods we want to call:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
class router
{
	private $origUrl;
	private $controller;
	private $action;
	private $params;
 
	public function __construct($origUrl)
	{
		$this->origUrl = $origUrl;
		$this->extractController();
	}
 
	private function extractController()
	{
		$urlParts = explode('index.php', $this->origUrl);
		$mvcParts = explode('/', $urlParts[1]);
		$this->controller = $mvcParts[1];
		$this->action = $mvcParts[2];
		$this->params = $mvcParts[3];
	}
 
	public function connect()
	{
		$controller = $this->controller;
		$action = $this->action;
		$params = $this->params;
 
		if (class_exists($controller, true))
		{
			$controllerInstance = new $controller($params);
		}
		else
		{
			throw new Exception('There was no controller named ' . $controller);
		}
		if (method_exists($controllerInstance, $action))
		{
			$controllerInstance->$action();
		}
		else
		{
			throw new Exception('There was no action named ' . $action);
		}
	}
}
?>

This is our index.php which instantiates the router object:

1
2
3
4
5
6
7
<?php
 
require_once('config.inc.php');
 
$router = new router($_SERVER['REQUEST_URI']);
$router->connect();
?>

And a config.inc.php, which extends our include path for classes and defines the required autoload function:

1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
 
set_include_path(get_include_path() 
	. PATH_SEPARATOR 
	. dirname(__FILE__)
	. DIRECTORY_SEPARATOR
	. 'classes');
 
function __autoload($class_name)
{
	require_once $class_name . '.php';
}
?>

A call of index.php/booking/sayHello/123456 will result in the following output:

Constructor of class booking.
Hello World in class booking.
123456

Further explanation needed? Comment please :-)

PS: Attached example files as zip.
PPS: This is no production code!

example