<?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/" version="2.0">

<channel>
	<title>PseudoCoder.com</title>
	
	<link>http://www.pseudocoder.com</link>
	<description>What Happends If It Actually Works?</description>
	<lastBuildDate>Fri, 19 Jun 2009 03:10:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/pseudocoder" type="application/rss+xml" /><item>
		<title>CakePHP Digest #16</title>
		<link>http://www.pseudocoder.com/archives/2009/06/18/cakephp-digest-16/</link>
		<comments>http://www.pseudocoder.com/archives/2009/06/18/cakephp-digest-16/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 03:10:52 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[CakePHP Digest]]></category>

		<guid isPermaLink="false">http://www.pseudocoder.com/?p=936</guid>
		<description><![CDATA[News
Preface
I just wanted to say this is probably the highest quality of links I&#8217;ve ever put together for one of these digests.  There have been some really good blog posts and code released over the last 2+ weeks.
Updated IBM Tutorial
I saw this link floating around, but ignored it for awhile since I thought it [...]]]></description>
			<content:encoded><![CDATA[<h1>News</h1>
<h4>Preface</h4>
<p>I just wanted to say this is probably the highest quality of links I&#8217;ve ever put together for one of these digests.  There have been some really good blog posts and code released over the last 2+ weeks.</p>
<h4>Updated IBM Tutorial</h4>
<p>I saw this link floating around, but ignored it for awhile since I thought it was just the old version of <a href="http://www.ibm.com/developerworks/opensource/tutorials/os-php-cake1/index.html">IBM&#8217;s Cooking Up Websites Fast</a> brought back to life.  Turns out it&#8217;s completely updated for 1.2 and covers everything from installation to security to caching.  </p>
<h4>@CakePHP</h4>
<p>So what happened to the <a href="http://twitter.com/cakephp">CakePHP twitter account</a>?  Did the devs lose the password?  Don&#8217;t get me wrong, it&#8217;s great that <a href="http://twitter.com/cakephp/status/1791337087">I&#8217;m the last link tweeted</a>, but it&#8217;s been over a month now.  Let&#8217;s get this thing rolling again.</p>
<h1>Tickets and Commits</h1>
<h4>Validation Rules</h4>
<p>I&#8217;m sure the Cake team would be perfectly happy to go the rest of their lives without ever seeing this ticket again, but I&#8217;ll bring it up one last time.  It&#8217;s <a href="https://trac.cakephp.org/ticket/5145">#5145 &#8211; Cake should have a alphanumeric+whitespace validation rule</a>.  On the surface the need for this type of rule seems to make sense, but as Joel Perras <a href="http://groups.google.com/group/cake-php/browse_thread/thread/5da14ef82b2c257e#">points out in the Google Group</a> it&#8217;s a fairly uncommon scenario.  Actually, I can&#8217;t think of when I&#8217;d actually use this rule &#8211; post a comment if you have.  </p>
<p>This also opens up an opportunity for someone in the community to make an awesome behavior (packaged as a plugin, of course) that encapsulates a bunch of random, bonus validation rules.  Joel even gets you started by providing a &#8220;alnumWhitelist&#8221; rule.  Whose gonna run with this?</p>
<h1>In The Wild</h1>
<h4>F-E-E-D-Z.com</h4>
<p>This one has actually been up for awhile, but I held of until <a href="http://bakery.cakephp.org/articles/view/f-e-e-d-z-com-rss-and-atom-feed-directory">the bakery article</a> stabilized.  <a href="http://www.f-e-e-d-z.com/">F-E-E-D-Z</a> is a feed directory.</p>
<h4>Dropfood.com</h4>
<p><a href="http://www.dropfood.com">Dropfood</a> is a recipe aggregation site, at least that&#8217;s what I&#8217;m inferring since there isn&#8217;t a description anywhere.  It seems to be moderated, so only select recipes are included.  Clicking on one brings you to a framed site with the recipe and diggbar like bar for Dropfood.</p>
<h4>Cyclingnews</h4>
<p>I&#8217;m not 100% sure this one is Cake site, but <a href="http://twitter.com/frodosghost/statuses/2176792422">@frodosghost heard that it is</a>.  Good enough for me.<br />
Unlike the two sites mentioned above, <a href="http://www.cyclingnews.com/">Cyclyingnews.com</a> has original content and focuses on&#8230;wait for it&#8230;cycling news!  It&#8217;s pics like <a href="http://www.cyclingnews.com/races/73rd-tour-de-suisse-2009-upt/photos/72097">this</a> and <a href="http://www.cyclingnews.com/races/73rd-tour-de-suisse-2009-upt/stages/stage-1/photos/75726">this</a> that make me wish I had spent less time trying to jump shit with my bike as a kid and instead just rode for a really long time.  Plus, I could finally <a href="http://www.cyclingnews.com/races/73rd-tour-de-suisse-2009-upt/stages/stage-1/photos/75937">wear my shirt like this</a> and people at work wouldn&#8217;t give me funny looks.</p>
<h1>In The Blogs</h1>
<h4>Vanity Routing</h4>
<p>Let&#8217;s say you have a site, we&#8217;ll call it FaceSpace in this example, where you want to have &#8220;www.facespace.com/vanity&#8221; route to a particular controller.  But you also want to make sure that your actual controller urls still route correctly.  <a href="http://dsi.vozibrale.com/articles/view/advanced-routing-with-cakephp-one-example">lecterror has a quick tip</a> on how to accomplish this.</p>
<h4>Two from Debuggable</h4>
<p>The first is a <a href="http://debuggable.com/posts/cakephp-removecache-shell---remove-your-cache-files-easily:4a277938-977c-43bc-bd83-645c4834cda3">cool little shell that can be used to clear cache</a>.  If you&#8217;re going to actually implement this though, I&#8217;d use the <a href="http://thechaw.com/cache">version that Joel Perras rolled into a plugin</a>.  Joel&#8217;s version is also updated to use the CakePHP clearCache function.</p>
<p>The second post from Debuggable is a <a href="http://debuggable.com/posts/what-is-a-test-case-especially-in-cakephp:4a2e86b5-015c-4536-aec1-5cf04834cda3">quick intro on unit tests in CakePHP</a> and has some good links on getting started.</p>
<h4>Sending Email with GMail</h4>
<p>Marc Grabanski has a post on using the <a href="http://bakery.cakephp.org/articles/view/updated-swiftmailer-4-xx-component-with-attachments-and-plugins">SwiftMailer component</a> to <a href="http://marcgrabanski.com/article/cakephp-email-google-apps-gmail">send email via Gmail</a>.  Another way to do this, assuming you have control over your server, is to install <a href="http://msmtp.sourceforge.net/">msmtp</a> and set your sendmail_path in php.ini to use it.  I&#8217;ll post about it if anyone&#8217;s interested.</p>
<h4>Simplifying Controller with Exceptions</h4>
<p>Mark Story has a post of using <a href="http://mark-story.com/posts/view/simplifying-controller-logic-with-exceptions">PHP&#8217;s try&#8230;catch() handling to clean up controllers and components</a>.  </p>
<h1>Code</h1>
<h4>AutoLogin Component</h4>
<p>I should have mentioned this one in the last digest, but completely wiffed.  Miles Johnson released an <a href="http://www.milesj.me/resources/script/auto-login-component">AutoLogin component</a> which allows you to add a checkbox to your login form, so that returning visitors can bypass the login.</p>
<h4>Commentable Behavior</h4>
<p>Jose Diaz-Gonzalez released<a href="http://josediazgonzalez.com/posts/view/2/Commentable_Behavior"> a behavior to allow comments to be tied to any model</a>.  </p>
<h4>Filter Component</h4>
<p>Ever wanted to apply a filter to your paginated list?  James Fairhurst makes it easy with his <a href="http://www.jamesfairhurst.co.uk/posts/view/cakephp_filter_component">Filter Component</a>.  Unfortunately there&#8217;s no download for this one, so be prepared to ctrl-c and ctrl-v.</p>
<h4>CouchDB</h4>
<p>If you&#8217;re into non-relational databases you might want to check out this <a href="http://www.littlehart.net/atthekeyboard/2009/06/05/a-simple-couchdb-datasource/">Couch DB datasource</a> from Chris Hartjes.  Or take a look at the <a href="http://groups.google.com/group/cake-php/browse_thread/thread/f0eaa55149d7ddb3?hl=en#">improved version</a> from Gwoo.</p>
<h4>Interactive Plugin for the DebugKit and Console</h4>
<p>This is one of mine.  The <a href="http://www.pseudocoder.com/archives/2009/06/09/interactive-plugin-for-cakephp-console-and-debugkit/">Interactive Plugin</a> lets you quickly run commands against your Cake app.  I saved about 30 minutes of debugging using this to fix an issue today.  </p>
<h1>I&#8217;m Out!</h1>
<p>Don&#8217;t forget to <a href="http://feeds.feedburner.com/pseudocoder">subscribe to my feed</a> or <a href="http://twitter.com/mcurry">follow me on twitter</a>.</p>
<p>As always if you think I missed something leave a comment.  Or if you do something interesting and want it included in the next digest, <a href="mailto:matt@pseudocoder.com">send me an email</a>.</p>
<img src="http://feeds.feedburner.com/~r/pseudocoder/~4/NhjMn6PkWGw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.pseudocoder.com/archives/2009/06/18/cakephp-digest-16/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>CakePHP Book and Code Updates</title>
		<link>http://www.pseudocoder.com/archives/2009/06/12/cakephp-book-and-code-updates/</link>
		<comments>http://www.pseudocoder.com/archives/2009/06/12/cakephp-book-and-code-updates/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 05:36:23 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[GitHub]]></category>

		<guid isPermaLink="false">http://www.pseudocoder.com/?p=894</guid>
		<description><![CDATA[The Book
For anyone who missed it, I released a free CakePHP book a month ago.  Since then it&#8217;s been downloaded over 2500 times.  I&#8217;ve also received some great feedback and have made a bunch of corrections to the code and grammar.  The biggest change is that the table of contents is now [...]]]></description>
			<content:encoded><![CDATA[<h1>The Book</h1>
<p>For anyone who missed it, <a href="http://www.pseudocoder.com/archives/2009/05/13/free-cakephp-e-book-super-awesome-advanced-cakephp-tips/">I released a free CakePHP book</a> a month ago.  Since then it&#8217;s been downloaded over 2500 times.  I&#8217;ve also received some great feedback and have made a bunch of corrections to the code and grammar.  The biggest change is that the table of contents is now links and will jump you right to the section.  That&#8217;s reason enough alone to grab the updated version.  The <a href="/free-cakephp-book/">new permanent home page for the book is here</a>.</p>
<p><span id="more-894"></span></p>
<h1>Interactive Console and DebugKit Panel</h1>
<h4>Github Link</h4>
<p><a href="http://github.com/mcurry/interactive">http://github.com/mcurry/interactive</a></p>
<h4>Updates</h4>
<p>I fixed a couple issues that were pointed out in <a href="http://www.pseudocoder.com/archives/2009/06/09/interactive-plugin-for-cakephp-console-and-debugkit/#comments">the comments of the announcement post</a>.</p>
<p>One of the suggestions was to have the up arrow cycle previous commands when using this in the console.  It&#8217;s a great idea and actually works magically on ForTheWindows.  I checked it out and I didn&#8217;t see a way to make it happen for all systems though.  So, I did the next best thing.  Hitting enter on a blank line re-runs the previous commands.  Entering &#8216;h&#8217; brings up a list of the last 20 commands and you can run one by just entering the number.  Command history is also saved across sessions, so you can exit and go back in and still run old commands.</p>
<h1>Custom Find</h1>
<h4>Github Link</h4>
<p><a href="http://github.com/mcurry/find">http://github.com/mcurry/find</a></p>
<h4>Pagination</h4>
<p>I pulled in some of the ideas from <a href="http://code621.com/content/10/easy-pagination-using-matt-curry-s-custom-find-types">Daniel Salazar&#8217;s post</a> and now the custom find types have built in pagination support.  It&#8217;s kind of scary how easy it is.  Here&#8217;s an example:</p>
<pre name="code" class="php">
$this->paginate = am($this->paginate, $this->Post->find('published', array('paginate' => true)));
$this->set('posts', $this->paginate());
</pre>
<p>This only works if you are still using one of the default find types to run the actual query, as opposed to Model::query();</p>
<h4>Extending Model</h4>
<p>I struggled with how to make this plugin easy to install.  I didn&#8217;t want to force people to have to copy and paste a bunch of code into their AppModel.  I felt like that would make updates harder and would just make AppModel too messy.  So instead I recommend that you have your AppModel extend FindAppModel instead of Model.  FindAppModel in turn extends Model.  Multiple inheritance would come in handy here.</p>
<h1>Ajax Chat</h1>
<h4>Github Link</h4>
<p><a href="http://github.com/mcurry/chat">http://github.com/mcurry/chat</a></p>
<h4>Updates</h4>
<p>A couple small changes here.  The helper now handles cake installs that aren&#8217;t running in webroot automatically, so you don&#8217;t have to set it in the JavaScript manually.  Also the posted chat message now appears instantly in the chat window.  Before you&#8217;d have to wait for an update for the message to appear.</p>
<h1>Asset</h1>
<h4>Github Link</h4>
<p><a href="http://github.com/mcurry/asset">http://github.com/mcurry/asset</a></p>
<h4>Updates</h4>
<p>The order that scripts and codeblocks is now maintained.  The previous version always put codeblocks after scripts, but there are times when the codeblock needs to go before a script.  The new version keeps everything in the order that it was entered.  This means if you do script1, codeblock, script2 that the two scripts won&#8217;t be merged because it is assumed that the codeblock is dependent on script1 and script2 is dependent on the codeblock.</p>
<h1> JS Validate</h1>
<h4>Github Link</h4>
<p><a href="http://github.com/mcurry/js_validate">http://github.com/mcurry/js_validate</a></p>
<h4>Updates</h4>
<p>I merged a couple changes from <a href="http://github.com/javierm/js_validate/">javierm&#8217;s fork</a>.  These include a fix for the numeric check, matching Cake&#8217;s default error HTML and including the fieldName when calling custom rules, which should make doing Ajax validation much easier.  I&#8217;ll have a post showing some examples of this next week.</p>
<img src="http://feeds.feedburner.com/~r/pseudocoder/~4/k4yuP-vCbX0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.pseudocoder.com/archives/2009/06/12/cakephp-book-and-code-updates/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Interactive Plugin For CakePHP Console and DebugKit</title>
		<link>http://www.pseudocoder.com/archives/2009/06/09/interactive-plugin-for-cakephp-console-and-debugkit/</link>
		<comments>http://www.pseudocoder.com/archives/2009/06/09/interactive-plugin-for-cakephp-console-and-debugkit/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 04:18:40 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[GitHub]]></category>

		<guid isPermaLink="false">http://www.pseudocoder.com/?p=893</guid>
		<description><![CDATA[I teased this on twitter last week, so here&#8217;s the official release.  The interactive plugin is a super easy way to run code against your Cake app.  You can use it either through a custom panel in the DebugKit or from the command line as a shell.  
Download
Get it at GitHub

Instructions
I&#8217;ll skip [...]]]></description>
			<content:encoded><![CDATA[<p>I <a href="http://twitter.com/mcurry/status/2025484655">teased this on twitter last week</a>, so here&#8217;s the official release.  The interactive plugin is a super easy way to run code against your Cake app.  You can use it either through a custom panel in the <a href="http://thechaw.com/debug_kit">DebugKit</a> or from the command line as a shell.  </p>
<h4>Download</h4>
<p><a href="http://github.com/mcurry/interactive">Get it at GitHub</a></p>
<p><span id="more-893"></span></p>
<h4>Instructions</h4>
<p>I&#8217;ll skip the install instructions, since they&#8217;re <a href="http://github.com/mcurry/interactive/raw/de04f4ae0cdd04113a2761082e15e77c0833989c/README">included in the README</a>.  It&#8217;s pretty easy to install.  If you&#8217;re using the latest stable release of the DebugKit you do need to apply a patch for better plugin handling.  That fix is already in the trunk, so it&#8217;s not a dirty hack.</p>
<h4>What It Can Do</h4>
<p>Let&#8217;s get right to the good stuff.</p>
<h4>Run Simple PHP</h4>
<p>Pretty much any simple PHP commands will run:</p>
<pre name="code" class="php">
10 % 4 //returns 2
is_array(49) //returns false
</pre>
<h4>Run SQL</h4>
<pre name="code" class="sql">
SELECT id FROM users WHERE email = 'test@test.com' //returns the id of the user
UPDATE posts SET published = false; //returns "No results found.", but does the update.
</pre>
<h4>Use Cake Functions</h4>
<pre name="code" class="php">
__('Test Message', true) //returns the translated text matching the msg id for your current language.
Configure::write('Config.language', 'es');
__('Test Message', true); //returns the translated text in Spanish.
</pre>
<h4>Use Cake Libs</h4>
<pre name="code" class="php">
Security::hash('my_pAssw0rd', null, true) //returns the hashed password
Set::extract('/id', array(array('id' => 3), array('name' => 'test', 'id' => 4))) //array(3, 4)
</pre>
<h4>Use Cake Helpers</h4>
<pre name="code" class="php">
$html->link('Posts', array('controller' => 'posts')) //the html code for the link and the link itself
$form->input('Post.title'); //the html code for the field and the field itself
</pre>
<h4>Use Your App Code</h4>
<pre name="code" class="php">
Post::find('first') //The first record from your posts table
User::findById(3) //The user record for id 3
</pre>
<h4>Debugging</h4>
<p>If you have a command that isn&#8217;t returning the results you expect, you can turn on debug first:</p>
<pre name="code" class="php">
Configure::write('debug', 2);
User::findByIdd(3) //will show error output
</pre>
<h4>Notes</h4>
<p>When using through the DebugKit you can stack commands, just separate them with a &#8220;;&#8221;.  However you can&#8217;t define a variable in one command then use it in another.  For example this doesn&#8217;t work:</p>
<pre name="code" class="php">
$i = 10;
$i ++;
echo $i;
</pre>
<p>You&#8217;ll also notice I never explicitly declared any of the models I was using.  The plugin does this automatically.  You can write your model calls statically or just pretend you have an instance.  These are all the same and will work:</p>
<pre name="code" class="php">
Post::find('first');
$Post->find('first');
Post->find('first');
$this->Post->find('first');
</pre>
<h4>The DebugKit = Awesomeness</h4>
<p>Like most of you, I read <a href="http://mark-story.com/posts/view/extending-debugkit-the-new-javascript-features">this post from Mark Story on the new JavaScript for the DebugKit</a>.  Just reading that post, you don&#8217;t get a full appreciation for how much work he (and others) have put into it.  The JavaScript lib is virtually it&#8217;s own mini-framework.  Everything I needed to create this was already included &#8211; Ajax, Event handing, Elements&#8230;Really great stuff.  </p>
<h4>That&#8217;s About It</h4>
<p>Let me know if you hit any commands you want to run that aren&#8217;t working.  I tried to cover most of the basics.  </p>
<img src="http://feeds.feedburner.com/~r/pseudocoder/~4/DoSS1F0CxJc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.pseudocoder.com/archives/2009/06/09/interactive-plugin-for-cakephp-console-and-debugkit/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Movie Review: Star Trek</title>
		<link>http://www.pseudocoder.com/archives/2009/06/03/movie-review-star-trek/</link>
		<comments>http://www.pseudocoder.com/archives/2009/06/03/movie-review-star-trek/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 04:18:02 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Movie Review]]></category>

		<guid isPermaLink="false">http://www.pseudocoder.com/?p=870</guid>
		<description><![CDATA[Preface
I&#8217;m going to be in the minority here, but I really didn&#8217;t like the new Star Trek movie.  It&#8217;s currently at 95% on Rotten Tomatoes.  Wow!  Really?  Did I see the same movie as everyone else?  Let&#8217;s get right into it&#8230;
This review is full of spoilers&#8230;I don&#8217;t make any effort [...]]]></description>
			<content:encoded><![CDATA[<h4>Preface</h4>
<p>I&#8217;m going to be in the minority here, but I really didn&#8217;t like the new Star Trek movie.  It&#8217;s currently at <a href="http://www.rottentomatoes.com/m/star_trek_11/">95% on Rotten Tomatoes</a>.  Wow!  Really?  Did I see the same movie as everyone else?  Let&#8217;s get right into it&#8230;</p>
<p><strong>This review is full of spoilers&#8230;I don&#8217;t make any effort to mark them or hide them.  Read at your own risk.</strong></p>
<p><span id="more-870"></span></p>
<h4>In The Before Time</h4>
<p>The movie opens with the USS George Kirk investigating a space &#8220;lighting storm&#8221;.  Emerging from the storm is a Romulan mining ship from 150 years in the future.  Remember this is a mining ship, not a military vessel.  It&#8217;s crewed by <strong>SPACE MINERS</strong>.  A short fight ensues the captain of the good guys ship shuttles over to the mining vessel where, after having some fancy holographs thrown at him, he is <strong>IMPALED BY A TRIDENT</strong>.   Before the Federation ship can be destroyed 800 are able to escape on shuttle craft.  Of course the filmmakers gloss over the fact that the shuttle craft have no warp drive.  How were they rescued?  And why didn&#8217;t the Romulan ship destroy them all?  Was it so badly damaged from the collision?  If so how does a ship from the future get repairs?  It&#8217;s not like they can just jet over to Mos Eisley for some body work.  </p>
<h4>The Childhood Years</h4>
<p>It would be a pretty short, but infinitely better, movie if the shuttle crafts had just been picked off by the space miners.  Unfortunately, they somehow made it to safety, which leads to a painful childhood Kirk scene.  We get that he&#8217;s rebellious, but also suicidal?  And these traits are what Starfleet is looking for in their starship captain aptitude test?  </p>
<h4>The Academy</h4>
<p>Flash forward another dozen years or so: Kirk is now drunken womanizer with no real aspirations.  Yet, he conveniently still lives near a Starfleet base and frequently visits bars populated by Starfleet cadets.  It&#8217;s almost pathetic.  Like he&#8217;s waiting for someone to notice him.  Eventually Captain Pike recognizes him because he wrote his Starfleet dissertation on the events that killed Kirk&#8217;s dad.  Not only does he recognize Kirk, but he invites him to join Starfleet Academey.  This isn&#8217;t some community college.  It&#8217;s <strong>FRIGGIN&#8217; STARFLEET ACADEMY</strong>.  It&#8217;s like Harvard, West Point, and Google all rolled into one.  And Kirk doesn&#8217;t even have to send an application or references or write a cheesy essay.  It&#8217;s no wonder that everyone hates him.  Is that another quality that Starfleet looks for in its captains?  </p>
<h4>Kobayashi Maru</h4>
<p>We all know from Star Trek II that Kirk cheated to &#8220;win&#8221; the Kobayashi Maru.  Basically he hacked (oh come on) the test and made it passable.  We actually get to see that scene play out and it&#8217;s really quite painful.  Kirk is completely arrogant and just looks pathetic.  I bet he uses an aimbot when playing Counter-Strike.  That fucker.</p>
<h4>Graduation</h4>
<p>Kirk is pretty close to being expelled, but thankfully there is a distress call from Vulcan.  The Starfleet Generals must have just finished a two day binge of Police Academy movies, because they get the brilliant idea of <strong>sending the cadets to deal with threat</strong>.  Conveniently, there are undermanned starships just sitting in space dock, including the brand new Enterprise.  Logically (for once), Kirk isn&#8217;t assigned to a ship, but thanks to some quick thinking by Bones he is infected with a strange disease and allowed on board.  That&#8217;s right, there is a Starfleet regulation that allows a doctor (not even the head doctor) to bring a patient infected with a potentially contagious disease on board during a crisis situation.</p>
<h4>On The Road</h4>
<p>As all the other ships take off for Vulcan, The Enterprise lags behind as young Sulu forgets to disengage the &#8220;parking break.&#8221;  The flagship of the Federation has a pilot that is so green he doesn&#8217;t even know how to go to warp.  Is this really the guy you want driving your ship as you head into an unknown situation?</p>
<p>And seriously, Kirk is the only one who figures out what&#8217;s going on?  <strong>PIKE WROTE A FUCKING THESIS PAPER ON THE ORIGINAL EVENT AND SPOCK IS A WALKING WIKIPEDIA</strong>.  But no one, only Kirk figures it out.  Even after they all agree, they still don&#8217;t warn the ships ahead of them or do anything different.  And guys it&#8217;s not a &#8220;trap&#8221; when the other ship doesn&#8217;t give a shit if you show up or not.  It&#8217;s not like the mining ship knew exactly where they Starfleet ships would appear and had a photon torpedo storm waiting.  They were stuck in a fixed orbit over the planet using the drill thingy. </p>
<p>This kills me about time travel in movies and TV.  Why didn&#8217;t Nero team up with Future Spock and just save Romulus this time around.  They had a 125 year head start.  This time they could make sure that Young Spock would be waiting with the red matter well in advance of the supernova hitting Romulus. </p>
<p>A couple other points here:</p>
<ul>
<li>Would the debris field from six destroyed starships really be that thick?  If that section of space was orange juice it would have been labeled extra pulp.</li>
<li>Did no one from Vulcan bother to send an updated distress call with some details of what was going on.  I know, I know: communications were blocked, but are there no shuttles?  Couldn&#8217;t someone have just warped a few parsecs and then sent a message?</li>
<li>Kirk made the connection that this was related to his dad&#8217;s death because of the similar &#8220;lighting storm&#8221;.  But wasn&#8217;t that storm caused by the wormhole, not the Romulan ship?  Why was the same anomaly detected near Vulcan?</li>
<li>Where the fuck was the Romulan ship the last 25 years?  Did they just hang out near the wormhole waiting for Spock?  How did they even know Spock would come through?  Was there an astrophysicist on the crew of the <strong>SPACE MINING VESSEL</strong>?</li>
<li>Was this crew of <strong>SPACE MINERS</strong> so hell bent on vengeance that they all just willing waited 25 years?  I guess if they have a holodeck it can make the wait bearable&#8230;</li>
<li>Did Starfleet not send another ship to investigate the anomaly?</li>
</ul>
<h4>Are We There Yet</h4>
<p>After about a fifteen minute trip the Enterprise arrives at Vulcan and is quickly disabled.  Right before Emperor Nero goes for the kill shot he pulls back, because he <strong>RECOGNIZES THE ENTERPRISE</strong>!  I guess with 25 years to kill you can read a lot about Spock, but that&#8217;s assuming the computers on his <strong>SPACE MINING SHIP</strong> already have that info.</p>
<p>Pike is forced to shuttle over to the enemy, because space drill blocks transporters and communications when enabled &#8211; <strong>AS A SIDE EFFECT</strong>, not by design.  If I&#8217;m the head of a space mining company 150 years in the future and I need a drill that can go to the center of the planet and someone comes to me with this thing, isn&#8217;t the fact that it inadvertently blocks communications and transport a deal breaker?  Do they have to knock 20K in gold-pressed latinum off the purchase price because of this?</p>
<p>The brilliant plan that Pike comes up with has Kirk, Sulu and a clearly not going to survive security officer sky jumping off the shuttle (which is probably outside the Vulcan atmosphere) and free falling onto the platform.  How about just firing a fucking laser beam at it?  Would that have been so hard?  Yeah, Nero would be pissed and probably destroy the Enterprise, but that&#8217;s a pretty fair trade for 8 billion Vulcans.  </p>
<p>Predictably, the guy with all the explosives dies after trying to be a hero and deploying his parachute at the last possible moment.  (before you comment that this was probably a homage to the original series where the random dude on the away team always dies&#8230;I get it).  After a <strong>SWORD FIGHT</strong> Sulu and Kirk fail to destroy the platform and end up falling off the edge only to be saved by Chekov&#8217;s mad transporter skillz.</p>
<h4>Meanwhile&#8230;</h4>
<p>On the Romulan ship they are preparing the red matter which is a vat of highly unstable and destructive materiel, where one drop can create a blackhole large enough to stop a star that has gone supernova or destroy a planet.  They acquired this vat from Spock who was going to use a single drop of it to save Romulus.  <strong>Why didn&#8217;t he just bring one drop, instead of a whole fucking keg?</strong>  That would have been too logical.</p>
<p>The reason the bad guy needed Pike is so that they could extract the code to the Earth defense grid.  Oh come on&#8230;really?  The Earth defense grid is password protected?  That&#8217;s it?  Did they at least make the password contain numbers and letters?  Plus the Romulan ship has pretty much dispatched all adversaries with ease.  They suddenly couldn&#8217;t get through an archaic (by their standards) defense grid?  And why didn&#8217;t Vulcan have the same setup?</p>
<h4>Boom Goes The Dynamite</h4>
<p>Spock realizes the planet is about to go boom and is forced to beam down to save the Vulcan elders, because, apparently, they decided a planetary crisis was a good time to have a sacred cave meeting with no access to communications or transporters.  Even stranger, <strong>Spock&#8217;s HUMAN mother is with them</strong>.  Is Spock&#8217;s mother the biggest wet blanket, ball and chain wife ever?  Did Spock&#8217;s dad try to sneak out for for some good times with the boys and get caught, then was forced to take her with him?  I can just imagine the buzzkill when the Spocks enter the cave together.  Ugh, he brought her again.  Most of you probably didn&#8217;t catch it, but when Vulcans are getting transported and the cliff collapses killing Spock&#8217;s mom, one of the Vulcans in the background give a slight fist pump.  It&#8217;s subtle.  Also it&#8217;s convenient that exactly six of them made it out of the cave, since there were only six transporter pads.  How great would it have been if seven had made it and they had to tell one of them &#8220;we&#8217;ll get you next time.&#8221;</p>
<h4>This Is Where It Really Falls Apart</h4>
<p>Vulcan is gone and Spock now wants to rendezvous with the rest of the fleet.  A <strong>HIGHLY EMOTIONAL</strong> (this is important later) Kirk wants to chase after Nero, who has now has targeted Earth.  Why Earth?  Didn&#8217;t he just accomplish his vengeance plan?  Spock has Kirk ejected from the ship, where he lands on the ice planet Hoth.  Rather then waiting for tauntauns from a nearby Starfleet outpost, Kirk decides it would be a good time for a walk.  Is he making the 14 mile trek to the outpost on foot?  This is better then just waiting to be picked up?  Once again, solid decision making from Kirk.  A <strong>painful chase scene right from the Phantom Menace/Lucas playbook</strong> ensues where Kirk is hunted by some of the native creatures.  </p>
<h4>Future Spock</h4>
<p>Ok, I can buy all the other huge leaps up until this point, but on a deserted ice planet Kirk happens upon Future Spock, who was stranded there by Nero, so he had a front row seat for Vulcan&#8217;s destruction.  Spock apparently knows that there is an outpost on the planet and how to get there, but didn&#8217;t think to actually go there and try to stop Nero.  And why the fuck is there an outpost on this planet?  What conceivable reason could they have had? </p>
<h4>Wait, It Gets Worse</h4>
<p>Spock reveals that he can beam Kirk to the Enterprise, despite not knowing where it is (how could they?) and that it&#8217;s traveling at warp speed.  How does he accomplish this bit of magic?  With a fucking formula!  That&#8217;s right.  No modifications are needed to the 150 year old transporter technology other then fixing up the code a bit.  Scotty, who was conveniently at the outpost, goes with Kirk.  First of all if I was Scotty you couldn&#8217;t drag me off that outpost.  You mean I can stay in this nice toasty igloo on a planet completely out of harm&#8217;s way or I can be the guinea pig for a high risk beam that will likely leave my arm coming out of my forehead and even if I&#8217;m lucky enough to survive I&#8217;ll probably get to witness Earth being destroyed and then die myself when Nero uses his future drilling weapons on my ship.  Fuck that, I&#8217;m staying here. </p>
<p>Second of all: why the fuck doesn&#8217;t Spock go?  You ready for this?  Because he thinks it will be a good bonding experience for Young Spock and Kirk.  That&#8217;s right,  <strong>Spock risks the fate of Earth, so that the Spock/Kirk bromance can blossom</strong>.  Wait, get this: for Kirk to succeed, Future Spock tells him he has to become captain of the Enterprise and the best way to do this is to get Young Spock to flip out by bringing up his dead mom.  We&#8217;ve already established that Kirk is a pretty big dick, so really this isn&#8217;t that much of a stretch.   The scene would have played out so much better if Spock had said: &#8220;To get control of the Enterprise you have to&#8230;&#8221;, then simultaneously Kirk and Spock said &#8220;&#8230;make Spock cry by ragging on him about his dead mom.&#8221;  Then they high-fived.</p>
<h4>The Fight</h4>
<p>After another wasted action scene where Scotty gets stuck in a water slide, Kirk and Scotty are captured and brought to the bridge.  Why didn&#8217;t Spock just throw them in the brig?  I think even Kirk was surprised; otherwise why did he try to evade the security guys?  After a dozen or so &#8220;yo mama&#8221; jokes Spock finally flips out when Kirk lets loose this gem: &#8220;Hey Spock, I think we both have the same lasting image of your mother.  The top of her head as she was going down.  OH, SNAP!&#8221;  Spock attacks Kirk, and then decides to step down as captain on his own.  Now remember that even though Nero killed Spock&#8217;s mom and destroyed his homeworld, Spock wasn&#8217;t going after him.  Kirk, whose Dad was also killed by Nero (this fact is now swept under the rug), is gung-ho on a suicide mission to stop Nero.  Which one of there two is letting their emotions affect their decisions?  If you answered Spock: Hi JJ Abrams, thanks for reading this.</p>
<h4>They Kiss And Make Up</h4>
<p>Spock runs off to his daddy and they have a heart-to-heart.  I&#8217;m not sure exactly what was said, since I was trying to burst my ear drums with my soda straw at this point.  Spock returns to the bridge and asks for the first officer&#8217;s job.  What a pussy!  He just got played by Kirk and now he comes begging for his old job back!  </p>
<p>Anyway, they have a new plan to warp into Saturn&#8217;s belt, then dramatically rise through the space cloud just like in every fan boys wet dream.  But then what?  Oh, Chekov has figured out a way to beam onto Nero&#8217;s ship.  How fucking timely.  </p>
<p>So they&#8217;re going to beam a whole fucking army on board, right?  Just Spock and Kirk? Really? But they&#8217;ll be double fisting phaser rifles and wearing bandoliers instead of shirts, right?  No?  </p>
<p>How about this for a better plan: Let&#8217;s just beam Pike right the fuck out of there, destroy the mining platform with our fricken laser beam, hail Nero and make fun of his dead wife and dead unborn baby so that we can lure him away from Earth and then beam about 400 photon torpedoes over, enjoy the explosion while cranking some Metallica, then go hit the space bar and get some hot green ass?  Whose against this plan?  Anyone?  I didn&#8217;t think so.</p>
<h4>The End&#8230;Thankfully</h4>
<p>I fucking hate scenes where the good guy has just a handgun and is against fifty bad guys with rifles, but the bad guys can&#8217;t make a shot for their life and the good guy is running through swarms of bullets making ridicules shots.  Don&#8217;t movie makers play Call of Duty on Xbox Live?  It just doesn&#8217;t work that way.  </p>
<p>You can pretty much guess what happens:  Kirk rescues Pike, Spock steals back his future ship, destroys the drill and lures Nero after him before engaging in high stakes game of chicken.  The resulting collision ignites the <strong>GIANT FUCKING VAT</strong> of red matter, which should probably engulf the entire milky way galaxy.  </p>
<p>Nero&#8217;s ship is disabled and will soon be destroyed by the ignited red matter and after refusing assistance <strong>KIRK OPENS FIRE ON HIM</strong>.  They should have had Kirk pull on a Judge Dredd helmet and say &#8220;I am the law.&#8221;  No one in the Federation was even a little pissed that Kirk didn&#8217;t capture Nero so he could stand trial &#8211; this was virtual street justice.</p>
<h4>Aftermath</h4>
<p>Kirk receives a medal for his part in the events.  Not really sure why.  Let&#8217;s break down what he did:</p>
<ul>
<li>Realized that Nero was attacking Vulcan &#8211; Result: no change &#8211; they still went with the same plan.</li>
<li>Attempted to destroy the mining platform on Vulcan &#8211; Result: fail.</li>
<li>Took over The Enterprise and went after Nero &#8211; Result: success, but only because Chekov figured out a way onto Nero&#8217;s ship.  If Chekov had been about 10 minutes faster and presented his plan why Spock was still in charge don&#8217;t you think Spock would have turned that ship right around and gone after Nero?</li>
<li>Rescued Pike &#8211; Result: success, I guess.  But they could have just beamed him out of there.  Plus it was Spock who did all the dirty work here.</li>
<li>Inspired the crew and earned their respect &#8211; Result: epic fail.  Kirk did everything he could to get rid of Spock, but that wimpy little bitch kept coming back.  He sexually harassed Uhura at every turn.
</ul>
<p>Oh, and wouldn&#8217;t you be pissed if you were one of the 12k surviving Vulcans and Earth was having a ceremony celebrating Kirk?   8 billion Vulcans just died.  Doing the math, the amount of mourning time is about 65 million years.  That sounds about right.</p>
<h4>A Few Other Things</h4>
<p>I hated how the main characters all rose to their positions.  Not one of them actually earned their jobs, except maybe Spock.  How would you feel if you were a starship pilot and spent years working your ass off and actually spent time in the field only to see Sulu promoted ahead of you.  Way to kill the moral of the entire fleet.</p>
<p>Not sure if you picked it up, but I wasn&#8217;t the biggest Kirk fan.  They really made him unlikable here.  I know Kirk is supposed to be brash and arrogant, but they really overdid.  He doesn&#8217;t have one redeeming scene in the whole movie.</p>
<h4>You&#8217;re All With Me Now, Right?</h4>
<p>I&#8217;m sure some of you will still disagree and that&#8217;s your right as a mentally challenged member of society.  I realize this was supposed to be a &#8220;fun, summer movie,&#8221; but does that really exclude having a decent plot with creative action sequences?  I really blame myself because all the warning signs were there in the trailer.  I just foolishly ignored them.  This is why I only go to the movies once a year.</p>
<img src="http://feeds.feedburner.com/~r/pseudocoder/~4/9_C3jjb-Xxs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.pseudocoder.com/archives/2009/06/03/movie-review-star-trek/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
		<item>
		<title>CakePHP Digest #15 – Blog Posts Edition</title>
		<link>http://www.pseudocoder.com/archives/2009/06/01/cakephp-digest-15-blog-posts-edition/</link>
		<comments>http://www.pseudocoder.com/archives/2009/06/01/cakephp-digest-15-blog-posts-edition/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 02:15:31 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[CakePHP Digest]]></category>

		<guid isPermaLink="false">http://www.pseudocoder.com/?p=867</guid>
		<description><![CDATA[In The Blogs
There were a ton of really good blog posts in the last couple weeks, so pretty much this entire digest is going to be blog posts.

Paginating Custom Find Type
Daniel Salazar has a great post on a simple way to paginate over custom find types.  It&#8217;s scary how easy it is and makes [...]]]></description>
			<content:encoded><![CDATA[<h1>In The Blogs</h1>
<p>There were a ton of really good blog posts in the last couple weeks, so pretty much this entire digest is going to be blog posts.</p>
<p><span id="more-867"></span></p>
<h4>Paginating Custom Find Type</h4>
<p>Daniel Salazar has a <a href="http://code621.com/content/10/easy-pagination-using-matt-curry-s-custom-find-types">great post on a simple way to paginate</a> over <a href="http://github.com/mcurry/find">custom find types</a>.  It&#8217;s scary how easy it is and makes it simple to have multiple pagination schemes per model without having to worry about creating paginate and paginateCount functions.</p>
<h4>How To Use Bake</h4>
<p><a href="http://fuelyourcoding.com/getting-to-know-cakephp-part-1">This tutorial on how to use bake</a> was hot on twitter.  Don&#8217;t get me wrong, bake is great, but if I&#8217;m introducing someone to Cake showing them the command line bake tool isn&#8217;t the first place I&#8217;d start.  </p>
<h4>Pagination Sort Direction</h4>
<p>Richard@Home has <a href="http://www.richardathome.com/blog/cakephp-extend-paginatorhelper-indicate-sort-field-and-direction">a quick post on how to add a CSS class to the paginated columns</a> that can be used for adding a direction arrow.  Crazy that this isn&#8217;t part of the core, right?  If you don&#8217;t want to create a new helper, you can accomplish the same thing using an element applied to the &lt;th> tag.</p>
<h4>Styling Flash Messages</h4>
<p>James Fairhurst awoke from a six month coma and posted a pair of new articles.  The more interesting one is on <a href="http://www.jamesfairhurst.co.uk/posts/view/custom_cakephp_flash_messages_updated">using layouts for flash messages</a>.</p>
<h4>Tips For Using Accented Characters</h4>
<p>Jimmy Bourassa has a <a href="http://www.webiscake.com/common-mistakes-when-with-accentuated-characters/">series of tips on how to successfully use accented characters</a>.  His post can pretty much be summed up as: use UTF-8 or fail hard.</p>
<h4>Redefine HTML Tags</h4>
<p>Flipflops.org has another simple, but extremely useful tip on how to <a href="http://www.flipflops.org/2009/05/23/overload-this-tags-this-map-in-apphelper/">redefine the html tags that Cake uses if you don&#8217;t like the defaults</a> (see part 2).</p>
<h1>In The Wild</h1>
<h4>dogcommanger.com</h4>
<p>From <a href="http://twitter.com/rsrose">@rsrose</a>: <a href="http://www.dogcommander.com/">dogcommander.com</a></p>
<h1>Code</h1>
<h4>Integrating Facebook Connect With The Auth Component</h4>
<p>Before I post the link, let me preface by saying don&#8217;t actually use this code verbatim.  You&#8217;d be much better served rolling this into it&#8217;s own component (preferably as a plugin), rather then just putting it all in your AppController.  Anyway, <a href="http://cutfromthenorth.com/integrating-facebook-connect-with-cakephps-auth-component/">here it is</a>.</p>
<h1>I&#8217;m Out!</h1>
<p>And on that note don&#8217;t forget to <a href="http://feeds.feedburner.com/pseudocoder">subscribe to my feed</a> or <a href="http://twitter.com/mcurry">follow me on twitter</a>.</p>
<p>As always if you think I missed something leave a comment.  Or if you do something interesting and want it included in the next digest, <a href="mailto:matt@pseudocoder.com">send me an email</a>.</p>
<img src="http://feeds.feedburner.com/~r/pseudocoder/~4/oA-aKUxW2rE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.pseudocoder.com/archives/2009/06/01/cakephp-digest-15-blog-posts-edition/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Connecting CakePHP Plugins</title>
		<link>http://www.pseudocoder.com/archives/2009/05/29/connecting-cakephp-plugins/</link>
		<comments>http://www.pseudocoder.com/archives/2009/05/29/connecting-cakephp-plugins/#comments</comments>
		<pubDate>Fri, 29 May 2009 05:23:41 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://www.pseudocoder.com/?p=861</guid>
		<description><![CDATA[Today I wrote a CakePHP plugin for localizing JavaScript files.  Basically it allows you to use the translate convenience function, __(), in your JavaScript files and will cache the results so that the static file can be used on all subsequent requests.  Way back I wrote an asset plugin that combines and compacts [...]]]></description>
			<content:encoded><![CDATA[<p>Today I wrote <a href="http://github.com/mcurry/js/">a CakePHP plugin for localizing JavaScript files</a>.  Basically it allows you to use the translate convenience function, __(), in your JavaScript files and will cache the results so that the static file can be used on all subsequent requests.  Way back I wrote <a href="http://github.com/mcurry/asset">an asset plugin that combines and compacts JS and CSS files automatically</a>.  I thought it would be cool if I could get the two plugins to work together, so that if they were both installed a localized, combined, and compacted JS file would be returned to the user.  </p>
<p><span id="more-861"></span></p>
<h4>Here&#8217;s The Trick</h4>
<p>In the asset plugin I needed to know if the localization plugin was also installed and if it was use it.  Cake&#8217;s App::import() function returns &#8220;boolean true if Class is already in memory or if file is found and loaded, false if not.&#8221;  Perfect.  I moved the majority of the localization plugin code to a model, JsLang.  Then I can simply do:</p>
<pre name="code" class="php">
$this->Lang = false;
if (App::import('Model', 'Js.JsLang')) {
  //plugin is installed.
  $this->Lang = ClassRegistry::init('Js.JsLang');
}
</pre>
<p>From there I can simply check if $this->Lang is not false and then use it for added functionality.  </p>
<h4>Beta Warning</h4>
<p>It&#8217;s pretty late and I&#8217;m programming on fumes, so assume that something is messed up somewhere.  Both plugins have pretty good test coverage, but that doesn&#8217;t mean I didn&#8217;t fuck something up somewhere.</p>
<h4>Plugins: USE THEM</h4>
<p>If you plan on releasing ANY CakePHP code, do it as a plugin.  There isn&#8217;t any reason not to.  Even if it&#8217;s the simplest of helpers, it&#8217;s worth it just to be able to provide unit test coverage.  </p>
<img src="http://feeds.feedburner.com/~r/pseudocoder/~4/sD359dGeu0Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.pseudocoder.com/archives/2009/05/29/connecting-cakephp-plugins/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Developers, Please Stop Fucking With Your JavaScript Files</title>
		<link>http://www.pseudocoder.com/archives/2009/05/21/developers-please-stop-fucking-with-your-javascript-files/</link>
		<comments>http://www.pseudocoder.com/archives/2009/05/21/developers-please-stop-fucking-with-your-javascript-files/#comments</comments>
		<pubDate>Fri, 22 May 2009 03:46:16 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.pseudocoder.com/?p=836</guid>
		<description><![CDATA[There have been waaaaaaayyyyyy too many posts lately on &#8220;supercharging&#8221; your JavaScript (and CSS) and creating &#8220;dynamic&#8221; JavaScript.  Bad. Bad. Bad Developers.  For an example of what I&#8217;m talking about take a look at this article (as posted on DZone), which got 18 up diggs and is described as &#8220;Best practices for Javascript [...]]]></description>
			<content:encoded><![CDATA[<p>There have been waaaaaaayyyyyy too many posts lately on &#8220;supercharging&#8221; your JavaScript (and CSS) and creating &#8220;dynamic&#8221; JavaScript.  Bad. Bad. Bad Developers.  For an example of what I&#8217;m talking about take a look at <a href="http://www.dzone.com/links/supercharging_javascript_in_php.html">this article (as posted on DZone)</a>, which got 18 up diggs and is described as &#8220;Best practices for Javascript delivery&#8230;&#8221;  Ugh.  I could write a &#8220;Best Practices For Taking A Dump&#8221; and it would come out smelling better then that post.  Let&#8217;s break it down&#8230;</p>
<p><span id="more-836"></span></p>
<h1>Client VS Server Side</h1>
<p>I don&#8217;t mean to focus on the supercharging article (which, unfortunately, also has a <a href="http://www.dzone.com/links/rss/supercharging_css_in_php.html">CSS version</a>), there are a bunch of others too (although most don&#8217;t stretch on for 7(!) pages).  Like <a href="http://net.tutsplus.com/tutorials/html-css-techniques/how-to-add-variables-to-your-css-files/">this one</a>, which caused me to lock myself in my office for 3 hours.  What happened during that time is buried so deep in my mind I&#8217;d need years of hypnotherapy to even scratch the surface.</p>
<p>The supercharging post opens with:</p>
<blockquote><p>I am an unapologetic stickler for speed when it comes to Web applications.</p></blockquote>
<p>Then he proceeds to show a method that effectively speeds up the client side of the app by slowing down the server side.  The net result: probably about the same as before.  </p>
<h4>Yslow Is To Blame</h4>
<p><a href="http://developer.yahoo.com/yslow/">Yahoo&#8217;s Yslow plugin</a> is to blame for a lot of this.  It&#8217;s provides nice, pretty grades and dares you to do better.  It even tells you where the problems are and how to fix them.  What&#8217;s the easiest way to do it?  Route all your JS files through your server side language!  No, no, no.  Wrong.  You see Yslow is only measuring front-end performance.  It doesn&#8217;t give a shit how long something takes to generate on the server.  To test that you should be using tools like <a href="http://httpd.apache.org/docs/2.0/programs/ab.html">ab</a> or <a href="http://freshmeat.net/projects/siege/">Siege</a>.   </p>
<h4>Why This Matters</h4>
<p>Your webserver, even Apache, can serve static .js and .css files a fuck ton faster then dynamic pages.  This is the point where you&#8217;ll counter with: &#8220;Fine.  It&#8217;s true I&#8217;m wasting some server resources, but everything will be cached on the client, so FU, it doesn&#8217;t really matter!&#8221;  Go ahead and read <a href="http://yuiblog.com/blog/2007/01/04/performance-research-part-2/">this article from YUI blog</a>.  Or I&#8217;ll just give you the conclusion:</p>
<blockquote><p>
Keep in mind the empty cache user experience. It might be more prevalent than you think!
</p></blockquote>
<h4>How Do I Know If I&#8217;m Doing It Wrong?</h4>
<p>1) You have something in your webserver&#8217;s configuration that routes .js or .css files to your server side language, like this:</p>
<pre name="code" class="html">
RewriteRule \.js$ lib/phpsprocket.php [QSA]
</pre>
<p> 2) You direct your javascript/css includes right to your programming language in your HTML, like this:</p>
<pre name="code" class="javascript">
&lt;script src="/javascript.php">&lt;/script>
</pre>
<h1>Making It Fast The Right Way</h1>
<h4>Make as Few HTTP Requests as Possible</h4>
<p>It&#8217;s a good thing to merge your static files into as few as possible (notice I didn&#8217;t say one &#8211; more on the later).  There are a bunch of different ways to do this.  Most commonly it should be part of your build routine.  This way the generated file can still be a static one and will be served up fast.  Heck, you could even go crazy and deploy it to a CDN. </p>
<p>Another way would be to have it process automatically the first time any user hits a page, as long as the results are stored as a static file for the next user.  If you use a framework there might already by <a href="http://github.com/mcurry/asset">a library that does this for you</a>.</p>
<h4>GZip Everything</h4>
<p>Something that can and should be done by your webserver.</p>
<h4>Minify Everything</h4>
<p>This should be part of the whatever process you have that combines your files.</p>
<h4>Caching on the Server</h4>
<p>Any static files that are cached on the server should be cached as plain .js or .css in a directory that is web accessible.  If you need to use any type of programming to read the cached file you are doing it wrong.</p>
<h4>Caching on the Client</h4>
<p>As part of the build routine, when you generate the minified and combined files, include either a timestamp or a version number (preferably) as part of the file name.  If you use a version number, then your HTML page (which is generated dynamically) can have access to that same number and can include it as part of the file name when it generates the tags to include your static files.</p>
<h1>Dynamic JavaScript</h1>
<p>I know what your thinking: &#8220;But, I need to pipe my javascript through the server side language so that I can generate custom code based on the user.&#8221;<br />
No.  No you don&#8217;t.  Do you think any site with more then three visitors a month does this?  Digg?  Amazon?  Twitter?   You will pry my web developer badge from my cold, dead, bullet ridden body before you convince me otherwise.</p>
<h1>The needs of the many outweigh the needs of the few&#8230;</h1>
<p>&#8230;or one.  Take a look at this simple scenario:  You have a JavaScript heavy website that uses jQuery and parts of the jQuery UI on every page.  Say you minify and combine those and they become one 100k file.  You also have page specific JavaScript files that are around 30k each.  If you were hell bent on only including one JavaScript file per page you&#8217;d end up with something like:<br />
Page 1: file1.js (130k)<br />
Page 2: file2.js (130K)</p>
<p>What if instead you left the files separate:<br />
Page 1: jquery.js (100k) + file1.js (30k)<br />
Page 2: file2.js (30k)</p>
<p>What about jquery.js on Page 2?  It would already have been loaded and cached by the browser on Page 1.  And if you are using the trick of including the version as part of the file name and setting a far future expires date, the browser won&#8217;t even make a request for the file.  </p>
<p>All I&#8217;m saying here is be smart.  It makes more sense to logically group your files and then include the groups you need for a particular page, rather then having one giant file that gets downloaded on every page because 25% of it is different then the other pages.</p>
<h1>Wrapping It Up</h1>
<p>Please developers, just leave your JavaScript and CSS files as static files.  It&#8217;s cool if you want to mess with them a bit, but make sure the final output is still a plain static file.  </p>
<img src="http://feeds.feedburner.com/~r/pseudocoder/~4/qlMungsazC8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.pseudocoder.com/archives/2009/05/21/developers-please-stop-fucking-with-your-javascript-files/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>CakePHP Digest #14</title>
		<link>http://www.pseudocoder.com/archives/2009/05/18/cakephp-digest-14/</link>
		<comments>http://www.pseudocoder.com/archives/2009/05/18/cakephp-digest-14/#comments</comments>
		<pubDate>Tue, 19 May 2009 03:30:59 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[CakePHP Digest]]></category>

		<guid isPermaLink="false">http://www.pseudocoder.com/?p=824</guid>
		<description><![CDATA[Prelude
I&#8217;m back.  The project  that has been my taking up my daily supply of quality thoughts is done.  This post will be twice as good as the last one.  Unfortunately, the last one was like a 1.5 out of ten, so you&#8217;re only getting a 3 here.
Let&#8217;s spice this one and [...]]]></description>
			<content:encoded><![CDATA[<h1>Prelude</h1>
<p>I&#8217;m back.  <a href="http://www.pseudocoder.com/archives/2009/05/13/free-cakephp-e-book-super-awesome-advanced-cakephp-tips/">The project</a>  that has been my taking up my daily supply of quality thoughts is done.  This post will be twice as good as <a href="http://www.pseudocoder.com/archives/2009/05/04/cakephp-digest-13/">the last one</a>.  Unfortunately, the last one was like a 1.5 out of ten, so you&#8217;re only getting a 3 here.</p>
<p>Let&#8217;s spice this one and give it a theme: &#8220;Acceptable phrases with NSFW origins.&#8221;  For example: With the release of my CakePHP book I really opened up the kimono on all my accumulated knowledge.  Got it?  See if you can find them all.  BTW, this is the last time I&#8217;ll <a href="http://www.pseudocoder.com/archives/2009/05/13/free-cakephp-e-book-super-awesome-advanced-cakephp-tips/">plug the book</a> in this post.  Really.</p>
<p><span id="more-824"></span></p>
<h1>News</h1>
<p>Yet another internationalized CakePHP site goes up: <a href="http://www.cakephp.com.br">cakephp.com.br</a>.  This one is for the Brazilian users.<br />
Saudações brasileiras Bakers! Sabia que eu escrevi <a href="http://www.pseudocoder.com/archives/2009/05/13/free-cakephp-e-book-super-awesome-advanced-cakephp-tips/">um livro</a>? Eu sei que prometi não mencioná-la novamente, mas esses idiotas falam Inglês não vai saber a diferença.</p>
<h1>Tickets and Commits</h1>
<p><a href="https://trac.cakephp.org/report/1">The current list of open bugs</a> is pretty short and over half of them have been assigned, which usually means they&#8217;ll get marked invalid and disappeared soon or fixed&#8230;sometimes they get fixed.  They all seem pretty obscure &#8211; 2 of them deal with email and 3 with MSSQL.  Nothing like the XSS issue from last time that had Cake bent over a table.</p>
<h1>In The Wild</h1>
<h4>Starcraft 2 Armory</h4>
<p><a href="http://www.milesj.me/blog/read/36/fresh-websites-fresh-updates">Miles Johnson announced</a> the relaunch of <a href="http://www.sc2armory.com/">Starcraft 2 Armory</a>.  Starcraft 2 is the forthcoming prequel to the somewhat popular <a href="http://ign64.ign.com/objects/003/003894.html">N64 game: StarCraft 64</a> released in 2000.  Almost ten years between games can really build up a lot of expectations.  Let&#8217;s hope they didn&#8217;t shoot their load on the first one and still have something left.  Oddly, the series skips from chapter 64 to chapter 2.  Not sure why they didn&#8217;t just go all the way back and do chapter 1.  Weird.</p>
<h4>tutrme</h4>
<p>The domain is <a href="http://tutrme.com/">tutrme.com</a>, which is short for &#8220;tutor me.&#8221;  It&#8217;s a site for matching tutees and tutors.  </p>
<h1>In The Blogs</h1>
<p>Nothing really stood out to me.  clown-hat-frowny-face <:(</p>
<h1>In The Groups</h1>
<h4>What do you hate about CakePHP?</h4>
<p>The most interesting topic was &#8220;<a href="http://groups.google.com/group/cake-php/browse_thread/thread/134b180ce477b9ef">what do you hate about CakePHP?</a>&#8221; started by Nate.  Of course, anyone whose reading this has already seen it, so I really should dig around and find some less traveled threads.  </p>
<h4>Johnny Two Times</h4>
<p>Like <a href="http://groups.google.com/group/cake-php/browse_thread/thread/f0f17b4f7151139f">this one</a>, which cracked me up because of the topic and the second and third posts.</p>
<h4>Yes, there&#8217;s a function for that</h4>
<p>Or <a href="http://groups.google.com/group/cake-php/browse_thread/thread/ad0b6c46a645597d">this thread where I learned about Controller::disableCache</a>.  Seriously, Cake has a function for everything.  Unless you&#8217;re balls deep in the API there&#8217;s no way you can know them all.</p>
<h1>Code</h1>
<h4>DebugKit</h4>
<p>Mark Story has released the <a href="http://mark-story.com/posts/view/debugkit-1-1-released">latest version of the DebugKit</a>.  Also it&#8217;s been over <a href="http://mark-story.com/posts/view/year-one-of-baking-cakephp">one year since Mark made his first CakePHP commit</a>.  Since then he&#8217;s averaged almost 3 commits a day between the various CakePHP projects.  It&#8217;s almost like he gets off on it, which is awesome for us since he produces some great output.  Umm&#8230;Uh&#8230;let&#8217;s just move on&#8230;</p>
<h4>Check back in a few days</h4>
<p>I had marked this <a href="http://bakery.cakephp.org/articles/view/counter-cache-behavior-for-habtm-relations">HABTM counter cache behavior</a> for later reading, but unfortunately there was some change, so it&#8217;s waiting to be approved again &#8211; what a pain in the ass. </p>
<h4>Vimeo Datasource</h4>
<p>I&#8217;m a sucker for datasources &#8211; <a href="http://bakery.cakephp.org/articles/view/vimeo-datasource">here&#8217;s one for the Vimeo API</a>.</p>
<h1>I&#8217;m Out!</h1>
<p>Don&#8217;t forget to <a href="http://feeds.feedburner.com/pseudocoder">subscribe to my feed</a> or <a href="http://twitter.com/mcurry">follow me on twitter</a>.</p>
<p>As always if you think I missed something leave a comment.  Or if you do something interesting and want it included in the next digest, <a href="mailto:matt@pseudocoder.com">send me an email</a>.</p>
<img src="http://feeds.feedburner.com/~r/pseudocoder/~4/0QoZejeprW0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.pseudocoder.com/archives/2009/05/18/cakephp-digest-14/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Free CakePHP E-Book – Super Awesome Advanced CakePHP Tips</title>
		<link>http://www.pseudocoder.com/archives/2009/05/13/free-cakephp-e-book-super-awesome-advanced-cakephp-tips/</link>
		<comments>http://www.pseudocoder.com/archives/2009/05/13/free-cakephp-e-book-super-awesome-advanced-cakephp-tips/#comments</comments>
		<pubDate>Thu, 14 May 2009 02:48:32 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://www.pseudocoder.com/?p=796</guid>
		<description><![CDATA[For those of you who just want the book
This is the download link &#8212;> Super Awesome Advanced CakePHP Tips
Updated to V1.1, fixing a few small things.
For those that want a 1500 word blog post
I&#8217;ve been sitting on this thing for the last two weeks and figure it&#8217;s about time I just let it out.  [...]]]></description>
			<content:encoded><![CDATA[<h1>For those of you who just want the book</h1>
<p>This is the download link &#8212;> <a href="http://www.pseudocoder.com/free-cakephp-book/">Super Awesome Advanced CakePHP Tips</a><br />
Updated to V1.1, fixing a few small things.</p>
<h1>For those that want a 1500 word blog post</h1>
<p>I&#8217;ve been sitting on this thing for the last two weeks and figure it&#8217;s about time I just let it out.  Ahhhh&#8230;.so much better.  Now, about the book.  What better way to introduce it then a fake interview?  Off we go!</p>
<p><span id="more-796"></span></p>
<p><strong>What exactly is this thing and why should I waste my precious bowl time reading it?</strong><br />
At the moment there is no lack of <a href="http://www.pseudocoder.com/archives/2008/02/10/cakephp-tutorials/">CakePHP books geared towards beginners</a>.  But, there really isn&#8217;t much for anyone who has mastered the basics and wants to do more.  This e-book is for you guys and gal (I&#8217;m sure there&#8217;s at least one out there somewhere).    </p>
<p><strong>I suck at CakePHP.  What&#8217;s the best way to learn the basics so I can get up to speed and read your book?</strong><br />
Check out Chapter 2: &#8220;How to Learn CakePHP&#8221;.  It details two paths for learning the framework &#8211; a free one and a pay one.  I&#8217;m interested in feedback here, since it&#8217;s hard for me to remember what it&#8217;s like learn the framework.  I just remember being really frustrated at times and blacking out, only to awaken covered in blood and standing over a dead hobo.  Not good times.</p>
<p><strong>How much is this thing going to cost me?</strong><br />
Nothing.  It&#8217;s free.</p>
<p><strong>No really.</strong><br />
Seriously. Free.  You know how when you&#8217;re watching an independent movie or playing an indy video game you cut it some extra slack and overlook a few minor flaws?  Do that there too.  Thanks.</p>
<p><strong>When did you start working on this?</strong><br />
The original idea was hatched in December 2007.  At the time I was planning on writing a <a href="http://www.pseudocoder.com/archives/2007/12/26/advanced-cakephp-series/">series of Advanved CakePHP posts</a>.  After I had 12-15 or so I was going to roll them into an e-book.  Naturally <a href="http://www.pseudocoder.com/archives/category/cakephp-tutorial/">I fizzled out after 2 posts</a>.</p>
<p>Fast Forward to Oct 08 and I&#8217;m sent a copy of <a href="http://www.pseudocoder.com/archives/2009/01/15/book-review-cakephp-application-development/">CakePHP Application Development to review</a>.  I realized as I was reading it (and <a href="http://www.pseudocoder.com/archives/2009/01/15/book-review-cakephp-application-development/comment-page-1/#comment-3167">confirmed by one of the comments on that post</a>) that there was a lack of upper level Cake books/documentation.  I also realized that in the year since I&#8217;d given up on the advanced series I had a bunch of decent posts that, once I cleaned out all the cursing and porn references, would make a decent e-book.  </p>
<p><strong>It&#8217;s kind of dick of you to spend all this time creating an e-book, but then hardly contribute to the Cookbook.  Do you feel any remorse or are you so hell bent on personal glory that it has crushed all rational thought in your oddly shaped head?</strong><br />
I struggled with this &#8211; I really did.  In my defense I would say most of the content of the book isn&#8217;t really appropriate for the Cookbook.  That still doesn&#8217;t excuse why I haven&#8217;t contributed more.  Although the Cookbook is great there are gaps (though they&#8217;re becoming harder to find).  I don&#8217;t know&#8230;maybe it&#8217;s because I spend more time in the API or maybe I&#8217;m still bitter that tempdocs, which served me so well, was whacked without even given a chance to make a tearful deathbed speech.  </p>
<p><strong>What IDE did you use to create the book?</strong><br />
I actually went through two before settling on Open Office.  I started with Google Docs, because I figured it would be cool to be able to write whenever/wherever I got inspired.  By about 30 pages Google Docs started to really choke, plus the PDF generation was mediocre at best. </p>
<p>I moved the whole thing to Word and spent like a week re-doing all the styles.  But Word just gave me other problems.  Whole pages would disappear until I scrolled around a bit and then they&#8217;d randomly re-appear.  Plus I tried a bunch of different PDF printers and they all sucked.  </p>
<p>Finally, I moved to Open Office and wasted another week fixing the styles again.  This time everything worked pretty well and the built in PDF generator actually did a decent job.</p>
<p><strong>Is this what you&#8217;ve been busy with and why you haven&#8217;t blogged as much and when you do blog the posts blow?</strong><br />
Yea, pretty much.  I&#8217;m also obsessed with converting all <a href="http://github.com/mcurry">my open source Cake code into plugins</a>.  I&#8217;m all over plugins like a meathead frat dude trying to impress his buddies as a way to cope with his feelings of inadequacy when he sees a slightly unattractive chick with self esteem issues whose had too much to drink.</p>
<p><strong>What&#8217;s with the Mark Story sections?</strong><br />
This one is going to take a bit.  Way back in the pre-RC days of 1.2 if you used the console to bake model tests the <a href="https://trac.cakephp.org/changeset/7747/">resulting test cases would have to extend the model and set the database to use the test_suite</a>.  This approached sucked and there was a better way.  If you used the ClassRegistry to get an instance of the model it would set the database automatically.  When I was putting the book together I knew I wanted to include a section of fixing the model unit test.</p>
<p>I also had an inkling I wanted to do a proper view unit test section.  It would have been a gaping goatse-esq hole if I had a section of M(odels) and V(iews) and not C(ontrollers).  Before I could get my shit together and write it <a href="http://mark-story.com/posts/view/testing-cakephp-controllers-the-hard-way">Mark&#8217;s article came out</a>.  Fuck.  It was good and I really hated the thought of re-writing the same thing.  </p>
<p>So, I got the brilliant idea to get others to contribute sections.  I emailed Mark and a bunch of other Cake devs to see if they were interested.  Predictably, everyone was too busy raking in that phat CakePHP bank to contribute.  Except for Mark who not only agreed to let me use that piece, but also his forthcoming (at the time), <a href="http://mark-story.com/posts/view/testing-cakephp-controllers-mock-objects-edition/">landmark, life altering, spiritually awakening piece on mock objects</a>.  *genuflect*</p>
<p><strong>Why not charge $$$ for this thing?</strong><br />
Another long answer.  Continuing the above section&#8230;sometime later I realized that Cake had actually fixed the core to generate better tests and my Model section was pretty much shot.  But at this point I already had Mark on board, so to sell this thing I would either have to a)cut his part and lose like 1/3 of the book or b) negotiate some sort of split.  </p>
<p>Realistically I knew this thing wasn&#8217;t going to make a ton of loot.  Certainly not enough add another wing to the PseudoCoder estate.  Take a look at <a href="http://ejohn.org/blog/programming-book-profits/">this post from John Resig</a>.  It&#8217;s a little unclear how much he&#8217;s made on that book, <del datetime="2009-06-06T01:54:42+00:00">since he never reveals how much he received up front</del> <ins datetime="2009-06-06T01:54:42+00:00">$7500</ins>.  What is clear is that he isn&#8217;t killing it.  I mean, if the fricking creator of jQuery can&#8217;t make a fuck ton of cash on a JavaScript book&#8230;really, what chance do the rest of us have?  It&#8217;s John Fucking Resign, writing about JavaFuckingScript!  Shouldn&#8217;t this be the #1 best seller of all time, crushing The Bible like an empty Miller High Life against it&#8217;s forehead?</p>
<p><strong>This book is so full of typos, grammar mistakes and bad code.  Where should I send my bitchy emails?</strong><br />
Take your pick &#8211; all of these people took the time to proof read it and gave me immensely helpful feedback.<br />
Paddy Foran (<a href="http://www.pennedby.me/">blog</a>) &#8211; Paddy sent me about 100 pages of speling, grammer and typeos, which is amazing since the book is only 64 pages.  I dare you to find a mistake that he missed and then harass him endlessly about it.  <strong>I DARE YOU</strong>.</p>
<p>Shawn Poulson (<a href="http://www.explodingcoder.com/">blog</a>, <a href="http://friendfeed.com/spoulson">friendfeed</a>, <a href="http://twitter.com/spoulson">twitter</a>) &#8211; Shawn helped fix my atrocious PERL regular expression skills as well as suggesting using the Heredoc syntax when including JavaScript in views.</p>
<p>Jonathan Langevin (<a href="http://www.phpsitesolutions.com/">site</a>, <a href="http://forum.phpsitesolutions.com/php-frameworks/cakephp/">cakephp forum</a>) &#8211; Jonathan sent me a bunch of spelling errors, which I probably could have figured out on my own if I those damn squiggly red lines under the words weren&#8217;t distracting me so much.</p>
<p>Heath and Sohaib &#8211; both challenged me on the &#8220;Getting the Logged In User from Anywhere&#8221; section.</p>
<p>Felix Geisendörfer (<a href="http://debuggable.com/">site</a>) &#8211; Felix is a superstar and provided some great pointers.</p>
<p>I&#8217;m sure I&#8217;m missing someone.  If you&#8217;re that someone, know that as angry as you are for not being mentioned, I feel 1/8 as bad for missing you.</p>
<p><strong>What as the most significant thing you learned while writing this?</strong><br />
I feel like a moron for not knowing this.  Apparently the correct slang is friggin&#8217;.  But for years I&#8217;ve been using &#8220;friggen&#8221; &#8211; which has a <a href="http://www.urbandictionary.com/define.php?defid=1567640&#038;term=friggen">completely different meaning</a>.  It&#8217;s no wonder that my friends would act strange when I&#8217;d ask &#8220;anyone want to hang at my place and play video games and other friggen stuff?&#8221;  Then they&#8217;d show up five minutes later and always seem disappointed at 3AM when I said I was going to bed&#8230;like they were expecting more&#8230;</p>
<p><strong>This brings up an important issue.  Has there ever been cursing in a programming book before?</strong><br />
Not that I&#8217;ve ever seen, but I&#8217;d be interested in hearing about it.  My goal is to have the first NSFW programming book.  Set your dreams high, kids.</p>
<p><strong>I have question/comment about the book.  How should I contact you?</strong><br />
<a href="mailto://matt@pseudocoder.com">Send me an email</a>.  <a href="http://twitter.com/mcurry">Hit me up on twitter</a>.  Leave a comment on this post.</p>
<p><strong>What&#8217;s next?</strong><br />
Not much for the book.  I&#8217;ll probably fix it up and add new sections from time to time.  I&#8217;ve already received a few good suggestions.  I have a couple good blog posts ready, including &#8220;How To Program While Shitfaced Drunk&#8221; and &#8220;Stop Fucking With Your JavaScript&#8221;.  They just need a few more drunken tangents and they&#8217;ll be ready to go.  Keep an eye out next week.</p>
<img src="http://feeds.feedburner.com/~r/pseudocoder/~4/xGaMd__1iUs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.pseudocoder.com/archives/2009/05/13/free-cakephp-e-book-super-awesome-advanced-cakephp-tips/feed/</wfw:commentRss>
		<slash:comments>52</slash:comments>
		</item>
		<item>
		<title>CakePHP Digest #13</title>
		<link>http://www.pseudocoder.com/archives/2009/05/04/cakephp-digest-13/</link>
		<comments>http://www.pseudocoder.com/archives/2009/05/04/cakephp-digest-13/#comments</comments>
		<pubDate>Tue, 05 May 2009 00:45:06 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[CakePHP Digest]]></category>

		<guid isPermaLink="false">http://www.pseudocoder.com/?p=778</guid>
		<description><![CDATA[Prelude
This digest kind of sucks.  As we&#8217;d say in high school: My B G (which translates to &#8220;My Bad, Gangsta,&#8221; for those who aren&#8217;t from dorky middle class America).  I have something kind of cool that I hope to get out this week that should make up for it.  
News
CakePHP 1.2.3.8166
There is [...]]]></description>
			<content:encoded><![CDATA[<h1>Prelude</h1>
<p>This digest kind of sucks.  As we&#8217;d say in high school: My B G (which translates to &#8220;My Bad, Gangsta,&#8221; for those who aren&#8217;t from dorky middle class America).  I have something kind of cool that I hope to get out this week that should make up for it.  </p>
<h1>News</h1>
<h4>CakePHP 1.2.3.8166</h4>
<p>There is a new <a href="http://bakery.cakephp.org/articles/view/release-cakephp-1-2-3-8166">bug fix release</a> for the 1.2 branch.  The biggest issue this fixes is described below in the Tickets and Commits section.</p>
<p><span id="more-778"></span></p>
<h4>CakeFest Talks</h4>
<p>It looks like all the slots have been assigned for <a href="http://cakefest.org/talks">talks at CakeFest</a>.  </p>
<h4>First 1.3 Site In The Wild?</h4>
<p><a href="http://www.ohloh.net/accounts/gwoo/messages/30233">TheChaw is now running on CakePHP 1.3</a>.  I would guess this is the first real CakePHP 1.3 site out there.  Although <a href="http://www.pseudocoder.com/archives/2009/03/23/cakephp-digest-10-news-overload/">I made a joke</a> a couple digests ago about how everyone should move to 1.3 immediately.  Some people didn&#8217;t realize it was a joke, so for all I know there could be a bunch of sites updated to 1.3 already.  </p>
<h4>CakePHP Meetup in Dallas</h4>
<p><a href="http://twitter.com/britg/statuses/1696167426">@britg</a> setup a <a href="http://www.facebook.com/event.php?eid=95239021418">CakePHP meetup for the Dallas</a> area bakers.</p>
<h1>Tickets and Commits</h1>
<p><ins datetime="2009-05-05T00:37:58+00:00">I can&#8217;t even get this post out and <a href="https://trac.cakephp.org/changeset/8165">it&#8217;s already fixed.</a></ins><br />
A <a href="https://trac.cakephp.org/ticket/6336">low danger XSS vulnerability</a> is <del datetime="2009-05-05T00:37:58+00:00">currently open</del> closed.  The trick allows you to inject HTML into some CakePHP apps.  For example <a href='http://planbookedu.com/index.php/"&lt;h1&gt;CodeIgnitor Rules!!!&lt;/h1&gt;'>here&#8217;s one of my sites</a>.  This doesn&#8217;t work on all sites.  For example the CakePHP <a href='http://cakephp.org/index.php/"&lt;h1&gt;CodeIgnitor Rules!!!&lt;/h1&gt;'>sites seem to be immune</a>.  I&#8217;m calling this one &#8220;low danger&#8221; because I was only able to get HTML into the page, <del datetime="2009-05-07T04:17:20+00:00">not JavaScript</del>.  Plus, it only works when you get people to visit your hacked link.  </p>
<p><ins datetime="2009-05-07T04:17:20+00:00">See the comment below from Ramon on how to exploit this for JavaScript</ins></p>
<h1>In The Wild</h1>
<h4>www.vendoo.co.za</h4>
<p><a href="http://twitter.com/johannduplessis/statuses/1647500253">@johannduplessis announced</a> his latest site: <a href="http://www.vendoo.co.za/">www.vendoo.co.za</a>.  It&#8217;s a &#8220;classifieds site and aggregator.&#8221;  </p>
<h1>In The Blogs</h1>
<h4>Pagination With Custom Find Types</h4>
<p>Mariano Iglesias has a <a href="http://cricava.com/blogs/index.php?blog=6&#038;title=pagination-with-custom-find-types-in-cak&#038;more=1&#038;c=1&#038;tb=1&#038;pb=1">nice post on doing pagination</a> with <a href="http://github.com/mcurry/find/tree/master">custom find types</a>.</p>
<h4>Ajax Form Validation</h4>
<p>JamNite posted a rather lengthy tutorial on doing <a href="http://jamnite.blogspot.com/2009/05/cakephp-form-validation-with-ajax-using.html">Ajax validation using jQuery</a>.</p>
<h4>Which teknoid Posts to Highlight?</h4>
<p>If I linked to every new teknoid post there wouldn&#8217;t be room for any other blogs.  I&#8217;ll pick there two:  &#8220;<a href="http://teknoid.wordpress.com/2009/04/30/give-all-of-your-error-messages-a-different-layout/">Give all of your error messages a different layout</a>&#8221; and &#8220;<a href="http://teknoid.wordpress.com/2009/04/21/more-pondering-about-habtm-lets-save-new-tags-with-a-post/">More pondering about HABTM</a>&#8220;.</p>
<h1>In The Groups</h1>
<p>Uhhh&#8230;.</p>
<h1>Code</h1>
<h4>jQuery Ajax Helper</h4>
<p>loadsys.com released a <a href="http://blog.loadsys.com/2009/05/01/cakephp-jquery-ajax-helper-easy-scriptaculous-replacement/">replacement for the default AjaxHelper</a> that uses jQuery.   How many of you use the AjaxHelper for generating JavaScript code?  I&#8217;m interested to know if most people just write their own JS &#8211; this is what I do &#8211; rather then using the helpers.</p>
<h4>Plugin Manager</h4>
<p><a href="http://twitter.com/rodrigorm">@rodrigorm</a> pointed out a project he&#8217;s been working on &#8211; a <a href="http://translate.google.com/translate?js=n&#038;prev=_t&#038;hl=en&#038;ie=UTF-8&#038;u=http%3A%2F%2Fwiki.github.com%2Flucius%2Fplugin_manager&#038;sl=pt&#038;tl=en&#038;history_state0=">plugin manager</a>.</p>
<h4>My Stuff</h4>
<p>I <a href="http://www.pseudocoder.com/archives/2009/04/27/github-updates/">updated a few of my projects</a> last week.  Since I&#8217;m completely obsessed with plugins I&#8217;m converting all my code.  So far I&#8217;ve done the <a href="http://github.com/mcurry/lazy_loader">LazyLoader</a>, <a href="http://github.com/mcurry/find">Custom Find Types</a> and <a href="http://github.com/mcurry/js_validate">jQuery Validation</a>.  I plan on doing the rest as I get time.</p>
<h1>I&#8217;m Out!</h1>
<p>And on that note don&#8217;t forget to <a href="http://feeds.feedburner.com/pseudocoder">subscribe to my feed</a> or <a href="http://twitter.com/mcurry">follow me on twitter</a>.</p>
<p>As always if you think I missed something leave a comment.  Or if you do something interesting and want it included in the next digest, <a href="mailto:matt@pseudocoder.com">send me an email</a>.</p>
<img src="http://feeds.feedburner.com/~r/pseudocoder/~4/CLrx7y-QPpY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.pseudocoder.com/archives/2009/05/04/cakephp-digest-13/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
	</channel>
</rss>
