<?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"
	>

<channel>
	<title>Mariano Peterson</title>
	<atom:link href="http://petersonpages.com/mariano/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://petersonpages.com/mariano/blog</link>
	<description>The truth behind the curtain</description>
	<pubDate>Thu, 08 Oct 2009 05:42:01 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
	<language>en</language>
			<item>
		<title>Pattern Traps</title>
		<link>http://petersonpages.com/mariano/blog/2009/10/07/pattern-traps/</link>
		<comments>http://petersonpages.com/mariano/blog/2009/10/07/pattern-traps/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 05:42:01 +0000</pubDate>
		<dc:creator>Mariano</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://petersonpages.com/mariano/blog/?p=33</guid>
		<description><![CDATA[Design patterns are ideas for solving problems that commonly occur in software development. Patterns provide a language framework for programmers, helping us to discuss abstract concepts in an efficient manner.
If you&#8217;re not familiar with design patterns, I highly recommend reading the seminal work by the Gang of Four: Design Patterns: Elements of Reusable Object-Oriented Software. [...]]]></description>
			<content:encoded><![CDATA[<p>Design patterns are ideas for solving problems that commonly occur in software development. Patterns provide a language framework for programmers, helping us to discuss abstract concepts in an efficient manner.</p>
<p>If you&#8217;re not familiar with design patterns, I highly recommend reading the seminal work by the Gang of Four: <a href="http://en.wikipedia.org/wiki/Design_Patterns_(book)">Design Patterns: Elements of Reusable Object-Oriented Software</a>. Its a bit dry but an excellent read. I remember when Joshua Storck recommended the book to me many years ago; it opened my eyes to a higher level of programming and helped me grow from a task implementer to a software designer.</p>
<p>Patterns are helpful for structuring thought around problems and forming elegant solutions. However, there are a few things to keep in mind: Patterns have consequences, and patterns are not best-practices. Programmers must still apply thought. Terry Chay describes this in his article, <a href="http://terrychay.com/blog/article/challenges-and-choices.shtml">Challenges and Choices</a>. </p>
<p>I just came across an article by Amy Hoy in which she describes the <a href="http://slash7.com/articles/2009/8/10/screw-interface-patterns">dangers of over relying on patterns</a>. She&#8217;s spot on:</p>
<blockquote><p>
People no longer treat patterns as the shared wisdom of experts, however. They are inclined less to bang their heads against a problem and <em>then</em> consult the Book of Wisdom to see what it says about their particular problem. Instead, they treat patterns as Wal-Mart for decisions. They don&#8217;t know what they want, exactly, but <em>hey, this little item here on the shelf looks like a potential candidate</em>.</p>
<p>They start with a pattern and see how to <em>make</em> it fit.</p>
<p>This is bassackwards.
</p></blockquote>
<p>We all build our own patterns around problems we&#8217;ve encountered. But just as with design patterns, its important that we force ourselves to think through problems creatively before jumping to more commonly treaded paths.</p>
]]></content:encoded>
			<wfw:commentRss>http://petersonpages.com/mariano/blog/2009/10/07/pattern-traps/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Fun with Rewrite rules and Zend Framework</title>
		<link>http://petersonpages.com/mariano/blog/2009/04/25/fun-with-rewrite-rules-and-zend-framework/</link>
		<comments>http://petersonpages.com/mariano/blog/2009/04/25/fun-with-rewrite-rules-and-zend-framework/#comments</comments>
		<pubDate>Sun, 26 Apr 2009 06:21:30 +0000</pubDate>
		<dc:creator>Mariano</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[apache]]></category>

		<category><![CDATA[rewrite]]></category>

		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://petersonpages.com/mariano/blog/?p=28</guid>
		<description><![CDATA[I ran into a problem with Apache&#8217;s mod_rewrite module this afternoon while setting up a Zend Framework web application.  I had just setup a virtual host for my app and was setting up rewrite rules to forward requests to ZF&#8217;s front controller.  However, I wanted requests for existing filesystem resources (such as CSS, [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into a problem with Apache&#8217;s <a href="http://httpd.apache.org/docs/2.2/rewrite/" title="Guide to Apache mod_rewrite">mod_rewrite</a> module this afternoon while setting up a <a href="http://framework.zend.com" title="Overview of Zend Framework">Zend Framework</a> web application.  I had just setup a virtual host for my app and was setting up rewrite rules to forward requests to ZF&#8217;s front controller.  However, I wanted requests for existing filesystem resources (such as CSS, JS, and image files) to be served directly by Apache, bypassing the Zend Framework.</p>
<div>&nbsp;</div>
<p>Loosely following the <a title="Zend Framework Quick Start Guide" href="http://framework.zend.com/docs/quickstart/create-a-rewrite-rule">ZF Quick Start Guide</a>, I copied these rules into my VirtualHost configuration:<br />
<span id="more-28"></span></p>

<div class="wp_syntax"><div class="code"><pre>&lt;VirtualHost *&gt;
    ...
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^.*$ /index.php [NC,L]
    ...
&lt;/VirtualHost&gt;</pre></div></div>

<p>These rewrite rules didn&#8217;t work for me.  They basically state, &#8220;If the requested file exists and is greater than 0 bytes, or if the requested file is a symbolic link, or if the file is a directory, then don&#8217;t rewrite the http request and don&#8217;t process any more rewrite conditions or rules for this http request. Otherwise, forward the http request to /index.php&#8221;.  The logic seemed correct, but requests for existing files were still being forwarded to the ZF front controller (/index.php).</p>
<p>To troubleshoot the problem, I enabled RewriteLog and traced its output.  I started at log level 1 and worked my way up to level 4, where I finally found the problem. You can enable the RewriteLog by adding these lines to your VirtualHost configuration:</p>

<div class="wp_syntax"><div class="code"><pre>RewriteLog      /var/log/apache2/dev-rewrite.log
RewriteLogLevel 4</pre></div></div>

<p>The following is the RewriteLog output for one http request:</p>

<div class="wp_syntax"><div class="code"><pre>[&lt;date&gt;][&lt;host&gt;][&lt;rid&gt;] (2) init rewrite engine with requested uri /tests/info.php
[&lt;date&gt;][&lt;host&gt;][&lt;rid&gt;] (3) applying pattern '^.*$' to uri '/tests/info.php'
[&lt;date&gt;][&lt;host&gt;][&lt;rid&gt;] (4) RewriteCond: input='/tests/info.php' pattern='-s' =&gt; not-matched
[&lt;date&gt;][&lt;host&gt;][&lt;rid&gt;] (4) RewriteCond: input='/tests/info.php' pattern='-l' =&gt; not-matched
[&lt;date&gt;][&lt;host&gt;][&lt;rid&gt;] (4) RewriteCond: input='/tests/info.php' pattern='-d' =&gt; not-matched
[&lt;date&gt;][&lt;host&gt;][&lt;rid&gt;] (3) applying pattern '^.*$' to uri '/tests/info.php'
[&lt;date&gt;][&lt;host&gt;][&lt;rid&gt;] (2) rewrite '/tests/info.php' -&gt; '/index.php'
[&lt;date&gt;][&lt;host&gt;][&lt;rid&gt;] (2) local path result: /index.php
[&lt;date&gt;][&lt;host&gt;][&lt;rid&gt;] (2) prefixed with document_root to /www/home/velissimo/web/index.php
[&lt;date&gt;][&lt;host&gt;][&lt;rid&gt;] (1) go-ahead with /www/home/velissimo/web/index.php [OK]</pre></div></div>

<p>The problem became apparent in the three lines printed for log level (4): mod_write was checking if the file &#8220;/tests/info.php&#8221; existed.  That path was incomplete, missing the DocumentRoot prefix (&#8221;/www/dev/web/&#8221;).  The path I expected mod_rewrite to check was: /www/dev/web/tests/info.php</p>
<p>And so I learned this lesson about mod_write:</p>
<p>In <em><a href="http://httpd.apache.org/docs/2.2/mod/directive-dict.html#Context">VirtualHost context</a></em>, %{REQUEST_FILENAME} does not expand to the full path of the requested resource as the docs indicate. Instead, it expands to the path of the resource relative to the VirtualHost&#8217;s DocumentRoot. This might be a bug, since the <a href="http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond" title="Apache documentation for RewriteCond and REQUEST_FILENAME.">Apache documentation</a> is pretty clear that %{REQUEST_FILENAME} should expand to <em>&#8220;The full local filesystem path to the file or script matching the request.&#8221;</em></p>
<p>Interestingly, %{REQUEST_FILENAME} expands to the full path when used in .htaccess context.</p>
<p>I should point out that the Zend Framework Quick Start Guide&#8217;s suggested rewrite rules were correct. The rules failed for me because I used them in VirtualHost context, while the ZF Guide called for them to be used in .htaccess context.  When I moved the rules from my virtual host configuration to an .htaccess file, the rewrites worked correctly.</p>
<p>Still, I preferred to define the rules in the virtual host configuration.  I was able to achieve this by changing the rewrite rules to:</p>

<div class="wp_syntax"><div class="code"><pre>&lt;VirtualHost *&gt;
    ...
    RewriteEngine   on
    # The leading %{DOCUMENT_ROOT} is necessary when used in VirtualHost context
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -s [OR]
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -l [OR]
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
&nbsp;
    RewriteRule ^.*$ /index.php [NC,L]
&lt;/VirtualHost&gt;</pre></div></div>

<p>These rules worked for me on:</p>
<ul>
<li>Apache 2.2.9 (single architecture 32 bit binary) running on OSX 10.5.6</li>
<li>Apache 2.0.54 (64 bit binary) running on Red Hat Enterprise Linux ES release 4.</li>
</ul>
<p>I hope this helps save you some time or shed light on why Zend Framework&#8217;s rewrite rules aren&#8217;t working for you.</p>
]]></content:encoded>
			<wfw:commentRss>http://petersonpages.com/mariano/blog/2009/04/25/fun-with-rewrite-rules-and-zend-framework/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Identifying function usage in PHP code</title>
		<link>http://petersonpages.com/mariano/blog/2008/07/24/identifying-function-usage-in-php-code/</link>
		<comments>http://petersonpages.com/mariano/blog/2008/07/24/identifying-function-usage-in-php-code/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 01:10:41 +0000</pubDate>
		<dc:creator>Mariano</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://petersonpages.com/mariano/blog/?p=19</guid>
		<description><![CDATA[Its important for programmers to be able to quickly identify all usage of a function.  Knowing where and how a function is called helps greatly in understanding the intent of the code and allows the programmer to refactor with confidence.
There aren&#8217;t any tools for PHP that identify function usage, the way one might do [...]]]></description>
			<content:encoded><![CDATA[<p>Its important for programmers to be able to quickly identify all usage of a function.  Knowing where and how a function is called helps greatly in understanding the intent of the code and allows the programmer to refactor with confidence.</p>
<p>There aren&#8217;t any tools for PHP that identify function usage, the way one might do with Java using Eclipse.  The recent release of Zend 6 for Eclipse comes closer with its refactor feature, but only refactors within a single file and not across a project.</p>
<p>I solve this need with a handy grep call.  The following grep finds all usage and definitions of a PHP function, and omits results from .svn directories.  Just replace FUNC_NAME with the name of the function you&#8217;re investigating.</p>
<p><span id="more-19"></span></p>
<p><strong>Command line usage</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash"><span style="color: #c20cb9; font-weight: bold;">grep</span> -rinE <span style="color: #ff0000;">&quot;(function[[:space:]]+|[[:space:]]*::[[:space:]]*|<span style="color: #000099; font-weight: bold;">\-</span>&gt;|[[:space:]]+)FUNC_NAME[[:space:]]*<span style="color: #000099; font-weight: bold;">\(</span>&quot;</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> -v <span style="color: #ff0000;">&quot;/.svn/&quot;</span></pre></div></div>

<p><strong>Human readable explanation of the grep syntax</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash"><span style="color: #c20cb9; font-weight: bold;">grep</span> -rinE <span style="color: #ff0000;">&quot;(
    function[[:space:]]+ |              # match function or method definition
    [[:space:]]*::[[:space:]]* |        # match static method call
    <span style="color: #000099; font-weight: bold;">\-</span>&gt;|                                # match instance method call
    [[:space:]]+ |                      # match procedural function call
    ,+ |
    )FUNC_NAME[[:space:]]*<span style="color: #000099; font-weight: bold;">\(</span>&quot;</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">|</span>       <span style="color: #666666; font-style: italic;"># SEARCH TERM</span>
    <span style="color: #c20cb9; font-weight: bold;">grep</span> -v <span style="color: #ff0000;">&quot;/.svn/&quot;</span>                    <span style="color: #666666; font-style: italic;"># omit svn directories</span></pre></div></div>

<p><strong>Even more convenient</strong></p>
<p>For the ultimate in grepping convenience (thanks Mike Luton for the tip), copy the following into an executable file in your $PATH:</p>

<div class="wp_syntax"><div class="code"><pre class="bash"><span style="color: #c20cb9; font-weight: bold;">grep</span> -rinE <span style="color: #ff0000;">&quot;(function[[:space:]]+|[[:space:]]*::[[:space:]]*|<span style="color: #000099; font-weight: bold;">\-</span>&gt;|[[:space:]]+|,+)$1[[:space:]]*<span style="color: #000099; font-weight: bold;">\(</span>&quot;</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> -v <span style="color: #ff0000;">&quot;/.svn/&quot;</span></pre></div></div>

<p>Name the file &#8220;grepf&#8221; and call it like so:</p>

<div class="wp_syntax"><div class="code"><pre class="bash">grepf some_function_name</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://petersonpages.com/mariano/blog/2008/07/24/identifying-function-usage-in-php-code/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Bike for Breath</title>
		<link>http://petersonpages.com/mariano/blog/2008/07/18/bike-for-breath/</link>
		<comments>http://petersonpages.com/mariano/blog/2008/07/18/bike-for-breath/#comments</comments>
		<pubDate>Fri, 18 Jul 2008 14:54:24 +0000</pubDate>
		<dc:creator>Mariano</dc:creator>
		
		<category><![CDATA[Cycling]]></category>

		<guid isPermaLink="false">http://petersonpages.com/mariano/blog/?p=17</guid>
		<description><![CDATA[This is the 50 mile cycling route I rode with Lan, Dennis, and Jill during the &#8220;Bike for Breath&#8221; event on July 12, 2008.  The route consists of moderate rolling hills, with the only steep climb being the short jaunt up Edgewood. The official ride map indicates 1,887 ft. of climbing - not much [...]]]></description>
			<content:encoded><![CDATA[<p>This is the 50 mile cycling route I rode with Lan, Dennis, and Jill during the <a href="http://www.bike4breath.org">&#8220;Bike for Breath&#8221;</a> event on July 12, 2008.  The route consists of moderate rolling hills, with the only steep climb being the short jaunt up Edgewood. The official ride map indicates 1,887 ft. of climbing - not much for a 50 mile route.</p>
<p><a href="http://www.flickr.com/photos/marianopeterson/2703238596/" title="BikeForBreath.jpg by Mariano Peterson, on Flickr"><img src="http://farm4.static.flickr.com/3142/2703238596_ec4cb038e0.jpg" width="500" height="332" alt="Bib, Bike for Breath 2008" class="aligncenter" /></a><br />
<span id="more-17"></span><br />
<br/></p>
<style>
.bike-route {
  border: 1px solid gray;
}
.bike-route th{
  border-bottom: 2px solid gray;
  text-align: left;
  padding-right: 15px;
}
</style>
<p><strong>Route</strong></p>
<table class="bike-route">
<thead>
<tr>
<th>Mile</th>
<th>Direction</th>
<th>Street/Landmark</th>
</tr>
</thead>
<tbody>
<tr>
<td>0.0</td>
<td>START</td>
<td><a href="http://local.google.com/maps?f=q&#038;hl=en&#038;geocode=&#038;q=850+Lincoln+Center+Drive,+Foster+City,+CA&#038;ie=UTF8&#038;ll=37.568664,-122.270021&#038;spn=0.02143,0.026436&#038;z=15" title="See it on Google Maps">Applied Biosystems</a></td>
</tr>
<tr>
<td>0.1</td>
<td>Right</td>
<td>Ride through 2nd parking lot towards bike path</td>
</tr>
<tr>
<td>0.4</td>
<td>Straight</td>
<td>Enter dirt path to bike path (Foster City Pedway)</td>
</tr>
<tr>
<td>2.9</td>
<td>Straight</td>
<td>Stay on main bike path</td>
</tr>
<tr>
<td>4.3</td>
<td>Left</td>
<td>&#8220;Y&#8221; in bike path, then pass thu gate</td>
</tr>
<tr>
<td>4.5</td>
<td>Left</td>
<td>Bike path towards bridge</td>
</tr>
<tr>
<td>4.7</td>
<td>Left</td>
<td>Pedestrian bridge over lagoon</td>
</tr>
<tr>
<td>4.8</td>
<td>Right</td>
<td>End of pedestrian bridge</td>
</tr>
<tr>
<td>4.9</td>
<td><strong>BATHROOM</strong></td>
<td>Island Park</td>
</tr>
<tr>
<td>5.0</td>
<td>Right</td>
<td>Oracle parkway</td>
</tr>
<tr>
<td>5.1</td>
<td>Left</td>
<td>Marine parkway</td>
</tr>
<tr>
<td>5.2</td>
<td>Right</td>
<td>Twin Dolphin drive</td>
</tr>
<tr>
<td>6.3</td>
<td>Right</td>
<td>Redwood Shores parkway</td>
</tr>
<tr>
<td>7.3</td>
<td>Left</td>
<td>Old County road</td>
</tr>
<tr>
<td>8.1</td>
<td>Right</td>
<td>Brittan</td>
</tr>
<tr>
<td>9.1</td>
<td>Left</td>
<td>Alameda de las Pulgas</td>
</tr>
<tr>
<td>9.9</td>
<td>Right</td>
<td>Edgewood road</td>
</tr>
<tr>
<td>12.8</td>
<td>Left</td>
<td>Canada road</td>
</tr>
<tr>
<td>16.1</td>
<td>Left</td>
<td>Woodside road</td>
</tr>
<tr>
<td>16.3</td>
<td>Right</td>
<td>Whiskey Hill road</td>
</tr>
<tr>
<td>17.7</td>
<td>Right</td>
<td>Sand Hill road</td>
</tr>
<tr>
<td>21.7</td>
<td><strong>WATER STOP</strong></td>
<td>Portola Valley Fire Station</td>
</tr>
<tr>
<td>21.9</td>
<td>Left</td>
<td>Alpine road</td>
</tr>
<tr>
<td>23.1</td>
<td>Right</td>
<td>Arastradero road</td>
</tr>
<tr>
<td>25</td>
<td>Left</td>
<td>Page Mill road</td>
</tr>
<tr>
<td>25.1</td>
<td>Right</td>
<td>Arastradeo road</td>
</tr>
<tr>
<td>25.3</td>
<td>Right</td>
<td>Purissima road</td>
</tr>
<tr>
<td>26.7</td>
<td>Left</td>
<td>Concepcion</td>
</tr>
<tr>
<td>27.6</td>
<td>Straight</td>
<td>Concepcion (Don&#8217;t turn right onto Fremont at stop sign)</td>
</tr>
<tr>
<td>28</td>
<td>Straight</td>
<td>Fremont (at this point, Concepcion becomes Freemont)</td>
</tr>
<tr>
<td>28.5</td>
<td>Straight</td>
<td>Hillview</td>
</tr>
<tr>
<td>29.4</td>
<td>Left</td>
<td>Foothill expressway (Caution: narrow shoulder)</td>
</tr>
<tr>
<td>33.2</td>
<td>Right</td>
<td>Santa Cruz avenue</td>
</tr>
<tr>
<td>33.4</td>
<td>Veer left</td>
<td>Alameda de las Pulgas</td>
</tr>
<tr>
<td>38.1</td>
<td>Right</td>
<td>Brewster avenue</td>
</tr>
<tr>
<td>38.2</td>
<td>1st Left</td>
<td>Alameda da las Pulgas</td>
</tr>
<tr>
<td>38.9</td>
<td>Right</td>
<td>St. Francis</td>
</tr>
<tr>
<td>39.7</td>
<td>Left</td>
<td>Elm street</td>
</tr>
<tr>
<td>40.1</td>
<td>Right</td>
<td>Howard avenue</td>
</tr>
<tr>
<td>40.6</td>
<td>Left</td>
<td>Industrial road</td>
</tr>
<tr>
<td>41.6</td>
<td>Right</td>
<td>Holly (crosses 101 and becomes Redwood Shores parkway)</td>
</tr>
<tr>
<td>42.2</td>
<td>Left</td>
<td>Twin Dolphin drive</td>
</tr>
<tr>
<td>43.3</td>
<td>Left</td>
<td>Marine parkway</td>
</tr>
<tr>
<td>43.4</td>
<td>Right</td>
<td>Oracle parkway</td>
</tr>
<tr>
<td>43.5</td>
<td><strong>BATHROOM</strong></td>
<td>Island Park</td>
</tr>
<tr>
<td>43.6</td>
<td>Left</td>
<td>Pedestrian bridge over lagoon</td>
</tr>
<tr>
<td>43.7</td>
<td>Right</td>
<td>End of pedestrian bridge</td>
</tr>
<tr>
<td>44.0</td>
<td>Right</td>
<td>&#8220;Y&#8221; in bike path</td>
</tr>
<tr>
<td>48.3</td>
<td>FINISH</td>
<td>Applied Biosystems</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://petersonpages.com/mariano/blog/2008/07/18/bike-for-breath/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Installing MacFusion</title>
		<link>http://petersonpages.com/mariano/blog/2008/07/17/installing-macfusion/</link>
		<comments>http://petersonpages.com/mariano/blog/2008/07/17/installing-macfusion/#comments</comments>
		<pubDate>Fri, 18 Jul 2008 01:25:10 +0000</pubDate>
		<dc:creator>Mariano</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[fuse]]></category>

		<category><![CDATA[macfusion]]></category>

		<category><![CDATA[osx]]></category>

		<category><![CDATA[samba]]></category>

		<guid isPermaLink="false">http://petersonpages.com/mariano/blog/?p=14</guid>
		<description><![CDATA[I recently setup a new MacBook Pro for web development.  While trying to mount a samba share I discovered MacFusion, an application that lets you treat various remote storage mechanisms as if they were folders on your local hard drive. MacFusion is built on top of MacFuse, which is the OSX port of the [...]]]></description>
			<content:encoded><![CDATA[<p>I recently setup a new MacBook Pro for web development.  While trying to mount a samba share I discovered <a href="http://macfusionapp.org">MacFusion</a>, an application that lets you treat various <a href="http://fuse.sourceforge.net/wiki/index.php/FileSystems">remote storage mechanisms</a> as if they were folders on your local hard drive. MacFusion is built on top of <a href="http://code.google.com/p/macfuse/" title="A User-Space File System Implementation Mechanism for Mac OS X">MacFuse</a>, which is the OSX port of the Linux based <a href="http://fuse.sourceforge.net/" title="Filesystem in Userspace">FUSE</a> that facilitates building filesystems that run in userspace.</p>
<p><span id="more-14"></span></p>
<p>In my case I&#8217;m using the SSH filesystems included in MacFusion to mount a remote directory as a local folder over an SSH connection.  The following steps got MacFusion to work on both my intel based MacBook Pro and my older PowerPC based G4 Powerbook.</p>
<ol>
<li>Install <a href="http://code.google.com/p/macfuse/">MacFuse</a>.</li>
<li>Reboot.</li>
<li>Install <a href="http://macfusionapp.org">MacFusion 2.x</a>.
<ul>
<li>Older (1.x) versions of MacFusion are available on <a href="http://code.google.com/p/macfusion/">Google Code</a>.  Note that the older 1.x versions of MacFusion are not compatible with the more current 1.7.x versions of the underlying MacFuse platform.  So if you install the current MacFuse platform, you&#8217;ll need to go <a href="">here</a> to get a 2.x version of the MacFusion GUI.</li>
</ul>
</li>
<li>Start MacFusion and configure it to connect to the desired hosts.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://petersonpages.com/mariano/blog/2008/07/17/installing-macfusion/feed/</wfw:commentRss>
		</item>
		<item>
		<title>SVN notifications</title>
		<link>http://petersonpages.com/mariano/blog/2008/07/09/svn-notifications/</link>
		<comments>http://petersonpages.com/mariano/blog/2008/07/09/svn-notifications/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 03:49:44 +0000</pubDate>
		<dc:creator>Mariano</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://petersonpages.com/mariano/blog/?p=13</guid>
		<description><![CDATA[I&#8217;ve been investigating how to send notification emails when changes are committed in a Subversion repository.  Two interesting options I found are svnnotify and svnmailer.

svnnotify looks reasonable (read the man page).  It generates HTML email with colored diffs (not as nice as Trac&#8217;s diff engine) and is configurable via CLI options to send [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been investigating how to send notification emails when changes are committed in a Subversion repository.  Two interesting options I found are <a href="http://search.cpan.org/dist/SVN-Notify/lib/SVN/Notify.pm">svnnotify</a> and <a href="http://opensource.perlig.de/svnmailer/">svnmailer</a>.</p>
<p><span id="more-13"></span></p>
<p><a href="http://search.cpan.org/dist/SVN-Notify/lib/SVN/Notify.pm">svnnotify</a> looks reasonable (<a href="http://pwet.fr/man/linux/commandes/p/svnnotify">read the man page</a>).  It generates HTML email with colored diffs (not as nice as <a href="http://trac.edgewall.org/wiki/WikiStart?action=diff&#038;version=111">Trac&#8217;s diff engine</a>) and is configurable via CLI options to send email to different addresses based on regular expression matches against the directories affected by the commit.</p>
<p>Example: put this in &#8220;/repo/hooks/post-commit&#8221;</p>

<div class="wp_syntax"><div class="code"><pre class="bash"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
&nbsp;
<span style="color: #007800;">REPOS=</span><span style="color: #ff0000;">&quot;$1&quot;</span>
<span style="color: #007800;">REV=</span><span style="color: #ff0000;">&quot;$2&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">perl</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>svnnotify \
    -p <span style="color: #007800;">$REPOS</span> \
    -r <span style="color: #007800;">$REV</span> \
    -C -d -H HTML::ColorDiff \
    --from admin<span style="color: #000000; font-weight: bold;">@</span>example.com \
    --reply-to somebody<span style="color: #000000; font-weight: bold;">@</span>example.com \
    -x foo<span style="color: #000000; font-weight: bold;">@</span>example.<span style="color: #007800;">com=</span><span style="color: #ff0000;">&quot;^foo/&quot;</span> \
    -x <span style="color: #ff0000;">&quot;team1@example.com,team2@example.com&quot;</span>=<span style="color: #ff0000;">&quot;^big_framework/&quot;</span> \
    -x other<span style="color: #000000; font-weight: bold;">@</span>example.<span style="color: #007800;">com=</span><span style="color: #ff0000;">&quot;^one|^two|^three&quot;</span></pre></div></div>

</p>
<p>I also looked at <a href="http://opensource.perlig.de/svnmailer/">svnmailer</a> but it uses <a href="http://www.gnu.org/software/diffutils/manual/html_node/Example-Unified.html#Example%20Unified">unified diff format</a> by default which doesn&#8217;t look so nice.  You can specify your own diff script via the CLI, but I don&#8217;t know of any good ones off hand. </p>
<p>Can anyone suggest a good diff script?<br />
Anybody know offhand if <a href="http://trac.edgewall.org/">Trac</a> uses a standalone diff engine that I could hook up to svnmailer?</p>
]]></content:encoded>
			<wfw:commentRss>http://petersonpages.com/mariano/blog/2008/07/09/svn-notifications/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Organizing log files into date based directories</title>
		<link>http://petersonpages.com/mariano/blog/2008/04/10/rename-files-in-bulk/</link>
		<comments>http://petersonpages.com/mariano/blog/2008/04/10/rename-files-in-bulk/#comments</comments>
		<pubDate>Thu, 10 Apr 2008 16:01:26 +0000</pubDate>
		<dc:creator>Mariano</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[perl code]]></category>

		<guid isPermaLink="false">http://petersonpages.com/mariano/blog/?p=6</guid>
		<description><![CDATA[I recently had to grep through a few hundred thousand log files in a single directory.  The logs dated back several years and had never been organized into directories.  In fact, there were so many log files that grep&#8217;ing the directory resulted in an &#8220;argument list too long&#8221; error.  This error is [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had to grep through a few hundred thousand log files in a single directory.  The logs dated back several years and had never been organized into directories.  In fact, there were so many log files that grep&#8217;ing the directory resulted in an &#8220;argument list too long&#8221; error.  This error is described clearly <a href="http://www.moundalexis.com/archives/000035.php">here</a>, and the quickest solution is to use find to pipe the filenames into grep using xargs:</p>

<div class="wp_syntax"><div class="code"><pre class="bash"><span style="color: #c20cb9; font-weight: bold;">find</span> . -name <span style="color: #ff0000;">&quot;*.log&quot;</span> -print0 <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #000000;">-0</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;xyz&quot;</span></pre></div></div>

</p>
<p><span id="more-6"></span></p>
<p>I still wanted to clean things up so I decided to organize the logs into date based directories.  I wrote a Perl script that scans files in a directory, parses a date from each filename (YYYY_MM_DD_&#8230;), and moves the file to the appropriate directory.  For example, the script moves 2008_03_01_foo.txt to 2008/03/01/2008_03_01_foo.txt and creates the directories if necessary.</p>

<div class="wp_syntax"><div class="code"><pre class="perl"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl -w</span>
<span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> File<span style="color: #339933;">::</span><span style="color: #006600;">Path</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$year</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$month</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$day</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$dir</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">&lt;*&gt;</span><span style="color: #009900;">&#41;</span> 
<span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$year</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$month</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$day</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$_</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">/(\d+)_(\d+)_(\d+)/</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #0000ff;">$dir</span> <span style="color: #339933;">=</span> <span style="color: #000066;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%04d/%02d/%02d&quot;</span> <span style="color: #339933;">,</span><span style="color: #0000ff;">$year</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$month</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$day</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        mkpath<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$dir</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!-</span>d <span style="color: #0000ff;">$dir</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">rename</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$_</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;$dir/$_&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!-</span>d <span style="color: #0000ff;">$_</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;Unable to move $_:  $!<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>
</p>
]]></content:encoded>
			<wfw:commentRss>http://petersonpages.com/mariano/blog/2008/04/10/rename-files-in-bulk/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The new VCR</title>
		<link>http://petersonpages.com/mariano/blog/2008/04/03/the-new-vcr/</link>
		<comments>http://petersonpages.com/mariano/blog/2008/04/03/the-new-vcr/#comments</comments>
		<pubDate>Thu, 03 Apr 2008 16:33:00 +0000</pubDate>
		<dc:creator>Mariano</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[audi]]></category>

		<category><![CDATA[craftsman]]></category>

		<category><![CDATA[garage door opener]]></category>

		<category><![CDATA[volkswagen]]></category>

		<guid isPermaLink="false">http://petersonpages.com/mariano/blog/?p=8</guid>
		<description><![CDATA[The garage door opener is to me what the VCR was to my parents.  After struggling with the garage door for a few hours, I decided I better write down some instructions.
I have a Craftsman garage door opener with three buttons on the controls.  It uses rolling codes but aside from that all [...]]]></description>
			<content:encoded><![CDATA[<p>The garage door opener is to me what the VCR was to my parents.  After struggling with the garage door for a few hours, I decided I better write down some instructions.</p>
<p>I have a Craftsman garage door opener with three buttons on the controls.  It uses rolling codes but aside from that all I can tell you is it sucks, its loud, and it never seems to do what I want it to, like opening.</p>
<p><span id="more-8"></span></p>
<p><strong>Programming the remote</strong><br />
Audi and Volkswagen vehicles have a built-in garage door opener built by <a title="HomeLink" href="http://www.homelink.com/">HomeLink</a>.  Here&#8217;s how to set them up with the Craftsman rolling code garage door opener:</p>
<ol>
<li>Turn the car on.</li>
<li>Press and hold buttons 1 and 3 on the car&#8217;s HomeLink transmitter until the lights start flashing.  Don&#8217;t hold your breath, it may take a while.</li>
<li>Release the buttons.</li>
<li>Press and hold the car&#8217;s HomeLink button that you want to program.</li>
<li>Hold the Craftsman remote control near the HomeLink transmitter and repeatedly press the big button on the Craftsman remote.   The HomeLink transmitter is likely in your rear-view mirror, sun-visor, or near the front right headlight.</li>
<li>Release the buttons once the HomeLink lights start flashing faster.  You may have to slowly move the remote control around the HomeLink transmitter before the lights start flashing faster.</li>
<li>Push and release the &#8220;Learn&#8221; button on the back of the garage door opener (the big ass motor hanging from the garage ceiling).  Holding the &#8220;Learn&#8221; button down for 5 seconds or so usually clears all the codes (i.e., breaks the connection with all your remote control units).</li>
<li>Push the car&#8217;s HomeLink button that you want to program (yes, again).  You may have to hold the button down for a little while, or prese and release the button a few times.</li>
<li><span class="Apple-style-span" style="font-weight: bold">Sha-bam-a-wama!</span> It should work now.  But if it doesn&#8217;t, you might find helpful information on <a title="this thread" href="http://forums.vwvortex.com/zerothread?id=1099046">this thread</a>.</li>
</ol>
<p><br/></p>
<p><strong>Troubleshooting</strong></p>
<table style="text-align: left;" border="0">
<thead>
<tr>
<th>Symptom</th>
<th>Solution</th>
</tr>
</thead>
<tbody>
<tr>
<td>Door doesn&#8217;t respond to the remote control but does respond to the wall mounted control. A green light on the wall mount is blinking.</td>
<td>The garage door is &#8220;locked&#8221;. Locate the wall mounted control and press the button with the padlock icon for 5+ seconds. When you release the button the green light will stop flashing and the door will respond to the remote controls again.</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://petersonpages.com/mariano/blog/2008/04/03/the-new-vcr/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
