<?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>lemmingzshadow.net</title>
	<atom:link href="http://lemmingzshadow.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://lemmingzshadow.net</link>
	<description>a webdevel&#039;s weblog</description>
	<lastBuildDate>Fri, 13 Aug 2010 09:10:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>SFTP Upload mit PHP</title>
		<link>http://lemmingzshadow.net/301/sftp-upload-mit-php/</link>
		<comments>http://lemmingzshadow.net/301/sftp-upload-mit-php/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 19:49:27 +0000</pubDate>
		<dc:creator>Lemmingz Shadow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SFTP]]></category>
		<category><![CDATA[Webtechnik]]></category>

		<guid isPermaLink="false">http://lemmingzshadow.net/?p=301</guid>
		<description><![CDATA[Seit einiger Zeit bietet PHP mit der SSH2-Library einige Methoden um das SFTP-Subsystem von SSH zu nutzen. Leider fehlt eine Methode um Dateien per SFTP hochzuladen. Zwar existiert mit der Methode ssh2_scp_send eine Möglichkeit Dateien über einer SSH-Verbindung hochzuladen, allerdings wird hier das SCP-Protokoll benutzt. Sollte der verwendete Account serverseitig jedoch auf SFTP beschränkt sein [...]]]></description>
			<content:encoded><![CDATA[<p>Seit einiger Zeit bietet PHP mit der <a href="http://de.php.net/manual/en/book.ssh2.php">SSH2-Library</a> einige Methoden um das SFTP-Subsystem von SSH zu nutzen. Leider fehlt eine Methode um Dateien per SFTP hochzuladen. Zwar existiert mit der Methode <em>ssh2_scp_send</em> eine Möglichkeit Dateien über einer SSH-Verbindung hochzuladen, allerdings wird hier das SCP-Protokoll benutzt. Sollte der verwendete Account serverseitig jedoch auf SFTP beschränkt sein funktioniert diese Methode nicht.<br />
Um dennoch Dateien per SFTP hochladen zu können kann man sich mit der Methode <em>fopen</em> und dem <a href="http://de.php.net/manual/en/wrappers.ssh2.php">ssh2-sftp Wrapper</a> eine funktionierende Lösung basteln. <span id="more-301"></span></p>
<p>Eine sftp-upload Funktion könnte beispielsweise so aussehen:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> sftp_putfile<span style="color: #009900;">&#40;</span><span style="color: #000088;">$local_file</span><span style="color: #339933;">,</span> <span style="color: #000088;">$remote_file</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mode</span> <span style="color: #339933;">=</span> <span style="color: #208080;">0664</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$remote_file</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$remote_file</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'/'</span><span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">'/'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$remote_file</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$remote_file</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$sftp_stream</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ssh2.sftp://'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sftp_connection</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$remote_file</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'w'</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;">$sftp_stream</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_sftp_error</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">7</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000088;">$data_to_send</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$local_file</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;">$data_to_send</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: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_sftp_error</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">7</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</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: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sftp_stream</span><span style="color: #339933;">,</span> <span style="color: #000088;">$data_to_send</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: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_sftp_error</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">7</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sftp_stream</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Diese beispielhafte Methode stammt aus einer SFTP Klasse die ich vor kurzem für eine Projekt geschrieben habe. Die komplette Klasse habe ich <a href="http://lemmingzshadow.net/wp-content/uploads/2010/08/class.sftp.php.txt">hier zum download</a> hinterlegt.</p>
]]></content:encoded>
			<wfw:commentRss>http://lemmingzshadow.net/301/sftp-upload-mit-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter API mit oAuth nutzen</title>
		<link>http://lemmingzshadow.net/295/twitter-api-mit-oauth-nutzen/</link>
		<comments>http://lemmingzshadow.net/295/twitter-api-mit-oauth-nutzen/#comments</comments>
		<pubDate>Sun, 06 Jun 2010 11:58:48 +0000</pubDate>
		<dc:creator>Lemmingz Shadow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[oAuth]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[Webtechnik]]></category>

		<guid isPermaLink="false">http://lemmingzshadow.net/?p=295</guid>
		<description><![CDATA[Am 30. Juni wird Twitter die Standard Authentifizierung der Twitter API abschalten. Bis dahin sollte man seine Scripte so umstellen, dass sie oAuth benutzen. Wie lange man dafür noch Zeit hat erfährt man übrigens hier: http://www.countdowntooauth.com/ Da es mittlerweile schon einige PHP Klassen gibt welche oAuth unterstützen ist die Umstellung relativ einfach zu bewerkstelligen. Hier [...]]]></description>
			<content:encoded><![CDATA[<p>Am 30. Juni wird Twitter die Standard Authentifizierung der Twitter API abschalten. Bis dahin sollte man seine Scripte so umstellen, dass sie oAuth benutzen. Wie lange man dafür noch Zeit hat erfährt man übrigens hier: <a href="http://www.countdowntooauth.com/">http://www.countdowntooauth.com/</a> <img src='http://lemmingzshadow.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Da es mittlerweile schon einige PHP Klassen gibt welche oAuth unterstützen ist die Umstellung relativ einfach zu bewerkstelligen. Hier ein kleines Tutorial:</p>
<p>Zunächst muss man auf <a href="http://dev.twitter.com/">http://dev.twitter.com/</a> eine neue &#8220;App&#8221; anlegen. (Vorher einloggen) Der Prozess ist selbsterklärend. Nachdem man die App angelegt hat erhält man einen &#8220;Consumer key&#8221; und ein &#8220;Consumer secret&#8221;. Diese beiden Strings benötigen wir später für die Authentifizierung. Weiterhin braucht man den &#8220;oAuth Token&#8221; und das &#8220;oAuth Token Secret&#8221;. Um diese zu bekommen oben auf <a href="http://dev.twitter.com/apps">Your apps</a> klicken. Dann auf &#8220;Edit Details&#8221; der entsprechen App. Nach zwei weiteren Klicks auf &#8220;Application detail&#8221; (rechts) und &#8220;My Access Token&#8221; (auch rechts) hat man alle benötigten Tokens und Passwörter zusammen die man in einem PHP-Script benötigt.<span id="more-295"></span></p>
<p>Nun kann man entweder selbst damit anfangen eine oAuth Authentifizierung zu coden oder man benutzt eine der fertigen Klassen. Ich habe für dieses Beispiel eine fertige <a href="http://github.com/abraham/twitteroauth">oAuth Klasse von Abraham Williams</a> benutzt.<br />
Hier ein kleines Codebeispiel für die Authentifizierung mit oAuth und dem anschließenden posten eines Tweets:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$consumer_key</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'insert_key'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$consumer_secret</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'insert_secret'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$access_key</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'insert_key'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$access_secret</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'insert_secret'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'twitteroauth/twitteroauth.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$twitter</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> TwitterOAuth <span style="color: #009900;">&#40;</span><span style="color: #000088;">$consumer_key</span><span style="color: #339933;">,</span> <span style="color: #000088;">$consumer_secret</span><span style="color: #339933;">,</span> <span style="color: #000088;">$access_key</span><span style="color: #339933;">,</span> <span style="color: #000088;">$access_secret</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$twitter</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'statuses/update'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'status'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Testing oAuth. Please ignore...'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://lemmingzshadow.net/295/twitter-api-mit-oauth-nutzen/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Lighttpd, mod_rewrite und die htaccess</title>
		<link>http://lemmingzshadow.net/283/lighttpd-mod_rewrite-und-die-htaccess/</link>
		<comments>http://lemmingzshadow.net/283/lighttpd-mod_rewrite-und-die-htaccess/#comments</comments>
		<pubDate>Sun, 30 May 2010 12:03:16 +0000</pubDate>
		<dc:creator>Lemmingz Shadow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Lighttpd]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mod_rewrite]]></category>

		<guid isPermaLink="false">http://lemmingzshadow.net/?p=283</guid>
		<description><![CDATA[Eins der wohl häufigsten Probleme bei der Umstellung von Lighttpd auf Apache ist sicherlich die Migration der htaccess Dateien. Grund dafür ist, dass (zumindest bis vor kurzem) das mod_rewrite Modul des Lighttpd nicht prüfen konnte ob eine Datei existiert und die Rewrite-Regeln somit immer angewendet wurden. Dieses Problem konnte man durch die Verwendung von mod_magnet [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://lemmingzshadow.net/wp-content/uploads/2010/05/200px-Lighttpd_Logo.png" alt="Lighttpd Logo" title="Lighttpd Logo" width="120" height="98" class="alignleft size-full wp-image-286" style="padding: 5px;" />Eins der wohl häufigsten Probleme bei der Umstellung von <a href="http://www.lighttpd.net/">Lighttpd</a> auf <a href="http://www.apache.org/">Apache</a> ist sicherlich die Migration der htaccess Dateien. Grund dafür ist, dass (zumindest bis vor kurzem) das mod_rewrite Modul des Lighttpd nicht prüfen konnte ob eine Datei existiert und die Rewrite-Regeln somit immer angewendet wurden. Dieses Problem konnte man durch die Verwendung von mod_magnet und LUA zwar umgehen allerdings müssen dann alle rewrite-Regeln in LUA neu geschrieben werden, was nicht immer ganz trivial ist.<span id="more-283"></span></p>
<p>Auch ich stand vor diesem Problem bis ich in der <a href="http://redmine.lighttpd.net/wiki/1/Docs:ModRewrite">mod_rewrite Doku</a> des Lighttpd folgedes entdeckte:</p>
<blockquote><p>New: For the 1.4.x branch as of 1.4.24 or r2647 from svn:<br />
Rewrites a set of URLs internally in the webserver BEFORE they are handled and checks that files do not exist.</p></blockquote>
<p>Gute Nachrichten: Ab Version 1.4.24 des Lighty bietet das mod_rewrite Modul die Möglichkeit eine Rewrite-Regel erst anzuwenden <strong>nachdem</strong> geprüft wurde ob eine Datei existiert. Also genau das Feature was bisher fehlte.<br />
Schlechte Nachricht: Die Lighty Version im stable Repository von Debian ist noch nicht aktuell genug.</p>
<p>Es ist gibt jedoch eine sehr elegante Möglichkeit unter Debian einzelne Pakte aus dem testing Repository zu installieren. Diese ist hier sehr schön beschrieben: <a href="http://proteino.de/blog/index.php/2010/04/02/debian-mit-aktuelleren-paketen-stable-und-testing/">Debian mit aktuelleren Paketen &#8211; stable und testing</a></p>
<p>Nachdem man so den Lighty auf eine aktuelle Version gebracht hat ist es relativ einfach htaccess Dateien des Apache zur Verwendung mit Lighttpd zu ändern.</p>
<p>Hier eine kurze Anleitung am Beispiel von WordPress und einem SEO-phpBB:</p>
<p>Zunächst das mod_rewrite Modul in der lighttpd.conf aktivieren:</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="text" style="font-family:monospace;">server.modules              = (
            &quot;mod_expire&quot;,
            &quot;mod_access&quot;,
            &quot;mod_alias&quot;,
            &quot;mod_accesslog&quot;,
            &quot;mod_compress&quot;,
            &quot;mod_fastcgi&quot;,
            &quot;mod_auth&quot;,
            &quot;mod_rewrite&quot;,
)</pre></td></tr></table></div>

<p>Dann im entsprechenden Vhost eine Datei mit den Rewrite-Regeln einbinden:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="text" style="font-family:monospace;">$HTTP[&quot;host&quot;] =~ &quot;^(lemmingzshadow\.net|www\.lemmingzshadow\.net)$&quot; {
    server.document-root = &quot;/var/www/lemmingzshadow.net/&quot;
    include &quot;/var/www/lemmingzshadow.net/rewrite.conf&quot;
}</pre></td></tr></table></div>

<p>Und so sehen Beispielsweise meine Rewrite-Regeln für dieses Blog aus:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="text" style="font-family:monospace;">url.rewrite-if-not-file = (	
	&quot;(wp-.+).*/?&quot; =&gt; &quot;$0&quot;,	
	&quot;^/(.+)/?$&quot; =&gt; &quot;/index.php/$1&quot;
)</pre></td></tr></table></div>

<p>Man sieht direkt, dass die Syntax der einer htaccess Datei sehr ähnlich ist und man seine regulären Ausdrücke nahezu eins zu eins übernehmen kann. Wichtig ist das <em>url.rewrite-if-not-file</em> um wirklich nur dann die Url umzuschreiben wenn die aufgerufene Datei nicht existiert. Die erste Regel dient dazu alle wp-* Verzeichnisse nicht umzuschreiben. Die zweite leitet alle restlichen Anfragen auf die index.php um.</p>
<p>Am Beispiel eines phpBB mit SEO-Urls sieht das ganze z.B. so aus:</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="text" style="font-family:monospace;">url.rewrite-if-not-file = ( 
  &quot;/(.*)-f([0-9]*)/(.*)-t([0-9]*)-s([0-9]*).html&quot;   =&gt; &quot;/viewtopic.php?f=$2&amp;t=$4&amp;start=$5&quot;,
  &quot;/(.*)-f([0-9]*)/(.*)-t([0-9]*).html&quot;         =&gt; &quot;/viewtopic.php?f=$2&amp;t=$4&quot;,
  &quot;/(.*)-f([0-9]*)/index-s([0-9]*).html&quot;         =&gt; &quot;/viewforum.php?f=$2&amp;start=$3&quot;,
  &quot;/(.*)-f([0-9]*)&quot;                        =&gt; &quot;/viewforum.php?f=$2&quot;,
  &quot;/global/(.*)-t([0-9]*).html&quot;           =&gt; &quot;/viewtopic.php?f=1&amp;t=$2&quot;
)</pre></td></tr></table></div>

<p>Eine entsprechende htaccess Datei hätte so ausgesehen:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="text" style="font-family:monospace;">RewriteEngine on
RewriteBase /
&nbsp;
RewriteRule ^(.*)-f([0-9]*)/(.*)-t([0-9]*)-s([0-9]*).html viewtopic.php?f=$2&amp;t=$4&amp;start=$5&amp;%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*)/(.*)-t([0-9]*).html viewtopic.php?f=$2&amp;t=$4&amp;%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*)/index-s([0-9]*).html viewforum.php?f=$2&amp;start=$3&amp;%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*)/ viewforum.php?f=$2&amp;%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*) viewforum.php?f=$2&amp;%{QUERY_STRING} [L]</pre></td></tr></table></div>

