<?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>Ben Hathaway &#187; How To&#8217;s</title>
	<atom:link href="http://hathaway.cc/category/articles/how-to/feed/" rel="self" type="application/rss+xml" />
	<link>http://hathaway.cc</link>
	<description>Husband, father, engineer, and entrepreneur.</description>
	<lastBuildDate>Fri, 11 May 2012 16:11:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>How to setup Mac OS X Lion for ruby and rails development</title>
		<link>http://hathaway.cc/2012/04/how-to-setup-mac-os-x-lion-for-ruby-and-rails-development/</link>
		<comments>http://hathaway.cc/2012/04/how-to-setup-mac-os-x-lion-for-ruby-and-rails-development/#comments</comments>
		<pubDate>Thu, 12 Apr 2012 14:49:20 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Archive]]></category>
		<category><![CDATA[How To's]]></category>

		<guid isPermaLink="false">http://hathology.com/?p=523</guid>
		<description><![CDATA[Most developers spend their first day on a new computer setting up their develoment environment. If you are a ruby developer, this article should help you get started quickly. I&#8217;m assuming you are starting with a clean install of Mac OS X Lion. A similar environment could be created off of the same or similar [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Most developers spend their first day on a new computer setting up their develoment environment. If you are a ruby developer, this article should help you get started quickly.</p>
<p>I&#8217;m assuming you are starting with a clean install of Mac OS X Lion. A similar environment could be created off of the same or similar tools for a Linux machine.</p>
<p>The pieces of this development environment are:</p>
<ul>
<li> rbenv</li>
<li> ruby-build</li>
<li> ruby</li>
<li> bundler</li>
<li> rails</li>
<li> MySQL</li>
<li> redis</li>
<li> pow</li>
</ul>
<p>This should give you a broad set of tools that will cover most development environment needs. You could easily add more tools to your environment if needed.</p>
<p><span id="more-523"></span></p>
<h2> Install Xcode</h2>
<p>Xcode provides many of the necessary compilers and libraries needed for your development environment.</p>
<p>As of Lion, this is an easy install via the Mac App Store. It is a large download so while this step is easy, it will take some time to download and install.</p>
<p>The following link will take you to the Mac App Store to install.</p>
<p><a href="http://itunes.apple.com/us/app/xcode/id497799835?mt=12">http://itunes.apple.com/us/app/xcode/id497799835?mt=12</a></p>
<h2> Install Homebrew</h2>
<p>Homebrew is the easiest and most flexible way to install the UNIX tools Apple didn&#8217;t include with OS X.</p>
<p><a href="http://mxcl.github.com/homebrew">http://mxcl.github.com/homebrew</a></p>
<p>To install run the following command:</p>
<pre><code>/usr/bin/ruby -e &quot;$(/usr/bin/curl -fksSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)&quot;</code>
</pre>
<p>You can see detailed instructions on what happens when you run this command to install here:</p>
<p><a href="https://github.com/mxcl/homebrew/wiki/installation">https://github.com/mxcl/homebrew/wiki/installation</a></p>
<h2> Remove RVM (if necessary)</h2>
<p>If you have previously used RVM in your environment, you&#8217;ll want to get rid of this so it doesn&#8217;t interfere with your new environment. This is a simple task. Just run:</p>
<pre><code>rvm implode</code>
</pre>
<h2> Install MySQL Server</h2>
<p>Now that we have homebrew installed, these installations become simple single line commands.</p>
<pre><code>brew install mysql</code>
</pre>
<h2> Install Redis (optional)</h2>
<p>Redis is an open source, advanced key-value store. It has many uses such as caching and serving as a queue for background jobs (via resque).</p>
<p>Once again, an easy to install with homebrew.</p>
<pre><code>brew install redis</code>
</pre>
<h2> Install rbenv and ruby-build</h2>
<p>The basis of this environment is rbenv which allows you to run self-contained ruby environments for each of your projects. This setup has huge advantages over a system wide install of ruby that would force you to keep all of your projects on the same version of ruby as well as gems. </p>
<p>I chose rbenv over rvm because it&#8217;s simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well.</p>
<p><a href="https://github.com/sstephenson/rbenv">https://github.com/sstephenson/rbenv</a></p>
<p><a href="https://github.com/sstephenson/ruby-build">https://github.com/sstephenson/ruby-build</a></p>
<p>Use homebrew to install.</p>
<pre><code>brew install rbenv</code>
<code>brew install ruby-build</code>
</pre>
<p>Add to ~/.bash_profile:</p>
<pre><code>eval &quot;$(rbenv init -)&quot;</code>
<code>alias b=‘bundle exec’</code>
</pre>
<p><code></code><code></code>I like to alias the `bundle exec` command to just `b` to save some typing. If you prefer not to do that, just skip adding that line to the .bash_profile.</p>
<p>Restart your Terminal.</p>
<h2> Install pow</h2>
<p>Pow is a zero-config Rack server for Mac OS X. Instead of running the rails server manually for each of your projects, pow runs it for you and gives you a simple hostname to. So instead of going to http://localhost:3000 after starting your rails server, you can just go straight to http://project.dev (where &#8220;project&#8221; is replaced with the folder name of your project.</p>
<p><a href="http://pow.cx">http://pow.cx</a></p>
<p>Note: I&#8217;ve had trouble using pow before when using custom DNS servers in my Network settings. If something isn&#8217;t working right when you try to use pow, check your DNS settings and make sure you are using the defaults.</p>
<p>To install pow, simply run:</p>
<pre><code>curl get.pow.cx | sh</code>
</pre>
<p>You can view this script before running it on their website.</p>
<h2> Install ruby</h2>
<p>Now we can install our rubies. At the time of writing this I had projects running on both 1.8.7 and 1.9.3 so I&#8217;m going to show you how to setup both and set one as the global version.</p>
<p>Install ruby 1.9.3:</p>
<pre><code>rbenv install 1.9.3-p0</code>
</pre>
<p>Install ruby 1.8.7:</p>
<pre><code>rbenv install 1.8.7-p352 </code>
</pre>
<p>After installing a new ruby or a global gem, you need to run the following command.</p>
<pre><code>rbenv rehash</code>
</pre>
<p>Set the global ruby to 1.9.3:</p>
<pre><code>rbenv global 1.9.3-p0</code>
</pre>
<h2> Configure your global gem settings</h2>
<p>I typically always just use Google and the online documentation for ruby, rails, and other gems. So installing the rdoc&#8217;s for all of our gems is a waste. I prefer to disable this in a .gemrc file.</p>
<p>Add this line to the ~/.gemrc file:</p>
<pre><code>install: --no-rdoc --no-ri update: --no-rdoc --no-ri</code>
</pre>
<h2> Install bundler</h2>
<p>Bundler manages an application&#8217;s dependencies through its entire life across many machines systematically and repeatably.</p>
<p>Bundler has to be installed for each version of ruby you want to run it on.</p>
<pre><code>rbenv shell 1.9.3-p0</code>
<code>gem install bundler</code>
<code>rbenv shell 1.8.7-p352</code>
<code>gem install bundler</code>
<code>rbenv rehash</code>
</pre>
<p>Configure bundler in ~/.bundle/config:</p>
<pre><code>BUNDLE_PATH: vendor/bundle</code>
</pre>
<p>This line tells bundler to install my gems in a relative path specific to each project.</p>
<h2> Install Rails</h2>
<p>Similar to bundler, you want to install the rails gem for each of your ruby versions.</p>
<pre><code>rbenv shell 1.9.3-p0</code>
<code>gem install rails</code>
<code>rbenv shell 1.8.7-p352</code>
<code>gem install rails</code>
<code>rbenv rehash</code>
</pre>
<h2> Setup your first Rails project</h2>
<p>Now you&#8217;re ready to setup your first project. We are going to create a sample project called &#8220;blog&#8221;.</p>
<p>Create a projects folder if you don&#8217;t already have one.</p>
<pre><code>mkdir ~/Projects</code>
<code>cd ~/Projects</code>
</pre>
<p>Remember that we want to use MySQL as the database for the Rails project so we are going to pass that in with the rails command.</p>
<pre><code>rails new blog --database=mysql</code>
</pre>
<p>Set the project specific ruby version.</p>
<pre><code>cd ~/Projects/blog</code>
<code>rbenv local 1.9.3-p0</code>
</pre>
<p>This sets a local per-project Ruby version by writing the version name to an .rbenv-version file in the current directory.</p>
<p>Now run bundler on your new project.</p>
<pre><code>bundle install</code>
</pre>
<p>This will install all of the gems for this project into:</p>
<pre><code>~/Projects/blog/vendor/bundle</code>
</pre>
<p>If you ever get into a situation where your gems are working correctly, you can simple delete that entire bundle directory and run bundle install again to get fresh versions of everything for your project.</p>
<p>To setup pow for your new rails project, just create a symbolic link to the project folder in the ~/.pow directory.</p>
<pre><code>cd ~/.pow</code>
<code>ln -s ~/Projects/blog</code>
</pre>
<p>That&#8217;s it! Now you should be able to access your new project at:</p>
<p>http://blog.dev</p>
<h2> Other apps you might want</h2>
<h3> GitHub</h3>
<p>I highly recommend using GitHub to host your projects. They offer a free app for working with git repositories and it makes it super easy to use with their service.</p>
<p><a href="http://mac.github.com">http://mac.github.com</a></p>
<h3> Sublime Text 2</h3>
<p>This is the text editor I use and prefer. It has a lot of cool features and is very customizable.</p>
<p><a href="http://www.sublimetext.com/2">http://www.sublimetext.com/2</a></p>
<h3> MySQL Workbench</h3>
<p>MySQL offers a free app for managing your MySQL databases.</p>
<p><a href="http://www.mysql.com/products/workbench">http://www.mysql.com/products/workbench</a></p>
]]></content:encoded>
			<wfw:commentRss>http://hathaway.cc/2012/04/how-to-setup-mac-os-x-lion-for-ruby-and-rails-development/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to fix the cursor movement in Mac OS X Terminal</title>
		<link>http://hathaway.cc/2011/05/how-to-fix-the-cursor-movement-in-mac-os-x-terminal/</link>
		<comments>http://hathaway.cc/2011/05/how-to-fix-the-cursor-movement-in-mac-os-x-terminal/#comments</comments>
		<pubDate>Tue, 17 May 2011 23:47:04 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Archive]]></category>
		<category><![CDATA[How To's]]></category>

		<guid isPermaLink="false">http://hathology.com/?p=473</guid>
		<description><![CDATA[I&#8217;ve been frustrated with the limited cursor movement out of the box in Mac OS X Terminal for years. Usually I&#8217;m always working in a linux server session so it never bothered me enough to figure it out. But I finally got sick enough to figure out the keyboard mappings to make Terminal better. Specifically [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>I&#8217;ve been frustrated with the limited cursor movement out of the box in Mac OS X Terminal for years. Usually I&#8217;m always working in a linux server session so it never bothered me enough to figure it out. But I finally got sick enough to figure out the keyboard mappings to make Terminal better.</p>
<p>Specifically I&#8217;m referring to control + left/right or alt + left/right as well as the home or end keys. In linux terminals, these will jump you word by word and to the beginning or end of the command line respectively. Not so much in Mac OS X Terminal.</p>
<p>So here is the list of keyboard mappings to add/modify. You can find these under Terminal -> Preferences -> Settings -> Keyboard. I&#8217;m doing this on Snow Leopard 10.6.7.</p>
<p>Hint: The best way to do these is to copy/paste the action so you don&#8217;t have to figure out the correct key strokes to get the action correct.</p>
<ul>
<li><b>Key &#8211; Action</b></li>
<li>home &#8211; \033OH</li>
<li>end &#8211; \033OF</li>
<li>control cursor left &#8211; \033b</li>
<li>control cursor right &#8211; \033f</li>
<li>option cursor left &#8211; \033b</li>
<li>option cursor right &#8211; \033f</li>
<li>forward delete &#8211; \004</li>
</ul>
<p>I&#8217;ll be sure to update this as I find more useful mappings. Feel free to leave a comment if you know of additional mappings that might be useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://hathaway.cc/2011/05/how-to-fix-the-cursor-movement-in-mac-os-x-terminal/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to enable multitasking gestures in iOS 4.3</title>
		<link>http://hathaway.cc/2011/03/how-to-enable-multitasking-gestures-in-ios-4-3/</link>
		<comments>http://hathaway.cc/2011/03/how-to-enable-multitasking-gestures-in-ios-4-3/#comments</comments>
		<pubDate>Mon, 14 Mar 2011 13:23:40 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[How To's]]></category>

		<guid isPermaLink="false">http://hathology.com/?p=409</guid>
		<description><![CDATA[Unfortunately we knew that iOS 4.3 wouldn&#8217;t end up shipping with those nifty four- and five-finger gestures, but what we didn&#8217;t know was how easy it&#8217;d be to enable them. That&#8217;s right, getting even more touchy-feely with your brand new iPad 2 is just a few clicks and a 4.5GB download away &#8212; if you&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p></p><blockquote><p>Unfortunately we knew that iOS 4.3 wouldn&#8217;t end up shipping with those nifty four- and five-finger gestures, but what we didn&#8217;t know was how easy it&#8217;d be to enable them. That&#8217;s right, getting even more touchy-feely with your brand new iPad 2 is just a few clicks and a 4.5GB download away &#8212; if you&#8217;ve got $5 for Xcode of course. Sound intriguing?</p></blockquote>
<p>A nice how-to on getting the multitasking gestures on your iOS 4.3 device. These gestures improve the experience and are a great way to enjoy that new iPad 2 if you were lucky enough to get one this past weekend. I was. </p>
<p>I can&#8217;t help think these gestures will come standard on iOS 5 this summer.</p>
]]></content:encoded>
			<wfw:commentRss>http://hathaway.cc/2011/03/how-to-enable-multitasking-gestures-in-ios-4-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to delete large amounts of files from Amazon S3 buckets or folders</title>
		<link>http://hathaway.cc/2011/02/how-to-delete-large-amounts-of-files-from-amazon-s3-buckets-or-folders/</link>
		<comments>http://hathaway.cc/2011/02/how-to-delete-large-amounts-of-files-from-amazon-s3-buckets-or-folders/#comments</comments>
		<pubDate>Mon, 21 Feb 2011 23:13:40 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Archive]]></category>
		<category><![CDATA[How To's]]></category>

		<guid isPermaLink="false">http://hathology.com/?p=366</guid>
		<description><![CDATA[Once we started using Amazon S3 for file storage at Mailprotector, we were faced with the need to clean up stale files that were no longer needed. Since we only keep quarantined spam and viruses for a sliding window (currently 14 days), we have a need to daily clean up millions of files that are [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Once we started using Amazon S3 for file storage at <a href="http://mailprotector.com">Mailprotector</a>, we were faced with the need to clean up stale files that were no longer needed. Since we only keep quarantined spam and viruses for a sliding window (currently 14 days), we have a need to daily clean up millions of files that are now stale.</p>
<p>After digging through the Amazon S3 API documentation, we realized there was no efficient way of mass deleting a large chunk of files. We structured the bucket using prefixes which operate as a sort of virtual folder structure in S3. We were thinking at the time there would be some easy way of saying, delete this folder and its contents. There is not.</p>
<p>Some additional research on how we could do this quickly led me to this ruby script to mass delete an entire bucket of files called <a href="https://github.com/lathanh/s3nukem">s3nukem</a>. It looked exactly like what we needed but there was one problem, we don&#8217;t want to delete the entire bucket, just a certain path inside of the bucket.</p>
<p>So after <a href="https://github.com/hathaway/s3nukem">forking the project</a>, I added an additional parameter to allow defining a path inside of the bucket to delete.</p>
<p>This works really well. With 50 threads running I was able to delete approximately 22,300 files in a minute. That translates to 1,338,000/hour, which now gives us the ability to clean up files fast. Of course if you throw more threads and CPU at it you can increase this rate even more. </p>
]]></content:encoded>
			<wfw:commentRss>http://hathaway.cc/2011/02/how-to-delete-large-amounts-of-files-from-amazon-s3-buckets-or-folders/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Files or Applications disappearing from Spotlight? How to fix the Spotlight index</title>
		<link>http://hathaway.cc/2010/03/files-or-applications-disappearing-from-spotlight-how-to-fix-the-spotlight-index/</link>
		<comments>http://hathaway.cc/2010/03/files-or-applications-disappearing-from-spotlight-how-to-fix-the-spotlight-index/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 13:58:59 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Archive]]></category>
		<category><![CDATA[How To's]]></category>

		<guid isPermaLink="false">http://hathology.com/?p=182</guid>
		<description><![CDATA[Occasionally, the Spotlight search results will not show files or applications that they used to show or will stop working altogether. Sometimes a simple reboot will fix the problem but in case that doesn&#8217;t work, here are the steps to clear out your Spotlight index and force it to reindex your file system. Delete the [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Occasionally, the Spotlight search results will not show files or applications that they used to show or will stop working altogether. Sometimes a simple reboot will fix the problem but in case that doesn&#8217;t work, here are the steps to clear out your Spotlight index and force it to reindex your file system.</p>
<p>Delete the current index</p>
<p>To delete the Spotlight index, open up the Terminal app and type in the following:</p>
<pre>sudo rm -r /.Spotlight-V&lt;tab&gt;</pre>
<p>Note: Do not type in the &lt;tab&gt; part. That is to force the Terminal app to load whatever your index folder is into the command.</p>
<p>How to make Spotlight reindex your file system</p>
<p>To force Spotlight to reindex your file system, use the Terminal app to run the following commands:</p>
<pre>
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
sudo mdutil -E /
</pre>
<p>Give it some time to reindex your file system. You&#8217;ll notice the processors working hard during this time. Depending on the amount of file on your system, this may take a few minutes or an hour or two.</p>
]]></content:encoded>
			<wfw:commentRss>http://hathaway.cc/2010/03/files-or-applications-disappearing-from-spotlight-how-to-fix-the-spotlight-index/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to use the Voice Control feature on the iPhone 3GS</title>
		<link>http://hathaway.cc/2009/07/how-to-use-the-voice-control-feature-on-the-iphone-3gs/</link>
		<comments>http://hathaway.cc/2009/07/how-to-use-the-voice-control-feature-on-the-iphone-3gs/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 15:46:34 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[How To's]]></category>

		<guid isPermaLink="false">http://hathology.com/?p=176</guid>
		<description><![CDATA[Long story short&#8230; if you want to use the Voice Control feature on the iPhone 3GS, hold down the Home button for a couple of seconds. It will make a sound and vibrate letting you know it is ready for the command. Now, the full story&#8230; When I first purchased my iPhone 3GS, one of [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Long story short&#8230; if you want to use the Voice Control feature on the iPhone 3GS, hold down the Home button for a couple of seconds. It will make a sound and vibrate letting you know it is ready for the command.</p>
<p>Now, the full story&#8230;</p>
<p>When I first purchased my iPhone 3GS, one of the features I looked forward to use the most was the new Voice Control feature. I had owned the iPhone 3G and originally thought this feature was going to be part of the iPhone OS 3.0 upgrade but it was not. You have to have the latest hardware in the iPhone 3GS in order to use this feature.</p>
<p>When I first got my iPhone 3GS activated and ready to use, I went to use the Voice Control feature and unlike most every other iPhone feature, the Voice Control feature was not obvious. I&#8217;ve never had to pick up an iPhone manual to figure out a feature and I wasn&#8217;t going to start now. <img src='http://hathaway.cc/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  So I thought about it for a minute and realized the point of the feature is to be able to take an action in a hands free mode. The only real way to do this would be if you could trigger it without unlocking the phone. So I looked and there are only two real buttons on the phone. I figured it wasn&#8217;t going to be the power button so it had to be the home button. Sure enough, if you hold down the Home button for a couple seconds, the phone will make a unique tone sound and vibrate. This lets you know you can speak the voice command without having to even look at the phone.</p>
<p>This is a great new feature to the iPhone and one that I welcome. It allows you to have a true &#8220;eyes free&#8221; experience with the iPhone. The extension of the voice commands into the iPod controls is also great. Just another example of the iPhone leading the way in mobile devices.</p>
]]></content:encoded>
			<wfw:commentRss>http://hathaway.cc/2009/07/how-to-use-the-voice-control-feature-on-the-iphone-3gs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How To Flush DNS Cache On Mac OS X Leopard</title>
		<link>http://hathaway.cc/2008/12/how-to-flush-dns-cache-on-mac-os-x-leopard/</link>
		<comments>http://hathaway.cc/2008/12/how-to-flush-dns-cache-on-mac-os-x-leopard/#comments</comments>
		<pubDate>Fri, 19 Dec 2008 17:16:05 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Archive]]></category>
		<category><![CDATA[How To's]]></category>
		<category><![CDATA[mac os x]]></category>

		<guid isPermaLink="false">http://hathology.com/how-to-flush-dns-cache-on-mac-os-x-leopard/</guid>
		<description><![CDATA[Occasionally, you&#8217;ll want to be sure you are getting fresh DNS information during development or working on servers with hostnames. This has changed in the Leopard version of Mac OS X. The following command will now flush your DNS cache on Mac OS X Leopard: dscacheutil -flushcache]]></description>
			<content:encoded><![CDATA[<p></p><p>Occasionally, you&#8217;ll want to be sure you are getting fresh DNS information during development or working on servers with hostnames. This has changed in the Leopard version of Mac OS X. The following command will now flush your DNS cache on Mac OS X Leopard:</p>
<p><code>dscacheutil -flushcache</code></p>
]]></content:encoded>
			<wfw:commentRss>http://hathaway.cc/2008/12/how-to-flush-dns-cache-on-mac-os-x-leopard/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How To Setup A Permanent Redirect (HTTP 301) With PHP</title>
		<link>http://hathaway.cc/2008/09/how-to-setup-a-permanent-redirect-http-301-with-php/</link>
		<comments>http://hathaway.cc/2008/09/how-to-setup-a-permanent-redirect-http-301-with-php/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 13:26:08 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Archive]]></category>
		<category><![CDATA[How To's]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[redirect]]></category>

		<guid isPermaLink="false">http://hathology.com/?p=76</guid>
		<description><![CDATA[The HTTP 301 status code is meant for use when you want to redirect a page or URL to its new destination after reorganizing or moving a web site around. This can be on the same domain or an entirely new domain. Here is the W3C definition of the 301 code. The requested resource has [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>The HTTP 301 status code is meant for use when you want to redirect a page or URL to its new destination after reorganizing or moving a web site around. This can be on the same domain or an entirely new domain. Here is the W3C definition of the 301 code.</p>
<blockquote><p>The requested resource has been assigned a new permanent URI and any    future references to this resource SHOULD use one of the returned    URIs.  Clients with link editing capabilities ought to automatically    re-link references to the Request-URI to one or more of the new    references returned by the server, where possible. This response is    cacheable unless indicated otherwise.</p>
<p>The new permanent URI SHOULD be given by the Location field in the    response. Unless the request method was HEAD, the entity of the    response SHOULD contain a short hypertext note with a hyperlink to    the new URI(s).</p>
<p>If the 301 status code is received in response to a request other    than GET or HEAD, the user agent MUST NOT automatically redirect the    request unless it can be confirmed by the user, since this might    change the conditions under which the request was issued.<br />
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.2" target="_blank">W3C Hypertext Transfer Protocol</a></p></blockquote>
<p>This is particularly useful for search engines like Google, which will carry over page rank to the new page if this status code is seen. If you do not need to indicate permanent displacement, you can accomplish redirection by setting a Location header in PHP. The <em>location</em> header does the actual redirection to the new location, and can be used by itself.</p>
<p>If you set the Location header by itself, PHP automatically sets the status code to <em>HTTP/1.1 302 Found</em>.</p>
<p>Note, if you attempt to send headers after content has been sent, you will get a warning like, <em>&#8220;Warning: Cannot modify header information &#8211; headers already sent by &#8230;&#8221;</em>.  Watch out for empty lines and spaces between PHP open and close tags.</p>
<p>Here is the code to do this in PHP&#8230;</p>
<p><code>&lt;?php<br />
// Permanent redirection<br />
header("HTTP/1.1 301 Moved Permanently");<br />
header("Location: http://www.example.com/");<br />
exit();<br />
?&gt;</code></p>
<p>Just make sure you put these lines in your page before any other content is sent out. The http://www.example.com/ part can be changed to whatever the new address for this resource is.</p>
]]></content:encoded>
			<wfw:commentRss>http://hathaway.cc/2008/09/how-to-setup-a-permanent-redirect-http-301-with-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Find Your iPhone/iPod Touch Serial Number</title>
		<link>http://hathaway.cc/2008/09/how-to-find-your-iphoneipod-touch-serial-number/</link>
		<comments>http://hathaway.cc/2008/09/how-to-find-your-iphoneipod-touch-serial-number/#comments</comments>
		<pubDate>Wed, 24 Sep 2008 15:24:09 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Archive]]></category>
		<category><![CDATA[How To's]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[iphone]]></category>

		<guid isPermaLink="false">http://hathology.com/?p=104</guid>
		<description><![CDATA[If you have ever contacted Apple for support on any of their products, you know the first question they are going to ask you is&#8230; &#8220;What is your serial number?&#8221;. The serial number is easy to find on most of their products because they allow you to access it through the software. This is typically [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>If you have ever contacted Apple for support on any of their products, you know the first question they are going to ask you is&#8230; &#8220;What is your serial number?&#8221;. The serial number is easy to find on most of their products because they allow you to access it through the software. This is typically a much better alternative to turning the device off to flip it over, remove the battery and squint to read the long string of letters and number in a size 4 font.</p>
<p>The only problem is that each device OS has a different location to find this serial number. This article explains how to find the serial number in your iPhone device. It will also work for the iPhone 3G since they use the same operating system. And it should also work the same for the iPod Touch.</p>
<ol>
<li>From the main screen on your iPhone/iPod Touch, tap the &#8220;Settings&#8221; icon.</li>
<li>On the Settings screen, tap the General section.</li>
<li>Now tap the About section.</li>
<li>Scroll down a ways and you will see an item for &#8220;Serial Number&#8221;. That&#8217;s it, read that off to the support person and you&#8217;ll be on your way.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://hathaway.cc/2008/09/how-to-find-your-iphoneipod-touch-serial-number/feed/</wfw:commentRss>
		<slash:comments>122</slash:comments>
		</item>
		<item>
		<title>How To Re-enable Mac OS X Spotlight</title>
		<link>http://hathaway.cc/2008/09/how-to-re-enable-mac-os-x-spotlight/</link>
		<comments>http://hathaway.cc/2008/09/how-to-re-enable-mac-os-x-spotlight/#comments</comments>
		<pubDate>Tue, 23 Sep 2008 22:51:59 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Archive]]></category>
		<category><![CDATA[How To's]]></category>
		<category><![CDATA[mac os x]]></category>
		<category><![CDATA[spotlight]]></category>

		<guid isPermaLink="false">http://hathology.com/?p=100</guid>
		<description><![CDATA[If you have previously disabled the Mac OS X Spotlight feature and you now find that you would like to turn it on again, following these steps to do so. Launch Terminal and type the following command: sudo nano /etc/hostconfig Find the following entry in the hostconfig file: SPOTLIGHT=-NO- Change SPOTLIGHT=-NO- to SPOTLIGHT=-YES- Save /etc/hostconfig [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>If you have previously disabled the Mac OS X Spotlight feature and you now find that you would like to turn it on again, following these steps to do so.</p>
<ol>
<li>Launch Terminal and type the following command: <code>sudo nano /etc/hostconfig</code></li>
<li>Find the following entry in the hostconfig file: <code>SPOTLIGHT=-NO-</code></li>
<li>Change <code>SPOTLIGHT=-NO-</code> to <code>SPOTLIGHT=-YES-</code></li>
<li>Save /etc/hostconfig by hitting Control-O and the return key. Next hit Control-X to exit the nano editor.</li>
<li></li>
<li>Disable the Spotlight index by typing the following in the Terminal:<code> sudo mdutil -i on /</code></li>
<li>When you reboot, Spotlight will be enabled again.</li>
</ol>
<p>If you would like to disable the Mac OS X Spotlight feature, follow our guide on <a href="http://hathology.com/how-to-completely-disable-mac-os-x-spotlight/">How To Completely Disable Mac OS X Spotlight</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://hathaway.cc/2008/09/how-to-re-enable-mac-os-x-spotlight/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

