<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet href="/blog/templates/default/atom.css" type="text/css" ?>

<feed 
   xmlns="http://www.w3.org/2005/Atom"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/">
    <link href="http://frank-seitz.de/blog/index.php?/feeds/atom10.xml" rel="self" title="Frank Seitz' Developer Logbuch" type="application/atom+xml" />
    <link href="http://fseitz.de/blog/"                        rel="alternate"    title="Frank Seitz' Developer Logbuch" type="text/html" />
    <link href="http://fseitz.de/blog/rss.php?version=2.0"     rel="alternate"    title="Frank Seitz' Developer Logbuch" type="application/rss+xml" />
    <title type="html">Frank Seitz' Developer Logbuch</title>
    <subtitle type="html">Notizen aus der Welt der Web-, Datenbank- und Unix-Programmierung</subtitle>
    <icon>http://fseitz.de/blog/templates/default/img/s9y_banner_small.png</icon>
    <id>http://fseitz.de/blog/</id>
    <updated>2010-06-02T06:34:16Z</updated>
    <generator uri="http://www.s9y.org/" version="1.5.1">Serendipity 1.5.1 - http://www.s9y.org/</generator>
    <dc:language>de</dc:language>

    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/41-CSS-Listen-portabel-einruecken.html" rel="alternate" title="CSS: Listen portabel einrücken" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-05-31T14:41:10Z</published>
        <updated>2010-06-02T06:34:16Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=41</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=41</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/20-CSS" label="CSS" term="CSS" />
    
        <id>http://fseitz.de/blog/index.php?/archives/41-guid.html</id>
        <title type="html">CSS: Listen portabel einrücken</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p class="sdoc-para-p">
  Die Browser benutzen unterschiedliche Wege, Listen einzurücken.
  Einige rücken per <i class="sdoc-seg-i">Padding</i> ein, andere per <i class="sdoc-seg-i">Margin</i>.
</p>
<p class="sdoc-para-p">
  Soll die Einrückung portabel verändert werden, müssen
  <tt class="sdoc-seg-c">margin-left</tt> uns <tt class="sdoc-seg-c">padding-left</tt> also zusammen gesetzt
  werden, und zwar eine Angabe auf die gewünschte Einrückung
  und die andere auf 0.
</p>
<table class="sdoc-code-table" cellpadding="0" cellspacing="0">
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 1</td>
  <td class="sdoc-code-td-line"><span class="hl kwb">ul</span> <span class="hl sym">{</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 2</td>
  <td class="sdoc-code-td-line">    <span class="hl kwa">padding-left</span><span class="hl sym">:</span> <span class="hl num">20px</span><span class="hl sym">;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 3</td>
  <td class="sdoc-code-td-line">    <span class="hl kwa">margin-left</span><span class="hl sym">:</span> <span class="hl num">0</span><span class="hl sym">;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 4</td>
  <td class="sdoc-code-td-line"><span class="hl sym">}</span></td>
</tr>
</table>
<p class="sdoc-para-p">
  oder
</p>
<table class="sdoc-code-table" cellpadding="0" cellspacing="0">
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 1</td>
  <td class="sdoc-code-td-line"><span class="hl kwb">ul</span> <span class="hl sym">{</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 2</td>
  <td class="sdoc-code-td-line">    <span class="hl kwa">padding-left</span><span class="hl sym">:</span> <span class="hl num">0</span><span class="hl sym">;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 3</td>
  <td class="sdoc-code-td-line">    <span class="hl kwa">margin-left</span><span class="hl sym">:</span> <span class="hl num">20px</span><span class="hl sym">;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 4</td>
  <td class="sdoc-code-td-line"><span class="hl sym">}</span></td>
</tr>
</table> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/40-HTML-Konstrukte-mit-CSS-gestalten.html" rel="alternate" title="HTML-Konstrukte mit CSS gestalten" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-05-30T11:35:05Z</published>
        <updated>2010-06-22T06:04:01Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=40</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=40</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/20-CSS" label="CSS" term="CSS" />
    
        <id>http://fseitz.de/blog/index.php?/archives/40-guid.html</id>
        <title type="html">HTML-Konstrukte mit CSS gestalten</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <h1 class="sdoc-sec-h1">Problem</h1>
<p class="sdoc-para-p">
  Ein aus mehreren Elementen bestehendes HTML-Konstrukt soll in seinem
  Aussehen frei gestaltbar sein. Wie lässt sich dies mit CSS erreichen?
</p>
<h1 class="sdoc-sec-h1">Beispiel</h1>
<p class="sdoc-para-p">
  Gegeben sei ein Inhaltsverzeichnis, bestehend aus einer Überschrift
  (h1) und verschachtelten Listen (ul, li) mit Links (a) auf die
  Dokument-Abschnitte.
</p>
<table class="sdoc-code-table" cellpadding="0" cellspacing="0">
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 1</td>
  <td class="sdoc-code-td-line"><span class="hl kwa">&lt;h1&gt;</span>Title<span class="hl kwa">&lt;/h1&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 2</td>
  <td class="sdoc-code-td-line"><span class="hl kwa">&lt;ul&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 3</td>
  <td class="sdoc-code-td-line">  <span class="hl kwa">&lt;li&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 4</td>
  <td class="sdoc-code-td-line">    <span class="hl kwa">&lt;a</span> <span class="hl kwb">href</span>=<span class="hl str">&quot;#section_1&quot;</span><span class="hl kwa">&gt;</span>Section <span class="hl num">1</span><span class="hl kwa">&lt;/a&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 5</td>
  <td class="sdoc-code-td-line">    <span class="hl kwa">&lt;ul&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 6</td>
  <td class="sdoc-code-td-line">      <span class="hl kwa">&lt;li&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 7</td>
  <td class="sdoc-code-td-line">        <span class="hl kwa">&lt;a</span> <span class="hl kwb">href</span>=<span class="hl str">&quot;#section_1_1&quot;</span><span class="hl kwa">&gt;</span>Section <span class="hl num">1.1</span><span class="hl kwa">&lt;/a&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 8</td>
  <td class="sdoc-code-td-line">        <span class="hl kwa">&lt;ul&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 9</td>
  <td class="sdoc-code-td-line">          <span class="hl kwa">&lt;li&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">10</td>
  <td class="sdoc-code-td-line">            <span class="hl kwa">&lt;a</span> <span class="hl kwb">href</span>=<span class="hl str">&quot;#section_1_1_1&quot;</span><span class="hl kwa">&gt;</span>Section <span class="hl num">1.1.1</span><span class="hl kwa">&lt;/a&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">11</td>
  <td class="sdoc-code-td-line">          <span class="hl kwa">&lt;/li&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">12</td>
  <td class="sdoc-code-td-line">          <span class="hl kwa">&lt;li&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">13</td>
  <td class="sdoc-code-td-line">            <span class="hl kwa">&lt;a</span> <span class="hl kwb">href</span>=<span class="hl str">&quot;#section_1_1_2&quot;</span><span class="hl kwa">&gt;</span>Section <span class="hl num">1.1.2</span><span class="hl kwa">&lt;/a&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">14</td>
  <td class="sdoc-code-td-line">          <span class="hl kwa">&lt;/li&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">15</td>
  <td class="sdoc-code-td-line">        <span class="hl kwa">&lt;/ul&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">16</td>
  <td class="sdoc-code-td-line">      <span class="hl kwa">&lt;/li&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">17</td>
  <td class="sdoc-code-td-line">      <span class="hl kwa">&lt;li&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">18</td>
  <td class="sdoc-code-td-line">        <span class="hl kwa">&lt;a</span> <span class="hl kwb">href</span>=<span class="hl str">&quot;#section_1_2&quot;</span><span class="hl kwa">&gt;</span>Section <span class="hl num">1.2</span><span class="hl kwa">&lt;/a&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">19</td>
  <td class="sdoc-code-td-line">      <span class="hl kwa">&lt;/li&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">20</td>
  <td class="sdoc-code-td-line">    <span class="hl kwa">&lt;/ul&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">21</td>
  <td class="sdoc-code-td-line">  <span class="hl kwa">&lt;/li&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">22</td>
  <td class="sdoc-code-td-line">  <span class="hl kwa">&lt;li&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">23</td>
  <td class="sdoc-code-td-line">    <span class="hl kwa">&lt;a</span> <span class="hl kwb">href</span>=<span class="hl str">&quot;#section_2&quot;</span><span class="hl kwa">&gt;</span>Section <span class="hl num">2</span><span class="hl kwa">&lt;/a&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">24</td>
  <td class="sdoc-code-td-line">  <span class="hl kwa">&lt;/li&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">25</td>
  <td class="sdoc-code-td-line"><span class="hl kwa">&lt;/ul&gt;</span></td>
</tr>
</table>
<p class="sdoc-para-p">
  Der HTML-Code wird ohne CSS vom Browser (Firefox) ungefähr so dargestellt
  (die Strukturelemente für den Titel (h1) und die Listen (ul) sind zur
  Verdeutlichung grau hinterlegt):
</p>
<p class="sdoc-fig-p">
  <img class="sdoc-fig-img" style="display:block" src="uploads/inhaltsverz.png" width="300" height="129" alt="" />
</p>
<h1 class="sdoc-sec-h1">Lösung</h1>
<p class="sdoc-para-p">
  Um ein HTML-Konstrukt aus mehreren Elementen per CSS anpassbar zu
  machen, gehen wir folgendermaßen vor:
</p>
<ul class="sdoc-list-ul">
  <li class="sdoc-list-li-point" style="list-style-type:disc">
    <p class="sdoc-para-p">
      Wir geben dem Wurzelelement des Konstruktes eine eindeutige Bezeichnung
      und weisen ihm hierzu eine Id oder einen Klassennamen (oder beides) zu.
    </p>
    <table class="sdoc-code-table" cellpadding="0" cellspacing="0">
    <tr class="sdoc-code-tr-odd">
      <td class="sdoc-code-td-ln"> 1</td>
      <td class="sdoc-code-td-line"><span class="hl kwa">&lt;ELEMENT</span> <span class="hl kwb">id</span>=<span class="hl str">&quot;my-toc-4711&quot;</span> <span class="hl kwb">class</span>=<span class="hl str">&quot;my-toc&quot;</span><span class="hl kwa">&gt;</span></td>
    </tr>
    <tr class="sdoc-code-tr-even">
      <td class="sdoc-code-td-ln"> 2</td>
      <td class="sdoc-code-td-line">  ...</td>
    </tr>
    <tr class="sdoc-code-tr-odd">
      <td class="sdoc-code-td-ln"> 3</td>
      <td class="sdoc-code-td-line"><span class="hl kwa">&lt;/ELEMENT&gt;</span></td>
    </tr>
    </table>
    <p class="sdoc-para-p">
      Eine Id verwenden wir, wenn wir ein bestimmte Instanz des Konstrukts
      gestalten wollen. Wollen wir alle Instanzen des Konstruktes
      gestalten, verwenden wir einen Klassennamen.
    </p>
  </li>
  <li class="sdoc-list-li-point" style="list-style-type:disc">
    <p class="sdoc-para-p">
      Hat das Konstrukt kein Wurzelelement, wie im Beispiel, denn auf
      oberster Ebene stehen hier <i class="sdoc-seg-i">zwei</i> Elemente: h1 und ul, erzeugen wir
      eins, indem wir das Konstrukt in ein &lt;div&gt; einfassen.
    </p>
    <table class="sdoc-code-table" cellpadding="0" cellspacing="0">
    <tr class="sdoc-code-tr-odd">
      <td class="sdoc-code-td-ln"> 1</td>
      <td class="sdoc-code-td-line"><span class="hl kwa">&lt;div</span> <span class="hl kwb">class</span>=<span class="hl str">&quot;my-toc&quot;</span><span class="hl kwa">&gt;</span></td>
    </tr>
    <tr class="sdoc-code-tr-even">
      <td class="sdoc-code-td-ln"> 2</td>
      <td class="sdoc-code-td-line">  HTML</td>
    </tr>
    <tr class="sdoc-code-tr-odd">
      <td class="sdoc-code-td-ln"> 3</td>
      <td class="sdoc-code-td-line"><span class="hl kwa">&lt;/div&gt;</span></td>
    </tr>
    </table>
    <p class="sdoc-para-p">
      Ein Wurzelelement zu haben, ist in vielerlei Hinsicht praktisch,
      denn es kann Definitionen aufnehmen, die das Konstrukt als Ganzes
      (Hintergrund, Abstände, etc.) oder alle seine Subelemente
      betreffen (Texteigenschaften etc.).
    </p>
  </li>
  <li class="sdoc-list-li-point" style="list-style-type:disc">
    <p class="sdoc-para-p">
      Im Stylesheet adressieren wir die Elemente ausgehend vom Wurzelelement
      mit entsprechenden Selektoren. Bei obiger Inhaltsverzeichnis-Struktur
      könnte dies so aussehen:
    </p>
    <table class="sdoc-code-table" cellpadding="0" cellspacing="0">
    <tr class="sdoc-code-tr-odd">
      <td class="sdoc-code-td-ln"> 1</td>
      <td class="sdoc-code-td-line"><span class="hl kwc">.my-toc</span> <span class="hl sym">{</span></td>
    </tr>
    <tr class="sdoc-code-tr-even">
      <td class="sdoc-code-td-ln"> 2</td>
      <td class="sdoc-code-td-line">    <span class="hl com">/* das gesamte Konstrukt */</span></td>
    </tr>
    <tr class="sdoc-code-tr-odd">
      <td class="sdoc-code-td-ln"> 3</td>
      <td class="sdoc-code-td-line"><span class="hl sym">}</span></td>
    </tr>
    <tr class="sdoc-code-tr-even">
      <td class="sdoc-code-td-ln"> 4</td>
      <td class="sdoc-code-td-line"><span class="hl kwc">.my-toc h1</span> <span class="hl sym">{</span></td>
    </tr>
    <tr class="sdoc-code-tr-odd">
      <td class="sdoc-code-td-ln"> 5</td>
      <td class="sdoc-code-td-line">    <span class="hl com">/* die Überschrift */</span></td>
    </tr>
    <tr class="sdoc-code-tr-even">
      <td class="sdoc-code-td-ln"> 6</td>
      <td class="sdoc-code-td-line"><span class="hl sym">}</span></td>
    </tr>
    <tr class="sdoc-code-tr-odd">
      <td class="sdoc-code-td-ln"> 7</td>
      <td class="sdoc-code-td-line"><span class="hl kwc">.my-toc ul</span> <span class="hl sym">{</span></td>
    </tr>
    <tr class="sdoc-code-tr-even">
      <td class="sdoc-code-td-ln"> 8</td>
      <td class="sdoc-code-td-line">    <span class="hl com">/* die Liste der Ebene 1 */</span></td>
    </tr>
    <tr class="sdoc-code-tr-odd">
      <td class="sdoc-code-td-ln"> 9</td>
      <td class="sdoc-code-td-line"><span class="hl sym">}</span></td>
    </tr>
    <tr class="sdoc-code-tr-even">
      <td class="sdoc-code-td-ln">10</td>
      <td class="sdoc-code-td-line"><span class="hl kwc">.my-toc ul ul</span> <span class="hl sym">{</span></td>
    </tr>
    <tr class="sdoc-code-tr-odd">
      <td class="sdoc-code-td-ln">11</td>
      <td class="sdoc-code-td-line">    <span class="hl com">/* die Listen der Ebene 2 */</span></td>
    </tr>
    <tr class="sdoc-code-tr-even">
      <td class="sdoc-code-td-ln">12</td>
      <td class="sdoc-code-td-line"><span class="hl sym">}</span></td>
    </tr>
    <tr class="sdoc-code-tr-odd">
      <td class="sdoc-code-td-ln">13</td>
      <td class="sdoc-code-td-line"><span class="hl kwc">.my-toc ul ul ul</span> <span class="hl sym">{</span></td>
    </tr>
    <tr class="sdoc-code-tr-even">
      <td class="sdoc-code-td-ln">14</td>
      <td class="sdoc-code-td-line">    <span class="hl com">/* die Listen der Ebene 3 und tiefer */</span></td>
    </tr>
    <tr class="sdoc-code-tr-odd">
      <td class="sdoc-code-td-ln">15</td>
      <td class="sdoc-code-td-line"><span class="hl sym">}</span></td>
    </tr>
    <tr class="sdoc-code-tr-even">
      <td class="sdoc-code-td-ln">16</td>
      <td class="sdoc-code-td-line"><span class="hl kwc">.my-toc a</span> <span class="hl sym">{</span></td>
    </tr>
    <tr class="sdoc-code-tr-odd">
      <td class="sdoc-code-td-ln">17</td>
      <td class="sdoc-code-td-line">    <span class="hl com">/* alle Links */</span></td>
    </tr>
    <tr class="sdoc-code-tr-even">
      <td class="sdoc-code-td-ln">18</td>
      <td class="sdoc-code-td-line"><span class="hl sym">}</span></td>
    </tr>
    </table>
  </li>
  <li class="sdoc-list-li-point" style="list-style-type:disc">
    <p class="sdoc-para-p">
      Weitere Klassennamen oder Ids werden innerhalb des Konstruktes nicht
      benötigt, es sei denn, es liegt der eher seltene Fall vor, dass CSS-Selektoren
      die erforderliche Elementauswahl nicht treffen können. Beispiel: gerade
      oder ungerade Zeilen einer Tabelle.
    </p>
  </li>
</ul> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/39-Perl-POD-als-Programm-Hilfetext.html" rel="alternate" title="Perl: POD als Programm-Hilfetext" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-05-20T08:59:21Z</published>
        <updated>2010-05-28T04:12:31Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=39</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=39</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/1-Perl" label="Perl" term="Perl" />
    
        <id>http://fseitz.de/blog/index.php?/archives/39-guid.html</id>
        <title type="html">Perl: POD als Programm-Hilfetext</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p class="sdoc-para-p">
  Das Core-Modul <tt class="sdoc-seg-c">Pod::Usage</tt> kann einen Programm-Hilfetext aus der
  eingebetteten POD-Dokumentation generieren. Es geht auch einfacher:
</p>
<table class="sdoc-code-table" cellpadding="0" cellspacing="0">
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 1</td>
  <td class="sdoc-code-td-line">#!/usr/bin/env perl</td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 2</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 3</td>
  <td class="sdoc-code-td-line"><span class="pt-k">use</span> <span class="pt-w">strict</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 4</td>
  <td class="sdoc-code-td-line"><span class="pt-k">use</span> <span class="pt-w">warnings</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 5</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 6</td>
  <td class="sdoc-code-td-line"><span class="pt-pd">=head1 NAME</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 7</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 8</td>
  <td class="sdoc-code-td-line"><span class="pt-pd">myprog - a simple program</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 9</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">10</td>
  <td class="sdoc-code-td-line"><span class="pt-pd">=head1 LICENSE</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">11</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">12</td>
  <td class="sdoc-code-td-line"><span class="pt-pd">This program is free software; you can redistribute it and/or</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">13</td>
  <td class="sdoc-code-td-line"><span class="pt-pd">modify it under the same terms as Perl itself.</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">14</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">15</td>
  <td class="sdoc-code-td-line"><span class="pt-pd">=cut</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">16</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">17</td>
  <td class="sdoc-code-td-line"><span class="pt-k">exec</span> <span class="pt-q">&#39;pod2text&#39;</span><span class="pt-cm">,</span><span class="pt-i">$0</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">18</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">19</td>
  <td class="sdoc-code-td-line"><span class="pt-c"># eof</span></td>
