<?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>Derek Reeve</title>
	<atom:link href="http://derekreeve.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://derekreeve.com</link>
	<description></description>
	<lastBuildDate>Thu, 22 Apr 2010 21:17:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Formatting the Rails logger</title>
		<link>http://derekreeve.com/2010/04/formatting-the-rails-logger/</link>
		<comments>http://derekreeve.com/2010/04/formatting-the-rails-logger/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 17:11:06 +0000</pubDate>
		<dc:creator>Derek Reeve</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://derekreeve.com/?p=37</guid>
		<description><![CDATA[I&#8217;ve always been somewhat annoyed that Rails 2 doesn&#8217;t have a way to specify the log formatting.  I would prefer that log messages include the logging level, for example.

Thanks to a post on Stack Overflow, I realized it&#8217;s pretty simple to override BufferedLogger.add to do what I want:

module ActiveSupport
  class BufferedLogger
   [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always been somewhat annoyed that Rails 2 doesn&#8217;t have a way to specify the log formatting.  I would prefer that log messages include the logging level, for example.</p>

<p>Thanks to a <a href="http://stackoverflow.com/questions/462651/rails-logger-format-string-configuration">post</a> on Stack Overflow, I realized it&#8217;s pretty simple to override <a href="http://api.rubyonrails.org/classes/ActiveSupport/BufferedLogger.html#M001533">BufferedLogger.add</a> to do what I want:</p>

<pre><code>module ActiveSupport
  class BufferedLogger
    def add(severity, message = nil, progname = nil, &amp;block)
      return if @level &gt; severity
      message = (message || (block &amp;&amp; block.call) || progname).to_s

      level = {
        0 =&gt; "DEBUG",
        1 =&gt; "INFO",
        2 =&gt; "WARN",
        3 =&gt; "ERROR",
        4 =&gt; "FATAL"
      }[severity] || "U"

      message = "[%s] %-6s%s" % [Time.now.strftime("%Y-%m-%d %H:%M:%S"), level,
                                 message]

      message = "#{message}\n" unless message[-1] == ?\n
      buffer &lt;&lt; message
      auto_flush
      message
    end
  end
end
</code></pre>

<p>Adding this to <code>environment.rb</code> will cause the logger to print log messages in the format</p>

<pre><code>[2010-04-13 11:55:20] DEBUG monkeys
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://derekreeve.com/2010/04/formatting-the-rails-logger/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shared command history with zsh</title>
		<link>http://derekreeve.com/2010/01/shared-command-history-with-zsh/</link>
		<comments>http://derekreeve.com/2010/01/shared-command-history-with-zsh/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 03:57:43 +0000</pubDate>
		<dc:creator>Derek Reeve</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[zsh]]></category>

		<guid isPermaLink="false">http://derekreeve.com/?p=23</guid>
		<description><![CDATA[In addition to intelligent word boundaries, another neat feature I came across with zsh was shared command history. This can be useful if, for example, you use GNU Screen and often open new shells but don&#8217;t want to lose your previous command history.

This is as simple as adding


setopt share_history
HISTSIZE=1000
SAVEHIST=1000
HISTFILE=~/.history
setopt APPEND_HISTORY


to your ~/.zshrc.  Running a [...]]]></description>
			<content:encoded><![CDATA[<p>In addition to intelligent word boundaries, another neat feature I came across with <a href="http://www.zsh.org">zsh</a> was shared command history. This can be useful if, for example, you use GNU Screen and often open new shells but don&#8217;t want to lose your previous command history.</p>

<p>This is as simple as adding</p>

<p><code>
setopt share_history<br />
HISTSIZE=1000<br />
SAVEHIST=1000<br />
HISTFILE=~/.history<br />
setopt APPEND_HISTORY<br />
</code></p>

<p>to your <code>~/.zshrc</code>.  Running a new shell should automatically start with the history from the shell you were previously using!</p>

<p>Update: Wordpress crammed some of the options together, so I fixed it.</p>
]]></content:encoded>
			<wfw:commentRss>http://derekreeve.com/2010/01/shared-command-history-with-zsh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Intelligent word boundaries in zsh</title>
		<link>http://derekreeve.com/2009/12/intelligent-word-boundaries-in-zsh/</link>
		<comments>http://derekreeve.com/2009/12/intelligent-word-boundaries-in-zsh/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 04:10:56 +0000</pubDate>
		<dc:creator>Derek Reeve</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[zsh]]></category>

		<guid isPermaLink="false">http://derekreeve.com/?p=4</guid>
		<description><![CDATA[A couple years ago, after several years of constant shell usage, I found myself wanting a more efficient way to move backward through paths.  As I work from the shell, I undoubtedly end up working with a long path, a portion of which I need to use more than once. Take, for example, a Ruby [...]]]></description>
			<content:encoded><![CDATA[<p>A couple years ago, after several years of constant shell usage, I found myself wanting a more efficient way to move backward through paths.  As I work from the shell, I undoubtedly end up working with a long path, a portion of which I need to use more than once. Take, for example, a Ruby on Rails project:</p>

<p><code>dreeve@puggle ~/projects/  $ ls cdreaper2/app/views/layouts</code></p>

<p>To run <code>ls</code> on another directory (<code>cdreaper2/app/controllers</code>, for example)  you would normally have to backspace all the way to the shared parent directory.  This is cumbersome for me: I hate holding down the backspace key.  <code>bash</code> helps alleviate the overuse of the backspace key by allowing the user to use <code>ctrl+w</code> to clear entire words. However, it isn&#8217;t easy to configure the <code>bash</code> shell to clear words up to a forward slash.</p>

<p>So, I started using <a href="http://www.zsh.org">zsh</a> instead. Since it&#8217;s already installed in OS X, you can set your user&#8217;s shell to <code>zsh</code> quite easily via the Accounts interface.</p>

<p>Adding</p>

<p><code>local WORDCHARS=${WORDCHARS//\//}</code></p>

<p>to your <code>.zshrc</code> file (found or created in your home directory) will tell <code>zsh</code> to use forward slash as a boundary character.</p>

<p>Then, when you have to move backward through a path, <code>ctrl+w</code> will remove the rightmost part of the path. Given the path we started with:</p>

<p><code>dreeve@puggle ~/projects  $ ls cdreaper2/app/views/layouts |</code></p>

<p>Hitting <code>ctrl+w</code> twice will give you:</p>

<p><code>dreeve@puggle ~/projects  $ ls cdreaper2/app/ |</code></p>

<p>making moving between directories in a heavily-nested projected easy.</p>
]]></content:encoded>
			<wfw:commentRss>http://derekreeve.com/2009/12/intelligent-word-boundaries-in-zsh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
