<?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>Mariano Peterson &#187; Uncategorized</title>
	<atom:link href="http://petersonpages.com/mariano/blog/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://petersonpages.com/mariano/blog</link>
	<description>Software engineer. Cycling fanatic. Snowboarder. Surfer. And very proud father of two boys.</description>
	<lastBuildDate>Thu, 08 Oct 2009 05:42:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<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 [...]]]></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>
		<slash:comments>0</slash:comments>
		</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 Linux [...]]]></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>
		<slash:comments>0</slash:comments>
		</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 email [...]]]></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" style="font-family:monospace;"><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>perl<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>svnnotify \
    <span style="color: #660033;">-p</span> <span style="color: #007800;">$REPOS</span> \
    <span style="color: #660033;">-r</span> <span style="color: #007800;">$REV</span> \
    <span style="color: #660033;">-C</span> <span style="color: #660033;">-d</span> <span style="color: #660033;">-H</span> HTML::ColorDiff \
    <span style="color: #660033;">--from</span> admin<span style="color: #000000; font-weight: bold;">@</span>example.com \
    <span style="color: #660033;">--reply-to</span> somebody<span style="color: #000000; font-weight: bold;">@</span>example.com \
    <span style="color: #660033;">-x</span> foo<span style="color: #000000; font-weight: bold;">@</span>example.com=<span style="color: #ff0000;">&quot;^foo/&quot;</span> \
    <span style="color: #660033;">-x</span> <span style="color: #ff0000;">&quot;team1@example.com,team2@example.com&quot;</span>=<span style="color: #ff0000;">&quot;^big_framework/&quot;</span> \
    <span style="color: #660033;">-x</span> other<span style="color: #000000; font-weight: bold;">@</span>example.com=<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>
		<slash:comments>0</slash:comments>
		</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 described clearly here, [...]]]></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" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;*.log&quot;</span> <span style="color: #660033;">-print0</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #660033;">-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" style="font-family:monospace;"><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>
		<slash:comments>0</slash:comments>
		</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 I [...]]]></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>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

