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

<channel>
	<title>WEBPIRATEN &#187; XML</title>
	<atom:link href="http://webpiraten.de/index.php/category/xml/feed/" rel="self" type="application/rss+xml" />
	<link>http://webpiraten.de</link>
	<description>TECHNOLOGIE-BLOG</description>
	<lastBuildDate>Sun, 20 Jun 2010 19:00:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Agavi Custom Logger implementieren</title>
		<link>http://webpiraten.de/index.php/2010/05/agavi-custom-logger-implementieren/</link>
		<comments>http://webpiraten.de/index.php/2010/05/agavi-custom-logger-implementieren/#comments</comments>
		<pubDate>Fri, 07 May 2010 15:15:57 +0000</pubDate>
		<dc:creator>sägefisch</dc:creator>
				<category><![CDATA[Agavi]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[agavi]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[logger]]></category>
		<category><![CDATA[logging]]></category>

		<guid isPermaLink="false">http://webpiraten.de/?p=252</guid>
		<description><![CDATA[Um in Agavi custom logfiles zu erstellen, benötigt man einen eigens erstellten logger + appender in der app/config/logger.xml. &#60;!-- logs only custom messages in a custom log --&#62; &#60;logger name=&#34;custom&#34; class=&#34;AgaviLogger&#34; level=&#34;'custom'&#34;&#62; &#60;appenders&#62; &#60;appender&#62;CustomLogAppender&#60;/appender&#62; &#60;/appenders&#62; &#60;/logger&#62; &#60;appender name=&#34;CustomLogAppender&#34; class=&#34;AgaviFileLoggerAppender&#34; layout=&#34;DateTimeLayout&#34;&#62; &#60;ae:parameters&#62; &#60;ae:parameter name=&#34;file&#34;&#62;%core.app_dir%/log/custom.log&#60;/ae:parameter&#62; &#60;/ae:parameters&#62; &#60;/appender&#62; Dann kann man den Logger quasi überall wo der LoggerManager [...]]]></description>
			<content:encoded><![CDATA[<p>Um in Agavi custom logfiles zu erstellen, benötigt man einen eigens erstellten logger + appender in der <strong>app/config/logger.xml</strong>.</p>
<pre class="brush: xml;">
&lt;!-- logs only custom messages in a custom log --&gt;
&lt;logger name=&quot;custom&quot; class=&quot;AgaviLogger&quot; level=&quot;'custom'&quot;&gt;
    &lt;appenders&gt;
        &lt;appender&gt;CustomLogAppender&lt;/appender&gt;
    &lt;/appenders&gt;
&lt;/logger&gt;

&lt;appender name=&quot;CustomLogAppender&quot; class=&quot;AgaviFileLoggerAppender&quot; layout=&quot;DateTimeLayout&quot;&gt;
    &lt;ae:parameters&gt;
        &lt;ae:parameter name=&quot;file&quot;&gt;%core.app_dir%/log/custom.log&lt;/ae:parameter&gt;
    &lt;/ae:parameters&gt;
&lt;/appender&gt;
</pre>
<p>Dann kann man den Logger quasi überall wo der LoggerManager verfügbar ist benutzen.</p>
<pre class="brush: php;">
$message = 'Custom logging message';
$this-&gt;getContext()-&gt;getLoggerManager()-&gt;log(new AgaviLoggerMessage($message, 'custom'), 'custom');
</pre>
<p>Und in der bash das logfile einsehen.</p>
<pre class="brush: bash;">
tail -f app/log/custom.log
</pre>
]]></content:encoded>
			<wfw:commentRss>http://webpiraten.de/index.php/2010/05/agavi-custom-logger-implementieren/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Agavi routing specials</title>
		<link>http://webpiraten.de/index.php/2010/05/agavi-routing-specials/</link>
		<comments>http://webpiraten.de/index.php/2010/05/agavi-routing-specials/#comments</comments>
		<pubDate>Mon, 03 May 2010 13:32:32 +0000</pubDate>
		<dc:creator>sägefisch</dc:creator>
				<category><![CDATA[Agavi]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[agavi]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[header]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[http_accept]]></category>
		<category><![CDATA[http_x_requested_with]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[output]]></category>
		<category><![CDATA[routing]]></category>
		<category><![CDATA[specials]]></category>
		<category><![CDATA[types]]></category>

		<guid isPermaLink="false">http://webpiraten.de/?p=245</guid>
		<description><![CDATA[Um bestimmte Agavi output_types bei speziellen routings zu bedienen kann man die routing.xml wie folgt anpassen. &#60;!-- cut out leading slash --&#62; &#60;route name=&#34;slasher&#34; pattern=&#34;^/&#34; stop=&#34;false&#34; imply=&#34;true&#34; cut=&#34;true&#34; /&#62; &#60;!-- match ajax calls with special http header --&#62; &#60;route pattern=&#34;XMLHttpRequest&#34; source=&#34;_SERVER[HTTP_X_REQUESTED_WITH]&#34; stop=&#34;false&#34; output_type=&#34;ajax&#34; /&#62; &#60;!-- match json calls with special http header --&#62; &#60;route pattern=&#34;application/json&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>Um bestimmte Agavi output_types bei speziellen routings zu bedienen kann man die routing.xml wie folgt anpassen.</p>
<pre class="brush: xml;">
&lt;!-- cut out leading slash --&gt;
&lt;route name=&quot;slasher&quot; pattern=&quot;^/&quot; stop=&quot;false&quot; imply=&quot;true&quot; cut=&quot;true&quot; /&gt;

&lt;!-- match ajax calls with special http header --&gt;
&lt;route pattern=&quot;XMLHttpRequest&quot; source=&quot;_SERVER[HTTP_X_REQUESTED_WITH]&quot; stop=&quot;false&quot; output_type=&quot;ajax&quot; /&gt;

&lt;!-- match json calls with special http header --&gt;
&lt;route pattern=&quot;application/json&quot; source=&quot;_SERVER[HTTP_ACCEPT]&quot; stop=&quot;false&quot; output_type=&quot;json&quot; /&gt;

&lt;!-- cut out special pointer --&gt;
&lt;route name=&quot;portal&quot; pattern=&quot;^({portal:[a-zA-Z]{3}}/)?&quot; stop=&quot;false&quot; imply=&quot;true&quot; cut=&quot;true&quot;&gt;
    &lt;callbacks&gt;
        &lt;callback class=&quot;RoutingCallback&quot; /&gt;
    &lt;/callbacks&gt;
&lt;/route&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://webpiraten.de/index.php/2010/05/agavi-routing-specials/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SVN-Befehle für Zwischendurch</title>
		<link>http://webpiraten.de/index.php/2009/11/svn-befehle-fuer-zwischendurch/</link>
		<comments>http://webpiraten.de/index.php/2009/11/svn-befehle-fuer-zwischendurch/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 21:58:19 +0000</pubDate>
		<dc:creator>graste</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[SVN]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Versionierung]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[hilfe]]></category>
		<category><![CDATA[one-liner]]></category>

		<guid isPermaLink="false">http://webpiraten.de/?p=198</guid>
		<description><![CDATA[Ein paar kleine SVN-Befehle und One-liner für den Alltag: Alle Beitragenden eines Repositories anzeigen lassen (sortiert nach Anzahl der Änderungen): svn log -q &#124; awk '/^r/ {print $3}' &#124; sort &#124; uniq -c &#124; sort -rn Alle Änderungen zwischen der aktuellen Arbeitskopie und der Head-Version anzeigen lassen. Sollte im Normalfall auch anzeigen, wer den Build [...]]]></description>
			<content:encoded><![CDATA[<p>Ein paar kleine SVN-Befehle und One-liner für den Alltag:</p>
<p>Alle Beitragenden eines Repositories anzeigen lassen (sortiert nach Anzahl der Änderungen):</p>
<pre class="brush: bash;">
svn log -q | awk '/^r/ {print $3}' | sort | uniq -c | sort -rn
</pre>
<p>Alle Änderungen zwischen der aktuellen Arbeitskopie und der Head-Version anzeigen lassen. Sollte im Normalfall auch anzeigen, wer den Build kaputt gespielt hat. ;)</p>
<pre class="brush: bash;">
svn log -r BASE:HEAD
</pre>
<p>History eines Zweiges ausgehend vom Verzweigungspunkt anzeigen lassen:</p>
<pre class="brush: bash;">
svn log --stop-on-copy
</pre>
<p>Alle Änderungen innerhalb eines Zeitraums ausgeben lassen:</p>
<pre class="brush: bash;">
svn di -r{2009-10-23}:{2009-11-28}
</pre>
<p>ALLE Änderungen der lokalen Arbeitskopie rückgängig machen:</p>
<pre class="brush: bash;">
svn revert -R .
</pre>
<p>SVN-Informationen als XML ausgeben lassen, um einfacher Infos für Analysen und Statistiken zu erhalten/zu parsen:</p>
<pre class="brush: bash;">
svn log --xml
</pre>
<p>Noch was für Leute, die keine Angst vor&#8217;m Löschen von Externals haben: Alle Dateien, die mit ? gekennzeichnet sind (bei SVN-Status) einfach mal löschen:</p>
<pre class="brush: bash;">
svn st | grep ^\? | awk '{print $2}' | xargs rm
</pre>
<p>Und hier noch ein Befehl um alle neuen Dateien zum Repository hinzuzufügen</p>
<pre class="brush: bash;">
svn st|grep ^?|sed s/?//|xargs svn add $1
</pre>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://webpiraten.de/index.php/2009/11/svn-befehle-fuer-zwischendurch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eigene Configs in Agavi nutzen</title>
		<link>http://webpiraten.de/index.php/2009/11/eigene-configs-in-agavi-nutze/</link>
		<comments>http://webpiraten.de/index.php/2009/11/eigene-configs-in-agavi-nutze/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 00:15:31 +0000</pubDate>
		<dc:creator>graste</dc:creator>
				<category><![CDATA[Agavi]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[agavi]]></category>
		<category><![CDATA[ConfigHandler]]></category>
		<category><![CDATA[Konfiguration]]></category>
		<category><![CDATA[Schema]]></category>
		<category><![CDATA[Validierung]]></category>
		<category><![CDATA[XSD]]></category>

		<guid isPermaLink="false">http://webpiraten.de/?p=191</guid>
		<description><![CDATA[Eigene XML-Konfigurationsdateien mit Agavi definieren, validieren und verwenden. Eine kurze Einführung mit Beispielnutzung des AgaviReturnArrayConfigHandler.]]></description>
			<content:encoded><![CDATA[<p>Für diverse Aufgaben in größeren Projekten ist es notwendig, eigene XML-Konfigurationsdateien zu nutzen. Die Definition umfangreicher Einstellungen in der settings.xml wird schnell anstrengend und das Holen der Werte per <code>AgaviConfig::get('setting.name', 'default');</code> unübersichtlich. Agavi bietet es aber an, eigene Konfigurationsdateien zu erstellen und diese nicht nur zu validieren, sondern auch zur Wiederverwendung zu cachen.<br />
In der <a href="http://www.mivesto.de/agavi/agavi-faq.html#general_22">Agavi FAQ</a> habe ich dazu mal ein Beispiel verfasst.</p>
<p>Einfach einen Config-Handler in der <code>config_handlers.xml</code> definieren:</p>
<pre class="brush: xml;">
&lt;handler pattern=&quot;%core.config_dir%/project/foo/*.xml&quot; class=&quot;AgaviReturnArrayConfigHandler&quot; /&gt;
</pre>
<p>und dann direkt in den Actions, Views und Models benutzen:</p>
<pre class="brush: php;">
if (!isset($config['baz']))
{
    throw new LogicException('baz is missing!');
}

if (isset($config['bars']))
{
    foreach ($config['bars'] as $foo =&gt; $data)
    {
        $this-&gt;doSomethingWithEach($foo, $data);
    }
}
</pre>
<p>Die XML-Datei für den obigen Code könnte beispielweise so aussehen:</p>
<pre class="brush: xml;">
&lt;ae:configurations&gt;
    &lt;ae:configuration&gt;
        &lt;baz&gt;asdf&lt;/baz&gt;
        &lt;foo&gt;-1&lt;/foo&gt;
        &lt;bars&gt;
            &lt;some&gt;...more data and xml...&lt;/some&gt;
            &lt;more&gt;...more data and xml...&lt;/more&gt;
            &lt;deep&gt;...more data and xml...&lt;/deep&gt;
            &lt;structs&gt;...more data and xml...&lt;/structs&gt;
        &lt;/bars&gt;
    &lt;/ae:configuration&gt;
    &lt;ae:configuration environment=&quot;production.*&quot;&gt;
        &lt;baz&gt;bleh&lt;/baz&gt;
        &lt;foo&gt;1&lt;/foo&gt;
    &lt;/ae:configuration&gt;
&lt;/ae:configurations&gt;
</pre>
<p>Gut zu erkennen ist der Vorteil eigener Configs: Man kann die Agavi-Features für Konfigurationsdateien nutzen und auf einfache Art und Weise environmentspezifische Einstellungen vornehmen (z.B. in &#8220;Production&#8221; andere Werte für Logdateien, URLs oder Einstellungen nutzen als während der Entwicklung oder beim Testen).</p>
<p>Ebenfalls gut zu erkennen im PHP-Code ist, dass man lauter Abfragen über die Existenz bestimmer Elemente macht, die man sich mit vernünftiger Validierung sparen kann, da invalide XML-Dokumente gar nicht erst als korrekt angesehen werden von Agavi. Um seine XML-Strukturen zu validieren definiert man per <code>validation</code> Parameter ein XML-Schema und definiert noch gleich einen eigenen ConfigHandler, den man schreibt und per <code>autoload.xml</code> bekannt macht:</p>
<pre class="brush: xml;">
&lt;handler pattern=&quot;%core.config_dir%/project/foo/*.foo.xml&quot; class=&quot;FooDefinitionConfigHandler&quot;&gt;
    &lt;validation&gt;%core.config_dir%/xsd/foo_definition.xsd&lt;/validation/&gt;
&lt;/handler&gt;
</pre>
<p>Der ConfigHandler könnte so beginnen:</p>
<pre class="brush: php;">
class FooDefinitionConfigHandler extends AgaviXmlConfigHandler
{
    // notwendige Methoden implementieren und XML-Struktur validieren...
}
</pre>
<p>Für Beispiele einfach in die in Agavi verwendeten XSDs und entsprechende ConfigHandler sehen. Viel Spaß. :)</p>
]]></content:encoded>
			<wfw:commentRss>http://webpiraten.de/index.php/2009/11/eigene-configs-in-agavi-nutze/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deployment mit ANT</title>
		<link>http://webpiraten.de/index.php/2009/10/deployment-mit-an/</link>
		<comments>http://webpiraten.de/index.php/2009/10/deployment-mit-an/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 20:39:17 +0000</pubDate>
		<dc:creator>sägefisch</dc:creator>
				<category><![CDATA[ANT]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[live]]></category>
		<category><![CDATA[stage]]></category>

		<guid isPermaLink="false">http://webpiraten.de/?p=104</guid>
		<description><![CDATA[ANT ist ein wunderbares Kommandozeilen-Tool mit dem man Deployment gerade auch von Webapplikationen automatisieren kann. Ich benutze es um Entwicklungsstände in die Stage oder Liveumgebung auszuspielen. Zur Konfiguration des Deploymentprozesses erzeugt man eine build.xml Datei, die alle nötigen Anweisungen enthält. Folgende XML Datei erzeugt einen Backup-Ordner und kopiert die aktuelle Live-Applikation dort hinein. Desweiteren erzeugt [...]]]></description>
			<content:encoded><![CDATA[<p>ANT ist ein wunderbares Kommandozeilen-Tool mit dem man Deployment gerade auch von Webapplikationen automatisieren kann.</p>
<p>Ich benutze es um Entwicklungsstände in die Stage oder Liveumgebung auszuspielen.</p>
<p>Zur Konfiguration des Deploymentprozesses erzeugt man eine <strong>build.xml</strong> Datei, die alle nötigen Anweisungen enthält.</p>
<p>Folgende XML Datei erzeugt einen Backup-Ordner und kopiert die aktuelle Live-Applikation dort hinein.</p>
<p>Desweiteren erzeugt das Skript einen Datenbank Dump und kopiert diesen ebenfalls dorthin.</p>
<p>Danach wird der aktuelle Entwicklungsstand in den Live-Ordner kopiert.</p>
<p>Zu guter Letzt werden noch die Log- und Cache-Ordner geleert.</p>
<pre class="brush: xml;">

&lt;project name=&quot;builder&quot; default=&quot;build&quot; basedir=&quot;.&quot;&gt;
    &lt;description&gt;
        devel to live update including dbdump and clear cache
    &lt;/description&gt;

    &lt;!-- set global properties for this build --&gt;
    &lt;property name=&quot;devel&quot; location=&quot;devel&quot;/&gt;
    &lt;property name=&quot;live&quot; location=&quot;live&quot;/&gt;
    &lt;property name=&quot;backup&quot; location=&quot;backup&quot;/&gt;

    &lt;property name=&quot;db_host&quot; value=&quot;localhost&quot;/&gt;
    &lt;property name=&quot;db&quot; value=&quot;databasename&quot;/&gt;
    &lt;property name=&quot;db_user&quot; value=&quot;databaseuser&quot;/&gt;
    &lt;property name=&quot;db_pass&quot; value=&quot;databasepassword&quot;/&gt;

    &lt;target name=&quot;build&quot;&gt;
        &lt;!-- create the timestamp --&gt;
        &lt;tstamp/&gt;

        &lt;!-- create the backup dir --&gt;
        &lt;mkdir dir=&quot;${backup}_${DSTAMP}&quot;/&gt;

        &lt;!-- dumb db to backup dir --&gt;
        &lt;echo message=&quot;create mysqldump&quot;/&gt;
        &lt;exec executable=&quot;mysqldump&quot; output=&quot;${backup}_${DSTAMP}/dump_${db}.sql&quot;&gt;
            &lt;arg value=&quot;${db}&quot;/&gt;
            &lt;arg value=&quot;-u${db_user}&quot;/&gt;
            &lt;arg value=&quot;-p${db_pass}&quot;/&gt;
        &lt;/exec&gt;

        &lt;!-- copy current live dir to backup dir --&gt;
        &lt;copy todir=&quot;${backup}_${DSTAMP}&quot;&gt;
            &lt;fileset dir=&quot;${live}&quot;/&gt;
        &lt;/copy&gt;

        &lt;!-- copy current devel dir to live dir --&gt;
        &lt;copy todir=&quot;${live}&quot;&gt;
            &lt;fileset dir=&quot;${devel}&quot; excludes=&quot;**/*index.php&quot;/&gt;&lt;!-- beware overiding main config index.php --&gt;
        &lt;/copy&gt;

        &lt;!-- delete cache/log files --&gt;
        &lt;echo message=&quot;cleanup cache/logs in backup/live&quot;/&gt;
        &lt;delete includeemptydirs=&quot;true&quot;&gt;
            &lt;fileset dir=&quot;${backup}_${DSTAMP}/application/cache&quot; includes=&quot;**/*&quot;/&gt;
            &lt;fileset dir=&quot;${backup}_${DSTAMP}/application/logs&quot; includes=&quot;**/*&quot;/&gt;
             &lt;fileset dir=&quot;${live}/application/cache&quot; includes=&quot;**/*&quot;/&gt;
            &lt;fileset dir=&quot;${live}/application/logs&quot; includes=&quot;**/*&quot;/&gt;
        &lt;/delete&gt;
    &lt;/target&gt;
&lt;/project&gt;
</pre>
<p>Dieses Skript wird auf der Kommandozeile von Linux ausgeführt.</p>
<p>ANT sucht per default nach einer <strong>build.xml</strong> im ausführenden Ordner.</p>
<pre class="brush: bash;">

user@server:~/pages$ ant

Buildfile: build.xml

build:
    [mkdir] Created dir: /home/user/pages/backup_20091027
     [echo] create mysqldump
     [copy] Copying 1153 files to /home/user/pages/backup_20091027
     [copy] Copied 261 empty directories to 5 empty directories under /home/user/pages/backup_20091027
     [copy] Copying 50 files to /home/user/pages/live
     [echo] cleanup cache/logs in backup/live

BUILD SUCCESSFUL
Total time: 27 seconds
</pre>
]]></content:encoded>
			<wfw:commentRss>http://webpiraten.de/index.php/2009/10/deployment-mit-an/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