</tr>
</table>
<p class="sdoc-para-p">
  produziert auf STDOUT
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">NAME&#10;    myprog - a simple program&#10;&#10;LICENSE&#10;    This program is free software; you can redistribute it and/or modify it&#10;    under the same terms as Perl itself.&#10;&#10;</pre>
</div> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/38-Medion-Life-S60003-MP3-Player-unter-Debian.html" rel="alternate" title="Medion Life S60003 MP3 Player unter Debian" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-05-18T23:08:24Z</published>
        <updated>2010-05-20T07:01:14Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=38</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=38</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/19-Audio" label="Audio" term="Audio" />
    
        <id>http://fseitz.de/blog/index.php?/archives/38-guid.html</id>
        <title type="html">Medion Life S60003 MP3 Player unter Debian</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p class="sdoc-para-p">
  Der Medion Life S60003 ist ein einfacher Player zum Abspielen
  von MP3- und WMA-Dateien.
</p>
<p class="sdoc-para-p">
  Zum Datenaustausch wird dieser auf einen freien USB-Port gesteckt.
  Der Player wechselt in den Zustand "USB Connected". Wird gerade
  ein Titel gespielt, muss die Wiedergabe erst angehalten werden.
</p>
<h1 class="sdoc-sec-h1">Zugriff auf das Dateisystem des Players</h1>
<p class="sdoc-para-p">
  Der Player wird von udev erkannt und vom System automatisch auf ein
  Verzeichnis unter <tt class="sdoc-seg-c">/media</tt> gemountet. Der Vorgang wird in
  <tt class="sdoc-seg-c">/var/log/messages</tt> protokolliert:
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">usb 3-1: new high speed USB device using ehci_hcd and address 18&#10;usb 3-1: New USB device found, idVendor=066f, idProduct=8588&#10;usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=5&#10;usb 3-1: Product: MD 83366&#10;usb 3-1: Manufacturer: Medion&#10;usb 3-1: SerialNumber: 43F9000056B398A30002D8F515A958A3&#10;usb 3-1: configuration #1 chosen from 1 choice&#10;scsi18 : SCSI emulation for USB Mass Storage devices&#10;scsi 18:0:0:0: Direct-Access   Medion   MD 83366   0100 PQ: 0 ANSI: 4&#10;scsi 18:0:0:1: Direct-Access   Medion   MD 83366   0100 PQ: 0 ANSI: 4&#10;sd 18:0:0:0: [sdc] 478976 4096-byte logical blocks: (1.96 GB/1.82 GiB)&#10;sd 18:0:0:0: [sdc] Write Protect is off&#10;sd 18:0:0:0: [sdc] 478976 4096-byte logical blocks: (1.96 GB/1.82 GiB)&#10;sd 18:0:0:1: [sdd] Attached SCSI removable disk&#10; sdc:&#10;sd 18:0:0:0: [sdc] 478976 4096-byte logical blocks: (1.96 GB/1.82 GiB)&#10;sd 18:0:0:0: [sdc] Attached SCSI removable disk</pre>
</div>
<p class="sdoc-para-p">
  Der Mountpoint lässt sich mit <tt class="sdoc-seg-c">mount(1)</tt> herausfinden:
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">$ mount&#10;...&#10;/dev/sdc on /media/87C9-FFD0 type vfat (rw,nosuid,nodev,uhelper=udisks,&#10;  uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,flush)</pre>
</div>
<p class="sdoc-para-p">
  Eigentlich ist der Flash-Speicher des Players nicht direkt
  mountbar. Vielmehr wird der Player als MTP-Gerät
  (<a class="sdoc-seg-u" href="http://de.wikipedia.org/wiki/Media_Transfer_Protocol">http://de.wikipedia.org/wiki/Media_Transfer_Protocol</a>) angesprochen. Der Eintrag in
  <tt class="sdoc-seg-c">/lib/udev/rules.d/45-libmtp8.rules</tt> lautet:
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre"># Medion MD8333&#10;ATTR{idVendor}=="066f", ATTR{idProduct}=="8588", SYMLINK+="libmtp-%k",&#10;  MODE="660", GROUP="audio"</pre>
</div>
<p class="sdoc-para-p">
  Der Player kann, wenn obiges Setup stimmt, auch per Hand gemountet
  werden:
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre"># mount /dev/sdX /mnt</pre>
</div>
<p class="sdoc-para-p">
  <tt class="sdoc-seg-c">X</tt> ist der Buchstabe des SCSI-Geräts <i class="sdoc-seg-i">ohne</i> eine Partitionsnummer,
  hier: <tt class="sdoc-seg-c">/dev/sdc</tt>.
</p>
<p class="sdoc-para-p">
  Ist unter <i class="sdoc-seg-i">System/Preferences/File Management/Media</i> (Gnome) die
  Option "Browse Media when inserted" aktiviert, wird von Gnome der File
  Browser Nautilus auf dem Verzeichnis gestartet, wenn es automatisch
  gemountet wird.
</p>
<p class="sdoc-para-p">
  <b class="sdoc-seg-b">Aber ACHTUNG:</b> Dies alles klappt nicht, wenn der Gnome
  Audio-Player Rhythmbox läuft! Dieser nimmt selbst mit dem Player
  via MTP Kontakt auf. Offenbar kann der Player nicht gleichzeitig
  gemountet sein, d.h. ein etwaiger Mount - egal ob automatisch
  oder manuell aufgebaut - wird sofort wieder abgebaut oder
  anderweitig gestört.
</p>
<h1 class="sdoc-sec-h1">Dateien übertragen</h1>
<p class="sdoc-para-p">
  Gemountet kann der Player als Datenträger für beliebige
  Dateien und Verzeichnisstrukturen verwendet werden.
</p>
<p class="sdoc-para-p">
  Auch die Musiksammlung kann theoretisch mittels
  Dateisystem-Operationen auf dem Player verwaltet werden. Dies ist
  allerdings nicht praktikabel, da der Player die in den MP3-Dateien
  enthaltenen ID3-Tags <i class="sdoc-seg-i">nicht</i> auswertet. Werden MP3-Dateien einfach
  nur kopiert, befinden sie sich anschließend zwar auf dem Player und
  können gespielt werden, aber der Player "weiß" nichts über ihren
  Inhalt und kann dem Benutzer die zur Unterscheidung wichtigen
  Informationen Titel, Künstler, Album, Jahr, Genre nicht präsentieren.
</p>
<p class="sdoc-para-p">
  Daher ist es besser, die Dateien mit Rhythmbox - oder einem anderen
  Programm, welches Musikdateien per MTP verwaltet - zu übertragen. Der
  Player erhält dann auch die Meta-Information zu den Dateien.
</p> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/37-Perl-Plus-Minus-Unendlich.html" rel="alternate" title="Perl: Plus / Minus Unendlich" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-03-25T07:23:55Z</published>
        <updated>2010-05-18T23:07:43Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=37</wfw:comment>
    
        <slash:comments>1</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=37</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/1-Perl" label="Perl" term="Perl" />
    
        <id>http://fseitz.de/blog/index.php?/archives/37-guid.html</id>
        <title type="html">Perl: Plus / Minus Unendlich</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p class="sdoc-para-p">
  Perl kennt mehrere Zeichenketten, die - numerisch interpretiert - plus
  und minus Unendlich bedeuten.
</p>
<table class="sdoc-keyval-table">
<tr class="sdoc-keyval-tr">
  <td class="sdoc-keyval-td-key">Plus Unendlich:</td>
  <td class="sdoc-keyval-td-value"><tt class="sdoc-seg-c">'+inf'</tt>, <tt class="sdoc-seg-c">'+infinity'</tt>, <tt class="sdoc-seg-c">'inf'</tt>, <tt class="sdoc-seg-c">'infinity'</tt></td>
</tr>
<tr class="sdoc-keyval-tr">
  <td class="sdoc-keyval-td-key">Minus Unendlich:</td>
  <td class="sdoc-keyval-td-value"><tt class="sdoc-seg-c">'-inf'</tt>, <tt class="sdoc-seg-c">'-infinity'</tt></td>
</tr>
</table>
<p class="sdoc-para-p">
  <b class="sdoc-seg-b">Beispiel:</b> Maximum ermitteln
</p>
<table class="sdoc-code-table" cellpadding="0" cellspacing="0">
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 1</td>
  <td class="sdoc-code-td-line"><span class="pt-k">my</span> <span class="pt-i">$max</span> = <span class="pt-q">&#39;-inf&#39;</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 2</td>
  <td class="sdoc-code-td-line"><span class="pt-k">for</span> <span class="pt-k">my</span> <span class="pt-i">$n</span> <span class="pt-s">(</span><span class="pt-n">-100</span><span class="pt-cm">,</span><span class="pt-n">-10</span><span class="pt-cm">,</span><span class="pt-n">-50</span><span class="pt-s">)</span> <span class="pt-s">{</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 3</td>
  <td class="sdoc-code-td-line">    <span class="pt-i">$max</span> = <span class="pt-i">$n</span> <span class="pt-k">if</span> <span class="pt-i">$n</span> &gt; <span class="pt-i">$max</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 4</td>
  <td class="sdoc-code-td-line"><span class="pt-s">}</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 5</td>
  <td class="sdoc-code-td-line"><span class="pt-k">say</span> <span class="pt-i">$max</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 6</td>
  <td class="sdoc-code-td-line"><a name="__END__"></a><span class="pt-k">__END__</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 7</td>
  <td class="sdoc-code-td-line"><span class="pt-q">-10</span></td>
</tr>
</table>
<p class="sdoc-para-p">
  <b class="sdoc-seg-b">Aber Achtung:</b> Diese besonderen Werte sind nicht sonderlich gut
  dokumentiert und scheinen bei einigen Windows-Ports nicht zu
  funktionieren. Siehe:
  <a class="sdoc-seg-u" href="http://reneeb-perlblog.blogspot.com/2010/03/unendliches-perl.html">http://reneeb-perlblog.blogspot.com/2010/03/unendliches-perl.html</a>
</p> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/35-Perl-Dirhandles-objektorientiert.html" rel="alternate" title="Perl: Dirhandles objektorientiert" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-03-18T21:41:26Z</published>
        <updated>2010-03-31T09:31:24Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=35</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=35</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/1-Perl" label="Perl" term="Perl" />
    
        <id>http://fseitz.de/blog/index.php?/archives/35-guid.html</id>
        <title type="html">Perl: Dirhandles objektorientiert</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p class="sdoc-para-p">
  Analog zu lexikalischen Filehandles besitzt Perl lexikalische
  Dirhandles. Eine Dirhandle ist ein Iterator über einem Verzeichnis.
  Die Operationen auf Dirhandles lassen sich objektorientiert kapseln.
</p>
<p class="sdoc-para-p">
  Hier eine entsprechende Klasse <tt class="sdoc-seg-c">Dirhandle</tt> mit drei
  Methoden: <tt class="sdoc-seg-c">new()</tt> (Directory öffnen), <tt class="sdoc-seg-c">close()</tt> (Directory
  schließen) und <tt class="sdoc-seg-c">next()</tt> (nächster Directory-Eintrag):
</p>
<table cellpadding="0" cellspacing="0" class="sdoc-code-table">
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 1</td>
  <td class="sdoc-code-td-line"><a name="package-Dirhandle"></a><span class="pt-k">package </span><span class="pt-i">Dirhandle</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 2</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 3</td>
  <td class="sdoc-code-td-line"><span class="pt-k">use</span> <span class="pt-w">strict</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 4</td>
  <td class="sdoc-code-td-line"><span class="pt-k">use</span> <span class="pt-w">warnings</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 5</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 6</td>
  <td class="sdoc-code-td-line"><a name="new"></a><span class="pt-k">sub </span><span class="pt-m">new</span> <span class="pt-s">{</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 7</td>
  <td class="sdoc-code-td-line">    <span class="pt-k">my</span> <span class="pt-s">(</span><span class="pt-i">$class</span><span class="pt-cm">,</span><span class="pt-i">$dir</span><span class="pt-s">)</span> = <span class="pt-i">@_</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 8</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 9</td>
  <td class="sdoc-code-td-line">    <span class="pt-k">opendir</span> <span class="pt-k">my</span> <span class="pt-i">$dh</span><span class="pt-cm">,</span><span class="pt-i">$dir</span> <span class="pt-k">or</span> <span class="pt-k">die</span> <span class="pt-q">&quot;ERROR: opendir failed: $dir ($!)\n&quot;</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">10</td>
  <td class="sdoc-code-td-line">    <span class="pt-k">return</span> <span class="pt-k">bless</span> <span class="pt-i">$dh</span><span class="pt-cm">,</span><span class="pt-i">$class</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">11</td>
  <td class="sdoc-code-td-line"><span class="pt-s">}</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">12</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">13</td>
  <td class="sdoc-code-td-line"><a name="close"></a><span class="pt-k">sub </span><span class="pt-m">close</span> <span class="pt-s">{</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">14</td>
  <td class="sdoc-code-td-line">    <span class="pt-k">my</span> <span class="pt-i">$self</span> = <span class="pt-k">shift</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">15</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">16</td>
  <td class="sdoc-code-td-line">    <span class="pt-k">closedir</span> <span class="pt-i">$self</span> <span class="pt-k">or</span> <span class="pt-k">die</span> <span class="pt-q">&quot;ERROR: closedir failed ($!)\n&quot;</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">17</td>
  <td class="sdoc-code-td-line">    <span class="pt-k">return</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">18</td>
  <td class="sdoc-code-td-line"><span class="pt-s">}</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">19</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">20</td>
  <td class="sdoc-code-td-line"><a name="next"></a><span class="pt-k">sub </span><span class="pt-m">next</span> <span class="pt-s">{</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">21</td>
  <td class="sdoc-code-td-line">    <span class="pt-k">return</span> <span class="pt-k">readdir</span> <span class="pt-k">shift</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">22</td>
  <td class="sdoc-code-td-line"><span class="pt-s">}</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">23</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">24</td>
  <td class="sdoc-code-td-line"><span class="pt-n">1</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">25</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">26</td>
  <td class="sdoc-code-td-line"><span class="pt-c"># eof</span></td>
</tr>
</table>
<p class="sdoc-para-p">
  <b class="sdoc-seg-b">Beispiel:</b> Gib alle Einträge des Verzeichnisses <tt class="sdoc-seg-c">$dir</tt> auf
  <tt class="sdoc-seg-c">STDOUT</tt> aus
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre"><span class="sdoc-code-ln"> 1</span> <span class="pt-k">use</span> <span class="pt-w">Dirhandle</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln"> 2</span> &#10;<span class="sdoc-code-ln"> 3</span> <span class="pt-k">my</span> <span class="pt-i">$dh</span> = <span class="pt-w">Dirhandle</span><span class="pt-w">-&gt;new</span><span class="pt-s">(</span><span class="pt-i">$dir</span><span class="pt-s">)</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln"> 4</span> <span class="pt-k">while</span> <span class="pt-s">(</span><span class="pt-k">my</span> <span class="pt-i">$entry</span> = <span class="pt-i">$dh</span><span class="pt-i">-&gt;next</span><span class="pt-s">)</span> <span class="pt-s">{</span>&#10;<span class="sdoc-code-ln"> 5</span>     <span class="pt-k">say</span> <span class="pt-i">$entry</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln"> 6</span> <span class="pt-s">}</span>&#10;<span class="sdoc-code-ln"> 7</span> <span class="pt-i">$dh</span><span class="pt-i">-&gt;close</span><span class="pt-sc">;</span>&#10;</pre>
</div>
<p class="sdoc-para-p">
  Das Dirhandle-Objekt <tt class="sdoc-seg-c">$dh</tt> kann wie jede normale Dirhandle an
  die Perl-Builtins <tt class="sdoc-seg-c">readdir()</tt>, <tt class="sdoc-seg-c">telldir()</tt>,  <tt class="sdoc-seg-c">seekdir()</tt>,
  <tt class="sdoc-seg-c">rewinddir()</tt>,  <tt class="sdoc-seg-c">closedir()</tt> übergeben werden.
</p> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/34-Perl-Filehandles-objektorientiert.html" rel="alternate" title="Perl: Filehandles objektorientiert" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-03-16T12:57:38Z</published>
        <updated>2010-03-31T08:15:58Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=34</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=34</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/1-Perl" label="Perl" term="Perl" />
    
        <id>http://fseitz.de/blog/index.php?/archives/34-guid.html</id>
        <title type="html">Perl: Filehandles objektorientiert</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p class="sdoc-para-p">
  Mit lexikalischen Filehandles ist es in Perl leicht möglich, File-I/O
  objektorientiert zu kapseln. Hier zur Veranschaulichung eine Klasse
  <tt class="sdoc-seg-c">Filehandle</tt> mit drei Methoden: <tt class="sdoc-seg-c">new()</tt> (Datei öffnen), <tt class="sdoc-seg-c">close()</tt>
  (Datei schließen) und <tt class="sdoc-seg-c">slurp()</tt> (Datei komplett einlesen):
</p>
<table cellpadding="0" cellspacing="0" class="sdoc-code-table">
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 1</td>
  <td class="sdoc-code-td-line"><a name="package-Filehandle"></a><span class="pt-k">package </span><span class="pt-i">Filehandle</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 2</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 3</td>
  <td class="sdoc-code-td-line"><span class="pt-k">use</span> <span class="pt-w">strict</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 4</td>
  <td class="sdoc-code-td-line"><span class="pt-k">use</span> <span class="pt-w">warnings</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 5</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 6</td>
  <td class="sdoc-code-td-line"><a name="new"></a><span class="pt-k">sub </span><span class="pt-m">new</span> <span class="pt-s">{</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 7</td>
  <td class="sdoc-code-td-line">    <span class="pt-k">my</span> <span class="pt-s">(</span><span class="pt-i">$class</span><span class="pt-cm">,</span><span class="pt-i">$mode</span><span class="pt-cm">,</span><span class="pt-i">$file</span><span class="pt-s">)</span> = <span class="pt-i">@_</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 8</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 9</td>
  <td class="sdoc-code-td-line">    <span class="pt-k">open</span> <span class="pt-k">my</span> <span class="pt-i">$fh</span><span class="pt-cm">,</span><span class="pt-i">$mode</span><span class="pt-cm">,</span><span class="pt-i">$file</span> <span class="pt-k">or</span> <span class="pt-k">die</span> <span class="pt-q">&quot;ERROR: open failed: $file ($!)\n&quot;</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">10</td>
  <td class="sdoc-code-td-line">    <span class="pt-k">return</span> <span class="pt-k">bless</span> <span class="pt-i">$fh</span><span class="pt-cm">,</span><span class="pt-i">$class</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">11</td>
  <td class="sdoc-code-td-line"><span class="pt-s">}</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">12</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">13</td>
  <td class="sdoc-code-td-line"><a name="close"></a><span class="pt-k">sub </span><span class="pt-m">close</span> <span class="pt-s">{</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">14</td>
  <td class="sdoc-code-td-line">    <span class="pt-k">my</span> <span class="pt-i">$self</span> = <span class="pt-k">shift</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">15</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">16</td>
  <td class="sdoc-code-td-line">    <span class="pt-k">close</span> <span class="pt-i">$self</span> <span class="pt-k">or</span> <span class="pt-k">die</span> <span class="pt-q">&quot;ERROR: close failed ($!)\n&quot;</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">17</td>
  <td class="sdoc-code-td-line">    <span class="pt-k">return</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">18</td>
  <td class="sdoc-code-td-line"><span class="pt-s">}</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">19</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">20</td>
  <td class="sdoc-code-td-line"><a name="slurp"></a><span class="pt-k">sub </span><span class="pt-m">slurp</span> <span class="pt-s">{</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">21</td>
  <td class="sdoc-code-td-line">    <span class="pt-k">my</span> <span class="pt-i">$self</span> = <span class="pt-k">shift</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">22</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">23</td>
  <td class="sdoc-code-td-line">    <span class="pt-k">local</span> <span class="pt-i">$/</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">24</td>
  <td class="sdoc-code-td-line">    <span class="pt-k">return</span> <span class="pt-k">scalar</span> <span class="pt-q">&lt;$self&gt;</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">25</td>
  <td class="sdoc-code-td-line"><span class="pt-s">}</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">26</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">27</td>
  <td class="sdoc-code-td-line"><span class="pt-n">1</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">28</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">29</td>
  <td class="sdoc-code-td-line"><span class="pt-c"># eof</span></td>
</tr>
</table>
<p class="sdoc-para-p">
  <b class="sdoc-seg-b">Beispiel:</b> Lies eine Datei komplett ein und gib sie auf <tt class="sdoc-seg-c">STDOUT</tt> aus
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre"><span class="sdoc-code-ln"> 1</span> <span class="pt-k">use</span> <span class="pt-w">Filehandle</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln"> 2</span> &#10;<span class="sdoc-code-ln"> 3</span> <span class="pt-k">my</span> <span class="pt-i">$fh</span> = <span class="pt-w">Filehandle</span><span class="pt-w">-&gt;new</span><span class="pt-s">(</span><span class="pt-q">&#39;&lt;&#39;</span><span class="pt-cm">,</span><span class="pt-i">$file</span><span class="pt-s">)</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln"> 4</span> <span class="pt-k">print</span> <span class="pt-i">$fh</span><span class="pt-i">-&gt;slurp</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln"> 5</span> <span class="pt-i">$fh</span><span class="pt-i">-&gt;close</span><span class="pt-sc">;</span>&#10;</pre>
</div>
<p class="sdoc-para-p">
  <b class="sdoc-seg-b">Der Clou:</b> Die Filehandle <tt class="sdoc-seg-c">$fh</tt> kann unabhängig von der Klasse wie
  jede andere Perl-Filehandle benutzt werden, z.B. mit dem
  Diamant-Operator <tt class="sdoc-seg-c">&lt;&gt;</tt> oder jeder anderen Filehandle-Operation
  wie <tt class="sdoc-seg-c">read()</tt>, <tt class="sdoc-seg-c">write()</tt> usw. Obiges Programm lässt sich also auch so
  implementieren:
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre"><span class="sdoc-code-ln"> 1</span> <span class="pt-k">use</span> <span class="pt-w">Filehandle</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln"> 2</span> &#10;<span class="sdoc-code-ln"> 3</span> <span class="pt-k">my</span> <span class="pt-i">$fh</span> = <span class="pt-w">Filehandle</span><span class="pt-w">-&gt;new</span><span class="pt-s">(</span><span class="pt-q">&#39;&lt;&#39;</span><span class="pt-cm">,</span><span class="pt-i">$file</span><span class="pt-s">)</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln"> 4</span> <span class="pt-k">while</span> <span class="pt-s">(</span><span class="pt-q">&lt;$fh&gt;</span><span class="pt-s">)</span> <span class="pt-s">{</span>&#10;<span class="sdoc-code-ln"> 5</span>     <span class="pt-k">print</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln"> 6</span> <span class="pt-s">}</span>&#10;<span class="sdoc-code-ln"> 7</span> <span class="pt-i">$fh</span><span class="pt-i">-&gt;close</span><span class="pt-sc">;</span>&#10;</pre>
</div> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/33-Perl-Crash-bei-Umleitung-von-STDERR-auf-Skalare-Variable.html" rel="alternate" title="Perl: Crash bei Umleitung von STDERR auf Skalare Variable" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-03-05T08:56:59Z</published>
        <updated>2010-03-31T08:15:56Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=33</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=33</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/1-Perl" label="Perl" term="Perl" />
    
        <id>http://fseitz.de/blog/index.php?/archives/33-guid.html</id>
        <title type="html">Perl: Crash bei Umleitung von STDERR auf Skalare Variable</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p class="sdoc-para-p">
  Ich weiß nicht, wann Perl mir mal abgestürzt ist,
  aber jetzt bin ich auf einen Fall gestoßen:
</p>
<table cellpadding="0" cellspacing="0" class="sdoc-code-table">
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 1</td>
  <td class="sdoc-code-td-line">#!/usr/bin/perl</td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 2</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 3</td>
  <td class="sdoc-code-td-line"><span class="pt-k">use</span> <span class="pt-w">strict</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 4</td>
  <td class="sdoc-code-td-line"><span class="pt-k">use</span> <span class="pt-w">warnings</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 5</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 6</td>
  <td class="sdoc-code-td-line"><span class="pt-k">my</span> <span class="pt-i">$s</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 7</td>
  <td class="sdoc-code-td-line"><span class="pt-k">close</span> <span class="pt-w">STDERR</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 8</td>
  <td class="sdoc-code-td-line"><span class="pt-k">open</span> <span class="pt-w">STDERR</span><span class="pt-cm">,</span><span class="pt-q">&#39;&gt;&#39;</span><span class="pt-cm">,</span>\<span class="pt-i">$s</span> <span class="pt-k">or</span> <span class="pt-k">die</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 9</td>
  <td class="sdoc-code-td-line"><span class="pt-k">warn</span> <span class="pt-q">&quot;a\n&quot;</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">10</td>
  <td class="sdoc-code-td-line"><span class="pt-i">$s</span> =~ <span class="pt-q">s/./xx/g</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">11</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">12</td>
  <td class="sdoc-code-td-line"><span class="pt-c"># eof</span></td>
</tr>
</table>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">$ ./test.pl&#10;Segmentation fault</pre>
</div>
<p class="sdoc-para-p">
  Perl-Version (andere habe ich nicht probiert):
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">$ perl -v&#10;This is perl, v5.10.1 (*) built for i686-linux</pre>
</div>
<h1 class="sdoc-sec-h1">Variationen</h1>
<p class="sdoc-para-p">
  Wenn <tt class="sdoc-seg-c">$s</tt> kein In-Memory File ist, geht es.
</p>
<p class="sdoc-para-p">
  Bei <tt class="sdoc-seg-c">$s =~ s/./xx/;</tt> geht es (ohne g Modifier).
</p>
<p class="sdoc-para-p">
  Bei <tt class="sdoc-seg-c">$s =~ s/./x/g;</tt> geht es (der String wird nicht länger).
</p>
<p class="sdoc-para-p">
  Schließen von <tt class="sdoc-seg-c">STDERR</tt> vor dem <tt class="sdoc-seg-c">s///</tt> ändert nichts.
</p> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/32-Perl-und-Unicode.html" rel="alternate" title="Perl und Unicode" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-02-10T07:38:38Z</published>
        <updated>2010-03-27T11:23:19Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=32</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=32</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/8-Unicode+UTF-8" label="Unicode+UTF-8" term="Unicode+UTF-8" />
    
        <id>http://fseitz.de/blog/index.php?/archives/32-guid.html</id>
        <title type="html">Perl und Unicode</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p class="sdoc-para-p">
  Eine sehr gute, knappe Einführung in Perl und Unicode von Moritz Lenz:
  <a class="sdoc-seg-u" href="http://perlgeek.de/de/artikel/charsets-unicode">http://perlgeek.de/de/artikel/charsets-unicode</a>
</p> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/31-GNU-Makefile-zum-Konvertieren-von-Dateien.html" rel="alternate" title="GNU Makefile zum Konvertieren von Dateien" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-02-09T11:09:39Z</published>
        <updated>2010-03-31T08:15:54Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=31</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=31</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/18-make" label="make" term="make" />
    
        <id>http://fseitz.de/blog/index.php?/archives/31-guid.html</id>
        <title type="html">GNU Makefile zum Konvertieren von Dateien</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p class="sdoc-para-p">
  Mitunter soll eine Menge von Dateien, die man erstellt und bearbeitet,
  systematisch in etwas anderes, z.B. ein anderes Format, konvertiert
  werden. Die Konvertierung lässt sich mit dem Utilty <tt class="sdoc-seg-c">make</tt>
  organisieren, so dass überflüssige Konvertierungen vermieden werden.
</p>
<p class="sdoc-para-p">
  Wie sieht ein GNU Makefile für diese Aufgabe aus?
</p>
<p class="sdoc-para-p">
  Das folgende (fiktive) Beispiel geht davon aus, dass wir .in-Dateien
  in .out-Dateien konvertieren wollen. Die Konvertierung übernimmt das
  (fiktive) Programm in2out.
</p>
<table cellpadding="0" cellspacing="0" class="sdoc-code-table">
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 1</td>
  <td class="sdoc-code-td-line">OUTFILES = $(patsubst %.in,%.out,$(wildcard *.in))</td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 2</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 3</td>
  <td class="sdoc-code-td-line">%.out: %.in</td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 4</td>
  <td class="sdoc-code-td-line">	in2out $&lt; $*.out</td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 5</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 6</td>
  <td class="sdoc-code-td-line">all: $(OUTFILES)</td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 7</td>
  <td class="sdoc-code-td-line"></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 8</td>
  <td class="sdoc-code-td-line">clean:</td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 9</td>
  <td class="sdoc-code-td-line">	rm -f *.out</td>
</tr>
</table>
<dl class="sdoc-list-dl">
  <dt class="sdoc-list-dt">Zeile 1</dt>
  <dd class="sdoc-list-dd">
    <p class="sdoc-para-p">
      Definition der Liste der Targets, also der Dateien, die zu
      generieren sind. Das sind .out-Dateien. Diese Liste könnten wir per
      Hand pflegen, was aber mühselig wäre. Stattdessen nutzen wir die
      Möglichkeiten von GNU make und generieren die Liste mittels der
      Funktionen <tt class="sdoc-seg-c">wildcard</tt> und <tt class="sdoc-seg-c">patsub</tt> aus den im aktuellen
      Verzeichnis befindlichen .in-Quell-Dateien.
    </p>
  </dd>
  <dt class="sdoc-list-dt">Zeile 3-4</dt>
  <dd class="sdoc-list-dd">
    <p class="sdoc-para-p">
      Pattern Rule, welche definiert, welche Kommandofolge aus einer
      .in-Quelldatei eine .out-Zieldatei erzeugt. Hier ist es ein einzelnes
      Kommando, der Aufruf von <tt class="sdoc-seg-c">in2out [infile] [outfile]</tt>.
      Die make-Variable <tt class="sdoc-seg-c">$&lt;</tt> enthält den Namen der .in-Quelldatei,
      die Variable <tt class="sdoc-seg-c">$*</tt> den Grundnamen der Quelldatei, aus dem
      durch Anhängen von ".out" der Name der Zieldatei wird.
    </p>
  </dd>
  <dt class="sdoc-list-dt">Zeile 6</dt>
  <dd class="sdoc-list-dd">
    <p class="sdoc-para-p">
      Regel, die bei Aufruf von
    </p>
    <div class="sdoc-code-div">
      <pre class="sdoc-code-pre">$ make</pre>
    </div>
    <p class="sdoc-para-p">
      oder
    </p>
    <div class="sdoc-code-div">
      <pre class="sdoc-code-pre">$ make all</pre>
    </div>
    <p class="sdoc-para-p">
      zu erfüllen versucht wird. Diese (PHONY-)regel besagt, dass
      als Vorbedingung alle <tt class="sdoc-seg-c">$(OUTFILES)</tt> zu generieren sind.
    </p>
  </dd>
  <dt class="sdoc-list-dt">Zeile 8-9</dt>
  <dd class="sdoc-list-dd">
    <p class="sdoc-para-p">
      Regel ohne Vorbedingung, die aufräumt, also alle .out-Dateien löscht, z.B.
      um sie insgesamt neu zu generieren. Aufruf:
    </p>
    <div class="sdoc-code-div">
      <pre class="sdoc-code-pre">$ make clean</pre>
    </div>
  </dd>
</dl> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/30-Syntax-Highlighting-mit-highlight.html" rel="alternate" title="Syntax-Highlighting mit highlight" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-02-08T15:01:36Z</published>
        <updated>2010-03-27T11:23:16Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=30</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=30</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/17-Unix" label="Unix" term="Unix" />
    
        <id>http://fseitz.de/blog/index.php?/archives/30-guid.html</id>
        <title type="html">Syntax-Highlighting mit highlight</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p class="sdoc-para-p">
  Highlight stellt die Syntax von zahlreichen Programmiersprachen farbig
  und mit Fontattributen wie kursiv und fett dar:
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">$ highlight --syntax=LANG --fragment &lt;CODE &gt;CODE.html</pre>
</div>
<p class="sdoc-para-p">
  Die Option <tt class="sdoc-seg-c">--syntax=LANG</tt> stellt die Programmiersprache ein,
  <tt class="sdoc-seg-c">--fragment</tt> sorgt dafür, dass keine vollständige HTML-Seite,
  sondern einbettbarer HTML-Code generiert wird.
</p>
<p class="sdoc-para-p">
  Die zugehörigen CSS-Klassen liefert folgendes Kommando nach stdout:
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">$ highlight --print-style --style-outfile=stdout | grep '^\.' &gt;CODE.css</pre>
</div>
<p class="sdoc-para-p">
  Das nachgeschaltete grep sorgt dafür, dass der Output auf
  die relevanten Klassen für eine Einbettung eingeschränkt wird.
</p> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/29-Syntax-Highlighting-mit-perltidy.html" rel="alternate" title="Syntax-Highlighting mit perltidy" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-02-05T17:45:03Z</published>
        <updated>2010-03-27T11:23:14Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=29</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=29</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/1-Perl" label="Perl" term="Perl" />
    
        <id>http://fseitz.de/blog/index.php?/archives/29-guid.html</id>
        <title type="html">Syntax-Highlighting mit perltidy</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p class="sdoc-para-p">
  Perltidy stellt die Syntax von Perl-Code farbig und mit
  Fontattributen wie kursiv und fett dar, wenn man den Code mit Option
  <tt class="sdoc-seg-c">-html</tt> nach HTML wandelt. Ich nutze dieses Feature, um lesbareren
  Perl-Code für mein Blog zu generieren.
</p>
<p class="sdoc-para-p">
  Für die Einbettung des generierten HTML-Codes in eigene HTML-Seiten
  sind allerdings kleinere Sonderbehandlungen nötig.
</p>
<h1 class="sdoc-sec-h1">Anpassung der Stylesheet-Definitionen</h1>
<p class="sdoc-para-p">
  Perltidy generiert mit
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">$ perltidy -html -ss &gt;FILE.css</pre>
</div>
<p class="sdoc-para-p">
  eine Stylesheet-Datei, die die Definitionen der CSS-Klassen für die
  Syntaxelemente enthält und in die eigenen HTML-Seiten
  eingebunden werden kann:
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre"><span class="hl com">/* default style sheet generated by perltidy */</span>&#10;<span class="hl kwb">body</span> <span class="hl sym">{</span><span class="hl kwa">background</span><span class="hl sym">:</span> <span class="hl num">#FFFFFF</span><span class="hl sym">;</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#000000</span><span class="hl sym">}</span>&#10;<span class="hl kwb">pre</span> <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#000000</span><span class="hl sym">;</span>&#10;      <span class="hl kwa">background</span><span class="hl sym">:</span> <span class="hl num">#FFFFFF</span><span class="hl sym">;</span>&#10;      <span class="hl kwa">font-family</span><span class="hl sym">:</span> courier<span class="hl sym">;</span>&#10;    <span class="hl sym">}</span>&#10;&#10;<span class="hl kwc">.c</span>  <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#228B22</span><span class="hl sym">;}</span> <span class="hl com">/* comment */</span>&#10;<span class="hl kwc">.cm</span> <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#000000</span><span class="hl sym">;}</span> <span class="hl com">/* comma */</span>&#10;<span class="hl kwc">.co</span> <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#000000</span><span class="hl sym">;}</span> <span class="hl com">/* colon */</span>&#10;<span class="hl kwc">.h</span>  <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#CD5555</span><span class="hl sym">;</span> <span class="hl kwa">font-weight</span><span class="hl sym">:</span><span class="hl kwa">bold</span><span class="hl sym">;}</span> <span class="hl com">/* here-doc-target */</span>&#10;<span class="hl kwc">.hh</span> <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#CD5555</span><span class="hl sym">;</span> <span class="hl kwa">font-style</span><span class="hl sym">:</span><span class="hl kwa">italic</span><span class="hl sym">;}</span> <span class="hl com">/* here-doc-text */</span>&#10;<span class="hl kwc">.i</span>  <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#00688B</span><span class="hl sym">;}</span> <span class="hl com">/* identifier */</span>&#10;<span class="hl kwc">.j</span>  <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#CD5555</span><span class="hl sym">;</span> <span class="hl kwa">font-weight</span><span class="hl sym">:</span><span class="hl kwa">bold</span><span class="hl sym">;}</span> <span class="hl com">/* label */</span>&#10;<span class="hl kwc">.k</span>  <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#8B008B</span><span class="hl sym">;</span> <span class="hl kwa">font-weight</span><span class="hl sym">:</span><span class="hl kwa">bold</span><span class="hl sym">;}</span> <span class="hl com">/* keyword */</span>&#10;<span class="hl kwc">.m</span>  <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#FF0000</span><span class="hl sym">;</span> <span class="hl kwa">font-weight</span><span class="hl sym">:</span><span class="hl kwa">bold</span><span class="hl sym">;}</span> <span class="hl com">/* subroutine */</span>&#10;<span class="hl kwc">.n</span>  <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#B452CD</span><span class="hl sym">;}</span> <span class="hl com">/* numeric */</span>&#10;<span class="hl kwc">.p</span>  <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#000000</span><span class="hl sym">;}</span> <span class="hl com">/* paren */</span>&#10;<span class="hl kwc">.pd</span> <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#228B22</span><span class="hl sym">;</span> <span class="hl kwa">font-style</span><span class="hl sym">:</span><span class="hl kwa">italic</span><span class="hl sym">;}</span> <span class="hl com">/* pod-text */</span>&#10;<span class="hl kwc">.pu</span> <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#000000</span><span class="hl sym">;}</span> <span class="hl com">/* punctuation */</span>&#10;<span class="hl kwc">.q</span>  <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#CD5555</span><span class="hl sym">;}</span> <span class="hl com">/* quote */</span>&#10;<span class="hl kwc">.s</span>  <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#000000</span><span class="hl sym">;}</span> <span class="hl com">/* structure */</span>&#10;<span class="hl kwc">.sc</span> <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#000000</span><span class="hl sym">;}</span> <span class="hl com">/* semicolon */</span>&#10;<span class="hl kwc">.v</span>  <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#B452CD</span><span class="hl sym">;}</span> <span class="hl com">/* v-string */</span>&#10;<span class="hl kwc">.w</span>  <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#000000</span><span class="hl sym">;}</span> <span class="hl com">/* bareword */</span>&#10;</pre>
</div>
<h1 class="sdoc-sec-h1">Anpassung 1</h1>
<p class="sdoc-para-p">
  Die CSS-Definitionen für <tt class="sdoc-seg-c">&lt;body&gt;</tt> und <tt class="sdoc-seg-c">&lt;pre&gt;</tt> am Anfang sollten im
  Falle einer Einbettung nicht vorkommen, da diese an anderer
  Stelle definiert sind. Sie lassen sich mit <tt class="sdoc-seg-c">grep</tt> wegfiltern.
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">$ perltidy -html -ss | grep '^\.'</pre>
</div>
<h1 class="sdoc-sec-h1">Anpassung 2</h1>
<p class="sdoc-para-p">
  Die Namen der CSS-Klassen bestehen aus ein oder zwei
  Buchstaben, was zu Nameclashes führen kann.
  Dies verbessere ich, indem ich dem Klassennamen
  einen Präfix voranstelle. Ich wähle "pt-".
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">$ perltidy -html -ss | grep '^\.' | sed -e 's/^\./.pt-/'</pre>
</div>
<h1 class="sdoc-sec-h1">Resultierende CSS-Datei</h1>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre"><span class="hl kwc">.pt-c</span>  <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#228B22</span><span class="hl sym">;}</span> <span class="hl com">/* comment */</span>&#10;<span class="hl kwc">.pt-cm</span> <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#000000</span><span class="hl sym">;}</span> <span class="hl com">/* comma */</span>&#10;<span class="hl kwc">.pt-co</span> <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#000000</span><span class="hl sym">;}</span> <span class="hl com">/* colon */</span>&#10;<span class="hl kwc">.pt-h</span>  <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#CD5555</span><span class="hl sym">;</span> <span class="hl kwa">font-weight</span><span class="hl sym">:</span><span class="hl kwa">bold</span><span class="hl sym">;}</span> <span class="hl com">/* here-doc-target */</span>&#10;<span class="hl kwc">.pt-hh</span> <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#CD5555</span><span class="hl sym">;</span> <span class="hl kwa">font-style</span><span class="hl sym">:</span><span class="hl kwa">italic</span><span class="hl sym">;}</span> <span class="hl com">/* here-doc-text */</span>&#10;<span class="hl kwc">.pt-i</span>  <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#00688B</span><span class="hl sym">;}</span> <span class="hl com">/* identifier */</span>&#10;<span class="hl kwc">.pt-j</span>  <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#CD5555</span><span class="hl sym">;</span> <span class="hl kwa">font-weight</span><span class="hl sym">:</span><span class="hl kwa">bold</span><span class="hl sym">;}</span> <span class="hl com">/* label */</span>&#10;<span class="hl kwc">.pt-k</span>  <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#8B008B</span><span class="hl sym">;</span> <span class="hl kwa">font-weight</span><span class="hl sym">:</span><span class="hl kwa">bold</span><span class="hl sym">;}</span> <span class="hl com">/* keyword */</span>&#10;<span class="hl kwc">.pt-m</span>  <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#FF0000</span><span class="hl sym">;</span> <span class="hl kwa">font-weight</span><span class="hl sym">:</span><span class="hl kwa">bold</span><span class="hl sym">;}</span> <span class="hl com">/* subroutine */</span>&#10;<span class="hl kwc">.pt-n</span>  <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#B452CD</span><span class="hl sym">;}</span> <span class="hl com">/* numeric */</span>&#10;<span class="hl kwc">.pt-p</span>  <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#000000</span><span class="hl sym">;}</span> <span class="hl com">/* paren */</span>&#10;<span class="hl kwc">.pt-pd</span> <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#228B22</span><span class="hl sym">;</span> <span class="hl kwa">font-style</span><span class="hl sym">:</span><span class="hl kwa">italic</span><span class="hl sym">;}</span> <span class="hl com">/* pod-text */</span>&#10;<span class="hl kwc">.pt-pu</span> <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#000000</span><span class="hl sym">;}</span> <span class="hl com">/* punctuation */</span>&#10;<span class="hl kwc">.pt-q</span>  <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#CD5555</span><span class="hl sym">;}</span> <span class="hl com">/* quote */</span>&#10;<span class="hl kwc">.pt-s</span>  <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#000000</span><span class="hl sym">;}</span> <span class="hl com">/* structure */</span>&#10;<span class="hl kwc">.pt-sc</span> <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#000000</span><span class="hl sym">;}</span> <span class="hl com">/* semicolon */</span>&#10;<span class="hl kwc">.pt-v</span>  <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#B452CD</span><span class="hl sym">;}</span> <span class="hl com">/* v-string */</span>&#10;<span class="hl kwc">.pt-w</span>  <span class="hl sym">{</span> <span class="hl kwa">color</span><span class="hl sym">:</span> <span class="hl num">#000000</span><span class="hl sym">;}</span> <span class="hl com">/* bareword */</span>&#10;</pre>
</div>
<h1 class="sdoc-sec-h1">Anpassung des HTML-Codes</h1>
<p class="sdoc-para-p">
  Perltidy erzeugt mit
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">$ perltidy -html -pre &lt;FILE &gt;FILE.html</pre>
</div>
<p class="sdoc-para-p">
  eine Quelltext-Darstellung in HTML. Diese kann in die eigene
  Seite eingebunden werden.
</p>
<h1 class="sdoc-sec-h1">Anpassung 1</h1>
<p class="sdoc-para-p">
  Der HTML-Code ist in ein <tt class="sdoc-seg-c">&lt;pre&gt;</tt> ohne Klassenanabe eingefasst.  Das
  CSS-Layout dieses <tt class="sdoc-seg-c">&lt;pre&gt;</tt> lässt sich also nicht gezielt anpassen. Am
  besten filtert man es weg und setzt den HTML-Code in ein eigenes
  <tt class="sdoc-seg-c">&lt;pre&gt;</tt>.
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">$ perltidy -html -pre &lt;FILE | egrep -v '^&lt;/?pre&gt;'</pre>
</div>
<h1 class="sdoc-sec-h1">Anpassung 2</h1>
<p class="sdoc-para-p">
  Die CSS-Klassennamen müssen an die oben gewählten Namen in der
  Stylesheet-Datei angepasst werden.
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">$ perltidy -html -pre | egrep -v '^&lt;/?pre&gt;' | sed -e 's/class="/class="pt-/g'</pre>
</div>
<h1 class="sdoc-sec-h1">Resultierender HTML-Code</h1>
<p class="sdoc-para-p">
  Aus
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">print "Hello world!\n";</pre>
</div>
<p class="sdoc-para-p">
  wird im HTML-Output (Umbruch hinzugefügt)
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">&lt;span class="pt-k"&gt;print&lt;/span&gt; &lt;span class="pt-q"&gt;&#10;  &amp;quot;Hello world!\n&amp;quot;&lt;/span&gt;&lt;span class="pt-sc"&gt;;&lt;/span&gt;</pre>
</div>
<p class="sdoc-para-p">
  und im Browser
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre"><span class="pt-k">print</span> <span class="pt-q">&quot;Hello world!\n&quot;</span><span class="pt-sc">;</span>&#10;</pre>
</div> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/28-Perl-Effizient-Zeichen-zaehlen.html" rel="alternate" title="Perl: Effizient Zeichen zählen" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-02-05T11:06:45Z</published>
        <updated>2010-03-27T11:23:12Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=28</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=28</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/1-Perl" label="Perl" term="Perl" />
    
        <id>http://fseitz.de/blog/index.php?/archives/28-guid.html</id>
        <title type="html">Perl: Effizient Zeichen zählen</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p class="sdoc-para-p">
  Ist eine FAQ (s. <tt class="sdoc-seg-c">perldoc -q occurrences</tt>), aber ich vergesse
  immer die genaue Syntax, da ich <tt class="sdoc-seg-c">tr///</tt> selten nutze und es mehrere
  Funktionen in sich vereint:
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre"><span class="pt-i">$n</span> = <span class="pt-i">$str</span> =~ <span class="pt-q">tr/\n//</span><span class="pt-sc">;</span>&#10;</pre>
</div>
<p class="sdoc-para-p">
  <tt class="sdoc-seg-c">$n</tt> ist in diesem Fall die Anzahl der Zeilenumbrüche in <tt class="sdoc-seg-c">$str</tt>.
</p> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/27-Apache-Redirection-auf-Subdirectory.html" rel="alternate" title="Apache: Redirection auf Subdirectory" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-02-03T16:28:50Z</published>
        <updated>2010-03-27T11:23:10Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=27</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=27</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/16-Apache" label="Apache" term="Apache" />
    
        <id>http://fseitz.de/blog/index.php?/archives/27-guid.html</id>
        <title type="html">Apache: Redirection auf Subdirectory</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p class="sdoc-para-p">
  Mit der Direktive
  <a class="sdoc-seg-u" href="http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirect">Redirect</a>
  kann ein Seitenzugriff auf eine andere Seite umgeleitet werden. Die
  Umleitung schließt alle Subpfade ein, also Seiten mit gleichem
  Pfadanfang.
</p>
<p class="sdoc-para-p">
  Möchte man ein Directory auf ein Subdirectory umleiten, klappt dies
  mit Redirect nicht, weil das zu einer Endlos-Rekursion führt.
  Die Redirect-Regel
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">Redirect /a /a/b</pre>
</div>
<p class="sdoc-para-p">
  führt bei Aufruf von <tt class="sdoc-seg-c">/a</tt> zu der endlosen Kette von HTTP-Aufrufen
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">/a&#10;/a/b&#10;/a/b/b&#10;/a/b/b/b&#10;...</pre>
</div>
<p class="sdoc-para-p">
  bis der Browser dies erkennt und mit einer Meldung wie
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">Redirect Loop: Redirection limit for this URL exceeded.</pre>
</div>
<p class="sdoc-para-p">
  abbricht.
</p>
<p class="sdoc-para-p">
  Die Lösung liefert die (leistungsfähigere) Direktive
  <a class="sdoc-seg-u" href="http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirectmatch">RedirectMatch</a>. Mit dieser lässt sich der umzulenkende
  Pfad per Regex präzise eingrenzen:
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">RedirectMatch /a$ /a/b</pre>
</div>
<p class="sdoc-para-p">
  Das Dollarzeichen verankert den Pfad <tt class="sdoc-seg-c">/a</tt> am Ende des URL,
  so dass Subpfade nicht mehr matchen und die Rekursion unterbleibt.
</p>
<p class="sdoc-para-p">
  Da durch die Regel keine Subpfade weitergeleitet werden,
  müssen die Zugriffe innerhalb von <tt class="sdoc-seg-c">/a/b</tt> relativ sein.
</p>
<p class="sdoc-para-p">
  Ist das Ausgangsdirectory das Root-Directory, muss
  auch der Anfang verankert werden, da jedes Verzeichnis
  auf <tt class="sdoc-seg-c">/</tt> endet:
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">RedirectMatch ^/$ /a</pre>
</div> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/26-Rsync-Abweichende-Rechte-einstellen.html" rel="alternate" title="Rsync: Abweichende Rechte einstellen" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-01-29T16:15:57Z</published>
        <updated>2010-03-27T11:23:08Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=26</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=26</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/14-rsync" label="rsync" term="rsync" />
    
        <id>http://fseitz.de/blog/index.php?/archives/26-guid.html</id>
        <title type="html">Rsync: Abweichende Rechte einstellen</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p class="sdoc-para-p">
  Mit der Option <tt class="sdoc-seg-c">-a</tt> führt <tt class="sdoc-seg-c">rsync</tt> den Abgleich im &#132;Archive Mode&#148;
  durch, d.h. Symlinks, Devices, Permissions, Ownerschaft usw. werden
  auf die Zielmaschine transferiert.
</p>
<p class="sdoc-para-p">
  Was aber, wenn gewisse Unterschiede erforderlich sind, z.B. die
  Ownerschaft einiger Dateien verschieden sein muss, weil
  der Owner oder die Group auf der Zielmaschine anders heißen?
</p>
<p class="sdoc-para-p">
  Beispiel: Die Group des HTTP-Servers heißt auf der
  einen Maschine &#132;www-data&#148; während sie auf der anderen Maschine
  &#132;apache&#148; heißt. Über die Group bekommt der HTTP-Server
  Rechte auf bestimmten Dateien eingeräumt, sie muss
  also passend zur Maschine gesetzt sein.
</p>
<p class="sdoc-para-p">
  Solche Differenzen kann <tt class="sdoc-seg-c">rsync</tt> nicht auflösen und bietet auch keine
  Option hierfür. Es lässt sich aber mit einem nachgeschalteten
  Shell-Skript erreichen, das via <tt class="sdoc-seg-c">ssh</tt> auf der Zielmaschine ausgeführt
  wird:
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">rsync -az --delete -e ssh DIR1/ USER@HOST:DIR2&#10;ssh USER@HOST CMD</pre>
</div>
<p class="sdoc-para-p">
  Wird <i class="sdoc-seg-i">CMD</i> in <i class="sdoc-seg-i">DIR1</i> abgelegt, wird es durch den <tt class="sdoc-seg-c">rsync</tt>-Aufruf
  mit verwaltet, also automatisch auf dem neusten Stand gehalten.
</p> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/25-Overlays-in-Google-Earth-einbinden.html" rel="alternate" title="Overlays in Google Earth einbinden" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-01-28T16:39:53Z</published>
        <updated>2010-03-31T08:15:52Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=25</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=25</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/15-Google-Earth" label="Google Earth" term="Google Earth" />
    
        <id>http://fseitz.de/blog/index.php?/archives/25-guid.html</id>
        <title type="html">Overlays in Google Earth einbinden</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p class="sdoc-para-p">
  Overlays sind Bilder, die von Google Earth auf einen Bereich
  der Erdoberfläche (<em class="sdoc-seg-e">GroundOverlays</em>) oder statisch ins Anwendungsfenster
  (<em class="sdoc-seg-e">ScreenOverlays</em>) projeziert werden.
</p>
<p class="sdoc-para-p">
  Zu den Bildern gehört eine Spezifikation in
  <a class="sdoc-seg-u" href="http://code.google.com/intl/de-DE/apis/kml/">KML</a> (<em class="sdoc-seg-e">Keyhole
  Markup Language</em>), die die Bilder beschreibt und festlegt, wie
  Google Earth mit ihnen verfahren soll. KML ist XML-basiert und
  wird in einer Datei mit der Extension .kml gespeichert.
</p>
<p class="sdoc-para-p">
  Die kml-Datei und die Bild-Dateien können zusammen in Form einer
  einzelnen kmz-Datei an Google Earth übergeben werden. Die kmz-Datei
  ist eine ZIP-Datei, die die genannten Dateien enthält.
</p>
<p class="sdoc-para-p">
  Die kmz-Datei wird entweder über "<tt class="sdoc-seg-c">File/Open</tt>" geladen oder als
  Parameter beim Aufruf von Google Earth angegeben.
</p>
<h1 class="sdoc-sec-h1">Beispiel</h1>
<p class="sdoc-fig-p">
  <img class="sdoc-fig-img" style="display:block" src="uploads/google-earth-overlay.png" width="539" height="622" alt="" />
</p>
<h1 class="sdoc-sec-h1">KML-Datei</h1>
<table cellpadding="0" cellspacing="0" class="sdoc-code-table">
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 1</td>
  <td class="sdoc-code-td-line"><span class="hl kwa">&lt;?xml</span> <span class="hl kwb">version</span>=<span class="hl str">&quot;1.0&quot;</span> <span class="hl kwb">encoding</span>=<span class="hl str">&quot;UTF-8&quot;</span><span class="hl kwa">?&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 2</td>
  <td class="sdoc-code-td-line"><span class="hl kwa">&lt;kml</span> <span class="hl kwb">xmlns</span>=<span class="hl str">&quot;http://www.opengis.net/kml/2.2&quot;</span><span class="hl kwa">&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 3</td>
  <td class="sdoc-code-td-line"><span class="hl kwa">&lt;Document&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 4</td>
  <td class="sdoc-code-td-line">  <span class="hl kwa">&lt;name&gt;</span>__NAME__<span class="hl kwa">&lt;/name&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 5</td>
  <td class="sdoc-code-td-line">  <span class="hl kwa">&lt;open&gt;</span><span class="hl num">1</span><span class="hl kwa">&lt;/open&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 6</td>
  <td class="sdoc-code-td-line">  <span class="hl kwa">&lt;description&gt;</span>__DESCRIPTION__<span class="hl kwa">&lt;/description&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 7</td>
  <td class="sdoc-code-td-line">  <span class="hl kwa">&lt;GroundOverlay&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 8</td>
  <td class="sdoc-code-td-line">    <span class="hl kwa">&lt;name&gt;</span>Image<span class="hl kwa">&lt;/name&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 9</td>
  <td class="sdoc-code-td-line">    <span class="hl kwa">&lt;Icon&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">10</td>
  <td class="sdoc-code-td-line">      <span class="hl kwa">&lt;href&gt;</span>__FILE__<span class="hl kwa">&lt;/href&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">11</td>
  <td class="sdoc-code-td-line">    <span class="hl kwa">&lt;/Icon&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">12</td>
  <td class="sdoc-code-td-line">    <span class="hl kwa">&lt;LatLonBox&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">13</td>
  <td class="sdoc-code-td-line">      <span class="hl kwa">&lt;north&gt;</span>__NORTH__<span class="hl kwa">&lt;/north&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">14</td>
  <td class="sdoc-code-td-line">      <span class="hl kwa">&lt;south&gt;</span>__SOUTH__<span class="hl kwa">&lt;/south&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">15</td>
  <td class="sdoc-code-td-line">      <span class="hl kwa">&lt;east&gt;</span>__EAST__<span class="hl kwa">&lt;/east&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">16</td>
  <td class="sdoc-code-td-line">      <span class="hl kwa">&lt;west&gt;</span>__WEST__<span class="hl kwa">&lt;/west&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">17</td>
  <td class="sdoc-code-td-line">    <span class="hl kwa">&lt;/LatLonBox&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">18</td>
  <td class="sdoc-code-td-line">  <span class="hl kwa">&lt;/GroundOverlay&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">19</td>
  <td class="sdoc-code-td-line">  <span class="hl kwa">&lt;ScreenOverlay&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">20</td>
  <td class="sdoc-code-td-line">    <span class="hl kwa">&lt;name&gt;</span>Legend<span class="hl kwa">&lt;/name&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">21</td>
  <td class="sdoc-code-td-line">    <span class="hl kwa">&lt;Icon&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">22</td>
  <td class="sdoc-code-td-line">      <span class="hl kwa">&lt;href&gt;</span>__LEGEND_FILE__<span class="hl kwa">&lt;/href&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">23</td>
  <td class="sdoc-code-td-line">    <span class="hl kwa">&lt;/Icon&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">24</td>
  <td class="sdoc-code-td-line">    <span class="hl kwa">&lt;overlayXY</span> <span class="hl kwb">x</span>=<span class="hl str">&quot;0.02&quot;</span> <span class="hl kwb">y</span>=<span class="hl str">&quot;0.98&quot;</span> <span class="hl kwb">xunits</span>=<span class="hl str">&quot;fraction&quot;</span> <span class="hl kwb">yunits</span>=<span class="hl str">&quot;fraction&quot;</span><span class="hl kwa">/&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">25</td>
  <td class="sdoc-code-td-line">    <span class="hl kwa">&lt;screenXY</span> <span class="hl kwb">x</span>=<span class="hl str">&quot;0.02&quot;</span> <span class="hl kwb">y</span>=<span class="hl str">&quot;0.98&quot;</span> <span class="hl kwb">xunits</span>=<span class="hl str">&quot;fraction&quot;</span> <span class="hl kwb">yunits</span>=<span class="hl str">&quot;fraction&quot;</span><span class="hl kwa">/&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">26</td>
  <td class="sdoc-code-td-line">    <span class="hl kwa">&lt;size</span> <span class="hl kwb">x</span>=<span class="hl str">&quot;-1&quot;</span> <span class="hl kwb">y</span>=<span class="hl str">&quot;-1&quot;</span> <span class="hl kwb">xunits</span>=<span class="hl str">&quot;pixels&quot;</span> <span class="hl kwb">yunits</span>=<span class="hl str">&quot;pixels&quot;</span><span class="hl kwa">/&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">27</td>
  <td class="sdoc-code-td-line">  <span class="hl kwa">&lt;/ScreenOverlay&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln">28</td>
  <td class="sdoc-code-td-line"><span class="hl kwa">&lt;/Document&gt;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln">29</td>
  <td class="sdoc-code-td-line"><span class="hl kwa">&lt;/kml&gt;</span></td>
</tr>
</table>
<p class="sdoc-para-p">
  Obige KML-Spezifiktion beschreibt ein Bild, das auf die Erdoberfläche
  projeziert wird (Element GroundOverlay) und ein Bild, das statisch in
  der oberen linken Ecke des Fensters dargestellt wird (Element
  ScreenOverlay). Die beteiligten Hauptelemente sind:
  <a class="sdoc-seg-u" href="http://code.google.com/intl/de-DE/apis/kml/documentation/kmlreference.html#document">Document</a>,
  <a class="sdoc-seg-u" href="http://code.google.com/intl/de-DE/apis/kml/documentation/kmlreference.html#groundoverlay">GroundOverlay</a>,
  <a class="sdoc-seg-u" href="http://code.google.com/intl/de-DE/apis/kml/documentation/kmlreference.html#screenoverlay">ScreenOverlay</a>.
</p>
<p class="sdoc-para-p">
  Für die Platzhalter __NAME__, __DESCRIPTION__ usw. müssen konkrete
  Werte eingesetzt werden.
</p>
<dl class="sdoc-list-dl">
  <dt class="sdoc-list-dt">__NAME__</dt>
  <dd class="sdoc-list-dd">
    <p class="sdoc-para-p">
      Bezeichnung des Orts (Google-Terminus: Place). Diese Bezeichnung
      erscheint auf der linken Seite im Fenster und kann direkt ausgewählt werden.
    </p>
  </dd>
  <dt class="sdoc-list-dt">__DESCRIPTION__</dt>
  <dd class="sdoc-list-dd">
    <p class="sdoc-para-p">
      Beschreibung zum Ort.
    </p>
  </dd>
  <dt class="sdoc-list-dt">__FILE__</dt>
  <dd class="sdoc-list-dd">
    <p class="sdoc-para-p">
      Dateiname des Bildes, das auf die Erdoberfläche projeziert wird.
    </p>
  </dd>
  <dt class="sdoc-list-dt">__NORTH__, __SOUTH__, __EAST__, __WEST__</dt>
  <dd class="sdoc-list-dd">
    <p class="sdoc-para-p">
      Quadrupel von dezimalen Gradzahlen, die die geografische Region
      definieren.
    </p>
  </dd>
  <dt class="sdoc-list-dt">__LEGEND_FILE__</dt>
  <dd class="sdoc-list-dd">
    <p class="sdoc-para-p">
      Dateiname des statischen Bildes (das wir hier als "Legende" bezeichnen).
    </p>
  </dd>
</dl>
<h1 class="sdoc-sec-h1">MIME Type</h1>
<p class="sdoc-para-p">
  Wird die kmz-Datei von einem HTTP-Server ausgeliefert, sollte
  dieser den MIME-Type kennen:
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">application/vnd.google-earth.kmz kmz</pre>
</div>
<p class="sdoc-para-p">
  Im Browser kann Google-Earth als Helper-Applikation vereinbart werden.
  Beim Eintreffen einer kmz-Datei wird Google Earth dann automatisch
  gestartet und positioniert an den betreffenden Ort.
  Die Angaben für den Browser sind:
</p>
<table class="sdoc-keyval-table">
<tr class="sdoc-keyval-tr">
  <td class="sdoc-keyval-td-key">Mime-Type:</td>
  <td class="sdoc-keyval-td-value">application/vnd.google-earth.kmz</td>
</tr>
<tr class="sdoc-keyval-tr">
  <td class="sdoc-keyval-td-key">Description:</td>
  <td class="sdoc-keyval-td-value">Keyhole Markup Language Archive</td>
</tr>
<tr class="sdoc-keyval-tr">
  <td class="sdoc-keyval-td-key">Extension:</td>
  <td class="sdoc-keyval-td-value">kmz</td>
</tr>
</table>
<h1 class="sdoc-sec-h1">Applikation</h1>
<p class="sdoc-para-p">
  <a class="sdoc-seg-u" href="http://ferrydata.gkss.de/index.cgi?seite=map_plot">http://ferrydata.gkss.de/index.cgi?seite=map_plot</a>
</p> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/24-Perl-Gleitkomma-Zahlen-ausgeben-wie-sie-sind.html" rel="alternate" title="Perl: Gleitkomma-Zahlen ausgeben wie sie sind" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-01-27T10:13:40Z</published>
        <updated>2010-01-27T18:02:47Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=24</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=24</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/1-Perl" label="Perl" term="Perl" />
    
        <id>http://fseitz.de/blog/index.php?/archives/24-guid.html</id>
        <title type="html">Perl: Gleitkomma-Zahlen ausgeben wie sie sind</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>
Vielleicht trivial, aber mir war die Antwort bislang nicht klar: Wie gebe ich
eine Gleitkomma-Zahl aus, ohne dass Stellen wegfallen oder überflüssige Nullen am Ende erscheinen?
</p>

<p>
Bei der Ausgabe von Gleitkommazahlen habe ich bislang automatisch zu printf/sprintf
und %f gegriffen, aber das Format-Element %f formatiert die Zahlen ja immer auf
eine feste Anzahl an Stellen und rundet auf die letzte Stelle. Z.B.
</p>

<pre class="s-pre-box">
my $x = 0.123456789;
printf "%f",$x;
</pre>

<p>
ergibt
</p>

<pre class="s-pre-box">
0.123457
</pre>

<p>
(%f formatiert/rundet per Default auf 6 Nachkommastellen)
</p>

<p>
Natürlich kann ich die Anzahl der Stellen groß wählen, aber dann bekomme
ich u.U. zusätzliche Stellen, wenn die betreffende Zahl binär nur
näherungsweise dargestellt werden kann:
</p>

<pre class="s-pre-box">
my $x = 0.123456789;
printf "%.20f",$x;
</pre>

<p>
ergibt
</p>

<pre class="s-pre-box">
0.12345678899999999734
</pre>

<p>
Andererseits erhalte ich am Ende überflüssige Nullen bei Zahlen,
die dezimal weniger als die vorgegebenen Stellen besitzen:
</p>

<pre class="s-pre-box">
my $x = 0.5;
printf "%.20f",$x;
</pre>

<p>
ergibt
</p>

<pre class="s-pre-box">
0.50000000000000000000
</pre>

<p>
Was tun?
</p>

<p>
Die Lösung ist (anscheinend) einfach: Ich gebe die Zahl nicht als Zahl sondern als <i>String</i> aus!
D.h. im Falle von printf/sprintf mit Format-Element %s!
</p>

<p>
Damit erhalte ich, was ich will. Die Zahl mit allen Stellen und nicht mehr
</p>

<pre class="s-pre-box">
my $x = 0.123456789;
printf "%s",$x;
</pre>

<pre class="s-pre-box">
0.123456789
</pre>

<p>
und ohne überflüssige Nullen
</p>

<pre class="s-pre-box">
my $x = 0.5;
printf "%s",$x;
</pre>

<pre class="s-pre-box">
0.5
</pre>

<p>
Bei näherer Überlegung leuchtet das ein, da Perl intern neben der (binären) numerischen
Repräsentation eine Stringrepräsentation des Werts speichert, welche anfänglich
genau der Zeichenfolge bei der Zuweisung entspricht.
</p>

<p>
Schlussfolgerung: Programme, die nicht rechnen, sondern Gleitkommazahlen
nur einlesen und wieder ausgeben, sollten, um Verfälschungen auszuschließen,
diese bei der Ausgabe grundsätzlich als Strings und nicht als Zahlen behandeln.
</p>
 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/23-Email-Adressen-in-HTML-vor-Spammern-schuetzen.html" rel="alternate" title="Email-Adressen in HTML vor Spammern schützen" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-01-26T11:09:37Z</published>
        <updated>2010-01-27T07:49:18Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=23</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=23</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/7-HTML+CSS" label="HTML+CSS" term="HTML+CSS" />
    
        <id>http://fseitz.de/blog/index.php?/archives/23-guid.html</id>
        <title type="html">Email-Adressen in HTML vor Spammern schützen</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <h4 class="s-h4">In Mailto-URLs</h4>

<p>
Statt den Mailto-URL per href zu setzen, wird der mailto-URL zum Zeitpunkt
des Klicks via JavaScript generiert.
</p>

<p>
Nicht gut:
</p>

<pre class="s-pre-box">
&lt;a href="<b>mailto:rudi.ratlos<span style="color:#ff5a5a;">@</span>host.dom</b>"&gt;...&lt;/a&gt;
</pre>

<p>
Besser:
</p>

<pre class="s-pre-box">
&lt;a href="#" onclick="this.href = '<b>mailto:rudi.ratlos</b>'+'<b><span style="color:#ff5a5a;">&amp;#64;</span></b>'+'<b>host.dom</b>'"&gt;...&lt;a/&gt;
</pre>

<p>
Dies setzt natürlich JavaScript voraus. Aber schreibt heutzutage noch jemand
Web-Anwendungen ohne JavaScript?
</p>

<h4 class="s-h4">Im Text</h4>

<p>
Statt die Email-Adresse im Klartext hinzuschreiben, wird das <code>@</code>-Zeichen ausgetauscht:
entweder durch ein HTML-Entity, eine Zeichenkette wie "<code>&lt;AT&gt;</code>"
oder eine Grafik:
</p>

<p>
Nicht gut:
</p>

<pre class="s-pre-box">
<b>rudi.ratlos<span style="color:#ff5a5a;">@</span>host.dom</b>
</pre>

<p>
Besser:
</p>

<pre class="s-pre-box">
<b>rudi.ratlos<span style="color:#ff5a5a;">&amp;#64;</span>host.dom</b>
</pre>

<p>
Noch besser, mit Text:
</p>

<pre class="s-pre-box">
<b>rudi.ratlos<span style="color:#ff5a5a;">&amp;lt;AT&amp;gt;</span>host.dom</b>
</pre>

<p>
Mit Grafik:
</p>

<pre class="s-pre-box">
<b>rudi.ratlos<span style="color:#ff5a5a;">&lt;img src="at.png" alt="AT" ... /&gt;</span>host.dom</b>
</pre>

<p>
Bei einer Grafik besteht das Problem, dass diese vom Aussehen statisch ist, das Aussehen des
umgebenden Textes u.U. nicht immer gleich ist, z.B. in unterschiedlichen Browsern oder
durch Farbänderung beim Überfahren eines Links.
</p>
 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/22-HTML-String-in-Entity-Schreibweise-wandeln.html" rel="alternate" title="HTML: String in Entity-Schreibweise wandeln" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-01-26T09:13:55Z</published>
        <updated>2010-03-31T08:15:51Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=22</wfw:comment>
    
        <slash:comments>4</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=22</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/7-HTML+CSS" label="HTML+CSS" term="HTML+CSS" />
    
        <id>http://fseitz.de/blog/index.php?/archives/22-guid.html</id>
        <title type="html">HTML: String in Entity-Schreibweise wandeln</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p class="sdoc-para-p">
  Eine einfache (eventuell nicht besonders wirksame) Methode, um
  Email-Adressen in HTML-Seiten unkenntlich zu machen, um sie vor
  Spammern zu verbergen, ist, sie in Entity-Schreibweise zu wandeln. Das
  folgende Perl-Skript wandelt einen beliebigen String in
  Entity-Schreibweise:
</p>
<table cellpadding="0" cellspacing="0" class="sdoc-code-table">
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 1</td>
  <td class="sdoc-code-td-line"><span class="pt-k">while</span> <span class="pt-s">(</span><span class="pt-i">$str</span> =~ <span class="pt-q">/(.)/g</span><span class="pt-s">)</span> <span class="pt-s">{</span></td>
</tr>
<tr class="sdoc-code-tr-even">
  <td class="sdoc-code-td-ln"> 2</td>
  <td class="sdoc-code-td-line">    <span class="pt-k">printf</span> <span class="pt-q">&#39;&amp;#%d;&#39;</span><span class="pt-cm">,</span><span class="pt-k">ord</span> <span class="pt-i">$1</span><span class="pt-sc">;</span></td>
</tr>
<tr class="sdoc-code-tr-odd">
  <td class="sdoc-code-td-ln"> 3</td>
  <td class="sdoc-code-td-line"><span class="pt-s">}</span></td>
</tr>
</table>
<p class="sdoc-para-p">
  Beispiel:
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">$ ./str-to-entity 'rudi.ratlos@...'&#10;&amp;#114;&amp;#117;&amp;#100;&amp;#105;&amp;#46;&amp;#114;&amp;#97;&amp;#116;&amp;#108;&amp;#111;&amp;#115;&amp;#64;&amp;#46;&amp;#46;&amp;#46;</pre>
</div> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/21-SSH-Timeout-unterbinden.html" rel="alternate" title="SSH: Timeout unterbinden" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-01-25T14:26:04Z</published>
        <updated>2010-01-27T14:14:16Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=21</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=21</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/13-SSH" label="SSH" term="SSH" />
    
        <id>http://fseitz.de/blog/index.php?/archives/21-guid.html</id>
        <title type="html">SSH: Timeout unterbinden</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <h4 class="s-h4">Clientseitig</h4>

<pre class="s-pre-box">
$ echo "ServerAliveInterval 120" >> /etc/ssh/ssh_config
</pre>

<p>
Wenn der Server 120 Sekunden kein Paket gesendet hat, sendet der Client ein Dummy-Paket zum Server.
</p>

<h4 class="s-h4">Serverseitig</h4>

<pre class="s-pre-box">
$ echo "ClientAliveInterval 120" >> /etc/ssh/sshd_config
$ /etc/init.d/ssh reload
</pre>

<p>
Wenn der Client 120 Sekunden kein Paket gesendet hat, sendet der Server ein Dummy-Paket zum Client. 
</p> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/20-SSH-Automatisch-einloggen.html" rel="alternate" title="SSH: Automatisch einloggen" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-01-25T14:06:26Z</published>
        <updated>2010-01-27T07:53:56Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=20</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=20</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/13-SSH" label="SSH" term="SSH" />
    
        <id>http://fseitz.de/blog/index.php?/archives/20-guid.html</id>
        <title type="html">SSH: Automatisch einloggen</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>
Ein automatisches Login führt SSH durch, wenn auf der Zielmaschine
der Öffentliche Schlüssel des eigenen Accounts hinterlegt ist. Der
Öffentliche Schlüssel wird auf der Zielmaschine zum Zielaccount
hinzugefügt mittels:
</p>

<pre class="s-pre-box">
$ cat id_rsa.pub >>.ssh/authorized_keys2
</pre>

<p>
Information zur Schlüsselgenerierung:
<a href="http://www.supportnet.de/faqsthread/806">http://www.supportnet.de/faqsthread/806</a>
</p> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/19-PostgreSQL-TIMESTAMP-nach-EPOCH-wandeln-und-zurueck.html" rel="alternate" title="PostgreSQL: TIMESTAMP nach EPOCH wandeln und zurück" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-01-22T15:49:32Z</published>
        <updated>2010-01-27T09:20:15Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=19</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=19</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/5-PostgreSQL" label="PostgreSQL" term="PostgreSQL" />
    
        <id>http://fseitz.de/blog/index.php?/archives/19-guid.html</id>
        <title type="html">PostgreSQL: TIMESTAMP nach EPOCH wandeln und zurück</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <h4 class="s-h4">TIMESTAMP WITHOUT TIME ZONE nach EPOCH</h4>

<p>
Umwandlung eines <code>TIMESTAMP WITHOUT TIME ZONE</code>
in Unix-Epoch (Sekunden seit 1.1.1970 0 Uhr) in einer Anwendung, die mit
UTC-Zeiten arbeitet:
</p>

<pre class="s-pre-box">
sql> SELECT EXTRACT(EPOCH FROM TIMESTAMP '1970-01-01 00:00:00' AT TIME ZONE 'UTC') AS t;
 t 
---
 0
</pre>

<p>
Entscheidend ist hier der Zusatz "<code>AT TIME ZONE 'UTC'</code>", denn ein
<code>TIMESTAMP WITHOUT TIME ZONE</code> wird als Zeit der <i>lokalen</i> Zeitzone
interpretiert - nicht etwa UTC! Ohne den Zusatz ist das Resultat um dem Offset der
lokalen Zeitzone verschoben - böse Falle. Hier das Ergebnis im Falle von MEZ (+0100):
</p>

<pre class="s-pre-box">
sql> SELECT EXTRACT(EPOCH FROM TIMESTAMP '1970-01-01 00:00:00') AS t;
   t   
-------
 -3600
</pre>

<h4 class="s-h4">Erläuterungen</h4>

<ul class="s-ul">
  <li><code>EXTRACT(EPOCH FROM <i>t</i>)</code> extrahiert die Epoch-Sekunden
    vom Zeit-Wert <code><i>t</i></code>.</li>
  <li><code>TIMESTAMP '1970-01-01 00:00:00'</code> ist die Zeitangabe
    <code><i>t</i></code>.</li>
  <li><code>AT TIME ZONE 'UTC'</code> interpretiert die Zeitangabe
    <code><i>t</i></code> hinsichtlich Zeitzone UTC.</li>
</ul>

<h4 class="s-h4">EPOCH nach TIMESTAMP WITHOUT TIMEZONE</h4>

<p>
Umwandlung von Epoch-Sekunden in einen <code>TIMESTAMP WITHOUT TIMEZONE</code>
(die<code>0</code> steht für den Epoch-Wert):
</p>

<pre class="s-pre-box">
sql> gkss=# SELECT TIMESTAMP 'epoch' + 0 * INTERVAL '1 second' AS t;
         t    
---------------------
 1970-01-01 00:00:00
</pre>

<h4 class="s-h4">Erläuterungen</h4>

<ul class="s-ul">
  <li><code>TIMESTAMP 'epoch'</code> bzeichnet den Anfang der Zeitrechnung (1.1.1970 0 Uhr).</li>
  <li><code>0 * INTERVAL '1 second'</code> ist der Zeitoffset in Sekunden, der hinzuaddiert wird.
    Er kann auch negativ sein.</li>
  <li>Das Resultat ist ein Timestamp.</li>
</ul>
 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/18-Verzeichnisse-via-rsync-abgleichen.html" rel="alternate" title="Verzeichnisse via rsync abgleichen" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-01-21T18:26:19Z</published>
        <updated>2010-01-26T07:27:37Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=18</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=18</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/14-rsync" label="rsync" term="rsync" />
    
        <id>http://fseitz.de/blog/index.php?/archives/18-guid.html</id>
        <title type="html">Verzeichnisse via rsync abgleichen</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <h3 class="s-h3">Verzeichnisbaum spiegeln (local => remote)</h3>

<pre class="s-pre-box">
$ rsync -avz --delete <b><i>dir1/</i></b>&#160;<b><i>user</i></b>@<b><i>host</i></b>:<b><i>dir2</i></b>
</pre>

<p>
Der trailing Slash bei <code><i>dir1/</i></code> ist wichtig, da sonst <code><i>dir1</i></code>
in dir  <code><i>dir2</i></code> hineinkopiert wird. Die Verzeichnisse können unterschiedlich
heißen.
</p>

<p>
Bei Angabe der Option <code>-n</code> wird die Ausführung nur simuliert.
</p>

<h3 class="s-h3">Via ssh</h3>

<pre class="s-pre-box">
$ rsync -e ssh -avz --delete <b><i>dir1/</i></b>&#160;<b><i>user</i></b>@<b><i>host</i></b>:<b><i>dir2</i></b>
</pre>

<h3 class="s-h3">Via ssh mit speziellem Port</h3>

<pre class="s-pre-box">
$ rsync --rsh='ssh -p <b><i>port</i></b>' -avz --delete <b><i>dir1/</i></b>&#160;<b><i>user</i></b>@<b><i>host</i></b>:<b><i>dir2</i></b>
</pre>
 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/17-Perl-Operationen-auf-Symlinks.html" rel="alternate" title="Perl-Operationen auf Symlinks" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-01-20T10:15:34Z</published>
        <updated>2010-01-21T08:13:11Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=17</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=17</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/1-Perl" label="Perl" term="Perl" />
    
        <id>http://fseitz.de/blog/index.php?/archives/17-guid.html</id>
        <title type="html">Perl-Operationen auf Symlinks</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>
Für den Umgang mit Symlinks stellt Perl eine Reihe von Builtins zur Verfügung,
die nicht unbedingt offensichtlich sind. Hier eine kurze Übersicht:
</p>

<dl>
  <dt><code>$bool = -l $path</code></dt>
  <dd>Test auf Symlink.</dd>
  <dt><code>@stat = lstat $path</code></dt>
  <dd>Dateisystem-Eigenschaften des Symlink.</dd>
  <dt><code>$destPath = readlink $path</code></dt>
  <dd>Ziel des Symlink.</dd>
  <dt><code>$bool = symlink $path,$destPath</code></dt>
  <dd>Erstelle Symlink $path mit Ziel $destPath. Liefert 0 im Fehlerfall.</dd>
</dl> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/16-Liste-der-zusaetzlich-installierten-Perl-Module.html" rel="alternate" title="Liste der zusätzlich installierten Perl-Module" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-01-19T20:43:28Z</published>
        <updated>2010-03-31T08:18:15Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=16</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=16</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/1-Perl" label="Perl" term="Perl" />
    
        <id>http://fseitz.de/blog/index.php?/archives/16-guid.html</id>
        <title type="html">Liste der zusätzlich installierten Perl-Module</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p class="sdoc-para-p">
  Wie ermittele ich, welche Perl-Module über das Grundsystem hinaus
  installiert wurden?
</p>
<p class="sdoc-para-p">
  Die Antwort liefert das Kommando:
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">$ perldoc perllocal</pre>
</div>
<p class="sdoc-para-p">
  Das Ergebnis ist ein formatiertes POD-Dokument, das die
  Installationshistorie aller per <tt class="sdoc-seg-c">make install</tt> oder
  <tt class="sdoc-seg-c">./Build install</tt> installierten Module aufführt.
</p>
<p class="sdoc-para-p">
  Das Dokument wird mit der Installation des ersten Moduls
  angelegt. Unmittelbar nach Installation des Core-Systems ist es noch
  nicht vorhanden, da noch kein zusätzliches Modul installiert wurde.
</p>
<p class="sdoc-para-p">
  Mit jeder Modul-Installation wird ein Eintrag am Ende hinzugefügt.
  Wird ein Modul mehrfach installiert, taucht es mehrfach auf.
</p>
<h1 class="sdoc-sec-h1">Programm</h1>
<p class="sdoc-para-p">
  Liefere die Namen der zusätzlich installierten Module, alphabetisch
  sortiert, ohne Doubletten:
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre"><span class="sdoc-code-ln"> 1</span> #!/usr/bin/env perl&#10;<span class="sdoc-code-ln"> 2</span> &#10;<span class="sdoc-code-ln"> 3</span> <span class="pt-k">use</span> <span class="pt-w">strict</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln"> 4</span> <span class="pt-k">use</span> <span class="pt-w">warnings</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln"> 5</span> &#10;<span class="sdoc-code-ln"> 6</span> <span class="pt-k">my</span> <span class="pt-i">%mod</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln"> 7</span> <span class="pt-k">my</span> <span class="pt-i">$cmd</span> = <span class="pt-q">&#39;perldoc -u perllocal&#39;</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln"> 8</span> <span class="pt-k">open</span><span class="pt-s">(</span><span class="pt-k">my</span> <span class="pt-i">$fh</span><span class="pt-cm">,</span><span class="pt-q">&#39;-|&#39;</span><span class="pt-cm">,</span><span class="pt-i">$cmd</span><span class="pt-s">)</span> <span class="pt-k">or</span> <span class="pt-k">die</span> <span class="pt-q">&quot;ERROR: open failed ($!)&quot;</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln"> 9</span> <span class="pt-k">while</span> <span class="pt-s">(</span><span class="pt-q">&lt;$fh&gt;</span><span class="pt-s">)</span> <span class="pt-s">{</span>&#10;<span class="sdoc-code-ln">10</span>     <span class="pt-k">if</span> <span class="pt-s">(</span><span class="pt-q">/^=head2.*\|(.*)&gt;/</span><span class="pt-s">)</span> <span class="pt-s">{</span>&#10;<span class="sdoc-code-ln">11</span>         <span class="pt-i">$mod</span>{<span class="pt-i">$1</span>} = <span class="pt-n">1</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">12</span>     <span class="pt-s">}</span>&#10;<span class="sdoc-code-ln">13</span> <span class="pt-s">}</span>&#10;<span class="sdoc-code-ln">14</span> <span class="pt-k">close</span><span class="pt-s">(</span><span class="pt-i">$fh</span><span class="pt-s">)</span> <span class="pt-k">or</span> <span class="pt-k">die</span> <span class="pt-q">qq|ERROR: Command failed: &quot;$cmd&quot; (Exit Code: $?)\n|</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">15</span> &#10;<span class="sdoc-code-ln">16</span> <span class="pt-k">for</span> <span class="pt-k">my</span> <span class="pt-i">$mod</span> <span class="pt-s">(</span><span class="pt-k">sort</span> <span class="pt-k">keys</span> <span class="pt-i">%mod</span><span class="pt-s">)</span> <span class="pt-s">{</span>&#10;<span class="sdoc-code-ln">17</span>     <span class="pt-k">print</span> <span class="pt-q">&quot;$mod\n&quot;</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">18</span> <span class="pt-s">}</span>&#10;<span class="sdoc-code-ln">19</span> &#10;<span class="sdoc-code-ln">20</span> <span class="pt-c"># eof</span>&#10;</pre>
</div> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/14-Icons.html" rel="alternate" title="Icons" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-01-13T08:15:00Z</published>
        <updated>2010-03-19T16:07:35Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=14</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=14</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/10-Grafik" label="Grafik" term="Grafik" />
    
        <id>http://fseitz.de/blog/index.php?/archives/14-guid.html</id>
        <title type="html">Icons</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>
  Sammlung von mehreren tausend qualitativ hochwertigen Desktop- und Web-Icons:
  <a href="http://www.iconarchive.com/">http://www.iconarchive.com/</a>
</p>

<table>
<tr>
  <td><img src="uploads/Misc-Videos-icon.png" width="64" height="64" alt="" /></td>
  <td><img src="uploads/Misc-System-icon.png" width="64" height="64" alt="" /></td>
  <td><img src="uploads/Misc-Globe-icon.png" width="64" height="64" alt="" /></td>
  <td><img src="uploads/Misc-Music-icon.png" width="64" height="64" alt="" /></td>
</tr>
</table>

<p>
   Fugue Icons: <a href="http://p.yusukekamiyamane.com/">http://p.yusukekamiyamane.com/</a>
</p> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/13-GIMP-Operationen.html" rel="alternate" title="GIMP Operationen" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-01-12T22:01:04Z</published>
        <updated>2010-01-14T08:41:44Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=13</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=13</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/10-Grafik" label="Grafik" term="Grafik" />
    
        <id>http://fseitz.de/blog/index.php?/archives/13-guid.html</id>
        <title type="html">GIMP Operationen</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <h3 class="s-h3">Farbe transparent machen</h3>

<p>
Menüpunkt: "<code>Colors/Color to Alpha...</code>"
</p> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/12-ISO-8859-1-nach-UTF-8-konvertieren.html" rel="alternate" title="ISO-8859-1 nach UTF-8 konvertieren" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-01-12T19:17:02Z</published>
        <updated>2010-01-12T19:23:00Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=12</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=12</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/8-Unicode+UTF-8" label="Unicode+UTF-8" term="Unicode+UTF-8" />
    
        <id>http://fseitz.de/blog/index.php?/archives/12-guid.html</id>
        <title type="html">ISO-8859-1 nach UTF-8 konvertieren</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <pre class="s-pre-box">
$ tcs -f 8859-1 INPUT &gt;OUTPUT
</pre>
 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/11-Speicherbedarf-von-Perl-Variablen.html" rel="alternate" title="Speicherbedarf von Perl-Variablen" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-01-12T10:18:58Z</published>
        <updated>2010-03-31T08:18:13Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=11</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=11</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/1-Perl" label="Perl" term="Perl" />
    
        <id>http://fseitz.de/blog/index.php?/archives/11-guid.html</id>
        <title type="html">Speicherbedarf von Perl-Variablen</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p class="sdoc-para-p">
  Der Speicherbedarf von einzelnen Perl-Variablen und komplexeren
  Datenstrukturen lässt sich mit
  <a class="sdoc-seg-u" href="http://search.cpan.org/~tels/Devel-Size/">Devel::Size</a>
  ermitteln. Hier die Werte für Perl 5.10 auf einem 32-Bit System.
</p>
<p class="sdoc-para-p">
  (Eine andere Betrachtung - Messung des verbrauchten virtuellen
  Speichers bei großen Datenstrukturen - hat Peter J. Holzer angestellt:
  <a class="sdoc-seg-u" href="http://www.hjp.at/programming/perl/memory/">http://www.hjp.at/programming/perl/memory/</a>)
</p>
<h1 class="sdoc-sec-h1">Skalare</h1>
<table class="sdoc-tab-table">
<tr class="sdoc-tab-tr-odd">
  <th class="sdoc-tab-th" align="left">Skalar ohne Wert:</th>
  <td class="sdoc-tab-td" align="left">16 Bytes</td>
</tr>
<tr class="sdoc-tab-tr-even">
  <th class="sdoc-tab-th" align="left">Referenz:</th>
  <td class="sdoc-tab-td" align="left">16 Bytes</td>
</tr>
<tr class="sdoc-tab-tr-odd">
  <th class="sdoc-tab-th" align="left">Integer:</th>
  <td class="sdoc-tab-td" align="left">16 Bytes</td>
</tr>
<tr class="sdoc-tab-tr-even">
  <th class="sdoc-tab-th" align="left">Float:</th>
  <td class="sdoc-tab-td" align="left">24 Bytes</td>
</tr>
<tr class="sdoc-tab-tr-odd">
  <th class="sdoc-tab-th" align="left">Leerstring:</th>
  <td class="sdoc-tab-td" align="left">36 Bytes</td>
</tr>
<tr class="sdoc-tab-tr-even">
  <th class="sdoc-tab-th" align="left">String der Länge n:</th>
  <td class="sdoc-tab-td" align="left">36+n Bytes</td>
</tr>
</table>
<p class="sdoc-para-p">
  Perl alloziert bei Strings jeweils 4 Bytes im Voraus, vermutlich um
  jedes UTF-8 Zeichen speichern zu können. Obige Berechnung geht von
  1-Byte-Zeichen aus. Enthält der String UTF-8 Zeichen mit 2, 3 oder 4
  Byte, vergrößert sich der Platzbedarf entsprechend.
</p>
<h1 class="sdoc-sec-h1">Arrays</h1>
<table class="sdoc-tab-table">
<tr class="sdoc-tab-tr-odd">
  <th class="sdoc-tab-th" align="left">leeres Array:</th>
  <td class="sdoc-tab-td" align="left">100 Bytes</td>
</tr>
<tr class="sdoc-tab-tr-even">
  <th class="sdoc-tab-th" align="left">Array der Größe n:</th>
  <td class="sdoc-tab-td" align="left">100+4*n Bytes</td>
</tr>
</table>
<p class="sdoc-para-p">
  Perl vergrößert ein Array schrittweise auf 4, 8, 16, 32, 64,
  ... Elemente. D.h. wird das 4. Element zugewiesen, vergößert Perl
  intern schon auf 8 Elemente usw. Für jedes Element alloziert Perl
  einen Pointer (4 Bytes). Die angegebene Größe ist der
  <i class="sdoc-seg-i">Netto</i>-Speicherbedarf des Array, d.h. der Speicherbedarf der
  (skalaren) Werte kommt noch hinzu.
</p>
<h1 class="sdoc-sec-h1">Hashes</h1>
<table class="sdoc-tab-table">
<tr class="sdoc-tab-tr-odd">
  <th class="sdoc-tab-th" align="left">leerer Hash:</th>
  <td class="sdoc-tab-td" align="left">76 Bytes</td>
</tr>
<tr class="sdoc-tab-tr-even">
  <th class="sdoc-tab-th" align="left">Hash mit n Keys:</th>
  <td class="sdoc-tab-td" align="left">ungefähr 76+n*4+n*(durchschn. Keygröße+8+Anz. Buckets)</td>
</tr>
</table>
<p class="sdoc-para-p">
  Perl vergrößert einen Hash schrittweise auf 8, 16, 32, 64,
  ... Elemente. D.h. wird das 8. Element zugewiesen, vergößert Perl
  intern auf 16 Elemente usw. Für jeden Key alloziert Perl vorab einen
  Pointer (4 Bytes). Zusätzlich kommt mit zunehmender Anzahl Buckets ein
  wachsender Overhead von 9, 10, 11, ... Bytes je Key hinzu. Die Größe
  des Key geht auch mit ein. Bei der Messung unten ist der Key der
  String "EintragNNNN", also 11 Zeichen lang. Die angegebene Größe ist
  der <i class="sdoc-seg-i">Netto</i>-Speicherbedarf des Hash, d.h. der Speicherbedarf der
  Werte kommt noch hinzu.
</p>
<h1 class="sdoc-sec-h1">Messung</h1>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">Perl Version: 5.010000&#10;Skalar ohne Wert: 16 Bytes&#10;Referenz: 16 Bytes&#10;Integer: 16 Bytes&#10;Float: 24 Bytes&#10;String - leer: 36 Bytes&#10;String - 1 1-Byte Zeichen: 36 Bytes (Diff: 0)&#10;String - 2 1-Byte Zeichen: 36 Bytes (Diff: 0)&#10;String - 3 1-Byte Zeichen: 36 Bytes (Diff: 0)&#10;String - 4 1-Byte Zeichen: 40 Bytes (Diff: 4)&#10;String - 5 1-Byte Zeichen: 40 Bytes (Diff: 0)&#10;String - 6 1-Byte Zeichen: 40 Bytes (Diff: 0)&#10;String - 7 1-Byte Zeichen: 40 Bytes (Diff: 0)&#10;String - 8 1-Byte Zeichen: 44 Bytes (Diff: 4)&#10;String - 9 1-Byte Zeichen: 44 Bytes (Diff: 0)&#10;String - 10 1-Byte Zeichen: 44 Bytes (Diff: 0)&#10;String - 11 1-Byte Zeichen: 44 Bytes (Diff: 0)&#10;String - 12 1-Byte Zeichen: 48 Bytes (Diff: 4)&#10;String - 16 1-Byte Zeichen: 52 Bytes (Diff: 4)&#10;String - 20 1-Byte Zeichen: 56 Bytes (Diff: 4)&#10;Array - leer: 100 Bytes&#10;Array - 4 Elemente: 116 Bytes (Diff: 16) - 29.0 Bytes/Key&#10;Array - 8 Elemente: 148 Bytes (Diff: 32) - 18.5 Bytes/Key&#10;Array - 16 Elemente: 212 Bytes (Diff: 64) - 13.2 Bytes/Key&#10;Array - 32 Elemente: 340 Bytes (Diff: 128) - 10.6 Bytes/Key&#10;Array - 64 Elemente: 596 Bytes (Diff: 256) - 9.3 Bytes/Key&#10;Hash - leer: 76 Bytes&#10;Hash - 4 Keys: 208 Bytes (Diff: 132) - 52.0 Bytes/Key&#10;Hash - 8 Keys: 372 Bytes (Diff: 164) - 46.5 Bytes/Key&#10;Hash - 16 Keys: 636 Bytes (Diff: 264) - 39.8 Bytes/Key&#10;Hash - 32 Keys: 1228 Bytes (Diff: 592) - 38.4 Bytes/Key&#10;Hash - 64 Keys: 2412 Bytes (Diff: 1184) - 37.7 Bytes/Key&#10;Hash - 128 Keys: 4780 Bytes (Diff: 2368) - 37.3 Bytes/Key&#10;Hash - 256 Keys: 10540 Bytes (Diff: 5760) - 41.2 Bytes/Key&#10;Hash - 512 Keys: 18988 Bytes (Diff: 8448) - 37.1 Bytes/Key&#10;Hash - 1024 Keys: 42028 Bytes (Diff: 23040) - 41.0 Bytes/Key&#10;</pre>
</div>
<h1 class="sdoc-sec-h1">Programm</h1>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre"><span class="sdoc-code-ln"> 1</span> #!/usr/bin/env perl&#10;<span class="sdoc-code-ln"> 2</span> &#10;<span class="sdoc-code-ln"> 3</span> <span class="pt-k">use</span> <span class="pt-w">strict</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln"> 4</span> <span class="pt-k">use</span> <span class="pt-w">warnings</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln"> 5</span> &#10;<span class="sdoc-code-ln"> 6</span> <span class="pt-k">use</span> <span class="pt-w">Devel::Size</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln"> 7</span> &#10;<span class="sdoc-code-ln"> 8</span> <span class="pt-k">print</span> <span class="pt-q">&quot;Perl Version: $]\n&quot;</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln"> 9</span> &#10;<span class="sdoc-code-ln">10</span> <span class="pt-k">my</span> <span class="pt-i">$s1</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">11</span> <span class="pt-k">print</span> <span class="pt-q">&#39;Skalar ohne Wert: &#39;</span><span class="pt-cm">,</span><span class="pt-i">Devel::Size::size</span><span class="pt-s">(</span>\<span class="pt-i">$s1</span><span class="pt-s">)</span><span class="pt-cm">,</span><span class="pt-q">&quot; Bytes\n&quot;</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">12</span> &#10;<span class="sdoc-code-ln">13</span> <span class="pt-k">my</span> <span class="pt-i">$s2</span> = \<span class="pt-i">$s1</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">14</span> <span class="pt-k">print</span> <span class="pt-q">&#39;Referenz: &#39;</span><span class="pt-cm">,</span><span class="pt-i">Devel::Size::size</span><span class="pt-s">(</span>\<span class="pt-i">$s2</span><span class="pt-s">)</span><span class="pt-cm">,</span><span class="pt-q">&quot; Bytes\n&quot;</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">15</span> &#10;<span class="sdoc-code-ln">16</span> <span class="pt-k">my</span> <span class="pt-i">$s3</span> = <span class="pt-n">4711</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">17</span> <span class="pt-k">print</span> <span class="pt-q">&#39;Integer: &#39;</span><span class="pt-cm">,</span><span class="pt-i">Devel::Size::size</span><span class="pt-s">(</span>\<span class="pt-i">$s3</span><span class="pt-s">)</span><span class="pt-cm">,</span><span class="pt-q">&quot; Bytes\n&quot;</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">18</span> &#10;<span class="sdoc-code-ln">19</span> <span class="pt-k">my</span> <span class="pt-i">$s4</span> = <span class="pt-n">1234.567</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">20</span> <span class="pt-k">print</span> <span class="pt-q">&#39;Float: &#39;</span><span class="pt-cm">,</span><span class="pt-i">Devel::Size::size</span><span class="pt-s">(</span>\<span class="pt-i">$s4</span><span class="pt-s">)</span><span class="pt-cm">,</span><span class="pt-q">&quot; Bytes\n&quot;</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">21</span> &#10;<span class="sdoc-code-ln">22</span> <span class="pt-k">my</span> <span class="pt-i">$s5</span> = <span class="pt-q">&#39;&#39;</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">23</span> <span class="pt-k">my</span> <span class="pt-i">$nLast</span> = <span class="pt-i">Devel::Size::size</span><span class="pt-s">(</span>\<span class="pt-i">$s5</span><span class="pt-s">)</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">24</span> <span class="pt-k">print</span> <span class="pt-q">&quot;String - leer: $nLast Bytes\n&quot;</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">25</span> &#10;<span class="sdoc-code-ln">26</span> <span class="pt-k">for</span> <span class="pt-k">my</span> <span class="pt-i">$i</span> <span class="pt-s">(</span><span class="pt-n">1</span>..<span class="pt-n">12</span><span class="pt-cm">,</span><span class="pt-n">16</span><span class="pt-cm">,</span><span class="pt-n">20</span><span class="pt-s">)</span> <span class="pt-s">{</span>&#10;<span class="sdoc-code-ln">27</span>     <span class="pt-i">$s5</span> = <span class="pt-q">&#39;x&#39;</span>x<span class="pt-i">$i</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">28</span>     <span class="pt-k">my</span> <span class="pt-i">$n</span> = <span class="pt-i">Devel::Size::size</span><span class="pt-s">(</span>\<span class="pt-i">$s5</span><span class="pt-s">)</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">29</span>     <span class="pt-k">print</span> <span class="pt-q">&quot;String - $i 1-Byte Zeichen: $n Bytes (Diff: &quot;</span><span class="pt-cm">,</span><span class="pt-i">$n</span>-<span class="pt-i">$nLast</span><span class="pt-cm">,</span><span class="pt-q">&quot;)\n&quot;</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">30</span>     <span class="pt-i">$nLast</span> = <span class="pt-i">$n</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">31</span> <span class="pt-s">}</span>&#10;<span class="sdoc-code-ln">32</span> &#10;<span class="sdoc-code-ln">33</span> <span class="pt-k">my</span> <span class="pt-i">@a1</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">34</span> <span class="pt-i">$nLast</span> = <span class="pt-i">Devel::Size::size</span><span class="pt-s">(</span>\<span class="pt-i">@a1</span><span class="pt-s">)</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">35</span> <span class="pt-k">print</span> <span class="pt-q">&quot;Array - leer: $nLast Bytes\n&quot;</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">36</span> &#10;<span class="sdoc-code-ln">37</span> <span class="pt-k">for</span> <span class="pt-k">my</span> <span class="pt-i">$i</span> <span class="pt-s">(</span><span class="pt-n">4</span><span class="pt-cm">,</span><span class="pt-n">8</span><span class="pt-cm">,</span><span class="pt-n">16</span><span class="pt-cm">,</span><span class="pt-n">32</span><span class="pt-cm">,</span><span class="pt-n">64</span><span class="pt-s">)</span> <span class="pt-s">{</span>&#10;<span class="sdoc-code-ln">38</span>     <span class="pt-k">my</span> <span class="pt-i">@a2</span> = <span class="pt-s">(</span><span class="pt-n">1</span>..<span class="pt-i">$i</span><span class="pt-s">)</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">39</span>     <span class="pt-k">my</span> <span class="pt-i">$n</span> = <span class="pt-i">Devel::Size::size</span><span class="pt-s">(</span>\<span class="pt-i">@a2</span><span class="pt-s">)</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">40</span>     <span class="pt-k">my</span> <span class="pt-i">$diff</span> = <span class="pt-i">$n</span>-<span class="pt-i">$nLast</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">41</span>     <span class="pt-k">my</span> <span class="pt-i">$avg</span> = <span class="pt-i">$n</span>/<span class="pt-i">$i</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">42</span>     <span class="pt-k">printf</span> <span class="pt-q">&quot;Array - $i Elemente: $n Bytes (Diff: $diff) - %.1f Bytes/Key\n&quot;</span><span class="pt-cm">,</span><span class="pt-i">$avg</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">43</span>     <span class="pt-i">$nLast</span> = <span class="pt-i">$n</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">44</span> <span class="pt-s">}</span>&#10;<span class="sdoc-code-ln">45</span> &#10;<span class="sdoc-code-ln">46</span> <span class="pt-k">my</span> <span class="pt-i">%h1</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">47</span> <span class="pt-i">$nLast</span> = <span class="pt-i">Devel::Size::size</span><span class="pt-s">(</span>\<span class="pt-i">%h1</span><span class="pt-s">)</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">48</span> <span class="pt-k">print</span> <span class="pt-q">&quot;Hash - leer: $nLast Bytes\n&quot;</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">49</span> &#10;<span class="sdoc-code-ln">50</span> <span class="pt-k">for</span> <span class="pt-k">my</span> <span class="pt-i">$i</span> <span class="pt-s">(</span><span class="pt-n">4</span><span class="pt-cm">,</span><span class="pt-n">8</span><span class="pt-cm">,</span><span class="pt-n">16</span><span class="pt-cm">,</span><span class="pt-n">32</span><span class="pt-cm">,</span><span class="pt-n">64</span><span class="pt-cm">,</span><span class="pt-n">128</span><span class="pt-cm">,</span><span class="pt-n">256</span><span class="pt-cm">,</span><span class="pt-n">512</span><span class="pt-cm">,</span><span class="pt-n">1024</span><span class="pt-s">)</span> <span class="pt-s">{</span>&#10;<span class="sdoc-code-ln">51</span>     <span class="pt-k">my</span> <span class="pt-i">%h2</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">52</span>     <span class="pt-k">for</span> <span class="pt-s">(</span><span class="pt-k">my</span> <span class="pt-i">$j</span> = <span class="pt-n">1</span><span class="pt-sc">;</span> <span class="pt-i">$j</span> &lt;= <span class="pt-i">$i</span><span class="pt-sc">;</span> <span class="pt-i">$j</span>++<span class="pt-s">)</span> <span class="pt-s">{</span>&#10;<span class="sdoc-code-ln">53</span>         <span class="pt-i">$h2</span>{<span class="pt-k">sprintf</span> <span class="pt-q">&#39;Eintrag%04d&#39;</span><span class="pt-cm">,</span><span class="pt-i">$j</span>} = <span class="pt-i">$j</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">54</span>     <span class="pt-s">}</span>&#10;<span class="sdoc-code-ln">55</span>     <span class="pt-c"># @h2{(1..$i)} = (1..$i);</span>&#10;<span class="sdoc-code-ln">56</span>     <span class="pt-k">my</span> <span class="pt-i">$n</span> = <span class="pt-i">Devel::Size::size</span><span class="pt-s">(</span>\<span class="pt-i">%h2</span><span class="pt-s">)</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">57</span>     <span class="pt-k">my</span> <span class="pt-i">$diff</span> = <span class="pt-i">$n</span>-<span class="pt-i">$nLast</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">58</span>     <span class="pt-k">my</span> <span class="pt-i">$avg</span> = <span class="pt-i">$n</span>/<span class="pt-i">$i</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">59</span>     <span class="pt-k">printf</span> <span class="pt-q">&quot;Hash - $i Keys: $n Bytes (Diff: $diff) - %.1f Bytes/Key\n&quot;</span><span class="pt-cm">,</span><span class="pt-i">$avg</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">60</span>     <span class="pt-i">$nLast</span> = <span class="pt-i">$n</span><span class="pt-sc">;</span>&#10;<span class="sdoc-code-ln">61</span> <span class="pt-s">}</span>&#10;<span class="sdoc-code-ln">62</span> &#10;<span class="sdoc-code-ln">63</span> <span class="pt-c"># eof</span>&#10;</pre>
</div> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/10-Text-Eingabefelder-per-CSS-gestalten.html" rel="alternate" title="Text-Eingabefelder per CSS gestalten" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-01-11T17:34:00Z</published>
        <updated>2010-01-12T03:40:44Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=10</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=10</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/7-HTML+CSS" label="HTML+CSS" term="HTML+CSS" />
    
        <id>http://fseitz.de/blog/index.php?/archives/10-guid.html</id>
        <title type="html">Text-Eingabefelder per CSS gestalten</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <pre class="s-pre-box">
&lt;input type="text"  id="e" name="text" size="20" /&gt;
</pre>

<p class="s-p-ind">
Text: <input type="text"  id="x-text" name="text" size="20" />
</p>

<h3 class="s-h3">Umrahmung</h3>

<p>
  Rahmen von 1px Breite statt der normalen Dekoration.
</p>

<pre class="s-pre-box">
#e {
  border: 1px #999 solid;
}
</pre>

<h3 class="s-h3">Hintergrundfarbe</h3>

<p>
Die Hintergrundfarbe des Eingabefeldes ändern, wenn es mit der Maus überfahren wird
(<code>:hover</code>) oder den Fokus bekommt (<code>:focus</code>).
Besitzt das Feld weder den Fokus noch befindet sich die Maus darüber, wird die ursprüngliche Hintergrundfarbe
automatisch wieder hergestellt. Dies braucht nicht vereinbart werden.
</p>

<pre class="s-pre-box">
#e:hover, #e:focus {
  background-color: #eee;
}
</pre>

