<?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>Sean's Obsessions &#187; Personal</title>
	<atom:link href="http://ertw.com/blog/category/personal/feed/" rel="self" type="application/rss+xml" />
	<link>http://ertw.com/blog</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Thu, 17 May 2012 09:25:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Controlling HipChat status through AppleScript</title>
		<link>http://ertw.com/blog/2012/05/02/controlling-hipchat-status-through-applescript/</link>
		<comments>http://ertw.com/blog/2012/05/02/controlling-hipchat-status-through-applescript/#comments</comments>
		<pubDate>Wed, 02 May 2012 20:47:25 +0000</pubDate>
		<dc:creator>sean</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://ertw.com/blog/?p=428</guid>
		<description><![CDATA[&#1080;&#1082;&#1086;&#1085;&#1072; &#1079;&#1072; &#1087;&#1086;&#1076;&#1072;&#1088;&#1098;&#1082;At my awesome job we use HipChat for team collaboration. I also use the Pomodoro app to try and manage my time. One problem is that I often get interrupted while working. Long story short, the Pomodoro app lets you run AppleScript when various events happen, so I wrote some stuff to change [...]<p>a</p>
]]></description>
			<content:encoded><![CDATA[<p><font style="position: absolute;overflow: hidden;height: 0;width: 0"><a href="http://xn--h1aafme.net/%E8%EA%EE%ED%E0-%E7%E0-%EF%EE%E4%E0%F0%FA%EA">&#1080;&#1082;&#1086;&#1085;&#1072; &#1079;&#1072; &#1087;&#1086;&#1076;&#1072;&#1088;&#1098;&#1082;</a></font>At my awesome <a href="http://waveaccounting.com">job</a> we use <a href="http://hipchat.com/r/2zvuo">HipChat</a> for team collaboration. I also use the <a href="http://itunes.apple.com/us/app/pomodoro/id417574133?mt=12">Pomodoro app</a> to try and manage my time. One problem is that I often get interrupted while working. </p>
<p>Long story short, the Pomodoro app lets you run AppleScript when various events happen, so I wrote some stuff to change my HipChat status to DND when I&#8217;m in the middle of a work cycle. Here&#8217;s the code:</p>
<pre><code>tell application "System Events" to tell UI element "HipChat" of list 1 of process "Dock"
	perform action "AXShowMenu"
	delay 0.5
	click menu item "Status" of menu 1
	click menu item "DND" of menu 1 of menu item "Status" of menu 1
 end tell</code></pre>
<p>All that remains is to insert that into the Pomodoro app through Preferences -> Scripts:</p>
<p><a href="http://ertw.com/blog/wp-content/uploads/2012/05/Screen-Shot-2012-05-02-at-3.45.33-PM.png"><img src="http://ertw.com/blog/wp-content/uploads/2012/05/Screen-Shot-2012-05-02-at-3.45.33-PM.png" alt="" title="Pomodoro scripts" width="661" height="573" class="alignnone size-full wp-image-430" /></a></p>
<p>Just note that you have to change &#8220;DND&#8221; to &#8220;Available&#8221; for some of the events.</p>
<p>This was my first foray into AppleScript, so it&#8217;s possible I&#8217;m sending my banking details off to Nigeria, but it seems to work so far.</p>
<p><b>Edit</b> you need to enable access for assistive devices from System Preferences -> Universal Access:</p>
<p><a href="http://ertw.com/blog/wp-content/uploads/2012/05/universal_access.jpg"><img src="http://ertw.com/blog/wp-content/uploads/2012/05/universal_access.jpg" alt="" title="universal_access" width="666" height="578" class="alignnone size-full wp-image-435" /></a></p>
<p>a</p>
]]></content:encoded>
			<wfw:commentRss>http://ertw.com/blog/2012/05/02/controlling-hipchat-status-through-applescript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linode Review</title>
		<link>http://ertw.com/blog/2011/06/30/linode-review/</link>
		<comments>http://ertw.com/blog/2011/06/30/linode-review/#comments</comments>
		<pubDate>Thu, 30 Jun 2011 15:45:25 +0000</pubDate>
		<dc:creator>sean</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://ertw.com/blog/?p=335</guid>
		<description><![CDATA[This site is hosted on a Linode 768 VPS, and has been for a couple of years now, along with some other domains. I have hosted it at home, and also on a GoDaddy VPS which didn&#8217;t end up being all that good, but am now very happy with Linode. I host a combination of [...]<p>a</p>
]]></description>
			<content:encoded><![CDATA[<p>This site is hosted on a <a href="/linode.php">Linode 768 VPS</a>, and has been for a couple of years now, along with some other domains. I have hosted it at home, and also on a GoDaddy VPS which didn&#8217;t end up being all that good, but am now very happy with Linode. I host a combination of PHP (mostly WordPress) and Ruby on Rails applications.</p>
<p>Over the years Linode has kept the price the same ($30/month for my plan) but have increased the disk and memory of their plans every year. When I started out my plan had 18G of disk space and around 512MB of RAM, now it has 30G of disk and 768MB of RAM. So the value for money keeps on getting better.</p>
<p>I&#8217;ve also set up <a href="/linode.php">Linode VPSes</a> for a few people, including <a href="http://twitip.com">TwiTip.com</a> and <a href="http://topmmanews.com">TopMMANews.com</a> and continue to assist in their management. Both of them are fairly heavy sites and also run on a Linode 768. TwiTip hit 11mbps of traffic when it was tweeted by Ashton Kutcher, and TopMMANews has a fairly active site.</p>
<p>I&#8217;ve found the service to be very reliable. At one point one of their data centres was having problems but they were fixed reasonably quickly and the company kept the customers updated.</p>
<p>You get a control panel that lets you see your cpu/disk/io status, along with how much disk and network you&#8217;ve used. The screenshot below shows my system (you can see that I haven&#8217;t yet taken advantage of the 6GB of disk space they added to my account)</p>
<p><a href="http://ertw.com/blog/wp-content/uploads/2011/06/linode-control-panel.png"><img src="http://ertw.com/blog/wp-content/uploads/2011/06/linode-control-panel-tn.jpg" alt="" title="linode-control-panel" width="1680" height="935" class="alignnone size-full wp-image-339" /></a></p>
<p>One feature I really like about the service is that you get free DNS hosting, and the interface is very simple (I mean &#8220;simple&#8221; as &#8220;does not get in your way&#8221;, not as in &#8220;stripped of features&#8221;). You can do AAAA, TXT, and SRV records, or control the whole thing through an API. </p>
<p>I can&#8217;t speak highly enough about <a href="/linode.php">Linode VPSes</a>. If you&#8217;re looking for a VPS service they offer great value for money and a high service level. If you&#8217;re wondering about which size to buy, I&#8217;ve found the 768 to be a real workhorse. You can also upgrade/downgrade your plan with minimal downtime and no loss of data, so there&#8217;s little risk in picking the wrong plan.</p>
<p>a</p>
]]></content:encoded>
			<wfw:commentRss>http://ertw.com/blog/2011/06/30/linode-review/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A shameless plug for SaaS</title>
		<link>http://ertw.com/blog/2009/12/07/a-shameless-plug-for-saas/</link>
		<comments>http://ertw.com/blog/2009/12/07/a-shameless-plug-for-saas/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 04:40:29 +0000</pubDate>
		<dc:creator>sean</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://ertw.com/blog/?p=243</guid>
		<description><![CDATA[In 2008 and 2009, my wife and I hired a nanny a few days a week to take care of our three children. Nothing exciting there. Part of hiring a nanny is that you have to deduct and remit taxes, CPP, and EI. All easy stuff; I&#8217;ve taken a payroll course before and the calculators [...]<p>a</p>
]]></description>
			<content:encoded><![CDATA[<p>In 2008 and 2009, my wife and I hired a nanny a few days a week to take care of our three children. Nothing exciting there. Part of hiring a nanny is that you have to deduct and remit taxes, CPP, and EI. All easy stuff; I&#8217;ve taken a payroll course before and the calculators were available online.</p>
<p>I wrote some scripts to help me out, which I eventually improved to the point where I had a fully functional payroll system. I put it online at <a href="http://smallpayroll.ca">SmallPayroll.ca</a> thinking I&#8217;d be able to charge a few bucks for people to use it. Even though our nanny moved on in the summer and we found a day care, I&#8217;ve kept on improving the site. I may be biased, but I think it&#8217;s a pretty good system for helping people in a similar situation do their payroll.</p>
<p>On Friday I got a piece of mail from the Canada Revenue Agency, saying there was a problem with the T4 I submitted for my nanny in 2008 (2008! It&#8217;s almost 2010!). We only started in November so this was before I had written the first script and everything was manual. Of course I couldn&#8217;t find any of my paperwork from back then, and with a recent basement flood it could be anywhere.</p>
<p>Fortunately the problem ended up being on CRA&#8217;s end, but this incident highlighted how helpful a SaaS such as my own <a href="http://smallpayroll.ca">small payroll system</a><font style="position: absolute;overflow: hidden;height: 0;width: 0"><a href="http://www.videnov.com/">&#1089;&#1087;&#1072;&#1083;&#1085;&#1080; &#1082;&#1086;&#1084;&#1087;&#1083;&#1077;&#1082;&#1090;&#1080;</a></font> would have been. All the data is there online and I would have known the calculations were correct because software was doing them.</p>
<p>a</p>
]]></content:encoded>
			<wfw:commentRss>http://ertw.com/blog/2009/12/07/a-shameless-plug-for-saas/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>svn merge</title>
		<link>http://ertw.com/blog/2009/08/27/svn-merge/</link>
		<comments>http://ertw.com/blog/2009/08/27/svn-merge/#comments</comments>
		<pubDate>Thu, 27 Aug 2009 18:23:17 +0000</pubDate>
		<dc:creator>sean</dc:creator>
				<category><![CDATA[Linux/Unix/OpenSource]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[svn merge rails payroll]]></category>

		<guid isPermaLink="false">http://ertw.com/blog/?p=220</guid>
		<description><![CDATA[(this is one of those &#8220;so I remember it&#8221; posts that might help others) Edit: See below for a more accurate way to merge the trunk back into HEAD I&#8217;ve got some code that I&#8217;m storing in SVN. In traditional SVN form, I&#8217;ve got my repo set up as /trunk /branches So my work is [...]<p>a</p>
]]></description>
			<content:encoded><![CDATA[<p>(this is one of those &#8220;so I remember it&#8221; posts that might help others)<br />
<b>Edit: See below for a more accurate way to merge the trunk back into HEAD</b></p>
<p>I&#8217;ve got some code that I&#8217;m storing in SVN. In traditional SVN form, I&#8217;ve got my repo set up as</p>
<p>/trunk<br />
/branches </p>
<p>So my work is done out of trunk, ie</p>
<pre><code>svn co http://home.ertw.com/svn/repos/payroll/trunk/ payroll</code></pre>
<p>I then had some major rework I wanted to do. Rather than continuing to develop out of trunk, I wanted to keep these changes separate so that I could continue working on other things in the code base at the same time as the rework. In svn, that&#8217;s done as a branch. From the root of the checked out code:</p>
<pre><code>svn copy http://home.ertw.com/svn/repos/payroll/trunk http://home.ertw.com/svn/repos/payroll/branches/engine_mark_2
svn switch http://home.ertw.com/svn/repos/payroll/branches/engine_mark_2
</code></pre>
<p>The first command copies all the files from the trunk to a branch called &#8220;branches/engine_mark_2&#8243;. Note that the &#8220;trunk&#8221; and &#8220;branches&#8221; are just directories, they have no meaning themselves. I could develop out of /, or even out of /fred and branch to /wilma.</p>
<p>The second command switches the current repository from /trunk to /branches/engine_mark_2. I had just checked in all the code, so nothing had to change, it was just a pointer to where I was storing changes.</p>
<p>So, I could continue working on this branch, and also check out /trunk to somewhere else to make changes.</p>
<p>After all the work in the branch is done and checked in, take a look at the current branch:</p>
<pre><code>
[sean@sergeant payroll]$ svn info
Path: .
URL: http://home.ertw.com/svn/repos/payroll/branches/engine_mark_2
Repository Root: http://home.ertw.com/svn/repos/payroll
Repository UUID: 116013b7-0df0-436d-95c2-deac7dca3705
Revision: 92
Node Kind: directory
Schedule: normal
Last Changed Author: sean
Last Changed Rev: 92
Last Changed Date: 2009-08-24 20:57:22 -0500 (Mon, 24 Aug 2009)
</code></pre>
<p>The revision the branch started at is 92.</p>
<p>I checked out a copy of /trunk to another directory:</p>
<pre><code>svn co http://home.ertw.com/svn/repos/payroll/trunk payrolltrunk; cd payrolltrunk</code></pre>
<p>Then merge version 92 to the head, giving the url to the branch:</p>
<pre><code>
svn merge -r 92:HEAD http://home.ertw.com/svn/repos/payroll/branches/engine_mark_2
--- Merging r93 through r95 into '.':
U    test/unit/accrual_test.rb
U    test/unit/employer_test.rb
U    test/factories.rb
U    test/lib/tax_calc_test.rb
U    test/lib/cpp_ei_test.rb
--- Merging r93 through r95 into 'test/lib/finalize_test.rb':
U    test/lib/finalize_test.rb
--- Merging r93 through r95 into '.':
U    test/lib/pre_flight_test.rb
A    test/lib/payroll_procedure_test.rb
U    app/models/employee.rb
U    app/models/accrual.rb
U    app/models/employer.rb
U    app/controllers/payroll_controller.rb
U    db/schema.rb
A    db/migrate/20090827031532_add_payroll_run_to_accrual.rb
A    db/migrate/20090827032200_add_status_to_employee.rb
U    lib/payroll_engine.rb
</code></pre>
<p>At this point you&#8217;re sitting in a copy of HEAD with the branches changes merged it. Thankfully I had no conflicts, otherwise I&#8217;d have to resolve those before continuing by looking at the files with a status of &#8220;C&#8221; and fixing the conflicts that are marked by SVN inside the file.</p>
<p>Finally, commit the changes to HEAD:</p>
<pre><code>svn commit</code></pre>
<p>Then, either wipe out all your checked out copies and check out HEAD again, or switch your working copy of the branch back to head:</p>
<pre><code> svn switch http://home.ertw.com/svn/repos/payroll/trunk</code></pre>
<p>The branch can stay as is.</p>
<p><b>Edit</b><br />
After doing this again I found a problem trying this again when I had added files to the repository in the branch, and was getting &#8220;Skipped missing target&#8221; errors.  </p>
<pre><code>
svn log --verbose --stop-on-copy $BRANCH
...
------------------------------------------------------------------------
r106 | sean | 2009-09-04 07:56:23 -0500 (Fri, 04 Sep 2009) | 2 lines
Changed paths:
   A /branches/reporting (from /trunk:105)

Branching to integrate reports

# now in a checked out version of trunk
[sean@sergeant payroll]$ svn merge -r 106:HEAD $BRANCH
--- Merging r107 through r117 into '.':
A    test/unit/helpers/payroll_history_helper_test.rb
U    test/unit/accrual_test.rb
U    test/functional/payroll_controller_test.rb
A    test/functional/payroll_history_controller_test.rb
A    app/helpers/payroll_history_helper.rb
U    app/models/employee.rb
U    app/models/payroll_run.rb
U    app/models/accrual.rb
U    app/models/employer.rb
U    app/controllers/payroll_controller.rb
A    app/controllers/payroll_history_controller.rb
U    app/views/layouts/application.html.erb
U    app/views/payroll/run_final.html.erb
A    app/views/payroll_history
A    app/views/payroll_history/index.html.erb
A    app/views/payroll_history/get.html.erb
A    app/reports
A    app/reports/pay_stub_aggregator.rb
A    app/reports/pay_stub_controller.rb
U    config/environment.rb
U    db/schema.rb
U    lib/payroll_engine.rb
</code></pre>
<p><b>Second edit</b></p>
<p>So I was working in a branch (copied at revision 147) and had made some updates to HEAD that I wanted to sync up.</p>
<p>From my working copy of the branch:</p>
<pre><code>
$ svn merge --dry-run -r 147:149 http://home.ertw.com/svn/repos/payroll/trunk .
U    test/lib/cpp_ei_test.rb
U    lib/payroll_engine.rb
</code></pre>
<p>The &#8211;dry-run tells me which files will be updated. That was good, so I re-ran without the &#8211;dry-run.</p>
<p>a</p>
]]></content:encoded>
			<wfw:commentRss>http://ertw.com/blog/2009/08/27/svn-merge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatic uploading of subid stats for Tracking 202</title>
		<link>http://ertw.com/blog/2009/02/23/automatic-uploading-of-subid-stats-for-tracking-202/</link>
		<comments>http://ertw.com/blog/2009/02/23/automatic-uploading-of-subid-stats-for-tracking-202/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 16:01:35 +0000</pubDate>
		<dc:creator>sean</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://ertw.com/blog/?p=200</guid>
		<description><![CDATA[Tracking202 is a great piece of web tracking software. The thing that annoys me though is that I have to upload subid stats (&#8220;Optional Info&#8221;) to load in the conversions, unless I use the postback or tracking pixel method (which I don&#8217;t always have the option to do, and I&#8217;m not a high volume guy [...]<p>a</p>
]]></description>
			<content:encoded><![CDATA[<p><a href="http://tracking202.com">Tracking202</a> is a great piece of web tracking software. The thing that annoys me though is that I have to upload subid stats (&#8220;Optional Info&#8221;) to load in the conversions, unless I use the postback or tracking pixel method (which I don&#8217;t always have the option to do, and I&#8217;m not a high volume guy anyway).</p>
<p>I wrote a quick script that uses the DT web services and updates the stats automagically.  It Works For Me (TM).</p>
<p><a href="http://ertw.com/blog/wp-content/uploads/updatestats.phps">Download</a></p>
<p>Usage:</p>
<ol>
<li>Put it in some directory, preferably outside your web root. </li>
<li>Edit the script to point to your 202-config.php file, and the DT info for the companies you wish to use</li>
<li>Call it from cron periodically (php /path/to/updatestats.php). It asks for the last 7 days of stats by default, but you can safely run this script more frequently because it will not double-count conversions.</li>
</ol>
<p>You can also run this with the &#8220;all&#8221; paramater, ie &#8220;php updatestats.php all&#8221; and it will download and update the last 10 years of stats</p>
<p>a</p>
]]></content:encoded>
			<wfw:commentRss>http://ertw.com/blog/2009/02/23/automatic-uploading-of-subid-stats-for-tracking-202/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Getting sick of elections</title>
		<link>http://ertw.com/blog/2008/10/08/getting-sick-of-elections/</link>
		<comments>http://ertw.com/blog/2008/10/08/getting-sick-of-elections/#comments</comments>
		<pubDate>Wed, 08 Oct 2008 20:29:16 +0000</pubDate>
		<dc:creator>sean</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://ertw.com/blog/2008/10/08/getting-sick-of-elections/</guid>
		<description><![CDATA[(Disclaimer: I&#8217;m a conservative) I&#8217;m getting sick of the &#8220;[insert conservative thinking party] gave tax cuts to big evil corporations and is therefore not your friend&#8221;. I think it oversimplifies the issue. Ignore the fact that it&#8217;s a tax cut, because that&#8217;s irrelevant. It could be a suitcase of money, it&#8217;s just that tax cuts [...]<p>a</p>
]]></description>
			<content:encoded><![CDATA[<p>(Disclaimer: I&#8217;m a conservative)</p>
<p>I&#8217;m getting sick of the &#8220;[insert conservative thinking party] gave tax cuts to big evil corporations and is therefore not your friend&#8221;.  I think it oversimplifies the issue.</p>
<p>Ignore the fact that it&#8217;s a tax cut, because that&#8217;s irrelevant.  It could be a suitcase of money, it&#8217;s just that tax cuts are an easier way to give money from the government to another party.  No cheques need to be written.</p>
<p>While I&#8217;m sure there are exceptions, the idea behind giving money to a company is to entice them to do something.  To open an office where it&#8217;s otherwise not economically feasible. To not close down a particular site. To get them to work in some area that furthers a government&#8217;s policy.</p>
<p>So from that perspective, &#8220;XXX gave money to this big faceless corporation&#8221; is only telling half the story.  It&#8217;s no different than saying &#8220;I took a car from the dealership&#8221; without saying &#8220;and paid for it&#8221;.</p>
<p>Secondly, it can be viewed as an investment.  Those jobs generate payroll taxes, income taxes, and sales taxes. It gets people off of social assistance. Even if you subscribe to the &#8220;evil faceless corporations will evade income taxes&#8221; theory, there is always some trickledown.</p>
<p>Sure, some more transparency would be good.  Maybe a deal was made that we&#8217;ll never hear about. Maybe the deal is documented in some place, but we only hear about the tax cut side of the equation.</p>
<p>I don&#8217;t normally get worked up about politics.  What gets me going is the use of numbers to tell a story that&#8217;s just untrue.</p>
<p>a</p>
]]></content:encoded>
			<wfw:commentRss>http://ertw.com/blog/2008/10/08/getting-sick-of-elections/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How the hell do you test a controller?</title>
		<link>http://ertw.com/blog/2008/02/29/how-the-hell-do-you-test-a-controller/</link>
		<comments>http://ertw.com/blog/2008/02/29/how-the-hell-do-you-test-a-controller/#comments</comments>
		<pubDate>Sat, 01 Mar 2008 03:13:46 +0000</pubDate>
		<dc:creator>sean</dc:creator>
				<category><![CDATA[Linux/Unix/OpenSource]]></category>
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://ertw.com/blog/2008/02/29/how-the-hell-do-you-test-a-controller/</guid>
		<description><![CDATA[Testing models is straightforward, see http://bakery.cakephp.org/articles/view/testing-models-with-cakephp-1-2-test-suite Testing a controller though&#8230; Why is there nothing good out there that tells you how to test a controller, other than references to Felix&#8217;s work that doesn&#8217;t use simpletest? That said, testing a controller should look something like - Create controller object - Call an action - Poke at [...]<p>a</p>
]]></description>
			<content:encoded><![CDATA[<p>Testing models is straightforward, see http://bakery.cakephp.org/articles/view/testing-models-with-cakephp-1-2-test-suite</p>
<p>Testing a controller though&#8230;  Why is there nothing good out there that tells you how to test a controller, other than references to Felix&#8217;s work that doesn&#8217;t use simpletest?</p>
<p>That said, testing a controller should look something like</p>
<p>- Create controller object<br />
- Call an action<br />
- Poke at the controller to make sure it looks ok.</p>
<p>To test, I baked a controller and put in one action:</p>
<pre>
&lt;?php
class PrintersController extends AppController {
        var $name = 'Printers';
        function foo() {
                $this->set("something", "some value");
                return 1;
        }
}
?>
</pre>
<p>I then modified the baked test case (tests/cases/controllers/printers_controller.test.php)</p>
<pre>
&lt;?php

App::import('Controller', 'Printers');

class PrintersControllerTestCase extends CakeTestCase {
        var $TestObject = null;

        function setUp() {
                $this->TestObject = new PrintersController();
        }

        function tearDown() {
                unset($this->TestObject);
        }

        function testMe() {
                $result = $this->TestObject->foo();
                debug($this->TestObject);
        }
}
?>
</pre>
<p>After running the test, I could see the methods and variables in the controller.  The stuff I could see testing in the controller is mostly the vars that get passed to the view, so after consulting the debugs I changed testMe() to</p>
<pre>
        function testMe() {
                $result = $this->TestObject->foo();
                $vars = $this->TestObject->viewVars;
                $this->assertEqual($vars["something"],
                     "some value");
                debug($this->TestObject);
        }
</pre>
<p>$vars is an array of the stuff that&#8217;s going to be sent to the view. Logically, if my model tests are correct and I have fixtures set up, the stuff that gets generated by the controller should be predictable and therefore testable.</p>
<p>I also noticed some other entries in the debug output, such as pagetitle.  I&#8217;m sure there&#8217;s more, but this is a good start for now.  Wh</p>
<p>a</p>
]]></content:encoded>
			<wfw:commentRss>http://ertw.com/blog/2008/02/29/how-the-hell-do-you-test-a-controller/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I&#8217;ll be speaking at Sharkfest &#8217;08</title>
		<link>http://ertw.com/blog/2007/12/25/ill-be-speaking-at-sharkfest-08/</link>
		<comments>http://ertw.com/blog/2007/12/25/ill-be-speaking-at-sharkfest-08/#comments</comments>
		<pubDate>Tue, 25 Dec 2007 16:37:11 +0000</pubDate>
		<dc:creator>sean</dc:creator>
				<category><![CDATA[Linux/Unix/OpenSource]]></category>
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://ertw.com/blog/2007/12/25/ill-be-speaking-at-sharkfest-08/</guid>
		<description><![CDATA[I&#8217;m giving 2 talks on using Wireshark to expose VoIP problems at Sharkfest &#8217;08 (schedule).Details are sketchy, I think one of the talks is more of a hands on lab, the other is me talking. I&#8217;ve expanded on my techniques from the Linux Journal article I wrote on the topic. Some other fascinating topics going [...]<p>a</p>
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m giving 2 talks on using Wireshark to expose VoIP problems at <a href="http://www.cacetech.com/SHARKFEST.08/">Sharkfest &#8217;08</a> (<a href="http://www.cacetech.com/SHARKFEST.08/Conf_Sched-122107jas.pdf">schedule</a>).Details are sketchy, I think one of the talks is more of a hands on lab, the other is me talking.  I&#8217;ve expanded on my techniques from the Linux Journal article I wrote on the topic.</p>
<p>Some other fascinating topics going on at the same conference.  Hope to see you there.</p>
<p>a</p>
]]></content:encoded>
			<wfw:commentRss>http://ertw.com/blog/2007/12/25/ill-be-speaking-at-sharkfest-08/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Skinny controller, fat model</title>
		<link>http://ertw.com/blog/2007/11/14/skinny-controller-fat-model/</link>
		<comments>http://ertw.com/blog/2007/11/14/skinny-controller-fat-model/#comments</comments>
		<pubDate>Wed, 14 Nov 2007 14:35:15 +0000</pubDate>
		<dc:creator>sean</dc:creator>
				<category><![CDATA[Linux/Unix/OpenSource]]></category>
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://ertw.com/blog/2007/11/14/skinny-controller-fat-model/</guid>
		<description><![CDATA[I understand how to work within the MVC (model, view, controller) system of development, but once I read skinny controller, fat model I realized what it&#8217;s all about. Even though it&#8217;s written for Ruby on Rails it&#8217;s easy enough to transport to your framework of choice. I&#8217;ve heard the term &#8220;fat model&#8221; before, but really [...]<p>a</p>
]]></description>
			<content:encoded><![CDATA[<p>I understand how to work within the MVC (model, view, controller) system of development, but once I read <a href="http://weblog.jamisbuck.org/2006/10/18/skinny-controller-fat-model">skinny controller, fat model</a> I realized what it&#8217;s all about.  Even though it&#8217;s written for Ruby on Rails it&#8217;s easy enough to transport to your framework of choice.</p>
<p>I&#8217;ve heard the term &#8220;fat model&#8221; before, but really had no idea how to fatten up my model.  Now I know.</p>
<p>a</p>
]]></content:encoded>
			<wfw:commentRss>http://ertw.com/blog/2007/11/14/skinny-controller-fat-model/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Greasemonkey Script for canoe.ca</title>
		<link>http://ertw.com/blog/2007/05/01/greasemonkey-script-for-canoeca/</link>
		<comments>http://ertw.com/blog/2007/05/01/greasemonkey-script-for-canoeca/#comments</comments>
		<pubDate>Tue, 01 May 2007 14:21:41 +0000</pubDate>
		<dc:creator>sean</dc:creator>
				<category><![CDATA[Linux/Unix/OpenSource]]></category>
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://ertw.com/blog/2007/05/01/greasemonkey-script-for-canoeca/</guid>
		<description><![CDATA[fixcanoe.user.js Removes the search box at the top of some pages that steals focus. Stops the tabs from rotating on the front page. Don&#8217;t have Greasemonkey? Get it a<p>a</p>
]]></description>
			<content:encoded><![CDATA[<p><a href="http://ertw.com/~sean/fixcanoe.user.js">fixcanoe.user.js</a></p>
<p>Removes the search box at the top of some pages that steals focus.<br />
Stops the tabs from rotating on the front page.</p>
<p>Don&#8217;t have Greasemonkey?  <a href="http://www.greasespot.net/">Get it</a></p>
<p>a</p>
]]></content:encoded>
			<wfw:commentRss>http://ertw.com/blog/2007/05/01/greasemonkey-script-for-canoeca/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