<p>Auch hier können die regeln fast eins zu eins übernommen werden.<br />
Noch ein wichtiger Hinweis zum Schluss: Um Änderungen an den Rewrite-Regeln zu übernehmen muss der Lighttpd neu gestartet werden!</p>
<p>Hoffentlich konnte ich mit diesem kurzem Beitrag dem ein oder anderen die Umstellung von Apache auf Lighttpd erleichtern.</p>
<p><strong>Nachtrag vom 01.06.2010:</strong><br />
<a href="http://lifeofguenter.de/">lifeofguenter</a> stellte fest, dass das mod_rewrite Modul aktuell wohl nur im 1.4er Trunk entsprechend angepasst ist. Für die 1.5er Versionen des Lighttpd ist die Möglichkeit <em>url.rewrite-if-not-file</em> zu nutzen aktuell wohl noch nicht implementiert.</p>
]]></content:encoded>
			<wfw:commentRss>http://lemmingzshadow.net/283/lighttpd-mod_rewrite-und-die-htaccess/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ajax Push Engine APE reanimiert JiTT</title>
		<link>http://lemmingzshadow.net/279/ajax-push-engine-ape-reanimiert-jitt/</link>
		<comments>http://lemmingzshadow.net/279/ajax-push-engine-ape-reanimiert-jitt/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 18:06:16 +0000</pubDate>
		<dc:creator>Lemmingz Shadow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[APE]]></category>
		<category><![CDATA[Websockets]]></category>
		<category><![CDATA[Webtechnik]]></category>

		<guid isPermaLink="false">http://lemmingzshadow.net/?p=279</guid>
		<description><![CDATA[Vor einiger Zeit habe ich ein kleines Bastelprojekt mit den Namen JiTT ins Leben gerufen um das Kaazing Gateway zu testen. Leider gibt es am Kaazing Gateway schon seit einiger Zeit keine Aktualisierungen mehr und mich habe mich nach Alternativen umgeschaut. Gefunden habe ich die Ajax Push Engine kurz APE. Genau wie das Kaazing Gateway [...]]]></description>
			<content:encoded><![CDATA[<p>Vor einiger Zeit habe ich ein kleines <a href="http://lemmingzshadow.net/163/jittcc-erste-gehversuche-mit-websockets/">Bastelprojekt</a> mit den Namen <a href="http://jitt.geekservice.de">JiTT</a> ins Leben gerufen um das <a href="http://www.kaazing.org/confluence/display/KAAZING/Home">Kaazing Gateway</a> zu testen. Leider gibt es am Kaazing Gateway schon seit einiger Zeit keine Aktualisierungen mehr und mich habe mich nach Alternativen umgeschaut. Gefunden habe ich die <a href="http://www.ape-project.org/">Ajax Push Engine</a> kurz APE.<br />
Genau wie das Kaazing Gateway bietet APE die Möglichkeit persistente Verbindungen zwischen Client (Browser) und Server aufzubauen. Dabei wird ein Coment-Server und ein kleines Javascript Framework benutzt.<br />
Die Installation ist Dank eines deb-Paketes sehr einfach und gut dokumentiert. Weiterhin gibt es einige Demo-Anwendungen so dass man schnell anfangen kann zu basteln.<br />
Ein Vorteil gegenüber dem Kaazing-Gateway: APE benötigt keine Java-Laufzeitumgebung und kommt somit mit wesentlich weniger Arbeitsspeicher aus. Insgesamt wirkt der Comet-Server um einiges schlaker und performanter. Lasttests konnte ich bisher noch nicht machen, ich werde mich aber bemühen dies nachzuholen.</p>
<p>Abschließend noch der Hinweis, dass das Projekt JiTT ab sofort und folgender URL zu finden ist: <a href="http://jitt.geekservice.de"><strong>http://jitt.geekservice.de</strong></a></p>
]]></content:encoded>
			<wfw:commentRss>http://lemmingzshadow.net/279/ajax-push-engine-ape-reanimiert-jitt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Konstanten für Datumsformate in PHP</title>
		<link>http://lemmingzshadow.net/245/konstanten-fuer-datumsformate-in-php/</link>
		<comments>http://lemmingzshadow.net/245/konstanten-fuer-datumsformate-in-php/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 17:06:06 +0000</pubDate>
		<dc:creator>Lemmingz Shadow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://lemmingzshadow.net/?p=245</guid>
		<description><![CDATA[Andauernd vergesse ich dass es Sie gibt: Konstanten für verschiedene Datumsformate. Ausserdem sind Sie (wie ich finde) bei php.net nur schlecht dokumentiert. Darum hier nun für alle ein Codebeispiel und der Link zu den restlichen Konstanten. Folgender Code würde z.B. soetwas ausgeben: Wednesday, 10-Feb-10 18:02:49 CET 1 echo date&#40;DATE_COOKIE, time&#40;&#41;&#41;; Alle dieser nützlichen Konstanten sind [...]]]></description>
			<content:encoded><![CDATA[<p>Andauernd vergesse ich dass es Sie gibt: Konstanten für verschiedene Datumsformate. Ausserdem sind Sie (wie ich finde) bei php.net nur schlecht dokumentiert. Darum hier nun für alle ein Codebeispiel und der Link zu den restlichen Konstanten.<br />
Folgender Code würde z.B. soetwas ausgeben:<br />
<em>Wednesday, 10-Feb-10 18:02:49 CET</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">echo</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span>DATE_COOKIE<span style="color: #339933;">,</span> <span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Alle dieser nützlichen Konstanten sind hier dokumentiert: <a href="http://php.net/manual/en/class.datetime.php"><strong>Datumskonstanten bei php.net</strong></a></p>
]]></content:encoded>
			<wfw:commentRss>http://lemmingzshadow.net/245/konstanten-fuer-datumsformate-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP: isset vs. array_key_exists</title>
		<link>http://lemmingzshadow.net/232/php-isset-vs-array_key_exists/</link>
		<comments>http://lemmingzshadow.net/232/php-isset-vs-array_key_exists/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 16:32:29 +0000</pubDate>
		<dc:creator>Lemmingz Shadow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Webtechnik]]></category>

		<guid isPermaLink="false">http://lemmingzshadow.net/?p=232</guid>
		<description><![CDATA[Heute möchte ich mal ein paar Worte zu den Funktionen isset und array_key_exists loswerden. Genauer angeschaut habe ich mir das Verhalten der beiden Funktionen beim Prüfen ob ein Feld in einem Array existiert. Bevor ich zur Performance komme möchte ich jedoch noch auf ein paar Besonderheiten der Funktionen eingehen: Um zu prüfen ob ein Feld [...]]]></description>
			<content:encoded><![CDATA[<p>Heute möchte ich mal ein paar Worte zu den Funktionen <em>isset</em> und <em>array_key_exists</em> loswerden. Genauer angeschaut habe ich mir das Verhalten der beiden Funktionen beim Prüfen ob ein Feld in einem Array existiert. Bevor ich zur Performance komme möchte ich jedoch noch auf ein paar Besonderheiten der Funktionen eingehen:</p>
<p>Um zu prüfen ob ein Feld in einem Array existiert ohne dabei Fehlermeldungen zu erzeugen muss vor beiden Funktionen <em>isset</em> und <em>is_array</em> aufgerufen werden.</p>
<p><strong>Beispiel:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</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: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$foo</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$foo</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$foo</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'bar'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$check</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</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: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$foo</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$foo</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">array_key_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'bar'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$foo</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$check</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><span id="more-232"></span><br />
Der Grund hierfür ist nicht immer direkt ersichtlich, deswegen hier die Erklärung:<br />
<em>isset</em> erzeugt zwar keine Notices oder Warnings falls die Variable $foo nicht gesetzt ist, aber es gibt ein anderes Problem. Wenn die Variable $foo vom Typ String ist würde die Prüfung auf ein Array-Feld mit isset true liefern.</p>
<p><strong>Beispiel:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$foo</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'bar'</span><span style="color: #339933;">;</span>
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$foo</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'bar'</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: #666666; font-style: italic;">// true</span></pre></td></tr></table></div>

<p>Dieses Verhalten erklärt die Notwendigkeit von <em>is_array</em> vor dem Prüfen mit isset. Das <em>isset</em> vor dem <em>is_array</em> ist schließlich notwendig weil <em>is_array</em> eine Notice erzeugt wenn die zu prüfende Variable nicht gesetzt ist.</p>
<p>Die Funktion<em> array_key_exists</em> erzeugt ein Warning falls das zu prüfende Array nicht existiert oder die übergebene Variable nicht vom Typ Array ist. Somit ist hier ebenfalls die Nutzung von <em>is_array</em> in Kombination mit <em>isset</em> zu empfehlen.</p>
<p>Mit obiger Syntax lässt sich nun eigentlich in beide Fällen prüfen ob ein Feld im einem Array existiert. Dabei ist jedoch eine Ausnahme zu beachten, und zwar der Wert null in einem Array.</p>
<p><strong>Beispiel:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$foo</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'bar'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span>
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$foo</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'bar'</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: #666666; font-style: italic;">// false</span>
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array_key_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'bar'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$foo</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// true</span></pre></td></tr></table></div>

<p>Damit sollte die Verwendung der beiden Funktionen geklärt sein (falls nicht bitte ich um einen kurzen Kommentar), aber es bleibt die Frage: Welche der beiden Varianten ist schneller, <em>isset</em> oder <em>array_key_exists</em>?<br />
Hier das Ergebnis:<br />
<a href="http://lemmingzshadow.net/wp-content/uploads/2009/10/performance_array_key_exists.jpg"><img src="http://lemmingzshadow.net/wp-content/uploads/2009/10/performance_array_key_exists-150x150.jpg" alt="performance_array_key_exists" title="performance_array_key_exists" width="150" height="150" class="alignnone size-thumbnail wp-image-240" style="float: left; margin: 5px;" /></a> <a href="http://lemmingzshadow.net/wp-content/uploads/2009/10/performance_isset.jpg"><img src="http://lemmingzshadow.net/wp-content/uploads/2009/10/performance_isset-150x150.jpg" alt="performance_isset" title="performance_isset" width="150" height="150" class="alignnone size-thumbnail wp-image-241" style="float: left; margin: 5px;" /></a></p>
<div style="clear: both;"></div>
<p>Klare Sache: <em>isset</em> ist wesentlich schneller als <em>array_key_exists</em>, 10000 Prüfungen dauert nur etwa halb so lange.<br />
Zudem fallen zwei weitere Dinge auf: <em>isset</em> taucht nicht in den Xdebug Ergebnissen auf. Die Begründung ist relativ simpel. Da <em>isset</em> keine Funktion ist sondern lediglich ein Sprachkonstrukt, taucht dieses nicht in den Xdebug-Listings auf. Weiterhin fällt auf, dass is_array fast genauso viel Zeit in Anspruch nimmt wie <em>array_key_exists</em>. Hierfür habe ich leider keine Erklärung, denn ich hätte erwarten dass <em>array_key_exists</em> im Gegensatz zu <em>is_array</em> eine Array-Funktion und damit wesentlich langsamer ist. Falls jemand eine Erklärung hat: Immer her damit!</p>
]]></content:encoded>
			<wfw:commentRss>http://lemmingzshadow.net/232/php-isset-vs-array_key_exists/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP-Performance: preg_match vs. strpos</title>
		<link>http://lemmingzshadow.net/214/php-performance-preg_match-vs-strpos/</link>
		<comments>http://lemmingzshadow.net/214/php-performance-preg_match-vs-strpos/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 17:40:42 +0000</pubDate>
		<dc:creator>Lemmingz Shadow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Webtechnik]]></category>

		<guid isPermaLink="false">http://lemmingzshadow.net/?p=214</guid>
		<description><![CDATA[Folgendes Problem hat man als Coder sicherlich öfters zu lösen: Man möchte wissen ob String A, String B oder String C (u.s.w) in einem Text vorkommen. Beispielsweise holt man eine Liste mit Keywords aus einer Datenbank und möchte wissen ob eins dieser Keywords in einem Text vorkommt. Um das Problem zu lösen gibt es sicherlich [...]]]></description>
			<content:encoded><![CDATA[<p>Folgendes Problem hat man als Coder sicherlich öfters zu lösen: Man möchte wissen ob String A,  String B oder String C (u.s.w) in einem Text vorkommen. Beispielsweise holt man eine Liste mit Keywords aus einer Datenbank und möchte wissen ob eins dieser Keywords in einem Text vorkommt.<br />
Um das Problem zu lösen gibt es sicherlich zig verschiedene Möglichkeiten. Die gängigsten sehen wahrscheinlich in etwas so aus:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</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: #990000;">stripos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$haystack</span><span style="color: #339933;">,</span> <span style="color: #000088;">$needle</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: #000088;">$found</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</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: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">.</span><span style="color: #000088;">$needle</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/is'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$haystack</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$found</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>		
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><span id="more-214"></span><br />
Hierbei wird eine Sache schnell klar: Bei mehr als einem Suchsting wird das ganze etwas komplizierter. Man muss die strpos Variante für jeden Suchstring einmal laufen lassen, bzw. in der zweiten Variante die Suchstrings mit einem oder verknüpfen.<br />
Die Frage ist nun: Welche der beiden Varianten ist schneller?</p>
<p>Ich habe ein kurzes Testscript gebastelt, und hier ist das Ergebnis:<br />
<a href="http://lemmingzshadow.net/wp-content/uploads/2009/10/performance_preg_match.jpg"><img src="http://lemmingzshadow.net/wp-content/uploads/2009/10/performance_preg_match-150x150.jpg" alt="performance_preg_match" title="performance_preg_match" width="150" height="150" class="alignnone size-thumbnail wp-image-217" style="margin: 5px; float: left;" /></a> <a href="http://lemmingzshadow.net/wp-content/uploads/2009/10/performance_strpos.jpg"><img src="http://lemmingzshadow.net/wp-content/uploads/2009/10/performance_strpos-150x150.jpg" alt="performance_strpos" title="performance_strpos" width="150" height="150" class="alignnone size-thumbnail wp-image-228" style="margin: 5px; float: left;" /></a>
<div style="clear: both;"></div>
<p>Die preg_match Varinate ist um einiges schneller. Ausserdem fällt auf das bei 10000 Durchläufen des Testscript die Funktion stripos öfter als 10000 mal ausgeführt wird. Die liegt daran, dass die Funktion so oft aufgerufen werden muss, bis der erste Suchstring gefunden wurde (oder eben keiner der gesuchten Strings im Text vorkommt). Durch die oder-Verknüpfung der einzelnen Strings muss preg_match bei jedem Durchlauf nur einmal ausgeführt werden.<br />
Klar wird also: Je mehr Suchstrings in einem Text gesucht werden sollen, desto langsamer wird die strpos Variante im Vergleich zu preg_match, obwohl natürlich auch der reguläre Ausdruck bei einem längeren Suchstring etwas langsamer wird.</p>
<p>Zum Schluss noch das Script mit dem ich dieses Verhalten getestet habe:<br />
<a href='http://lemmingzshadow.net/wp-content/uploads/2009/10/performance_preg_vs_strpos_php.txt'>performance_preg_vs_strpos.php</a></p>
]]></content:encoded>
			<wfw:commentRss>http://lemmingzshadow.net/214/php-performance-preg_match-vs-strpos/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>TNC 95 / TNC2400 &#8211; Geekstuff aus CB-Funk Zeiten</title>
		<link>http://lemmingzshadow.net/206/tnc-95-tnc2400-geekstuff-aus-cb-funk-zeiten/</link>
		<comments>http://lemmingzshadow.net/206/tnc-95-tnc2400-geekstuff-aus-cb-funk-zeiten/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 15:00:55 +0000</pubDate>
		<dc:creator>Lemmingz Shadow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Geek]]></category>
		<category><![CDATA[Packet-Radio]]></category>

		<guid isPermaLink="false">http://lemmingzshadow.net/?p=206</guid>
		<description><![CDATA[Eigentlich habe ich ein S-Video Kabel gesucht (und auch gefunden). Wesentlich interessanter war aber, dass ich mein altes TNC 95 im Keller entdeckt habe. Ein Paket-Radio-Modem aus CB-Funk Zeiten. Mit einem solchen TNC konnte man damals Daten per CB-Funkgerät übertragen. Die maximale Datenübertragungsrate lag bei 2400 Boud, üblich waren aber eher 1200. Das besondere an [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://lemmingzshadow.net/wp-content/uploads/2009/08/tnc95_01.jpg"><img src="http://lemmingzshadow.net/wp-content/uploads/2009/08/tnc95_01-150x150.jpg" alt="TNC 95" title="TNC 95" width="150" height="150" class="alignnone size-thumbnail wp-image-207" style="margin: 5px; float: left;" /></a> <a href="http://lemmingzshadow.net/wp-content/uploads/2009/08/tnc95_02.jpg"><img src="http://lemmingzshadow.net/wp-content/uploads/2009/08/tnc95_02-150x150.jpg" alt="TNC 95 Angebot" title="TNC 95 Angebot" width="150" height="150" class="alignnone size-thumbnail wp-image-209" style="margin: 5px; float: left;" /></a>Eigentlich habe ich ein S-Video Kabel gesucht (und auch gefunden). Wesentlich interessanter war aber, dass ich mein altes TNC 95 im Keller entdeckt habe. Ein Paket-Radio-Modem aus CB-Funk Zeiten. Mit einem solchen <a href="http://de.wikipedia.org/wiki/Terminal_Node_Controller">TNC</a> konnte man damals Daten per CB-Funkgerät übertragen. Die maximale Datenübertragungsrate lag bei 2400 Boud, üblich waren aber eher 1200. Das besondere an diesem damals 250 DM teuren Gerät: Es konnte, ähnlich einem Bouncer, auch dann antworten wenn der angeschlossene PC aus war. Nur das TNC und ein Funkgerät wurden benötigt.</p>
<p>Beitreibt heutzutage eigentlich noch jemand ernsthaft Packt-Radio?</p>
]]></content:encoded>
			<wfw:commentRss>http://lemmingzshadow.net/206/tnc-95-tnc2400-geekstuff-aus-cb-funk-zeiten/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>About Seite und Soical Network Icons</title>
		<link>http://lemmingzshadow.net/203/about-seite-und-soical-network-icons/</link>
		<comments>http://lemmingzshadow.net/203/about-seite-und-soical-network-icons/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 17:22:51 +0000</pubDate>
		<dc:creator>Lemmingz Shadow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[lemmingzshadow]]></category>

		<guid isPermaLink="false">http://lemmingzshadow.net/?p=203</guid>
		<description><![CDATA[Gerade habe ich endlich mal die (schon vor langem angelegte) About-Seite mit ein wenig Inhalt gefüllt. In dem Zuge habe ich auch gleich mal Links zu den diversen Social-Networks hinzugefügt, bei denen ich angemeldet bin. Ein schönes einheitliches Iconset welches sich dafür prima verwenden lässt findet man hier: Free glossy Community Icons (Danke für&#8217;s kostenlose [...]]]></description>
			<content:encoded><![CDATA[<p>Gerade habe ich endlich mal die (schon vor langem angelegte) About-Seite mit ein wenig Inhalt gefüllt. In dem Zuge habe ich auch gleich mal Links zu den diversen Social-Networks hinzugefügt, bei denen ich angemeldet bin. Ein schönes einheitliches Iconset welches sich dafür prima verwenden lässt findet man hier: <a href="http://www.tilo-hensel.de/free-glossy-community-icons/2009/04/23/">Free glossy Community Icons</a> (Danke für&#8217;s kostenlose bereitstellen)</p>
]]></content:encoded>
			<wfw:commentRss>http://lemmingzshadow.net/203/about-seite-und-soical-network-icons/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MySQLi und UTF-8</title>
		<link>http://lemmingzshadow.net/182/mysqli-und-utf-8/</link>
		<comments>http://lemmingzshadow.net/182/mysqli-und-utf-8/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 10:12:35 +0000</pubDate>
		<dc:creator>Lemmingz Shadow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[MySQLi]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://lemmingzshadow.net/?p=182</guid>
		<description><![CDATA[Um auf MySQL Datenbanken zuzugreifen verwende ich gerne die MySQLi-Erweiterung von PHP. Vor ein paar Tagen musste ich dabei feststellen, dass es einen fiesen Fehler in der Methode &#8220;set_charset&#8221; gibt der zur Folge hat, dass die UTF-8 Unterstützung teilweise nicht funktioniert. Wenn man eine Verbindung zur Datenbank herstellt und dabei den Konstruktor der MySQLi-Klasse verwendet [...]]]></description>
			<content:encoded><![CDATA[<p>Um auf MySQL Datenbanken zuzugreifen verwende ich gerne die MySQLi-Erweiterung von PHP. Vor ein paar Tagen musste ich dabei feststellen, dass es einen fiesen Fehler in der Methode <em>&#8220;set_charset&#8221;</em> gibt der zur Folge hat, dass die UTF-8 Unterstützung teilweise nicht funktioniert. Wenn man eine Verbindung zur Datenbank herstellt und dabei den Konstruktor der MySQLi-Klasse verwendet funktioniert das anschließende setzten des UTF-8 Zeichensatzes nicht. Wenn man die Verbindung allerdings mit der Methode <em>&#8220;real_connect&#8221;</em> öffnet funktioniert es wunderbar.<br />
<span id="more-182"></span><br />
Ein Codebeispiel:</p>
<p>Funktioniert <strong>nicht</strong>:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">mysqli</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> mysqli<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;host&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;user&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;pass&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;db&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">mysqli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_charset</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'uft8'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">mysqli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">character_set_name</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Ausgabe: latin1</span></pre></td></tr></table></div>

<p>Funktioniert:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">mysqli</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysqli_init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">mysqli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">real_connect</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;host&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;user&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;pass&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;db&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">mysqli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_charset</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;utf8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">mysqli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">character_set_name</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Ausgabe: utf8</span></pre></td></tr></table></div>

<p>Der Fehler ist <a href="http://bugs.php.net/bug.php?id=42902">hier</a> zwar gemeldet und als closed markiert, tritt bei mir jedoch immer noch auf. </p>
]]></content:encoded>
			<wfw:commentRss>http://lemmingzshadow.net/182/mysqli-und-utf-8/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