<h3 class="s-h3">Font</h3>

<p>
Ein Text-Eingabefeld sollte m.E. normalerweise einen monospaced Font eingestellt haben,
nur dann entspricht die optische Feldbreite exakt der Anzahl der Zeichen, die
in das Feld passen.
</p>

<pre class="s-pre-box">
#e {
  font-family: monospace;
}
</pre>
 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/8-Cellspacing-per-CSS-unterdruecken.html" rel="alternate" title="Cellspacing per CSS unterdrücken" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-01-09T15:03:10Z</published>
        <updated>2010-05-31T08:26:24Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=8</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=8</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/20-CSS" label="CSS" term="CSS" />
    
        <id>http://fseitz.de/blog/index.php?/archives/8-guid.html</id>
        <title type="html">Cellspacing per CSS unterdrücken</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>In HTML:</p>

<pre class="s-pre-box">
&lt;table cellspacing="0"&gt;
</pre>

<p>Per CSS (<code>#t</code> sei die Tabelle):</p>

<pre class="s-pre-box">
#t {
  border-collapse: collapse;
}

#t > td {
  padding: 0;
}
</pre> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/7-Dreispaltiges-Seitenlayout-mit-CSS.html" rel="alternate" title="Dreispaltiges Seitenlayout mit CSS" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-01-09T10:27:23Z</published>
        <updated>2010-05-31T08:25:53Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=7</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=7</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/20-CSS" label="CSS" term="CSS" />
    
        <id>http://fseitz.de/blog/index.php?/archives/7-guid.html</id>
        <title type="html">Dreispaltiges Seitenlayout mit CSS</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>Layout mit Kopf, Fuss und drei Spalten:</p>

