<?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>blog.seric.at &#187; Code</title>
	<atom:link href="http://blog.seric.at/tag/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.seric.at</link>
	<description>photography programming politics life</description>
	<lastBuildDate>Tue, 10 Jan 2012 22:01:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-alpha-19719</generator>
		<item>
		<title>Automatic Anti-Pattern Corrections for PHP</title>
		<link>http://blog.seric.at/2010/07/19/automatic-anti-pattern-corrections-for-php/</link>
		<comments>http://blog.seric.at/2010/07/19/automatic-anti-pattern-corrections-for-php/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 11:23:45 +0000</pubDate>
		<dc:creator>Franziskus Domig</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Anti-Pattern]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[lex-pass]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[University]]></category>

		<guid isPermaLink="false">http://blog.seric.at/?p=271</guid>
		<description><![CDATA[During my computer science studies at the Vorarlberg University of Applied Sciences I wrote my bachelor thesis about "Automatic Anti-Pattern Corrections for PHP". As a fan of the open source philosophy, I want to share my work with others. ...]]></description>
			<content:encoded><![CDATA[<p>During my computer science studies at the Vorarlberg University of Applied Sciences I wrote my bachelor thesis about &#8220;Automatic Anti-Pattern Corrections for PHP&#8221;. As a fan of the open source philosophy, I want to share my work with others. I invite everyone to contribute to the great lex-pass project and this approach to better PHP software. Please share your thought and ideas on this with me and others by leaving a comment or sending me a message.<span id="more-271"></span></p>
<p>The thesis is written in german but at least there is an english abstract.</p>
<blockquote><p><strong>Abstract</strong></p>
<p>Since the first release of the programming language PHP, PHP has been rapidly developed. As a result to these huge improvements, many of the features from PHP 4 have been rewritten or replaced in PHP 5. For instance exception handling, abstract classes and interfaces have been introduced. Additionally, objects are not getting copied (call-by-value) every time they are assigned to another variable or used as function parameters, but assigned as reference (call-by-reference). As a result, many old and bad constructs remain in already existing applications. This leads to several issues.</p>
<p>That is why many companies struggle especially with security and performance problems. Manual refactoring of existing source code is time-consuming and a reason why a lot of companies abandon such improvements.<br />
The open-source initiative of Facebook led to the tool <a href="http://github.com/facebook/lex-pass">lex-pass</a> which is already capable of some very basic refactoring transformations. It is using the abstract syntax tree (AST) to transform PHP into corrected code according to predefined rules.</p>
<p>This bachelor thesis detects several anti-patterns and implements some basic transformations. As a result, these anti-patterns are automatically corrected with lex-pass. Then the implemented transformations are explained in detail and some further possible corrections are discussed. For demonstration purposes, some well known open-source projects are being tested and corrected with the written transformations.</p>
<p>As a conclusion the advantages and disadvantages of automatic corrections are explained and the usefulness and limitations of such automatic transformations are illustrated.</p></blockquote>
<p><a href="http://blog.seric.at/wp-content/uploads/2010/07/Bachelorarbeit_Franziskus_Domig.pdf">Download &#8220;Automatic Anti-Pattern Corrections for PHP&#8221; bachelor thesis</a></p>
<p>I would like to thank the people from Mayflower GmbH for their great support  and Daniel Corson from Facebook for his contribution to my work.</p>
<div class="gpo_bottomcontainer">
						<div class="gpo_buttons">
						        <g:plusone href="http://blog.seric.at/2010/07/19/automatic-anti-pattern-corrections-for-php/" size="standard" count="true"></g:plusone>
						</div>
			   </div>
			   <div style="clear:both"></div><p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://blog.seric.at/2010/07/19/automatic-anti-pattern-corrections-for-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wer sagt C wäre simpel?</title>
		<link>http://blog.seric.at/2008/03/06/wer-sagt-c-ware-simpel/</link>
		<comments>http://blog.seric.at/2008/03/06/wer-sagt-c-ware-simpel/#comments</comments>
		<pubDate>Thu, 06 Mar 2008 22:44:23 +0000</pubDate>
		<dc:creator>Franziskus Domig</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[CIL]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[GCC]]></category>

		<guid isPermaLink="false">http://seric.at/blog/?p=28</guid>
		<description><![CDATA[Ich habe eine interessante Webseite gefunden, welche sich mit dem teilweise witzigen und komischen Verhalten von C bzw. dem Compiler (GCC sowie Microsoft VC) befasst.]]></description>
			<content:encoded><![CDATA[<p>Ich habe eine <a title="Who says C is simple?" href="http://manju.cs.berkeley.edu/cil/cil016.html">interessante Webseite</a> gefunden, welche sich mit dem teilweise witzigen und komischen Verhalten von C bzw. dem Compiler (GCC sowie Microsoft VC) befasst.</p>
<div class="gpo_bottomcontainer">
						<div class="gpo_buttons">
						        <g:plusone href="http://blog.seric.at/2008/03/06/wer-sagt-c-ware-simpel/" size="standard" count="true"></g:plusone>
						</div>
			   </div>
			   <div style="clear:both"></div><p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://blog.seric.at/2008/03/06/wer-sagt-c-ware-simpel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP-Code-Camp in München</title>
		<link>http://blog.seric.at/2008/02/26/php-code-camp-in-munchen/</link>
		<comments>http://blog.seric.at/2008/02/26/php-code-camp-in-munchen/#comments</comments>
		<pubDate>Tue, 26 Feb 2008 19:36:21 +0000</pubDate>
		<dc:creator>Franziskus Domig</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Camp]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[München]]></category>

		<guid isPermaLink="false">http://seric.at/blog/?p=20</guid>
		<description><![CDATA[Vom 3. bis zum 6. März 2008 findet in München das PHP Code Camp statt und es sind noch Plätze frei. Auf diesem Camp werden unterschiedliche Schulungen mit einigen bekannten Referenten abgehalten. Das Camp findet im NH Hotel Deutscher ...]]></description>
			<content:encoded><![CDATA[<p>Vom <b>3. bis zum 6. März 2008</b> findet in München das <a title="PHP Code Camp" href="http://entwickler-akademie.de/codecamps/php">PHP Code Camp</a> statt und es sind noch Plätze frei. Auf diesem Camp werden unterschiedliche Schulungen mit einigen bekannten Referenten abgehalten. Das Camp findet im NH Hotel Deutscher Kaiser direkt am Münchner Hauptbahnhof statt und kostet ab 1.790 Euro. Organisiert wird das Code Camp vom PHP Magazin und von der Entwickler Akademie und wird als ein neuartiges Trainingskonzept beworben, das vier Tage lang in konzentrierter Form vermittelt, wie PHP-Anwendungen mit professionellem Anspruch entwickelt werden können.</p>
<p><b>Ein Auszug aus dem geplanten Programm:</b></p>
<blockquote><p>Interaktives Code-Review einer &#8220;schlechten&#8221; Anwendung<br />
PHP-Security (SQL-Injection, XSS, Session-Hijacking, Input-Verarbeitung)<br />
Objektorientierte Programmierung<br />
Testgetriebene Entwicklung<br />
Einführung in Unit Testing, Entwicklung von Unit Tests<br />
Werkzeuge für die PHP-Entwicklung<br />
Funktionale Tests<br />
Patterns für PHP<br />
Code-Review von schlechtem und gutem Code</p></blockquote>
<p><b>Mehr Informationen:</b><br />
<a href="http://entwickler-akademie.de/codecamps/php">PHP Code Camp</a></p>
<div class="gpo_bottomcontainer">
						<div class="gpo_buttons">
						        <g:plusone href="http://blog.seric.at/2008/02/26/php-code-camp-in-munchen/" size="standard" count="true"></g:plusone>
						</div>
			   </div>
			   <div style="clear:both"></div><p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://blog.seric.at/2008/02/26/php-code-camp-in-munchen/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Externals in SVN inkludieren</title>
		<link>http://blog.seric.at/2008/02/12/externals-in-sv-inkludieren/</link>
		<comments>http://blog.seric.at/2008/02/12/externals-in-sv-inkludieren/#comments</comments>
		<pubDate>Tue, 12 Feb 2008 16:17:15 +0000</pubDate>
		<dc:creator>Franziskus Domig</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[SVN]]></category>

		<guid isPermaLink="false">http://seric.at/blog/?p=15</guid>
		<description><![CDATA[Weil wir gerade die Diskussion hatten wie man externe Repositories in das eigene Repository inkludieren kann, möchte ich dazu einige Zeilen tippen. Es manch manchmal durchaus externe Quellen wie zum für Beispiel eine Library oder Plugins und Themes in ...]]></description>
			<content:encoded><![CDATA[<p>Weil wir gerade die Diskussion hatten wie man externe Repositories in das eigene Repository inkludieren kann, möchte ich dazu einige Zeilen tippen. Es manch manchmal durchaus externe Quellen wie zum für Beispiel eine Library oder Plugins und Themes in ein Projekt zu integrieren. Um dabei auch jeweils auf dem aktuellsten Stand zu bleiben, kann man mithilfe der SVN (<a href="http://subversion.tigris.org">Subversion</a>) Eigenschaft &#8220;<code>externals</code>&#8221; ein externes Repository angeben.</p>
<p>Dazu macht man folgendes:<span id="more-15"></span></p>
<p>Zuerst importiert man in seine Working-Copy die externe Quelle mittels <code>svn checkout &lt;url&gt;</code>. Mit <code>svn propset svn:externals "&lt;Verzeichnis&gt; &lt;url&gt;" &lt;Name&gt;</code> wird nun die Eigenschaft des angegebenen Verzeichnis auf eine externe Quelle mit angegebener URI zum entsprechenden Repository gelegt. Nun kann das die Working-Copy mit <code>svn commit -m "added external ressource"</code> in das Repository importiert werden.<br />
<script type="text/javascript"><!--
google_ad_client = "pub-7188468985735362";
/* 468x60, Erstellt 28.02.10 */
google_ad_slot = "7225146616";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
Um das ganze nun zu Überprüfen, reicht ein einfaches <code>svn update</code> und man sollte für das entsprechende Verzeichnis die Ausgabe: &#8220;<code>Fetching external item into &lt;Name&gt;</code>&#8221; zusätzlich zum Normalen Update-Text erhalten und das entsprechende Verzeichnis wird automatisch aus einem anderen Repository importiert bzw. aktualisiert.</p>
<p>Weiter <a href="http://svnbook.red-bean.com/en/1.0/ch07s03.html">Informationen zur Thematik</a> gibt es außerdem beim svnbook.</p>
<div class="gpo_bottomcontainer">
						<div class="gpo_buttons">
						        <g:plusone href="http://blog.seric.at/2008/02/12/externals-in-sv-inkludieren/" size="standard" count="true"></g:plusone>
						</div>
			   </div>
			   <div style="clear:both"></div><p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://blog.seric.at/2008/02/12/externals-in-sv-inkludieren/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>isPrime.c</title>
		<link>http://blog.seric.at/2008/02/07/isprimec/</link>
		<comments>http://blog.seric.at/2008/02/07/isprimec/#comments</comments>
		<pubDate>Thu, 07 Feb 2008 10:49:09 +0000</pubDate>
		<dc:creator>Franziskus Domig</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[Uni]]></category>

		<guid isPermaLink="false">http://seric.at/blog/?p=3</guid>
		<description><![CDATA[Ja, man würde vielleicht vermuten, dass es überhaupt keine Schwierigkeit ist, herauszufinden ob eine Zahl eine Primzahl ist oder nicht. Es soll jedoch Leute geben, die sich damit schwer tun (und zufälligerweise des öfteren neben mir in den Vorlesungen ...]]></description>
			<content:encoded><![CDATA[<p>Ja, man würde vielleicht vermuten, dass es überhaupt keine Schwierigkeit ist, herauszufinden ob eine Zahl eine Primzahl ist oder nicht. Es soll jedoch Leute geben, die sich damit schwer tun (und zufälligerweise des öfteren neben mir in den Vorlesungen sitzen).</p>
<p>Deswegen von mir (auch wenn man dieses Problem wohl niemals rekursiv lösen würde) der entsprechende Source-Code dazu:</p>

<div class="wp_syntax"><div class="code"><pre class="c"><span class="kw4">int</span> isPrime<span class="br0">&#40;</span><span class="kw4">int</span> num<span class="sy0">,</span> <span class="kw4">int</span> i<span class="br0">&#41;</span> <span class="br0">&#123;</span>
    <span class="kw1">if</span> <span class="br0">&#40;</span>num <span class="sy0">==</span> <span class="nu0">0</span><span class="br0">&#41;</span> <span class="kw1">return</span> <span class="nu0">0</span><span class="sy0">;</span>
    <span class="kw1">if</span> <span class="br0">&#40;</span>i<span class="sy0">*</span>i <span class="sy0">&gt;</span> num<span class="br0">&#41;</span> <span class="kw1">return</span> <span class="nu0">1</span><span class="sy0">;</span>
    <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>num<span class="sy0">%</span>i<span class="br0">&#41;</span> <span class="sy0">==</span> <span class="nu0">0</span><span class="br0">&#41;</span> <span class="kw1">return</span> <span class="nu0">0</span><span class="sy0">;</span>
    <span class="kw1">return</span> isPrime<span class="br0">&#40;</span>num<span class="sy0">,</span> <span class="br0">&#40;</span>i<span class="sy0">+</span><span class="nu0">1</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre></div></div>

<div class="gpo_bottomcontainer">
						<div class="gpo_buttons">
						        <g:plusone href="http://blog.seric.at/2008/02/07/isprimec/" size="standard" count="true"></g:plusone>
						</div>
			   </div>
			   <div style="clear:both"></div><p class="wp-flattr-button"></p> <p><a href="http://blog.seric.at/?flattrss_redirect&amp;id=3&amp;md5=a8a940432a42e4c27df81695652dbd83" title="Flattr" target="_blank"><img src="http://blog.seric.at/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.seric.at/2008/02/07/isprimec/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

