<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
     xmlns:atom="http://www.w3.org/2005/Atom"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:wfw="http://wellformedweb.org/CommentAPI/"
     >
  <channel>
    <title>Ask the Relic</title>
    <link>http://asktherelic.com/code</link>
    <description>Programming 'n stuff</description>
    <pubDate>Fri, 30 Apr 2010 04:14:57 GMT</pubDate>
    <generator>Blogofile</generator>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Accessing Google Reader via OAuth and Python</title>
      <link>http://asktherelic.com/2010/04/26/accessing-google-reader-via-oauth-and-python</link>
      <pubDate>Mon, 26 Apr 2010 18:19:40 EDT</pubDate>
      <category><![CDATA[Life]]></category>
      <guid isPermaLink="true">http://asktherelic.com/2010/04/26/accessing-google-reader-via-oauth-and-python</guid>
      <description>Accessing Google Reader via OAuth and Python</description>
      <content:encoded><![CDATA[<p>Last month, Google Reader <a href="http://groups.google.com/group/fougrapi/browse_thread/thread/4430c9a6dea4d70f" title="Groups post on OAuth access">announced</a> support for accessing user data via OAuth. Previously, access was unofficially allowed using the <a href="http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html" title="Authentication using ClientLogin">ClientLogin method</a>, which required the user's login and password. OAuth seems to be the recommended access method for the future, due to security it provides for a user. I've finally had a chance to figure out OAuth using Python and how to get your Reader data, so I wanted to share my method.
</p>
<p>For an example of the ClientLogin method in Python, take a look at my <a href="http://github.com/askedrelic/libgreader" title="Python library for working with Google Reader">libgreader library</a> on github. It automates the ClientLogin auth and tokens that you are required to have for any requests. I'm working to merge this code below into a more generic Google Reader library supporting both auth methods.
</p>
<p>I've written my code using v1.1.3 of the <a href="http://github.com/simplegeo/python-oauth2/" title="OAuth2 v1.1.3">OAuth2 python library</a> to help wrangle OAuth. This was my first foray into OAuth and using the library certainly helped for figuring out all the required data and security that you need to have on every request. If you haven't used OAuth before, definitely check out <a href="http://oauth.net/">http://oauth.net/</a> and the <a href="http://code.google.com/apis/accounts/docs/OAuth.html" title="docs for Google OAuth for Webapps">Google docs</a> for using their OAuth implementation. If you just want to experiment with the process not using Python, use <a href="http://googlecodesamples.com/oauth_playground/" title="Interactive OAuth using AJAX">this interactive JS/AJAX app</a>.
</p>

<h3>The Code</h3>
<p>First, let's setup some imports and definitions. You can also <a href="http://gist.github.com/380090">view this source code</a> on Github.
</p>
<div class="pygments_murphy"><pre>	<span class="kn">import</span> <span class="nn">urlparse</span>
	<span class="kn">import</span> <span class="nn">oauth2</span> <span class="kn">as</span> <span class="nn">oauth</span>
	
	<span class="c">#Unsecured http for testing, should be https for production</span>
	<span class="n">scope</span> <span class="o">=</span> <span class="s">&quot;http://www.google.com/reader/api&quot;</span>
	<span class="c">#Alphabetical list of a user&#39;s subscriptions</span>
	<span class="n">sub_url</span> <span class="o">=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">/0/subscription/list&quot;</span> <span class="o">%</span> <span class="n">scope</span>
	<span class="c">#JSON list of a user&#39;s unread feed items</span>
	<span class="n">reading_url</span> <span class="o">=</span> <span class="s">&#39;</span><span class="si">%s</span><span class="s">/0/stream/contents/user/-/state/com.google/reading-list&#39;</span> <span class="o">%</span> <span class="n">scope</span>
	
	<span class="c">#Google Auth urls</span>
	<span class="n">request_token_url</span> <span class="o">=</span> <span class="s">&quot;https://www.google.com/accounts/OAuthGetRequestToken?scope=</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">scope</span>
	<span class="n">authorize_url</span> <span class="o">=</span> <span class="s">&#39;https://www.google.com/accounts/OAuthAuthorizeToken&#39;</span>
	<span class="n">access_token_url</span> <span class="o">=</span> <span class="s">&#39;https://www.google.com/accounts/OAuthGetAccessToken&#39;</span>
	
</pre></div>

<p>Now, you have to setup a consumer key with Google, for the future domain your webapp will run at. The url to manage your domains is <a href="https://www.google.com/accounts/ManageDomains" title="Getting your OAuth key/secret">https://www.google.com/accounts/ManageDomains</a>
</p>
<div class="pygments_murphy"><pre>	<span class="n">oauth_key</span> <span class="o">=</span> <span class="s">&quot;www.asktherelic.com&quot;</span>
	<span class="n">oauth_secret</span> <span class="o">=</span> <span class="s">&quot;XXXXXXXXXXXXXXXX&quot;</span>
	
	<span class="n">consumer</span> <span class="o">=</span> <span class="n">oauth</span><span class="o">.</span><span class="n">Consumer</span><span class="p">(</span><span class="n">oauth_key</span><span class="p">,</span> <span class="n">oauth_secret</span><span class="p">)</span>
	<span class="n">client</span> <span class="o">=</span> <span class="n">oauth</span><span class="o">.</span><span class="n">Client</span><span class="p">(</span><span class="n">consumer</span><span class="p">)</span>
</pre></div>

<p>From here, most of the code mirrors the example code from the OAuth2 library, using a 3-step process to verify and get your required tokens from Google. In step 2, you have to manually open the link and authorize your script with Google.
</p>
<div class="pygments_murphy"><pre>	<span class="c"># Step 1: Get a request token. This is a temporary token that is used for </span>
	<span class="c"># having the user authorize an access token and to sign the request to obtain </span>
	<span class="c"># said access token.</span>
	
	<span class="n">resp</span><span class="p">,</span> <span class="n">content</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">request</span><span class="p">(</span><span class="n">request_token_url</span><span class="p">,</span> <span class="s">&quot;GET&quot;</span><span class="p">)</span>
	<span class="n">request_token</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span><span class="n">urlparse</span><span class="o">.</span><span class="n">parse_qsl</span><span class="p">(</span><span class="n">content</span><span class="p">))</span>
	
	<span class="k">print</span> <span class="s">&quot;Request Token:&quot;</span>
	<span class="k">print</span> <span class="s">&quot;    - oauth_token        = </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">request_token</span><span class="p">[</span><span class="s">&#39;oauth_token&#39;</span><span class="p">]</span>
	<span class="k">print</span> <span class="s">&quot;    - oauth_token_secret = </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">request_token</span><span class="p">[</span><span class="s">&#39;oauth_token_secret&#39;</span><span class="p">]</span>
	<span class="k">print</span>
	
	<span class="c"># Step 2: Redirect to the provider. Since this is a CLI script we do not</span>
	<span class="c"># redirect. In a web application you would redirect the user to the URL</span>
	<span class="c"># below.</span>
	
	<span class="k">print</span> <span class="s">&quot;Go to the following link in your browser:&quot;</span>
	<span class="k">print</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">?oauth_token=</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">authorize_url</span><span class="p">,</span> <span class="n">request_token</span><span class="p">[</span><span class="s">&#39;oauth_token&#39;</span><span class="p">])</span>
	<span class="k">print</span>
	
	<span class="n">accepted</span> <span class="o">=</span> <span class="s">&#39;n&#39;</span>
	<span class="k">while</span> <span class="n">accepted</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="s">&#39;n&#39;</span><span class="p">:</span>
	    <span class="n">accepted</span> <span class="o">=</span> <span class="nb">raw_input</span><span class="p">(</span><span class="s">&#39;Have you authorized me? (y/n) &#39;</span><span class="p">)</span>
	
	<span class="c"># Step 3: Once the consumer has redirected the user back to the oauth_callback</span>
	<span class="c"># URL you can request the access token the user has approved. You use the</span>
	<span class="c"># request token to sign this request. After this is done you throw away the</span>
	<span class="c"># request token and use the access token returned. You should store this</span>
	<span class="c"># access token somewhere safe, like a database, for future use.</span>
	<span class="n">token</span> <span class="o">=</span> <span class="n">oauth</span><span class="o">.</span><span class="n">Token</span><span class="p">(</span><span class="n">request_token</span><span class="p">[</span><span class="s">&#39;oauth_token&#39;</span><span class="p">],</span> <span class="n">request_token</span><span class="p">[</span><span class="s">&#39;oauth_token_secret&#39;</span><span class="p">])</span>
	<span class="n">client</span> <span class="o">=</span> <span class="n">oauth</span><span class="o">.</span><span class="n">Client</span><span class="p">(</span><span class="n">consumer</span><span class="p">,</span> <span class="n">token</span><span class="p">)</span>
	
	<span class="n">resp</span><span class="p">,</span> <span class="n">content</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">request</span><span class="p">(</span><span class="n">access_token_url</span><span class="p">,</span> <span class="s">&quot;POST&quot;</span><span class="p">)</span>
	<span class="n">access_token</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span><span class="n">urlparse</span><span class="o">.</span><span class="n">parse_qsl</span><span class="p">(</span><span class="n">content</span><span class="p">))</span>
	
	<span class="k">print</span> <span class="s">&quot;Access Token:&quot;</span>
	<span class="k">print</span> <span class="s">&quot;    - oauth_token        = </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">access_token</span><span class="p">[</span><span class="s">&#39;oauth_token&#39;</span><span class="p">]</span>
	<span class="k">print</span> <span class="s">&quot;    - oauth_token_secret = </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">access_token</span><span class="p">[</span><span class="s">&#39;oauth_token_secret&#39;</span><span class="p">]</span>
	<span class="k">print</span>
	<span class="k">print</span> <span class="s">&quot;You may now access protected resources using the access tokens above.&quot;</span>
</pre></div>

<p>An annoying process, but once completed, you can create an authorized client which can hit any Google Reader url and access data. First, let's start off with the user's subscription list. Then the user's reading list.
</p>
<div class="pygments_murphy"><pre>	<span class="c">#Authorized client using access tokens</span>
	<span class="n">token</span> <span class="o">=</span> <span class="n">oauth</span><span class="o">.</span><span class="n">Token</span><span class="p">(</span><span class="n">access_token</span><span class="p">[</span><span class="s">&#39;oauth_token&#39;</span><span class="p">],</span> <span class="n">access_token</span><span class="p">[</span><span class="s">&#39;oauth_token_secret&#39;</span><span class="p">])</span>
	<span class="n">client</span> <span class="o">=</span> <span class="n">oauth</span><span class="o">.</span><span class="n">Client</span><span class="p">(</span><span class="n">consumer</span><span class="p">,</span> <span class="n">token</span><span class="p">)</span>
	
	<span class="c">#Get user&#39;s subscription list</span>
	<span class="n">resp</span><span class="p">,</span> <span class="n">content</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">request</span><span class="p">(</span><span class="n">sub_url</span><span class="p">,</span> <span class="s">&#39;GET&#39;</span><span class="p">)</span>
	<span class="k">print</span> <span class="n">content</span>
	<span class="k">print</span> 
	
	<span class="c">#Get user&#39;s reading list</span>
	<span class="n">resp</span><span class="p">,</span> <span class="n">content</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">request</span><span class="p">(</span><span class="n">reading_url</span><span class="p">,</span> <span class="s">&#39;GET&#39;</span><span class="p">)</span>
	<span class="k">print</span> <span class="n">content</span>
</pre></div>

<p>In this CLI example, the user experience is pretty disjointed, but in a webapp setting, you would like for a more fluid experience. The way to do that is using a callback: a location that google will punt the user to after the 2nd step, when they have authorized your application. Checkout the code below for a simple example or the google docs for options.
</p>
<div class="pygments_murphy"><pre>	<span class="c">#Google Auth using a callback</span>
	<span class="n">callback</span> <span class="o">=</span> <span class="s">&quot;http://www.asktherelic.com/thenextstep/&quot;</span>
	<span class="n">request_token_url</span> <span class="o">=</span> <span class="s">&quot;https://www.google.com/accounts/OAuthGetRequestToken?scope=</span><span class="si">%s</span><span class="s">&amp;oauth_callback=</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">callback</span><span class="p">)</span>
</pre></div>


<h3>Possible Issues</h3>
<p>The Google Reader API is still pretty undocumented, most knowledge comes from sniffing Google Reader traffic that their webapp generates or experimenting on your own. One difference between the ClientLogin and the OAuth login is that ClientLogin method requires your script to get a token from the Reader API. I haven't seen the OAuth method require that token in my testing, but it might be something that is still required.
</p>
<p>Another thing I noticed while testing, with the 2nd OAuth auth step that occurs when you have multiple Google accounts, is that Google Apps accounts don't seem to work with my code. I'm using a regular gmail account but Google Apps appear to be a different affair.
</p>
<p>Goodluck with the Reader API.
</p>]]></content:encoded>
    </item>
    <item>
      <title>Awesome OSX Software</title>
      <link>http://asktherelic.com/2010/04/12/awesome-osx-software</link>
      <pubDate>Mon, 12 Apr 2010 12:27:24 EDT</pubDate>
      <category><![CDATA[Life]]></category>
      <guid isPermaLink="true">http://asktherelic.com/2010/04/12/awesome-osx-software</guid>
      <description>Awesome OSX Software</description>
      <content:encoded><![CDATA[<p>Many years ago, when I switched to OSX from Windows, I quickly knew it was the right choice to switch. As the years have passed and my knowledge of all three major platforms(OSX, Windows, and Linux) has increased, I've become more confident and happy with my choice of OSX. While the OS defines how you interact with the software, but the software defines what you can accomplish and enables you to do so. Here is a selection of awesome software which I've found really helps me out. You can also check out my last post about <a href="/2010/04/05/my-perfect-osx-terminal-setup">Terminal and the hacks I use here</a>.
</p>

<h3>Spark</h3>
<p><a href="http://www.shadowlab.org/Software/spark.php">Spark</a> is a shortcut manager that has been around for years, but I just recently found out about. I am a very keyboard driven user who loves to customize things and Spark lets me do that. Spark allow you to rebind keyboard shortcuts to do pretty much anything: Applescript, launch Applications, open Documents, call window/menu commands in specific programs or call other keyboard shortcuts. It's very versatile and has replaced a few other applications for me.
</p>
<p><span class="aligncenter">
   <img src="/pic/spark1.png" title="spark configuration window" alt="Spark Configuration Window"/>
   </span>
</p>
<p>Here is my current Spark configuration, which I am mainly using to reconfigure iTunes. I listen to iTunes 24x7 and like to be able to easily rate the currently playing track.  I have <code>CTRL + F15-F19</code> keys setup to do so. I also have a <code>CTRL</code> key setup to display the current track, along with album cover, current position in the song, and song length. Having all of this info is really nice, because I have seen other pay-for iTunes control programs skimp and not provide it. 
</p>
<p><span class="aligncenter">
   <img src="/pic/spark2.png" title="spark itunes info" alt="Spark iTunes Info"/>
   </span>
</p>
<p>One of the things not shown, is that you can bind keys per-application or system wide. I have a shortcut in iTunes for <code>Apple + D</code> to bring focus to the search music window because the default shortcut key is <code>Apple + Shift + F</code>, which is awkward for a shortcut I use frequently. iTunes has <code>Apple + F</code> bound to set the visualizer to fullscreen mode, which I never even use the damn visualizer.
</p>
<p>Some of this might seem minor, but the overall package that Spark provides is stellar. You can export and import your database of commands, which is great for future portability and backups. The Spark Daemon seems to average around 10MB of memory usage, which is less than other iTunes control programs I've seen and it does more than other programs. Combined with the expandability to control any other program, I think Spark a good choice.
</p>

<h3>iStat Menus</h3>
<p>As you have seen, I love being able to customize and tweak my system. <a href="http://www.islayer.com/apps/istatmenus/">iStat Menus</a> is one of the best packages I have seen to monitor your system and what it is doing. It is very much a power user program, most people don't need to know as much info as it provides, but you do want that info, iStat provides it very well. The website for iStat provides a very thorough description, worth checking out.
</p>

<h3>Teleport</h3>
<p><a href="http://abyssoft.com/software/teleport/">Teleport</a> is another piece of software that I just found out about recently, but has been around for awhile: it allows you to share control of 2(or more) OSX systems via 1 keyboard/mouse. Very similar to <a href="http://synergy2.sourceforge.net/">Synergy</a>, which allows you to share control between any OSX/Windows/Linux system, but I always found Synergy to be buggy and not that fluid. Teleport works quite well, you can configure it to switch systems when you get to the edge of the screen and it works near instantaneously. If you have a main machine and a laptop, you can have Teleport run in the background on both and control the laptop via the main system, whenever the laptop is plugged in. Teleport is nearly invisible and is one of the reasons it is so good.
</p>

<h3>Sequel Pro</h3>
<p>As a developer, I work with mySQL frequently and installing phpMyAdmin is annoying. Sequel Pro is a mySQL database management program, which has evolved quite a bit over the last few years and is way better than the default mySQL admin tools, which have not seen an update in years. 
</p>
<p><span class="aligncenter">
   <img src="/pic/sequelpro1.png" alt="Sequel Pro"/>
   </span>
</p>
<p>Sequel Pro lets you create/edit/delete tables using the OSX Cocoa goodness. It has built-in support for SSH tunnels, so you can securely connect to your mySQL server on your development/production server and view/edit data there. You can import/export data as well. Sometimes working in a console isn't always the best choice, especially when dealing with lots of data. This program is a great option beyond the console.
</p>
<p>These are great OSX programs that I use all the time. Have any other programs that you like? Post them in the comments!
</p>]]></content:encoded>
    </item>
    <item>
      <title>My Perfect OSX Terminal Setup</title>
      <link>http://asktherelic.com/2010/04/05/my-perfect-osx-terminal-setup</link>
      <pubDate>Mon, 05 Apr 2010 14:44:13 EDT</pubDate>
      <category><![CDATA[Life]]></category>
      <guid isPermaLink="true">http://asktherelic.com/2010/04/05/my-perfect-osx-terminal-setup</guid>
      <description>My Perfect OSX Terminal Setup</description>
      <content:encoded><![CDATA[<p>As a programmer and a part-time sysadmin, I spend a huge amount of time in the OSX Terminal and find it be one of the better CLI environments I've used, after some tweaking. Windows + Powershell or CMD (shudder) is just terrible. Linux with Xterm comes close, but doesn't have the same easy usability that I enjoy about the OSX Terminal. Today, I'd like to share my tweaks and explain what I enjoy about them.
</p>
<p>Here is my general color scheme/terminal look. I'm running OSX 10.6.3 with 64-bit Terminal. All of these tweaks depend on <a href="http://www.culater.net/software/SIMBL/SIMBL.php">SIMBL</a>, a bundle loader which loads these tweaks. I'm running version 0.9.7a.
</p>
<p><span class="aligncenter">
   <img src="/pic/terminal1.png" title="terminal colorscheme" alt="Pretty colors!"/>
   </span>
</p>

<h3>Visor</h3>
<p><a href="http://visor.binaryage.com/">Visor</a> is a "system-wide terminal on a hot-key". I have Visor bound to <code>Apple ~</code>. Having simple access to the Terminal whenever I want is very important.
</p>
<p>Visor also adds "copy on select", a very useful little tweak for text. Additionally, it allows you bind the Terminal to a specific position; having it drop down from the top and take up 50% of the screen, reminiscent of the Quake style visor. I bind my Visor to use the full screen.
</p>

<h3>Terminal Tab Switching</h3>
<p>Visor only uses one main window, which means you can have multiple tabs in the window. Getting easy access to the specific tab I want is very important. Chrome, Firefox, and many other tab based applications bind <code>Apple 1-9</code> to the specified tab location and I like having that functionality in Terminal. I rarely work with more than 9 tabs anyways.
</p>
<p>TerminalTabSwitching was originally posted as a 32-bit plugin for SIMBL 3 years ago <a href="http://ciaranwal.sh/2007/12/10/tab-switching-in-terminal">here</a>. Since then, Terminal and OSX went 64-bit and the plugin stopped working. dabeeeenster has ported the plugin and you can download the latest version on <a href="http://github.com/dabeeeenster/TerminalTabSwitching">github</a>.
</p>
<p>Another useful tweak I do is bind the left and right bracket, <code>Apple [</code>, to select the next or previous tab, like in every other program. Terminal defaults to using curly brackets, <code>Apple {</code>, to switch tabs, but doesn't let you change that. In the OSX System Preferences, under the Keyboard settings, you can rebind window commands to any key you want and I do so!
</p>
<p><span class="aligncenter">
   <img src="/pic/terminal2.png" title="Rebind Apple ]" alt="Rebind Apple right bracket"/>
   </span>
</p>

<h3>Terminal Colors</h3>
<p>This is mostly cosmetic, but when in Vim and coding, having the specific color for a function or variable is useful and every color has huge implied meaning. Being able to better select the right color and using more eye pleasing colors is useful.
</p>
<p><a href="http://blog.fallingsnow.net/2009/08/28/fixing-colors-in-terminal-app-on-10-6/">TerminalColors</a> is a plugin that updates the default colors to be less jarring and lets you use the standard OSX color picker to choose any color you want. Downloadable <a href="http://cloud.github.com/downloads/evanphx/terminalcolours/TerminalColours-SL.tar.gz">here</a>.
</p>
<p><strong>Addendum:</strong>
   If you are getting "Terminal version errors" or something equivalent, you may have to modify your plugin to support the latest version of Terminal. Goto <code>~/Library/Application Support/SIMBL</code>, right click on the broken plugin and select "Show Package Contents". Then open the Contents folder and open the Info.plist file with a text editor. Generally it is the MaxBundleVersion number that gives problems. Increase that number until it works, I'm using 280 for my bundles and Terminal is at version 273 as of now.
</p>
<p>These tweaks help me use Terminal better and make my life easier. If you want more tips on OSX Finder and Terminal integration, check out my other post <a href="/2009/01/31/osx-terminal-and-finder-integration/">here</a>. Hope they help you as well!
</p>]]></content:encoded>
    </item>
    <item>
      <title>Fixing MacFusion with OSX 10.6.3</title>
      <link>http://asktherelic.com/2010/04/05/fixing-macfusion-with-osx-10.6.3</link>
      <pubDate>Mon, 05 Apr 2010 14:11:58 EDT</pubDate>
      <category><![CDATA[Life]]></category>
      <guid isPermaLink="true">http://asktherelic.com/2010/04/05/fixing-macfusion-with-osx-10.6.3</guid>
      <description>Fixing MacFusion with OSX 10.6.3</description>
      <content:encoded><![CDATA[<p>MacFusion is a great little app that allows you to mount network locations over SSH, which I've <a href="http://asktherelic.com/2009/07/17/edit-locally-run-remotely-via-macfuse/">mentioned before</a>. With the latest 10.6.3 update in OSX, the latest version MacFusion 2.0.3 breaks. Unfortunately, the developers of MacFusion haven't touched the app in over 2 years.
</p>
<p>I found a fix on the <a href="http://groups.google.com/group/macfuse/browse_thread/thread/3c611784177843f0" title="MacFusion google groups">MacFusion Google Group</a>. A third-party developer, nall, fixed the problem and updated the binary to 2.0.4, available at <a href="http://github.com/downloads/nall/MacFusion2/Macfusion-2.0.4-SL.zip">http://github.com/downloads/nall/MacFusion2/Macfusion-2.0.4-SL.zip</a>. This version works fine for me on 10.6.3. While this might not be a long term fix, it works now and I will update this post if an official way comes out.
</p>
<p>This latest version also now correctly shows the volume size for the mount point, which previously would only show "1TB" for me. Hooray for working software!
</p>]]></content:encoded>
    </item>
    <item>
      <title>A New Branch</title>
      <link>http://asktherelic.com/2010/02/25/a-new-branch</link>
      <pubDate>Thu, 25 Feb 2010 15:25:14 EST</pubDate>
      <category><![CDATA[Life]]></category>
      <guid isPermaLink="true">http://asktherelic.com/2010/02/25/a-new-branch</guid>
      <description>A New Branch</description>
      <content:encoded><![CDATA[<p>I've been writing on this site for a couple years now, slowing figuring out how to organize things and finding out what I like to write about. I've finally come the conclusion that it's time to split into two sites, <a href="http://www.asktherelic.com">asktherelic.com</a> and <a href="http://www.thebehrensventure.com">thebehrensventure.com</a>.
</p>
<p>Ask the Relic (this blog) will focus on programming, sys admin, web dev, and other tech things I'm trying to make a career out of, while TheBehrensVenture will focus on my random travels, stories, and adventures. Two very different themes, deserving of different methods of display. The Behrens Venture had running on Wordpress and will continue to do so. I love WP's simple plugins and content management capabilities. It's damn simple to upload a picture and write something up. However, when posting longer how-tos or source code, WP wasn't cutting it. This blog, AskTheRelic will now be run off <a href="http://blogofile.com/">Blogofile</a>, a Python static file compiler. It's Python, which I love using, and is super easy to tinker with. I can also now keep this entire site under source control, git specifically, which is awesome.
</p>
<p>I've split up most of my travel/tech posts and moved them to their respective sites. I'm still cleaning up AskTheRelic, but I hope to keep moving things forward slowly. This is all work in progress, bear with me!
</p>]]></content:encoded>
    </item>
    <item>
      <title>Bash History Punchcard</title>
      <link>http://asktherelic.com/2009/11/10/bash-history-punchcard/</link>
      <pubDate>Tue, 10 Nov 2009 21:13:54 EST</pubDate>
      <category><![CDATA[Life]]></category>
      <guid>http://asktherelic.com/2009/11/10/bash-history-punchcard/</guid>
      <description>Bash History Punchcard</description>
      <content:encoded><![CDATA[<p>I love the punchcard graph on GitHub, showing the hourly/daily/weekly output of a project in a nice and neat format. I decided to apply the punchcard format to my Bash history, one of the random bits of data I have lying around.
</p>
<p>By default, Bash just stores history commands sequentially with a number and the command. To store the command with a timestamp, you must set the HISTTIMEFORMAT variable in your bashrc. That variable is used to format the output from "history", but it must be set to something for Bash to store the timestamp.
</p>
<div class="pygments_murphy"><pre>    <span class="n">export</span> <span class="n">HISTTIMEFORMAT</span><span class="o">=</span><span class="s">&#39;%Y-%m-%d %H:%M:%S - &#39;</span>
   
</pre></div>

<p>With a timestamped .bash_history file, you can figure out when you were using your terminal! Someone else had <a href="http://dustin.github.com/2009/01/11/timecard.html">already come up with this idea</a> using git history data, so I borrowed most of their code and created a new project on github.
</p>
<p><a href="http://github.com/askedrelic/Bash-History-Punchcard">http://github.com/askedrelic/Bash-History-Punchcard</a>
</p>
<p>Sample output from my account on this server (thebehrensventure.com)
   <a href="http://thebehrensventure.com/wp-content/uploads/2009/11/asktherelic-historychart.png"><img src="http://thebehrensventure.com/wp-content/uploads/2009/11/asktherelic-historychart-500x187.png" alt="asktherelic-historychart" title="asktherelic-historychart" width="500" height="187" class="aligncenter size-medium wp-image-736" /></a>
</p>
<p>Sample output from my main machine (jofur)
   <a href="http://thebehrensventure.com/wp-content/uploads/2009/11/jofur-historychart.png"><img src="http://thebehrensventure.com/wp-content/uploads/2009/11/jofur-historychart-500x187.png" alt="jofur-historychart" title="jofur-historychart" width="500" height="187" class="aligncenter size-medium wp-image-737" /></a>
</p>
<p>So for both of these, my bash history goes back about 7 months, when I turned on the variable. It's not 100% accurate either because I have duplicates being ignored and some other settings altering my bash history. It looks like Tue/Wed/Thur are my big days for getting stuff done!
</p>]]></content:encoded>
    </item>
    <item>
      <title>GIT Line Totals Per Author </title>
      <link>http://asktherelic.com/2009/10/24/git-line-totals-per-author/</link>
      <pubDate>Sat, 24 Oct 2009 21:58:17 EDT</pubDate>
      <category><![CDATA[Life]]></category>
      <guid>http://asktherelic.com/2009/10/24/git-line-totals-per-author/</guid>
      <description>GIT Line Totals Per Author </description>
      <content:encoded><![CDATA[<p>I finally switched all of my projects over to git or git-svn and have never been happier. Everything has so many more options than svn, everything is faster, and the universe of software for git is way better than svn. Switch now!
</p>
<p>Awhile back I wrote a command to print the total number of lines contributed per author for my svn repository because I wanted to see how awesome I am. I decided to port this command over to git.
</p>
<div class="pygments_murphy"><pre>    git ls-files | xargs -n1 -d<span class="s1">&#39;n&#39;</span> -i git-blame <span class="o">{}</span> | perl -n -e <span class="s1">&#39;/s((.*?)s[0-9]{4}/ &amp;&amp; print &quot;$1n&quot;&#39;</span> | sort -f | uniq -c -w3 | sort -r
    
    Output:
     217167 mattb
      11592 bob
       3975 alice
       1276 jim
        358 tom
         64 brad
         13 Not Committed Yet
   
</pre></div>

<p>This output includes a bunch of binary files which throw off the total.  If you mess with the ls-file options, you can remove them or only include specific source filestypes.
</p>
<div class="pygments_murphy"><pre>    <span class="c1">#to remove really random binary files</span>
    <span class="n">git</span> <span class="n">ls</span><span class="o">-</span><span class="n">files</span> <span class="o">-</span><span class="n">x</span> <span class="s">&quot;*pdf&quot;</span> <span class="o">-</span><span class="n">x</span> <span class="s">&quot;*psd&quot;</span> <span class="o">-</span><span class="n">x</span> <span class="s">&quot;*tif&quot;</span>  
    <span class="c1">#to only include specific file types</span>
    <span class="n">git</span> <span class="n">ls</span><span class="o">-</span><span class="n">files</span> <span class="s">&quot;*.py&quot;</span> <span class="s">&quot;*.html&quot;</span> <span class="s">&quot;*.css&quot;</span> 
   
</pre></div>

<p>I crossposted this over at <a href="http://www.commandlinefu.com/commands/view/3889/prints-per-line-contribution-per-author-for-a-git-repository">commndlinefu</a>, so there might be some helpful feedback over there too.
</p>]]></content:encoded>
    </item>
    <item>
      <title>SVN Line Output Totals</title>
      <link>http://asktherelic.com/2009/07/28/svn-output-totals/</link>
      <pubDate>Tue, 28 Jul 2009 22:23:04 EDT</pubDate>
      <category><![CDATA[Life]]></category>
      <guid>http://asktherelic.com/2009/07/28/svn-output-totals/</guid>
      <description>SVN Line Output Totals</description>
      <content:encoded><![CDATA[<p>I'm working in a group project currently and annoyed at the lack of output by my teammates. Wanting hard metrics of how awesome I am and how awesome they aren't, I wrote this command up.
</p>
<div class="pygments_murphy"><pre>    svn ls -R | egrep -v -e <span class="s2">&quot;/$&quot;</span> | xargs svn blame | awk <span class="s1">&#39;{print $2}&#39;</span> | sort | uniq -c | sort -r
    
    Output:
       2038 matt
        433 john
        263 ryan
        186 alice
        167 bob
   
</pre></div>

<p>This command will print an full repository listing of all files, remove the directories, run svn blame on each individual file, and tally the resulting line counts. It seems quite slow, depending on your repository location, because blame must hit the server for each individual file. You can remove the -R on the first part to print out the tallies for just the current directory.
</p>
<p>I posted this over at <a title="www.commandlinefu.com" href="http://www.commandlinefu.com">commandlinefu.com</a> as well for feedback, so check <a title="http://www.commandlinefu.com/commands/view/2787/prints-total-line-count-contribution-per-user-for-an-svn-repository" href="http://www.commandlinefu.com/commands/view/2787/prints-total-line-count-contribution-per-user-for-an-svn-repository" target="_blank">here</a> for possible helpful commentary of the command! If you haven't been to commandlinefu before, definitely check it out for some great one-liner-commands!
</p>]]></content:encoded>
    </item>
    <item>
      <title>Edit Locally, Run Remotely Via MacFUSE</title>
      <link>http://asktherelic.com/2009/07/17/edit-locally-run-remotely-via-macfuse/</link>
      <pubDate>Fri, 17 Jul 2009 13:37:02 EDT</pubDate>
      <category><![CDATA[Life]]></category>
      <guid>http://asktherelic.com/2009/07/17/edit-locally-run-remotely-via-macfuse/</guid>
      <description>Edit Locally, Run Remotely Via MacFUSE</description>
      <content:encoded><![CDATA[<p>One of the most ample things I've had this summer has been time: time to read, time to code, and time to tinker (or waste) on improving how I code. While I am occasionally guilt <a title="http://www.codinghorror.com/blog/archives/001282.html" href="http://www.codinghorror.com/blog/archives/001282.html" target="_blank">of being too 'meta,'</a> spending too much much time worrying about how I do work rather than doing work, I feel that having the idea to improve in your head is far better than stagnating. Some improvements are easy to invest in and quick to see returns of saved time, others are not. Improving how you work and trying new things is an investment than I feel is worth making.
</p>
<p>The most recent change I've done is to use MacFUSE to mount my ssh connections to remote machines as network files systems, via <a title="http://en.wikipedia.org/wiki/Sshfs" href="http://en.wikipedia.org/wiki/Sshfs">SSHFS</a>. Any machine that you have an ssh connection connection to, you can mount as a shared drive, allowing you to browse it via the Finder, copy and paste like any normal folder, and most important of all, edit files on that share using local programs. I've used SMB or FTP before, but neither has worked as smooth as this or as easily. Using this method also gives you the security of SSH.
</p>
<p>This guide will show how to install MacFUSE, then install and setup the GUI or CLI version of SSHFS, depending on your preferences. The GUI version is sweet and simple, but takes up more RAM and is not as customizable as the CLI version. This is aimed primarily for OSX 10.5 users (The GUI version is 10.5 only, CLI should be 10.4 compatible). Linux users should have most of this functionality already built-in and I have not seen much free support for any of this in Windows.
   <h3>Install MacFUSE</h3>
   The latest stable version of <a title="http://code.google.com/p/macfuse/" href="http://code.google.com/p/macfuse/">MacFUSE</a> is 2.0.3. Download and install the package. It is the base package which enables other plugins to build custom filesystems with.
</p>
<p>Download: <a title="http://macfuse.googlecode.com/files/MacFUSE-2.0.3,2.dmg" href="http://macfuse.googlecode.com/files/MacFUSE-2.0.3,2.dmg">http://macfuse.googlecode.com/files/MacFUSE-2.0.3,2.dmg</a>
</p>
<p><a href="http://thebehrensventure.com/wp-content/uploads/2009/07/macfuse_pref.png"><img class="aligncenter size-medium wp-image-518" title="macfuse_pref" src="http://thebehrensventure.com/wp-content/uploads/2009/07/macfuse_pref-449x189.png" alt="macfuse_pref" width="449" height="189" /></a>
</p>
<p>MacFUSE will be installed as a Preference Pane in your System Preferences.
   <h3>Install the GUI SSHFS</h3>
   The GUI version of SSHFS is an app called <a title="http://www.macfusionapp.org/" href="http://www.macfusionapp.org/">MacFusion</a>. Download and install their app.
</p>
<p>Download: <a title="http://www.macfusionapp.org/files/mf2_latest.zip" href="http://www.macfusionapp.org/files/mf2_latest.zip">http://www.macfusionapp.org/files/mf2_latest.zip</a>
</p>
<p>You then get a GUI with options to create new SSH or SFTP shares. Fill in your connection details and hit the "Mount" button. Your share should appear on the desktop, mounted at /Volumes/XXXX where XXXX is the share's hostname, but both the mount location and share name are customizable in the options.
</p>
<p><a href="http://thebehrensventure.com/wp-content/uploads/2009/07/macfusion_1.png"><img class="aligncenter size-medium wp-image-520" title="macfusion_1" src="http://thebehrensventure.com/wp-content/uploads/2009/07/macfusion_1-450x165.png" alt="macfusion_1" width="450" height="165" /></a>
</p>
<p>You can set MacFusion to run on login and have a menu item for easy mounting/unmounting of shares. Quite easy!
   <h3>Install the CLI SSHFS</h3>
   I first found out about the CLI version and prefer this version due to the customization it provides. Not everyone needs a command line app though. 
</p>
<p>First, checkout the code from Google Code using Subversion, following the <a title="http://code.google.com/p/macfuse/wiki/MACFUSE_FS_SSHFS" href="http://code.google.com/p/macfuse/wiki/MACFUSE_FS_SSHFS">official install instructions</a>. OSX 10.5 should have Subversion installed.
</p>
<div class="pygments_murphy"><pre>    <span class="nv">$ </span><span class="nb">cd</span> ~/Desktop
    <span class="nv">$ </span>svn co http://macfuse.googlecode.com/svn/trunk/filesystems/sshfs/binary sshfs-binaries
   
</pre></div>

<p>The binaries for 10.5 and 10.4 are the latest version of SSHFS, 2.2.0. Now you need to create a folder to mount to and then mount the shared drive!
</p>
<div class="pygments_murphy"><pre>    <span class="c"># Mounting the SSH file system</span>
    <span class="nv">$ </span>mkdir /some/mount/point <span class="c"># or use one that already exists</span>
    <span class="nv">$ </span>sshfs user@host:/some/directory /some/mount/point -oauto_cache,reconnect,volname<span class="o">=</span><span class="s2">&quot;some vol name&quot;</span>
    <span class="c">#My usual mount command</span>
    <span class="nv">$ </span>mkdir /Volumes/thebehrensventure.com
    <span class="nv">$ </span>sshfs-static-leopard askedrelic@thebehrensventure.com:/home/askedrelic <span class="se">\</span>
         /Volumes/thebehrensventure.com -oauto_cache,reconnect,volname<span class="o">=</span><span class="s2">&quot;thebehrensventure.com&quot;</span>
   
</pre></div>

<p>From here, you link the binary to your /usr/local/bin perhaps and create a script to automount the drive on login. Generally I prefer doing things via the Terminal, but that's just me.
   <h3>Working with SSHFS</h3>
   With an ssh drive mounted, you can go to that drive via the Finder and browse it graphically. Generally, I store my source code remotely on my server, edit the local copy using GVIM or TextMate and then run it remotely. I keep a remote ssh connection to the server I am editing on open, so I can run mysql commands or reboot the webserver I'm using. With port forwarding, you can effectively do all of your work on a remote server, but still have the benefits of GUI applications and their performance.
</p>
<p>One thing to watch out for is applying commands for the remote server on the local folders. SVN or GIT will generally work in the local folders because their commands are directory specific. I have heard of issues when working with a large amount of folders before, with slow response times, but that is why I would recommend to apply all commands remotely over ssh. My main usage of SSHFS is over a LAN connection with a server sitting 10 feet from me. Browsing directories via the Finder in the Icon view over a slower connection, with Finder previews turned on and other bandwidth intensive accessories, will definitely dampen performance. Try browsing in List mode if you have slow performance.
</p>
<p>Hope this helps! My next guide will detail my VIM setup, which takes advantage of these mounted ssh drives.
</p>]]></content:encoded>
    </item>
    <item>
      <title>Barcamp Rochester 4</title>
      <link>http://asktherelic.com/2009/04/17/barcamp-rochester-4/</link>
      <pubDate>Fri, 17 Apr 2009 18:29:49 EDT</pubDate>
      <category><![CDATA[Life]]></category>
      <guid>http://asktherelic.com/2009/04/17/barcamp-rochester-4/</guid>
      <description>Barcamp Rochester 4</description>
      <content:encoded><![CDATA[
Over the weekend, <a title="http://www.barcamproc.org/" href="http://www.barcamproc.org/">Barcamp Rochester</a> 4 took place here on campus at RIT. I have been helping to plan this event over the last few months and was pleased that it went off with any major problems! Around 60-80 people showed up of the course of an entire Saturday and there was a lock picking village that was open most of the day. I arranged most of the food and it seemed like my estimates were in order, I don't think anyone left hungry!

To explain a bit further, <a title="http://www.barcamp.org/" href="http://www.barcamp.org/">Barcamp</a> is a kind of informal conference, where everyone who comes, presents about a topic of their interest. Anything goes and most of the presentations are pretty informal, leading to  open discussions about some topic occasionally. I enjoy the format overall, it's flexible and focuses on sharing information in the simplest way possible.

My presentation was on <a title="http://www.openlaszlo.org/" href="http://www.openlaszlo.org/">OpenLaszlo</a> and Flex, two technologies for creating rich internet applications. I had interned at Laszlo, the company that makes OpenLaszlo, over this previous summer and got them to send me out a box of t-shirts and swag to give away also. I felt it went off pretty well and I had a handful of people who came and listened. Several other of my friends gave talks on RF signals, Python, open government, Dwarf Fortress, and a whole host of topics. Overall, it was a good event!
]]></content:encoded>
    </item>
  </channel>
</rss>