<img class="s-img" src="uploads/layout3-3.png" alt="3-spaltiges CSS Layout" /><br />

<p>Der HTML- und CSS-Code, der dies realisiert:</p>

<pre class="s-pre-box" style="float:left">
&lt;div id="<span style="background:#ffff5a">header</span>"&gt;
Header
&lt;/div&gt;
&lt;div id="<span style="background:#ff5a5a">left</span>"&gt;
Left
&lt;/div&gt;
&lt;div id="<span style="background:#ff5aff">right</span>"&gt;
Right
&lt;/div&gt;
&lt;div id="<span style="background:#5affff">middle</span>"&gt;
Middle
&lt;/div&gt;
&lt;div id="<span style="background:#5aff5a">footer</span>"&gt;
Footer
&lt;/div&gt;
</pre>

<pre class="s-pre-box">
#<span style="background:#ffff5a">header</span> {
  clear: both;
}
#<span style="background:#ff5a5a">left</span> {
  float: left;
  width: 80px;
}
#<span style="background:#ff5aff">right</span> {
  float: right;
  width: 80px;
}
#<span style="background:#5affff">middle</span> {
  padding: 0 80px 0 80px;
}
#<span style="background:#5aff5a">footer</span> {
  clear: both;
}
</pre>

<h3 class="s-h3">Anmerkungen</h3>

