<?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>SmartLogic Solutions Blog &#187; jtrupiano</title>
	<atom:link href="http://blog.smartlogicsolutions.com/tag/jtrupiano/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.smartlogicsolutions.com</link>
	<description>News and updates from the people at SmartLogic Solutions</description>
	<lastBuildDate>Tue, 30 Nov 2010 21:39:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Rack::Rewrite + Google Analytics Makes Site Transitions Seamless</title>
		<link>http://blog.smartlogicsolutions.com/2009/11/24/rack-rewrite-google-analytics-makes-site-transitions-seamless/</link>
		<comments>http://blog.smartlogicsolutions.com/2009/11/24/rack-rewrite-google-analytics-makes-site-transitions-seamless/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 14:20:20 +0000</pubDate>
		<dc:creator>John Trupiano</dc:creator>
				<category><![CDATA[analytics]]></category>
		<category><![CDATA[Google Analytics]]></category>
		<category><![CDATA[John Trupiano]]></category>
		<category><![CDATA[Rack]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[googleanalytics]]></category>
		<category><![CDATA[jtrupiano]]></category>
		<category><![CDATA[rack-rewrite]]></category>

		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=718</guid>
		<description><![CDATA[At SmartLogic we recently rebuilt our website in rails. The previous version was a MediaWiki installation with a ton of content that had garnered a decent bit of Google juice that we did not want to lose. By setting up 301 permanent redirects for the old URL&#8217;s, we can hold onto that juice. Enter Rack::Rewrite. [...]]]></description>
			<content:encoded><![CDATA[<p>At SmartLogic we recently rebuilt our <a href="http://www.smartlogicsolutions.com">website</a> in rails.  The previous version was a MediaWiki installation with a ton of content that had garnered a decent bit of Google juice that we did not want to lose.  By setting up 301 permanent redirects for the old URL&#8217;s, we can hold onto that juice.</p>
<p><span id="more-718"></span></p>
<div id="attachment_762" class="wp-caption alignright" style="width: 160px"><a href="http://blog.smartlogicsolutions.com/wp-content/uploads/2009/11/Picture-2.png"><img src="http://blog.smartlogicsolutions.com/wp-content/uploads/2009/11/Picture-2-150x150.png" alt="Google Analytics Navigation" title="Google Analytics Navigation" width="150" height="150" class="size-thumbnail wp-image-762" /></a><p class="wp-caption-text">Google Analytics Navigation</p></div>
<p>Enter Rack::Rewrite.  <a href="http://github.com/jtrupiano/rack-rewrite">Rack::Rewrite</a> is a <a href="http://rack.rubyforge.org/">Rack</a> middleware for defining and applying rewrite rules.  Though it&#8217;s not a full replacement for <a href="http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html">Apache&#8217;s mod_rewrite</a>, a great deal of rules I&#8217;ve previously written in Apache config files can be replaced by Rack::Rewrite.  Run <code>gem install rack-rewrite</code> to install the gem.</p>
<p>In order to determine which URL&#8217;s were most important to issue 301&#8242;s for, we turned to Google Analytics.  By reviewing the most popular landing pages of the past two months from our site, we were able to methodically write our redirect rules.</p>
<div id="attachment_766" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.smartlogicsolutions.com/wp-content/uploads/2009/11/Picture-33.png"><img src="http://blog.smartlogicsolutions.com/wp-content/uploads/2009/11/Picture-33-300x291.png" alt="Google Analytics | Top Landing Pages" title="Google Analytics | Top Landing Pages" width="300" height="291" class="size-medium wp-image-766" /></a><p class="wp-caption-text">Google Analytics | Top Landing Pages</p></div>
<p>Here is a subset of the associated Rack::Rewrite rules.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  config.<span style="color:#9900CC;">middleware</span>.<span style="color:#9900CC;">insert_before</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#6666ff; font-weight:bold;">Rack::Lock</span>, <span style="color:#6666ff; font-weight:bold;">Rack::Rewrite</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>        
    <span style="color:#008000; font-style:italic;"># original wiki smartlogicsolutions.com website</span>
    r301 <span style="color:#996600;">'/wiki/Main_Page'</span>, <span style="color:#996600;">'/'</span>
    r301 <span style="color:#996600;">'/wiki/John_Trupiano'</span>, <span style="color:#996600;">'/john'</span>
    r301 <span style="color:#006600; font-weight:bold;">%</span>r<span style="color:#006600; font-weight:bold;">&#123;</span>^<span style="color:#006600; font-weight:bold;">/</span>wiki<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#40;</span>Charity<span style="color:#006600; font-weight:bold;">|</span>Charities<span style="color:#006600; font-weight:bold;">|</span>Local_Connection<span style="color:#006600; font-weight:bold;">&#41;</span>$<span style="color:#006600; font-weight:bold;">&#125;</span>, <span style="color:#996600;">'/gratis-work-and-charities'</span>
    r301 <span style="color:#996600;">'/wiki/Category:Portfolio'</span>, <span style="color:#996600;">'/portfolio'</span>
    r301 <span style="color:#996600;">'/wiki/ExxonMobil_-_Brand_Asset_Center'</span>, <span style="color:#996600;">'/portfolio/exxonmobil-brand-asset-center'</span>
    r301 <span style="color:#996600;">'/wiki/In_the_News'</span>, <span style="color:#996600;">'/in-the-news'</span>
    r301 <span style="color:#996600;">'/wiki/Getting_to_our_Office'</span>, <span style="color:#996600;">'/driving-directions'</span>
    r301 <span style="color:#996600;">'/wiki/Category:Employees'</span>, <span style="color:#996600;">'/our-team'</span>
    r301 <span style="color:#996600;">'/wiki/SimNet_for_Office_2007'</span>, <span style="color:#996600;">'/portfolio/simnet-for-office-2007-and-vista'</span>
    r301 <span style="color:#996600;">'/wiki/VNC_Collaboration_Application'</span>, <span style="color:#996600;">'/portfolio/shared-desktop'</span>
    r301 <span style="color:#996600;">'/wiki/Contact_Information'</span>, <span style="color:#996600;">'/contact-us'</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>This scheme is great for landing pages, but what if we had querystring information that we wanted to keep around?  This is common for tracking codes &#8212; many marketing platforms generate URL&#8217;s that embed data in the querystring for recording and tracking purposes.  We can leverage the following trick to maintain the querystring across a rewrite.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  r301 <span style="color:#006600; font-weight:bold;">%</span>r<span style="color:#006600; font-weight:bold;">&#123;</span>^<span style="color:#006600; font-weight:bold;">/</span>wiki<span style="color:#006600; font-weight:bold;">/</span>Main_Page<span style="color:#006600; font-weight:bold;">&#40;</span>\?.<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#41;</span>?$<span style="color:#006600; font-weight:bold;">&#125;</span>, <span style="color:#996600;">'/$1'</span></pre></div></div>

<p>Note the following:</p>
<ul>
<li>We are conditionally matching a querystring so that the rule continues to match in the absence of a querystring. </li>
<li>We are leveraging substitution patterns to reconstitute the querystring in the rewritten URL.
</ul>
<p>Many more great use cases for Rack::Rewrite are covered in the project&#8217;s <a href="http://github.com/jtrupiano/rack-rewrite">README</a>.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2010/05/13/rack-rewrite-1-0-0-released/" rel="bookmark" class="crp_title">Rack::Rewrite 1.0.0 Released</a></li><li><a href="http://blog.smartlogicsolutions.com/2010/01/06/rack-rewrite-0-2-1-released/" rel="bookmark" class="crp_title">Rack::Rewrite 0.2.1 Released</a></li><li><a href="http://blog.smartlogicsolutions.com/2009/11/16/rack-rewrite-for-site-maintenance-and-downtime/" rel="bookmark" class="crp_title">Rack::Rewrite for Site Maintenance and Downtime</a></li><li><a href="http://blog.smartlogicsolutions.com/2010/05/13/directory-conventions-for-rack-middleware-rubygems/" rel="bookmark" class="crp_title">Directory Conventions for Rack Middleware RubyGems</a></li><li><a href="http://blog.smartlogicsolutions.com/2009/09/24/google-analytics-event-tracking-overview/" rel="bookmark" class="crp_title">Google Analytics Event Tracking Overview</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.smartlogicsolutions.com/2009/11/24/rack-rewrite-google-analytics-makes-site-transitions-seamless/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Timecop 0.2.0 Released: Freeze and Rebase Time in Ruby</title>
		<link>http://blog.smartlogicsolutions.com/2008/12/24/timecop-2-released-freeze-and-rebase-time-ruby/</link>
		<comments>http://blog.smartlogicsolutions.com/2008/12/24/timecop-2-released-freeze-and-rebase-time-ruby/#comments</comments>
		<pubDate>Wed, 24 Dec 2008 06:14:35 +0000</pubDate>
		<dc:creator>John Trupiano</dc:creator>
				<category><![CDATA[John Trupiano]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[TATFT]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[jtrupiano]]></category>
		<category><![CDATA[rubygem]]></category>
		<category><![CDATA[tatft]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[timecop]]></category>

		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=445</guid>
		<description><![CDATA[I just released version 0.2.0 of Timecop this evening (morning). The primary feature added was the distinction between &#8220;freezing&#8221; and &#8220;rebasing&#8221; time. In 0.1.0, Timecop.travel would actually freeze time. This is no longer the case. Rather, a time offset will be calculated, and a running clock is simulated by always offsetting the time returned by [...]]]></description>
			<content:encoded><![CDATA[<p>I just released version 0.2.0 of <a href="http://github.com/jtrupiano/timecop">Timecop</a> this evening (morning).</p>
<p>The primary feature added was the distinction between &#8220;freezing&#8221; and &#8220;rebasing&#8221; time.  In 0.1.0, <code>Timecop.travel</code> would actually freeze time.  This is no longer the case.  Rather, a time offset will be calculated, and a running clock is simulated by always offsetting the time returned by Time.now (and friends) by the original offset.</p>
<p>(Note that time can still be frozen with <code>Timecop.freeze</code>.)</p>
<p><span id="more-445"></span></p>
<p>To update a previous version:</p>
<pre><code>sudo gem update timecop</code></pre>
<p>To install for the first time: </p>
<pre><code>sudo gem install timecop</code></pre>
<p>The new feature set allows us to avoid the following common pitfalls that were present in 0.1.0. </p>
<ol>
<li>In rails, if you had set up a time mock in the development environment, then every time you invoked <code>script/generate migration</code> (and others), the generator would read your mocked instance of Time.now, and use that date for the migration name.</li>
<li>Any benchmarking/timing code executed within the yielded block would always return times of 0 seconds.  This was due to time being frozen.</li>
</ol>
<p>The other major change to the API was the deprecating of Timecop.unset_all in favor or Timecop.return.</p>
<p>This update also vastly <a href="http://johntrupiano.rubyforge.org/timecop">improves the rdoc</a>, making the public API much more accessible.  The Timecop class has particularly thorough documentation.</p>
<p>For a more complete description of the gem, please refer to the <a href="http://blog.smartlogicsolutions.com/2008/11/19/timecop-freeze-time-in-ruby-for-better-testing/">introductory blog post</a>.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2009/09/20/timecop-0-3-0-released/" rel="bookmark" class="crp_title">Timecop 0.3.0 Released</a></li><li><a href="http://blog.smartlogicsolutions.com/2009/12/07/timecop-0-3-4-released/" rel="bookmark" class="crp_title">Timecop 0.3.4 Released</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/11/19/timecop-freeze-time-in-ruby-for-better-testing/" rel="bookmark" class="crp_title">Timecop: Freeze Time in Ruby for Better Testing</a></li><li><a href="http://blog.smartlogicsolutions.com/2010/05/13/directory-conventions-for-rack-middleware-rubygems/" rel="bookmark" class="crp_title">Directory Conventions for Rack Middleware RubyGems</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/12/18/puremvcgen-011-released-now-works-on-windows/" rel="bookmark" class="crp_title">PureMVCGen 0.1.1 Released &#8211; Now Works on Windows</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.smartlogicsolutions.com/2008/12/24/timecop-2-released-freeze-and-rebase-time-ruby/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

