<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mike Panitz&#039;s Blog &#187; Misc</title>
	<atom:link href="http://panitzco.com/Mike/category/misc/feed/" rel="self" type="application/rss+xml" />
	<link>http://panitzco.com/Mike</link>
	<description>Some tech, some teaching, and some other stuff</description>
	<lastBuildDate>Tue, 29 Sep 2009 06:00:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Upgrading to Cake 1.2</title>
		<link>http://panitzco.com/Mike/misc/upgrading-to-cake-1-2/</link>
		<comments>http://panitzco.com/Mike/misc/upgrading-to-cake-1-2/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 00:25:04 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://panitzco.com/Mike/?p=76</guid>
		<description><![CDATA[Upgrading to 1.2.4.8284 stable from the 1.2.0.6311 beta.
Recently, CakePHP.org released their 1.2 &#8217;stable&#8217; build (specifically, 1.2.4.8424), and appear to have moved on to working on version 1.3.&#160; Since it&#8217;s still a couple of weeks till my school starts up again, it seemed like a good time to move my StudentTracker web app forwards to the [...]]]></description>
			<content:encoded><![CDATA[<p>Upgrading to <strong>1.2.4.8284 stable </strong>from the <strong>1.2.0.6311 beta.</strong></p>
<p>Recently, CakePHP.org released their 1.2 &#8217;stable&#8217; build (specifically, 1.2.4.8424), and appear to have moved on to working on version 1.3.&#160; Since it&#8217;s still a couple of weeks till my school starts up again, it seemed like a good time to move my StudentTracker web app forwards to the current stable version.&#160; In this blog post, I&#8217;m going to briefly comment on a couple of issues I ran into, in the hopes of helping out other people who are upgrading to Cake 1.2.</p>
<p>Given that I&#8217;m upgrading from an earlier, beta version of 1.2 to the stable, final version of 1.2 <a href="#Footnote_1">[1]</a>, one would expect the upgrade to be quick and pretty painless; the process largely was.&#160;&#160; <a href="http://book.cakephp.org/view/411/Migrating-from-CakePHP-1-1-to-1-2">http://book.cakephp.org/view/411/Migrating-from-CakePHP-1-1-to-1-2</a> provides an nice &#8216;checklist&#8217; of common issues to check for, and was incredibly helpful.</p>
<p>That said, there was really only two things that gave me trouble:</p>
<ol>
<li><u>Use </u><a href="http://book.cakephp.org/view/499/The-App-Class"><u>App::import</u></a><u> instead of vendor()</u>       <br />In the earlier version of CakePHP, if you wanted to include PHP files from the &#8216;app/vendors&#8217; directory, you used the vendor() function.&#160; This was all well and dandy, and worked great.&#160; While I can&#8217;t find it right now, I swear that there was a page of Cake documentation that clearly stated the intention that the app/vendors/ directory would not have any particular naming convention imposed on it.&#160; This is exactly what one would expect for a directory that&#8217;s intended to hold third party, general-purpose PHP libraries (i.e., libraries that have no knowledge of CakePHP).&#160; Looking at the code for the vendor() function itself in Cake 1.1, one can see that it (basically) checked that the specified file existed in the vendors subdirectory, and then <a href="http://us3.php.net/manual/en/function.include.php">included</a> it (using <a href="http://us3.php.net/manual/en/function.require-once.php">require_once</a>).&#160; <strong>vendor() did <u>not</u> inflect the name of the library</strong><em>.        <br /></em>vendor() is replaced by the new App::import function.&#160; <strong>App::import <u>does</u> inflect the library name.&#160; </strong>This means that if you try to replace, say:<br />
<blockquote>
<p><code>vendor('StudentTracker/ResultSet');</code></p>
</blockquote>
<p>with:<br />
<blockquote>
<p><code>App::import( 'Vendor', 'StudentTracker/ResultSet');</code> </p>
</blockquote>
<p>You&#8217;ll get an error as Cake attempts to inflect the &#8216;StudentTracker/ResultSet&#8217; string, and ends up with something like &#8216;app/student_tracker/result_set.php&#8217;, which of course doesn&#8217;t exist.       </p>
<p>Instead, what you need to do is specify the path to the file yourself, like so:       <br /> <br />
<blockquote>
<p><code>App::import( 'Vendor', 'StudentTracker/ResultSet',            <br /><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160; array('file' =&gt; 'StudentTracker'.DS.'ResultSet.php')</strong>);</code></p>
</blockquote>
<p> I find this awkward, and I think that it violates the spirit of the vendors directory. But I didn&#8217;t get an affirmative response to my Google Group posting about this, so I guess the inflection is intentional.       </li>
<li><u>Model::execute is kind of deprecated &#8211; use </u><a href="http://book.cakephp.org/view/456/query"><u>Model::query</u></a><u> instead        <br /></u>Model::execute has now been replaced with <a href="http://book.cakephp.org/view/456/query">Model::query</a>.&#160; This seems like a reasonable change, and once I knew that the change needed to be made, it was a quick and painless switch.&#160; The only problem was that the deprecation is semi-documented, in the Google Group (specifically here: <a href="http://groups.google.com/group/cake-php/browse_thread/thread/8c0edd5f43dad22d/73ec7bf768500bf9?lnk=gst&amp;q=execute#73ec7bf768500bf9">http://groups.google.com/group/cake-php/browse_thread/thread/8c0edd5f43dad22d/73ec7bf768500bf9?lnk=gst&amp;q=execute#73ec7bf768500bf9</a>).&#160; <br />What tripped me up is the fact that Model::execute still exists in the CakePHP 1.2.4.8284 code base.&#160; Since my code used this method, and because the method still exists, I didn&#8217;t get a &#8216;method not found&#8217; error, which would have been a clear indication that it had been deprecated and removed.&#160; It&#8217;s deprecation is also not listed in the <a href="http://book.cakephp.org/view/411/Migrating-from-CakePHP-1-1-to-1-2">upgrade guide</a>, so it&#8217;s easy to miss.&#160; </li>
</ol>
<p>There were (as always) a number of minor, dumb mistakes of my own that I needed to iron out (including my use of <code>echo $this-&gt;render();</code> &#8211; I keep asking myself how this ever worked correctly <img src='http://panitzco.com/Mike/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> &#160; )(FWIW, that lined caused the view to be displayed twice in the same page).</p>
<p>Overall, the experience was quick, painless, and extremely fast.&#160; Admittedly, I&#8217;m only upgrading from the beta (and not from version 1.1), but I&#8217;m guessing that the 1.1 upgrade should be quick and easy, too.</p>
<hr />
<p>&#160;<a name="Footnote_1">[1]</a> At least, I *think* it&#8217;s the final version &#8211; 1.2.4.8284 is marked as being &#8217;stable&#8217; on the <a href="http://cakephp.org/">CakePHP</a> website, and it appears that the next dev version is labeled 1.3</p>
]]></content:encoded>
			<wfw:commentRss>http://panitzco.com/Mike/misc/upgrading-to-cake-1-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello, World!</title>
		<link>http://panitzco.com/Mike/misc/hello-world/</link>
		<comments>http://panitzco.com/Mike/misc/hello-world/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 00:20:59 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://panitzco.com/Mike/?p=4</guid>
		<description><![CDATA[My name is Mike Panitz, and I&#8217;ve been teaching computer programming (and occassionally math) at Cascadia Community College since 2001.  I put this blog together mostly for fun, but also as a platform to talk about (computer) technology, teaching, and how to apply one to the other.
My homepage is at http://faculty.cascadia.edu/mpanitz/
]]></description>
			<content:encoded><![CDATA[<p>My name is Mike Panitz, and I&#8217;ve been teaching computer programming (and occassionally math) at <a href="http://www.cascadia.edu">Cascadia Community College</a> since 2001.  I put this blog together mostly for fun, but also as a platform to talk about (computer) technology, teaching, and how to apply one to the other.</p>
<p>My homepage is at <a href="http://faculty.cascadia.edu/mpanitz/">http://faculty.cascadia.edu/mpanitz/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://panitzco.com/Mike/misc/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
