<?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>Turing tarpit &#187; Development</title>
	<atom:link href="http://www.turingtarpit.com/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.turingtarpit.com</link>
	<description>Where everything is possible but nothing of interest is easy –Alan Perlis</description>
	<lastBuildDate>Thu, 11 Mar 2010 02:01:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>TCPMon: Monitor TCP Transactions on OSX</title>
		<link>http://www.turingtarpit.com/2010/03/tcpmon-tcp-monitor-for-osx/</link>
		<comments>http://www.turingtarpit.com/2010/03/tcpmon-tcp-monitor-for-osx/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 20:05:22 +0000</pubDate>
		<dc:creator>Chandima Cumaranatunge</dc:creator>
				<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.turingtarpit.com/?p=430</guid>
		<description><![CDATA[Essential tool for debugging web services. You can monitor HTTP request headers, returned status codes and content.

This is a double clickable version of the classic Apache TCPMon utility. I simply packaged the program&#8217;s files into an application using the Jar Bundler utility that comes with XCode developer tools.
Take a look at the tutorial on how [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-433 post-thumb" title="tcpmon_icon" src="http://www.turingtarpit.com/wp-content/uploads/2010/03/tcpmon_icon.jpg" alt="tcpmon_icon" width="200" height="200" /><span class="post-tagline">Essential tool for debugging web services. You can monitor HTTP request headers, returned status codes and content.</span></p>
<p><a href="http://www.turingtarpit.com/wp-content/uploads/2010/03/TCPMon.app.zip"><img class="alignleft size-full wp-image-313" title="Download wplogger plugin" src="http://www.turingtarpit.com/wp-content/uploads/2009/03/download2_btn.jpg" alt="Download wplogger plugin" width="130" height="30" /></a></p>
<p>This is a double clickable version of the classic <a href="http://ws.apache.org/commons/tcpmon/index.html" target="_blank">Apache TCPMon</a> utility. I simply packaged the program&#8217;s files into an application using the <em>Jar Bundler</em> utility that comes with <em>XCode</em> developer tools.</p>
<p>Take a look at the <a href="http://ws.apache.org/commons/tcpmon/tcpmontutorial.html" target="_blank">tutorial</a> on how to use it. TCPMon is most commonly used as an intermediary &#8211; a proxy that stands between and listens to incoming and outgoing web traffic.</p>
<p><img class="alignnone" src="http://ws.apache.org/commons/tcpmon/images/concept.jpg" alt="" width="490" height="98" /></p>
<p>This is a very useful tool to monitor network transactions when accessing web services using SOAP and REST. You can monitor returned XML and JSON content without inserting trace or debugging statements in the code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.turingtarpit.com/2010/03/tcpmon-tcp-monitor-for-osx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mounting remote filesystems on OSX Leopard using sshfs, MacFuse and Macfusion</title>
		<link>http://www.turingtarpit.com/2009/04/mounting-remote-filesystems-on-osx-leopard-using-sshfs-macfuse-and-macfusion/</link>
		<comments>http://www.turingtarpit.com/2009/04/mounting-remote-filesystems-on-osx-leopard-using-sshfs-macfuse-and-macfusion/#comments</comments>
		<pubDate>Fri, 01 May 2009 07:06:25 +0000</pubDate>
		<dc:creator>Chandima Cumaranatunge</dc:creator>
				<category><![CDATA[Workflow]]></category>
		<category><![CDATA[SSHFS FUSE filesystems]]></category>

		<guid isPermaLink="false">http://www.turingtarpit.com/?p=315</guid>
		<description><![CDATA[Have you ever wanted to edit the web pages that reside on your commercial web host like they were on your own desktop? Wouldn’t it be nice to mount your entire remote website host directory on the desktop with a nice disk icon? Now you can drag and drop files into it without leaving the Finder. You can also edit files remotely without downloading, editing and uploading. This can be a huge improvement in workflow, and you don’t have to keep track of local and remote versions of files and the inevitable versioning headaches. This post shows you how to combine three free tools to setup this workflow.]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-342 post-thumb" title="macfuse_icon" src="http://www.turingtarpit.com/wp-content/uploads/2009/04/macfuse_icon.jpg" alt="macfuse_icon" width="200" height="200" /><span class="post-tagline">Work on the web pages that reside on your commercial web host like they were on your own desktop.</span></p>
<p>If you have cursed out an FTP client ( under your breath of course ) at any point in a development cycle, welcome to the club. I develop on an OSX machine and I love Cyberduck &#8211; the popular FTP client for the Mac. But wouldn&#8217;t it be nice to mount your  entire remote website host directory on the desktop with a nice disk icon? Now you can drag and drop files into it without leaving the Finder. You can also edit files remotely without downloading, editing and uploading. This can be a huge improvement in workflow, and you don&#8217;t have to keep track of local and remote versions of files and the invariable versioning headaches.</p>
<a name="wptoc_0_0_0"></a><h3>Advantages</h3>
<ul>
<li><strong>Avoid UNIX:</strong> Most hosting plans run on some variant of UNIX/Linux. Stuff that you had to do on the server over SSH using the Terminal can now be done on the desktop. For example, WordPress plugins and themes can be downloaded, unzipped and moved to their proper locations, all from the desktop. You no longer have to execute cryptic commands from the UNIX command line.</li>
<li><strong>Develop on a thin client: </strong>You can develop on a lightweight Netbook with a super fast, but low-capacity solid-state (SSD) drive. You don&#8217;t have to worry about the limited disk space  because your workspace resides on the remote server.</li>
<li><strong>Don&#8217;t have to worry about backups:</strong> Most hosting plans have some sort of incremental backup on the server side. Your workspace will automatically get backed up on the server.</li>
</ul>
<p>First, a caution &#8211; I&#8217;m not advocating editing a live website. Although that is certainly possible, it is not recommended practice. However, there are a myriad of little things that can be done quite efficiently if the remote filesystem was mounted on the desktop. Moving, renaming and deleting files is super easy ( these actions can be a real pain to accomplish using an FTP client). For those perfectionists who incessantly tinker with image files, just open the file, make the change and save it. The huge advantage is the seamless access and the improvement in overall workflow.<span id="more-315"></span></p>
<a name="wptoc_0_0_1"></a><h3>Disadvantages</h3>
<ul>
<li><strong>Filesystem response dependent on network speed: </strong>This is the big caveat. This method is not suitable for editing 100MB Photoshop files. However, it can be very effective for editing web pages.</li>
</ul>
<a name="wptoc_0_0_2"></a><h3><strong>System requirements</strong></h3>
<ul>
<li>You need to have access to a remote server like a commercial web host ( e.g. Dreamhost, Media Temple ).</li>
<li><a href="http://en.wikipedia.org/wiki/Secure_Shell" target="_blank">SSH</a> ( <em>Secure SHell</em> ) remote login has to be available and setup on the server. You can turn on SSH access on most hosting plans through your web panel. Make sure that you test SSH access before proceeding.</li>
<li>The method described here works only on Mac OSX Leopard.</li>
</ul>
<a name="wptoc_0_0_3"></a><h3>Method</h3>
<p>You need to install three applications / frameworks:</p>
<ol>
<li><a href="http://code.google.com/p/macfuse/" target="_blank">MacFuse</a></li>
<li><a href="http://www.macfusionapp.org/support.html" target="_blank">Macfusion</a></li>
<li><a style="text-decoration: none;" href="http://code.google.com/p/macfuse/wiki/MACFUSE_FS_SSHFS" target="_blank">sshfs</a> (to update the old version pre-installed with Macfusion)</li>
</ol>
<a name="wptoc_3_1_0"></a><h4>1. Install MacFuse</h4>
<p><img class="alignnone size-full wp-image-317" title="macfuse" src="http://www.turingtarpit.com/wp-content/uploads/2009/04/macfuse.jpg" alt="macfuse" width="250" height="145" /></p>
<p><a href="http://code.google.com/p/macfuse/" target="_blank">MacFuse</a> is an OSX implementation of the <em>Filesystem in Userspace</em> (FUSE) framework. <em>Fuse</em> provides an API to write a <em>virtual file system</em>. Virtual in the sense that a developer can write a file-system like front-end to any structured information source.  Even though the information is accessed and manipulated as files, the actual data doesn&#8217;t need to be files on a disk. For example, there is the Picasa image file system (<em>PicasawebFS)</em>, a virtual filesystem that allows you to mount all your Picasa images like a disk on the desktop. Then theres is the RSS file system (<em>RSSFS)</em> that allows you to mount an RSS feed as a filesystem and access each entry as an individual file. <strong>We will use SSHFS, the </strong><em><strong>Secure SHell FileSystem</strong></em>, that allows you to mount a remote computer directory though a <em>secure shell (SSH) </em>login. If you want additional technical details, watch a <a href="http://video.google.com/videoplay?docid=3138515991250095768" target="_blank">screencast</a> by  Amit Sigh, the project owner of  MacFuse.</p>
<p><strong>Download and install MacFuse from google code:</strong></p>
<p><a href="http://code.google.com/p/macfuse/" target="_blank">http://code.google.com/p/macfuse/</a></p>
<p>MacFuse comes with a nice preference pane to check for updates. The version was 2.0.3 as of this writing.</p>
<a name="wptoc_3_1_1"></a><h4>2. Install Macfusion</h4>
<p><img class="alignnone size-full wp-image-318" title="macfusion-icon" src="http://www.turingtarpit.com/wp-content/uploads/2009/04/macfusion-icon.png" alt="macfusion-icon" width="64" height="64" /></p>
<p>Macfusion is an open source SSHFS mounting application for OSX Leopard. There are a couple of apps out there that do this ( <a href="http://mac.softpedia.com/get/Network-Admin/sshfs.shtml" target="_blank">sshfs 1.0</a>, <a href="http://www.pqrs.org/tekezo/macosx/sshfs/" target="_blank">sshfs for Mac OS X</a> ), but Macfusion is by far the most mature.</p>
<p><strong>Download and install from:</strong></p>
<p><a href="http://www.macfusionapp.org" target="_blank">http://www.macfusionapp.org</a></p>
<a name="wptoc_1_2_0"></a><h5>Add an SSHFS file system</h5>
<p>To add an SSHFS file system click on the plus icon at the bottom of the main window and choose SSHFS.</p>
<div id="attachment_320" class="wp-caption alignnone" style="width: 412px"><img class="size-full wp-image-320" title="add_sshfs" src="http://www.turingtarpit.com/wp-content/uploads/2009/04/add_sshfs.jpg" alt="add_sshfs" width="402" height="126" /><p class="wp-caption-text">Adding an SSHFS filesystem</p></div>
<a name="wptoc_1_2_1"></a><h5>Set SSHFS mount parameters</h5>
<p>Under the <strong>SSH</strong> tab:</p>
<ul>
<li><strong>Host:</strong> The <em>hostname</em> of the server that you SSH to. This is usually the domain name of you website ( e.g. &#8216;yourdomain.com&#8217; ).</li>
<li><strong>User Name: </strong>Your SSH username.</li>
<li><strong>Password: </strong>Your SSH password.</li>
<li><strong>Path: </strong>can be left blank.</li>
</ul>
<p>Under the <strong>SSH Advanced</strong> tab:</p>
<ul>
<li><strong>Port:</strong> The default SSH port is 22 unless your server uses a different one ( just try 22 ).</li>
<li><strong>Follow Symbolic Links: </strong>Leave this checked.</li>
</ul>
<p>Under the <strong>Macfusion</strong> tab:</p>
<ul>
<li><strong>Mount Point and Volume Name:</strong> Can be left blank.</li>
<li><strong>Ignore Apple Double Files: </strong>You must <em>uncheck</em> this if you plan to <em>open/edit/save</em> files on the mounted volume.  For example, if you want to edit an image file using Photoshop, this setting has to be <em>unchecked</em>. However, this powerful feature comes with a downside. Leaving this unchecked will  cause OSX to place .DS_Store and ._ * ( Appledouble ) files on the server.  OSX utilizes these hidden files for enhanced filesystem features and extended file attributes in non OSX native filesystems. For example, a Photoshop file can have icon, thumbnail, and version cue information saved in a separate Appledouble file. These files are invisible in OSX and other filesystems as they start with a dot. Leave this <em>checked</em> if you are just going to <em>copy/move/delete</em> files ( increases speed ). You can leave this checked if editing text files as most apps don&#8217;t save additional file attributes with text files. However, this depends on the application you use, so do some testing first.</li>
<li><strong>Enable Negative VNode Cache:</strong> This is an <a href="http://code.google.com/p/macfuse/wiki/OPTIONS" target="_blank">optimization</a> to increase speed and should generally be left <em>checked </em>unless files can appear on the mounted volume from the server side. For example, if multiple users are using your mounted disk space leave this <em>unchecked</em>.</li>
</ul>
<p><a title="SSH tab" rel="shadowbox[SSHFS settings]" href="http://www.turingtarpit.com/wp-content/uploads/2009/04/ssh.jpg"><img class="size-thumbnail wp-image-323 alignnone" title="ssh" src="http://www.turingtarpit.com/wp-content/uploads/2009/04/ssh-150x150.jpg" alt="ssh" width="120" height="120" /></a> <a title="SSH Advanced tab" rel="shadowbox[SSHFS settings]" href="http://www.turingtarpit.com/wp-content/uploads/2009/04/ssh_advanced.jpg"><img class="size-thumbnail wp-image-324 alignnone" title="ssh_advanced" src="http://www.turingtarpit.com/wp-content/uploads/2009/04/ssh_advanced-150x150.jpg" alt="ssh_advanced" width="120" height="120" /></a> <a title="Macfusion tab" rel="shadowbox[SSHFS settings]" href="http://www.turingtarpit.com/wp-content/uploads/2009/04/macfusion.jpg"><img class="alignnone size-thumbnail wp-image-322" title="macfusion" src="http://www.turingtarpit.com/wp-content/uploads/2009/04/macfusion-150x150.jpg" alt="macfusion" width="120" height="120" /></a></p>
<p>You will now have an SSHFS filesystem ready to mount on your desktop.</p>
<a name="wptoc_1_2_2"></a><h5>Mount the remote filesystem</h5>
<p>Click on the mount button and if the SSH settings are correct, you should have a green disk icon mounted on the desktop.</p>
<div id="attachment_330" class="wp-caption alignnone" style="width: 415px"><img class="size-full wp-image-330" title="mounted" src="http://www.turingtarpit.com/wp-content/uploads/2009/04/mounted.jpg" alt="mounted" width="405" height="111" /><p class="wp-caption-text">Macfusion main window after mounting a remote filesystem</p></div>
<p>You can now access your remote files like they were on an external disk attached to your computer. You can copy, move, rename and delete files at ease. Remember that if you want to edit files on the remotely mounted disk, the <em>Ignore Apple Double Files</em> checkbox should be <em>unchecked</em>. You can easily edit the SSHFS mount settings by unmounting the disk and clicking on the Edit button.</p>
<p>You might have noticed that we completed only two of the three steps but you can already mount your remote filesystem. This is because Macfusion already has SSHFS pre-installed within its application package. However, I found  the mounted filesystem response to be a little sluggish and wondered if the version of SSHFS that came pre-installed with Macfusion was outdated.</p>
<a name="wptoc_3_1_2"></a><h4>3. Update SSHFS</h4>
<p>Let&#8217;s examine the pre-installed version of SSHFS that comes with Macfusion. RIGHT-CLICK ( or CONTROL-CLICK) on the Macfusion app in the Applications folder. You will be presented with a contextual menu. Choose the &#8220;Show Package Contents&#8221; menu option. You will then be presented with a folder containing the application folder hierarchy. Drill down until you see an application called sshfs-static.</p>
<div id="attachment_333" class="wp-caption alignnone" style="width: 268px"><a title="Macfusion application package hierarchy" rel="shadowbox" href="http://www.turingtarpit.com/wp-content/uploads/2009/04/macfusion_folders.jpg"><img class="size-medium wp-image-333" title="macfusion_folders" src="http://www.turingtarpit.com/wp-content/uploads/2009/04/macfusion_folders-258x300.jpg" alt="macfusion_folders" width="258" height="300" /></a><p class="wp-caption-text">Macfusion application hierarchy showing the location of the pre-installed version of SSHFS</p></div>
<p>This is the copy of sshfs that Macfusion uses to do its magic. To check its version, I opened up the Terminal app, changed directory to the parent folder off sshfs-static and typed in ./sshfs-static -V . You don&#8217;t have to do this by-the-way, just skip to the <em>Download and Install SSHFS</em> section.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">% cd /Applications/Macfusion.app/Contents/PlugIns/sshfs.mfplugin/Contents/Resources/
% ls -la
total 5736
drwxr-xr-x  9 chandima  staff      306 Aug  4  2008 .
drwxr-xr-x  5 chandima  staff      170 Aug  4  2008 ..
-rwxr-xr-x  1 chandima  staff    46928 Aug  4  2008 new_sshfs_askpass
-rwxr-xr-x  1 chandima  staff  2756952 Aug  4  2008 sshfs-static
-rw-r--r--  1 chandima  staff    13259 Aug  4  2008 sshfs.png
-rw-r--r--  1 chandima  staff     6796 Aug  4  2008 sshfsAdvanced.nib
-rw-r--r--  1 chandima  staff     7609 Aug  4  2008 sshfsConfiguration.nib
-rw-r--r--  1 chandima  staff    61418 Aug  4  2008 sshfs_icon.icns
-rwxr-xr-x  1 chandima  staff    29280 Aug  4  2008 sshnodelay.so
% ./sshfs-static -V
SSHFS version 1.8 (MacFUSE SSHFS 1.3.0)
MacFUSE library version: FUSE 2.7.3 / MacFUSE 2.0.3
no mount point</pre></div></div>

<p>The pre-installed version was 1.8. I wondered if I&#8217;d get a speed increase if SSHFS was updated to the latest version which was 2.2 (as of this writing).</p>
<p><strong>Download SSHFS from:</strong></p>
<p><a href="http://code.google.com/p/macfuse/wiki/MACFUSE_FS_SSHFS" target="_blank">http://code.google.com/p/macfuse/wiki/MACFUSE_FS_SSHFS</a> (make sure you download <strong>sshfs-static-leopard.gz</strong> ).</p>
<p>After you uncompress the gzip archive, you will end up with a folder called <em>sshfs-binaries</em>. In there, you will see an app called <em>sshfs-static-leopard</em>.</p>
<p><strong>Rename the sshfs executable:</strong></p>
<p>Rename <em>sshfs-static-leopard</em> app to <em>sshfs-static </em>to match the filename that Macfusion expects.</p>
<p><strong>Replace the old version of sshfs with the new version:</strong></p>
<p>Drag and drop the downloaded and renamed <em>sshfs-static</em> executable into the <em>Resources</em> folder to replace the older version within the Macfusion package hierarchy.</p>
<p>You can check the version again to make sure that the new version is recognized.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">% ./sshfs-static -V
SHFS version 2.2 (MacFUSE SSHFS 2.2.0)
MacFUSE library version: FUSE 2.7.3 / MacFUSE 2.0.3
no mount point</pre></div></div>

<p>I unmounted and remounted the filesystem and the speed increase was quite significant. I highly recommend that you do this third step.</p>
<a name="wptoc_0_0_4"></a><h3>What to do about those pesky <code>.DS_Store</code> and Appledouble files?</h3>
<p>There is a solution to <a href="http://support.apple.com/kb/HT1629" target="_blank">prevent <code>.DS_Store</code> file creation over network connections</a>.</p>
<p>The real power of this workflow is being able to edit files remotely without first copying them to the local computer. The <em>Ignore Apple Double Files</em> checkbox has to be left <em>unchecked</em> in order to edit images using Photoshop etc. However, as mentioned previously, this will cause OSX to spew  ._ * files on the server. These files, although invisible on the filesystem UI are still accessible through the web. As far as I know, the Appledouble files don&#8217;t contain any sensitive information like passwords and such and can be regarded as relatively harmless ( let me know if this is an incorrect assumption ).</p>
<a name="wptoc_0_0_5"></a><h3>Next steps</h3>
<p>Try it out and post a comment with your thoughts. I am interested in seeing if it does improve the workflow for web developers. For those of you who use a versioning system like subversion, I&#8217;m interested in getting some feedback on how this can be integrated, or if it is overkill.</p>
<p>I&#8217;ve only tested this with my commercial host ( Dreamhost.com ) that runs Linux, although it should work with most hosts that run some variant of UNIX / Linux. There could be permission issues depending on whether the remote filesystem allows extended file attributes. I&#8217;ll try and help out if you do have problems.</p>
<p>If anyone knows of a tutorial / resources on mounting remote filesystems on Windows please post a comment and I&#8217;ll integrate it into the post.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.turingtarpit.com/2009/04/mounting-remote-filesystems-on-osx-leopard-using-sshfs-macfuse-and-macfusion/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>PureMVC Console &#8211; Shines a light inside the MVC triad</title>
		<link>http://www.turingtarpit.com/2009/03/puremvc-console-shines-a-light-inside-the-mvc-triad/</link>
		<comments>http://www.turingtarpit.com/2009/03/puremvc-console-shines-a-light-inside-the-mvc-triad/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 22:31:38 +0000</pubDate>
		<dc:creator>Chandima Cumaranatunge</dc:creator>
				<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[PureMVC]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.turingtarpit.com/?p=26</guid>
		<description><![CDATA[I was checking the PureMVC website today and came across PureMVC Console developed by the good folks at Kap Lab. This is an absolutely invaluable tool to figure out in real-time what is going on inside the Flex PureMVC framework in a running application.]]></description>
			<content:encoded><![CDATA[<p>I was checking the <a href="http://puremvc.org/">PureMVC</a> website today and came across <a href="http://lab.kapit.fr/display/puremvcconsole/PureMVC+Console">PureMVC Console</a> developed by the good folks at <a href="http://lab.kapit.fr/display/kaplabhome/Home">Kap Lab</a>. This is an absolutely invaluable tool to figure out in real-time what is going on inside the Flex PureMVC framework in a running application. PureMVC is quite lightweight and is very good at keeping things hidden under the hood. However, during development it is essential to get a snapshot of application state and the sequence of notifications. This is exactly what PureMVC Console does. It provides you with a flashlight to peer into your Notifications, Commands, Mediators and Proxies and track notifications and application flow in response to user gestures and other events.</p>
<div>
<p>For example, if you need to know the state of your <em>value objects</em> at any point, just click on the <em>Proxies</em>tab and select the proxy.</p>
<p><a title="Inspecting the value objects inside the proxies" rel="shadowbox[PureMVC Console]" href="http://www.turingtarpit.com/wp-content/uploads/2009/03/vos.jpg"><img class="alignnone size-medium wp-image-28" title="Inspecting the value objects inside the proxies" src="http://www.turingtarpit.com/wp-content/uploads/2009/03/vos-300x257.jpg" alt="Inspecting the value objects inside the proxies" width="300" height="257" /></a></p>
<p>If you want to check the sequence of actions taking place in your application from startup, just click on the PureMVC flow tab. This is very useful for debugging as it provides a record of the command invocation sequence and will help answer questions like &#8220;why did this command execute before this other one?&#8221;</p>
<p><a title="Inspecting the flow of the application" rel="shadowbox[PureMVC Console]" href="http://www.turingtarpit.com/wp-content/uploads/2009/03/flow1.jpg"><img class="alignnone size-medium wp-image-32" title="Inspecting the flow of the application" src="http://www.turingtarpit.com/wp-content/uploads/2009/03/flow1-300x259.jpg" alt="Inspecting the flow of the application" width="300" height="259" /></a></p>
<p>I am a big fan of the <a href="http://osflash.org/xray">Xray logger</a> developed for Flash AS2 and had to try out this console right away as this is the first console with similar utility for AS3, I integrated the console into the <a href="http://trac.puremvc.org/Demo_AS3_Flex_EmployeeAdmin">Employee Admin demo</a> (developed by Cliff Hall).</p>
<a name="wptoc_0_0_0"></a><h4>Employee Admin Demo with integrated Console</h4>
<p>Click on the button below to open the Employee Admin demo. Make sure that you hit <strong>Ctrl+Alt+F6</strong> to open the console ( <strong>Alt</strong> = <strong>Option</strong> in OSX ).</p>
<p><a href="http://www.turingtarpit.com/wp-content/uploads/2009/03/employeeadmin.swf" target="_blank"><img class="alignnone size-full wp-image-39" title="click_to_open_btn" src="http://www.turingtarpit.com/wp-content/uploads/2009/03/click_to_open_btn.jpg" alt="click_to_open_btn" width="101" height="34" /></a></p>
<a name="wptoc_0_0_1"></a><h4>Integrating the console into the <em>Employee Admin</em> Demo</h4>
<p>The console is very easy to integrate into a new or existing app &#8211; just follow the <a href="http://lab.kapit.fr/display/puremvcconsole/Integration+Guide">integration guide</a>. The ease of integration is a huge plus as it is simply injected before the application is invoked.</p>
<a name="wptoc_1_1_0"></a><h5>1. Add the PureMVC Console SWC into your library</h5>
<p>First drag-and-drop the PureMVC Console swc file into the libs folder in your Flex project. There is a different swc if you are using the multi-core version of PureMVC.</p>
<p><img class="alignnone size-full wp-image-50" title="project_files" src="http://www.turingtarpit.com/wp-content/uploads/2009/03/project_files.jpg" alt="project_files" width="226" height="199" /></p>
<a name="wptoc_1_1_1"></a><h5>2. Add the console component into your application</h5>
<p>For an MXML app, you need to add an additional  <code>xmlns:kapit="fr.kapit.*"</code> name space attribute to the  <code>&lt;mx:Application&gt;</code> tag and then add the  <code>&lt;kapit:PureMVCConsole/&gt;</code> component before the closing <code>&lt;/mx:Application&gt;</code> tag (see <a href="http://lab.kapit.fr/display/puremvcconsole/Integration+Guide">integration guide</a>). I added this to the <code>EmployeeAdmin.mxml</code> file which is the default application for the project.</p>
<a name="wptoc_1_1_2"></a><h5>3. Add a new SwitchFacade parent class for you application facade</h5>
<p>The next step is to create a new <code>SwitchFacade</code> class and modify your application facade so that it inherits from <code>SwitchFacade</code> ( instead of the PureMVC <code>Facade</code> class ). The <code>SwitchFacade</code> class is the same for all apps and can be copied and pasted from the <a href="http://lab.kapit.fr/display/puremvcconsole/Integration+Guide">integration guide</a>. Make sure you create the <code>SwitchFacade</code> class in the same location in the folder hierarchy where you current application facade class resides. You can right click on the enclosing folder (employeeadmin in my case) and create <strong>New &gt; ActionScript Class</strong> and type in <code>SwitchFacade</code> for the class name. Now copy and paste the code.</p>
<p><img class="alignnone size-full wp-image-54" title="project_files2" src="http://www.turingtarpit.com/wp-content/uploads/2009/03/project_files2.jpg" alt="project_files2" width="345" height="415" /></p>
<p>Injecting the  <code>SwitchFacade</code> class allows you to control the integration of the console using compiler directives as opposed to changing code when it comes time to ship the application. <code>SwitchFacade</code> extends the PureMVC <code>Facade</code> class if the <em>CONFIG::release</em> directive is set. Conversely, if the <em>CONFIG::debug</em> directive is set ( and <em>CONFIG::release</em> is unset), <code>SwitchFacade</code> extends  <code>DebugFacade</code> that has all the debug stuff required by the console.</p>
<a name="wptoc_1_1_3"></a><h5>4. Set the compiler directives</h5>
<p>To control which facade gets extended you need to add the <em>CONFIG::release</em> and <em>CONFIG::debug</em> directives in the compiler options. Right click on the <em>Project folder</em> and choose <em>properties</em> from the contextual menu. Now click on <em>Flex Compiler</em> option to add the additional compiler directives in the <em>Additional Compiler Arguments</em> field.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">-define=CONFIG::release,false -define=CONFIG::debug,true</pre></div></div>

<p><a title="Setting compiler options" rel="shadowbox[PureMVC Console]" href="http://www.turingtarpit.com/wp-content/uploads/2009/03/compiler_options.jpg"><img class="alignnone size-medium wp-image-57" title="compiler_options" src="http://www.turingtarpit.com/wp-content/uploads/2009/03/compiler_options-300x240.jpg" alt="compiler_options" width="300" height="240" /></a></p>
<p><a title="Setting compiler options" rel="shadowbox[PureMVC Console]" href="http://www.turingtarpit.com/wp-content/uploads/2009/03/compiler_options.jpg"></a><br />
Reset the directives for the release version.</p>
<p><strong>Recap of cool features:</strong></p>
<ul>
<li>Very easy to integrate into a new or existing app.</li>
<li>Works with the standard version of Flash ( does not need the debugger version ).</li>
<li>Integration is controlled by using compiler options ( just change a compiler option for the release version ).</li>
</ul>
<p>Simple to integrate and keeps out of the way of you doing the job of coding and debugging &#8211; excellent!</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.turingtarpit.com/2009/03/puremvc-console-shines-a-light-inside-the-mvc-triad/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