<ul class="s-ul">
  <li>Die Farben und die Höhe der Elemente sind weggelassen,
    da diese mit der Lösung nichts zu tun haben.
  </li>

  <li>
    Die Breite von <code>#header</code>, <code>#middle</code> und
    <code>#footer</code> passt sich dem zur Verfügung stehenden Raum dynamisch an.
  </li>

  <li>Die Reihenfolge der divs in HTML ist signifikant. Das div <code>#middle</code>
    kommt <i>nach</i> <code>#left</code> und <code>#right</code>.
  </li>

  <li>"<code>clear: both;</code>" bei <code>#header</code> bewirkt,
    dass neben dem Header kein Float platziert wird. D.h. die beiden
    Floats <code>#left</code> und <code>#right</code> werden vom Browser darunter
    platziert.
  </li>

  <li>Durch "<code>float: left;</code>" wird das Element <code>#left</code>
    links platziert. Analog wird Element <code>#right</code> durch
    "<code>float: right;</code>" rechts platziert. Die Breitenangabe "<code>width: 80px;</code>"
    weist den Floats ihren (fixen) horizontalen Raum am linken
    und rechten Rand zu.
  </li>

  <li>Das Element <code>#middle</code> hat keine clear-Angabe
    und kann daher zwischen die Elemente <code>#left</code> und <code>#right</code> treten.
    Damit der Inhalt des div sich nicht mit den Randelementen überschneidet, wird
    mit "<code>padding: 0 80px 0 80px;</code>" ein Padding eingestellt, das den Raum,
    der von den Randelementen belegt wird, ausspart. Die Reihenfolge der Angaben ist:
    oben, rechts, unten, links.
  </li>

  <li>"<code>clear: both;</code>" bei <code>#footer</code> verhindert,
    dass beim horizontalen Verkleinern des Fensters die oberen Floats
    neben oder unter den Footer springen.
  </li>

  <li>Die Konstruktion aus den fünf divs kann in den HTML <code>&lt;body&gt;</code>
    oder eine Tabellenzelle <code>&lt;td&gt;</code> eigebettet werden.
  </li>
