<?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>Dominik Winter&#039;s Blog &#187; programming language</title>
	<atom:link href="http://blog.edge-project.org/category/programming-language/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.edge-project.org</link>
	<description></description>
	<lastBuildDate>Fri, 01 Jul 2011 20:45:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>Recursively Create MD5-Hashes</title>
		<link>http://blog.edge-project.org/2011/07/01/recursively-create-md5-hashes/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://blog.edge-project.org/2011/07/01/recursively-create-md5-hashes/#comments</comments>
		<pubDate>Fri, 01 Jul 2011 15:51:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[programming language]]></category>

		<guid isPermaLink="false">http://blog.edge-project.org/?p=206</guid>
		<description><![CDATA[If you want to compute MD5 hashes for an directory, you can use following script. I added some exclusions needed for my projects.



After that you can check the directory against this file.

]]></description>
			<content:encoded><![CDATA[<p>If you want to compute MD5 hashes for an directory, you can use following script. I added some exclusions needed for my projects.</p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/bash

DIR=&quot;$1&quot;
MD5=&quot;file.md5&quot;

if [ -z &quot;$DIR&quot; ]; then
 DIR=&quot;.&quot;
fi

rm -f &quot;$DIR/$MD5&quot;

find \
    &quot;$DIR&quot; \
    -type f \
    -not \( \
        -path &quot;*.svn*&quot; -o \
        -path &quot;*.cache*&quot; -o \
        -path &quot;*.settings*&quot; -o \
        -path &quot;*.metadata*&quot; -o \
        -name &quot;.buildpath&quot; -o \
        -name &quot;.buildpath&quot; -o \
        -name &quot;.project&quot; -o \
        -name &quot;$MD5&quot; \
    \) \
    -print0 | \
xargs -0 md5sum &gt;&gt; &quot;$DIR/$MD5&quot;
</pre>
<p>After that you can check the directory against this file.</p>
<pre class="brush: bash; title: ; notranslate">
md5sum -c file.md5
</pre>
<p class="wp-flattr-button"></p> <p><a href="http://blog.edge-project.org/?flattrss_redirect&amp;id=206&amp;md5=964d568fdc68a46a229fbf4679b0d515" title="Flattr" target="_blank"><img src="http://blog.edge-project.org/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.edge-project.org/2011/07/01/recursively-create-md5-hashes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multiple Inheritance in PHP</title>
		<link>http://blog.edge-project.org/2009/12/20/multiple-inheritance-in-php/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://blog.edge-project.org/2009/12/20/multiple-inheritance-in-php/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 17:26:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.edge-project.org/?p=137</guid>
		<description><![CDATA[With the magic of __call() it is possible to do multiple inheritance in PHP. This example is more then a mixin pattern. It can also call protected and private methods from inherited classes.



That's all! Now the usage:

We have two simple base classes, Bird and Horse, which have some methods.



Now we want a new class named ...]]></description>
			<content:encoded><![CDATA[<p>With the magic of __call() it is possible to do multiple inheritance in PHP. This example is more then a mixin pattern. It can also call protected and private methods from inherited classes.</p>
<pre class="brush: php; title: ; notranslate">&lt;?php

abstract class Inheritance {
    private $_inheritances = array();

    public function __call($method, array $arguments = array()) {
        // Here you can handle the calls. Maybe you don't want to call
        // every found method but only the first or the last ...
        foreach ($this-&gt;_inheritances as $inheritance) {
            $inheritance-&gt;invoke($method, $arguments);
        }
    }

    public function invoke($method, $arguments) {
        if (method_exists($this, $method) === true) {
            return call_user_func_array(array($this, $method), $arguments);
        }
    }

    protected function _addInheritance(Inheritance $inheritance) {
        $this-&gt;_inheritances[get_class($inheritance)] = $inheritance;
    }
}</pre>
<p>That&#8217;s all! Now the usage:</p>
<p>We have two simple base classes, Bird and Horse, which have some methods.</p>
<pre class="brush: php; title: ; notranslate">/**
 * first base class
 */
class Bird extends Inheritance {
    public function chirp() {
        echo &quot;&lt;br/&gt;chirp ..&quot;;
    }

    public function fly() {
        echo &quot;&lt;br/&gt;fly ..&quot;;
    }

    protected function _eat() {
        echo &quot;&lt;br/&gt;eat worms ..&quot;;
    }
}

/**
 * second base class
 */
class Horse extends Inheritance {
    public function whinny() {
        echo &quot;&lt;br/&gt;whinny ..&quot;;
    }

    protected function _eat() {
        echo &quot;&lt;br/&gt;eat hay ..&quot;;
    }
}</pre>
<p>Now we want a new class named Pegasus that implements all methods from Bird and Horse. The only thing we have to do is to inherit from Inheritance and add the two base classes with _addInheritance().</p>
<pre class="brush: php; title: ; notranslate">class Pegasus extends Inheritance {
    public function __construct() {
        // bind extented classes
        $this-&gt;_addInheritance(new Bird);
        $this-&gt;_addInheritance(new Horse);
    }

    public function eat() {
        // works with protected methods, too
        $this-&gt;_eat();
    }
}

$pegasus = new Pegasus;
$pegasus-&gt;chirp();
$pegasus-&gt;fly();
$pegasus-&gt;whinny();
$pegasus-&gt;eat();</pre>
<p>Output:</p>
<pre class="brush: plain; title: ; notranslate">chirp ..
fly ..
whinny ..
eat worms ..
eat hay ..</pre>
<p class="wp-flattr-button"></p> <p><a href="http://blog.edge-project.org/?flattrss_redirect&amp;id=137&amp;md5=7affa6636bdb949af1b134c2491ba587" title="Flattr" target="_blank"><img src="http://blog.edge-project.org/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.edge-project.org/2009/12/20/multiple-inheritance-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Naming of Classes, Methods and Member Variables</title>
		<link>http://blog.edge-project.org/2009/10/18/naming-of-classes-methods-and-member-variables/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://blog.edge-project.org/2009/10/18/naming-of-classes-methods-and-member-variables/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 15:36:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[programming language]]></category>

		<guid isPermaLink="false">http://blog.edge-project.org/?p=91</guid>
		<description><![CDATA[This article is not about syntax style. It's only about right naming of classes, their methods and their member variables. Because there's nothing better for other programmer (ie. like me) to see a constant name schema.
General Provisions

	leave out articles like 'a' and 'the' - these are totally unnecessary (TheCar)
	don't use 'my' in the name ...]]></description>
			<content:encoded><![CDATA[<p>This article is not about syntax style. It&#8217;s only about right naming of classes, their methods and their member variables. Because there&#8217;s nothing better for other programmer (ie. like me) to see a constant name schema.</p>
<h3>General Provisions</h3>
<ul>
<li>leave out articles like &#8216;a&#8217; and &#8216;the&#8217; &#8211; these are totally unnecessary (TheCar)</li>
<li>don&#8217;t use &#8216;my&#8217; in the name &#8211; it&#8217;s not yours (myVar, MyClass)</li>
</ul>
<h3>Classes</h3>
<ul>
<li>try to use a noun or a short phrase with a noun (Tree, SubTree)</li>
<li>always use singular instead of plural</li>
<li>avoid imperatively &#8216;object&#8217; in class names &#8211; classes are not a objects. You can find bad examples everywhere: stdObject, ArryObject, Zend_Date_DateObject</li>
</ul>
<h3>Methods</h3>
<ul>
<li>the name should simply describe what does the method do</li>
<li>try to use a verb or verb with a noun, like save(), build(), getTitle()</li>
</ul>
<h3>Member Variables</h3>
<ul>
<li>if type of boolean, then prepend &#8216;is&#8217;</li>
<li>avoid variables like &#8216;x&#8217;, &#8216;i&#8217; &#8211; use for example &#8216;index&#8217;</li>
</ul>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://blog.edge-project.org/2009/10/18/naming-of-classes-methods-and-member-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jCharacterfall</title>
		<link>http://blog.edge-project.org/2009/10/15/jcharacterfall/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://blog.edge-project.org/2009/10/15/jcharacterfall/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 21:57:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[hacking]]></category>

		<guid isPermaLink="false">http://blog.edge-project.org/?p=79</guid>
		<description><![CDATA[This is the first article of my new section "javascript/hacking".

Firefox and and the Firebug add-on are required for the most scripts, I will post from time to time.

First go to this site http://demo.marcofolio.net/jcharacterfall/, put the code at the bottom in the console and run it. Then start the game.

Have much fun!

]]></description>
			<content:encoded><![CDATA[<p>This is the first article of my new section &#8220;javascript/hacking&#8221;.</p>
<p><a href="http://www.mozilla.org/">Firefox</a> and and the <a href="http://getfirebug.com/">Firebug add-on</a> are required for the most scripts, I will post from time to time.</p>
<p>First go to this site <a href="http://demo.marcofolio.net/jcharacterfall/">http://demo.marcofolio.net/jcharacterfall/</a>, put the code <span>at the bottom</span> in the console and run it. Then start the game.</p>
<p>Have much fun!</p>
<pre class="brush: jscript; title: ; notranslate">
$(function () {
    var still = [];
    var $document = $(document);

    window.setInterval(function () {
        var $drop = $('#waterfall .fallingchar:last-child');
        var id = $drop.attr('id');

        if ($drop.length !== 1 || $.inArray(id, still) !== -1) {
            return true;
        }

        var letter = $.trim($('p', $drop).text());

        $document.trigger({
            type: 'keydown',
            keyCode: String.charCodeAt(letter)
        });

        still.push(id);
    }, 1);
});
</pre>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://blog.edge-project.org/2009/10/15/jcharacterfall/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chaining Variables</title>
		<link>http://blog.edge-project.org/2009/06/21/chaining-variables/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://blog.edge-project.org/2009/06/21/chaining-variables/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 13:57:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.edge-project.org/?p=5</guid>
		<description><![CDATA[Do you have always asked yourself how to chain variables to make a sentence?

In the magic __get()-method the variable names will be collected, and finally the echo "calls" the __toString()-method.



Usage:



Output:

]]></description>
			<content:encoded><![CDATA[<p>Do you have always asked yourself how to chain variables to make a sentence?</p>
<p>In the magic __get()-method the variable names will be collected, and finally the echo &#8220;calls&#8221; the __toString()-method.</p>
<pre class="brush: php; title: ; notranslate">&lt;?php

class Sentence {
    protected $_words = array();

    public static function create() {
        return new self;
    }

    public function __get($word) {
        $this-&gt;_words[] = $word;

        return $this;
    }

    public function __toString() {
        return implode(' ', $this-&gt;_words) . '.';
    }
}</pre>
<p>Usage:</p>
<pre class="brush: php; title: ; notranslate">echo Sentence::create()-&gt;All-&gt;your-&gt;base-&gt;are-&gt;belong-&gt;to-&gt;us;</pre>
<p>Output:</p>
<pre class="brush: plain; title: ; notranslate">All your base are belong to us.</pre>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://blog.edge-project.org/2009/06/21/chaining-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

