PageRenderTime 35ms CodeModel.GetById 18ms app.highlight 8ms RepoModel.GetById 0ms app.codeStats 1ms

/tests/ZendTest/Feed/Reader/Entry/_files/Common/rss.xml

Design Patterns: Elements of Reusable Object-Oriented Software

Also known as 'The Gang of Four' or GoF book. The bible when it comes to design patterns. One of the books that you read early in your career and apply over and over again. Amazon Affiliate Link
https://bitbucket.org/dagnet_d/zf2
XML | 679 lines | 599 code | 80 blank | 0 comment | 0 complexity | 0b7ae0ec216a6ed332b1f41b9759f824 MD5 | raw file
  1<?xml version="1.0" encoding="UTF-8"?>
  2<rss version="2.0"
  3	xmlns:content="http://purl.org/rss/1.0/modules/content/"
  4	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  5	xmlns:dc="http://purl.org/dc/elements/1.1/"
  6	xmlns:atom="http://www.w3.org/2005/Atom"
  7	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
  8	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  9	>
 10
 11<channel>
 12	<title>Norm 2782</title>
 13	<atom:link href="http://www.norm2782.com/feed/" rel="self" type="application/rss+xml" />
 14	<link>http://www.norm2782.com</link>
 15	<description>Why are you here?</description>
 16	<lastBuildDate>Sat, 07 Mar 2009 08:03:50 +0000</lastBuildDate>
 17	<generator>http://wordpress.org/?v=2.8</generator>
 18	<language>en</language>
 19	<sy:updatePeriod>hourly</sy:updatePeriod>
 20	<sy:updateFrequency>1</sy:updateFrequency>
 21			<item>
 22		<title>Wth&#8230; reading books?</title>
 23		<link>http://www.norm2782.com/2009/03/wth-reading-books/</link>
 24		<comments>http://www.norm2782.com/2009/03/wth-reading-books/#comments</comments>
 25		<pubDate>Mon, 02 Mar 2009 08:09:33 +0000</pubDate>
 26		<dc:creator>norm2782</dc:creator>
 27				<category><![CDATA[New Zealand]]></category>
 28		<category><![CDATA[Personal]]></category>
 29		<category><![CDATA[Programming]]></category>
 30		<category><![CDATA[Study]]></category>
 31
 32		<guid isPermaLink="false">http://www.norm2782.com/?p=114</guid>
 33		<description><![CDATA[Being in New Zealand does strange things to a person. Everybody who knows me, knows I don&#8217;t much like that crazy invention called a Book. However, being here I&#8217;ve already finished 4 books, all of which I can highly recommend.
 34
 35Agile Software Development with Scrum, by Ken Schwaber and Mike Beedle
 36Domain-Driven Design: Tackling Complexity in the [...]]]></description>
 37			<content:encoded><![CDATA[<p>Being in New Zealand does strange things to a person. Everybody who knows me, knows I don&#8217;t much like that crazy invention called a Book. However, being here I&#8217;ve already finished 4 books, all of which I can highly recommend.</p>
 38<ul>
 39<li><a href="http://www.amazon.com/Agile-Software-Development-Scrum/dp/0130676349/">Agile Software Development with Scrum, by Ken Schwaber and Mike Beedle</a></li>
 40<li><a href="http://www.amazon.com/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215/">Domain-Driven Design: Tackling Complexity in the Heart of Software, by Eric Evans</a></li>
 41<li><a href="http://www.amazon.com/Enterprise-Application-Architecture-Addison-Wesley-Signature/dp/0321127420/">Patterns of Enterprise Application Architecture, by Martin Fowler</a></li>
 42<li><a href="http://www.amazon.com/Refactoring-Improving-Existing-Addison-Wesley-Technology/dp/0201485672/">Refactoring: Improving the Design of Existing Code by Martin Fowler</a></li>
 43</ul>
 44<p>Next up: <a href="http://www.amazon.com/Design-Patterns-Object-Oriented-Addison-Wesley-Professional/dp/0201633612/">Design Patterns: Elements of Reusable Object-Oriented Software, by the Gang of Four</a>. Yes, talk about classics and shame on me for not having ordered it sooner! Also reading <a href="http://www.amazon.com/Implementation-Patterns-Addison-Wesley-Signature-Kent/dp/0321413091/">Implementation Patterns, by Kent Beck</a> at the moment.</p>
 45]]></content:encoded>
 46			<wfw:commentRss>http://www.norm2782.com/2009/03/wth-reading-books/feed/</wfw:commentRss>
 47		<slash:comments>0</slash:comments>
 48		</item>
 49		<item>
 50		<title>My first few weeks in New Zealand</title>
 51		<link>http://www.norm2782.com/2009/02/my-first-few-weeks-in-new-zealand/</link>
 52		<comments>http://www.norm2782.com/2009/02/my-first-few-weeks-in-new-zealand/#comments</comments>
 53		<pubDate>Sun, 15 Feb 2009 03:29:21 +0000</pubDate>
 54		<dc:creator>norm2782</dc:creator>
 55				<category><![CDATA[New Zealand]]></category>
 56		<category><![CDATA[Personal]]></category>
 57
 58		<guid isPermaLink="false">http://www.norm2782.com/?p=105</guid>
 59		<description><![CDATA[It&#8217;s been a while since my last blog post. Things have been quite hectic for me these last few weeks. There was my final week at Angry Bytes, followed by a pre-NZ party and then my trip to New Zealand. Currently New Zealand looks pretty much the same as the Netherlands, seeing as I&#8217;m locked [...]]]></description>
 60			<content:encoded><![CDATA[<p>It&#8217;s been a while since my last blog post. Things have been quite hectic for me these last few weeks. There was my final week at <a href="http://www.angrybytes.com">Angry Bytes</a>, followed by a pre-NZ party and then my trip to New Zealand. Currently New Zealand looks pretty much the same as the Netherlands, seeing as I&#8217;m locked away in an office most of my time.</p>
 61<p><span id="more-105"></span><br />
 62My adventure into Kiwi-land started with a long and interesting trip to San Francisco. The interesting part was my new book: <a href="http://domaindrivendesign.org/books/#DDD">Domain Driven Design: Tackling Complexity in the Heart of Software</a>, by Eric Evans. This book, combined with KLM&#8217;s excellent on-board service made my flight to SF a breeze.</p>
 63<p>It was only 2PM when I arrived in SF, so I had to wait another 4 hours before my flight to Auckland even boarded. The waiting wasn&#8217;t too bad. It was great to get out into the sun and to grab some decent food and coffee. Didn&#8217;t get to see much of SF though, which was too bad.</p>
 64<p><img src="http://farm4.static.flickr.com/3403/3232983613_637af46bc3.jpg?v=0" alt="SF Airport" /></p>
 65<p>The flight to Auckland wasn&#8217;t that flawless unfortunately. There were some technical problems with the airplane, which caused quite a bit of a delay. Because of this delay I had to run to catch my flight to Dunedin. The flight was all set to go and was waiting for me&#8230; I barely made it in time!</p>
 66<p><img src="http://farm4.static.flickr.com/3109/3233835892_ec0b4d26f8.jpg?v=0" alt="Flying to Dunedin" /></p>
 67<p>When I got to Dunedin I was welcomed by Jesse, Tracey and Lindsay. It was great to meet them in person. The first order of business for me was to get some coffee, because I only got roughly 3 hours of sleep on my way there. After a little tour of <a href="http://www.otago.ac.nz/abbeycollege/">Abbey College</a> (that&#8217;s where I&#8217;m staying) it was time for our first meeting. No time for sleep! Finally, after dinner at Abbey, I decided it was time to get some sleep. When I woke up the next day, the jet-lag was no more!</p>
 68<p><img src="http://farm4.static.flickr.com/3201/3280470572_fceb6c64c8.jpg?v=0" alt="My Room" /></p>
 69<p>Abbey is a great place to stay by the way. It&#8217;s not far from the office or from the city center. The people who are staying there are great as well. Just <a href="http://www.otago.ac.nz/abbeycollege/">check out the site</a>. Abbey&#8217;s got it all!</p>
 70<p><img src="http://farm4.static.flickr.com/3227/3279648921_d8efbd51e3.jpg?v=0" alt="View from my room" /></p>
 71<p>So what am I doing here in NZ? We&#8217;re currently working on writing the software for the <a href="http://www.otago.ac.nz/research/pbrf/">PBRF initiative</a>. It has already taken a lot of late hours, and it will probably take a lot more. It will be worth it though! After that, we&#8217;ll be working on a great and exciting cutting-edge open-source project. Unfortunately I can&#8217;t say a lot more at this point, but you can rest assured that it includes the latest <a href="http://framework.zend.com">Zend Framework technologies</a>.</p>
 72<p><img src="http://farm4.static.flickr.com/3432/3239911680_bd2f368457.jpg?v=0" alt="My Desk" /></p>
 73<p>Seeing as I don&#8217;t have internet-access at Abbey College yet, I&#8217;ve got lots of time for other activities. I&#8217;ve finished reading the better part of my <a href="http://domaindrivendesign.org/books/#DDD">Domain Driven Design book</a> and I&#8217;ve ordered Martin Fowler&#8217;s <a href="http://martinfowler.com/books.html#eaa">Patterns Of Enterprise Application Architecture</a>, which should arrive this week. I&#8217;ve also bought myself a brand new bicycle so I can get around. Cycling here is a bit more dangerous than in the Netherlands though&#8230; it definitely brings back memories from my bicycling trip in Scotland! There are lots more things on my todo list: winery tour, surfing, snowboarding, skydiving, bungee-jumping, renting/buying a Harley&#8230; six months in NZ is not going to be enough time!</p>
 74<p><img src="http://farm4.static.flickr.com/3408/3279649371_521a113552.jpg?v=0" alt="Me!" /></p>
 75<p>Well, that&#8217;s my first NZ blog-post. There will definitely be more of these! Let&#8217;s hope they fix my internet soon&#8230; See <a href="http://www.flickr.com/photos/34800767@N05/">my Flickr photo-stream</a> for more pictures.</p>
 76]]></content:encoded>
 77			<wfw:commentRss>http://www.norm2782.com/2009/02/my-first-few-weeks-in-new-zealand/feed/</wfw:commentRss>
 78		<slash:comments>0</slash:comments>
 79		</item>
 80		<item>
 81		<title>Properties in PHP &#8211; revisited</title>
 82		<link>http://www.norm2782.com/2009/01/properties-in-php-revisited/</link>
 83		<comments>http://www.norm2782.com/2009/01/properties-in-php-revisited/#comments</comments>
 84		<pubDate>Wed, 14 Jan 2009 10:47:25 +0000</pubDate>
 85		<dc:creator>norm2782</dc:creator>
 86				<category><![CDATA[PHP]]></category>
 87		<category><![CDATA[Proof-of-concepts]]></category>
 88
 89		<guid isPermaLink="false">http://www.norm2782.com/?p=94</guid>
 90		<description><![CDATA[A while ago I was daydreaming about native property support in PHP. Unfortunately it will be a while before PHP itself will support this natively and an even longer while before shared hosting providers will upgrade to a newer version of PHP.
 91So what&#8217;s the big deal about those properties? In short, they make a developers [...]]]></description>
 92			<content:encoded><![CDATA[<p>A while ago I was daydreaming about native <a href="http://www.norm2782.com/2009/01/properties-in-php/">property support in PHP</a>. Unfortunately it will be a while before PHP itself will support this natively and an even longer while before shared hosting providers will upgrade to a newer version of PHP.</p>
 93<p>So what&#8217;s the big deal about those properties? In short, they make a developers life easier by allowing the developer to code no more than needed at that moment. And lets face it&#8230; less code is better! In this post we&#8217;ll see that it&#8217;s not impossible to enjoy properties in PHP <em>today</em>. As with a lot of good things, it does come with a small price though&#8230;</p>
 94<p><span id="more-94"></span><br />
 95Lets have a look at a use-case to demonstrate where properties will not only save you time, but it will also save your sanity. In this example we&#8217;re modeling a Person class. In the beginning of the project, the requirements for the Person class are quite simple: a Person has an age and a name. In the simplest form we can code that as follows:</p>
 96<pre name="code" class="php:nogutter">
 97&lt;?php
 98class Person
 99{
100    public $age;
101
102    public $name;
103}
104</pre>
105<p>This look easy enough, and it is. It even works like a charm and it&#8217;s possibly the fastest implementation for the Person class.</p>
106<p>But, pesky as they are, the client suddenly wants some logic added to our Person class! A Person suddenly can&#8217;t be younger than 21 years old. This poses a problem. To add logic to our Person class, we would have to switch the public age attribute with a pair of getters and setters:</p>
107<pre name="code" class="php:nogutter">
108&lt;?php
109class Person
110{
111    private $_age = null;
112
113    public $name = null;
114
115    public function getAge()
116    {
117        return $this-&gt;_age;
118    }
119
120    public function setAge($age)
121    {
122        if ($age &lt; 21) {
123            throw new Exception('You need to be at least 21 years or older!');
124        }
125
126        $this-&gt;_age = $age;
127    }
128}
129</pre>
130<p>Technically this works like a charm, however it will force me to go through my entire application and switch all references from the public attribute to the getter and setter. Not an ideal situation. One possible solution is to do things the Java way: just create all getters and setters up-front so you don&#8217;t have to do so afterwards. Even though this works fine, it&#8217;s in violation of our mission to write no more code than we actually need at the moment of writing.</p>
131<p>The solution? Properties! But wait&#8230; PHP doesn&#8217;t support those, remember? Luckily we still have magic methods. It&#8217;s nowhere near as nice as a native solution, but at least it helps us write no more code than we need at the moment we&#8217;re first writing our code:</p>
132<pre name="code" class="php:nogutter">
133&lt;?php
134abstract class ModelAbstract
135{
136    public function __get($key)
137    {
138        $method = 'get' . ucfirst($key);
139
140        if (!method_exists($this, $method)) {
141            throw new Exception('No property found for ' . $key);
142        }
143
144        return $this-&gt;$method();
145    }
146
147    public function __set($key, $value)
148    {
149        $method = 'set' . ucfirst($key);
150
151        if (!method_exists($this, $method)) {
152            throw new Exception('No property found for ' . $key);
153        }
154
155        $this-&gt;$method($value);
156    }
157}
158</pre>
159<p>We&#8217;ll take a look at what this does exactly later. The important thing to note is that we can now do the following:</p>
160<pre name="code" class="php:nogutter">
161&lt;?php
162class Person extends ModelAbstract
163{
164    private $_age = null;
165
166    public $name = null;
167
168    public function getAge()
169    {
170        return $this-&gt;_age;
171    }
172
173    public function setAge($age)
174    {
175        if ($age &lt; 21) {
176            throw new Exception('You need to be at least 21 years or older!');
177        }
178
179        $this-&gt;_age = $age;
180    }
181}
182
183$person = new Person();
184
185try {
186    $person-&gt;age = 10;
187} catch (Exception $e) {
188    // Will print "You need to be at least 21 years or older!"
189    echo $e-&gt;getMessage();
190}
191</pre>
192<p>With this construction in place, we can safely switch from a public attribute to getters and setters, without changing the rest of the application code. The only real downside to this &#8211; aside from the minor speed impact &#8211; is the fact that you have to subclass ModelAbstract to make this work. Luckily it&#8217;s not a lot of code, so should there be a big need to get rid of the ModelAbstract inheritance it&#8217;s not a big disaster to do some copy/paste work.</p>
193<p>This method works by assuming you have get- and set methods that have the same name as the property you&#8217;re trying to access. When there&#8217;s a public attribute, it will use that. If there&#8217;s no public attribute, it will fall back to __get or __set and the logic will take it from there.</p>
194<p>All of this is just a proof-of-concept of implementing properties in PHP and of the way I want to be using properties to access data the data in my objects. Please comment your experiences with this approach or similar approaches. I&#8217;m curious to see how practical this solution would be in a real-life situation.</p>
195]]></content:encoded>
196			<wfw:commentRss>http://www.norm2782.com/2009/01/properties-in-php-revisited/feed/</wfw:commentRss>
197		<slash:comments>0</slash:comments>
198		</item>
199		<item>
200		<title>Filters for Zend_Paginator</title>
201		<link>http://www.norm2782.com/2009/01/filters-for-zend_paginator/</link>
202		<comments>http://www.norm2782.com/2009/01/filters-for-zend_paginator/#comments</comments>
203		<pubDate>Tue, 13 Jan 2009 12:57:53 +0000</pubDate>
204		<dc:creator>norm2782</dc:creator>
205				<category><![CDATA[PHP]]></category>
206		<category><![CDATA[Zend Framework]]></category>
207
208		<guid isPermaLink="false">http://www.norm2782.com/?p=72</guid>
209		<description><![CDATA[Zend_Paginator has a new feature! It is now possible to add a filter to your Paginator object which acts on the data retrieved from the adapter. This filter can be any instance of Zend_Filter_Interface, including a filter-chain. If a filter(-chain) is set, the raw data from the adapter will be passed to the filter() method.
210
211So [...]]]></description>
212			<content:encoded><![CDATA[<p>Zend_Paginator has a new feature! It is now possible to add a filter to your Paginator object which acts on the data retrieved from the adapter. This filter can be any instance of Zend_Filter_Interface, including a filter-chain. If a filter(-chain) is set, the raw data from the adapter will be passed to the filter() method.</p>
213<p><span id="more-72"></span><br />
214So why would you want to apply filters to your result set? Usually my domain models don&#8217;t inherit from Zend_Db_Table_Row but that is the data type I get from the Paginator when I use the DbTableSelect adapter (wrapped in a nice Zend_Db_Table_Rowset). Instead, I would like to load my rows into my models and preferably without using the Paginator abilities or having to apply weird hacks. Previously this was only possible (in a sane way) by subclassing an adapter so it could return a collection of model objects instead of a rowset. With the new filter support you can just inject a filter to do this for you.</p>
215<p>Lets have a look at an example. In this example I want to list all my users from the database. I&#8217;ll grab the name of the user from the row and inject it into a User object.</p>
216<pre name="code" class="php:nogutter">
217&lt;?php
218class User
219{
220    private $_name = '';
221
222    public function getName()
223    {
224        return $this-&gt;_name;
225    }
226
227    public function setName($name)
228    {
229        $this-&gt;_name = $name;
230    }
231}
232
233class UserFilter implements Zend_Filter_Interface
234{
235    public function filter($rows)
236    {
237        $users = array();
238
239        foreach ($rows as $row) {
240            $user = new User();
241            $user-&gt;setName($row-&gt;name);
242
243            $users[] = $user;
244        }
245
246        return $rows;
247    }
248}
249
250class MyModel
251{
252    public static function getUserPaginator()
253    {
254        $userTable = new UserTable();
255        $paginator = Zend_Paginator::factory($userTable-&gt;select());
256        $paginator-&gt;setFilter(new UserFilter());
257
258        return $paginator;
259    }
260}
261
262$paginator = MyModel::getUserPaginator();
263$items = $paginator-&gt;getCurrentItems();
264
265foreach ($items as $user) {
266    echo 'Current name: ' . $user-&gt;getName() . '&lt;br /&gt;' . PHP_EOL;
267}
268</pre>
269<p>To simplify adding a simple filter to your paginator I&#8217;ve also added Zend_Filter_Callback. This allows you to specify a callback method that does the same as the filter in the previous example.</p>
270<pre name="code" class="php:nogutter">
271&lt;?php
272class MyModel
273{
274    public static function getUserPaginator()
275    {
276        $userTable = new UserTable();
277        $paginator = Zend_Paginator::factory($userTable-&gt;select());
278        $paginator-&gt;setFilter(new Zend_Filter_Callback(
279            array('MyModel', 'filter'))
280        );
281
282        return $paginator;
283    }
284
285    public static function filter($rows)
286    {
287        $users = array();
288
289        foreach ($rows as $row) {
290            $user = new User();
291            $user-&gt;setName($row-&gt;name);
292
293            $users[] = $user;
294        }
295
296        return $rows;
297    }
298}
299</pre>
300<p>The callback also accepts object instead of a static reference to a class. Internally it uses call_user_func to execute the filter() method, so any notation that works there, works with the Callback filter.</p>
301<p>Enjoy!</p>
302]]></content:encoded>
303			<wfw:commentRss>http://www.norm2782.com/2009/01/filters-for-zend_paginator/feed/</wfw:commentRss>
304		<slash:comments>0</slash:comments>
305		</item>
306		<item>
307		<title>ZF-3239</title>
308		<link>http://www.norm2782.com/2009/01/zf-3239/</link>
309		<comments>http://www.norm2782.com/2009/01/zf-3239/#comments</comments>
310		<pubDate>Wed, 07 Jan 2009 11:48:31 +0000</pubDate>
311		<dc:creator>norm2782</dc:creator>
312				<category><![CDATA[PHP]]></category>
313		<category><![CDATA[Zend Framework]]></category>
314
315		<guid isPermaLink="false">http://www.norm2782.com/?p=68</guid>
316		<description><![CDATA[Zend_Db_Table_Select users, rejoice! I&#8217;ve just committed a patch for ZF-3239 in revision 13530. This should be a relief for those of you who have been implementing workarounds for those &#8220;No table has been specified for the FROM clause&#8221; exceptions.
317]]></description>
318			<content:encoded><![CDATA[<p>Zend_Db_Table_Select users, rejoice! I&#8217;ve just committed a patch for <a href="http://framework.zend.com/issues/browse/ZF-3239">ZF-3239</a> in revision 13530. This should be a relief for those of you who have been implementing workarounds for those &#8220;No table has been specified for the FROM clause&#8221; exceptions.</p>
319]]></content:encoded>
320			<wfw:commentRss>http://www.norm2782.com/2009/01/zf-3239/feed/</wfw:commentRss>
321		<slash:comments>0</slash:comments>
322		</item>
323		<item>
324		<title>New in-ear earphones</title>
325		<link>http://www.norm2782.com/2009/01/new-in-ear-earphones/</link>
326		<comments>http://www.norm2782.com/2009/01/new-in-ear-earphones/#comments</comments>
327		<pubDate>Sat, 03 Jan 2009 15:49:19 +0000</pubDate>
328		<dc:creator>norm2782</dc:creator>
329				<category><![CDATA[Personal]]></category>
330
331		<guid isPermaLink="false">http://www.norm2782.com/?p=53</guid>
332		<description><![CDATA[Just got myself the Sennheiser CX 300 II Precision in-ear earphones. Check &#8216;em out by clicking the read more link!
333
334
335]]></description>
336			<content:encoded><![CDATA[<p>Just got myself the Sennheiser CX 300 II Precision in-ear earphones. Check &#8216;em out by clicking the read more link!</p>
337<p><span id="more-53"></span><br />
338<img src="http://www.norm2782.com/wp-content/uploads/2009/01/cx300.jpeg" alt="cx300" title="cx300" width="300" height="300" class="alignnone size-full wp-image-60" /></p>
339]]></content:encoded>
340			<wfw:commentRss>http://www.norm2782.com/2009/01/new-in-ear-earphones/feed/</wfw:commentRss>
341		<slash:comments>0</slash:comments>
342		</item>
343		<item>
344		<title>Seven Things &#8211; Tagged by P�draic</title>
345		<link>http://www.norm2782.com/2009/01/seven-things-tagged-by-padraic/</link>
346		<comments>http://www.norm2782.com/2009/01/seven-things-tagged-by-padraic/#comments</comments>
347		<pubDate>Sat, 03 Jan 2009 10:14:38 +0000</pubDate>
348		<dc:creator>norm2782</dc:creator>
349				<category><![CDATA[Personal]]></category>
350
351		<guid isPermaLink="false">http://www.norm2782.com/?p=44</guid>
352		<description><![CDATA[Well, this was bound to happen: I got tagged by P�draic because I&#8217;m working on Zend_Feed_Reader with him. Luckily I&#8217;ve just setup this new blog, so here we go!
353Did you know that&#8230;
354
355Every bit of PHP I know is self-taught
356My programming adventure started out with Visual Basic 3 back in 1993. I was just 8 years [...]]]></description>
357			<content:encoded><![CDATA[<p>Well, this was bound to happen: I got tagged by <a href="http://blog.astrumfutura.com/">P�draic</a> because I&#8217;m working on <a href="http://framework.zend.com/code/browse/Zend_Framework/standard/incubator/library/Zend/Feed">Zend_Feed_Reader</a> with him. Luckily I&#8217;ve just setup this new blog, so here we go!</p>
358<p>Did you know that&#8230;</p>
359<ul>
360<li>Every bit of PHP I know is self-taught</li>
361<li>My programming adventure started out with Visual Basic 3 back in 1993. I was just 8 years old back then and had no clue what I was doing.</li>
362<li>My left foot is actually a few millimeter bigger than my right foot.</li>
363<li>I used to have long hair (almost reached my ass). I cut it off in the summer of &#8216;08 for various reasons, one of which was 100 euro.</li>
364<li>I bought my Harley Davidson before I even had my drivers license.</li>
365<li>My whisky collection (only single malts <img src='http://www.norm2782.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ) keeps growing instead of shrinking</li>
366<li>While I use a Mac, with an Apple Cinema Display and an Apple keyboard&#8230; I have an HTC Touch with Windows Mobile and I&#8217;m stuck with it for at least a few more months.</li>
367</ul>
368<p>Now it&#8217;s my turn to start tagging!</p>
369<ul>
370<li><a href="http://www.leftontheweb.com/weblog">Stefan Koopmanschap</a> &#8211; For not being tagged yet and having said so on Twitter</li>
371<li><a href="http://naneau.nl/">Maurice Fonk</a> &#8211; For being my co-worker and for not having finished <a href="http://madoqua.org/">Madoqua</a> yet</li>
372<li><a href="http://mirmodynamics.com/">Geoffrey Bachelet</a> &#8211; For the great party in Paris</li>
373<li><a href="http://wadearnold.com/blog/">Wade Arnold</a> &#8211; For doing a great job on Zend_AMF and having the same WordPress theme as me.</li>
374<li><a href="http://www.missyeh.nl/blog/">Kana Yeh</a> &#8211; For being the coolest PHP girl in the Netherlands (that I know of)</li>
375<li><a href="http://www.builtfromsource.com/">Matthew Ratzloff</a> &#8211; For his great help on Zend_Paginator</li>
376<li>And one more here&#8230;</li>
377</ul>
378<p>As for the rules:</p>
379<ul>
380<li>Link your original tagger(s), and list these rules on your blog.</li>
381<li>Share seven facts about yourself in the post &#8211; some random, some wierd.</li>
382<li>Tag seven people at the end of your post by leaving their names and the links to their blogs.</li>
383<li>Let them know they&#8217;ve been tagged by leaving a comment on their blogs and/or Twitter.</li>
384</ul>
385]]></content:encoded>
386			<wfw:commentRss>http://www.norm2782.com/2009/01/seven-things-tagged-by-padraic/feed/</wfw:commentRss>
387		<slash:comments>0</slash:comments>
388		</item>
389		<item>
390		<title>AMF Server class for WordPress</title>
391		<link>http://www.norm2782.com/2009/01/amf-server-class-for-wordpress/</link>
392		<comments>http://www.norm2782.com/2009/01/amf-server-class-for-wordpress/#comments</comments>
393		<pubDate>Fri, 02 Jan 2009 14:49:42 +0000</pubDate>
394		<dc:creator>norm2782</dc:creator>
395				<category><![CDATA[Flex]]></category>
396		<category><![CDATA[PHP]]></category>
397		<category><![CDATA[Zend Framework]]></category>
398
399		<guid isPermaLink="false">http://www.norm2782.com/?p=27</guid>
400		<description><![CDATA[After browsing through WordPress&#8217; code I quickly found that there&#8217;s no sane way to create AMF support as a WP plugin. At least not for someone who hasn&#8217;t done any old-skool procedural PHP in years. Instead of writing a plugin, I decided to write a standalone server script. It&#8217;s still very basic and currently setup [...]]]></description>
401			<content:encoded><![CDATA[<p>After browsing through WordPress&#8217; code I quickly found that there&#8217;s no sane way to create AMF support as a WP plugin. At least not for someone who hasn&#8217;t done any old-skool procedural PHP in years. Instead of writing a plugin, I decided to write a standalone server script. It&#8217;s still very basic and currently setup to work for me. To get it working for your WP setup you should probably make some minor modifications. Click the read more link to check out the code. I&#8217;ve released it under the generous BSD license, so knock yourself out! Use it at your own risk&#8230; I&#8217;m not going to support it. Any updates will be posted in this post. Also, please note that I haven&#8217;t tested it yet. If you access the script directly it should output &#8220;Zend Amf Endpoint&#8221; just fine, but that&#8217;s all I can guarantee at this point <img src='http://www.norm2782.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
402<p><span id="more-27"></span></p>
403<pre name="code" class="php:nogutter">
404&lt;?php
405/**
406 * Zend Framework (http://framework.zend.com/)
407 *
408 * @link      http://github.com/zendframework/zf2 for the canonical source repository
409 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
410 * @license   http://framework.zend.com/license/new-bsd New BSD License
411 * @package   Zend_Feed
412 */
413
414/**
415 * Set production mode.
416 * If set to false, exceptions will bubble through to the Flex frontend
417 *
418 * @var bool
419 */
420$production = false;
421
422/**
423 * Determine the absolute path of the AMF server
424 *
425 * @var string
426 */
427define('ABSPATH', dirname(__FILE__) . '/');
428
429/**
430 * One directory below docroot. Your config file and library dir should be here.
431 *
432 * @var string
433 */
434define('SUBPATH', dirname(ABSPATH));
435
436/**
437 * You should make sure Zend Framework is in your include path
438 */
439set_include_path(
440    implode(PATH_SEPARATOR, array(
441        SUBPATH . '/library',
442        get_include_path()
443    ))
444);
445
446/**
447 * Include the WordPress config file
448 */
449$configFile = SUBPATH . '/wp-config.php';
450
451if (!file_exists($configFile)) {
452    throw new Exception('WordPress config file was not found!');
453}
454
455require_once $configFile;
456
457/**
458 * No need to config more stuff from this point on
459 */
460
461/**
462 * @see Zend_Amf_Server
463 */
464require_once 'Zend/Amf/Server.php';
465
466/**
467 * @see Zend_Db_Adapter_Pdo_Mysql
468 */
469require_once 'Zend/Db/Adapter/Pdo/Mysql.php';
470
471/**
472 * @see Zend_Paginator
473 */
474require_once 'Zend/Paginator.php';
475
476/**
477 * @see Zend_Paginator_Adapter_DbSelect
478 */
479require_once 'Zend/Paginator/Adapter/DbSelect.php';
480
481/**
482 * Simple class to expose wordpress data through AMF
483 *
484 * @author norm2782
485 */
486class Wp_Amf_Gateway
487{
488    /**
489     * Database adapter
490     *
491     * @var Zend_Db_Adapter_Pdo_Mysql
492     */
493    private $_db = null;
494
495    /**
496     * WordPress table prefix
497     *
498     * @var string
499     */
500    private $_prefix = null;
501
502    /**
503     * Constructor
504     *
505     * @param array $dbConfig
506     * @param string $prefix
507     */
508    public function __construct(array $dbConfig, $prefix)
509    {
510        $this-&gt;_db = new Zend_Db_Adapter_Pdo_Mysql($dbConfig);
511        $this-&gt;_db-&gt;query('SET NAMES `utf8`');
512
513        $this-&gt;_prefix = $prefix;
514    }
515
516    /**
517     * Get paginated results for the provided query
518     *
519     * @param Zend_Db_Select $select
520     * @param int $page
521     * @param int $itemsPerPage
522     * @return array
523     */
524    private function _getPaginated(Zend_Db_Select $select, $page, $itemsPerPage)
525    {
526        $paginator = new Zend_Paginator(
527            new Zend_Paginator_Adapter_DbSelect($select)
528        );
529
530        $paginator-&gt;setCurrentPageNumber($page)
531                  -&gt;setItemCountPerPage($itemsPerPage);
532
533        return array(
534            'info'  =&gt; $paginator-&gt;getPages(),
535            'items' =&gt; $paginator-&gt;getCurrentItems()
536        );
537    }
538
539    /**
540     * Get the comments for the specified post ID
541     *
542     * @param int $postId
543     * @param int $page
544     * @param int $itemsPerPage
545     * @return array
546     */
547    public function getCommentsForPost($postId, $page = 1, $itemsPerPage = 10)
548    {
549        $select = $this-&gt;_db-&gt;select()-&gt;from($this-&gt;_prefix . 'comments')
550                                      -&gt;where('comment_post_ID = ?', $postId);
551
552        return $this-&gt;_getPaginated($select, $page, $itemsPerPage);
553    }
554
555    /**
556     * Get the meta data for the specified post ID
557     *
558     * @param $postId
559     * @return unknown_type
560     */
561    public function getMetaForPost($postId)
562    {
563        $select = $this-&gt;_db-&gt;select()-&gt;from($this-&gt;_prefix . 'postmeta')
564                                      -&gt;where('post_id = ?', $postId);
565
566        return $this-&gt;_db-&gt;fetchAll($select);
567    }
568
569    /**
570     * Get a post by specifying its ID
571     *
572     * @param int $postId
573     * @return array
574     */
575    public function getPost($postId)
576    {
577        $select = $this-&gt;_db-&gt;select()-&gt;from($this-&gt;_prefix . 'posts')
578                                      -&gt;where('ID = ?', $postId);
579
580        return $this-&gt;_db-&gt;fetchOne($select);
581    }
582
583    /**
584     * Get posts per page
585     *
586     * @param int $page
587     * @param int $itemsPerPage
588     * @return array
589     */
590    public function getPosts($page = 1, $itemsPerPage = 10)
591    {
592        $select = $this-&gt;_db-&gt;select()-&gt;from($this-&gt;_prefix . 'posts');
593
594        return $this-&gt;_getPaginated($select, $page, $itemsPerPage);
595    }
596}
597
598/**
599 * Pass the values from wp-config.php to the Wp_Amf_Gateway class.
600 */
601$gateway = new Wp_Amf_Gateway(
602    array(
603        'host'     =&gt; DB_HOST,
604        'username' =&gt; DB_USER,
605        'password' =&gt; DB_PASSWORD,
606        'dbname'   =&gt; DB_NAME
607    ),
608    $table_prefix
609);
610
611$server = new Zend_Amf_Server();
612$server-&gt;setProduction($production)
613       -&gt;setClass($gateway)
614       -&gt;handle();
615</pre>
616]]></content:encoded>
617			<wfw:commentRss>http://www.norm2782.com/2009/01/amf-server-class-for-wordpress/feed/</wfw:commentRss>
618		<slash:comments>0</slash:comments>
619		</item>
620		<item>
621		<title>Flex frontend</title>
622		<link>http://www.norm2782.com/2009/01/flex-frontend/</link>
623		<comments>http://www.norm2782.com/2009/01/flex-frontend/#comments</comments>
624		<pubDate>Thu, 01 Jan 2009 23:29:35 +0000</pubDate>
625		<dc:creator>norm2782</dc:creator>
626				<category><![CDATA[Flex]]></category>
627		<category><![CDATA[PHP]]></category>
628
629		<guid isPermaLink="false">http://www.norm2782.com/?p=22</guid>
630		<description><![CDATA[I was planning on writing a quick Flex frontend for this blog, but it appears WordPress only offers the posts themselves as RSS feed. If I get real bored (which I doubt,  unfortunately) I&#8217;ll have a look and see if I can create a Zend_AMF plugin for WordPress that allows me to retrieve virtually [...]]]></description>
631			<content:encoded><![CDATA[<p>I was planning on writing a quick Flex frontend for this blog, but it appears WordPress only offers the posts themselves as RSS feed. If I get real bored (which I doubt,  unfortunately) I&#8217;ll have a look and see if I can create a Zend_AMF plugin for WordPress that allows me to retrieve virtually all data from my WordPress install. Would be cool <img src='http://www.norm2782.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
632]]></content:encoded>
633			<wfw:commentRss>http://www.norm2782.com/2009/01/flex-frontend/feed/</wfw:commentRss>
634		<slash:comments>0</slash:comments>
635		</item>
636		<item>
637		<title>Properties in PHP</title>
638		<link>http://www.norm2782.com/2009/01/properties-in-php/</link>
639		<comments>http://www.norm2782.com/2009/01/properties-in-php/#comments</comments>
640		<pubDate>Thu, 01 Jan 2009 23:02:54 +0000</pubDate>
641		<dc:creator>norm2782</dc:creator>
642				<category><![CDATA[Daydreaming]]></category>
643		<category><![CDATA[PHP]]></category>
644
645		<guid isPermaLink="false">http://www.norm2782.com/?p=8</guid>
646		<description><![CDATA[A while ago Dynom from #php_bnl pointed me to an interesting entry on the PHP 5.3 wiki page. In the &#8220;Future PHP releases&#8221; sections there&#8217;s an entry called &#8220;29. �real� properties with attached getters and setters&#8221;. Personally I can&#8217;t wait for this. Hopefully it will look something like ActionScript 3&#8217;s properties:
647
648&#60;?php
649class Bar
650{
651    [...]]]></description>
652			<content:encoded><![CDATA[<p>A while ago Dynom from #php_bnl pointed me to an interesting entry on the <a title="PHP 5.3 wiki page" href="http://wiki.php.net/todo/php53">PHP 5.3 wiki page</a>. In the &#8220;Future PHP releases&#8221; sections there&#8217;s an entry called &#8220;29. �real� properties with attached getters and setters&#8221;. Personally I can&#8217;t wait for this. Hopefully it will look something like ActionScript 3&#8217;s properties:</p>
653<pre name="code" class="php:nogutter">
654&lt;?php
655class Bar
656{
657    private $_foo = 'foo';
658
659    public function get foo()
660    {
661        return $this->_foo;
662    }
663
664    public function set foo($fooString)
665    {
666        $this->_foo = $fooString;
667    }
668}
669
670$bar = new Bar();
671$bar->foo = 'baz';
672echo $bar->foo; // prints baz
673</pre>
674]]></content:encoded>
675			<wfw:commentRss>http://www.norm2782.com/2009/01/properties-in-php/feed/</wfw:commentRss>
676		<slash:comments>0</slash:comments>
677		</item>
678	</channel>
679</rss>