<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Michel Krämer</title>
	<atom:link href="http://www.michel-kraemer.de/feed" rel="self" type="application/rss+xml" />
	<link>http://www.michel-kraemer.de</link>
	<description>Der Blog von Michel Krämer</description>
	<lastBuildDate>Fri, 04 Jun 2010 11:01:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Einfachere Benutzung von Git</title>
		<link>http://www.michel-kraemer.de/einfachere-benutzung-von-git</link>
		<comments>http://www.michel-kraemer.de/einfachere-benutzung-von-git#comments</comments>
		<pubDate>Fri, 04 Jun 2010 10:54:36 +0000</pubDate>
		<dc:creator>michel</dc:creator>
				<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[Git]]></category>

		<guid isPermaLink="false">http://www.michel-kraemer.de/?p=488</guid>
		<description><![CDATA[Seit einiger Zeit benutze ich Git zur Verwaltung meiner Projekte. Da die graphischen Benutzeroberflächen noch nicht besonders ausgereift sind und ich gerne die volle Kontrolle über alles habe, benutze ich Git auf der Kommandozeile (i.e. Bash). Damit ich dort nicht immer wieder die gleichen Kommandos eingeben muss, habe ich mir einige Bash-Aliasse und -Funktionen überlegt, [...]]]></description>
			<content:encoded><![CDATA[<p>Seit einiger Zeit benutze ich Git zur Verwaltung meiner Projekte. Da die graphischen Benutzeroberflächen noch nicht besonders ausgereift sind und ich gerne die volle Kontrolle über alles habe, benutze ich Git auf der Kommandozeile (i.e. Bash). Damit ich dort nicht immer wieder die gleichen Kommandos eingeben muss, habe ich mir einige Bash-Aliasse und -Funktionen überlegt, die die Benutzung von Git vereinfachen.<span id="more-488"></span></p>
<p>Die vereinfachten Kommandos kann man in meinem <a href="http://github.com/michel-kraemer/gitaliases">Github-Repository</a> herunterladen. Eine Anleitung zur Installation und Benutzung findet sich in der <a href="http://github.com/michel-kraemer/gitaliases/blob/master/README.rst">README</a>.</p>
<p>Hier nun eine kurzer Ausschnitt aus den definierten Kommandos:</p>
<dl>
<dt><code>add</code></dt>
<dd>
Führt <code>git add -v</code> und danach <code>git status</code> aus. Alle Parameter werden an <code>git add</code> weitergeleitet.<br />
<i>Beispiel:</i><br />
<code>add -p foobar.txt</code>
</dd>
<dt><code>commit</code>
<dt>
<dd>Alias für <code>git commit</code></dd>
<dt><code>gadd</code>
<dt>
<dd>
Filtert die Ausgabe von <code>git ls-files</code> mit <code>grep</code>, damit nur die Dateien zum Index hinzugefügt werden, die einem bestimmten Muster entsprechen. Alle Parameter (einschließlich des Musters) werden an <code>grep</code> übergeben. Genauso wie bei <code>add</code> wird hier am Ende <code>git status</code> aufgerufen.<br />
<i>Beispiel:</i><br />
<code>gadd -i '\.java$'</code>
</dd>
<dt><code>log</code></dt>
<dd>Alias für <code>git log</code></dd>
<dt><code>pull</code></dt>
<dd>Führt <code>git pull --rebase</code> aus und zeigt dann die Commits seit dem letzten Pull in einem komprimierten Format an.</dd>
<dt><code>push</code></dt>
<dd>Alias für <code>git push</code>
<dd>
<dt><code>st</code></dt>
<dd>Alias für <code>git status</code></dd>
</dl>
<p>Die Kommandos wurden unter <a href="http://code.google.com/p/msysgit">msysgit</a> getestet, sollten aber auch auf anderen Plattformen funktionieren. Eine vollständige Liste findet man in der <a href="http://github.com/michel-kraemer/gitaliases/blob/master/README.rst">README</a>.</p>
<p>In Zukunft wird die Liste der Kommandos vielleicht noch erweitert. Ich würde mich über Feedback freuen.</p>
<p>Abschließend möchte ich mich bei Simon Templer und Simon Thum für die Ideen bedanken!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michel-kraemer.de/einfachere-benutzung-von-git/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mehrsprachige Webseiten mit Lift und OSGi</title>
		<link>http://www.michel-kraemer.de/mehrsprachige-webseiten-mit-lift-und-osgi</link>
		<comments>http://www.michel-kraemer.de/mehrsprachige-webseiten-mit-lift-und-osgi#comments</comments>
		<pubDate>Mon, 05 Apr 2010 15:11:12 +0000</pubDate>
		<dc:creator>michel</dc:creator>
				<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[Internationalisierung]]></category>
		<category><![CDATA[Lift]]></category>
		<category><![CDATA[OSGi]]></category>
		<category><![CDATA[Scala]]></category>

		<guid isPermaLink="false">http://www.michel-kraemer.de/?p=386</guid>
		<description><![CDATA[Für die Internationalisierung von Webseiten bietet Lift bereits einige Mechanismen. Wird das Framework aber in einer OSGi-Umgebung verwendet, benötigt man einen kleinen Workaround, damit die Resource-Bundles in Form von Property-Files gefunden werden können. Internationalisierung mit Lift Zunächst eine kleine Zusammenfassung der Möglichkeiten zur Internationalisierung mit Lift: Die String-Ressourcen müssen in so genannten &#8220;Property-Bundles&#8221; abgelegt werden. [...]]]></description>
			<content:encoded><![CDATA[<p>Für die Internationalisierung von Webseiten bietet <a href="http://www.liftweb.net">Lift</a> bereits einige Mechanismen. Wird das Framework aber in einer OSGi-Umgebung verwendet, benötigt man einen kleinen Workaround, damit die <a href="http://java.sun.com/developer/technicalArticles/Intl/ResourceBundles/">Resource-Bundles</a> in Form von Property-Files gefunden werden können.<span id="more-386"></span></p>
<h3>Internationalisierung mit Lift</h3>
<p>Zunächst eine kleine Zusammenfassung der Möglichkeiten zur Internationalisierung mit Lift: Die String-Ressourcen müssen in so genannten &#8220;Property-Bundles&#8221; abgelegt werden. Das sind ganz normale Java-Properties-Dateien in der folgenden Form:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="properties" style="font-family:monospace;"><span style="color: #000080; font-weight:bold;">title</span><span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;">Meine Website</span>
<span style="color: #000080; font-weight:bold;">yes</span><span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;">Ja</span>
<span style="color: #000080; font-weight:bold;">no</span><span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;">Nein</span>
<span style="color: #000080; font-weight:bold;">deletequestion</span><span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;">Möchten Sie alles löschen?</span></pre></td></tr></table></div>

<p>Der Name der Property-Bundles beginnt immer mit <code>lift</code>. Jedoch werden unterschiedliche Suffixe angehängt, die die entsprechende Sprache und optional das Land im ISO-Format angeben. Zum Beispiel enthält die Datei <code>lift_en.properties</code> englische String-Ressourcen während <code>lift_de.properties</code> deutsche und <code>lift_de_CH.properties</code> schweizerdeutsche enthält. Den Präfix <code>lift</code> kann man im Boot-Loader der Webapplikation spezifizieren:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="scala" style="font-family:monospace;">LiftRules.<span style="color: #000000;">resourceNames</span> <span style="color: #000080;">=</span> <span style="color: #6666FF;">&quot;einAndererPraefix&quot;</span> <span style="color: #000080;">::</span> Nil</pre></td></tr></table></div>

<p>Die Variable <code>resourceNames</code> ist dabei eine Liste von Strings. Das heißt, man kann seine Resource-Bundles auch in mehrere Dateien mit unterschiedlichen Präfixen aufteilen, damit man z.B. in großen Projekten nicht den Überblick verliert.</p>
<p>Hat man die Resource-Bundles erstellt, kann man Strings in HTML-Templates mit <code>&lt;lift:loc locid="..." /&gt;</code> übersetzen. Verwendet man also die Properties-Datei aus obigem Beispiel, dann wird das folgende Template</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;&lt;lift:loc locid<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;title&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;lift:loc locid<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;deletequestion&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">button</span>&gt;&lt;lift:loc locid<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;yes&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">button</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">button</span>&gt;&lt;lift:loc locid<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;no&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">button</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></td></tr></table></div>

<p>in folgenden HTML-Code übersetzt:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;</span>Meine Website<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
Möchten Sie alles Löschen?
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">button</span>&gt;</span>Ja<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">button</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">button</span>&gt;</span>Nein<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">button</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></td></tr></table></div>

<p>Im Scala-Quellcode kann man stattdessen das Stateful-Objekt <code>net.liftweb.http.S</code> verwenden. Es definiert die Methode <code>?</code>, die einen String als Parameter annimmt und diesen im Resource-Bundle sucht:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="scala" style="font-family:monospace;"><span style="color: #0000ff; font-weight: bold;">def</span> snippet<span style="color: #F78811;">&#40;</span>xhtml<span style="color: #000080;">:</span> NodeSeq<span style="color: #F78811;">&#41;</span><span style="color: #000080;">:</span> NodeSeq <span style="color: #000080;">=</span>
  <span style="color: #000080;">&lt;</span>p<span style="color: #000080;">&gt;</span><span style="color: #F78811;">&#123;</span> S <span style="color: #000080;">?</span> <span style="color: #6666FF;">&quot;deletequestion&quot;</span> <span style="color: #F78811;">&#125;</span><span style="color: #000080;">&lt;</span>/p<span style="color: #000080;">&gt;</span></pre></td></tr></table></div>

<p>Ein kleiner Tipp: Möchte man in den HTML-Templates Tag-Attribute übersetzen (z.B. das Attribut <code>value</code> eines <code>input</code>-Elements), dann sollte man den entsprechenden Teil in ein Snippet auslagern, sodass man das <code>S</code>-Objekt verwenden kann:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="scala" style="font-family:monospace;"><span style="color: #0000ff; font-weight: bold;">def</span> inputButton<span style="color: #F78811;">&#40;</span>xhtml<span style="color: #000080;">:</span> NodeSeq<span style="color: #F78811;">&#41;</span><span style="color: #000080;">:</span> NodeSeq <span style="color: #000080;">=</span>
  <span style="color: #000080;">&lt;</span>input <span style="color: #0000ff; font-weight: bold;">type</span><span style="color: #000080;">=</span><span style="color: #6666FF;">&quot;button&quot;</span> value<span style="color: #000080;">=</span><span style="color: #F78811;">&#123;</span> S <span style="color: #000080;">?</span> <span style="color: #6666FF;">&quot;yes&quot;</span> <span style="color: #F78811;">&#125;</span> /<span style="color: #000080;">&gt;</span></pre></td></tr></table></div>

<h3>Resource-Bundles in der OSGi-Umgebung</h3>
<p>Das Problem mit der oben beschriebenen Methode ist, dass die Resource-Bundles von Lift im Classpath mittels <code>getClass.getClassLoader.getResourceAsStream()</code> gesucht werden. In einer OSGi-Umgebung können Sie demnach nicht mehr gefunden werden, da der Classloader des Bundles <code>net.liftweb.lift-webkit</code> verwendet wird.</p>
<p>Wie eingangs erwähnt, kann man dies mit einem Workaround lösen. Dazu muss man im BootLoader eine Resource-Bundle-Factory definieren:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="scala" style="font-family:monospace;">LiftRules.<span style="color: #000000;">resourceBundleFactories</span> prepend <span style="color: #F78811;">&#123;</span>
  <span style="color: #0000ff; font-weight: bold;">case</span> <span style="color: #F78811;">&#40;</span>basename, locale<span style="color: #F78811;">&#41;</span> <span style="color: #000080;">=&gt;</span> ResourceBundle.<span style="color: #000000;">getBundle</span><span style="color: #F78811;">&#40;</span>basename, locale<span style="color: #F78811;">&#41;</span>
<span style="color: #F78811;">&#125;</span></pre></td></tr></table></div>

<p>Dadurch werden die Resource-Bundles über den Classloader des Bundles, das den BootLoader enthält, geladen.</p>
<h3>Zusammenfassung</h3>
<p>Die Mechanismen zur Internationalisierung mit Lift sind ausreichend für die meisten Webseiten. Wenn man etwas mit dem Lift-Tag nicht übersetzen kann (z.B. Attribute) oder man mehr Kontrolle benötigt, muss man auf Snippets ausweichen. In OSGi-Umgebungen muss man eine Resource-Bundle-Factory erzeugen, die die Properties-Dateien über den korrekten Classloader lädt.</p>
<p>In einem weiteren Artikel werde ich in Kürze auf die Übersetzung von Strings in JavaScript-Dateien eingehen.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michel-kraemer.de/mehrsprachige-webseiten-mit-lift-und-osgi/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scala-Projekte mit Eclipse PDE Build bauen</title>
		<link>http://www.michel-kraemer.de/scala-projekte-mit-eclipse-pde-build-bauen</link>
		<comments>http://www.michel-kraemer.de/scala-projekte-mit-eclipse-pde-build-bauen#comments</comments>
		<pubDate>Tue, 30 Mar 2010 06:01:15 +0000</pubDate>
		<dc:creator>michel</dc:creator>
				<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[Ant]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[OSGi]]></category>
		<category><![CDATA[PDE]]></category>
		<category><![CDATA[Scala]]></category>

		<guid isPermaLink="false">http://www.michel-kraemer.de/?p=320</guid>
		<description><![CDATA[PDE Build ist das Standard-Build-System von Eclipse. Es wird verwendet, um OSGi Bundles, Plugins, Features oder Produkte zu exportieren. Im so genannten Headless Mode kann man es einsetzen, um automatisierte Builds ohne Eclipse UI durchzuführen. Die Scala IDE unterstützt PDE Build bisher noch nicht. Um Scala-Projekte zu kompilieren, muss man selbst etwas Hand anlegen. Zunächst [...]]]></description>
			<content:encoded><![CDATA[<p>PDE Build ist das Standard-Build-System von Eclipse. Es wird verwendet, um OSGi Bundles, Plugins, Features oder Produkte zu exportieren. Im so genannten Headless Mode kann man es einsetzen, um automatisierte Builds ohne Eclipse UI durchzuführen. Die Scala IDE unterstützt PDE Build bisher noch nicht. Um Scala-Projekte zu kompilieren, muss man selbst etwas Hand anlegen.<span id="more-320"></span></p>
<p>Zunächst benötigt man ein Ant-Skript, das man in den Build-Prozess einhängen kann. Das Skript sollte den Namen <code>customBuildCallbacks.xml</code> haben und im Wurzel-Verzeichnis des Bundles liegen, das den zu kompilierenden Scala-Quellcode enthält:</p>
<p><code>de.michel-kraemer.myplugin/<br />
  |- bin<br />
  |- META-INF<br />
  |- src<br />
  |- build.properties<br />
  |- customBuildCallbacks.xml<br />
</code></p>
<p>Im gleichen Verzeichnis liegt die Datei <code>build.properties</code> des Plugins. (Nicht zu verwechseln mit der <code>build.properties</code>-Datei, die man für den Headless Build benötigt!) Damit das neue Ant-Skript während des PDE Builds auch ausgeführt wird, muss man dieser Datei folgendes hinzufügen:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="properties" style="font-family:monospace;"><span style="color: #000080; font-weight:bold;">customBuildCallbacks</span><span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;">customBuildCallbacks.xml</span>
<span style="color: #000080; font-weight:bold;">customBuildCallbacks.inheritall</span><span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;">true</span></pre></td></tr></table></div>

<p>Die zweite Zeile ermöglicht den Zugriff auf globale Properties wie zum Beispiel <code>${build.result.folder}</code>.</p>
<p>Im Ant-Skript kann man spezielle Targets definieren, die zu bestimmten Zeitpunkten im Build-Prozess aufgerufen werden. Am besten kopiert man dazu die Vorlage aus dem Verzeichnis <code>${eclipse.home}/plugins/org.eclipse.pde.build_*/templates/plugins/</code>.</p>
<p>Das Target <code>post.compile.@dot</code> eignet sich hervorragend, um den Scala-Compiler manuell aufzurufen. Dazu muss man zunächst die Ant-Tasks definieren, die bereits mit der Scala Library ausgeliefert werden. Eine automatische Suche nach der Scala Library, die durch die Scala IDE installiert wird, und den dazugehörigen Tools kann man in Ant zum Beispiel folgendermaßen realisieren:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- find eclipse.home --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathconvert</span> <span style="color: #000066;">property</span>=<span style="color: #ff0000;">&quot;eclipse.home&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;path</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${eclipse.launcher}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mapper<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #808080; font-style: italic;">&lt;!-- map &quot;${eclipse.home}/eclipse.exe&quot; to &quot;${eclipse.home}&quot; --&gt;</span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;globmapper</span> <span style="color: #000066;">from</span>=<span style="color: #ff0000;">&quot;*/eclipse.exe&quot;</span> <span style="color: #000066;">to</span>=<span style="color: #ff0000;">&quot;*&quot;</span> <span style="color: #000066;">handledirsep</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mapper<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pathconvert<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- find scala bundle --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathconvert</span> <span style="color: #000066;">property</span>=<span style="color: #ff0000;">&quot;scala_bundle&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;path<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${eclipse.home}/plugins&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;scala.library_*&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fileset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/path<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pathconvert<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- find scala tools --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathconvert</span> <span style="color: #000066;">property</span>=<span style="color: #ff0000;">&quot;scala_tools_jar&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;path<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${eclipse.home}/plugins&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;scala.tools.nsc_*&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fileset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/path<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pathconvert<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Danach steht der Pfad zum Scala-OSGi-Bundle in der Variablen <code>${scala_bundle}</code> zur Verfügung. Die Variable <code>${scala_tools_jar}</code> zeigt außerdem auf die Jar-Datei, die die Scala-Tools und damit auch die Ant-Tasks enthält.</p>
<p>Das Library-Bundle muss als nächstes entpackt werden, damit die eigentliche Scala-Library <code>scala-library.jar</code> bei der Task-Definition und beim Kompilieren im Classpath verwendet werden kann. Dazu nutzt man am besten das temporäre Build-Verzeichnis, das in der Variablen <code>${build.result.folder}</code> zu finden ist:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;unjar</span> <span style="color: #000066;">dest</span>=<span style="color: #ff0000;">&quot;${build.result.folder}/scala-library&quot;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;${scala_bundle}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;scala_library_jar&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${build.result.folder}/scala-library/lib/scala-library.jar&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></td></tr></table></div>

<p>Danach können die Scala-Ant-Tasks definiert werden:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- define scalac task --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;taskdef</span> <span style="color: #000066;">resource</span>=<span style="color: #ff0000;">&quot;scala/tools/ant/antlib.xml&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;classpath<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${scala_tools_jar}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${scala_library_jar}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/classpath<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/taskdef<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Vor dem Kompilieren der Klassen, muss zunächst noch der korrekte Classpath definiert werden. Dieser setzt sich aus den vom PDE Build vorgegebenen Classpath <code>@dot.classpath</code> und der Scala-Library zusammen:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathconvert</span> <span style="color: #000066;">property</span>=<span style="color: #ff0000;">&quot;my.classpath&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;restrict<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;path<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;path</span> <span style="color: #000066;">refid</span>=<span style="color: #ff0000;">&quot;@dot.classpath&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${scala_library_jar}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/path<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #808080; font-style: italic;">&lt;!-- remove libraries from classpath that don't exist (optional) --&gt;</span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;rsel:exists</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/restrict<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pathconvert<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Das Filtern von nicht vorhandenen Bibliotheken aus dem Classpath über <code>&lt;rsel:exists /&gt;</code> ist hierbei optional. Damit dies funktioniert, muss man im Root-Knoten der XML-Datei den entsprechenden Namespace definieren:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Build specific targets and properties&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">xmlns:rsel</span>=<span style="color: #ff0000;">&quot;antlib:org.apache.tools.ant.types.resources.selectors&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    ...</pre></td></tr></table></div>

<p>Schließlich wird der Quellcode kompiliert:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- compile scala source files --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${target.folder}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;scalac</span> <span style="color: #000066;">srcdir</span>=<span style="color: #ff0000;">&quot;${source.folder1}&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">destdir</span>=<span style="color: #ff0000;">&quot;${target.folder}&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">classpath</span>=<span style="color: #ff0000;">&quot;${my.classpath}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;**/*.scala&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/scalac<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Als letztes kann man noch die Scala-Quelldateien aus dem Zielordner entfernen, damit diese nicht mit dem Plugin ausgeliefert werden:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- delete scala source files in output folder --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${target.folder}&quot;</span> <span style="color: #000066;">includes</span>=<span style="color: #ff0000;">&quot;**/*.scala&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/delete<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<h3>Zusammenfassung</h3>
<p>Die hier vorgestellte Methode verwendet die Möglichkeit, eigene Ant-Kommandos in den PDE-Build-Prozess aufzunehmen. Dabei wird versucht, die Scala-Bibliothek und die -Tools zu verwenden, die zusammen mit der IDE ausgeliefert werden. Falls man dies nicht möchte, kann man auch die Dateien <code>scala-library.jar</code> sowie <code>scala-compiler.jar</code> (enthält den Ant-Task) aus der Standard-Scala-Distribution kopieren und diese stattdessen in den Classpath einbinden.</p>
<p>Den vollständigen Quellcode der generischen Datei <code>customBuildCallbacks.xml</code> kann man hier herunterladen:</p>
Note: There is a file embedded within this post, please visit this post to download the file.
<p>Die Datei kann ohne Änderungen in jedes OSGi-Bundle kopiert werden, das mit PDE Build gebaut werden soll und Scala-Code enthält. Lediglich die Datei <code>build.properties</code> muss noch wie oben beschrieben angepasst werden.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michel-kraemer.de/scala-projekte-mit-eclipse-pde-build-bauen/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Style Guide für Scala</title>
		<link>http://www.michel-kraemer.de/style-guide-fur-scala</link>
		<comments>http://www.michel-kraemer.de/style-guide-fur-scala#comments</comments>
		<pubDate>Mon, 22 Mar 2010 18:20:23 +0000</pubDate>
		<dc:creator>michel</dc:creator>
				<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[Scala]]></category>

		<guid isPermaLink="false">http://www.michel-kraemer.de/?p=309</guid>
		<description><![CDATA[Scala hat bisher noch keinen offiziellen Style Guide, weshalb Daniel Spiewak im November 2009 einen Vorschlag für ein solches Dokument auf der Scala-Mailingliste gepostet hat. Wie dort zu lesen ist, findet selbst Martin Odersky, der Schöpfer von Scala, den Vorschlag gut und kann sich vorstellen, das Dokument in absehbarer Zeit offiziell auf der Scala-Website zu [...]]]></description>
			<content:encoded><![CDATA[<p>Scala hat bisher noch keinen offiziellen Style Guide, weshalb <a href="http://www.codecommit.com">Daniel Spiewak</a> im November 2009 einen Vorschlag für ein solches Dokument auf der <a href="http://old.nabble.com/-scala--Proposed-Style-Guide-ts26310456.html">Scala-Mailingliste</a> gepostet hat. Wie dort zu lesen ist, findet selbst Martin Odersky, der Schöpfer von Scala, den Vorschlag gut und kann sich vorstellen, das Dokument in absehbarer Zeit offiziell auf der <a href="http://www.scala-lang.org">Scala-Website</a> zu veröffentlichen.<span id="more-309"></span></p>
<p>Die PDF-Version kann man sich unter folgender Adresse herunterladen:<br />
<a href="http://www.codecommit.com/scala-style-guide.pdf">http://www.codecommit.com/scala-style-guide.pdf</a></p>
<p>Eine Online-Version ist unter folgender Adresse verfügbar:<br />
<a href="http://davetron5000.github.com/scala-style/">http://davetron5000.github.com/scala-style/</a></p>
<p>Der Style Guide ist gut gegliedert. Zu jedem Vorschlag wird auch stets ein Grund angegeben, warum es sinnvoll ist, den Code auf diese Weise zu formatieren und nicht anders. Gegenbeispiele zeigen, wie unleserlich der Code wird, wenn man sich nicht an den Style Guide hält.</p>
<p>Da ich ein großer Verfechter strukturierten Codes bin, kann ich das Dokument nur jedem empfehlen, der sich mit Scala beschäftigt. Wenn man die Sprache gerade neu lernt, sollte man sich den Style Guide möglichst früh durchlesen, damit gar nicht erst &#8220;schlechte Gewohnheiten&#8221; aufkommen. Durch Einhalten des Styles kann die Lesbarkeit von Scala-Programmen erhöht werden, wodurch auch die Erweiterbarkeit und Wartbarkeit vereinfacht wird.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michel-kraemer.de/style-guide-fur-scala/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>phpBB auf dem iPhone/iPod Touch</title>
		<link>http://www.michel-kraemer.de/phpbb-auf-dem-iphone-ipod-touch</link>
		<comments>http://www.michel-kraemer.de/phpbb-auf-dem-iphone-ipod-touch#comments</comments>
		<pubDate>Wed, 03 Mar 2010 19:46:40 +0000</pubDate>
		<dc:creator>michel</dc:creator>
				<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPod]]></category>
		<category><![CDATA[phpBB]]></category>
		<category><![CDATA[Spamihilator]]></category>

		<guid isPermaLink="false">http://www.michel-kraemer.de/?p=287</guid>
		<description><![CDATA[Das iPhone eignet sich hervorragend für Foren-Moderatoren, die viel unterwegs sind und z.B. im Zug Beiträge beantworten möchten. Leider lässt sich das Standard-Theme von phpBB auf dem iPhone (oder dem iPod Touch) nur sehr schlecht bedienen. Die Schriftgröße ist außerdem in den meisten Foren so klein, dass man ständig zoomen muss. Etwas komfortabler ist das [...]]]></description>
			<content:encoded><![CDATA[<p>Das <a href="http://www.apple.com/de/iphone/">iPhone</a> eignet sich hervorragend für Foren-Moderatoren, die viel unterwegs sind und z.B. im Zug Beiträge beantworten möchten. Leider lässt sich das Standard-Theme von <a href="http://www.phpbb.com">phpBB</a> auf dem iPhone (oder dem <a href="http://www.apple.com/de/ipodtouch/">iPod Touch</a>) nur sehr schlecht bedienen. Die Schriftgröße ist außerdem in den meisten Foren so klein, dass man ständig zoomen muss.<span id="more-287"></span></p>
<p>Etwas komfortabler ist das speziell für das iPhone entwickelte, kostenlose Theme <a href="http://code.google.com/p/phpbb-iphone-style/">phpbb-iphone-style</a>. Es reduziert die Anzeige auf die wichtigsten Elemente, vergrößert die Schrift und erleichtert die Bedienung mit dem Touchscreen.</p>
<p>Die Installation ist sehr einfach. Man muss lediglich den Quellcode aus dem Subversion-Repository des Projekts herunterladen und auf dem Webserver in das Unterverzeichnis &#8220;styles&#8221; kopieren. Wenn man möchte, kann man außerdem die beigelegten Anweisungen befolgen, sodass beim Öffnen des Forums mit einem mobilen Browser automatisch das neue Theme ausgewählt wird. Hat man das erledigt, kann man das Theme wahlweise im Administrationsbereich deaktivieren, sodass es in normalen Browsern nicht manuell ausgewählt werden kann.</p>
<p>Ich habe <i>phpbb-iphone-style</i> im <a href="http://www.spamihilator.com/forum">Spamihilator-Forum</a> installiert. Hier ein paar Screenshots:</p>

<a href="http://www.michel-kraemer.de/wp-content/uploads/2010/03/IMG_0006.png" title="Startseite"><img width="150" height="150" src="http://www.michel-kraemer.de/wp-content/uploads/photojar/cache/IMG_0006-150x150-1-img290.png" class="attachment-thumbnail" alt="Startseite" title="Startseite" /></a>\n<a href="http://www.michel-kraemer.de/wp-content/uploads/2010/03/IMG_0007.png" title="Foren-Übersicht"><img width="150" height="150" src="http://www.michel-kraemer.de/wp-content/uploads/photojar/cache/IMG_0007-150x150-1-img291.png" class="attachment-thumbnail" alt="Foren-Übersicht" title="Foren-Übersicht" /></a>\n<a href="http://www.michel-kraemer.de/wp-content/uploads/2010/03/IMG_0005.png" title="Hile-Forum"><img width="150" height="150" src="http://www.michel-kraemer.de/wp-content/uploads/photojar/cache/IMG_0005-150x150-1-img289.png" class="attachment-thumbnail" alt="Hile-Forum" title="Hile-Forum" /></a>\n<a href="http://www.michel-kraemer.de/wp-content/uploads/2010/03/IMG_0008.png" title="Beitrag lesen"><img width="150" height="150" src="http://www.michel-kraemer.de/wp-content/uploads/photojar/cache/IMG_0008-150x150-1-img292.png" class="attachment-thumbnail" alt="Beitrag lesen" title="Beitrag lesen" /></a>\n
<p>Ich werde in den kommenden Tagen noch einige kleinere Änderungen am Aussehen vornehmen, sodass es besser zum Stil der Spamihilator-Website passt.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michel-kraemer.de/phpbb-auf-dem-iphone-ipod-touch/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Neues Scala-Projekt mit OSGi</title>
		<link>http://www.michel-kraemer.de/neues-scala-projekt-mit-osgi</link>
		<comments>http://www.michel-kraemer.de/neues-scala-projekt-mit-osgi#comments</comments>
		<pubDate>Mon, 15 Feb 2010 18:44:48 +0000</pubDate>
		<dc:creator>michel</dc:creator>
				<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Lift]]></category>
		<category><![CDATA[OSGi]]></category>
		<category><![CDATA[Scala]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[Wicket]]></category>

		<guid isPermaLink="false">http://www.michel-kraemer.de/?p=263</guid>
		<description><![CDATA[Die Plugin-Download-Seite von Spamihilator bedarf einer umfassenden Überarbeitung. Ich möchte diese Gelegenheit nutzen, um mich ein wenig mehr mit Scala zu beschäftigen. Um die Praxistauglichkeit zu testen, möchte ich Scala auch in Verbindung mit Lift, Spring und Hibernate benutzen. Das ganze soll zudem als Applikation unter OSGi laufen. Als IDE kommt Eclipse mit dem Scala-Plugin [...]]]></description>
			<content:encoded><![CDATA[<p>Die <a href="http://www.spamihilator.com/plugins">Plugin-Download-Seite</a> von Spamihilator bedarf einer umfassenden Überarbeitung. Ich möchte diese Gelegenheit nutzen, um mich ein wenig mehr mit <a href="http://www.scala-lang.org">Scala</a> zu beschäftigen. Um die Praxistauglichkeit zu testen, möchte ich Scala auch in Verbindung mit <a href="http://www.liftweb.com">Lift</a>, <a href="http://www.springsource.org">Spring</a> und <a href="http://www.hibernate.org">Hibernate</a> benutzen. Das ganze soll zudem als Applikation unter <a href="http://www.osgi.org">OSGi</a> laufen. Als IDE kommt <a href="http://www.eclipse.org">Eclipse</a> mit dem <a href="http://www.scala-lang.org/node/94">Scala-Plugin</a> zum Einsatz. In den nächsten Wochen werde ich hier über meine Erfahrungen berichten.<span id="more-263"></span></p>
<p>Ich habe mich nach einiger Prüfung für den Einsatz der aktuellen Version <b>Scala 2.8.0 Beta 1</b> entschieden, da die neue Sprachdefinition einige Vorteile gegenüber 2.7 besitzt (wie zum Beispiel die überarbeitete Collection-API oder Default-Arguments, die ich aus C++ gewohnt bin).</p>
<h3>Erzeugen eines neuen OSGI-Bundles mit Scala-Nature</h3>
<p>Zunächst muss die <a href="http://www.scala-lang.org/node/94">Scala IDE für Eclipse</a> installiert werden. Danach kann man Scala-Programme mit Eclipse schreiben, ausführen und sogar debuggen. Das Plugin ist gut benutzbar, jedoch noch lange nicht so ausgereift wie die Java-Unterstützung von Eclipse. Hier und da stößt man noch auf kleinere Bugs. Zum Beispiel werden manchmal Fehlermeldungen im eigentlich korrekten Quellcode angezeigt, die sich nur dadurch entfernen lassen, dass man &#8220;Project/Clean&#8230;&#8221; benutzt und alles neu kompiliert. Dies passiert jedoch erfreulicherweise relativ selten.</p>
<p>Um ein OSGi-Bundle mit Scala-Nature zu erzeugen, muss man in Eclipse zunächst ein ganz normales Plugin-Projekt erzeugen. Danach muss man die Scala-Nature hinzufügen, damit der Scala-Quellcode kompiliert werden kann. Dazu klickt man mit der rechten Maustaste im Navigator oder Package Explorer auf das neue Projekt und wählt &#8220;Scala/Add Scala Nature&#8221;. Dadurch werden folgende Einträge in die Datei <code>.project</code> eingefügt:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;buildCommand<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>ch.epfl.lamp.sdt.core.scalabuilder<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arguments<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/arguments<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/buildCommand<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;nature<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>ch.epfl.lamp.sdt.core.scalanature<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/nature<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Damit die Scala Library genutzt werden kann, muss man in der <code>META-INF/MANIFEST.MF</code> das Bundle &#8220;scala.library&#8221; als &#8220;Required Bundle&#8221; angeben:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="properties" style="font-family:monospace;">Require-Bundle: scala.library;bundle-version<span style="color: #000000;">=</span><span style="color: #933;">&quot;2.8.0&quot;</span></pre></td></tr></table></div>

<p>In einigen Fällen muss man zusätzlich die Scala-Library zum Classpath hinzufügen. Dazu kann man die Datei <code>.classpath</code> manuell anpassen:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;classpathentry</span> <span style="color: #000066;">kind</span>=<span style="color: #ff0000;">&quot;con&quot;</span> <span style="color: #000066;">path</span>=<span style="color: #ff0000;">&quot;ch.epfl.lamp.sdt.launching.SCALA_CONTAINER&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></td></tr></table></div>

<p>Falls es danach immer noch nicht möglich ist, Scala-Klassen zu kompilieren, kann es daran liegen, dass sie nach wie vor als Java-Quellcode interpretiert werden. In diesem Fall muss man den Java-Builder in den Projekt-Eigenschaften deaktivieren. Dadurch kann man innerhalb eines Projekts natürlich keine Scala- und Java-Klassen mehr mischen. Zwischen unterschiedlichen OSGi-Bundles funktioniert es jedoch problemlos. Es ist anzunehmen, dass dies ein Fehler der aktuellen Beta-Version der Scala IDE ist, denn laut Dokumentation sollte dieses Feature eigentlich funktionieren.</p>
<h3>Bewertung</h3>
<p>Der Scala-Compiler erstellt normalen Java-Bytecode sodass eine vollständige Integration mit Java und OSGi sichergestellt ist. Etwas störend ist die unvollständige Unterstützung von OSGi-Package-Imports der Scala IDE. Wenn man einmal ein Package aus einem Bundle per <code>Import-Package</code> importiert hat, kann man danach auch Klassen aus allen anderen Packages dieses Bundles im Scala-Quellcode importieren. Die IDE zeigt dabei keine Fehler an. Zur Laufzeit kommt es jedoch korrekterweise zu <code>ClassNotFoundExceptions</code>. Man hat somit zwei Möglichkeiten:</p>
<ul>
<li>Auf <code>Require-Bundle</code> statt <code>Import-Package</code> umsteigen, was jedoch <a href="http://www.vogella.de/blog/2009/03/27/required-bundle-import-package/">nicht empfohlen ist.</a>
<li>Nach dem Auftreten der Laufzeitfehler die Packages manuell importieren (erfahrende OSGi-Entwickler kennen diese Vorgehensweise sowieso) und auf eine neue Version der Scala IDE warten.
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.michel-kraemer.de/neues-scala-projekt-mit-osgi/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Vista auf eine andere Partition verschieben</title>
		<link>http://www.michel-kraemer.de/vista-auf-andere-partition-verschieben</link>
		<comments>http://www.michel-kraemer.de/vista-auf-andere-partition-verschieben#comments</comments>
		<pubDate>Wed, 06 May 2009 18:48:07 +0000</pubDate>
		<dc:creator>michel</dc:creator>
				<category><![CDATA[Betriebssysteme]]></category>

		<guid isPermaLink="false">http://www.michel-kraemer.de/?p=228</guid>
		<description><![CDATA[Der Kauf einer größeren Festplatte muss nicht unbedingt bedeuten, dass man das komplette Betriebssystem neu installieren muss. Dieser Artikel fasst die Schritte zusammen, die beim Verschieben einer Vista-Installation auf eine andere Partition nötig sind. Die Punkte lassen sich auch anwenden, wenn man eine Dual-Boot-Konfiguration auflösen und das Betriebssystem auf der Startpartition gegen das auf einer [...]]]></description>
			<content:encoded><![CDATA[<p>Der Kauf einer größeren Festplatte muss nicht unbedingt bedeuten, dass man das komplette Betriebssystem neu installieren muss. Dieser Artikel fasst die Schritte zusammen, die beim Verschieben einer Vista-Installation auf eine andere Partition nötig sind. Die Punkte lassen sich auch anwenden, wenn man eine Dual-Boot-Konfiguration auflösen und das Betriebssystem auf der Startpartition gegen das auf einer anderen ersetzen möchte.<span id="more-228"></span></p>
<p>Der Artikel <a href="http://geekswithblogs.net/lorint/archive/2006/12/07/100596.aspx">Howto: Duplicate any Windows installation to a new hard disk &#8230;</a> von Lorin Thwaits ist ein guter Ausgangspunkt. Die dort beschriebenen Schritte seien hier kurz zusammengefasst:</p>
<ol>
<li>Vorbereiten der Zielpartition (z.B. durch Formatierung oder Partitionierung)</li>
<li>Einlegen der Windows Vista-Installations-DVD</li>
<li>Rechner neu starten und von der Installations-DVD booten</li>
<li>Installation starten, bis man zur Eingabe der Seriennummer gelangt</li>
<li>Durch Drücken von Umschalt+F10 ein Eingabefenster öffnen</li>
<li>Mit folgendem Kommando alle Dateien von der alten Partition (z.B. X:) auf die neue (z.B. C:) kopieren:<br />
<code>ROBOCOPY X:\ C:\ /e /XJ /efsraw /copyall /dcopy:t /r:0</code></li>
<li>Abwarten, bis alle Dateien kopiert wurden (dies kann je nach Größe der Partition mehrere Stunden dauern)</li>
<li>Installation abbrechen und neu starten</li>
</ol>
<p>Weitere Informationen findet man in oben genanntem Artikel. Allerdings bezieht dieser sich auf das Kopieren einer Windows XP-Installation. Erst in den Kommentaren liest man, dass der Schalter <code>/XJ</code> für das Kopieren einer Vista-Installation unbedingt nötig ist! Dadurch wird nämlich verhindert, dass so genannte &#8220;Abzweigunspunkte&#8221; (engl. Junction Points) verfolgt werden. Ein solcher Punkt ist in der Deutschen Vista-Version z.B. das virtuelle Verzeichnis &#8220;C:\Benutzer&#8221;, das in Wirklichkeit auf &#8220;C:\Users&#8221; verweist. Lässt man den Schalter weg, kopiert ROBOCOPY beide Verzeichnisse, wodurch doppelter Speicherplatz belegt wird.</p>
<h3>Probleme beim Booten</h3>
<p>Nach dem Kopieren kann es passieren, dass Vista nicht mehr korrekt startet. Die folgenden Hinweise sollen bei der Problemlösung helfen:</p>
<h4>Beim Start erscheint: NTLDR fehlt</h4>
<p>Dieses Problem lässt sich einfach beheben, indem man von der Windows Vista-DVD bootet und die Reparaturoption auswählt. Die Installationsroutine sollte einen Fehler finden und beheben. Gegebenenfalls ist die Prozedur ein weiteres Mal zu wiederholen. Danach sollte Windows wieder starten.</p>
<h4>Nach dem Starten von Windows, kann man sich anmelden, aber dann bleibt der Bildschirm leer</h4>
<p>Dieser Fall tritt auf, wenn der Windows Explorer nicht gefunden werden kann. Vista speichert in der Registry zu jedem Laufwerksbuchstaben den physischen Identifzierer der jeweiligen Festplatte bzw. Partition. Da sich Vista nun auf einer anderen Partition befindet, entspricht der Laufwerksbuchstabe C: nicht mehr dem gleichen Identifizierer wie vorher. Dieses Problem kann man wie folgt lösen:</p>
<ol>
<li>Windows neu starten</li>
<li>Bevor der Startbildschirm erscheint F8 drücken, um das Boot-Menü zu öffnen</li>
<li>&#8220;Abgesicherter Modus&#8221; auswählen.</li>
<li>Nach dem Start von Windows mit einem Benutzer anmelden, der Administratorrechte hat. Wurde das Administratorkonto nicht aktiviert, hat der Hauptbenutzer im abgesicherten Modus automatisch alle Rechte.</li>
<li>Sollte der Explorer immer noch nicht starten, durch Drücken von Strg+Alt+Entf den Task-Manager öffnen</li>
<li>Den Menüpunkt &#8220;Datei/Neuer Task (Ausführen&#8230;)&#8221; wählen.</li>
<li><code>regedit</code> eingeben und mit OK bestätigen.</li>
<li>Der Registrierungs-Editor erscheint. Dort folgenden Pfad öffnen:<br />
<code>HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices</code></li>
<li>Auf der rechten Seite alle Einträge (außer &#8220;Standard&#8221;) löschen</li>
<li>Rechner neu starten</li>
</ol>
<p>Nach diesen Schritten sollte das System wieder wie gewohnt laufen.</p>
<h4>Ruhezustand funktioniert nicht mehr (das System fährt nicht mehr korrekt hoch)</h4>
<p>Dies kann zwei Ursachen haben. Entweder ist die Datei für den Ruhezustand (C:\hiberfil.sys) defekt oder ein Eintrag in der Startkonfiguration stimmt nicht.</p>
<p>Im ersten Fall genügt es, folgende Schritte durchzuführen:</p>
<ol>
<li>Im Startmenü den Eintrag &#8220;Zubehör/Eingabeaufforderung&#8221; mit der rechten Maustaste anklicken und &#8220;Als Administrator ausführen&#8221; wählen.</li>
<li>Folgende Kommandos ausführen:<br />
<code>powercfg -h off<br />
powercfg -h on</code></li>
</ol>
<p>Der Ruhezustand wird hiermit deaktiviert und danach wieder aktiviert, wodurch die hiberfil.sys neu erstellt wird.</p>
<p>Funktioniert der Ruhezustand danach immer noch nicht, ist die Startkonfiguration beschädigt. Dies kann man wie folgt beheben:</p>
<ol>
<li>Die Eingabeaufforderung wie oben als Administrator starten</li>
<li>Überprüfen der Startkonfiguration durch folgendes Kommando:<br />
<code>bcdedit -enum all</code></li>
<li>Der Abschnitt &#8220;Resume from Hibernate&#8221; oder &#8220;Wiederaufnahme aus dem Ruhezustand&#8221; sollte vorhanden sein. (Falls nicht, bitte die oben beschriebenen Schritte ausführen). Allerdings enthält dieser folgenden fehlerhaften Eintrag:<br />
<code>inherit {resumeloadersettings}</code></li>
<li>Kopieren des Identifizierers des entsprechenden Abschnitts. Zum Beispiel:<br />
<code>Bezeichner <em>{xxxx-xxxx-xxxx-xxxx}</em></code></li>
<li>Den fehlerhaften Eintrag durch folgendes Kommando löschen (wobei der Bezeichner durch den soeben kopierten ersetzt werden muss:<br />
<code>bcdedit -deletevalue <em>{xxxx-xxxx-xxxx-xxxx}</em> inherit</code></li>
</ol>
<p>Danach sollte der Ruhezustand wie gewohnt funktionieren. Falls der Startbildschirm nun in englischer Sprache erscheint, kann man ihn mit folgendem Kommando auf Deutsch umschalten:</p>
<p><code>bcdedit -set <em>{xxxx-xxxx-xxxx-xxxx}</em> locale de-DE</code></p>
<p>Der Identifizierer ist wieder durch den oben gefundenen zu ersetzen.</p>
<p>Weitere Informationen zur Startkonfiguration findet man in Martin Richters Artikel <a href="http://blog.m-ri.de/index.php/2008/05/18/vista-sp1-und-so-manche-ruhezustandhibernate-probleme/">Vista SP1 und so manche Ruhezustand/Hibernate Probleme</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michel-kraemer.de/vista-auf-andere-partition-verschieben/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>5 Anti-Spam-Maßnahmen für phpBB 3.0</title>
		<link>http://www.michel-kraemer.de/anti-spam-phpbb3</link>
		<comments>http://www.michel-kraemer.de/anti-spam-phpbb3#comments</comments>
		<pubDate>Wed, 08 Apr 2009 15:29:38 +0000</pubDate>
		<dc:creator>michel</dc:creator>
				<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[Akismet]]></category>
		<category><![CDATA[phpBB]]></category>
		<category><![CDATA[Project Honey Pot]]></category>
		<category><![CDATA[Spam]]></category>

		<guid isPermaLink="false">http://www.michel-kraemer.de/?p=165</guid>
		<description><![CDATA[phpBB ist als Foren-Software mit offenem Quellcode sehr beliebt und weit verbreitet. Aus diesem Grund ist es aber auch häufig das Ziel von Spammern. In der Version 3.0 wurde deshalb unter anderem ein besseres Captcha eingeführt. Leider haben sich die Spammer inzwischen auf die neue Version eingestellt und Bots geschrieben, die das Captcha automatisch überwinden [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.phpbb.com">phpBB</a> ist als Foren-Software mit offenem Quellcode sehr beliebt und weit verbreitet. Aus diesem Grund ist es aber auch häufig das Ziel von Spammern. In der Version 3.0 wurde deshalb unter anderem ein besseres Captcha eingeführt. Leider haben sich die Spammer inzwischen auf die neue Version eingestellt und Bots geschrieben, die das Captcha automatisch überwinden und Beiträge absetzen können. Im Folgenden werden deshalb fünf Anti-Spam-Maßnahmen beschrieben, die sich in jeder phpBB-3.0-Installation einsetzen lassen und sehr effektiv sind. Ziel ist es dabei, möglichst viele Spam-Beiträge zu blockieren ohne den normalen Betrieb des Forums zu beeinträchtigen.<span id="more-165"></span></p>
<h3>Maßnahme 1: Links</h3>
<p>Spammer versuchen meist bestimmte Websites zu bewerben. Deshalb enthalten etwa 95% aller Spam-Beiträge Links bzw. URLs. Die effektivste Methode solche Beiträge zu verhindern, ist Links komplett zu sperren. Da die hier vorgestellten Maßnahmen normale Benutzer aber möglichst wenig beeinträchtigen sollen, kann ein kleiner Trick verwendet werden: Es wird davon ausgegangen, dass ein Spammer sich in einem Forum neu anmeldet und direkt damit beginnt, Werbebotschaften zu schreiben. Das heißt, Gäste und Benutzer mit weniger als einer bestimmten Zahl von Beiträgen werden als potenzielle Spammer behandelt. Ihre Beiträge werden genauer untersucht. Alle anderen Benutzer bleiben von den Maßnahmen unbetroffen.</p>
<p>Um Beiträge mit Links zu blockieren, kann die Funktion <code>submit_post()</code> in der Datei <code>includes\functions_posting.php</code> um folgende Zeilen ergänzt werden:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//Define the minimum number of posts for &quot;good&quot; users</span>
<span style="color: #666666; font-style: italic;">//Users below this threshold are considered potential spammers</span>
<span style="color: #000088;">$user_posts_threshold</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//strip whitespace characters in the post body</span>
<span style="color: #000088;">$msgwows</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'message'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$msgwows</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$msgwows</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$msgwows</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$msgwows</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$msgwows</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$msgwows</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$msgwows</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$msgwows</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'is_registered'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">||</span>
    <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'user_posts'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$user_posts_threshold</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$msgwows</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'http://'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">FALSE</span> <span style="color: #339933;">||</span>
      <span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$msgwows</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'ftp://'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">FALSE</span> <span style="color: #339933;">||</span>
      <span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$msgwows</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'www.'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">FALSE</span> <span style="color: #339933;">||</span>
      <span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$msgwows</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'[url'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #990000;">trigger_error</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;You are not allowed to post URLs!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Dieser Code sollte selbstverständlich ganz am Anfang der Funktion stehen, damit die Beiträge vor dem Speichern gefiltert werden.</p>
<h3>Maßnahme 2: Bilder</h3>
<p>Spammer versuchen Filter oftmals durch den Einsatz von Bildern zu umgehen. Dazu schreiben sie ihre Werbebotschaften und Links in Bilddateien und hängen diese an Foren-Beiträge an. Mit dem gleicher Methode wie oben beschrieben, können in der Funktion <code>submit_post()</code> in der Datei <code>functions/functions_posting.php</code> Beiträge mit Bildern geblockt werden:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'is_registered'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">||</span>
    <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'user_posts'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$user_posts_threshold</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$msgwows</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'[img'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #990000;">trigger_error</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;You are not allowed to post images!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h3>Maßnahme 3: Russische und Chinesische Beiträge?</h3>
<p>Einige Spam-Beiträge sind auf Russisch oder Chinesisch oder enthalten einfach nur eine Menge unleserlicher Sonderzeichen. Man kann sich zunutze machen, dass in deutsch- und englischsprachigen Foren in der Regel nur Deutsche bzw. Englische Beiträge erwünscht sind. Beiträge mit sehr vielen Sonderzeichen bzw. Zeichen aus fremdsprachigen Alphabeten können problemlos als Spam betrachtet werden.</p>
<p><a href="http://www.mawhorter.net">Cory Mawhorter</a> hat eine kleine <a href="http://www.mawhorter.net/web-development/easily-detecting-if-a-block-of-text-is-written-in-english-non-unicode-languages">PHP-Funktion</a> veröffentlicht (<code>is_english()</code>), die auf einfache Weise Sonderzeichen erkennt. Diese kann verwendet werden, um Deutsche bzw. Englische Texte von fremdsprachigen zu unterscheiden:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'is_registered'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">||</span>
    <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'user_posts'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$user_posts_threshold</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>is_english<span style="color: #009900;">&#40;</span><span style="color: #000088;">$msgwows</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.75</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #990000;">trigger_error</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Only German or English posts are allowed here!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h3>Maßnahme 4: http:BL</h3>
<p>Das <a href="http://www.projecthoneypot.org/">Project Honey Pot</a> bietet ein effektives System an, um Spammer und Adresssammler von Webseiten fern zu halten. <a href="http://www.projecthoneypot.org/httpbl.php">http:BL</a> gleicht die IP-Adresse eines Besuchers mit einer Datenbank ab. Ist die IP-Adresse bekannt und verbirgt sich dahinter ein Spammer, dann kann der Besucher schon gesperrt werden bevor er die Webseite sieht. Das System verwendet DNS, wodurch die Abfragen relativ schnell sind.</p>
<p>Um http:BL zu verwenden, muss man sich bei Project Honey Pot registrieren. Dadurch erhält man einen Schlüssel, der dem eigenen Benutzernamen eindeutig zugeordnet ist. Project Honey Pot will dadurch Missbrauch des Systems verhindern. Ein <a href="http://www.projecthoneypot.org/httpbl_implementations.php">MOD für phpBB</a> wird angeboten, allerdings nur für Version 2.0. Diesen kann man unter Umständen an phpBB 3.0 anpassen. Alternativ kann man folgenden Code an das Ende der Datei <code>common.php</code> kopieren:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//configure your http:BL Access Key here</span>
<span style="color: #000088;">$httpblkey</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;xxxxxxxxxxx&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$httpblmaxdays</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">21</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$httpblmaxthreat</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">25</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//if you already configured a honey pot on your website use this line:</span>
<span style="color: #666666; font-style: italic;">//$httpblhoneypot = &quot;http://xxxxxxxxxxx&quot;;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> httpbl_check<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$httpblkey</span><span style="color: #339933;">,</span> <span style="color: #000088;">$httpblmaxdays</span><span style="color: #339933;">,</span> <span style="color: #000088;">$httpblmaxthreat</span><span style="color: #339933;">,</span> <span style="color: #000088;">$httpblhoneypot</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000088;">$ip</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;REMOTE_ADDR&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;.&quot;</span><span style="color: #339933;">,</span> <span style="color: #990000;">gethostbyname</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$httpblkey</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.&quot;</span>
    <span style="color: #339933;">.</span><span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;.&quot;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array_reverse</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;.&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ip</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.dnsbl.httpbl.org&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">127</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">//something went wrong or the IP is not in the database.</span>
    <span style="color: #666666; font-style: italic;">//ignore this one.</span>
    <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000088;">$days</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$result</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$threat</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$result</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$days</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$httpblmaxdays</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$threat</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$httpblmaxthreat</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$httpblhoneypot</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;HTTP/1.1 301 Moved Permanently&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$httpblhoneypot</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
httpbl_check<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>In der Variablen <code>$httpblkey</code> muss der http:BL Access Key angegeben werden.</p>
<h3>Maßnahme 5: Akismet</h3>
<p>Eine weitere Methode Spam zu blockieren, ist <a href="http://akismet.com/">Akismet</a>. Dieses System wird auch gerne in WordPress-Blogs eingesetzt. Wie für Project Honey Pot, benötigt man hierfür einen API-Key, den man durch eine <a href="http://akismet.com/personal/">Registrierung</a> erhält.</p>
<p>In Foren kann Akismet zum Beispiel beim Absenden von Beiträgen verwendet werden. Das System kann zu Falschmeldungen führen, weshalb die Filterung auch hier wieder nur auf die ersten Beiträge eines Benutzers beschränkt wird. Der folgende Code verwendet die Datei <code>Akismet.class.php</code>, die man <a href="http://www.achingbrain.net/stuff/php/akismet">von Alex Potsides&#8217; Blog herunterladen</a> kann. Der Code kann in die Funktion <code>submit_post()</code> in der Datei <code>includes/functions_posting.php</code> eingefügt werden:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//configure your Akismet API key here</span>
<span style="color: #000088;">$akismet_key</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'xxxxxxxxxxx'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//the URL you entered when you registered for a Wordpress account</span>
<span style="color: #000088;">$akismet_url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'xxxxxxxxxxx'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Akismet.class.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$akismet</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Akismet<span style="color: #009900;">&#40;</span><span style="color: #000088;">$akismet_url</span><span style="color: #339933;">,</span> <span style="color: #000088;">$akismet_key</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'is_registered'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #000088;">$akismet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCommentAuthor</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$username</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">else</span>
  <span style="color: #000088;">$akismet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCommentAuthor</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'username'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$akismet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCommentContent</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'message'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$akismet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setUserIP</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ip</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'is_registered'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$akismet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCommentAuthorEmail</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'user_email'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$akismet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCommentAuthorURL</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'user_website'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'is_registered'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">||</span>
    <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'user_posts'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$user_posts_threshold</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span>
    <span style="color: #000088;">$akismet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isCommentSpam</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #990000;">trigger_error</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Akismet says your post is spam&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Die Variable <code>$akismet_key</code> muss den Akismet API Key enthalten. Die URL, die man bei der Registrierung für einen WordPress-Account angegeben hat, muss in der Variablen <code>$akismet_url</code> stehen.</p>
<p>Akismet kann desweiteren sinnvoll bei der Registrierung von neuen Benutzern eingesetzt werden. Dazu ist folgender Code in die Funktion <code>user_add()</code> in der Datei <code>includes/functions_user.php</code> einzufügen:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//configure your Akismet API key here</span>
<span style="color: #000088;">$akismet_key</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'xxxxxxxxxxx'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//the URL you entered when you registered for a Wordpress account</span>
<span style="color: #000088;">$akismet_url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'xxxxxxxxxxx'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Akismet.class.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$akismet</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Akismet<span style="color: #009900;">&#40;</span><span style="color: #000088;">$akismet_url</span><span style="color: #339933;">,</span> <span style="color: #000088;">$akismet_key</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$akismet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCommentAuthor</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$username_clean</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$akismet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setUserIP</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ip</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$akismet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SetCommentAuthorEmail</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$user_row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'user_email'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$akismet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isCommentSpam</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #990000;">trigger_error</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Akismet says you are a spammer&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h3>Fazit</h3>
<p>Die hier vorgestellten Maßnahmen helfen, das Spam-Aufkommen in phpBB-3.0-Foren drastisch zu reduzieren. Seit dem Aktivieren der verschiedenen Filter im <a href="http://www.spamihilator.com/forum">Spamihilator-Forum</a> konnte kein einziger Spammer einen Beitrag absetzen. Das Blockieren von Links und Bildern ist dabei die effektivste Methode. Durch das Filtern von Sonderzeichen werden alle anderen Spam-Beiträge verhindert. Der normale Betrieb wird kaum gestört, da die Maßnahmen nur neue Benutzer betreffen. Sobald ein Benutzer eine bestimmte Anzahl von &#8220;guten&#8221; Beiträgen geschrieben hat, werden die Filter deaktiviert. Bisher hat dies noch kein Spammer ausgenutzt. Falls dies jemals der Fall sein sollte, kann die Schwelle sehr leicht erhöht werden.</p>
<p>Trotz aller Filtermaßnahmen beim Schreiben von Beträgen, bleibt immer noch das Problem, dass Spammer sich nach wie vor registrieren und in ihrer Signatur auf eine Webseite verlinken können. Maßnahmen für dieses Problem sind noch zu entwickeln.</p>
<p>In vielen von Spam geplagten Foren sind Gäste nicht zugelassen. Man muss sich registrieren, um Beiträge schreiben zu können. Dies kann für einfache Support-Foren zu umständlich sein. Die Benutzer möchten gerne Beiträge schreiben können ohne lange und komplizierte Registrierungsverfahren zu durchlaufen. Mit den in diesem Artikel vorgestellten Maßnahmen können Gäste grundsätzlich wieder zugelassen werden, denn die Filterung ist für solche immer aktiv.</p>
<p>Abschließend bleibt zu erwähnen, dass der Einsatz von Akismet auf deutschen Webseiten zur Zeit noch umstritten ist. Weiteres darüber findet man unter anderem in folgendem Artikel: <a href="http://www.drweb.de/magazin/akismet-und-der-datenschutz/">http://www.drweb.de/magazin/akismet-und-der-datenschutz/</a>. Maßnahme 5 kann bei Bedarf ausgelassen werden.</p>
<h3>Lizenz</h3>
<p>Die hier vorgestellten Code-Schnipsel von <a xmlns:cc="http://creativecommons.org/ns#" href="http://www.michel-kraemer.de" rel="cc:attributionURL">Michel Kr&#228;mer</a> sind unter der Lizenz <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0</a> veröffentlicht.</p>
<p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.michel-kraemer.de/anti-spam-phpbb3/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Schallabsorbierer DR002</title>
		<link>http://www.michel-kraemer.de/schallabsorbierer-dr002</link>
		<comments>http://www.michel-kraemer.de/schallabsorbierer-dr002#comments</comments>
		<pubDate>Tue, 27 Jan 2009 20:25:35 +0000</pubDate>
		<dc:creator>michel</dc:creator>
				<category><![CDATA[Musik]]></category>

		<guid isPermaLink="false">http://michel-kraemer.spamihilator.com/?p=23</guid>
		<description><![CDATA[Damit man später im Mix alle Möglichkeiten hat, Gesang gut zu integrieren, wird dieser in der Regel trocken aufgenommen. Dazu verwendet man oft Kabinen, die durch spezielle akustische Maßnahmen möglichst &#8220;tot&#8221; klingen, also keinen Nachhall erzeugen. Bei Bedarf kann man diesen später mit einem guten Hallalgorithmus dosiert hinzufügen. Dieser Artikel beschreibt den Aufbau eines Schallabsorbierers, [...]]]></description>
			<content:encoded><![CDATA[<p>Damit man später im Mix alle Möglichkeiten hat, Gesang gut zu integrieren, wird dieser in der Regel trocken aufgenommen. Dazu verwendet man oft Kabinen, die durch spezielle akustische Maßnahmen möglichst &#8220;tot&#8221; klingen, also keinen Nachhall erzeugen. Bei Bedarf kann man diesen später mit einem guten Hallalgorithmus dosiert hinzufügen.</p>
<p>Dieser Artikel beschreibt den Aufbau eines Schallabsorbierers, der das Mikrofon vor Reflexionen abschirmt, sodass möglichst nur das Direktsignal aufgenommen wird. <span id="more-23"></span> Als Bauelemente kommen ausgewählte Materialien aus dem Baumarkt zum Einsatz:</p>
<ul>
<li>Filz (ca. 80x40cm)</li>
<li>Dämmschaum (nicht drückend)</li>
<li>Streckmetall (100x30cm)</li>
<li>Dämmwolle (70x30cm)</li>
<li>Holzleiste (ca. 1,5&#215;1×200cm)</li>
<li>Kunststoffleiste (ca. 1,5&#215;1,5x240cm)</li>
<li>Aluminiumfolie (140x30cm)</li>
<li>diverse Schrauben</li>
<li>diverse Eisenteile</li>
</ul>

<a href="http://www.michel-kraemer.de/wp-content/uploads/2009/01/dr002_01.jpg" title="DR002 von vorne"><img width="150" height="150" src="http://www.michel-kraemer.de/wp-content/uploads/photojar/cache/dr002_01-150x150-1-img29.jpg" class="attachment-thumbnail" alt="DR002 von vorne" title="DR002 von vorne" /></a>\n<a href="http://www.michel-kraemer.de/wp-content/uploads/2009/01/dr002_02.jpg" title="DR002 von oben"><img width="150" height="150" src="http://www.michel-kraemer.de/wp-content/uploads/photojar/cache/dr002_02-150x150-1-img34.jpg" class="attachment-thumbnail" alt="DR002 von oben" title="DR002 von oben" /></a>\n<a href="http://www.michel-kraemer.de/wp-content/uploads/2009/01/dr002_03.jpg" title="DR002 unten"><img width="150" height="150" src="http://www.michel-kraemer.de/wp-content/uploads/photojar/cache/dr002_03-150x150-1-img35.jpg" class="attachment-thumbnail" alt="DR002 unten" title="DR002 unten" /></a>\n<a href="http://www.michel-kraemer.de/wp-content/uploads/2009/01/dr002_04.jpg" title="DR002 unten"><img width="150" height="150" src="http://www.michel-kraemer.de/wp-content/uploads/photojar/cache/dr002_04-150x150-1-img36.jpg" class="attachment-thumbnail" alt="DR002 unten" title="DR002 unten" /></a>\n
<h3>Der Rahmen</h3>
<p>Zunächst wird die Holzleiste in acht 30cm lange Stücke zerschnitten. Zwei davon dienen später als äußere Randstücke und müssen im Moment nicht weiter bearbeitet werden. Die anderen erhalten auf der langen Seite einen Winkel von 22,5°, sodass man je zwei mit Holzleim zusammenkleben kann und dadurch drei Leisten mit einem 45°-Winkel erhält (siehe Abbildung).</p>
<p>Aus der Kunststoffleiste wird nun ein Rahmen erstellt. Dazu werden zuerst zwei 30cm lange Stücke abgeschnitten, die später die äußeren, senkrechten Teile bilden. Sie werden an den beiden Enden um je 45° abgeschrägt, damit sie später mit den anderen Teilen einen rechten Winkel bilden können.</p>
<p>Die oberen und unteren Teile (insgesamt 8 Stück) haben je eine Länge von ca. 17cm. Die genaue Länge ist vom Streckmetall abhängig, das später an die Rückseite des Geräts angebracht wird. Vier dieser Teile erhalten beidseitig einen Winkel von 22,5°, damit man sie &#8211; ähnlich wie die Holzleisten &#8211; zu einem 45°-Winkel zusammenfügen kann. Die äußeren Teile erhalten nur auf einer Seite einen 22,5°-Winkel und auf der anderen einen 45°-Winkel nach unten, damit sie auf die oben angesprochenen senkrechten Teile passen.<br />

<a href="http://www.michel-kraemer.de/wp-content/uploads/2009/01/teile.jpg" title="teile"><img width="150" height="150" src="http://www.michel-kraemer.de/wp-content/uploads/photojar/cache/teile-150x150-1-img42.jpg" class="attachment-thumbnail" alt="teile" title="teile" /></a>\n<a href="http://www.michel-kraemer.de/wp-content/uploads/2009/01/leisten_02.jpg" title="leisten_02"><img width="150" height="150" src="http://www.michel-kraemer.de/wp-content/uploads/photojar/cache/leisten_02-150x150-1-img41.jpg" class="attachment-thumbnail" alt="leisten_02" title="leisten_02" /></a>\n<a href="http://www.michel-kraemer.de/wp-content/uploads/2009/01/leisten_01.jpg" title="leisten_01"><img width="150" height="150" src="http://www.michel-kraemer.de/wp-content/uploads/photojar/cache/leisten_01-150x150-1-img40.jpg" class="attachment-thumbnail" alt="leisten_01" title="leisten_01" /></a>\n</p>
<h3>Die Rückseite</h3>
<p>Nachdem der Rahmen vorbereitet wurde, muss zunächst das Streckmetall gebogen werden. Dazu wird es in zwei Hälften geteilt, von denen eine ca. 70cm lang sein sollte (je nach Länge der oberen und unteren Kunststoffleisten multipliziert mit 4). Dieses Teil erhält in Abständen von 17cm (siehe oben) einen Knick von 45°. Es ergibt sich ein U-förmiges Gebilde mit einer Gesamtbiegung von 135°.</p>
<p>Das restliche Metall sollte in vier gleichgroße Teile geschnitten werden, wobei das vierte noch einmal halbiert werden muss. Drei dieser Teile werden in der Mitte um 45° geknickt. Sie kommen später (zusammen mit den geklebten Holzleisten) in die Ecken des Rahmens. Die halbierten Teile kommen an den linken und rechten Rand (siehe Abbildung).</p>
<p>Verwendet man ein Eisengitter, ist es ratsam die Teile an dieser Stelle noch zu lackieren, da sie sonst schnell rosten. Bei einem Aluminiumgitter ist dies nicht notwendig. Außerdem ist dieses auch leichter als ein Eisengitter &#8211; allerdings auch teurer.</p>
<a href="http://www.michel-kraemer.de/wp-content/uploads/2009/01/rueckseite_02.jpg"  rel="prettyPhoto[23]" ><img src="http://www.michel-kraemer.de/wp-content/uploads/photojar/cache/rueckseite_02-200x150-0-img51.jpg" alt="" title="" width="200" height="150" class="aligncenter size-200x150 wp-image-51" /></a>
<h3>Die Dämmwolle</h3>
<p>Setzt man die zusammengeklebten Holzleisten in die Ecken der Kunststoffteile ein und fügt die anderen am Rand hinzu, ergeben sich dazwischen Freiräume. Diese müssen mit der Dämmwolle gefüllt werden. Am einfachsten ist es, wenn man den vorbereiteten Rahmen an dieser Stelle zusammenlegt (ohne ihn zu verschrauben) und die Freiräume mit einem Zentimetermaß ausmisst. So kann man vier Platten aus dem Dämmmaterial herausschneiden, die dort genau hereinpassen.</p>
<p>Diese Platten müssen außerdem halbiert werden, sodass sich aus je einer Platte zwei gleichgroße, halb so dünne Platten ergeben. Dazwischen wird eine Schicht Aluminiumfolie gelegt.</p>

<a href="http://www.michel-kraemer.de/wp-content/uploads/2009/01/daemmwolle_01.jpg" title="daemmwolle_01"><img width="150" height="150" src="http://www.michel-kraemer.de/wp-content/uploads/photojar/cache/daemmwolle_01-150x150-1-img77.jpg" class="attachment-thumbnail" alt="daemmwolle_01" title="daemmwolle_01" /></a>\n<a href="http://www.michel-kraemer.de/wp-content/uploads/2009/01/daemmwolle_02.jpg" title="daemmwolle_02"><img width="150" height="150" src="http://www.michel-kraemer.de/wp-content/uploads/photojar/cache/daemmwolle_02-150x150-1-img78.jpg" class="attachment-thumbnail" alt="daemmwolle_02" title="daemmwolle_02" /></a>\n
<h3>Zusammenfügen der Teile</h3>
<p>Nun kann alles zusammengefügt werden. Zusammen mit den Holzleisten passt das Streckmetall genau in die Kunststoffleisten hinein. Auf der Rückseite &#8211; zwischen Holzleisten und Metall &#8211; ist noch eine Schicht Aluminiumfolie hinzuzufügen. Diese dient nicht nur einem akustischen, sondern auch einem optischen Zweck. Außerdem können somit später keine &#8220;Krümel&#8221; von der Dämmwolle abfallen.</p>
<p>Man sollte mit den unteren Leisten beginnen, die Holzteile, die Aluminiumfolie und das Metall hinzufügen und alles verschrauben. Sodann können die Platten aus dem Dämmmaterial mit der Aluminiumfolie in die Freiräume gesteckt werden.</p>
<p>Als nächstes werden die Kunststoffleisten an der Seite und oben ebenfalls mit dem Holz verschraubt. Man sollte möglichst kleine Schrauben verwenden, damit das Holz nicht bricht.</p>

<a href="http://www.michel-kraemer.de/wp-content/uploads/2009/01/zusammen_01.jpg" title="zusammen_01"><img width="150" height="150" src="http://www.michel-kraemer.de/wp-content/uploads/photojar/cache/zusammen_01-150x150-1-img79.jpg" class="attachment-thumbnail" alt="zusammen_01" title="zusammen_01" /></a>\n<a href="http://www.michel-kraemer.de/wp-content/uploads/2009/01/zusammen_02.jpg" title="zusammen_02"><img width="150" height="150" src="http://www.michel-kraemer.de/wp-content/uploads/photojar/cache/zusammen_02-150x150-1-img80.jpg" class="attachment-thumbnail" alt="zusammen_02" title="zusammen_02" /></a>\n
<h3>Die Innenseite</h3>
<p>Der Hauptteil des Schirms ist nun fertig. Er kann jedoch noch verbessert werden, indem man auf der Innenseite eine Schicht Dämmschaum und Filz anbringt. Dazu wird aus einer Lage Filz eine Form in der Größe 70x30x1cm erstellt. Am besten spannt man um diese noch einen Holzrahmen (falls man noch altes Holz zur Verfügung hat), damit sich die Form beim nächsten Schritt möglichst wenig verbiegt.</p>
<p>Der Dämmschaum kann nun in die Form hineingefüllt werden. Es ist zu beachten, dass dieses Material an Volumen sehr stark zunimmt. Eine dünne Schicht sollte reichen. Wer jedoch sicher gehen will und die Dose Dämmschaum sowieso nicht mehr benötigt, kann auch ein bisschen mehr in die Form füllen.</p>
<p>Nachdem der Schaum trocken ist, was durchaus einen Tag dauern kann, wird alles Überflüssige mit einem möglichst langen Messer abgeschnitten, sodass eine 1cm dicke Platte aus Schaum mit aufgeklebten Filz übrig bleibt.</p>
<p>Diese wird dann in den Abständen der Schirmecken mit einem Messer vorsichtig eingeschnitten und dort geknickt. Die Platte kann dann an der Innenseite des Schirms angebracht werden, indem man sie mit den Holzleisten verschraubt.</p>

<a href="http://www.michel-kraemer.de/wp-content/uploads/2009/01/schaum_01.jpg" title="schaum_01"><img width="150" height="150" src="http://www.michel-kraemer.de/wp-content/uploads/photojar/cache/schaum_01-150x150-1-img81.jpg" class="attachment-thumbnail" alt="schaum_01" title="schaum_01" /></a>\n<a href="http://www.michel-kraemer.de/wp-content/uploads/2009/01/schaum_02.jpg" title="schaum_02"><img width="150" height="150" src="http://www.michel-kraemer.de/wp-content/uploads/photojar/cache/schaum_02-150x150-1-img82.jpg" class="attachment-thumbnail" alt="schaum_02" title="schaum_02" /></a>\n<a href="http://www.michel-kraemer.de/wp-content/uploads/2009/01/schaum_03.jpg" title="schaum_03"><img width="150" height="150" src="http://www.michel-kraemer.de/wp-content/uploads/photojar/cache/schaum_03-150x150-1-img83.jpg" class="attachment-thumbnail" alt="schaum_03" title="schaum_03" /></a>\n<a href="http://www.michel-kraemer.de/wp-content/uploads/2009/01/schaum_04.jpg" title="schaum_04"><img width="150" height="150" src="http://www.michel-kraemer.de/wp-content/uploads/photojar/cache/schaum_04-150x150-1-img84.jpg" class="attachment-thumbnail" alt="schaum_04" title="schaum_04" /></a>\n
<h3>Die Halterung</h3>
<p>Hat man dies erledigt, ist der Schirm schon einsatzbereit. Will man noch eine Halterung anbringen (wie auf der Abbildung zu sehen), sollte man dies vor der Verschraubung der Schaumplatte mit dem Rahmen tun.</p>
<p>Die Halterung des DR002 besteht aus ein paar geschweißten Blechen, die am Rahmen befestigt sind. Diese wurden auf eine Schraube gedreht, damit man später auch die Höhe des Schirms gegenüber dem Mikrofon verändern kann. Die Schraube wurde außerdem auf ein Stück Eisen geschweißt, das in der Mitte eine Aussparung hat. Diese ist so groß, dass man das Stück Eisen mittels einer Flügelmutter auf einen Mikrofonständer schrauben kann. Das Mikrofon wird befestigt, indem man eine Gewindestange (bzw. zwei aneinandergeschweißte Schrauben) von unten in das Eisenstück steckt und mit einer Flügelmutter festzieht.</p>

<a href="http://www.michel-kraemer.de/wp-content/uploads/2009/01/halterung_01.jpg" title="halterung_01"><img width="150" height="150" src="http://www.michel-kraemer.de/wp-content/uploads/photojar/cache/halterung_01-150x150-1-img86.jpg" class="attachment-thumbnail" alt="halterung_01" title="halterung_01" /></a>\n<a href="http://www.michel-kraemer.de/wp-content/uploads/2009/01/dr002_041.jpg" title="dr002_041"><img width="150" height="150" src="http://www.michel-kraemer.de/wp-content/uploads/photojar/cache/dr002_041-150x150-1-img85.jpg" class="attachment-thumbnail" alt="dr002_041" title="dr002_041" /></a>\n
]]></content:encoded>
			<wfw:commentRss>http://www.michel-kraemer.de/schallabsorbierer-dr002/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
