<?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>Adventures in Japanese Programming &#187; debug</title>
	<atom:link href="http://blog.japanesetesting.com/tag/debug/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.japanesetesting.com</link>
	<description>Design and Programming of a mISV Site</description>
	<lastBuildDate>Fri, 23 Jul 2010 13:29:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Taking the pain out of CakePHP deployment: Batch Scripts and SVN</title>
		<link>http://blog.japanesetesting.com/2010/04/23/taking-the-pain-out-of-cakephp-deployment-batch-scripts-and-svn/</link>
		<comments>http://blog.japanesetesting.com/2010/04/23/taking-the-pain-out-of-cakephp-deployment-batch-scripts-and-svn/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 02:52:50 +0000</pubDate>
		<dc:creator>Harisenbon</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cakephp]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://blog.japanesetesting.com/?p=148</guid>
		<description><![CDATA[If you take a look at the update rate of this blog, or the wait time on my email responses, or even the changelogs from my Subversion repository, you will notice one thing &#8212; I am a horrible procrastinator.
Well, not actually true. I&#8217;m a great procrastinator.
I found out a long time ago that something I [...]]]></description>
			<content:encoded><![CDATA[<p>If you take a look at the update rate of this blog, or the wait time on my email responses, or even the changelogs from my Subversion repository, you will notice one thing &#8212; I am a <strong>horrible </strong>procrastinator.</p>
<p>Well, not actually true. I&#8217;m a <strong>great </strong>procrastinator.</p>
<p>I found out a long time ago that something I think will take 10 minutes ends up taking an hour, and things I think will take an hour end up taking 10 minutes. The downside to this thought pattern is that it makes it hard for me to start anything I know that I can&#8217;t get done in 1 minute, unless I have a lot of time to kill on it.</p>
<p>The more steps there are to a process, the less likely I am to feel that I can get it done in the small amount of time I have allowed.</p>
<h2>What is the process for deploying a project with CakePHP?</h2>
<p>The process for deploying a cakePHP website is monotonous enough, but at the same time contains enough fiddly bits to be annoying to do more than once in a blue moon.</p>
<ol>
<li>Export the data from the SVN to the directory of your choice (dev or live in my case)</li>
<li>If you&#8217;re anal about keeping logs of what you exported (like me), write the version info to a file.</li>
<li>Update the config file so that your local version (which is probably running in debug 1 or 2) runs without debug info.</li>
<li>Remove all the old cache data in case you made any changes to your models</li>
<li>Done</li>
</ol>
<p>Kind of a pain in the rear.</p>
<p>And we all know what are great for repetitive tasks with lots of fiddly steps that are a pain in the rear:</p>
<h2>Enter the bash file</h2>
<p>I created a simple batch file that I can run directly on my <a title="SliceHost" href="http://slicehost.com" target="_blank">SliceHost</a> server. It allows me to deploy a specific folder from my SVN, pick whether to deploy to the dev site or the live site, clear the cache, and set the debug settings.</p>
<h3><span style="font-size: 15px;">Now let&#8217;s do it in one line</span></h3>
<pre class="brush: plain;">./deploy live app</pre>
<p><strong>Done</strong>.</p>
<p>Here&#8217;s what comes out the other end:</p>
<pre class="brush: plain;">
Setting LIVE
.....
Lots of SVN Export Data
.....
Reset Config File: [livesite]/app/config/core.php
Cleared out Cache
</pre>
<p>This gives me a sense of security when updating my site, because I know that I won&#8217;t have forgotten any of the tiny repetitive details, and can fill my deploy checklist with more important things (such as &#8220;Check that users can login&#8221;) instead of &#8220;Set Debug to 0.&#8221;</p>
<h2>Here&#8217;s the Code</h2>
<p>I know, I know. All you want is the code. Well here you go. Feel free to edit and use as you like, but be sure to set your svn and target paths.</p>
<pre class="brush: bash;">
#!/bin/sh
# usage: ./deploy TYPE DIR
# TYPE = live | (anything else)
#
# Be sure to edit the following:
# _MY_SVN_DIR_ -- the base SVN dir for this project
# _MY_LIVE_PATH_ ex: /home/ippatsu/japanesetesting.com/public
# _MY_DEV_PATH_ ex: /home/ippatsu/beta.japanesetesting.com/public

# Set as Life or Dev
if [ &quot;$1&quot; != &quot;live&quot; ]; then
echo &quot;Setting DEVsite&quot;
TARGETP=&quot;_MY_DEV_PATH_&quot;
else
echo &quot;Setting LIVE&quot;
TARGETP=&quot;_MY_LIVE_PATH_&quot;
fi

# Export Data
svn export --force svn://127.0.0.1/_MY_SVN_DIR_/$2  $TARGETP/$2

# Write Version to File
svn info svn://127.0.0.1/_MY_SVN_DIR_/$2 &gt; $TARGETP/version.txt
svn info svn://127.0.0.1/_MY_SVN_DIR_/$2

# Update Config File
OLD=&quot;Configure::write('debug', 2);&quot;
NEW=&quot;Configure::write('debug', 0);&quot;
CONFIGFILE=&quot;$TARGETP/app/config/core.php&quot;

sed -i &quot;s/$OLD/$NEW/g&quot; $CONFIGFILE
echo &quot;Reset Config File: $CONFIGFILE&quot;

# Clearout Cake Model Cache
rm $TARGETP/app/tmp/cache/models/cake*
rm $TARGETP/app/tmp/cache/persistent/cake*
rm $TARGETP/app/tmp/cache/views/cake*
echo &quot;Cleared out Cache&quot;

exit 0
</pre>
<p>Hope you enjoy it, and if you have any advice or questions, just leave them in the comments!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.japanesetesting.com/2010/04/23/taking-the-pain-out-of-cakephp-deployment-batch-scripts-and-svn/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>CakePHP DebugKit: Take Back your Debugging</title>
		<link>http://blog.japanesetesting.com/2009/11/12/cakephp-debugkit-take-back-your-debugging/</link>
		<comments>http://blog.japanesetesting.com/2009/11/12/cakephp-debugkit-take-back-your-debugging/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 03:48:47 +0000</pubDate>
		<dc:creator>Harisenbon</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[cakephp]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[plugins]]></category>

		<guid isPermaLink="false">http://blog.japanesetesting.com/?p=115</guid>
		<description><![CDATA[Yet another foray into the WORD: The Subtitle blog posts; today we&#8217;re going to look at the amazing features of the CakePHP DebugKit.
The DebugKit is a standard plugin for CakePHP written by Mark Story. It provides a lot more information that the standard debugging features of cake (Errors, warnings, SQL Queries) and also keeps them [...]]]></description>
			<content:encoded><![CDATA[<p>Yet another foray into the <strong>WORD: The Subtitle</strong> blog posts; today we&#8217;re going to look at the amazing features of the CakePHP DebugKit.</p>
<p>The <a href="http://www.ohloh.net/p/cakephp-debugkit">DebugKit </a>is a standard plugin for CakePHP written by <a href="http://mark-story.com/">Mark Story</a>. It provides a lot more information that the standard debugging features of cake (Errors, warnings, SQL Queries) and also keeps them in a nice contained collapsible icon at the top of your page so you don&#8217;t have to have error messages and sql queries appearing all over the page.</p>
<h2>The Debug Kit Interface</h2>
<div id="attachment_120" class="wp-caption aligncenter" style="width: 206px"><img class="size-full wp-image-120 " title="debug_icon" src="http://blog.japanesetesting.com/wp-content/uploads/2009/11/debug_icon.jpg" alt="DebugKit Icon" width="196" height="81" /><p class="wp-caption-text">DebugKit Icon</p></div>
<p>Click the Cake icon at the top of your page, and it expands to all the tools you&#8217;ll need.</p>
<div id="attachment_119" class="wp-caption aligncenter" style="width: 412px"><img class="size-full wp-image-119" title="debug_expanded" src="http://blog.japanesetesting.com/wp-content/uploads/2009/11/debug_expanded.jpg" alt="DebugKit Expanded" width="402" height="35" /><p class="wp-caption-text">DebugKit Expanded</p></div>
<p>If you click any of the titles there, it shows you various debug information such as the current Session information, how the Request was processed, the SQL Log, a timer for all the functions that were called, currently accessible variables and the current memory usage.</p>
<div id="attachment_122" class="wp-caption aligncenter" style="width: 341px"><img class="size-full wp-image-122 " title="debug_variables" src="http://blog.japanesetesting.com/wp-content/uploads/2009/11/debug_variables.jpg" alt="DebugKit Variables View" width="331" height="186" /><p class="wp-caption-text">DebugKit Variables View</p></div>
<div id="attachment_121" class="wp-caption aligncenter" style="width: 341px"><img class="size-full wp-image-121" title="debug_timer" src="http://blog.japanesetesting.com/wp-content/uploads/2009/11/debug_timer.jpg" alt="DebugKit Timer View" width="331" height="277" /><p class="wp-caption-text">DebugKit Timer View</p></div>
<p>All in all, an amazing amount of information. And best of all? It stays out of the way so your designs don&#8217;t get cluttered with debug information while you&#8217;re testing.</p>
<h2>Installation</h2>
<p>Installation is easy.</p>
<h3>Download</h3>
<p>Download the debug kit from ohloh. <a href="http://www.ohloh.net/p/cakephp-debugkit" target="_blank">http://www.ohloh.net/p/cakephp-debugkit</a></p>
<h3>Install</h3>
<p>Place the DebugKig in the plugins folder of your application:</p>
<p>/app/plugins/debug_kit/[INSERT ME HERE]</p>
<h3>Connect</h3>
<p>Add the DebugKit Toolbar component to your app_controller, so it will be available to all your controllers.</p>
<pre class="brush: php;">

// app_controller.php
var $components = array('DebugKit.Toolbar');
</pre>
<p>Then set the debug mode to at least 1.</p>
<h2>Problems</h2>
<p>DebugKit isn&#8217;t a perfect system (or maybe my understanding of it isn&#8217;t quite perfect). In any case, these are some problems I&#8217;ve had with DebugKit, but even they&#8217;re not enough to really gripe about.</p>
<h3>Speed</h3>
<p>DebugKit does seem to take <strong>a lot</strong> more processing power to run it than the standard Debug functions of cake.</p>
<p>This is easy to understand, though, as with the timers, reporters and everything, it&#8217;s doing quite a bit more than the standard Debug functions, and gives you a lot more information. I&#8217;ve had my dev-laptop exceed the 30sec execution time limit quite a few times while running DebugKit, but nothing like that has ever happened on my dev-server, so I doubt it&#8217;s anything major. It does make navigation a bit slower though, so when testing user flow, I would recommend turning it off by setting the Debug level to 0 for the duration of the session.</p>
<p>And remember, if you switch your debug to 0, then the DebugKit isn&#8217;t run at all, so there&#8217;s no worries about it eating precious resources on your live server.</p>
<h3>Ajax Reporting</h3>
<div id="attachment_123" class="wp-caption alignright" style="width: 250px"><img class="size-full wp-image-123" title="debug_ajax" src="http://blog.japanesetesting.com/wp-content/uploads/2009/11/debug_ajax.jpg" alt="Ajax doesn't seem to be affected" width="240" height="187" /><p class="wp-caption-text">Ajax doesn&#39;t seem to be affected</p></div>
<p>When you make a request with Ajax, the DebugKit doesn&#8217;t seem to get spun up like it should &#8212; which results in it reverting to the standard CakePHP reporting, which (while not bad) is definitely a grade down compared to the glory of DebugKit. It would have been nice to have the reporting fed into another icon inside the div that displays the ajax result, or something to that effect. Perhaps there is a way, and I just haven&#8217;t found it yet. Always a possibility.</p>
<h2>Conclusion</h2>
<p>Really, there isn&#8217;t much else to say except: why are you waiting? <a href="http://www.ohloh.net/p/cakephp-debugkit" target="_blank">Go download this thing now!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.japanesetesting.com/2009/11/12/cakephp-debugkit-take-back-your-debugging/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