</ul>
 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/9-Validierung-von-HTML-und-CSS-Code.html" rel="alternate" title="Validierung von HTML- und CSS-Code" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-01-09T09:00:00Z</published>
        <updated>2010-01-11T13:57:49Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=9</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=9</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/7-HTML+CSS" label="HTML+CSS" term="HTML+CSS" />
    
        <id>http://fseitz.de/blog/index.php?/archives/9-guid.html</id>
        <title type="html">Validierung von HTML- und CSS-Code</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>
  Das W3C stellt zwei Services zur Validierung von HTML- und CSS-Code zur Verfügung:
</p>

<p>
  HTML-Validator: <a  href="http://validator.w3.org/">http://validator.w3.org/</a><br />
  CSS-Validator: <a  href="http://jigsaw.w3.org/css-validator/">http://jigsaw.w3.org/css-validator/</a>
</p>

<p>
  Um den HTML- bzw. CSS-Code einer Seite direkt zu validieren,
  können folgende Links in die Seite eingebaut werden. Aus dem Referer-Header ermittelt
  der Validator die Ausgangsseite und ruft diese ab. Das geht natürlich nur,
  wenn die Seite öffentlich zugreifbar ist.
</p>

<h3 class="s-h3">Validierung von XHTML-Code</h3>

<p>
    <a  style="margin-left: 1.6em;" href="http://validator.w3.org/check/referer?ss=1">
      <img src="uploads/valid-xhtml10.png" width="88" height="31" alt="Valid XHTML 1.0!" />
    </a>
