<?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>Matt_ptr * &#187; Rant</title>
	<atom:link href="http://mattptr.net/category/rant/feed/" rel="self" type="application/rss+xml" />
	<link>http://mattptr.net</link>
	<description>Programming and stuff -- incoherent and unfocused since 1997</description>
	<lastBuildDate>Tue, 31 Jan 2012 16:39:07 +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>More PHP ORM disappointment</title>
		<link>http://mattptr.net/2012/01/31/more-php-orm-disappointment/</link>
		<comments>http://mattptr.net/2012/01/31/more-php-orm-disappointment/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 16:39:07 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Rant]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php orm]]></category>
		<category><![CDATA[phpActiveRecord]]></category>

		<guid isPermaLink="false">http://mattptr.net/?p=255</guid>
		<description><![CDATA[OK, so I know I&#8217;ve been beaten this horse to a pulp. But today it reared its ugly head again. The ORM in this case is phpActiveRecord. I had used this in other projects and had a generally positive experience, so I thought it would be a decent fit for this quick little user registration [...]]]></description>
			<content:encoded><![CDATA[<p>OK, so I know I&#8217;ve been beaten this horse to a pulp. But today it reared its ugly head again.</p>
<p>The ORM in this case is <a href="http://www.phpactiverecord.org">phpActiveRecord</a>. I had used this in other projects and had a generally positive experience, so I thought it would be a decent fit for this quick little user registration database I had to set up.</p>
<p>Of course, I had neglected to check whether or not phpActiveRecord worked with PostgreSQL. Silly me, when I looked at <a href="http://www.phpactiverecord.org/projects/main/wiki/Configuration__Setup">this page</a> and saw &#8216;pgsql&#8217; in a DSN, and when I read that PDO is used for the backend &#8212; which provides a decent API for the library to use &#8212; I assumed that I would be safe.</p>
<p>In short terms, no. In longer terms, fuck no.</p>
<p>There&#8217;s an error, apparently in all versions that I could find, in the <a href="https://github.com/kla/php-activerecord/blob/master/lib/adapters/PgsqlAdapter.php">pgsql adapter</a>. I guess there were some <a href="https://github.com/kla/php-activerecord/pull/142">attempts to fix it</a>, but it remains uncommitted to the main branch, despite being a year old.</p>
<p>So good-bye to phpActiveRecord. It was fun, that one time when I used you and you worked correctly. You can now join the wall of shame with lack of PostgresQL support along with WordPress and Drupal. (Yes, I know Drupal core has at least partial support, but modules may not necessarily support pgsql &#8212; which could have been avoided with a decent ORM).</p>
<p>The saga continues&#8230; sigh&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://mattptr.net/2012/01/31/more-php-orm-disappointment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Another disappointing Python web framework</title>
		<link>http://mattptr.net/2012/01/16/another-disappointing-python-web-framework/</link>
		<comments>http://mattptr.net/2012/01/16/another-disappointing-python-web-framework/#comments</comments>
		<pubDate>Mon, 16 Jan 2012 21:53:49 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Rant]]></category>
		<category><![CDATA[Web Apps]]></category>
		<category><![CDATA[circuits]]></category>
		<category><![CDATA[circuits.web]]></category>
		<category><![CDATA[i'm frustrated]]></category>

		<guid isPermaLink="false">http://mattptr.net/?p=253</guid>
		<description><![CDATA[I&#8217;ve always liked CherryPy. I thought its routing method was a very novel take on the application routing problem. But I never used it too much because it was too loosely coupled for my purposes at the time. Fast forward to a few weeks ago when I hear about circuits.web, part of the circuits framework. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always liked <a href="http://www.cherrypy.org">CherryPy</a>. I thought its routing method was a very novel take on the application routing problem. But I never used it too much because it was too loosely coupled for my purposes at the time.</p>
<p>Fast forward to a few weeks ago when I hear about <a href="http://pypi.python.org/pypi/circuits">circuits.web</a>, part of the circuits framework. Event driven, modeled after CherryPy, asynchronous, web-socket support, and loosely coupled &#8212; which I need this time.</p>
<p>I&#8217;ve spent the better part of three weeks working with circuits.web, and I can say it&#8217;s been a resounding disappointment.</p>
<p>First of all, documentation is non-existent. And when I say non-existent, I mean non-existent. The core circuits framework is poorly documented <em>at best.</em> The circuits.web component isn&#8217;t documented at all. The closest thing to documentation is a collection of asinine examples that have almost no merit for real life applications, if they even work at all.</p>
<p>Second, I can&#8217;t exactly tell if the project is still being worked on. When I first started, I naively looked at the dates on the recent commits to the whole circuits project. The circuits.web portion hasn&#8217;t been committed to since August. WebSockets were made a candidate recommendation in December. Nothing in circuit.web&#8217;s implementation needs to be changed? That makes me suspicious.</p>
<p>Lastly, the Component architecture seemed like a good idea, but it seems to be thrown together in no logical way. Case in point?</p>
<p>Components handle events. Controllers inherit from Components. Controllers can&#8217;t handle events. Or if they can, I couldn&#8217;t figure out a way. Who knows why &#8212; there&#8217;s no documentation.</p>
<p>I was trying to create an Authentication component for an admin controller. There are of course, no examples of this. The authentication examples &#8212; that is the ACL, HTTP Auth, and HTTP Auth using /etc/passwd &#8212; all use an authentication scheme that is site wide.</p>
<p>What I needed was a way to pick specific actions that would require authorization. I figured out a way by accident, and within 3 seconds found a way around it due to the &#8220;channel&#8221; member of the Controller.</p>
<p>The channel in circuits.web, I assume, specifies the routing for the dispatcher to find the object. So your Admin Controller object might have a channel of &#8220;/admin&#8221;. The problem I found, using a Component for forcing authentication, I could bypass the Auth Component by going to, &#8220;http://localhost/admin<strong>/</strong>&#8220;. Note the trailing slash.</p>
<p>Change the channel to &#8220;/admin/&#8221; or &#8220;admin&#8221; and get a 404 on all admin actions &#8212; but the auth component works.</p>
<p>And that&#8217;s where I&#8217;m at. I should have went with CherryPy on this project, but no, I guess I felt like being disappointed by Python web frameworks again.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattptr.net/2012/01/16/another-disappointing-python-web-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Am I nuts?</title>
		<link>http://mattptr.net/2009/10/26/am-i-nuts/</link>
		<comments>http://mattptr.net/2009/10/26/am-i-nuts/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 20:21:20 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rant]]></category>
		<category><![CDATA[Thoughts]]></category>
		<category><![CDATA[die irc]]></category>
		<category><![CDATA[irc]]></category>
		<category><![CDATA[rfc1459]]></category>

		<guid isPermaLink="false">http://mattptr.net/?p=125</guid>
		<description><![CDATA[I&#8217;m starting to think I&#8217;m a masochist. Examine the evidence: I&#8217;ve been in 2 serious relationships with crazy (and I do mean crazy) girls &#8212; both ended crappily. I still hand wind my guitar strings. I&#8217;ve worked with PHP since version 3 and I&#8217;ve had a job doing it for 5 years. I actually gave [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m starting to think I&#8217;m a masochist. Examine the evidence:</p>
<ul>
<li>I&#8217;ve been in 2 serious relationships with crazy (and I do mean crazy) girls &#8212; both ended crappily.</li>
<li>I still hand wind my guitar strings.</li>
<li>I&#8217;ve worked with PHP since version 3 and I&#8217;ve had a job doing it for 5 years. I actually gave up a job doing embedded systems with C to keep doing PHP work.</li>
<li>I keep thinking I want to learn Erlang.</li>
<li>Lastly, and I think this is the big one, despite the fact that I&#8217;ve worked on no less than 3 failed IRC clients &#8212; I started working on an IRC bot project.</li>
</ul>
<p><span id="more-125"></span></p>
<p>If you didn&#8217;t know, IRC was invented in 1793 by the world-renouned horrible person, the Marquis De Sade. He was so horrible, in fact, that the term <em>sadism</em> comes from his name. The work I&#8217;m referring to is <a href="http://www.faqs.org/rfcs/rfc1459.html">RFC1459</a> &#8212; arguably his most notorious and mind-boggling work. RFC1459 is part of the reason some people consider De Sade to be the devil incarnate.</p>
<p>RFC1459 was so bad that the IETF has refused to standardize it. An attempt was made in 2000 to update it with RFCs 2810, 2811, <a href="http://irchelp.org/irchelp/rfc/rfc2812.txt">2812</a>, and 2813. After reading all of them, I can&#8217;t really tell what was updated. It&#8217;s more like someone took the original document of unholy sin and smeared it across 4 others. And even after this act of moral indecency, it&#8217;s still not standardized. It&#8217;s not helped by the fact that the &#8220;updates&#8221; <strong>weren&#8217;t even supposed to be considered a new standard </strong>and also pretty much every IRCd and client does whatever the hell they want.</p>
<p>Here are some things I really, really hate about IRC. I mean other than it being a complete total stab in the groin&#8230;</p>
<p><strong>Ident </strong><br />
Does anyone actually have an actual ident daemon running? And does it actually help anything? It&#8217;s pretty much a useless addition &#8212; and why it&#8217;s mentioned in the IRC protocol (and by protocol, I mean random suggestions) I could only speculate.</p>
<p><strong>Mode strings</strong><br />
This is probably the worst abomination of the entire spec (and by spec I mean loose collection of internet bowel movements).  So there are user modes and channels modes. A mode character can have parameters or not and a mode string can consist of any of the mode characters or a bunch of them. Because of that, you end up with this kind of crap:</p>
<p>MODE #liek :+om-v+b nick1 nick2 *.aol.com</p>
<p>Which sets nick1 as an operator, sets the channel to moderated, takes voice away from nick2, and bans aol users from the channel. Look at sections 3.1.5 and 3.2.3 in RFC2812 for some more awful ideas.  If you think parsing that is not so bad, then you should know that not every IRC-network is going to have the same modes. And to figure out what modes a channel might have&#8230;</p>
<p><strong>005<br />
</strong>RFC2812 says that numeric reply 005 is, &#8220;Sent by the server to a user to suggest an alternative server.&#8221; It&#8217;s just not true at all. In all my years of working with IRC, I&#8217;ve never seen 005 used in this capacity.</p>
<p>005 is used for relaying the server configuration to the client. This is a <a href="http://www.irc.org/tech_docs/005.html">separate, 5-year old document</a> that explains the ISUPPORT reply. Of course, it&#8217;s not official or anything. It&#8217;s not even really called ISUPPORT. The page I linked to at least tells you what IRCds are doing what. Keeping track of all that configuration info is unbelievably tedious.</p>
<p><strong>NAMES</strong><br />
Channels on IRC are usually small, but on the off-chance that you find yourself in a warez channel, you&#8217;ll be in a sea of people. When you join in the chat, the server will send you the list of other chatters, which can take quite a while depending on the legality of the channel you&#8217;re in. The problem:</p>
<p>The names list can be too large to fit in to one packet, so the server will break it up. The problem is that if you&#8217;re in a big room, there&#8217;s bound to be lots of activity and the server will broadcast whatever messages it&#8217;s supposed to no matter what it&#8217;s doing. So rather than queuing a JOIN notification while it&#8217;s processing the names reply, it&#8217;ll just send the notice right in-between packets.</p>
<p>Yeah, me too. I also have no idea what order the names list might be in. I have no idea if it&#8217;s random, alphabetized, or predicted by Nostradamus &#8212; there&#8217;s nothing in the spec (and by spec, I mean not-spec) about it.</p>
<p>So how do you know what the NAMES reply is? Unlike JOIN or QUIT or KICK, when you request information from the server, chances are you&#8217;ll get a numeric reply.</p>
<p><strong>Numeric Replies<br />
</strong>By numeric, they mean a string of numbers &#8212; not actually binary numerics. There are a few things I don&#8217;t understand about numeric replies.</p>
<p>Why do some things have a numeric reply instead of just the text? Take NAMES for instance or WHOIS. I thought it had something to do with if the client sent the message requesting a reply. But then why is 005 considered a numeric reply? Or 001? Both are sent by the server after a connection.</p>
<p>Where the hell did these numbers come from? There&#8217;s some basic organization &#8212; 0xx are informative, 4xx are errors, 3xx are requested info&#8230; sometimes&#8230; 2xx are used for&#8230; uh&#8230;</p>
<p>Beyond that, I can&#8217;t figure out why the NAMES reply is 353 and the &#8220;End of NAMES&#8221; message is 366. MOTD Starting is 375, the actual MOTD packet is 372 and MOTD Ending is 376.</p>
<p>Additionally, when mentioning what reply is generated from what message, the spec (and by spec, I mean gelatinous blob of useless goo) refers to the numeric codes <em>by a  name!</em> Sending a WHOIS on a user generates a numeric reply of RPL_WHOISUSER &#8212; which is actually numeric 311. This makes things exceptionally hard to follow and you&#8217;re better off experimenting with viewing the raw output from the server.</p>
<p><strong>Security</strong><br />
For a while, there seemed to be a trend in having SSL connections to servers. It makes sense for say, HTTP or FTP &#8212; *real* protocols I mean. But because SSL connections are not required  for every client, IT BASICALLY MAKES THE WHOLE THING POINTLESS!!! Yeah, now I&#8217;m yelling!</p>
<p>You know those popups that you get in your web browser that say, &#8220;This page contains both secure and non-secure items.&#8221; &#8212; You have the option to ignore the non-secure items. If you had that option on IRC, it would basically ignore 90% of the people on there.</p>
<p><strong>Packet Length</strong><br />
It bothers me when connection oriented protocols (and by protocol in this case, I mean&#8230;. you get the idea&#8230;) reimplement stuff that TCP already does. Actually, I think the IRC protocol is the only one that does this.</p>
<p>TCP already breaks up things in to packets and lets you know when the stream terminates. Think about HTTP, you send the GET request, then stream everything down and then it terminates and you&#8217;re done. If you&#8217;re getting a 2MB html doc (god forbid), you don&#8217;t get it all at once &#8212; but no HTTP client on earth has to check for a line termination every 512 chars and then check to see if it sent the &#8220;End of HTTP Stream&#8221; message.</p>
<p><strong>Unicode and I18N</strong><br />
The Marquis de Sade, being the awful, evil man that he was made no plans for IRC to ever be in anything but 8-bit ASCII. Which is weird because he said that hundreds of years before 8-bit ASCII encoding was invented. I have yet to find *any* information in 10 years, whether official or &#8220;official,&#8221; about how Unicode works with IRC. I&#8217;m sure non-ascii characters can be sent &#8212; but as for the server encoding, BOM, etc&#8230; it&#8217;s a mystery.</p>
<p><strong>CTCP and DCC</strong><br />
At some point, some genius decided that instead of extending the protocol that extensions could be added by a hack in to an existing message.</p>
<p>There is, of course, <a href="http://www.invlogic.com/irc/ctcp.html">yet another document</a> about this &#8220;part.&#8221;</p>
<p>Trying to add support for these basically makes your handler for PRIVMSG 9000x bigger than it was. Also, you give yourself a massive headache and you start to think, &#8220;I must be a friggin&#8217; masochist to be working on this.&#8221;</p>
<p>The biggest crap-sandwich that one must eat is that the Client-to-Client Protocol goes through the Server. I&#8217;m gonna start yelling again. How about a rule that says you can&#8217;t call it a protocol if all you do is wrap some capitalized letters with \001? I&#8217;m gonna make an HTTP variant called FATTP (Fucking Awesome Text Transfer Protocol) which takes regular HTTP verbs and wraps them with \001. Fuck you.</p>
<p>But DCC takes the cake. Not only is it ass-backwards and full of errors &#8212; once again, you must reimplement parts of TCP stream control in order for it to work right. DCC Send is the real culprit &#8212; and it was supposedly replaced by DCC XMIT in 1997, but good luck finding anything that uses it.</p>
<p>The CTCP-97 document intends to offer an official spec for formatting codes. The problem is&#8230;</p>
<p><strong>mIRC</strong><br />
Currently the biggest piece of crap in IRC today is mIRC. For some reason, it is the standard for IRC clients. It uses a <a href="http://www.ircle.com/colorfaq.shtml">broken color formatting scheme</a>, old DCC code, horrible scripting, a poor interface, and yet, you still have to pay for it. There were many, <strong>many</strong> times when during the development of Zephyr (the IRC client I was working on from 2002-2004), we came to a point and said, &#8220;We don&#8217;t really know what to do here&#8230; What does mIRC do?&#8221;</p>
<p>So, given all these reasons, why can&#8217;t I convince my friends to move to jabber or something? Don&#8217;t they know what kind of state it puts me in?</p>
<p>At least this time, I&#8217;m only writing a bot. And, aside from reading the IRC RFCs&#8230; *sigh* I&#8217;m enjoying it.</p>
<p>See? Masochism.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattptr.net/2009/10/26/am-i-nuts/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Kind of annoyed with WordPress</title>
		<link>http://mattptr.net/2009/09/10/kind-of-annoyed-with-wordpress/</link>
		<comments>http://mattptr.net/2009/09/10/kind-of-annoyed-with-wordpress/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 23:50:51 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Rant]]></category>

		<guid isPermaLink="false">http://mattptr.net/?p=111</guid>
		<description><![CDATA[So, Automatic upgrade for WP has been broken for some time. Now there&#8217;s a stupid coding error that&#8217;s responsible for a worm attack. This is what I get for following the trend and not researching some software that I start using. A possible switch to a different blog software may be in the works if [...]]]></description>
			<content:encoded><![CDATA[<p>So, Automatic upgrade for WP has been broken for some time. Now there&#8217;s a stupid coding error that&#8217;s responsible for a worm attack. This is what I get for following the trend and not researching some software that I start using.</p>
<p>A possible switch to a different blog software may be in the works if they don&#8217;t get their act together.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattptr.net/2009/09/10/kind-of-annoyed-with-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>So this happened</title>
		<link>http://mattptr.net/2009/07/02/so-this-happened/</link>
		<comments>http://mattptr.net/2009/07/02/so-this-happened/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 14:44:26 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rant]]></category>

		<guid isPermaLink="false">http://mattptr.net/?p=91</guid>
		<description><![CDATA[I was, at one point, a big fan of the Visual Studio Environment. Yesterday, my appreciation of it was crushed &#8212; perhaps permanently. See, every once in a while, I&#8217;ll get the urge to program something. Yesterday, I went to start up a new WPF project in C# Express. I wanted to code myself a [...]]]></description>
			<content:encoded><![CDATA[<p>I was, at one point, a big fan of the Visual Studio Environment. Yesterday, my appreciation of it was crushed &#8212; perhaps permanently.</p>
<p>See, every once in a while, I&#8217;ll get the urge to program something. Yesterday, I went to start up a new WPF project in C# Express. I wanted to code myself a little forecast/weather grabber from the <a href="http://weather.gov/xml">NOAA NDFD Forecast Soap Service</a> which I had experimented with before. So I added the service to the project and had Visual C# generate the code, as has been the way for a long time.</p>
<p>Lo&#8217; and behold: it didn&#8217;t work.</p>
<p>Turns out that the service didn&#8217;t specify an encoding or didn&#8217;t encode properly. C#  wants everything to be UTF-8 or UTF-16, and dies thusly. It wasn&#8217;t dying or throwing a warning about the encoding while <em>generating </em>the code, or even instantiating the service, but only when data was recieved after the method call. Turns out, the way to handle encodings other than UTF-* <a href="http://msdn.microsoft.com/en-us/library/ms751486.aspx">is so unbelivably complicated that I don&#8217;t care to do it, especially when specifying the encoding could easily be an option when generating the code</a>.</p>
<p>So while I&#8217;m debugging this project and trying to get it to work, a &#8220;Help Update&#8221; dialog pops up and prevents me from doing anything. I try to stop the debugger at least, so this update can complete and VS tells me that it&#8217;s waiting for the update to complete. Ok&#8230; so I wait. And wait&#8230;wait and wait and wait&#8230; nothing. According to Task Manager, this update is burning up 100% of my cpu, so I get mad and terminate the process. It takes me two or three times of terminating the process before I can actually get it to die and get control of VS back. As I stop the debugger and prepare to close the IDE, the update dialog comes back, continues to burn up my cpu and my patience.</p>
<p>&#8220;Something must be messed up,&#8221; I think. So I repair the MSDN install. It comes back. I repair C# Express. It comes back. I <em>uninstall</em> MSDN, effectively removing what needed the update (or so I thought), and it COMES BACK! I uninstall C# Express and the problem goes away :)</p>
<p>So I&#8217;m done with Visual C# Express for a while and my high opinion of the MS development tools is shattered. It&#8217;s a shame too &#8212; I had high hopes for XNA.</p>
<p>Oh yeah, my computer at home is kind of shot and I can&#8217;t afford to get a new one. So this site will probably go unmaintained for a bit.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattptr.net/2009/07/02/so-this-happened/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Completely unfair, totally biased review of PHP ORM libraries</title>
		<link>http://mattptr.net/2009/05/07/php-orm-libraries/</link>
		<comments>http://mattptr.net/2009/05/07/php-orm-libraries/#comments</comments>
		<pubDate>Thu, 07 May 2009 20:37:55 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Rant]]></category>
		<category><![CDATA[Thoughts]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[orm]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://mattptr.net/?p=65</guid>
		<description><![CDATA[This has been on my mind for a long, long time. Having been spoiled with SQLAlchemy and Elixir, I am tortured with sub-par ORM libraries while at work. Granted I did get to use SA for an internal project, but the majority of the things I do involves PHP. I&#8217;ve been stuck with it for [...]]]></description>
			<content:encoded><![CDATA[<p>This has been on my mind for a long, long time. Having been spoiled with <a href="http://www.sqlalchemy.org">SQLAlchemy</a> and <a href="http://elixir.ematia.de/trac/wiki">Elixir</a>, I am tortured with sub-par ORM libraries while at work. Granted I did get to use SA for an internal project, but the majority of the things I do involves PHP.</p>
<p>I&#8217;ve been stuck with it for years. It is the language of choice for people who run servers and hate web developers. So yeah, 5 years of PHP and MySQL &#8230;and using so many different libs for database abstraction has given me some room to shoot my mouth off.</p>
<p>Anyway, this is going to be a long post and not for the faint of heart.  I&#8217;m going to start off at the beginning&#8230;</p>
<p><span id="more-65"></span></p>
<h2>1. I was a <a href="http://php.net/mysql_connect">mysql_*</a> junkie</h2>
<p>It&#8217;s true &#8212; I was. But hey, it was PHP4 man! Love was free! No one knew about SQL injection just yet. We didn&#8217;t need features&#8230;just some SQL knowledge and a while-loop. Oh, how innocent we all were.</p>
<p><strong>I&#8217;m never using this again because: </strong>It&#8217;s an unbelievably monstrous pain-in-the-nuts to use these functions. They&#8217;re totally unsafe and take no advantage over any of the features in the versions of MySQL greater than 4.0. It has been removed from the default PHP5 install.</p>
<h2>2. Then I discovered, <a href="http://pear.php.net/DB">PEAR::DB</a> and my journey started</h2>
<p>I can&#8217;t remember how I discovered PEAR or any of the packages in it. I do know that I wrote a TON of boilerplate code with the mysql_* functions, especially with insert and update statements. So I imagine I was searching for some way to cut back on this and also I had probably started getting wind of SQL injection.</p>
<p>Holy crap &#8212; I totally found what I was looking for. The autoPrepare and autoExecute functions! This was perfect. The prepare/execute methods also helped me a great deal. It was truly a great day to be me.</p>
<p><strong>I&#8217;m never using this again because:</strong> IT&#8217;S SO SLOW! I&#8217;ve never, ever, ever before or since had a single, legitimate PHP script increase the load time on a project to 5 seconds. It was unbelievable. Never mind the fact that the entire package has been deprecated. I gave it up long before. Also, error handling created a large amount of repetitive code. I actually had keyboard shortcuts in Eclipse (yeah, I said Eclipse) to paste a snippet for a query with error handling.</p>
<h2>3. Time to find something else&#8230; look deeper at PEAR&#8230; find <a href="http://pear.php.net/MDB2">PEAR::MDB2</a></h2>
<p>From the PEAR::MDB2 documentation:</p>
<blockquote><p>PEAR MDB2 is a merge of the PEAR DB and Metabase php database abstraction layers.</p></blockquote>
<p>More on that briefly. In the meantime, HOLY DAMN THIS IS WAY FASTER! How did they manage to get this *that* much fast than DB? Anyway it doesn&#8217;t matter. The romance was short lived&#8230;.</p>
<p><strong>I&#8217;m never using this again because:</strong> While I could consider this *my* fault if present-day Matt did this, back-in-the-day Matt took &#8220;merge of the PEAR DB&#8230;&#8221; statement to mean, &#8220;compatible API.&#8221; Wrong. I had to change every single query I wrote with PEAR::DB. I should have seen this as an omen&#8230;</p>
<p>Read the changelog. I can&#8217;t remember when I started using it exactly, but I have a feeling it was around Beta-2 when I saw the statement,</p>
<blockquote><p>The core of MDB2 is now fairly stable API-wise.</p></blockquote>
<p>Now check later releases&#8230;go ahead&#8230;I&#8217;ll be here. Notice anything? They all start out with, &#8220;Warning: BC breaks.&#8221; That&#8217;s <strong>Backwards-Compatibility</strong> to those who don&#8217;t know. Do you know what&#8217;s more frustrating to a developer than relying on a library that breaks backwards compatibility with every release? Nothing. You could pour fire ants down my ass-crack and taunt me with an Epi-Pen as my throat closes from anaphalyctic shock and I wouldn&#8217;t be so annoyed.</p>
<p>At this point I stopped using MDB2, waited for the API to stabilize, upgraded and fixed that dozen or so sites that used it. Then I buried it inside the cemetery in my mind. Their release schedule probably made me start noticing how ridiculous the PHP community was when it came to Release Tags &#8212; but that&#8217;s a rant for another day.</p>
<h2>4.  MySQLi am the Walrus</h2>
<p>I tried MySQLi.</p>
<p><strong>I&#8217;m never using this again because:</strong> The <a href="http://php.net/mysqli">API</a> is worse than <a href="http://en.wikipedia.org/wiki/Adolf_Hitler">Hitler</a>.</p>
<h2>5. <a href="http://php.net/PDO">PDO</a> plz</h2>
<p>Around 2006, I started hearing some buzz about ORMs and I thought PHP Data Objects was one. It&#8217;s not. It&#8217;s a DB abstraction API. That said, it was clearly the best attempt so far to some kind of standard. There are lots of goodies like prepared statements and parameter escaping. It tends to be a bit verbose, like any non-ORM DB layer.</p>
<p><strong>I&#8217;m never using this again if I can help it because:</strong> Upgrading PHP becomes a hassle. PDO is built in (more or less) to the PHP stdlib. The problem is, none of the PDO db-drivers are &#8212; they&#8217;re all extensions. So when I upgrade PHP, I have to rebuild the database driver. Yeah, I&#8217;m lazy.</p>
<h2>6. <a href="http://adodb.sf.net">ADOdb</a> FTW!</h2>
<p>Now we come to my latest choice of library. I knew about ADOdb long ago, but for some reason, I didn&#8217;t use it. It wins for a bunch of reasons. I love it now though.</p>
<ol>
<li>It&#8217;s fast. I&#8217;ve never felt a performance hit because of it.</li>
<li>It&#8217;s mature. I don&#8217;t know if the API has *ever* changed.</li>
<li>It supports PHP4. Yeah I know, not even PHP supports PHP4, but tell that to some of these hosting providers. Unfortunately, in the real world, we still have to deal with 4 from time to time. (I&#8217;m looking at you, Yahoo).</li>
<li>It doesn&#8217;t require PEAR. I&#8217;ve worked with a few hosts *cough*hostmysite*cough* :)  who insist that upgrading PEAR will break everything and the world will die, famine will spread, the dead will rise from the grave and they might have to stay 5 minutes late. Installing PEAR to a shared host is a pain and if I don&#8217;t have to do it &#8212; that&#8217;s a major selling point.</li>
<li>There&#8217;s another reason it wins that I will get in to shortly&#8230;</li>
</ol>
<h2>7. Release me from this tainted ORM</h2>
<p>Ok, so even though ADOdb is the clear cut winner for me in the Abstraction Layer department, writing boilerplate-queries is still bothersome. I may have tried every single ORM for PHP that there is and there is only one that I can stand. So here, in no particular order are the crappy ones:</p>
<h3><a href="http://framework.zend.com/manual/en/zend.db.table.html">Zend_Db_Table</a></h3>
<p>I don&#8217;t know who thought including this was better than making an ActiveRecord clone, but they need to experience <a href="http://deephurting.ytmnd.com/">Deep Hurting</a>. I was using ZF since it&#8217;s pre-release days and I stopped using ZF before it&#8217;s actual release. They pulled the same, &#8220;Oh we said it was ok for production use, so we&#8217;ll change the API and give you absolutely no graceful deprecation.&#8221;</p>
<p>I&#8217;ve since looked at the Zend_Db_Table documents and man, it&#8217;s pure evil. The way to handle relationships is unbelievably verbose and it actually sickens me to think I wanted to contribute to this project.</p>
<h3><a href="http://book.cakephp.org/view/66/Models">CakePHP&#8217;s ORM</a></h3>
<p>I have a fair amount of respect for CakePHP. The ORM *isn&#8217;t* the worst on this list, but what is up with using arrays for <a href="http://book.cakephp.org/view/807/find-first">EVERYTHING</a>? I can almost excuse using arrays for function parameters (things get messy very quickly), but for result sets? Objects in PHP exist for a reason, USE THEM!</p>
<h3><a href="http://www.doctrine-project.org/">Doctrine</a></h3>
<p>In fairness, I&#8217;ve never gotten Doctrine to work. Why? Because the documents are written by The Riddler. I&#8217;ve installed Doctrine a few times and have never produced working models with it. I also don&#8217;t like defining the schema with YAML or whatever and using a command line tool to generate the code. You can generate models from an existing Schema, but defining the relations is manual and tedious.</p>
<h3><a href="http://propel.phpdb.org/trac/">Propel</a></h3>
<p>There are things that bother me about the interface for retrieving data. ::retrieveByPK()? What&#8217;s wrong with retrieve(), select(), load()&#8230;do we really have to state ByPK? Why not go the full 10 yards and make it retrieveByPrimaryKey()?</p>
<p>The other thing &#8212; do*() methods? Really? I mean, great.</p>
<p>XML Schemas&#8230; come on.</p>
<p>On top of that, it requires Phing, which didn&#8217;t want to be installed when I was testing Propel. See ya.</p>
<h3><a href="http://www.ezpdo.net/">ezPDO</a></h3>
<p>I was almost ready to attempt to use ezPDO once, but then I remember how dumb of an idea it is to put code in the docstrings. Yeah, I didn&#8217;t make that up.  It used to bother me that PEAR standards stipulate that people put some kind of typing scheme in the docstrings for function parameters. *sigh* But ezPDO takes it to a sinister new level.</p>
<h3><a href="http://codeigniter.com/user_guide/general/models.html">CodeIgniter</a></h3>
<p>I haven&#8217;t used CodeIgniter&#8217;s ORM, but reading the documents has made me a little peeved that they call it an ActiveRecord implementation. ActiveRecord has methods attached to it, like save() etc. Without those, it&#8217;s just Record.</p>
<h3>And the rest&#8230;</h3>
<p>There are a bunch of other ones that I won&#8217;t bother downloading:</p>
<ul>
<li><a href="http://www.getdorm.com/">dORM</a> &#8212; Requires an XML schema and also uses getters and setters for data access.</li>
<li><a href="http://www.php-rocks.com/rocks_php_library.php">Rocks</a> &#8212; Sucks :) No really though, their website kept dying while I was trying to read the documents. Max execution time exceeded. When I finally got to it, I had to register for most of it.</li>
<li><a href="http://coughphp.com/">Coughphp</a> &#8212; More getters and setters. Java is like herpes. It just keeps spreading and you can&#8217;t get rid of it.</li>
</ul>
<p>and on and on.</p>
<p>The clear cut winner, in my opinion, was right under my nose the whole time. That&#8217;s right, ADOdb_Active_Record. It has the simplest API &#8212; no schema definitions needed, no models needed to be created before hand, no getter-setter methods, no field name mangling, simple debugging&#8230;</p>
<p>It&#8217;s not without it&#8217;s problems though. No N:M relations, although 1:m and m:1 are breath-takingly simple. Development on it is a bit sluggish, but I&#8217;ve been using it successfully for a few projects now and I&#8217;ve had no problems.</p>
<p>As far as performance? I have no idea. It&#8217;s not PEAR::DB slow, so I don&#8217;t care.</p>
<h2>8. In conclusion</h2>
<p>I&#8217;m sticking with ADOdb for now, but I&#8217;ll always be on the look for something better. Maybe when PHP gets namespaces, SQLAlchemy can be ported?</p>
]]></content:encoded>
			<wfw:commentRss>http://mattptr.net/2009/05/07/php-orm-libraries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to break Firefox</title>
		<link>http://mattptr.net/2009/01/26/how-to-break-firefox/</link>
		<comments>http://mattptr.net/2009/01/26/how-to-break-firefox/#comments</comments>
		<pubDate>Mon, 26 Jan 2009 16:07:36 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Rant]]></category>

		<guid isPermaLink="false">http://mattptr.net/?p=6</guid>
		<description><![CDATA[I don&#8217;t know how long this has been around (I think only since 3.x), but if you&#8217;re using Firebug&#8230; Open a site with javascript that you&#8217;re presumably trying to debug or are otherwise involved in some time sensitive development. Set a breakpoint in a script. Get the breakpoint to be reached, thus halting execution of [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t know how long this has been around (I think only since 3.x), but if you&#8217;re using Firebug&#8230;</p>
<ol>
<li>Open a site with javascript that you&#8217;re presumably trying to debug or are otherwise involved in some time sensitive development.</li>
<li>Set a breakpoint in a script.</li>
<li>Get the breakpoint to be reached, thus halting execution of the script.</li>
<li>Find exactly what you&#8217;re looking for.</li>
<li>Fix it in the code file you&#8217;re working on</li>
<li>Refresh the page.</li>
<li>Notice that none of the Javascript seems to be working &#8212; if the page even displays</li>
<li>Remove the breakpoint and try again</li>
<li>Copy the URL because you know you&#8217;re going to have to restart the browser</li>
<li>Get a message about Firefox already running</li>
<li>Open up your process manager and see Firefox using up 100% cpu and an enormous amount of memory</li>
<li>End the process</li>
<li>Start Firefox again</li>
<li>Find out that your URL wasn&#8217;t copied</li>
<li>ARGGHH</li>
</ol>
<p>Note that this can be avoided by resuming the javascript engine before step 6 &#8212; but I never remember to do that.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattptr.net/2009/01/26/how-to-break-firefox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

