<?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>Tony Thomas &#187; This Site</title>
	<atom:link href="http://anthonygthomas.com/category/this-site/feed/" rel="self" type="application/rss+xml" />
	<link>http://anthonygthomas.com</link>
	<description>Father to two, husband to one, web developer and musician.</description>
	<lastBuildDate>Fri, 11 Nov 2011 14:00:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Use Functions from Other Controllers While Maintaining MVC Architecture in CakePHP</title>
		<link>http://anthonygthomas.com/2008/12/10/use-functions-from-other-controllers-while-maintaining-mvc-architecture-in-cakephp/</link>
		<comments>http://anthonygthomas.com/2008/12/10/use-functions-from-other-controllers-while-maintaining-mvc-architecture-in-cakephp/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 23:52:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[About the Author]]></category>
		<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[This Site]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[dry]]></category>
		<category><![CDATA[mvc]]></category>

		<guid isPermaLink="false">http://anthonygthomas.com/?p=66</guid>
		<description><![CDATA[UPDATE (7/22/2009) requestionAction may not be the best solution. Read this. At my day job, I&#8217;m working on an application to keep track of specimens for our lab. A specimen is sent to the lab, then divided into aliquots which are put into boxes and stored in freezers. The previous sentence ought to give you [...]]]></description>
			<content:encoded><![CDATA[<h3>UPDATE (7/22/2009)</h3>
<p>requestionAction may not be the best solution. <a href="http://teknoid.wordpress.com/2009/01/17/can-we-talk-enough-about-requestaction/" onclick="pageTracker._trackPageview('/outgoing/teknoid.wordpress.com/2009/01/17/can-we-talk-enough-about-requestaction/?referer=');">Read this</a>.</p>
<p>At my day job, I&#8217;m working on an application to keep track of specimens for our lab. A specimen is sent to the lab, then divided into aliquots which are put into boxes and stored in freezers. The previous sentence ought to give you some idea of the architecture of the database, which in turn drives the Model for my application.</p>
<p>To take a step back for a second, I&#8217;m developing the application using the <a title="CakePHP" href="http://cakephp.org" onclick="pageTracker._trackPageview('/outgoing/cakephp.org?referer=');">CakePHP framework</a> which uses <a href="http://en.wikipedia.org/wiki/Model-view-controller" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Model-view-controller?referer=');">MVC architecture</a>.</p>
<p>As you may have guessed I have specimen, aliquot, boxes and freezers tables. In turn then, I have Specimen, Aliquot, Box and Freezer Models.</p>
<p>The trick here is that I want to alert users when there are aliquots in the system that have not yet been assigned to boxes. It&#8217;s a simple query:</p>

<div class="wp_syntax"><div class="code"><pre class="language" style="font-family:monospace;">SELECT COUNT(aliquot.id)
FROM aliquots
WHERE aliquots.box_id IS NULL</pre></div></div>

<p>The problem is that I want the number of unstored aliquots to be displayed on every page in the left column as a persistent reminder that there are are aliquots that need to be put away. I want to do that in a way that maintains the MVC architecture and doesn&#8217;t violate the <a href="http://en.wikipedia.org/wiki/Don%27t_repeat_yourself" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Don_27t_repeat_yourself?referer=');">DRY philosophy</a>.</p>
<p>Since the query is run on the aliquots table and each view is generally specific to it&#8217;s own model, I either have to run a recursive query to access data across models&#8211;which adds overhead&#8211;or implement the solution below which lightens the load a bit and is a more elegant bit of code. (<a title="CakePHP Group" href="http://groups.google.com/group/cake-php/browse_thread/thread/b302d650fa9ec36e/82fd46c3d4e9eeec#82fd46c3d4e9eeec" onclick="pageTracker._trackPageview('/outgoing/groups.google.com/group/cake-php/browse_thread/thread/b302d650fa9ec36e/82fd46c3d4e9eeec_82fd46c3d4e9eeec?referer=');">Tip of the hat to Jon Bennet for offering the solution</a>.)</p>
<p><a href="http://api.cakephp.org/class_object.html#c40a38b60a3748b9cf75215b92ee3db1" onclick="pageTracker._trackPageview('/outgoing/api.cakephp.org/class_object.html_c40a38b60a3748b9cf75215b92ee3db1?referer=');">The solution involves CakePHP&#8217;s requestAction()</a>.</p>
<p>I can define the method in my aliquots controller and call it from anywhere. So if aliquots_controller.php has a method that retrieves the data from the model (in this case called &#8216;unstored&#8217;) I can simply put the following code into my layout:</p>

<div class="wp_syntax"><div class="code"><pre class="language" style="font-family:monospace;">$unstored = $this-&amp;gt;requestAction('aliquots/unstored');
if(!empty($unstored)) {
echo $html-&amp;gt;link('&lt;strong&gt;' . $unstored['unstored'] . ' aliquots have not been stored.&lt;/strong&gt;', '/aliquots/store');
}</pre></div></div>

<p>I only have to define the method once to use it throughout my application. Problem solved.<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://anthonygthomas.com/2008/12/10/use-functions-from-other-controllers-while-maintaining-mvc-architecture-in-cakephp/" rel="bookmark" title="December 10, 2008">Use Functions from Other Controllers While Maintaining MVC Architecture in CakePHP</a></li>
<li><a href="http://anthonygthomas.com/2010/02/18/cakephp-containable-behavior-is-your-friend/" rel="bookmark" title="February 18, 2010">CakePHP: Containable Behavior is Your Friend</a></li>
<li><a href="http://anthonygthomas.com/2009/05/22/roll-your-own-cakephp-components/" rel="bookmark" title="May 22, 2009">Roll Your Own CakePHP Components</a></li>
<li><a href="http://anthonygthomas.com/2010/03/14/display-form-fields-based-on-selection-using-jquery/" rel="bookmark" title="March 14, 2010">Display Form Fields Based on Selection Using JQuery</a></li>
<li><a href="http://anthonygthomas.com/2010/05/24/an-unexpected-problem-with-cakephp-and-email-elements/" rel="bookmark" title="May 24, 2010">An Unexpected Problem with CakePHP and Email Elements</a></li>
</ul>
<p><!-- Similar Posts took 8.229 ms --></p>
]]></content:encoded>
			<wfw:commentRss>http://anthonygthomas.com/2008/12/10/use-functions-from-other-controllers-while-maintaining-mvc-architecture-in-cakephp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Careful Where You Point That Thing</title>
		<link>http://anthonygthomas.com/2008/04/18/careful-where-you-point-that-thing/</link>
		<comments>http://anthonygthomas.com/2008/04/18/careful-where-you-point-that-thing/#comments</comments>
		<pubDate>Fri, 18 Apr 2008 06:00:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Social Media]]></category>
		<category><![CDATA[This Site]]></category>

		<guid isPermaLink="false">http://anthonygthomas.com/?p=27</guid>
		<description><![CDATA[In four recent instances I&#8217;ve written something or mentioned something in a podcast where someone directly related to the subject found the post/podcast. That seems to me to be a relatively recent phenomenon. Instance one: In a recent Minneapoliscast podcast, we discussed the demise of No Depression&#8217;s print magazine. Soon after Kyle Matteson and Steve [...]]]></description>
			<content:encoded><![CDATA[<p>In four recent instances I&#8217;ve written something or mentioned something in a podcast where someone directly related to the subject found the post/podcast. That seems to me to be a relatively recent phenomenon.</p>
<p>Instance one: In a recent <a href="http://minneapoliscast.com/2008/03/07/roundtable-discussion-with-stook-kyle-matteson-steve-mcpherson-tony-thomas-musical-guest-ben-kyle-from-romantica/" onclick="pageTracker._trackPageview('/outgoing/minneapoliscast.com/2008/03/07/roundtable-discussion-with-stook-kyle-matteson-steve-mcpherson-tony-thomas-musical-guest-ben-kyle-from-romantica/?referer=');">Minneapoliscast podcast</a>, we discussed the <a href="http://nodepression.net/blogs/letter" onclick="pageTracker._trackPageview('/outgoing/nodepression.net/blogs/letter?referer=');">demise of No Depression&#8217;s print magazine</a>. Soon after Kyle Matteson and Steve McPherson attended SXSW. Who should attend <a href="http://reveillemag.com" onclick="pageTracker._trackPageview('/outgoing/reveillemag.com?referer=');">Reveille Magazine</a>&#8216;s day party but Peter Blackstock, co-editor of No Depression. Peter actually discussed listening to the podcast w/ Kyle. I had to review it to make sure I didn&#8217;t say anything asinine.</p>
<p>Instance two: I mentioned <a href="http://drop.io" onclick="pageTracker._trackPageview('/outgoing/drop.io?referer=');">drop.io</a> the other day here. Who should <a href="http://anthonygthomas.com/2008/04/11/transparency/#comment-6">comment on the post</a> but <a href="http://twitter.com/lessin" onclick="pageTracker._trackPageview('/outgoing/twitter.com/lessin?referer=');">someone directly involved with the company</a>.</p>
<p>Instance three: I made a few off-hand comments at MinneWebCon via <a href="http://twitter.com/truetone" onclick="pageTracker._trackPageview('/outgoing/twitter.com/truetone?referer=');">Twitter</a>. Who responded to me directly? One of the organizers of the event.</p>
<p>Instance four: I wrote about APML here earlier this week. Who added the post to <a href="http://ma.gnolia.com/people/ChrisSaad/bookmarks/vrokiqekut" onclick="pageTracker._trackPageview('/outgoing/ma.gnolia.com/people/ChrisSaad/bookmarks/vrokiqekut?referer=');">his ma.gnolia links</a>? <a href="http://twitter.com/ChrisSaad" onclick="pageTracker._trackPageview('/outgoing/twitter.com/ChrisSaad?referer=');">Chris Saad</a>, one of the founders of <a href="http://apml.org" onclick="pageTracker._trackPageview('/outgoing/apml.org?referer=');">apml.org</a>.</p>
<p>We&#8217;re no longer sequestered in our rooms in the cold glow of a CRT. We&#8217;re talking and exchanging ideas. How you doin?<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://anthonygthomas.com/2008/04/18/careful-where-you-point-that-thing/" rel="bookmark" title="April 18, 2008">Careful Where You Point That Thing</a></li>
<li><a href="http://anthonygthomas.com/2008/04/15/minnewebcon-2008/" rel="bookmark" title="April 15, 2008">MinneWebCon 2008</a></li>
<li><a href="http://anthonygthomas.com/2008/04/16/apml/" rel="bookmark" title="April 16, 2008">APML</a></li>
<li><a href="http://anthonygthomas.com/2008/04/14/access-to-free-music-and-emotional-connections/" rel="bookmark" title="April 14, 2008">Access to Free Music and Emotional Connections</a></li>
<li><a href="http://anthonygthomas.com/2008/05/01/value-of-the-written-word/" rel="bookmark" title="May 1, 2008">Value of the Written Word</a></li>
</ul>
<p><!-- Similar Posts took 3.918 ms --></p>
]]></content:encoded>
			<wfw:commentRss>http://anthonygthomas.com/2008/04/18/careful-where-you-point-that-thing/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Upgraded to WordPress 2.5</title>
		<link>http://anthonygthomas.com/2008/04/02/upgraded-to-wordpress-25/</link>
		<comments>http://anthonygthomas.com/2008/04/02/upgraded-to-wordpress-25/#comments</comments>
		<pubDate>Wed, 02 Apr 2008 06:00:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[This Site]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://anthonygthomas.com/?p=11</guid>
		<description><![CDATA[WordPress 1.x was the first CMS to get me to move away from my old home-brewed CMS I used to use for blogging. Yesterday I upgraded this blog to Worpress 2.5. Even though you can&#8217;t see it, the admin area has a whole new look and support for audio and video in posts. I&#8217;m going [...]]]></description>
			<content:encoded><![CDATA[<p>WordPress 1.x was the first CMS to get me to move away from my old home-brewed CMS I used to use for blogging. Yesterday I upgraded this blog to <a title="Wordpress Download Page" href="http://wordpress.org/download/" onclick="pageTracker._trackPageview('/outgoing/wordpress.org/download/?referer=');">Worpress 2.5</a>. Even though you can&#8217;t see it, the admin area has a whole new look and support for audio and video in posts. I&#8217;m going to upgrade <a href="http://minneapoliscast.com" onclick="pageTracker._trackPageview('/outgoing/minneapoliscast.com?referer=');">Minneapoliscast</a> next to see how well it works with a podcast. Then a handful of other sites including the site I maintain for work.</p>
<p>This is my first post with the new interface. It&#8217;s taking a little getting used to, but once I figure out where everything is I think I&#8217;ll like it. I can&#8217;t say I can give WordPress a fair review in comparison to other CMS&#8217;s since I&#8217;ve never used <a href="http://http//movabletype.com/" onclick="pageTracker._trackPageview('/outgoing/http//movabletype.com/?referer=');">Movable Type</a>, <a href="http://joomla.org/" onclick="pageTracker._trackPageview('/outgoing/joomla.org/?referer=');">Joomla</a>, <a href="http://drupal.org/" onclick="pageTracker._trackPageview('/outgoing/drupal.org/?referer=');">Drupal</a> or any other of a cornucopia of blogging applications and content management systems.</p>
<p>Anyone else have experience with these others? How do they compare?<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://anthonygthomas.com/2008/04/02/upgraded-to-wordpress-25/" rel="bookmark" title="April 2, 2008">Upgraded to WordPress 2.5</a></li>
<li><a href="http://anthonygthomas.com/2008/04/14/access-to-free-music-and-emotional-connections/" rel="bookmark" title="April 14, 2008">Access to Free Music and Emotional Connections</a></li>
<li><a href="http://anthonygthomas.com/2008/11/25/wordpress-auto-update-is-ok-but-the-command-line-is-faster/" rel="bookmark" title="November 25, 2008">WordPress&#8217; Auto Update Is OK, But The Command Line Is Faster</a></li>
<li><a href="http://anthonygthomas.com/2008/03/26/hello-world/" rel="bookmark" title="March 26, 2008">Hello world!</a></li>
<li><a href="http://anthonygthomas.com/2010/03/22/baseline-wordpress-theme-version-1-0-2/" rel="bookmark" title="March 22, 2010">Baseline WordPress Theme Version 1.0.2</a></li>
</ul>
<p><!-- Similar Posts took 12.034 ms --></p>
]]></content:encoded>
			<wfw:commentRss>http://anthonygthomas.com/2008/04/02/upgraded-to-wordpress-25/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello world!</title>
		<link>http://anthonygthomas.com/2008/03/26/hello-world/</link>
		<comments>http://anthonygthomas.com/2008/03/26/hello-world/#comments</comments>
		<pubDate>Wed, 26 Mar 2008 18:29:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[This Site]]></category>
		<category><![CDATA[Tony Thomas]]></category>

		<guid isPermaLink="false">http://anthonygthomas.com/?p=1</guid>
		<description><![CDATA[I&#8217;m leaving the title. I&#8217;ve actually been blogging since 2002. This year my old blog was lost in what I can only call the great server crash of aught-eight. So here I am with a shiny new URL named after me. Anthony G. Thomas. You can call me Tony. Hello World!Similar Posts: Hello world! Upgraded [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m leaving the title. I&#8217;ve actually been blogging since 2002. This year my old blog was lost in what I can only call the great server crash of aught-eight. So here I am with a shiny new URL named after me. Anthony G. Thomas. You can call me Tony.</p>
<p>Hello World!<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://anthonygthomas.com/2008/03/26/hello-world/" rel="bookmark" title="March 26, 2008">Hello world!</a></li>
<li><a href="http://anthonygthomas.com/2008/04/02/upgraded-to-wordpress-25/" rel="bookmark" title="April 2, 2008">Upgraded to WordPress 2.5</a></li>
<li><a href="http://anthonygthomas.com/2008/11/25/wordpress-auto-update-is-ok-but-the-command-line-is-faster/" rel="bookmark" title="November 25, 2008">WordPress&#8217; Auto Update Is OK, But The Command Line Is Faster</a></li>
<li><a href="http://anthonygthomas.com/2009/09/30/lets-try-that-again/" rel="bookmark" title="September 30, 2009">Let&#8217;s Try That Again</a></li>
<li><a href="http://anthonygthomas.com/2008/04/16/apml/" rel="bookmark" title="April 16, 2008">APML</a></li>
</ul>
<p><!-- Similar Posts took 3.873 ms --></p>
]]></content:encoded>
			<wfw:commentRss>http://anthonygthomas.com/2008/03/26/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