</p>

<pre class="s-pre-box">
&lt;a href="http://validator.w3.org/check/referer?ss=1"&gt;
  &lt;img src="valid-xhtml10.png" width="88" height="31" alt="Valid XHTML 1.0!" /&gt;
&lt;/a&gt;
</pre>

<p>
  Der URL-Parameter <code>ss=1</code> sorgt dafür, dass der Validator
  ein Source-Listing erzeugt. Dies ist sehr sinnvoll, da dann von einem Fehler aus
  direkt an die beanstandete Stelle gesprungen werden kann.
</p>

<h3 class="s-h3">Validierung von CSS2-Code</h3>

<p>
    <a style="margin-left: 1.6em;" href="http://jigsaw.w3.org/css-validator/check/referer">
      <img src="uploads/valid-css2.png" width="88" height="31" alt="Valid CSS!" />
    </a>
</p>

<pre class="s-pre-box">
  &lt;a href="http://jigsaw.w3.org/css-validator/check/referer"&gt;
    &lt;img src="valid-css2.png" width="88" height="31" alt="Valid CSS!" /&gt;
  &lt;/a&gt;
</pre>
 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/6-Grundlegende-PostgreSQL-Administration.html" rel="alternate" title="Grundlegende PostgreSQL-Administration" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-01-08T13:55:00Z</published>
        <updated>2010-03-27T11:22:57Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=6</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=6</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/5-PostgreSQL" label="PostgreSQL" term="PostgreSQL" />
    
        <id>http://fseitz.de/blog/index.php?/archives/6-guid.html</id>
        <title type="html">Grundlegende PostgreSQL-Administration</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p class="sdoc-para-p">
  PostgreSQL ist meiner Meinung nach das beste frei erhältliche
  Relationale Datenbanksystem.  Hier die wichtigsten Kommandos, um damit
  an den Start gehen zu können.
</p>
<h1 class="sdoc-sec-h1">PostgreSQL RDBMS installieren (Debian)</h1>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre"># apt-get install postgresql</pre>
</div>
<h1 class="sdoc-sec-h1">Zum DB-Admin machen</h1>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre"># su - postgres</pre>
</div>
<p class="sdoc-para-p">
  Nur von diesem Unix-Account aus kann nach der Installation eine
  Connection zum DBMS aufgebaut werden.
</p>
<h1 class="sdoc-sec-h1">Liste der existierenden Datenbanken</h1>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">$ psql -l&#10;[Liste]</pre>
</div>
<p class="sdoc-para-p">
  Nach der Installation existiert zunächst nur die Datenbank
  <tt class="sdoc-seg-c">postgres</tt>.
</p>
<h1 class="sdoc-sec-h1">Datenbank erzeugen/zerstören</h1>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">$ createdb DB&#10;...&#10;$ dropdb DB&lt;/pre&gt;</pre>
</div>
<h1 class="sdoc-sec-h1">Liste der existierenden Benutzer</h1>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">$ psql&#10;postgres=# \du</pre>
</div>
<p class="sdoc-para-p">
  oder
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">postgres=# SELECT rolname FROM pg_roles;</pre>
</div>
<h1 class="sdoc-sec-h1">Benutzer anlegen/entfernen</h1>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">$ createuser USER&#10;Shall the new role be a superuser? (y/n) y&#10;...&#10;$ dropuser USER</pre>
</div>
<p class="sdoc-para-p">
  Benutzer sind global für alle Datenbanken einer Installation.
  Zunächst existiert nur der Benutzer <tt class="sdoc-seg-c">postgres</tt>. Soll der User
  <tt class="sdoc-seg-c">USER</tt> von einem anderen Account als dem entsprechenden
  Unix-Account connecten können, muss ein Passwort vergeben
  werden. Option <tt class="sdoc-seg-c">-P</tt>.
