<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Web Technolgie Blog</title>
	
	<link>http://technologie4web.de</link>
	<description>Blog rund um CSS, PHP, SQL, JS, ...</description>
	<lastBuildDate>Mon, 20 Feb 2012 14:00:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/WebTechnolgieBlog" /><feedburner:info uri="webtechnolgieblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.0/</creativeCommons:license><image><link>http://creativecommons.org/licenses/by-nc-sa/2.0/</link><url>http://creativecommons.org/images/public/somerights20.gif</url><title>Some Rights Reserved</title></image><item>
		<title>Google und die automatsiche Silbentrennung</title>
		<link>http://feedproxy.google.com/~r/WebTechnolgieBlog/~3/EjJkXE_oYJo/</link>
		<comments>http://technologie4web.de/google-und-die-automatsiche-silbentrennung/#comments</comments>
		<pubDate>Fri, 11 Feb 2011 09:16:41 +0000</pubDate>
		<dc:creator>Martin Kiesewetter</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[SEO]]></category>

		<guid isPermaLink="false">http://technologie4web.de/?p=571</guid>
		<description><![CDATA[Goo- gle Lange Wörter machen auf Webseiten häufig Probleme, weil die Silben standardmäßig nicht vom Browser getrennt werden. Dadurch entstehen entweder Zeilenumbrüche mit sehr großen „Lücken“ oder das lange Wort wird einfach über die Container-Begrenzung hinaus geschrieben. Heute möchte ich euch einige einige Möglichkeiten aufzeigen, wie man trotzdem eine Silbentrennung realisieren kann. Via HTML Ich [...]]]></description>
			<content:encoded><![CDATA[<div style="border:1px solid;width:50px;padding:0;background:-moz-linear-gradient(-45deg,yellow 50%,red);float:left; margin:35px 8px 0 0;font-size:15px;padding-top:10px">
<span style="-webkit-transform: rotate(-45deg);-moz-transform: rotate(-45deg);">Goo-<br />
<span style="margin-left:20px">gle</span></span>
</div>
<p>Lange Wörter machen auf Webseiten häufig Probleme, weil die Silben standardmäßig nicht vom Browser getrennt werden. Dadurch entstehen entweder Zeilenumbrüche mit sehr großen „Lücken“ oder das lange Wort wird einfach über die Container-Begrenzung hinaus geschrieben. Heute möchte ich euch einige einige Möglichkeiten aufzeigen, wie man trotzdem eine Silbentrennung realisieren kann.<span id="more-571"></span></p>
<h2>Via HTML</h2>
<p>Ich muss gestehen, dass auch ich erst kürzlich über den bedingten Zeilenumbruch mittels <a href="http://de.selfhtml.org/html/text/anzeige/wbr.htm">HTML-Befehl &#8220;SHY&#8221;</a> gestoßen bin.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">Das ist ein SUPER&amp;shy;LANGESWORT</pre></div></div>

<p>Dieses besagt, dass der Browser die Möglichkeit hat, das Wort bei Bedarf an der mit shy markierten Stelle umzubrechen. Der Browser wird an der betreffenden Stelle den ganz normalen Trennstrich einfügen. Im Netz habe ich ein paar Experimente gefunden, die besagen, dass Google z.b.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">key&amp;shy;word</pre></div></div>

<p>als keyword erkennt, allerdings konnte ich keine konkrete Aussage von Google selbst finden. Bei den anderen großen Suchmaschinen ist es genauso. Einige kleine Suchmaschinen haben aber trotzdem möglicherweise Probleme mit diesem eher selten vorkommenden Befehl.</p>
<h3>Vorteile</h3>
<ul>
<li>kinderleichter Einbau an jeder beliebigen Stelle durch den Nutzer</li>
<li>keine Gefahr der automatisierten Falschtrennung</li>
</ul>
<h3>Nachteile</h3>
<ul>
<li>Jede mögliche Trennung muss manuell im Quelltext eingetragen werden => großer Arbeitsaufwand</li>
<li>nicht alle <a href="http://de.selfhtml.org/html/text/zeilenumbruch.htm#erlauben">Browser unterstützen shy</a></li>
</ul>
<h2>Via JavaScript</h2>
<p>Ich habe die <a href=“ http://code.google.com/p/hyphenator/downloads/detail?name=Hyphenator%203.2.0.zip“>hyphenator-JavaScript-Klasse</a> getestet und muss sagen, dass ich begeistert bin! Um die hyphenator-JavaScript-Klasse zu verwenden müssen die JS-Dateien hochgeladen werden und anschließend folgender Code im HEAD-Bereich eingefügt werden:</p>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">        &lt;script src=&quot;Hyphenator.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
        &lt;script type=&quot;text/javascript&quot;&gt;
        	Hyphenator.config({
        		displaytogglebox : true,
        		minwordlength : 4
        	});
        	Hyphenator.run();
        &lt;/script&gt;</pre></div></div>

<p>Danach kann man jeden beliebigen Text zur Silbentrennung aktivieren, indem man den Text in einen Container mit der Klasse &#8220;hyphenate&#8221;. Über den Parameter lang kann man die Sprache des Textes auswählen. Dadurch ist auch möglich Texte aus verschiedenen Sprachen auf einer Seite zu verwenden.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;p class=&quot;hyphenate&quot; lang=&quot;de&quot;&gt;SEHRLANGESWORTDASUNBEDINGTGETRENNTWERDENMUSS&lt;/p&gt;</pre></div></div>

<h3>Vorteile</h3>
<ul>
<li>automatische Worttrennung (es ist kein Eingriff im Text notwendig)</li>
<li>es werden <a href="http://code.google.com/p/hyphenator/wiki/en_AddNewLanguage">viele Sprachen</a> unterstützt (jede Sprache hat einen anderen Aufbau bei Worttrennungen)</li>
<li>der Text steht im normalen Klartext im HTML-Code, d.h. auf Google &#038; Co hat diese Variante keine Auswirkungen</li>
</ul>
<h3>Nachteil</h3>
<ul>
<li>aktives JavaScript ist für das Feature der Silbentrennung notwendig (falls JS deaktiviert ist, wird der Text normal dargestellt)</li>
<li>es sind zusätzliche JS-Dateien notwendig
<ul>
<li>1 Klassendatei (unkomprimiert: 65Kb)</li>
<li>1 Datei pro verwendeter Sprache (z.B. deutsch: rund 80Kb)</li>
</ul>
</li>
<li>Falls Fehler bei der Trennung auftreten (ich konnte keine Fehler finden), ist ein manueller Eingriff nur in Verbindung mit einem Eingriff in die umfangreiche JS-Klasse möglich</li>
</ul>
<img src="http://feeds.feedburner.com/~r/WebTechnolgieBlog/~4/EjJkXE_oYJo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://technologie4web.de/google-und-die-automatsiche-silbentrennung/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://technologie4web.de/google-und-die-automatsiche-silbentrennung/</feedburner:origLink></item>
		<item>
		<title>JavaScript / CSS Komprimieren und Cachen</title>
		<link>http://feedproxy.google.com/~r/WebTechnolgieBlog/~3/cr1YHY7Use8/</link>
		<comments>http://technologie4web.de/javascript-css-komprimieren-cachen/#comments</comments>
		<pubDate>Wed, 09 Feb 2011 11:34:11 +0000</pubDate>
		<dc:creator>Martin Kiesewetter</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://technologie4web.de/?p=515</guid>
		<description><![CDATA[Mithilfe von PHP kann man JavaScript- und CSS-Dateien sehr effizient Komprimieren und Cachen. Dadurch können diese wesentlich schneller übertragen werden und müssen zudem nicht bei jedem Seitenaufruf erneut runtergeladen werden. Ich werde diesen Beitrag so gliedern: JavaScript und CSS komprimnieren JavaScript und CSS cachen Zusätzliche Optimierung für JavaScript und CSS finden Sie in einem früheren [...]]]></description>
			<content:encoded><![CDATA[<p>Mithilfe von PHP kann man JavaScript- und CSS-Dateien sehr effizient Komprimieren und Cachen. Dadurch können diese wesentlich schneller übertragen werden und müssen zudem nicht bei jedem Seitenaufruf erneut runtergeladen werden.<span id="more-515"></span><br />
Ich werde diesen Beitrag so gliedern:</p>
<ol>
<li><a href="#javascript-css-komprimieren">JavaScript und CSS komprimnieren</a></li>
<li><a href="#javascript-css-cachen">JavaScript und CSS cachen</a></li>
</ol>
<p>Zusätzliche <a href="/performance-javascript-css-code-optimieren/">Optimierung für JavaScript und CSS</a> finden Sie in einem früheren Artikel.</p>
<h1 id="javascript-css-komprimieren">Javascript- und CSS-Dateien komprimieren</h1>
<p>Im Gegensatz zu Bildern sind CSS und JavaScript Texte, die mit sehr hoher Kompressionsrate (70% sind durchaus üblich) komprimiert werden können. Alle modernen Browser können komprimierte Webinhalte dekomprimieren und anzeigen. Weil unsere Webseite allerdings auch von alten Browsern angezeigt werden soll müssen wir für unser <a href="#javascript-css-cachen">Cache-System</a> 2 verschiedene Varianten vorsehen: eine komprimierte und eine unkomprimierte Variante. Die einfachste Art ein PHP(-CSS)-Script zu komprimieren ist den folgenden Code <b>vor</b> die erste Ausgabe des CSS-Scripts zu schreiben:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">ob_start</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ob_gzhandler'</span><span style="color: #339933;">,</span>xxx<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>das xxx kann eine Zahl zwischen 1 und 9 sein, die angibt wie stark komprimiert wird. Wird keine Zahl angegeben so wird 6 als Standard verwendet. Beachte: Die Serverbelastung steigt bei Zahlen größer 6 extrem an, weshalb man sich den Einsatz genau überlegen sollte. Wer ein Cache-System verwendet und die Komprimierung z.B. nur einmal am Tag durchführt kann bedenkenlos die maximale Kompressionsstufe 9 verwenden. Wem die Komprimierung mittels PHP zu aufwendig ist kann das ganze alternativ auch per .htaccess regeln (Im folgenden Beispiel werden alle Dateien, die die Endung .css haben komprimiert übertragen (soweit der Browser des Nutzers das unterstützt).</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;Files *.css&gt;
SetOutputFilter DEFLATE   
&lt;/Files&gt;</pre></div></div>

<p>Kleiner Nachteil: Weil hier wird kein Cache-System verwendet wird muss der Server die Komprimierung für jeden Besucher neu durchführen.</p>
<h1 id="javascript-css-cachen">JavaScript und CSS Cachen</h1>
<p>Beim Cachen wird dem Browser des Nutzers mitgeteilt, dass die gerade heruntergeladene Datei noch eine gewisse Zeit X aktuell bleibt. Wird die Datei innerhalb dieser Zeit erneut gebraucht, so wird sie nicht aus dem Internet heruntergeladen, sondern wird direkt aus dem Speicher des Nutzers geladen. Am leichtesten lässt sich das ganze mit dem fertigen PHP-Script <a href="http://quickcache.codeworxtech.com/">QuickCache</a> realisieren. </p>
<p>Für ein optimales Caching werden meiner Meinung nach 4 Versionen der CSS-Datei gebraucht. Je eine Version für IE und die sonstigen Browser (je nach Design mehr oder weniger, je nach Anzahl der Browserweichen). Und von jeder dieser Versionen wird jeweils eine komprimierte und eine unkomprimierte Version benötigt. Dadurch kann der Server genau die richtige Version ausliefern, ohne erst den Prozessor für eine mögliche Kompression anwerfen zu müssen.</p>
<p>Wer die Cache-Header manuell setzen möchte kann folgenden PHP-Code verwenden.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">   <span style="color: #990000;">header</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;cache-control: must-revalidate&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   
   <span style="color: #000088;">$offset</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">60</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">60</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">24</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">31</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//1 Monat  </span>
   <span style="color: #990000;">header</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'expires: '</span><span style="color: #339933;">.</span><span style="color: #990000;">gmdate</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'D, d M Y H:i:s'</span><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: #339933;">+</span> <span style="color: #000088;">$offset</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' GMT'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<img src="http://feeds.feedburner.com/~r/WebTechnolgieBlog/~4/cr1YHY7Use8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://technologie4web.de/javascript-css-komprimieren-cachen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://technologie4web.de/javascript-css-komprimieren-cachen/</feedburner:origLink></item>
		<item>
		<title>Verschiedene Animationen für :hover an und aus</title>
		<link>http://feedproxy.google.com/~r/WebTechnolgieBlog/~3/YxmPyMm8TJ4/</link>
		<comments>http://technologie4web.de/verschiedene-animationen-fur-hover-an-und-aus/#comments</comments>
		<pubDate>Tue, 08 Feb 2011 14:29:25 +0000</pubDate>
		<dc:creator>Martin Kiesewetter</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>

		<guid isPermaLink="false">http://technologie4web.de/?p=550</guid>
		<description><![CDATA[Normalerweise hat jeder CSS-Container die selbe Animation für das aktivierende und deaktivierende Hover – Ereignis (mit der Maus das Feld betreten bzw. verlassen). Mir bekannt waren bisher nur verschiedene Animationenstechniken in Zusammenhang mit JavaScript-Frameworks wie JQuery oder mootools bekannt. Doch auch mit reinem CSS3 kann man verschiedene CSS :hover Animationen realisieren. Der folgende einfache Trick [...]]]></description>
			<content:encoded><![CDATA[<p>Normalerweise hat jeder CSS-Container die selbe Animation für das aktivierende und deaktivierende Hover – Ereignis (mit der Maus das Feld betreten bzw. verlassen). Mir bekannt waren bisher nur verschiedene Animationenstechniken in Zusammenhang mit JavaScript-Frameworks wie JQuery oder mootools bekannt. Doch auch mit reinem CSS3 kann man verschiedene <span id="more-550"></span>CSS :hover Animationen realisieren. Der folgende einfache Trick realisiert die verschiedenen Animation für hover an und hover aus. Beachte: Der Code-Schnipsel funktioniert nur in Browsern, die transitions unterstützen (z.B. webkit-Browser). Das CSS3-Modul Transition und Animation eignen sich besonders um Interaktivität ohne JavaScript oder Flash auf die eigene Seite zu bringen.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#thing</span> <span style="color: #00AA00;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
   border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/* HOVER OFF */</span>
   -webkit-transition<span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">padding</span> 4s<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#thing</span><span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">25px</span><span style="color: #00AA00;">;</span>
   border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/* HOVER ON */</span>
   -webkit-transition<span style="color: #00AA00;">:</span> border-radius 4s<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Wenn man die Maus über das Feld bewegt, überschreibt die transition den regulären Zustand. Wenn die Maus das Feld wieder verlässt, wird der reguläre Zustand wieder hergestellt, indem die im Originalzustand definierte Animation ausgeführt wird. Der Einsatz von CSS3 hat gegenüber den JavaScript bzw. Flashlösungen einige Vorteile:</p>
<ul>
<li>es wird kein JavaScript benötigt</li>
<li>es werden keine Frameworks benötigt</li>
<li>die Animationen stören keine Skripte</li>
<li>kein Flash wird benötigt</li>
<li>weniger Speicherplatz verbrauch => geringere Übertragunsgzeit übder das Internet</li>
</ul>
<img src="http://feeds.feedburner.com/~r/WebTechnolgieBlog/~4/YxmPyMm8TJ4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://technologie4web.de/verschiedene-animationen-fur-hover-an-und-aus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://technologie4web.de/verschiedene-animationen-fur-hover-an-und-aus/</feedburner:origLink></item>
		<item>
		<title>CSS-Dreiecke</title>
		<link>http://feedproxy.google.com/~r/WebTechnolgieBlog/~3/XCa4ssN3yds/</link>
		<comments>http://technologie4web.de/css-dreiecke/#comments</comments>
		<pubDate>Mon, 07 Feb 2011 07:15:11 +0000</pubDate>
		<dc:creator>Martin Kiesewetter</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://technologie4web.de/?p=541</guid>
		<description><![CDATA[Dreiecke mit CSS . Ein Kriterium für die Qualität einer Webseite ist die Ladegeschwindigkeit. Diese ist u.a. von der zu übertragenden Datenmenge abhängig. Um diese möglichst gering zu halten gibt es die Möglichkeit Dreiecke mit reinem CSS darstellen zu können. Dadurch können oft Teile des Templates durch reines CSS ersetzt werden, wodurch man weniger speicherintenisve [...]]]></description>
			<content:encoded><![CDATA[<p>Dreiecke mit CSS</p>
<div style="width: 0pt; height: 0pt; float: left; margin: 0pt 10px 3px 0pt; border: 25px solid; border-color:red green blue orange;">.</div>
<p>Ein Kriterium für die Qualität einer Webseite ist die Ladegeschwindigkeit. Diese ist u.a. von der zu übertragenden Datenmenge abhängig. Um diese möglichst gering zu halten gibt es die Möglichkeit Dreiecke mit reinem CSS darstellen zu können. Dadurch können oft Teile des Templates durch reines CSS ersetzt werden, wodurch man weniger speicherintenisve Bilder braucht. Weil es nur sehr begrenze Dokumentation dazu im Netz gibt, möchte ich euch die Grundlagen vorstellen. Eine Demonstration ist neben diesem Abschnitt zu sehen.<span id="more-541"></span></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.css-dreieck</span> <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">border-color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">red</span> <span style="color: #993333;">green</span> <span style="color: #000000; font-weight: bold;">blue</span> orange<span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">border-style</span><span style="color: #00AA00;">:</span><span style="color: #993333;">solid</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">border-width</span><span style="color: #00AA00;">:</span><span style="color: #933;">25px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<div style="width: 0pt; height: 0pt; float: left; margin: 0px 10px 3px 0px; border-width:30px 10px 20px 30px; border-style: solid; border-color:red green blue orange;">.</div>
<p>Durch das Anpassen der border-width kann man die Dreiecke in beliebige Form bringen. Dadurch ist der Kreativität keine Grenze mehr gesetzt. Es können auch mehrere Dreiecke zu komplexen Formen zusammengesetzt werden. Wenn man nur einzelne Dreiecke haben möchte so kann man die<br />
übrigen Dreiecke ausblenden, indem man Ihnen die Farbe &#8220;transparent&#8221; zuweist (<a href="#ie6">Hinweis IE6</a>).</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.css-dreieck</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">border-color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">red</span> <span style="color: #993333;">green</span> <span style="color: #000000; font-weight: bold;">blue</span> orange<span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">border-style</span><span style="color: #00AA00;">:</span><span style="color: #993333;">solid</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">border-width</span><span style="color: #00AA00;">:</span><span style="color: #933;">30px</span> <span style="color: #933;">10px</span> <span style="color: #933;">20px</span> <span style="color: #933;">30px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Durch Anpassen des border-style können schöne, auf den ersten Blick unerwartete Formen erzeugt werden:</p>
<div style="width: 0pt; height: 0pt; float: left; margin: 0pt 10px 3px 0pt; border: 30px dotted;border-color:red green blue orange">.</div>
<p>border-style:dotted;</p>
<div style="clear:both;color:white">.</div>
<div style="width: 0pt; height: 0pt; float: left; margin: 0pt 10px 3px 0pt; border: 30px dashed;border-color: red green blue orange">.</div>
<p>border-style:dashed;</p>
<div style="clear:both;color:white">.</div>
<div style="width: 0pt; height: 0pt; float: left; margin: 0pt 10px 3px 0pt; border: 30px outset;border-color: red green blue orange">.</div>
<p>border-style:outset;</p>
<div style="clear:both;color:white">.</div>
<div style="width: 0pt; height: 0pt; float: left; margin: 0pt 10px 3px 0pt; border: 30px inset;border-color: red green blue orange">.</div>
<p>border-style:inset;</p>
<div style="clear:both;color:white">.</div>
<div style="width: 0pt; height: 0pt; float: left; margin: 0pt 10px 3px 0pt; border: 30px ridge;border-color:red green blue orange">.</div>
<p>border-style:ridge;</p>
<div style="clear:both;color:white">.</div>
<div style="width: 0pt; height: 0pt; float: left; margin: 0pt 10px 3px 0pt; border: 30px groove;border-color: red green blue orange">.</div>
<p>border-style:groove;</p>
<div style="clear:both;color:white">.</div>
<div style="width: 0pt; height: 0pt; float: left; margin: 0pt 10px 3px 0pt; border: 30px double;border-color: red green blue orange">.</div>
<p>border-style:double;</p>
<div style="clear:both;color:white">.</div>
<h2 id="ie6">IE6</h2>
<p>Im IE6 funktioniert diese Technik nicht, weil er die Farbe „Transparent“ nicht kennt. Es gibt aber eine ebenso einfache wie geniale Lösung. Man weist den auszublendenden Dreiecken eine Farbe zu, die sonst nirgends verwendet wird und blendet diese anschließend über die CSS-Eigenschaft Chroma komplett aus.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">.css_dreieck<span style="color: #00AA00;">&#123;</span>
    _border-left-<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> pink<span style="color: #00AA00;">;</span>
    _border-bottom-<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> pink<span style="color: #00AA00;">;</span>
    _border-right-<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> pink<span style="color: #00AA00;">;</span>
    _filter<span style="color: #00AA00;">:</span> chroma<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">=</span>pink<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<h2>Praktisches Beispiel mit CSS Dreiecken</h2>
<p>Um den Nutzen zu demonstrieren folgt eine Sprechblase, die normalerweise mit hilfe von 3 Bildern erstellt wird: jeweils ein Bild für den oberen und unteren Bereich der Sprechblase, sowie ein Bild für den mittleren Teil, der je nach Textmenge mehrfach nach unten wiederholt werden würde. In diesem Beispiel, dass in allen Browsern funktioniert, wird ausschließlich CSS eingesetzt. Das hat neben der geringen Datenmenge auch andere Vorteile: </p>
<ul>
<li>Farben können durch eine einzige Zeile im CSS angepasst werden</li>
<li>Die Breite der Box kann schnell beliebig angepasst werden</li>
</ul>
<style type="text/css">
.sprechblase {
  background-color:#EDEDED;
  border:2px solid #666666;
  font-size:35px;
  line-height:1.3em;
  margin:10px auto;
  padding:10px;
  position:relative;
  text-align:center;
  width:300px;
  -moz-border-radius:10px;
  -webkit-border-radius:10px;
  -moz-box-shadow:0 0 5px #888888;
  -webkit-box-shadow:0 0 5px #888888;
}
.sprechblase_dunkles_freieck {
  border-color: #666666 transparent transparent transparent;
  border-style: solid;
  border-width: 10px;
  height:0;
  width:0;
  position:absolute;
  bottom:-22px;
  _bottom:-66px;
  left:30px;
}
.sprechblase_helles_freieck {
  border-color: #EDEDED transparent transparent transparent;
  border-style: solid;
  border-width: 10px;
  height:0;
  width:0;
  position:absolute;
  bottom:-19px;
  _bottom:-63px;
  left:30px; 
}</p>
</style>
<div class="sprechblase">
  Toller Text!<br />
  mit n&uuml;tzlichen Infos</p>
<div class="sprechblase_dunkles_freieck"></div>
<div class="sprechblase_helles_freieck"></div>
</div>
<p>HTML</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&amp;lt;div&amp;gt;
 Toller Text!&amp;lt;br&amp;gt;
 mit n&amp;amp;uuml;tzlichen Infos
 &amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;
 &amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;</pre></div></div>

<p>CSS</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.sprechblase</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#EDEDED</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span><span style="color: #933;">2px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#666666</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">35px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span><span style="color: #933;">1.3em</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span><span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">300px</span><span style="color: #00AA00;">;</span>
  -moz-border-radius<span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
  -webkit-border-radius<span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
  -moz-box-shadow<span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">5px</span> <span style="color: #cc00cc;">#888888</span><span style="color: #00AA00;">;</span>
  -webkit-box-shadow<span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">5px</span> <span style="color: #cc00cc;">#888888</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.sprechblase_dunkles_freieck</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">border-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#666666</span> <span style="color: #993333;">transparent</span> <span style="color: #993333;">transparent</span> <span style="color: #993333;">transparent</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">border-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">solid</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">border-width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">:</span><span style="color: #933;">-22px</span><span style="color: #00AA00;">;</span>
  _bottom<span style="color: #00AA00;">:</span><span style="color: #933;">-66px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span><span style="color: #933;">30px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.sprechblase_helles_freieck</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">border-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#EDEDED</span> <span style="color: #993333;">transparent</span> <span style="color: #993333;">transparent</span> <span style="color: #993333;">transparent</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">border-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">solid</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">border-width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">:</span><span style="color: #933;">-19px</span><span style="color: #00AA00;">;</span>
  _bottom<span style="color: #00AA00;">:</span><span style="color: #933;">-63px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span><span style="color: #933;">30px</span><span style="color: #00AA00;">;</span> 
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<img src="http://feeds.feedburner.com/~r/WebTechnolgieBlog/~4/XCa4ssN3yds" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://technologie4web.de/css-dreiecke/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://technologie4web.de/css-dreiecke/</feedburner:origLink></item>
		<item>
		<title>Blognische finden</title>
		<link>http://feedproxy.google.com/~r/WebTechnolgieBlog/~3/HPPTQsPSiT0/</link>
		<comments>http://technologie4web.de/blognische-finden/#comments</comments>
		<pubDate>Sun, 02 Jan 2011 13:15:58 +0000</pubDate>
		<dc:creator>Martin Kiesewetter</dc:creator>
				<category><![CDATA[SEO]]></category>

		<guid isPermaLink="false">http://technologie4web.de/?p=534</guid>
		<description><![CDATA[Wer heute erfolgreich einen eigenen Blog starten möchte hat´s nicht leicht: mittlerweile gibt es tausende Blogs im Internet &#8211; scheinbar wird jedes Thema bereits in einer Vielzahl von Blogs diskutiert. In diesem Artikel möchte ich euch klären was Nischen genau sind außerdem werde ich einige Tipps geben, wie man ein Nischenthema findet. Inhalt Was ist [...]]]></description>
			<content:encoded><![CDATA[<p><a href="/wp-content/uploads/2011/01/blognische-finden.gif"><img src="/wp-content/uploads/2011/01/blognische-finden.gif" alt="blognische finden Blognische finden" title="blognische-finden" width="150" height="150" class="bild-content-anfang" /></a>Wer heute <em>erfolgreich</em> einen eigenen Blog starten möchte hat´s nicht leicht: mittlerweile gibt es tausende Blogs im Internet &#8211; scheinbar wird jedes Thema bereits in einer Vielzahl von Blogs diskutiert. In diesem Artikel möchte ich euch klären was Nischen genau sind außerdem werde ich einige Tipps geben, wie man ein Nischenthema findet.<span id="more-534"></span></p>
<h1>Inhalt</h1>
<ol style="margin-left:-20px">
<li><a href="#definition-blognische">Was ist eine Blognische</a></li>
<li><a href="#kriterien-gute-nische">Kriterien für eine gute Nische</a>
<ul style="margin-left:-20px">
<li>In meiner <a href="#keywordliste">Keywordliste</a> stehen mindestens 250 Begriffe</li>
<li>Es gibt ein <a href="#Mindestsuchvolumen">Mindestsuchvolumen über Suchmaschinen</a></li>
<li>Es gibt <a href="#wenige-sem-mitbewerber">wenige schwache SEM-Mitbewerber</a>  (Adwords &#038; Co)</li>
<li>Es gibt <a href="#wenige-konkurrenten">wenige Mitbewerber in der organischen Suche</a></li>
<li>Die Konkurrenten in der Organischen Suche haben <a href="#schlecht-optimierte-konkurrenzseiten">schlecht optimierte Webseiten</a></li>
<li>Ich kann zum Nischenthema <a href="#eigene-Kompetenz">regelmäßig Beiträge verfassen</a> (ich habe Ahnung vom Thema)</li>
<li>Ich kann ein <a href="#produkte-dienstleistungen-verkaufen">Produkt oder eine Dienstleistung</a> aus dem Nischenthema verkaufen</li>
</ul>
</li>
</ol>
<h1 id="definition-blognische">Was ist eine Blognische</h1>
<p>Für mich ist eine Nische ein <strong>stark eingegrenztes</strong> Thema, in dem nur sehr wenige/schwache Konkurrenten unterwegs sind. D.h. das Nischenthema ist so speziell, dass es sich für große Firmen nicht lohnt dieses Abzudecken und andererseits groß genug ist, damit man damit ordentliche Gewinne erwirtschaften kann.</p>
<h1 id="kriterien-gute-nische">Kriterien für eine gute Blognische</h1>
<p>In den nächsten Abschnitten werden die Kriterien aufgezählt, die für mich wichtig sind, wenn ich mich auf die Suche nach einer Nische mache. Falls Ihr andere Kriterien habt, schreibt das bitte in die Kommentare. Sobald ich ein Kriterium mit &#8220;nein&#8221; beantworten muss verwerfe ich das Thema und suche mir ein Neues.</p>
<h2 id="keywordliste">Mindestgröße meiner Keywordliste</h2>
<p>Die Keywordliste ist die Liste aller möglichen Nischenthemen, die für mich in Betracht kommen. Diese ist von fundamentaler Bedeutung, weil sämtliche folgenden Schritte immer wieder auf dieser Liste aufbauen. Eine schlechte Keywordliste ist ein Garant für ein erfolgloses Projekt. Um sicher zu gehen, dass ich mir lange genug Gedanken über andere mögliche Themen gemacht habe setze ich mir eine unter Schranke von 250 Begriffen. Je nach Thema können auch mehr oder weniger sinnvoll sein! Solange diese Anzahl nicht erreicht ist, suche ich weiter nach Artverwandten Begriffen und Synonymen.</p>
<h2 id="Mindestsuchvolumen">Mindestsuchvolumen über Suchmaschinen</h2>
<p>Je mehr potentielle Kunden existieren, desto erfolgreicher kann ein Nischenblog werden &#8211; logisch! Doch wie viele Besucher sind konkret notwendig damit sich der Betrieb eines Blogs langfristig lohnt? Erstellt man einen Blog über Luxusschiffe, bei denen man eine Provision pro Verkauf bekommt, könnten sich bereits 10 Besucher / Monat lohnen. Es gibt natürlich auch Themen, bei denen die Provisionen bzw. Erträge pro Besucher sehr gering sind. Bei diesen Themen sind entsprechend mehr Besucher notwendig. Für mich hat sich eine Zahl von 5.000 Suchanfragen im <a href="#links">Google-Keywordtool</a> als sinnvoll herausgestellt.</p>
<h2 id="#wenige-sem-mitbewerber">Wenige schwache SEM &#8211; Mitbewerber</h2>
<p>Die meisten Besucher werden über SEO bzw. SEM auf unseren Nischenblog finden. Weil wir alle Keywords, bei denen wir mit SEO keine gute Platzierung erreichen mit SEM bewerben sollten die Preise für SEM möglichst gering sein. In den meisten Fällen sind preise bis max. 50ct akzeptabel. Diese Preishürde betrifft vor allem das Hauptkeyword, weil dieses i.a. die meisten Besucher erwarten lässt und deshalb am teuersten ist. Den späteren Klickpreis kann man bei <a href="#links">Google Adwords</a> sehen.</p>
<h2 id="wenige-konkurrenten">Wenige Mitbewerber in der organischen Suche</h2>
<p>Die günstigsten Besucher sind die, für die man nichts bezahlen muss. Eine erfolgreiche Suchmaschinenoptimierung ist besonders wichtig, weil man so die meisten &#8220;kostenlosen Besucher&#8221; kommt. Die Suchmaschinenoptimierung selber ist umso aufwendiger/teurer je mehr starke Konkurrenten in der gewünschten Nische tätig sind. Auf vielen Seiten, die sich auch mit dem Nischenfinden beschäftigen habe ich Zahlen gefunden, die besagen, dass maximal 100.000 bis 500.000 Ergebnisse bei einer Googlesuche in der Nische vorhanden sein sollten, damit sich ein neuer Blog lohnt. Meiner Meinung nach kann man das wesentlich genauer festlegen, indem man in die Google-Suche folgendes eingibt (ohne Anführungsstriche): &#8220;intitle:keyword&#8221; bzw. wenn der Nischenname aus mehreren Worten besteht: &#8220;intitle:keyword1 intitle:keyword2&#8243; uws. Dadurch erhält man die Anzahl der Seiten, bei denen unser Wunschnischenthema im Meta-Title steht. Der Metatitle ist das Hauptrankingkriterium (onpage). Dadurch erfährt man genau wie wie viele <strong>echte Konkurrenten</strong> vorhanden sind und filtert die &#8220;Opferseiten&#8221;, d.h. die Seiten, die eh keinen echte Gegner darstellen, aus.<br />
Meiner Meinung nach sollte man das Thema vergessen, wenn es mehr als 500 Konkurrenten gibt &#8211; außer man kennt sich mit SEO wirklich aus.</p>
<h2 id="schlecht-optimierte-konkurrenzseiten">Schlecht optimierte Konkurrenzseiten</h2>
<p>Sobald man die <a href="#wenige-konkurrenten">echten Konkurrenten</a> ermittelt hat untersucht man die Konkurrenzseiten auf ihre jeweiligen SEO &#8211; Werte (Onpage &#8211; Optimierung und Backlinks). Ist man der Meinung, dass man mit angemessenen Mitteln nicht gegen diese Konkurrenz ankommt, so sollte man sich ein anderes Nischenthema suchen.<br />
Ggf. kann man auch ein ganzes Blognetzwerk erstellen und so auch scheinbar übermächtige Gegner bezwingen, indem man für jedes Unterthema der Nische einen eigenen Blog erstellt und diese geschickt untereinander verlinkt.</p>
<h2 id="eigene-Kompetenz">Kann ich Regelmäßig Beiträge verfassen?</h2>
<p>Das Nischenthema sollte den eigenen Interessen entsprechen, d.h. man sollte sich in dem Bereich, über den man Bloggen möchte, sehr gut auskennen und sich sicher sein, dass man immer was zu erzähle hat. Weil man sich dabei die eigenen Fähigkeiten leicht schönredet hat es sich bewährt, wenn man in der Nischenthema-finden-Phase eine Liste mit 50 Themen macht, über die man im Blog berichten möchte. Dazu zählen nicht: Rezensionen, <a href="http://www.schaefer-werbeartikel.de">Werbeartikel</a> für Andere, Administratives (ála ich habe heute den Blog geupdated) usw. Wenn man die Liste schnell füllt kann man sich sicher sein, dass einem die Themen nicht so schnell ausgehen und die Blognische genügend &#8220;Tiefgang&#8221; hat.</p>
<h2 id="produkte-dienstleistungen-verkaufen">Produkt oder eine Dienstleistung verkaufen</h2>
<p>Ein Blog wird nur dann wirtschaftlich funktionieren, wenn das Thema den Verkauf von Produkten und Dienstleistungen grundsätzlich zulässt und ob die potentiellen Kunden grundsätzlich bereit sind dafür Geld auszugeben. Als nächstes muss man sich Fragen, ob man das Produkt/Dienstleistung selber anbieten kann (optimal) oder ob man die Vermarktung auf Provisionsbasis macht. Die Provisionsbasis hat neben dem Vorteil, dass man sich um nichts kümmern muss einige Nachteile: </p>
<ul>
<li>was passiert wenn der, der die Provision bezahlt (Merchant) aus welchen Gründen auch immer nicht mehr existiert?</li>
<li>i.a. geringerer Verdienst, als wenn man selber etwas verkauft</li>
<li>meistens gibt es Einschränkungen bei der Bewerbung der eigenen Seite (z.B. Verbot von SEM zum Keyword)</li>
<li>usw.</li>
</ul>
<h1 id="links">Weiterführende Links</h1>
<ul>
<li><a href="https://adwords.google.com/select/KeywordToolExternal">Google-Keywordtool</a></li>
<li><a href="http://adwords.google.de/">Google-Adwords</a></li>
</ul>
<img src="http://feeds.feedburner.com/~r/WebTechnolgieBlog/~4/HPPTQsPSiT0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://technologie4web.de/blognische-finden/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://technologie4web.de/blognische-finden/</feedburner:origLink></item>
		<item>
		<title>Automatisches Webseitenkopieren verhindern</title>
		<link>http://feedproxy.google.com/~r/WebTechnolgieBlog/~3/lyuNa5oarm8/</link>
		<comments>http://technologie4web.de/automatisches-webseitenkopieren-verhindern/#comments</comments>
		<pubDate>Mon, 15 Nov 2010 18:34:24 +0000</pubDate>
		<dc:creator>Martin Kiesewetter</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://technologie4web.de/?p=524</guid>
		<description><![CDATA[Weil ich häufig mal keinen Internetzugang habe, kopiere ich gerne ganze Webseiten auf meinen Laptop und durchstöbere die Inhalte später in ruhe. Während ich also meine Lieblingsseite kopiere komme ich auf den Gedanken, dass ich nicht unbedingt möchte, dass jemand meine ganzen Inhalte in einem Rutsch runterläd. Doch wie verhindert man das? Warum stört es [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://technologie4web.de/wp-content/uploads/2010/11/keine-kopie.jpg"><img src="http://technologie4web.de/wp-content/uploads/2010/11/keine-kopie.jpg" alt="keine kopie Automatisches Webseitenkopieren verhindern" title="keine-kopie" width="120" height="120" class="bild-content-anfang" /></a>Weil ich häufig mal keinen Internetzugang habe, kopiere ich gerne ganze Webseiten auf meinen Laptop und durchstöbere die Inhalte später in ruhe. Während ich also meine Lieblingsseite kopiere komme ich auf den Gedanken, dass ich nicht unbedingt möchte, dass jemand meine ganzen Inhalte in einem Rutsch runterläd. Doch wie verhindert man das?<span id="more-524"></span></p>
<h1>Warum stört es mich, wenn andere meine Webseite kopieren?</h1>
<p>Ganz einfach: zum einen verhindert es korrekte Statistiken, weil für jeden Artikel ein angeblicher Besucher hinzukommt. Zum anderen belastet es meinen Server / Traffic, was zum einen Geld kostet und zum anderen die Ladezeiten der anderer echten Besucher verlängert. Der dritte Grund liegt im Contentdiebstahl, d.h. Diebe könnten versuchen die Inhalte meiner Seite zu extrahieren und zukünftig auf anderen Seiten als jeweils Eigene<br />
auszugeben.</p>
<h1>So werde ich das Problem lösen</h1>
<p>Ich würde in einer Datenbank die IPs der Besucher zwischenspeichern und wenn eine IP mehr als XX Seiten pro Minute oder XX Seiten pro Tag runterläd wird der Zugriff mit einer Fehlermeldung verweigert.<br />
Ich nehme die IP und nicht die Session oder irgendein anderen Cookie, weil Sessions (Cookies) einfach vom Nutzer / Kopierprogramm deaktiviert werden können. Natürlich ist es auch möglich, dass mehrere Menschen die selbe IP verwenden, allerdings ist die Wahrscheinlichkeit, dass sich 2 verschiedene Menschen zeitgleich (innerhalb der selben Minute) auf der selben Seite bewegen sehr gering. Selbst wenn dieser unwahrscheinliche Fall eintritt, so müssten die Beiden jeweils massiv viele Seiten anklicken um den Filter zu aktivieren.</p>
<h2>Die Datenbank</h2>
<p>Als Datenbank verwende ich eine einfache einspaltige Relation:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">TABLE</span> <span style="color: #008000;">`sec<span style="color: #008080; font-weight: bold;">_</span>antikopie`</span> <span style="color: #FF00FF;">&#40;</span>
<span style="color: #008000;">`ip`</span> <span style="color: #999900; font-weight: bold;">INT</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span> <span style="color: #000033;">,</span>
<span style="color: #008000;">`zeit`</span> <span style="color: #999900; font-weight: bold;">INT</span> <span style="color: #FF9900; font-weight: bold;">UNSIGNED</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span> <span style="color: #000033;">,</span>
<span style="color: #990099; font-weight: bold;">INDEX</span> <span style="color: #FF00FF;">&#40;</span> <span style="color: #008000;">`ip`</span> <span style="color: #FF00FF;">&#41;</span>
<span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">ENGINE</span> <span style="color: #CC0099;">=</span> MYISAM <span style="color: #000033;">;</span></pre></div></div>

<p>Die IPs speicher ich als INT, weil IPs auf diese Art besonders effektiv gespeichert und verarbeitet werden können. Hier finden Sie genauere Informationen um <a href="/ip-optimal-in-datenbank-speichern/">IP´s effizient zu speichern</a>. Die Zeit speichere ich als Time-Stamp.</p>
<h2>Das Script</h2>
<p>Das folgende Script sollte möglichst weit oben im Quellcode eingebaut werden. Falls die Seite standardmäßig eine Verbindung zur Datenbank herstellt, so sollte das Script direkt nach der Datenbankverbindung eingefügt werden.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'xxx'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'xxx'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Datenbankverbindung</span>
<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'xxx'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Settings Start</span>
<span style="color: #000088;">$max_erlaubte_aufrufe_minute</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$max_erlaubte_aufrufe_tag</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">50</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//Settings Ende</span>
&nbsp;
<span style="color: #000088;">$aufrufe</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SELECT (select count(*) FROM `sec_antikopie` WHERE ip='</span><span style="color: #339933;">.</span><span style="color: #990000;">ip2long</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REMOTE_ADDR'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' and zeit&gt;'</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">60</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">') as zahl_minute,(select count(*) FROM `sec_antikopie` WHERE ip='</span><span style="color: #339933;">.</span><span style="color: #990000;">ip2long</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REMOTE_ADDR'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' and zeit&gt;'</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">60</span><span style="color: #339933;">*</span><span style="color: #cc66cc;">60</span><span style="color: #339933;">*</span><span style="color: #cc66cc;">24</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">') as zahl_tag'</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: #009900;">&#40;</span><span style="color: #000088;">$aufrufe</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'zahl_minute'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">&gt;</span><span style="color: #000088;">$max_erlaubte_aufrufe_minute</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$aufrufe</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'zahl_tag'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">&gt;</span><span style="color: #000088;">$max_erlaubte_aufrufe_tag</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
  <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Sie haben zu viele Aufrufe auf diese Seite gemacht'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'insert low_priority into sec_antikopie(ip,zeit) values ('</span><span style="color: #339933;">.</span><span style="color: #990000;">ip2long</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REMOTE_ADDR'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">','</span><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: #339933;">.</span><span style="color: #0000ff;">')'</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: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">//Jeder tausendste</span>
  <span style="color: #009900;">&#123;</span>
  <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'delete from sec_antikopie where zeit &lt;'</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">24</span><span style="color: #339933;">*</span><span style="color: #cc66cc;">60</span><span style="color: #339933;">*</span><span style="color: #cc66cc;">60</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Das Script baut zuerst eine Verbindung zur Datenbank auf. Falls diese bereits durch die Seite besteht muss man natürlich keine zweite Verbindung aufbauen und kann die ersten 2 Zeilen löschen. Die nächsten zwei Zeilen enthalten die Einstellungen: ich lege fest, dass jede IP maximal 10 Aufrufe pro Minute und maximal 50 Aufrufe pro Tag.<br />
Als nächstes wird aus der Datenbank die Anzahl der Seitenaufrufe der letzten Minute und die Anzahl der heutigen Seitenaufrufe ermittelt. Falls diese die Grenzwerte aus den Einstellungen überschreiten wird der weitere Seitenaufbau abgebrochen. Die nächste Zeile fügt eine neue Eintrag in die Datenbank ein mit IP und Uhrzeit ein. Das &#8220;low_priority&#8221; signalisiert dem Datenbanksystem, dass es sich um eine &#8220;unwichtige&#8221; Anfrage handelt, die dann ausgeführt werden soll, wenn das System gerade nichts zu tun hat. Sämtliche weitere Nachteile von low_priority (z.B. Datenverlust bei Serverzusammenbruch) haben keinen funktionalen Einfluss auf dieses Script und werden deshalb hier nicht weiter besprochen.<br />
Der letzte Abschnitt wird durchschnittlich bei jedem tausendsten Besucher durchgeführt. Es werden alle veralteten Einträge aus der Datenbank gelöscht. Dieser Schritt verhindert, dass die Datenbank &#8220;Datenleichen&#8221; ansammelt und mit der Zeit vollläuft. Je nach Geschmack kann man das Löschen auch in einen Cronjob auslagern, wodurch man den &#8220;ungünstigen Zufall&#8221; (das das Script z.B. eine million mal nicht die Zufallszahl 10 wählt) verhindert.</p>
<h1>Zusammenfassung</h1>
<p>Sie sind jetzt in der Lage Ihre Webseite gegen automatisiertes Kopieren zu schützen. Sie wissen wie die Datenbank zu erstellen ist, wie der Code eingebaut werden muss und was er bewirkt. Das Script geht äußerst schonend mit den Serverressourcen um und kann deshalb auch auf stark frequentierten Seiten eingesetzt werden.</p>
<img src="http://feeds.feedburner.com/~r/WebTechnolgieBlog/~4/lyuNa5oarm8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://technologie4web.de/automatisches-webseitenkopieren-verhindern/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		<feedburner:origLink>http://technologie4web.de/automatisches-webseitenkopieren-verhindern/</feedburner:origLink></item>
		<item>
		<title>Performance von JavaScript- und CSS-Code optimieren</title>
		<link>http://feedproxy.google.com/~r/WebTechnolgieBlog/~3/M-Of4XNUpJQ/</link>
		<comments>http://technologie4web.de/performance-javascript-css-code-optimieren/#comments</comments>
		<pubDate>Fri, 12 Nov 2010 11:31:51 +0000</pubDate>
		<dc:creator>Martin Kiesewetter</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://technologie4web.de/?p=510</guid>
		<description><![CDATA[JavaScript und CSS befinden sich heute auf praktisch jeder Webseite. Bei beidem kann man allerdings aus Performance-sicht so einiges falsch machen. Deshalb möchte ich zusammenfassen, wie man die Performance von JavaScript- und CSS-Code optimieren kann und dadurch den Seitenaufbau beschleunigen kann. Diesen Blogpost werde ich in die folgenden Teile zerlegen: Browserabhängiges CSS JavaScript- und CSS-Dateien [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://technologie4web.de/wp-content/uploads/2010/11/css-javascript-optimieren.jpg"><img src="http://technologie4web.de/wp-content/uploads/2010/11/css-javascript-optimieren.jpg" alt="css javascript optimieren Performance von JavaScript  und CSS Code optimieren" title="css-javascript-optimieren" width="120" height="120" class="bild-content-anfang" /></a>JavaScript und CSS befinden sich heute auf praktisch jeder Webseite. Bei beidem kann man allerdings aus Performance-sicht so einiges falsch machen. Deshalb möchte ich zusammenfassen, wie man die Performance von JavaScript- und CSS-Code optimieren kann und dadurch den Seitenaufbau beschleunigen kann.<span id="more-510"></span><br />
Diesen Blogpost werde ich in die folgenden Teile zerlegen:</p>
<ol>
<li><a href="#Browserabhängiges CSS">Browserabhängiges CSS</a></li>
<li><a href="#JavaScript-CSS-Dateien-zusammenführen">JavaScript- und CSS-Dateien zusammenführen</a></li>
<li><a href="#JavaScript-CSS-minimieren">JavaScript- und CSS minimieren</a></li>
<li><a href="#optimale-reihenfolge-css-javascript">optimaler Ort/Reihenfolge zum Referenzieren von JavaScript und CSS</a></li>
</ol>
<h1 id="Browserabhängiges CSS">Browserabhängiges CSS</h1>
<p>Dass CSS nicht von allen Browsern einheitlich interpretiert wird ist bekannt. Speziell der IE6 macht häufig was er will. Deshalb setzen Webentwickler häufig sogenannte Browserweichen ein.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#nav</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">157px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
body <span style="color: #00AA00;">&gt;</span> <span style="color: #cc00cc;">#nav</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">117px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Die obere Regel wird von allen Browsern verwendet. Die zweite Regel wird von allen Browsern außer dem IE verwendet, weil dieser den Selektor: > nicht kennt. Deshalb werden alle &#8220;nicht IE-Browser&#8221; die zweite Regel, und der IE die erste Regel verwenden. Diese gängige Praxis ist aus Performance-sicht nicht optimal, weil zum einen die CSS-Datei durch &#8220;Doppelregeln&#8221; unnötig groß wird und zum anderen mehr CSS-Regeln vom Browser verarbeitet werden müssen.<br />
Um das Problem zu lösen wandel ich meine CSS-Datei in eine PHP-Datei um<sup>1</sup> und kann dadurch PHP innerhalb des CSS verwenden. Der folgende Code-Schnipsel löst das Problem von oben:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strstr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_USER_AGENT'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'MSIE'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'#nav {left: 157px;}'</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span>
  <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'#nav {left: 117px;}'</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<h1 id="JavaScript-CSS-Dateien-zusammenführen">JavaScript- und CSS-Dateien zusammenführen</h1>
<p>Jede Datei, die zum Anzeigen einer Webseite notwendig ist muss (vereinfacht gesagt<sup>2</sup>) einzeln vom Server angefordert werden. Ziel dieser Optimierung ist die Reduzierung der HTTP-Requests, d.h. die Anzahl der Anfragen an den Server zu minimieren. So sieht der HEAD-Bereich einer typischerweisen Webseite aus:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;head&gt;
&lt;link rel='stylesheet' href='file_1.css' type='text/css' /&gt;
&lt;link rel='stylesheet' href='file_2.css' type='text/css' /&gt;
&lt;link rel='stylesheet' href='file_n.css' type='text/css' /&gt;
&lt;/head&gt;</pre></div></div>

<p>Es werden also N einzelne CSS-Dateien für die Darstellung benötigt. Der folgende PHP-Code<sup>1</sup> kann in eine CSS-Sammel-Datei geschrieben werden. Dadurch werden die Inhalte aller CSS-Dateien hintereinander in die neue CSS-Sammel-Datei geschrieben.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'content-type: text/css'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'file_1.css'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'file_2.css'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">.</span>
<span style="color: #339933;">.</span>
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'file_n.css'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Diese CSS-Sammel-Datei wird ganz normal im HTML referenziert:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;head&gt;
&lt;link rel='stylesheet' href='CSS-Sammel-Datei.php' type='text/css' /&gt;
&lt;/head&gt;</pre></div></div>

<p>Die zu übertragende Datenmenge hat sich dabei nicht verändert. Es verringert sich nur die Anzahl der HTTP-Requests, wodurch die Seite wesentlich schneller läd. Kleiner Nebeneffekt: Je länger eine Datei ist, desto effizienter funktionert die Komprimierung. In einigen Sonderfällen sollte man auf die Zusammenführung verzichten: wird auf einer Unterseite nur eine sehr kleine CSS-Datei benötigt und auf einer anderen Unterseite mehrere sehr große, so bietet es sich an die CSS-Dateien nicht zusammenzuführen.<br />
JavaScript-Dateien lassen sich genauso zusammenfügen. Dabei muss nur der Content-Type von &#8220;text/css&#8221; in &#8220;text/javascript&#8221; geändert werden.</p>
<h1 id="JavaScript-CSS-minimieren">JavaScript- und CSS minimieren</h1>
<p>Bei dieser Optimierung geht es darum Zeichen aus der JavaScript bzw. CSS-Datei zu löschen, die für die funktionalität ohne Bedeutung sind. Im Internet existieren bereits etliche kostenlose CSS- und JavaScript minifier (z.B. <a href="http://csstidy.sourceforge.net/index.php" target="_blank">CSSTidy</a> oder <a href="http://www.cssdrive.com/index.php/main/csscompressor/" target="_blank">cssdrive.com</a>), die vollautomatisch ihre Arbeit erledigen. Die Qualität (Kompressionsrate) ist dabei meist sehr gut. Wer sein CSS / JavaScript allerdings häufig ändert wünscht sich vermutlich eine etwas komfortablere Variante. Der folgende PHP-Code komprimiert eine CSS-Datei zur Laufzeit (&#8220;on the fly&#8221;):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">  <span style="color: #990000;">ob_start</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'compress'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
&nbsp;
  <span style="color: #000000; font-weight: bold;">function</span> compress<span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</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;<span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><span style="color: #339933;">,</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: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #990000;">array</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: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$data</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;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'!/\*[^*]*\*+([^/][^*]*\*+)*/!'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/;( *)}( *)/i&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;}&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/ *{ */i&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;{&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/; */i&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;;&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/ *, */i&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;,&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$data</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Da der PHP-Befehl <em>preg_replace</em> wie jeder Befehl, der reguläre Ausdrücke verwendet, äußerst langsam ist, ist ein <a href="#javascript-css-cache">Cachesystem</a> für die Ergebnisdatei pflicht!<br />
Für JavaScript gibt es ähnliche Codeschnipsel im Internet. Bei meinen Tests gab es allerdings kein Script, dass alle von mir getesten JavaScripts fehlerfrei verkleinern konnte. Deshalb möchte ich auch keine Empfehlung aussprechen &#8211; Probiert einfach einige aus!</p>
<h1 id="optimale-reihenfolge-css-javascript">Optimaler Ort und Reihenfolge zum Referenzieren von JavaScript und CSS</h1>
<p>Es gibt eine einfache Faustregel: <strong>CSS so weit oben wie möglich</strong> im Quellcode stehen &#8211; ideal wenn alles was mit CSS zutun hat im head-Bereich steht. Dadurch kann der Browser bereits mit dem Seitenaufbau beginnen, obwohl noch nicht die ganze Seite heruntergeladen wurde.<br />
Bei JavaScript ist es ganau andersrum: <strong>JavaScript sollte soweit wie möglich unten</strong> im Quellcode stehen &#8211; idealerweise kurz vor dem </html>. Die Ursache dafür ist, dass JavaScript den HTML-Baum ändern kann und das natürlich nur Sinn macht, wenn der HTML-Baum auch vollständig bekannt ist.<br />
Sollten in head-bereich mehrere CSS- und JavaScript-Dateien vorhanden sein, die nicht <a href="#JavaScript-CSS-Dateien-zusammenführen">zusammengeführt</a> werden können, so sollten diese streng nach typ sortiert werden: erst alle CSS-Dateien und dann alle JavaScript-Dateien. Der Grund hierfür liegt darin, dass der Browser gleiche Dateitypen parallel downloaden kann und beim wechsel von JavaScript und CSS jeweils warten muss, bis die erste Datei fertig runtergeladen wurde.<br />
Das <a href="http://www.w3.org/TR/REC-html40/interact/scripts.html">HTML-Attribut defer</a> gibt dem Browser einen Hinweis, dass das JavaScript keine Inhalte in die Seite einfügt. Dadurch können nachfolgende CSS-Dateien parallel zur JavaScript-Datei heruntergeladen werden. Verfügbar ist das HTML-Attribut defer breits im Internet Explorer und seit Version 3.1 auch im Firefox.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;script defer=&quot;defer&quot; type=&quot;text/javascript&quot; src=&quot;&quot; /&gt;</pre></div></div>

<hr />
<sup>1</sup>= damit alle Browser PHP-Dateien, die CSS enthalten auch als CSS-Datei anerkennen, muss der richtige Content-Type gesetzt werden (z.B. mit PHP: 	header(&#8216;content-type: text/css&#8217;); )<br />
<sup>2</sup>= die echte Anzahl der Dateien, die gleichzeitig geladen werden können, ist von Browser und Betriebssystem des Nutzers abhängig.</p>
<img src="http://feeds.feedburner.com/~r/WebTechnolgieBlog/~4/M-Of4XNUpJQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://technologie4web.de/performance-javascript-css-code-optimieren/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://technologie4web.de/performance-javascript-css-code-optimieren/</feedburner:origLink></item>
		<item>
		<title>Kaspersky Anti-Virus 2011 Verlosung</title>
		<link>http://feedproxy.google.com/~r/WebTechnolgieBlog/~3/IQ0jxokLvQo/</link>
		<comments>http://technologie4web.de/kaspersky-anti-virus-2011-verlosung/#comments</comments>
		<pubDate>Tue, 26 Oct 2010 09:21:45 +0000</pubDate>
		<dc:creator>Martin Kiesewetter</dc:creator>
				<category><![CDATA[Werbung]]></category>

		<guid isPermaLink="false">http://technologie4web.de/?p=501</guid>
		<description><![CDATA[Heute möchte ich das erste Gewinnspiel auf Technologie4web.de starten. Zu gewinnen gibt es ein Paket der Antivirensoftware: Kaspersky Anti-Virus 2011 Limited Edition. Mit dieser Software kann man ein Jahr lang bis zu 3 PCs vor unliebsamen Viren, Würmern, Spyware &#038; Co schützen. Dieser Artikel wurde von der iCrossing GmbH gesponsort (im Auftrag von Kaspersky Lab) [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://technologie4web.de/wp-content/uploads/2010/10/Virenscanner.jpg" width="120px" height="120px" class="bild-content-anfang" title="Kaspersky Anti Virus 2011 Verlosung" alt="Virenscanner Kaspersky Anti Virus 2011 Verlosung" />Heute möchte ich das erste Gewinnspiel auf Technologie4web.de starten. Zu gewinnen gibt es ein Paket der Antivirensoftware: <strong>Kaspersky Anti-Virus 2011 Limited Edition</strong>. Mit dieser Software kann man ein Jahr lang bis zu 3 PCs vor unliebsamen Viren, Würmern, Spyware &#038; Co schützen.<span id="more-501"></span></p>
<p><span style="color:red">Dieser Artikel wurde von der iCrossing GmbH gesponsort  (im Auftrag von Kaspersky Lab)</span></p>
<h2>Kaspersky Anti-Virus 2011 Limited Edition</h2>
<p>Dieses Blog richtet sich primär an Webentwickler. Webentwickler bewegen sich traditionell sehr viel im Internet und sind damit den Internet-Gefahren besonders stark ausgesetzt. Deshalb sollte jeder Webentwickler eine aktuelles Anti-Viren-Programm installiert haben.</p>
<p>Die Anti-Viren-Software „<a href="http://adt.traffictrack.de/go.cgi?pid=232&#038;wmid=812&#038;cpid=10&#038;prid=59&#038;target=Kaspersky_AV_LimEd_Textlink">Kaspersky Anti-Virus</a>“ hilft Ihnen, Viren, Würmer, Trojaner, Spyware, Rootkits und andere Malware auf Ihrem Computer aufzuspüren und zu vernichten. Wie jede (mir bekannte) Virensoftware  bietet sie einen Echtzeitschutz, der völlig unauffällig im Hintergrund läuft und vor den oben genannten Gefahren schützt. Im Gegensatz zu anderen Anti-Viren-Programmen wird das System dabei nicht übermäßig belastet.<br />
Für Webentwickler besonders wichtig ist das automatische Scannen von Webseiten und E-Mails. Bei Emails werden alle möglichen Konten (POP3, IMAP für eingehenden sowie SMTP für ausgehenden Nachrichten) geprüft bevor die Email den eigentlichen Weg auf die Festplatte nehmen kann. Sollten Schädlinge gefunden werden, so können diese wenigen Klicks gelöscht werden. Es können sogar Teile der durch einen Virus beschädigten Dateien wiederhergestellt werden.<br />
Falls es doch mal zu einer schlimmen Infektion kommt, kann man sich mithilfe einer enthaltenen Notfall-CD der Schadsoftware erwehren.</p>
<p><a href="http://technologie4web.de/wp-content/uploads/2010/10/Virenscanner.jpg"><img src="http://technologie4web.de/wp-content/uploads/2010/10/Virenscanner.jpg" alt="Virenscanner Kaspersky Anti Virus 2011 Verlosung" title="Virenscanner" width="500" height="500" class="alignleft size-full wp-image-503" /></a></p>
<h2>Gewinnspiel</h2>
<p>Um an der Verlosung teilzunehmen habt Ihr mehrere Möglichkeiten:</p>
<ol>
<li>einen Artikel in eurem Blog über ein beliebiges Thema von Technologie4web.de schreiben und dabei einen Link auf den entsprechenden Artkel setzen. Bitte setzt die Trackback-Url dieses Artikels, damit ich euern Artikel als Teilnahmewunsch werten kann (falls euer Blogsystem kein Trackback unterstützt: schickt mir einefach eine email)!</li>
<li>ihr schreibt einen Kommentar in einem beliebigen Blog, der ein Thema behandelt, dass es ebenfalls auf technologie4web.de gibt und verlinkt unseren Artikel.</li>
<li>ihr habt eine viel bessere Idee und erzählt mir per email davon</li>
</ol>
<p>Der Gewinner wird per Los aus allen Teilnehmern am 6.12.2010 ermittelt und per email benachrichtigt.</p>
<p><a href="http://adt.traffictrack.de/go.cgi?pid=232&#038;wmid=811&#038;cpid=10&#038;prid=59&#038;target=Kaspersky_AV_LimEd_Pixel" rel="nofollow"><img src="https://adt.traffictrack.de/go.cgi?pid=232&#038;wmid=811&#038;cpid=10&#038;prid=59&#038;view=1&#038;target=http://www.traffictrack.de/tracking/shim.gif" height="1" width="1" border="0" title="Kaspersky Anti Virus 2011 Verlosung" alt="shim Kaspersky Anti Virus 2011 Verlosung" /></a></p>
<p><img src="https://adt.traffictrack.de/go.cgi?pid=232&#038;wmid=812&#038;cpid=10&#038;prid=59&#038;view=1" height="1" width="1" border="0" alt=" Kaspersky Anti Virus 2011 Verlosung"  title="Kaspersky Anti Virus 2011 Verlosung" /> </p>
<img src="http://feeds.feedburner.com/~r/WebTechnolgieBlog/~4/IQ0jxokLvQo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://technologie4web.de/kaspersky-anti-virus-2011-verlosung/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://technologie4web.de/kaspersky-anti-virus-2011-verlosung/</feedburner:origLink></item>
		<item>
		<title>Wie erstellt man ein effektives Blognetzwerk?</title>
		<link>http://feedproxy.google.com/~r/WebTechnolgieBlog/~3/ufny7lOYSU0/</link>
		<comments>http://technologie4web.de/effektives-blognetzwerk-erstellen/#comments</comments>
		<pubDate>Wed, 20 Oct 2010 08:26:43 +0000</pubDate>
		<dc:creator>Martin Kiesewetter</dc:creator>
				<category><![CDATA[SEO]]></category>

		<guid isPermaLink="false">http://technologie4web.de/?p=491</guid>
		<description><![CDATA[In diesem Artikel möchte ich euch anhand eines Beispiels zeigen, warum man ein Blognetzwerk erstellt, und wie das ganze effektive durchführt. Ein Blognetzwerk ist ein virtueller Zusammenschluss eigener Blogs mit dem Ziel die eigene Hauptwebseite (Seite, die Geld erwirtschaftet) zu verstärken. Dabei muss man etliches beachten: C-Class-Netzwerk, Domainregistrierung, Verlinkung im Blognetzwerk und Contentproduktion. Als Script [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://technologie4web.de/wp-content/uploads/2010/10/blognetzwerk-erstellen.jpg" alt="blognetzwerk erstellen Wie erstellt man ein effektives Blognetzwerk?" title="blognetzwerk-erstellen" width="120" height="120" class="bild-content-anfang" />In diesem Artikel möchte ich euch anhand eines Beispiels zeigen, <a href="#Ziele-Blognetzwerks">warum man ein Blognetzwerk</a> erstellt, und wie das ganze effektive durchführt. Ein Blognetzwerk ist ein virtueller Zusammenschluss eigener Blogs mit dem Ziel die eigene Hauptwebseite (Seite, die Geld erwirtschaftet) zu verstärken. Dabei muss man etliches beachten: <a href="/effektives-blognetzwerk-erstellen/#class-c-blog-netzwerk">C-Class-Netzwerk</a>, <a href="/effektives-blognetzwerk-erstellen#Domainregistrierung">Domainregistrierung</a>, <a href="/effektives-blognetzwerk-erstellen#Verlinkung-Blognetzwerk">Verlinkung im Blognetzwerk</a> und <a href="/effektives-blognetzwerk-erstellen#contenproduktion">Contentproduktion</a>. Als Script für das Blognetzwerk wird das kostenlose WordPress verwendet.<span id="more-491"></span></p>
<h2 id="Ziele-Blognetzwerks">Ziele des Blognetzwerks</h2>
<p>Ein Blognetzwerk kann helfen die folgenden vier Ziele der Hauptseite zu erreichen:</p>
<h3>1. Index-Tuning</h3>
<p>Sollte es auf der Hauptseite eine neue Unterseite geben, die möglichst schnell in die Serps aufgenommen werden soll, so ist es hilfreich einige Links im Blognetzwerk auf diese verweisen zu lassen. Da wir hier von einem WordPress-Blognetzwerk ausgehen werden neue Beiträge durch das Anpingen von Pingdiensten sehr zeitnah in die Suchmaschinen aufgenommen. Dadurch werden auch die verlinkten Seiten sehr schnell von den Suchmaschinen untersucht.</p>
<h3>2. Backlinktuning</h3>
<p>Jeder Link, der auf unsere Hauptseite verweist erhöht deren Ranking und damit die Besucherzahl und damit den Umsatz. Deshalb kann ein Blognetzwerk zum einen als direkten Linkgeber für die Hauptseite verwendet werden. Außerdem kann man äußerst effektiv Linktausch betreiben (z.B. ich gebe einen Link für deine Seite aus meinem Blognetzwerk und deine Seite verweist dafür auf meine Hauptseite).</p>
<h3>3. Keywordtuning</h3>
<p>Das Ranking der verlinkten Seite verbessert sich vor allem für die Worte, die im Anchor-Teil des Links stehen.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;a href=&quot;linkziel&quot;&gt;anchor&lt;/a&gt;</pre></div></div>

<p>Weil das Blognetzwerk uns gehört können wir die Anchortexte beliebig selber festlegen. Dadurch können wir sehr genau steuern für welche Keywords unsere Hauptseite besonders optimiert werden soll.</p>
<h3>4. Nischen beherrschen</h3>
<p>Jeder Blog des Netzwerks kann verwendet werden um eine ganz spezielle Nische abzudecken. Verkauft man auf der Hauptseite beispielsweise Fahrräder, so könnte es in einen Blog ausschießlich um Fahrradbremsen gehen. So könnte man die &#8220;Nische&#8221; Fahrradbremse leicht beherrschen. Je nachdem wie <a href="#wieviele-blogs-blognetzwerk">viele Blogs</a> man im Blognetzwerk hat könnte man auch eine noch feinere Nische finden (z.B. Fahrradbremsen für Down-Hill-Bikes).</p>
<h2 id="wieviele-blogs-blognetzwerk">Wieviele Blogs sollte ein Blognetzwerk umfassen</h2>
<p><strong>Je mehr, desto besser</strong>: Die Anzahl der Blogs im Blognetzwerk ist natürlich vom von den persönlichen Möglichkeiten (Zeit / Geld usw.) des Blognetzwerk-Besitzers abhängig, weil ein Blog von immer neuen Inhalten lebt, die manuell eingepflegt werden müssen. Das ganze lohnt sich umso mehr je mehr Geld man mit der Hauptseite verdienen könnte, wenn es keine Konkurrenz geben würde. Durch das Blognetzwerk verbessert man das Ranking seine Hauptseite in den Suchmaschinen, wodurch immer weniger Menschen die Seiten der Konkurrenz besuchen. Ich schlage für den Anfang einfach mal 20 Blogs vor und lasse offen, ob man später noch mehr Blogs betreuen kann.<br />
Das Hosting eines Blognetzwerks ist verhältnismäßig teuer, weil man immer versuchen sollte die Blogs auf möglichst viele <a href="#class-c-blog-netzwerk">Class-C Netzwerke</a> zu verteilen. Deshalb kann man nicht einfach <strong>einen Server</strong> mieten und zig Domains auf diesen verweise lassen. Vielmehr muss man entweder bei einem SEO-Hoster hosten oder manuell zig hosting-pakete bei verschiedenen Anbietern bestellen.</p>
<h2 id="class-c-blog-netzwerk">Class-C Netzwerk für Blognetzwerke</h2>
<p>Suchmaschinen versuchen anhand der IP-Adresse des Servers zu ermitteln, ob verschiedene Webprojekte zusammengehören und die Links &#8220;aus dem selben Haus kommen&#8221;. Solche Links sind für Suchmaschinen nicht besonders wertvoll, weil sie nicht natürlich entstanden sind. Natürlich entstandene Links wurden gesetzt, weil die verlinkte Seite nützliche Informationen enthält, auf die die verlinkende Seite hinweisen möchte. Kommen die Links aber vom gleichen Besitzer, so ist davon auszugehen, dass sie nur wegen des gleichen Besitzers überhaupt gesetzt wurden.</p>
<blockquote><p>Eine IP hat den typischen Aufbau: AAA.BBB.CCC.DDD. Sind 2 IPs im gleichen C-Classe-Netzwerk, so ist der Teil AAA.BBB.CCC. identisch.</p></blockquote>
<p>Einige Domainanbieter (z.b. Godaddy) bieten eine anonyme Registrierung an. Dadurch können Suchmaschinen nicht erkennen, dass die Domains der selben Person gehören (Admin-C-popularity). Beachtet werden sollte allerdings unbedingt, dass der Webhoster verschiedene Nameserver verwendet, weil Suchmaschinen auch anhand der Nameserver zusammenghörige Domains identifizieren kann.</p>
<p>Beim Hosting gibt es die Möglichkeiten: dedicated class-c ips und shared class-c ips. In der Regel ist shared billiger, weil viele Webseiten auf der selben IP laufen. Ideal ist es, wenn nur die eigene Webseite auf einer IP läuft. </p>
<h2 id="Domainregistrierung">Domainregistrierung</h2>
<p>Wie bei jeder SEO-Domain-Registrierung sollte man sich bereits vor der Registrierung über das Hauptkeyword der Seite im klaren sein und dieses im Domain-Namen verwenden (im Beispiel von oben z.B. &#8220;fahrrad-bremse-downhill.com&#8221;). Um wichtige Keywords für die Seite zu finden bietet sich wie immer das Google Traffc-Tool von Adwords an. Als nächstes sollte man beachten, dass man jeden Tag höchstens eine Domain registriert, damit Suschmaschinen nicht anhand des Registrierungsdatums erkennen können, das alle Domains am gleichen Tag entstanden sind. Hinweis: hier bieten sich ggf. auch wesentlich größere Zeitabstände als ein Tag an.</p>
<h2>Blogs aufsetzen</h2>
<p>WordPress Blogs lassen sich auch ohne Programmierkenntnisse innerhalb weniger Minuten installieren. Beachtet werden solllte, dass alle Blogs ein eigenes Theme (Design) und einen einzigartigen Titel verwenden. Kostenlose (SEO-)Wordpress-Designs gibt es massenhaft im Internet. Für Blogs, die als reine &#8220;Linkschleudern&#8221; eingesetzt werden sollen, sollte man ein Design verwenden, dass von Haus aus keine externen Links aufweist (z.B. zur Homepage des Designer). Hier kann man auch ein hässliches Design verwenden, solange es SEO-freundlich ist.<br />
Als nächstes sollte man ein <a href="http://www.wordpress.org/extend/plugins/all-in-one-seo-pack/">SEO-Plugin</a> installieren, um so den eigenen Blog SEO-freundlicher zu gestallten.</p>
<h2 id="contenproduktion">Die Blognetzwerktechnik steht &#8211; was nun</h2>
<blockquote><p>Jetzt beginnt die eigentliche Arbeit: einzigartige Texte müssen her!</p></blockquote>
<p>Am besten beobachtet man die Nachrichten aus dem entsprechenden Bereich un verfasst, wann immer es etwas interessantes gibt, einen Artikel zum Thema. Auf Content-Klau bzw. automatisierte Texte sollte man verzichten, weil Suchmaschinen doppelte Inhalte abstrafen.</p>
<h2 id="Verlinkung-Blognetzwerk">Verlinkung im Blognetzwerk</h2>
<p>Jetzt kommen wir zum wichtigsten Teil: Wie verlinke ich meine Blogs effektiv? Dazu gibt es einige grundlegende Regeln:</p>
<ol>
<li>verlinke niemals Blogs des selben Class-C-Netzwerks</li>
<li>verlinke niemals Blogs reziprok, d.h. Blog A verlinkt B und Blog B verlinkt Blog A</li>
<li>Links zur Hauptseite (Seite, die Geld bringt) sind immer erlaubt</li>
</ol>
<p>In der folgenden Grafik wird ein ideales beispielhaftes Blognetzwerk mit jeweils 3 Blogs in 4 Class-C-Netzen  dargstellt:<br />
<a href="http://technologie4web.de/wp-content/uploads/2010/10/blognetzwerk.jpg"><img src="http://technologie4web.de/wp-content/uploads/2010/10/blognetzwerk.jpg" alt="blognetzwerk Wie erstellt man ein effektives Blognetzwerk?" title="blognetzwerk" width="500" height="500" class="alignleft size-full wp-image-495" /></a><br />
Die blauen Kästen stellen ein Class-C-Netzwerk da. In jedem Class-C-Netzwerk gibt es eine gewisse Anzahl Blogs, die untereinander keine Verlinkung aufweisen. Die roten Pfeile symbolisieren externe Links. Für ein effektives Linknetzwerk sollte es stets mehr eingehende als ausgehende Links geben. Die Gelben Pfeile symbolisieren interne Links (also Links innerhalb des Blognetzwerks). Je mehr Class-C-Netzwerke es gibt, desto größer wird der Linkkreis und desto schwerer ist es für Suchmaschinen die Zusammengehörigkeit festzustellen. Es sollte nur die mit einem gelb Pfeil markierten internen Links geben, weil alle anderen Links den Suchmaschinen zeigen würde, dass es sich um zusammengehörige Projekte handelt.</p>
<img src="http://feeds.feedburner.com/~r/WebTechnolgieBlog/~4/ufny7lOYSU0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://technologie4web.de/effektives-blognetzwerk-erstellen/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://technologie4web.de/effektives-blognetzwerk-erstellen/</feedburner:origLink></item>
		<item>
		<title>IP optimal in Datenbank speichern</title>
		<link>http://feedproxy.google.com/~r/WebTechnolgieBlog/~3/jemq5BNHR6c/</link>
		<comments>http://technologie4web.de/ip-optimal-in-datenbank-speichern/#comments</comments>
		<pubDate>Mon, 18 Oct 2010 18:15:37 +0000</pubDate>
		<dc:creator>Martin Kiesewetter</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://technologie4web.de/?p=477</guid>
		<description><![CDATA[In (fast) allen Webprojekten werden die IP &#8216;s der Nutzer gespeichert. Solange die Seite nur wenige IP ´s speichert, ist das sicher kein Problem. Die Probleme beginnen, wenn sich nach einiger Zeit mehrere 10.000 Einträge angesammelt haben und die Suche nach einem speziellen Wert immer länger dauert. Wie man IP &#8216;s optimal in der Datenbank [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://technologie4web.de/wp-content/uploads/2010/10/ip-in-db.png" alt="ip in db IP optimal in Datenbank speichern" title="ip-in-db" width="120" height="120" class="bild-content-anfang" />In (fast) allen Webprojekten werden die IP &#8216;s der Nutzer gespeichert. Solange die Seite nur wenige IP ´s speichert, ist das sicher kein Problem. Die Probleme beginnen, wenn sich nach einiger Zeit mehrere 10.000 Einträge angesammelt haben und die Suche nach einem speziellen Wert immer länger dauert. Wie man IP &#8216;s optimal in der Datenbank speichert soll in diesm Beitrag geklärt werden.<span id="more-477"></span></p>
<h2>Mögliche Datenbank-Daten-Typen</h2>
<ol>
<li><strong>Datentyp Text:</strong> Braucht in MySQL genau 17 Byte (Textlänge + 2 Byte)</li>
<li><strong>Datentyp VarChar(15):</strong> Braucht in MySQL genau 16 Byte (Textlänge + 1 Byte)</li>
<li><strong>Datentyp Long:</strong> Braucht in MySQL genau 4 Byte</li>
</ol>
<p>Wie man an dieser Auflistung sieht verbraucht der Datentyp Long mit Abstand am wenigsten Speicher, d.h. die Datenbank wird im Verhältnis zu den anderen Möglichkeiten wesentlich kleiner. Dieser Speichervorteil kann durch die Datenbank-Engine: Storage noch weiter verbessert werden. Ein weiterer Vorteil liegt darin, dass Mysql Zahlen wesentlich schneller durchsuchen kann als Text.</p>
<h2>Wie kann man IPs in Long werte umwandeln?</h2>
<p>Dafür gibt es zwei Möglichkeiten, die performancetechnisch identisch sind. </p>
<h3>IP umwandeln mittels PHP</h3>
<p><a href="http://technologie4web.de/wp-content/uploads/2010/10/ip-in-db-effizient.jpg"><img src="http://technologie4web.de/wp-content/uploads/2010/10/ip-in-db-effizient.jpg" alt="ip in db effizient IP optimal in Datenbank speichern" title="ip-in-db-effizient" width="400" height="400" class="alignleft size-full wp-image-480" /></a> PHP bietet die netten Funktionen IP2LONG und LONG2IP. Damit lassen sich höchst komfortabel IPs in Long werte und Long-Werte in IP &#8216;s umwandeln. Bitte beachte: Die entstehenden Long-Werte können auch negative sein!</p>
<h3>IP umwandeln mittels Datenbank</h3>
<p>Alle (von mir untersuchten) Datenbanksysteme bietet eine eigene Implementierung der Funktionen. In Mysql  heißen diese beispielsweise INET_ATON bzw. INET_NTOA.</p>
<h2>Mein Testscript</h2>
<p>Mein Testscript funktioniert so:</p>
<ol>
<li>Test-Tabelle erstellen (in der jeweils die zu testenden Datentypen hinterlegt sind)</li>
<li>Test-Tabelle mit zufälligen IPs auffüllen</li>
<li>jeweils 500 Anfragen an jede Spalte der Test-Tabelle</li>
<li>Rückgabe der Resultate</li>
</ol>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$db_server</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;localhost&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$db_name</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;test&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$db_user</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;root&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$db_passwort</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Ab hier nichts mehr ändern!</span>
&nbsp;
<span style="color: #000088;">$db</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$db_server</span><span style="color: #339933;">,</span><span style="color: #000088;">$db_user</span><span style="color: #339933;">,</span><span style="color: #000088;">$db_passwort</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Konnte keine Verbindung zur Datenbank herstellen, bitte versuchen Sie es später erneut!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$db_check</span> <span style="color: #339933;">=</span> <span style="color: #990000;">MYSQL_SELECT_DB</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$db_name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Tabelle erstellen</span>
&nbsp;
<span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' CREATE TABLE `ip` (
`ip_int` INT NOT NULL ,
`ip_int_index` INT NOT NULL ,
`ip_varchar` VARCHAR( 15 ) NOT NULL ,
`ip_varchar_index` VARCHAR( 15 ) NOT NULL ,
`ip_text` TEXT NOT NULL ,
INDEX ( `ip_int_index` , `ip_varchar_index` )
) ENGINE = MYISAM '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">//Tabelle mit zufälligen IPs füllen</span>
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><span style="color: #000088;">$x</span><span style="color: #339933;">&lt;</span><span style="color: #cc66cc;">10000</span><span style="color: #339933;">;</span><span style="color: #000088;">$x</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$ip</span><span style="color: #339933;">=</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">150</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">244</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">254</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">254</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">254</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'insert into ip (ip_int,ip_int_index,ip_varchar,ip_varchar_index,ip_text) values (&quot;'</span><span style="color: #339933;">.</span><span style="color: #990000;">ip2long</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ip</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;,&quot;'</span><span style="color: #339933;">.</span><span style="color: #990000;">ip2long</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ip</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;,&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$ip</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;,&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$ip</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;,&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$ip</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;)'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'DB mit 10.000 IPs gefüllt&lt;br /&gt;'</span><span style="color: #339933;">;</span>  
<span style="color: #990000;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">//Zeit Messen: INT mit Index</span>
<span style="color: #000088;">$ip</span><span style="color: #339933;">=</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">150</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">244</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">254</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">254</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">254</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$t2</span><span style="color: #339933;">=</span><span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><span style="color: #000088;">$x</span><span style="color: #339933;">&lt;</span><span style="color: #cc66cc;">500</span><span style="color: #339933;">;</span><span style="color: #000088;">$x</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
  <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'select * from ip where ip_int_index=&quot;'</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">ip2long</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ip</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #000088;">$x</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; LIMIT 1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>  
<span style="color: #000088;">$t2</span><span style="color: #339933;">=</span><span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #000088;">$t2</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'INT (LONG) mit Index    :'</span><span style="color: #339933;">.</span><span style="color: #000088;">$t2</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' s&lt;br /&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #990000;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Zeit Messen: INT ohne Index</span>
<span style="color: #000088;">$ip</span><span style="color: #339933;">=</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">150</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">244</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">254</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">254</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">254</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$t1</span><span style="color: #339933;">=</span><span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><span style="color: #000088;">$x</span><span style="color: #339933;">&lt;</span><span style="color: #cc66cc;">500</span><span style="color: #339933;">;</span><span style="color: #000088;">$x</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
  <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'select * from ip where ip_int=&quot;'</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">ip2long</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ip</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #000088;">$x</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; LIMIT 1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$t1</span><span style="color: #339933;">=</span><span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #000088;">$t1</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'INT (LONG) ohne Index   :'</span><span style="color: #339933;">.</span><span style="color: #000088;">$t1</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' s&lt;br /&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #990000;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Zeit Messen: VarChar ohne Index</span>
<span style="color: #000088;">$ip</span><span style="color: #339933;">=</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">150</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">244</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">254</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">254</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">254</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$t3</span><span style="color: #339933;">=</span><span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><span style="color: #000088;">$x</span><span style="color: #339933;">&lt;</span><span style="color: #cc66cc;">500</span><span style="color: #339933;">;</span><span style="color: #000088;">$x</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
  <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'select * from ip where ip_varchar=&quot;'</span><span style="color: #339933;">.</span><span style="color: #990000;">long2ip</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">ip2long</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ip</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #000088;">$x</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; LIMIT 1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$t3</span><span style="color: #339933;">=</span><span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #000088;">$t3</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'VarChar (15) ohne Index   :'</span><span style="color: #339933;">.</span><span style="color: #000088;">$t3</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' s&lt;br /&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #990000;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Zeit Messen: VarChar mit Index</span>
<span style="color: #000088;">$ip</span><span style="color: #339933;">=</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">150</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">244</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">254</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">254</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">254</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$t4</span><span style="color: #339933;">=</span><span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><span style="color: #000088;">$x</span><span style="color: #339933;">&lt;</span><span style="color: #cc66cc;">500</span><span style="color: #339933;">;</span><span style="color: #000088;">$x</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
  <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'select * from ip where ip_varchar_index=&quot;'</span><span style="color: #339933;">.</span><span style="color: #990000;">long2ip</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">ip2long</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ip</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #000088;">$x</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; LIMIT 1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$t4</span><span style="color: #339933;">=</span><span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #000088;">$t4</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'VarChar (15) mit Index   :'</span><span style="color: #339933;">.</span><span style="color: #000088;">$t4</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' s&lt;br /&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #990000;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Zeit Messen: Text ohne Index</span>
<span style="color: #000088;">$ip</span><span style="color: #339933;">=</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">150</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">244</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">254</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">254</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">254</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$t5</span><span style="color: #339933;">=</span><span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><span style="color: #000088;">$x</span><span style="color: #339933;">&lt;</span><span style="color: #cc66cc;">500</span><span style="color: #339933;">;</span><span style="color: #000088;">$x</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
  <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'select * from ip where ip_text=&quot;'</span><span style="color: #339933;">.</span><span style="color: #990000;">long2ip</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">ip2long</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ip</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #000088;">$x</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; LIMIT 1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$t5</span><span style="color: #339933;">=</span><span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #000088;">$t5</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Text ohne Index  :'</span><span style="color: #339933;">.</span><span style="color: #000088;">$t5</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' s&lt;br /&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #990000;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
&nbsp;
&nbsp;
<span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DROP TABLE ip'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><strong>Hinweis:</strong>: Ich benutze für jede SQL-Anfrage eine unique IP (ip2long($ip)+$x). Grund dafür ist, dass ich verhindern möchte, dass die Ergebnis aus dem Query-Cache kommen!</p>
<h2>Ergebnisse meines Benchmarks</h2>
<h3>Benchmarkergebnisse</h3>
<table border="0">
<tbody>
<tr style="background-color:#454545;color:#fff">
<th>Variante</th>
<th>Speicherbedarf</th>
<th>Suchzeit in s</th>
</tr>
<tr style="background-color:lightgreen">
<td>INT (LONG) mit Index</td>
<td>4 Byte</td>
<td>0.104</td>
</tr>
<tr style="background-color:#FFFA75">
<td>VarChar(15) mit Index</td>
<td>16 Byte</td>
<td>2.794</td>
</tr>
<tr style="background-color:#FFFA75">
<td>VarChar(15) ohne Index</td>
<td>16 Byte</td>
<td>2.799</td>
</tr>
<tr style="background-color:#FFFA75">
<td>Text</td>
<td>17 Byte</td>
<td>2.804</td>
</tr>
<tr style="background-color:#FF9E9E">
<td>INT (LONG) ohne Index</td>
<td>4 Byte</td>
<td>2.981</td>
</tr>
</tbody>
</table>
<h2>Ergebnis</h2>
<p>Die Benchmarkergebnistabelle zeigt, dass die Abfragen der IP mit Datentyp INT (LONG) mit Index mit Abstand die schnellsten sind. Alles Andere ist etwa gleich langsam. Die Speichereinsparung von 75% der INT-Werte gegenüber Varchar oder Text sollte ebenfalls berücksichtigt werden! </p>
<h2>Update ip_v6</h2>
<p>Wer das ganze auch für ip_v6 braucht kann die folgende PHP-Funktion von <a href="http://php.net/manual/de/function.ip2long.php">php.net</a> verwenden:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$ipv6</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;2001:4860:a005::68&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> ip2long6<span style="color: #009900;">&#40;</span><span style="color: #000088;">$ipv6</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$ip_n</span> <span style="color: #339933;">=</span> inet_pton<span style="color: #009900;">&#40;</span><span style="color: #000088;">$ipv6</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$bits</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">15</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// 16 x 8 bit = 128bit</span>
  <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$bits</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$bin</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #009933; font-weight: bold;">%08b</span>&quot;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">ord</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ip_n</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$bits</span><span style="color: #009900;">&#93;</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: #000088;">$ipv6long</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$bin</span><span style="color: #339933;">.</span><span style="color: #000088;">$ipv6long</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$bits</span><span style="color: #339933;">--;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #990000;">gmp_strval</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">gmp_init</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ipv6long</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> long2ip6<span style="color: #009900;">&#40;</span><span style="color: #000088;">$ipv6long</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000088;">$bin</span> <span style="color: #339933;">=</span> <span style="color: #990000;">gmp_strval</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">gmp_init</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ipv6long</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">2</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: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$bin</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">128</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$pad</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">128</span> <span style="color: #339933;">-</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$bin</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;=</span> <span style="color: #000088;">$pad</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$bin</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;0&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$bin</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #000088;">$bits</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$bits</span> <span style="color: #339933;">&lt;=</span> <span style="color: #cc66cc;">7</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$bin_part</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$bin</span><span style="color: #339933;">,</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$bits</span><span style="color: #339933;">*</span><span style="color: #cc66cc;">16</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">16</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$ipv6</span> <span style="color: #339933;">.=</span> <span style="color: #990000;">dechex</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">bindec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$bin_part</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;:&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$bits</span><span style="color: #339933;">++;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #666666; font-style: italic;">// compress</span>
&nbsp;
  <span style="color: #b1b100;">return</span> inet_ntop<span style="color: #009900;">&#40;</span>inet_pton<span style="color: #009900;">&#40;</span><span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ipv6</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: #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;">print</span> <span style="color: #000088;">$ipv6long</span> <span style="color: #339933;">=</span>  ip2long6<span style="color: #009900;">&#40;</span><span style="color: #000088;">$ipv6</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</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: #b1b100;">print</span> <span style="color: #000088;">$ipv6</span> <span style="color: #339933;">=</span> long2ip6<span style="color: #009900;">&#40;</span><span style="color: #000088;">$ipv6long</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<img src="http://feeds.feedburner.com/~r/WebTechnolgieBlog/~4/jemq5BNHR6c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://technologie4web.de/ip-optimal-in-datenbank-speichern/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		<feedburner:origLink>http://technologie4web.de/ip-optimal-in-datenbank-speichern/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 1.951 seconds. --><!-- Cached page generated by WP-Super-Cache on 2012-02-20 14:20:39 --><!-- Compression = gzip -->

