<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5721355636181981292</id><updated>2011-11-28T00:27:14.313+01:00</updated><category term='xml'/><category term='obfuscation'/><category term='oss'/><category term='stored procedures'/><category term='dom'/><category term='pov'/><category term='mysql'/><category term='php'/><category term='static'/><category term='smalltalk'/><category term='programming'/><category term='mixin'/><category term='simplicity php framework'/><category term='eval'/><category term='interoperability'/><category term='eval is evil'/><category term='oop'/><category term='wtf'/><category term='antipattern'/><category term='simplexml'/><category term='phpism'/><category term='observer'/><category term='scraping'/><category term='namespaces'/><category term='mpl'/><category term='namespace'/><category term='xpath'/><category term='guestbook'/><category term='xyster'/><category term='aprils fool'/><category term='traits'/><category term='fun'/><category term='framework'/><category term='closures'/><category term='rant'/><category term='py-notify'/><category term='google'/><title type='text'>dispel magic</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://dispelmagic.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5721355636181981292/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://dispelmagic.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>elias</name><uri>http://www.blogger.com/profile/03352023807135754785</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5721355636181981292.post-4819188332118496701</id><published>2008-08-04T12:49:00.003+02:00</published><updated>2008-08-04T12:59:47.656+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oss'/><category scheme='http://www.blogger.com/atom/ns#' term='mpl'/><category scheme='http://www.blogger.com/atom/ns#' term='google'/><category scheme='http://www.blogger.com/atom/ns#' term='wtf'/><title type='text'>google vs. democracy</title><content type='html'>maybe my last blogpost here :) google tries to overthrow democracy by &lt;a href="http://www.linuxtoday.com/news_story.php3?ltsn=2008-08-01-012-35-NW"&gt;banning MPL from google code&lt;/a&gt;. is the open source license jungle proliferation or variety?&lt;a href="http://dict.leo.org/ende?lp=ende&amp;amp;p=thMx..&amp;amp;search=variety"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5721355636181981292-4819188332118496701?l=dispelmagic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dispelmagic.blogspot.com/feeds/4819188332118496701/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5721355636181981292&amp;postID=4819188332118496701' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5721355636181981292/posts/default/4819188332118496701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5721355636181981292/posts/default/4819188332118496701'/><link rel='alternate' type='text/html' href='http://dispelmagic.blogspot.com/2008/08/google-vs-democracy.html' title='google vs. democracy'/><author><name>elias</name><uri>http://www.blogger.com/profile/03352023807135754785</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5721355636181981292.post-7732159772875756928</id><published>2008-07-16T15:39:00.013+02:00</published><updated>2008-07-16T19:32:50.239+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rant'/><category scheme='http://www.blogger.com/atom/ns#' term='closures'/><category scheme='http://www.blogger.com/atom/ns#' term='static'/><category scheme='http://www.blogger.com/atom/ns#' term='phpism'/><category scheme='http://www.blogger.com/atom/ns#' term='namespaces'/><category scheme='http://www.blogger.com/atom/ns#' term='wtf'/><category scheme='http://www.blogger.com/atom/ns#' term='oop'/><title type='text'>static classes</title><content type='html'>There is a proposal for&lt;a href="http://wiki.php.net/rfc/static-classes"&gt; static classes&lt;/a&gt; in the official php wiki. Interesting? Yes, in some way, but in no way that i like. If you are one of the code monkeys that discovered object oriented programming in some depth, you probably dislike &lt;span style="font-style: italic;"&gt;static&lt;/span&gt; like me. If not, my further explanation may give you a clue.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Static is evil&lt;/span&gt;. Not enough explanation? Ok.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Static is evil because it exists.&lt;/span&gt; Still not enough?&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Static is evil because it has been invented.&lt;/span&gt; *grmbl* I'll try the long route...&lt;br /&gt;&lt;br /&gt;Let us start with the abbreviation OOP. The words Object Oriented Programming &lt;span&gt;gives me the feeling that it has to do with objects. And objects are instantiated from classes. But the evil &lt;span style="font-style: italic;"&gt;static&lt;/span&gt; declared stuff don't do anything to objects, it just belongs to the class and not the instance. (Ok, in PHP it's not exactly like that but it's the way it should be.)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;So does all the static stuff has anything to do with OOP? Uhm, no. Can we make it more OOP? &lt;span style="font-style: italic;"&gt;"We could make interfaces for static classes available! It's totally OOP!"&lt;/span&gt;  Yes it's OOP, but it won't help. Why create an interface based static class if you can't replace it with another implementation? That's the idea of interfaces! &lt;span style="font-style: italic;"&gt;"We can replace a class by an namespace import? Or we can call_user_func() all the time?" &lt;/span&gt;Oh, please! We have all this already with objects! Interfaces are useless for static classes. We can mimic abstract and singleton behaviour - for it's rare uses - in userland.&lt;br /&gt;&lt;br /&gt;Static only exists to make old-school procedural programmers feel nice. You don't really need it in OOP and you don't need a even more complex static magic on earth. Actually all the static stuff could be thrown away with &lt;a href="http://www.php.net/manual/en/language.namespaces.php"&gt;namespaces&lt;/a&gt; and &lt;a href="http://wiki.php.net/rfc/closures"&gt;closures for regular functions&lt;/a&gt;. Can you &lt;a href="http://python.org/"&gt;imagine&lt;/a&gt;?&lt;br /&gt;&lt;br /&gt;Don't get me wrong, i use static methods sometimes and i love functions. But static classes would be a change in the wrong place.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5721355636181981292-7732159772875756928?l=dispelmagic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dispelmagic.blogspot.com/feeds/7732159772875756928/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5721355636181981292&amp;postID=7732159772875756928' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5721355636181981292/posts/default/7732159772875756928'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5721355636181981292/posts/default/7732159772875756928'/><link rel='alternate' type='text/html' href='http://dispelmagic.blogspot.com/2008/07/static-classes.html' title='static classes'/><author><name>elias</name><uri>http://www.blogger.com/profile/03352023807135754785</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5721355636181981292.post-5597732992010196631</id><published>2008-06-27T20:08:00.004+02:00</published><updated>2008-06-27T21:04:30.203+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='py-notify'/><category scheme='http://www.blogger.com/atom/ns#' term='phpism'/><category scheme='http://www.blogger.com/atom/ns#' term='observer'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>An unorthodox implementation of Observer pattern</title><content type='html'>This is how &lt;a href="http://pypi.python.org/pypi/py-notify/0.2.0"&gt;py-notify&lt;/a&gt; describes itself. And it really is. Most observer implementations I've seen look almost like the good old Observer Pattern from GoF. Although it does the job, it could achieve more loose &lt;a href="http://en.wikipedia.org/wiki/Coupling_%28computer_science%29"&gt;coupling&lt;/a&gt; with some changes. The unorthodox in py-notify is that the events (signals) are not typed. You don't need to pass constants like 'onSomeEvent' around or more worse event objects (but you &lt;span style="font-style: italic;"&gt;can&lt;/span&gt; do both). Also unorthodox is that you don't need any interfaces for the observers since it's possible to register every method or function. This makes the implementation less verbose and type safe, but much more flexible and easier to implement.&lt;br /&gt;Py-notify has much more to offer on top of the signals concept, but I'm currently only interested in the pure observer concept and partially ported it to php. &lt;a href="http://ekans.svn.sourceforge.net/viewvc/ekans/trunk/lib/ekans/ekn/Signal.php?view=markup"&gt;code&lt;/a&gt;/&lt;a href="http://ekans.svn.sourceforge.net/viewvc/ekans/trunk/examples/signal/"&gt;examples&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here is an simple Observer example:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;class Observer {&lt;br /&gt; function notify($msg) {&lt;br /&gt;  echo "Subject says: $msg\n";&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class Subject {&lt;br /&gt; /**&lt;br /&gt;  * @var ekn_Signal&lt;br /&gt;  */&lt;br /&gt; protected $signal;&lt;br /&gt; &lt;br /&gt; function __construct() {&lt;br /&gt;  $this-&gt;signal = new ekn_Signal();&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; function addObserver($observer, $method = 'notify') {&lt;br /&gt;  $this-&gt;signal-&gt;connect(array($observer, $method));&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; function saySomething() {&lt;br /&gt;  $this-&gt;signal-&gt;emit('something');&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;$subject = new Subject();&lt;br /&gt;$subject-&gt;addObserver(new Observer());&lt;br /&gt;$subject-&gt;saySomething();&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5721355636181981292-5597732992010196631?l=dispelmagic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dispelmagic.blogspot.com/feeds/5597732992010196631/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5721355636181981292&amp;postID=5597732992010196631' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5721355636181981292/posts/default/5597732992010196631'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5721355636181981292/posts/default/5597732992010196631'/><link rel='alternate' type='text/html' href='http://dispelmagic.blogspot.com/2008/06/unorthodox-implementation-of-observer.html' title='An unorthodox implementation of Observer pattern'/><author><name>elias</name><uri>http://www.blogger.com/profile/03352023807135754785</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5721355636181981292.post-3420916482128971624</id><published>2008-06-27T19:04:00.005+02:00</published><updated>2008-06-27T19:28:36.576+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='fun'/><category scheme='http://www.blogger.com/atom/ns#' term='guestbook'/><category scheme='http://www.blogger.com/atom/ns#' term='obfuscation'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>gbook help, plz^^</title><content type='html'>&lt;span style="font-size:130%;"&gt;i'm new to php but i'll make a gbook!!!&lt;br /&gt;&lt;br /&gt;i have code!!&lt;br /&gt;&lt;br /&gt;but i'm scripting for hourz now and i can't find errorz in my scriptz!!&lt;br /&gt;&lt;br /&gt;help plz!!&lt;br /&gt;&lt;br /&gt;herez my code^^&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$_=reset(get_defined_functions());$i='&amp;gt;&amp;lt;input';&lt;br /&gt;$_[242]("&amp;lt;form$i name=$i type=submit&amp;gt;")&amp;&amp;$a?$_&lt;br /&gt;[459](8,$a."\n",8):8;$_[242]($_[230]('&amp;lt;li&amp;gt;',$_[&lt;br /&gt;457     ]     (      8      )     )     )     ;&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5721355636181981292-3420916482128971624?l=dispelmagic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dispelmagic.blogspot.com/feeds/3420916482128971624/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5721355636181981292&amp;postID=3420916482128971624' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5721355636181981292/posts/default/3420916482128971624'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5721355636181981292/posts/default/3420916482128971624'/><link rel='alternate' type='text/html' href='http://dispelmagic.blogspot.com/2008/06/gbook-help-plz.html' title='gbook help, plz^^'/><author><name>elias</name><uri>http://www.blogger.com/profile/03352023807135754785</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5721355636181981292.post-560384517469632446</id><published>2008-06-06T15:19:00.002+02:00</published><updated>2008-06-06T15:29:09.089+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='stored procedures'/><category scheme='http://www.blogger.com/atom/ns#' term='rant'/><category scheme='http://www.blogger.com/atom/ns#' term='pov'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='wtf'/><title type='text'>mysql stored procedures point of view</title><content type='html'>Stored procedures in mysql totally suck! The syntax is far behind any usability, debugging is impossible, error messages are meaningless. Using result sets? A joke! And if you created a procedure after hours it's likely that it don't work.&lt;br /&gt;&lt;br /&gt;I think a stored procedure in mysql is thinking this:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;Darkness imprisoning me&lt;br /&gt;All that I see&lt;br /&gt;Absolute horror&lt;br /&gt;I cannot live&lt;br /&gt;I cannot die&lt;br /&gt;Trapped in myself&lt;br /&gt;Body my holding cell&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;font-size:78%;" &gt;Metallica, One&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5721355636181981292-560384517469632446?l=dispelmagic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dispelmagic.blogspot.com/feeds/560384517469632446/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5721355636181981292&amp;postID=560384517469632446' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5721355636181981292/posts/default/560384517469632446'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5721355636181981292/posts/default/560384517469632446'/><link rel='alternate' type='text/html' href='http://dispelmagic.blogspot.com/2008/06/mysql-stored-procedures-point-of-view.html' title='mysql stored procedures point of view'/><author><name>elias</name><uri>http://www.blogger.com/profile/03352023807135754785</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5721355636181981292.post-1972267728397996736</id><published>2008-03-12T13:34:00.003+01:00</published><updated>2008-03-12T13:37:21.647+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='aprils fool'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='wtf'/><title type='text'>Early Aprils Fool?</title><content type='html'>Real &lt;a href="http://www.phpguru.org/article.php/225"&gt;gurus&lt;/a&gt; write &lt;a href="http://www.phpguru.org/downloads/registry/"&gt;simple code&lt;/a&gt;. Thanks universe!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5721355636181981292-1972267728397996736?l=dispelmagic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dispelmagic.blogspot.com/feeds/1972267728397996736/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5721355636181981292&amp;postID=1972267728397996736' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5721355636181981292/posts/default/1972267728397996736'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5721355636181981292/posts/default/1972267728397996736'/><link rel='alternate' type='text/html' href='http://dispelmagic.blogspot.com/2008/03/early-aprils-fool.html' title='Early Aprils Fool?'/><author><name>elias</name><uri>http://www.blogger.com/profile/03352023807135754785</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5721355636181981292.post-450393437960377513</id><published>2008-03-07T20:42:00.003+01:00</published><updated>2008-03-07T21:05:26.479+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='smalltalk'/><category scheme='http://www.blogger.com/atom/ns#' term='phpism'/><category scheme='http://www.blogger.com/atom/ns#' term='mixin'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='traits'/><title type='text'>needful things - traits</title><content type='html'>Via &lt;a href="http://pooteeweet.org/blog/0/1006#m1006"&gt;lukas post&lt;/a&gt; i figured out that there is an &lt;a href="http://www.stefan-marr.de/rfc-traits-for-php.txt"&gt;traits proposal&lt;/a&gt; for php. Read more about &lt;a href="http://en.wikipedia.org/wiki/Trait_%28abstract_type%29"&gt;traits&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;If you get into it, you'll see traits could be a kick ass feature! This needs more attention, so share with your nerd-friends!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5721355636181981292-450393437960377513?l=dispelmagic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dispelmagic.blogspot.com/feeds/450393437960377513/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5721355636181981292&amp;postID=450393437960377513' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5721355636181981292/posts/default/450393437960377513'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5721355636181981292/posts/default/450393437960377513'/><link rel='alternate' type='text/html' href='http://dispelmagic.blogspot.com/2008/03/needful-things-traits.html' title='needful things - traits'/><author><name>elias</name><uri>http://www.blogger.com/profile/03352023807135754785</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5721355636181981292.post-5114301225199497113</id><published>2008-03-07T19:27:00.003+01:00</published><updated>2008-06-27T19:30:32.760+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='dom'/><category scheme='http://www.blogger.com/atom/ns#' term='scraping'/><category scheme='http://www.blogger.com/atom/ns#' term='namespace'/><category scheme='http://www.blogger.com/atom/ns#' term='xpath'/><category scheme='http://www.blogger.com/atom/ns#' term='xml'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='simplexml'/><title type='text'>PHP and SimpleXML namespaces</title><content type='html'>Last days i did some &lt;a href="http://en.wikipedia.org/wiki/Screen_scraping"&gt;web scraping&lt;/a&gt; with PHP and decided to use &lt;a href="http://php.net/simplexml"&gt;simplexml&lt;/a&gt;'s &lt;a href="http://de3.php.net/manual/en/function.simplexml-element-xpath.php"&gt;xpath&lt;/a&gt; feature to get it done. But the xpath stuff caused massive headache. The problem: I wasn't able to execute &lt;em&gt;any&lt;/em&gt; xpath expression on the simplexml document. Not any! Because i had no idea what the problem is, i googled a little bit and found some hints. The xpath engine need to know about namespaces (&lt;a href="http://de3.php.net/manual/en/function.simplexml-element-registerXPathNamespace.php"&gt;registerXPathNamespace to the help&lt;/a&gt;) and isn't able to &lt;a href="http://jetlogs.org/2007/10/03/php-simplexml-xpaths-and-namespaces/"&gt;use default namespace&lt;/a&gt;.&lt;br /&gt;So what went wrong? As a orderly guy i've used &lt;a href="http://php.net/tidy"&gt;tidy&lt;/a&gt; to make the maybe not well formed xhtml document parseable for simplexml. Of course i've exported xhtml with tidy and pedantic tidy added namespaces in this case.&lt;br /&gt;Obviously the solution was simply to use tidy with &lt;code&gt;output-html&lt;/code&gt; instead of &lt;code&gt;output-xhtml&lt;/code&gt; option.&lt;br /&gt;&lt;br /&gt;I probably never encountered this problem if i've used this little workaround with &lt;a href="http://de3.php.net/manual/en/function.dom-domdocument-loadhtml.php"&gt;domxml::loadHTML&lt;/a&gt;:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$dom = DOMDocument::loadHTML($html);&lt;br /&gt;$page = simplexml_import_dom($dom);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;I guess the dom function will fix most common issues with broken html.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5721355636181981292-5114301225199497113?l=dispelmagic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dispelmagic.blogspot.com/feeds/5114301225199497113/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5721355636181981292&amp;postID=5114301225199497113' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5721355636181981292/posts/default/5114301225199497113'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5721355636181981292/posts/default/5114301225199497113'/><link rel='alternate' type='text/html' href='http://dispelmagic.blogspot.com/2008/03/php-and-simplexml-namespaces.html' title='PHP and SimpleXML namespaces'/><author><name>elias</name><uri>http://www.blogger.com/profile/03352023807135754785</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5721355636181981292.post-6020671371371327250</id><published>2008-02-29T19:29:00.005+01:00</published><updated>2008-06-27T19:30:00.071+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='eval is evil'/><category scheme='http://www.blogger.com/atom/ns#' term='wtf'/><category scheme='http://www.blogger.com/atom/ns#' term='eval'/><category scheme='http://www.blogger.com/atom/ns#' term='simplicity php framework'/><title type='text'>eval is still evil</title><content type='html'>Here is an interesting &lt;a href="http://wiki.simplicityphp.com/browser/trunk/simplicity/core/registry/registry.php#L102"&gt;code snippet&lt;/a&gt; from the &lt;a href="http://wiki.simplicityphp.com/"&gt;simplicity php framework&lt;/a&gt;:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;//...&lt;br /&gt;static public function check($path=false) {&lt;br /&gt; if (!self::loadFiles($path)) return false;&lt;br /&gt; &lt;br /&gt; $arr = "";&lt;br /&gt; $apath = explode('.',$path);&lt;br /&gt; foreach ($apath as $pt) {&lt;br /&gt;  $arr .= "['{$pt}']";   &lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; $var = 'self::$_settings'.$arr;&lt;br /&gt; $eval = "return isset({$var}) ? true : false;";&lt;br /&gt; return eval($eval);&lt;br /&gt;}&lt;br /&gt;//...&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;What happens? This code traverses through an multidimensional array with N dimensions.&lt;br /&gt;Yes, recursion is sometimes tedious. But if i can avoid an eval call, i avoid it! The solution without eval is not longer and not much harder to understand and written in nearly the same time:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$data['foo']['baz']['wtf'] = 'whupass';&lt;br /&gt;$path = 'foo.baz.wtf';&lt;br /&gt;&lt;br /&gt;$p = explode('.', $path);&lt;br /&gt;$value = $data;&lt;br /&gt;while ($k = array_shift($p)) {&lt;br /&gt;  $value = $value[$k];&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;echo "$value\n";&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Cute, isn't it?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5721355636181981292-6020671371371327250?l=dispelmagic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dispelmagic.blogspot.com/feeds/6020671371371327250/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5721355636181981292&amp;postID=6020671371371327250' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5721355636181981292/posts/default/6020671371371327250'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5721355636181981292/posts/default/6020671371371327250'/><link rel='alternate' type='text/html' href='http://dispelmagic.blogspot.com/2008/02/eval-is-still-evil.html' title='eval is still evil'/><author><name>elias</name><uri>http://www.blogger.com/profile/03352023807135754785</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5721355636181981292.post-8624149989912914678</id><published>2008-02-29T17:44:00.001+01:00</published><updated>2008-02-29T18:22:59.126+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rant'/><category scheme='http://www.blogger.com/atom/ns#' term='antipattern'/><category scheme='http://www.blogger.com/atom/ns#' term='interoperability'/><category scheme='http://www.blogger.com/atom/ns#' term='xyster'/><category scheme='http://www.blogger.com/atom/ns#' term='phpism'/><category scheme='http://www.blogger.com/atom/ns#' term='framework'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>deconstructing xyster</title><content type='html'>I've stumpled across a new framework called &lt;a href="http://xyster.devweblog.org/"&gt;xyster&lt;/a&gt; and it's not surprising that behind the &lt;span style="font-style: italic;"&gt;fancy&lt;/span&gt; web 2.0 website is lurking something evil.&lt;br /&gt;Xyster is an extension to &lt;a href="http://framework.zend.com/"&gt;Zend Framework&lt;/a&gt; and extends ACL, MVC with some features and uses the Database Layer for an ORM package. So what is the evil in xyster? Evil is the &lt;a href="http://xyster.devweblog.org/documentation/guide/xyster.collection.html"&gt;Xyster_Collection&lt;/a&gt; package. Everyone who knows Java's collection mess. Everyone who envied languages with object oriented array's. Will have some (good or bad) emotion now. But this is not the point. The points are interoperability and simplicity. It isn't easy nor fun to convert from/to collection &lt;span style="font-style: italic;"&gt;Foo,&lt;/span&gt; again and again. Indeed, in Java this is common, but Java sucks exactly for this reason (and some others)! PHP does better, just hand over some native array's that work everywhere. And if you really need a fancy collection-like-something, create an highly specialized version and integrate it in the specific domain.&lt;br /&gt;&lt;br /&gt;There is one small chance to create a collection framework for PHP that is interoperable. Write an &lt;a href="http://en.wikipedia.org/wiki/Request_for_Comments"&gt;RFC&lt;/a&gt;. Write an &lt;a href="http://pecl.php.net/"&gt;native extension&lt;/a&gt;. Start an &lt;a href="http://www.petitiononline.com/"&gt;petition&lt;/a&gt;. Pray. An don't forget to &lt;a href="http://en.wikipedia.org/wiki/Euphemism#Euphemisms_for_death"&gt;become a landowner&lt;/a&gt;, in case &lt;a href="http://lerdorf.com/bio.php"&gt;rasmus&lt;/a&gt; comes around and kills you with a &lt;a href="http://en.wikipedia.org/wiki/Roundhouse_kick"&gt;roundhouse kick&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;This fact would be a great disadvantage, if i had a need for xyster (or any other framework with the same flaws).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5721355636181981292-8624149989912914678?l=dispelmagic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dispelmagic.blogspot.com/feeds/8624149989912914678/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5721355636181981292&amp;postID=8624149989912914678' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5721355636181981292/posts/default/8624149989912914678'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5721355636181981292/posts/default/8624149989912914678'/><link rel='alternate' type='text/html' href='http://dispelmagic.blogspot.com/2008/02/deconstructing-xyster.html' title='deconstructing xyster'/><author><name>elias</name><uri>http://www.blogger.com/profile/03352023807135754785</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry></feed>
