<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Squirrel Hacker</title>
	
	<link>http://blog.seanja.com</link>
	<description>I have come forward in time from the year 1986 to share this with you</description>
	<lastBuildDate>Wed, 21 Jul 2010 04:16:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
<cloud domain="blog.seanja.com" port="80" path="/?rsscloud=notify" registerProcedure="" protocol="http-post" />
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/SquirrelHacker" /><feedburner:info uri="squirrelhacker" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license><image><link>http://creativecommons.org/licenses/by-nc-sa/3.0/</link><url>http://creativecommons.org/images/public/somerights20.gif</url><title>Some Rights Reserved</title></image><feedburner:emailServiceId>SquirrelHacker</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Orms and Circular References</title>
		<link>http://feedproxy.google.com/~r/SquirrelHacker/~3/1RKr3_K1oMA/</link>
		<comments>http://blog.seanja.com/2010/05/orms-and-circular-references/#comments</comments>
		<pubDate>Thu, 27 May 2010 05:17:54 +0000</pubDate>
		<dc:creator>SeanJA</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[circular relationships]]></category>
		<category><![CDATA[factory]]></category>
		<category><![CDATA[gist]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[orm]]></category>
		<category><![CDATA[static functions]]></category>

		<guid isPermaLink="false">http://blog.seanja.com/?p=998</guid>
		
			<content:encoded><![CDATA[In my spare time I have been working on an ORM&#8230; not one meant to be used in the real world (well&#8230; not yet anyway). I currently have hasOne and hasMany working like so: &#60;?php &#160; /** * @property int $id * @property string $type * @property int $car_id */ class wheelBoilerplate extends orm&#123; protected function init&#40;&#41;&#123; $this-&#62;addProperty&#40;'type', array&#40; 'type'=&#62;'string', 'default'=&#62;'monster truck', &#41;&#41;; $this-&#62;hasOne&#40;'car'&#41;; &#125; &#125; &#160; class wheel extends wheelBoilerplate&#123;&#125; &#160; /** * @property int $id * @property int $wheel_count * @property array $wheels * @property string $type */ abstract class carBoilerplate extends orm&#123; protected function init&#40;&#41;&#123; $this-&#62;addProperty&#40;'wheel_count', array&#40; 'default'=&#62;4, 'type'=&#62;'int', &#41;&#41;; $this-&#62;addProperty&#40;'type', array&#40; 'default'=&#62;'monster truck', 'type'=&#62;'string', &#41;&#41;;...<img src="http://feeds.feedburner.com/~r/SquirrelHacker/~4/1RKr3_K1oMA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.seanja.com/2010/05/orms-and-circular-references/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.seanja.com/2010/05/orms-and-circular-references/</feedburner:origLink></item>
		<item>
		<title>Netbeans 6.9: My New Favourite Features</title>
		<link>http://feedproxy.google.com/~r/SquirrelHacker/~3/w2JMlcpG1hQ/</link>
		<comments>http://blog.seanja.com/2010/04/netbeans-6-9-my-favourite-new-features/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 05:38:53 +0000</pubDate>
		<dc:creator>SeanJA</dc:creator>
				<category><![CDATA[IDE]]></category>
		<category><![CDATA[Netbeans]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.seanja.com/?p=980</guid>
		
			<content:encoded><![CDATA[Netbeans 6.9 beta was recently released, here are some of the new features for the PHP editor that are pretty awesome. The first one is recognizing overridden methods and classes. This feature is great because it allows for better auto completion, and lets you find things faster. Not only does it recognize that I am extending the class, it recognizes that the function I am writing is overriding a function in the parent class, and provides hints as to what that function did (based on the comments that you *did* write right?). After you hit enter (because you actually want to override that function, you get this (including a call to parent::functionName()): There is a little green circular O icon beside your function because it is overriding a parent function (granted this would make more sense if I were using __construct rather than php4 syntax). Hovering over the O tells you which function you are overriding, and where it is. Clicking on that icon will take you to the actual...<img src="http://feeds.feedburner.com/~r/SquirrelHacker/~4/w2JMlcpG1hQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.seanja.com/2010/04/netbeans-6-9-my-favourite-new-features/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://blog.seanja.com/2010/04/netbeans-6-9-my-favourite-new-features/</feedburner:origLink></item>
		<item>
		<title>Exceptions Are Not For Flow Control</title>
		<link>http://feedproxy.google.com/~r/SquirrelHacker/~3/GloKhDsN5a0/</link>
		<comments>http://blog.seanja.com/2010/04/exceptions-are-not-for-flow-control/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 12:00:00 +0000</pubDate>
		<dc:creator>SeanJA</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.seanja.com/?p=976</guid>
		
			<content:encoded><![CDATA[When I saw this post on Better Error Handling, while there is nothing horribly horribly wrong with it I couldn&#8217;t help thinking that he has gone past proper error handling. Exceptions are for exceptional cases, hence the name. They should not to be used for flow control, or for things that could occur normally like a user failing to login. This is because almost all function calls are basically a question: Did the user enter the correct information to login? Yes, No Did the database query return data? Here is the data array, here is an empty array. Is the data that the user entered valid? Yes, No. Within these functions, you can pass an error to the next screen, view, wherever you are returning to because the function failed to produce a positive result. Things that are exceptional cases would be something similar to the following. In these cases, you cannot continue because the assumptions made by your code were not fulfilled. A malformed query on the database...<img src="http://feeds.feedburner.com/~r/SquirrelHacker/~4/GloKhDsN5a0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.seanja.com/2010/04/exceptions-are-not-for-flow-control/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://blog.seanja.com/2010/04/exceptions-are-not-for-flow-control/</feedburner:origLink></item>
		<item>
		<title>PHP Functions, you’re doing it wrong…</title>
		<link>http://feedproxy.google.com/~r/SquirrelHacker/~3/jWhw1B0SgwM/</link>
		<comments>http://blog.seanja.com/2010/04/php-functions-youre-doing-it-wrong/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 11:47:56 +0000</pubDate>
		<dc:creator>SeanJA</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[WTF]]></category>

		<guid isPermaLink="false">http://blog.seanja.com/?p=967</guid>
		
			<content:encoded><![CDATA[Just a quick tip today. If your function looks something like this: &#160; &#60;?php /** * A really long function definition * @param string $has * @param bool $a * @param int $lot * @param float $of * @param assoc_array $parameters * @param string $I * @param string $wonder * @param int $what * @param int $they * @param int $do */ function myfunction&#40; $has=null, $a=null, $lot=null, $of=null, $parameters=null, $I=null, $wonder=null, $what=null, $they=null, $do=null &#41;&#123; //do some magic &#125; &#160; //this is how it would be called myfunction&#40;null, false, null, 1.2, array&#40;'one'=&#62;1, 'two'=&#62;2&#41;, 'I', null, 1, null, 3&#41;; You are doing it wrong, if all of these parameters are really nullable and required for your function, and there is no way for you to split it up, then you _can_ refactor it like this: &#160; &#60;?php /** * Quickly refactored to make it easier to use * @param array $array containing: (string)'has', (bool)'a', (int)'lot', (float)'of',...<img src="http://feeds.feedburner.com/~r/SquirrelHacker/~4/jWhw1B0SgwM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.seanja.com/2010/04/php-functions-youre-doing-it-wrong/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<feedburner:origLink>http://blog.seanja.com/2010/04/php-functions-youre-doing-it-wrong/</feedburner:origLink></item>
		<item>
		<title>An alternative to Poor Man’s MVC in PHP</title>
		<link>http://feedproxy.google.com/~r/SquirrelHacker/~3/e4SzqnS6Xec/</link>
		<comments>http://blog.seanja.com/2010/04/an-alternative-to-poor-mans-mvc-in-php/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 12:30:32 +0000</pubDate>
		<dc:creator>SeanJA</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.seanja.com/?p=956</guid>
		
			<content:encoded><![CDATA[As written in my previous post ( http://blog.seanja.com/2010/03/re-top-10-php-techniques-that-will-save-you-time-and-effort/ ) I noted that the code for the proper way to write an index file is essentially a Poor Man&#8217;s MVC tm. This method is fine for someone starting out their php journey, it lets them do everything they will probably need to do (they can even add in some apache rewrite rules to make the url look nice). The problem with this approach is that, while it is really fast, it is relying on you to define every single page that you add to your site individually by hand (well, except for the last example). Another problem is that you will inevitably end up with something like this (ok, this might be a bit of an extreme example&#8230;): because the next person to edit the code is too lazy to look at how it actually works. This will repeat itself because the next person after that will figure that is how the code works (ad infinitum). The alternative is to use an actual...<img src="http://feeds.feedburner.com/~r/SquirrelHacker/~4/e4SzqnS6Xec" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.seanja.com/2010/04/an-alternative-to-poor-mans-mvc-in-php/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://blog.seanja.com/2010/04/an-alternative-to-poor-mans-mvc-in-php/</feedburner:origLink></item>
		<item>
		<title>RE: Top 10 PHP Techniques That Will Save You Time and Effort</title>
		<link>http://feedproxy.google.com/~r/SquirrelHacker/~3/ejP8ucHyNmo/</link>
		<comments>http://blog.seanja.com/2010/03/re-top-10-php-techniques-that-will-save-you-time-and-effort/#comments</comments>
		<pubDate>Thu, 01 Apr 2010 00:59:10 +0000</pubDate>
		<dc:creator>SeanJA</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Emergency]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[WTF]]></category>

		<guid isPermaLink="false">http://blog.seanja.com/?p=943</guid>
		
			<content:encoded><![CDATA[I realise that I already posted something today, but this seemed like an emergency&#8230; I thought maybe this was a serious post when I clicked on it, then when I got to number 2 on the list (I had skipped reading his post about how you should write an index page), I thought maybe he was joking, but at the end of it I realised that he was not. 1. How to Properly Create a Website Index Page See my post about how to do it right. [... snip] $page = isset&#40;$_REQUEST&#91;'page'&#93;&#41; ? $_REQUEST&#91;'page'&#93; : 'home'; &#160; switch&#40;$page&#41; &#123; case 'home': break; case 'mail': break; case 'contact': break; default: $page = 'home'; &#125; &#160; include&#40;&#34;$page.php&#34;&#41;; [... snip] Apparently this is the right way. I do like the single point of entry idea, and at least he is filtering the variables so you can&#8217;t load other php pages right? It really is too bad my $_COOKIE['page'] = &#8216;mail&#8217;&#8230; I wonder what the rest of the site is like....<img src="http://feeds.feedburner.com/~r/SquirrelHacker/~4/ejP8ucHyNmo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.seanja.com/2010/03/re-top-10-php-techniques-that-will-save-you-time-and-effort/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		<feedburner:origLink>http://blog.seanja.com/2010/03/re-top-10-php-techniques-that-will-save-you-time-and-effort/</feedburner:origLink></item>
		<item>
		<title>PHP DateTime is missing methods in 5.2</title>
		<link>http://feedproxy.google.com/~r/SquirrelHacker/~3/pb5Ssb9jryE/</link>
		<comments>http://blog.seanja.com/2010/03/php-datetime-is-missing-methods-in-5-2/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 11:28:32 +0000</pubDate>
		<dc:creator>SeanJA</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.seanja.com/?p=938</guid>
		
			<content:encoded><![CDATA[It turns out that in PHP 5.2, the DateTime class is missing a couple of methods (get/setTimestamp) that are available in PHP 5.3. These are some strange methods to be missing as a lot of people in the PHP world seem to work on Timestamps using these concepts, so you would have thought that php would have included these methods initially. Unfortunately they did not, so here is a fix for that: And since using it in production would be no good if it were not tested properly, here are the unit tests to make sure that it returns the same values as the new one in PHP 5.3: You use it the same way that you would use the normal DateTime class, it even includes the poorly named php functions date_timestamp_get / date_timestamp_set if they don&#8217;t exist so you can use them as well. Hopefully this is helpful for those of you that have used this functionality mistakenly (as I did) before realizing that it wasn&#8217;t actually available. (get it on github: http://gist.github.com/349273) Share...<img src="http://feeds.feedburner.com/~r/SquirrelHacker/~4/pb5Ssb9jryE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.seanja.com/2010/03/php-datetime-is-missing-methods-in-5-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.seanja.com/2010/03/php-datetime-is-missing-methods-in-5-2/</feedburner:origLink></item>
		<item>
		<title>jQuery :contains selector and unicode characters</title>
		<link>http://feedproxy.google.com/~r/SquirrelHacker/~3/uU6OgcEiTIc/</link>
		<comments>http://blog.seanja.com/2010/03/jquery-contains-selector-and-unicode-characters/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 12:30:51 +0000</pubDate>
		<dc:creator>SeanJA</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[contains]]></category>
		<category><![CDATA[hex]]></category>
		<category><![CDATA[selector]]></category>
		<category><![CDATA[unicode]]></category>

		<guid isPermaLink="false">http://blog.seanja.com/?p=934</guid>
		
			<content:encoded><![CDATA[I have an element like this (to save space in the menu since they can put up to 255 characters in it): &#60;span class=&#34;tool_tip&#34; title=&#34;The full title&#34;&#62;The ful&#38;#8230;&#60;/span&#62; While this seems to work: jQuery&#40;'span:contains(…)'&#41;; this does not: jQuery&#40;'span:contains(&#38;#8230;)'&#41;; I am pretty sure that it would be bad to use the first one because if someone else saves the file, or the browser decides to get the file in a different character set for some reason things will not work. There has to be a way to properly select this span, right? Turns out there is: &#160; jQuery('span:contains(\u2026)'); In other words: Use the hex value instead of the decimal value as the selector and things will work out fine. Share and Enjoy: Related posts:JQuery and WordPress A better way to use jQuery in WordPress Themes Using the jQuery-UI Autocomplete Widget


Related posts:JQuery and WordPress
A better way to use jQuery in WordPress Themes
Using the...<img src="http://feeds.feedburner.com/~r/SquirrelHacker/~4/uU6OgcEiTIc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.seanja.com/2010/03/jquery-contains-selector-and-unicode-characters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.seanja.com/2010/03/jquery-contains-selector-and-unicode-characters/</feedburner:origLink></item>
		<item>
		<title>Documenting PHP Code</title>
		<link>http://feedproxy.google.com/~r/SquirrelHacker/~3/keo73UN5eLc/</link>
		<comments>http://blog.seanja.com/2010/03/documenting-php-code/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 13:00:40 +0000</pubDate>
		<dc:creator>SeanJA</dc:creator>
				<category><![CDATA[IDE]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.seanja.com/?p=924</guid>
		
			<content:encoded><![CDATA[I know we all hate documenting code, but it can really help out future you or me when we need to go back and fix something. Poorly documented code is the bane of anyone who will be taking on your code after you leave (or invite more people into) the project. One thing that can really help is documenting the variables that you can get via the __get and __set magic methods: &#60;?php &#160; /** * @property bool $development_environment * @property string $base_url * @property string $index_file * @property string $allowed_uri_characters * @property string $char_encoding * @property string $default_location * @property string $helper_prefix * @property array $auto_load * @property string $auto_load['helpers'] * @property array $db * @property string $db['name'] * @property string $db['user'] * @property string $db['password'] * @property string $db['host'] * @property string $db['type'] * @property array $users * @property string $users['table'] * @property string $users['encryption'] *...<img src="http://feeds.feedburner.com/~r/SquirrelHacker/~4/keo73UN5eLc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.seanja.com/2010/03/documenting-php-code/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.seanja.com/2010/03/documenting-php-code/</feedburner:origLink></item>
		<item>
		<title>Using the jQuery-UI Autocomplete Widget</title>
		<link>http://feedproxy.google.com/~r/SquirrelHacker/~3/_cUhLTgscG0/</link>
		<comments>http://blog.seanja.com/2010/03/using-the-jquery-ui-autocomplete-widget/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 13:00:24 +0000</pubDate>
		<dc:creator>SeanJA</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Databases]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://blog.seanja.com/?p=925</guid>
		
			<content:encoded><![CDATA[The latest version of jQuery-ui has an autocomplete widget. No more looking for one that will work (you get the point) with the version of jQuery that you have. All you have to do is pull the latest one down from the jQuery-ui site and you are good to go. First the jQuery to use the autocomplete plugin: &#160; //we will be using this to cache the responses from the server var ajaxCache = &#123;&#125;; &#160; //activate autocomplete on boxes that have the autocomplete class $&#40;&#34;input.auto_complete&#34;&#41;.autocomplete&#40;&#123; source: function&#40;request, response&#41; &#123; //what are we searching for var query_type = $&#40;this&#41;.attr&#40;'element'&#41;.attr&#40;'id'&#41;; //the cacheterm that we use to save it in the cache var cachedTerm = &#40;request.term + '' + query_type&#41; . toLowerCase&#40;&#41;; //if the data is in the cache and the data is not too long, use it if &#40;ajaxCache&#91;cachedTerm&#93; != undefined &#38;&#38; ajaxCache&#91;cachedTerm&#93;.length...<img src="http://feeds.feedburner.com/~r/SquirrelHacker/~4/_cUhLTgscG0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.seanja.com/2010/03/using-the-jquery-ui-autocomplete-widget/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://blog.seanja.com/2010/03/using-the-jquery-ui-autocomplete-widget/</feedburner:origLink></item>
	</channel>
</rss>