</p>
<h1 class="sdoc-sec-h1">Datenbankzugriff</h1>
<p class="sdoc-para-p">
  Ist ein DB-User erzeugt, kann dieser vom gleichnamigen Unix-Account
  oder per Passwort, falls eins vergeben wurde, von einem anderen
  Account per <tt class="sdoc-seg-c">psql</tt> auf die Datenbank zugreifen.
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">USER$ psql DB&#10;Welcome to psql 8.3.6, the PostgreSQL interactive terminal.&#10;...&#10;DB=#</pre>
</div>
<h1 class="sdoc-sec-h1">Liste der existierenden Objekte</h1>
<table class="sdoc-keyval-table">
<tr class="sdoc-keyval-tr">
  <td class="sdoc-keyval-td-key">Tabellen:</td>
  <td class="sdoc-keyval-td-value"><tt class="sdoc-seg-c">\dt</tt></td>
</tr>
<tr class="sdoc-keyval-tr">
  <td class="sdoc-keyval-td-key">Sequenzen:</td>
  <td class="sdoc-keyval-td-value"><tt class="sdoc-seg-c">\ds</tt></td>
</tr>
<tr class="sdoc-keyval-tr">
  <td class="sdoc-keyval-td-key">Views:</td>
  <td class="sdoc-keyval-td-value"><tt class="sdoc-seg-c">\dv</tt></td>
</tr>
</table>
<h1 class="sdoc-sec-h1">Exportieren/Importieren</h1>
<table class="sdoc-keyval-table">
<tr class="sdoc-keyval-tr">
  <td class="sdoc-keyval-td-key">Alle Datenbanken:</td>
  <td class="sdoc-keyval-td-value"><tt class="sdoc-seg-c">pg_dumpall &gt;FILE</tt></td>
</tr>
<tr class="sdoc-keyval-tr">
  <td class="sdoc-keyval-td-key">Eine Datenbank:</td>
  <td class="sdoc-keyval-td-value"><tt class="sdoc-seg-c">pg_dump DB &gt;FILE</tt></td>
</tr>
<tr class="sdoc-keyval-tr">
  <td class="sdoc-keyval-td-key">Importieren:</td>
  <td class="sdoc-keyval-td-value"><tt class="sdoc-seg-c">psql -f FILE DB</tt></td>
</tr>
</table>
<h1 class="sdoc-sec-h1">Session-Einstellungen</h1>
<h2 class="sdoc-sec-h2">Datumsformat</h2>
<p class="sdoc-para-p">
  Datumsangaben im Format YYYY-MM-DD
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">SET datestyle TO iso, ymd&#10;select localtimestamp(0);</pre>
</div>
<p class="sdoc-para-p">
  liefert die Zeit im Format:
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">2009-03-12 17:38:20</pre>
</div>
<h2 class="sdoc-sec-h2">Zeichensatz</h2>
<p class="sdoc-para-p">
  Client arbeitet mit ISO-8859-1:
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">SET client_encoding TO iso88591</pre>
</div>
<p class="sdoc-para-p">
  Client arbeitet mit UTF-8:
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">SET client_encoding TO utf8</pre>
</div>
<p class="sdoc-para-p">
  Siehe: <a class="sdoc-seg-u" href="http://www.postgresql.org/docs/8.3/static/multibyte.html#AEN27449">http://www.postgresql.org/docs/8.3/static/multibyte.html#AEN27449</a>
</p>
<p class="sdoc-para-p">
  Der clientseitige Zeichensatz kann jederzeit umgeschaltet werden.
  Wenn Daten mit unterschiedlichem Encoding verarbeitet werden,
  besteht die Möglichkeit, vor dem Schreiben auf die Datenbank das
  clientseitige Encoding umzuschalten. Die Konvertierung wird dann
  vom Server übernommen.
</p>
<h2 class="sdoc-sec-h2">\-Escapes in Stringliteralen verbieten</h2>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">SET standard_conforming_strings TO on</pre>
</div>
<h1 class="sdoc-sec-h1">Server-Zugriff von externen Hosts</h1>
<p class="sdoc-para-p">
  Die folgenden Einträge ermöglichen den Zugriff von allen
  Hosts für alle User und alle Datenbanken.
</p>
<p class="sdoc-para-p">
  In <tt class="sdoc-seg-c">pg_hba.conf</tt> oberhalb der anderen Einträge hinzufügen:
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre"># TYPE  DATABASE  USER  CIDR-ADDRESS  METHOD&#10;host    all       all   0.0.0.0/0     md5</pre>
</div>
<p class="sdoc-para-p">
  In <tt class="sdoc-seg-c">postgresql.conf</tt> eintragen:
</p>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre">listen_addresses = '*'</pre>
</div>
<h1 class="sdoc-sec-h1">Server neu starten</h1>
<div class="sdoc-code-div">
  <pre class="sdoc-code-pre"># /etc/init.d/postgresql-X.Y restart</pre>
</div>
<h1 class="sdoc-sec-h1">Upgrade auf eine neue Version</h1>
<p class="sdoc-para-p">
  Siehe Kapitel "Upgrading" in der Doku.
</p> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/5-YouTube-Video-in-HTML-Seite-einbetten.html" rel="alternate" title="YouTube Video in HTML-Seite einbetten" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-01-07T22:35:19Z</published>
        <updated>2010-01-09T16:08:50Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=5</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=5</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/4-YouTube" label="YouTube" term="YouTube" />
    
        <id>http://fseitz.de/blog/index.php?/archives/5-guid.html</id>
        <title type="html">YouTube Video in HTML-Seite einbetten</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <object width="120" height="115">
  <param name="movie" value="http://www.youtube.com/v/oDFPNKeVcI0&amp;hl=de_DE&amp;fs=0&amp;rel=0"></param>
  <param name="allowFullScreen" value="false"></param>
  <param name="allowscriptaccess" value="always"></param>
  <embed src="http://www.youtube.com/v/oDFPNKeVcI0&amp;hl=de_DE&amp;fs=0&amp;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="120" height="115"></embed>
</object>

<object width="160" height="145">
  <param name="movie" value="http://www.youtube.com/v/oDFPNKeVcI0&amp;hl=de_DE&amp;fs=0&amp;rel=0"></param>
  <param name="allowFullScreen" value="false"></param>
  <param name="allowscriptaccess" value="always"></param>
  <embed src="http://www.youtube.com/v/oDFPNKeVcI0&amp;hl=de_DE&amp;fs=0&amp;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="160" height="145"></embed>
</object>

<object width="240" height="205">
  <param name="movie" value="http://www.youtube.com/v/oDFPNKeVcI0&amp;hl=de_DE&amp;fs=0&amp;rel=0"></param>
  <param name="allowFullScreen" value="false"></param>
  <param name="allowscriptaccess" value="always"></param>
  <embed src="http://www.youtube.com/v/oDFPNKeVcI0&amp;hl=de_DE&amp;fs=0&amp;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="240" height="205"></embed>
</object>

<br />
Hier der Code, wie er von YouTube vorgeschlagen wird:

<pre class="s-pre-box">
&lt;object width="$WIDTH" height="$HEIGHT"&gt;
  &lt;param name="movie" value="$URL"&gt;&lt;/param&gt;
  &lt;param name="allowFullScreen" value="$FS"&gt;&lt;/param&gt;
  &lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;
  &lt;embed src="$URL"
      type="application/x-shockwave-flash"
      allowscriptaccess="always"
      allowfullscreen="$FS"
      width="$WIDTH"
      height="$HEIGHT"&gt;
  &lt;/embed&gt;
&lt;/object&gt;
</pre>

<table>
<tr>
  <td>$URL</td>
  <td>YouTube-URL (hier: "http://www.youtube.com/v/$VIDEO&amp;hl=de_DE&amp;fs=$FS&amp;rel=$REL")</td>
</tr>
<tr>
  <td>$VIDEO</td>
  <td>YouTube Video-Id (hier: "oDFPNKeVcI0")</td>
</tr>
<tr>
  <td>$WIDTH</td>
  <td>Breite des Players (hier: 240)</td>
</tr>
<tr>
  <td>$HEIGHT</td>
  <td>Höhe des Players = Videohöhe + 25 (hier: 205 = 180+25 )</td>
</tr>
<tr>
  <td>$FS</td>
  <td>Erlaube Fullscreen-Modus (bei allowfullscreen "true" oder "false", bei fs: 0 oder 1)</td>
</tr>
<tr>
  <td>$REL</td>
  <td>Ähnliche Videos vorschlagen, wenn die Maus über dem Player ist (0=nein, 1=ja)</td>
</tr>
</table>

<p>Im Falle eine Standard-Definition Films - wie oben - im Steitenverhältnis 4:3, errechnen sich z.B.
folgende Playergrößen:</p>

<pre class="s-pre-box">120 x 115 (klein oben - es wird keine Zeit und kein Slider angezeigt)
160 x 145 (mittel oben - es wird keine Zeit angezeigt)
240 x 205 (groß oben - Fullscreen-Button ist explizit abgeschaltet)
320 x 265 (1. YouTube-Vorschlag)
425 x 344 (2. YouTube-Vorschlag)
480 x 385 (3. YouTube-Vorschlag)
640 x 505 (4. YouTube-Vorschlag)</pre> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/15-AEnderungen-an-Serendipity.html" rel="alternate" title="Änderungen an Serendipity" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-01-07T18:00:00Z</published>
        <updated>2010-03-27T11:22:55Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=15</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=15</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/2-Serendipity" label="Serendipity" term="Serendipity" />
    
        <id>http://fseitz.de/blog/index.php?/archives/15-guid.html</id>
        <title type="html">Änderungen an Serendipity</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <h1 class="sdoc-sec-h1">Favicon hinzugefügt</h1>
<p class="sdoc-para-p">
  Zu Datei: <tt class="sdoc-seg-c">templates/default/index.tpl</tt>
</p>
<h1 class="sdoc-sec-h1">Homelink2 auf Artikelübersicht geändert</h1>
<p class="sdoc-para-p">
  Zu <tt class="sdoc-seg-c">index.php?/archives/summary.html</tt> in Datei: <tt class="sdoc-seg-c">templates/default/index.tpl</tt>
</p> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/4-Style-der-Serendipity-Admin-Oberflaeche-aendern.html" rel="alternate" title="Style der Serendipity Admin-Oberfläche ändern" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-01-07T17:30:42Z</published>
        <updated>2010-01-07T22:21:02Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=4</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=4</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/2-Serendipity" label="Serendipity" term="Serendipity" />
    
        <id>http://fseitz.de/blog/index.php?/archives/4-guid.html</id>
        <title type="html">Style der Serendipity Admin-Oberfläche ändern</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>Die Admin-Oberfläche bietet keine getrennte Einstellung für den eigenen Style - entweder
der Haupt-Style ändert den Style der Admin-Oberfläche mit oder es bleibt bei dem (für meinen Geschmack)
nicht sonderlich schönen Default.</p>

<p>Die Admin-Styles sind in den Verzeichnissen der Haupt-Styles in <code>templates/STYLE/admin</code> definiert.
Die Haupt-Styles, die einen Admin-Style mitbringen, lassen
sich folgendermaßen ermitteln:</p>

<pre class="s-pre-box">
$ find templates -type d | grep admin$
./carl_contest/admin
./competition/admin
./contest/admin
./bulletproof/admin
./default-rtl/admin
./default/admin
</pre>

<p>Ein Style, der keinen Admin-Style definiert, kann mit einem fremden
Admin-Style ausgestattet werden, indem ein fremdes admin Verzeichnis (eines anderen
Style) dorthin kopiert wird oder ein Symlink auf dieses angelegt wird:</p>

<pre class="s-pre-box">
$ cd templates/MYSTYLE
$ ln -s ../OTHERSTYLE/admin .
</pre> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/1-Perl-Interpreter-ueber-Shebang-Zeile-suchen.html" rel="alternate" title="Perl-Interpreter über Shebang-Zeile suchen" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-01-07T12:54:00Z</published>
        <updated>2010-01-07T21:58:06Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=1</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=1</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/1-Perl" label="Perl" term="Perl" />
    
        <id>http://fseitz.de/blog/index.php?/archives/1-guid.html</id>
        <title type="html">Perl-Interpreter über Shebang-Zeile suchen</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <pre class="s-pre-box">#!/usr/bin/env perl</pre>

<p>Mit dieser Shebang-Zeile wird der Perl-Interpreter über die Environment-Variable
<code>$PATH</code> gesucht. D.h. die Shebang-Zeile muss nicht angepasst werden, wenn das Skript
in mehreren Umgebungen mit unterschiedlichen Installationspfaden laufen soll.</p>
 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/2-Installation-von-Serendipity.html" rel="alternate" title="Installation von Serendipity" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-01-07T11:30:00Z</published>
        <updated>2010-01-11T13:36:52Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=2</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=2</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/2-Serendipity" label="Serendipity" term="Serendipity" />
    
        <id>http://fseitz.de/blog/index.php?/archives/2-guid.html</id>
        <title type="html">Installation von Serendipity</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>Meine Wahl der Blog-Software ist auf Serendipity gefallen, da ich es neulich positiv
erwähnt gefunden habe und meine anschließende Recherche ergeben hat, dass es wohl
tatsächlich gut ist.</p>

<p>Als ersten technischen Eintrag schreibe ich auf, wie ich Serendipity from scratch auf meinem
Debian Web-Host installiert habe. Zwar gibt es Serendipity auch fix und fertig als
Debian-Paket, aber das ist in Debian/Stable schon älter. Außerdem
ist diese Anwendung für mich wichtig genug, dass ich alles im Detail kontrollieren möchte,
einschließlich programmierung, und keinesfalls will, dass die Debian-Paketverwaltung
mir mit Updates dazwischen kommt.</p>

<p>Homepage von Serendipity: <a href="http://www.s9y.org/">http://www.s9y.org/</a></p>

<p><strong>Schritt 1: Herunterladen der Software</strong></p>

<p>Auf der Homepage bekommt man die aktuelle Version als Tarball und auch eine Beschreibung
für die manuelle Installation. Diese hat den Titel <i>Fresh Installation</i>. Sie ist gut, aber in einigen Punkten
nicht ausführlich genug. Ich beschreibe hier die Dinge, die ich bei <i>meiner</i> Installation
dort nicht gefunden habe.</p>

<p><strong>Schritt 2: Auspacken des Pakets</strong></p>

<p>Das Paket, in meinen Fall <code>serendipity-1.5.1.tar.gz</code>, kann irgendwo
im Dateisystem ausgepackt werden. In der Webserver-Konfiguration wird
später mitgeteilt, wo es sich befindet. Ich entscheide mich als Installationsort
für <code>/opt/serendipity/1.5.1/</code>.</p>

<p><strong>Schritt 3: Benötigte Debian-Pakete installieren</strong></p>

<pre class="s-pre-box"># deb-install php5
# apt-get install postgresql
# apt-get install php5-pgsql
# apt-get install imagemagick</pre>

<p>Serendipity ist in PHP5 programmiert. Als DBMS verwende ich PostgreSQL.
Imagemagick wird von Serendipity zur Bildbearbeitung gebraucht.</p>

<p><strong>Schritt 4: Apache Konfiguration</strong></p>

<p>Im Serendipity-Paket scheint keine Apache-Config dabei zu sein. Ich habe diese
von der Debian-Version übernommen, mit der ich zuvor herumgespielt habe. Lediglich
die Pfade brauchte ich anpassen. Der URL des Blog wird
<code>http://SERVER.DOMAIN/blog</code> lauten.</p>

<pre class="s-pre-box">Alias /blog /opt/serendipity/1.5.1

&lt;Directory /opt/serendipity/1.5.1&gt;
        Options -Indexes +FollowSymlinks

        DirectoryIndex index.php

        &lt;IfModule mod_php5.c&gt;
        php_flag session.use_trans_sid off
        php_flag register_globals off
        &lt;/IfModule&gt;

        AllowOverride All
        order allow,deny
        allow from all

        &lt;Files *.tpl.php&gt;
            deny from all
        &lt;/Files&gt;

        &lt;Files *.tpl&gt;
            deny from all
        &lt;/Files&gt;

        &lt;Files *.sql&gt;
            deny from all
        &lt;/Files&gt;

        &lt;Files *.inc.php&gt;
            deny from all
        &lt;/Files&gt;

        &lt;Files *.db&gt;
            deny from all
        &lt;/Files&gt;
&lt;/Directory&gt;</pre>

<p>Die Datei wird als <code>serendiptiy.conf</code> nach <code>/etc/apacha2/conf.d</code>
kopiert und anschließend der Apache neu gestartet:</p>

<pre class="s-pre-box"># apache2ctl restart</pre>

<p><strong>Schritt 5: PostgreSQL-Datenbank einrichten</strong></p>

<p>Für die Datenbank-Einrichtung sind drei Dinge zu tun:</p>

<ol>
  <li>Datenbank erzeugen</li>
  <li>Datenbank-User erzeugen, über den Serendipity auf die Datenbank zugreift</li>
  <li>Datenbanknamen und User und Passwort in die Serendipity-Config eintragen</li>
</ol>

<p>Datenbank und User erzeugen:</p>

<pre class="s-pre-box"># su - postgres
$ createdb serendipity
$ createuser -P serendipity
Password:
</pre>

<p>Wichtig ist bei <code>creatuser</code> der Parameter <code>-P</code>,
damit der User ein Passwort erhält.</p>

<p><strong>Schritt 6: Konfiguration und Administration von Serendipity</strong></p>

<p>Anschließend auf <code>http://SERVER.DOMAIN/blog/serendipity_admin.php</code> gehen
und die Datenbank-Angaben in die Formularfelder eintragen</p>

<p>Bei Anmeldeaufforderung per "John Doe" mit Passwort "john" anmelden. Benutzername
und Passwort sollten nach der Anmeldung als erstes geändert werden. Danach
kann Serendipity im Detail den persönlichen Wünschen angepasst werden.</p> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://fseitz.de/blog/index.php?/archives/3-Eroeffnung-des-Developer-Logbuchs.html" rel="alternate" title="Eröffnung des Developer Logbuchs" />
        <author>
            <name>Frank Seitz</name>
                    </author>
    
        <published>2010-01-07T11:00:00Z</published>
        <updated>2010-02-09T11:30:00Z</updated>
        <wfw:comment>http://fseitz.de/blog/wfwcomment.php?cid=3</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://fseitz.de/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=3</wfw:commentRss>
    
            <category scheme="http://fseitz.de/blog/index.php?/categories/3-Sonstiges" label="Sonstiges" term="Sonstiges" />
    
        <id>http://fseitz.de/blog/index.php?/archives/3-guid.html</id>
        <title type="html">Eröffnung des Developer Logbuchs</title>
        <content type="xhtml" xml:base="http://fseitz.de/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>Ich habe beschlossen, ein Technik Logbuch zu führen, in welchem ich meine Erkenntnisse aufschreibe.
Primär als Nachschlagewerk zur eigenen Erinnerung, aber auch als mögliche Hilfe für andere.
Ich selbst schlage meist zuerst im Web nach, wenn ich auf eine Fragestellung oder ein Problem stoße
und oft ist etwas darunter, was mir schnell weiter hilft. Dies soll mein bescheidener Beitrag
zur Wissensweitergabe im Zeitalter des Internet sein.</p>
 
            </div>
        </content>
        
    </entry>

</feed>