<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>@Lathi.net</title>
    <link>http://blog.lathi.net</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>On Life, Fatherhood, Christianity, and Computers</description>
    <item>
      <title>Simple Expense Tracking with Google Docs</title>
      <description>&lt;p&gt;As my family prepares for our pending Disney trip, I&amp;#8217;m thinking about clever ways to take advantage of my wife&amp;#8217;s iPhone.  One of the things we&amp;#8217;ve done is budget the trip based on a few simple categories of expenses.  There&amp;#8217;s a lot of ways to track expenses to budgets, but I&amp;#8217;m particularly happy with how this worked out using Google Documents and the iPhone.&lt;/p&gt;


	&lt;p&gt;The kicker is that Google Docs are only viewable from the iPhone.  My initial hopes of editing a spreadsheet directly from the phone were quashed rudely in a live demo with the wife.  Plan B is to use Google Doc&amp;#8217;s forms to add individual expenses.  This is really a better solution as it&amp;#8217;s much easier for my wife to fill out three text fields than to worry about editing a spreadsheet in the right cells.&lt;/p&gt;


	&lt;p&gt;So the expense sheet of the document is simply the form entries: description, amount, and type.  I added help text that listed the valid values I was looking for: food, gas, tickets, junk.&lt;/p&gt;


	&lt;p&gt;The budget sheet has four rows; one for each budget type.  One column has the budgeted amount, and another uses &amp;#8220;SUMIF&amp;#8221; to sum up all the expense entries if the type matches the budget category.  I can then subtract these two to get how much of our budgeted money remains in that category.&lt;/p&gt;


	&lt;p&gt;I bookmarked the form url on the iPhone for my wife and she can fill it out repeatedly.  I also bookmarked the actual spreadsheet.  It&amp;#8217;s unfortunate that the Google Doc forms don&amp;#8217;t let you specify a &amp;#8220;thank you&amp;#8221; url instead of a thank you message.  Anyway, I bookmarked the actual Google Document so we can check the budget remaining easily while out and about.  It seems that the iPhone has some trouble changing sheets while viewing Google Documents, so I made the budget sheet the first and default page.&lt;/p&gt;


	&lt;p&gt;All in all it&amp;#8217;s very simple and has a high wife approval factor.  Plus, the whole thing took me less than 30 minutes to setup including several &amp;#8220;customer approval testing&amp;#8221; iterations.  Spreadsheets with Google Docs are really fun.  Adding in these forms is almost like rapid prototyping custom web apps.&lt;/p&gt;</description>
      <pubDate>Mon, 28 Apr 2008 12:57:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:9f82cce2-70ca-495d-86aa-10c501ab478b</guid>
      <author>Doug</author>
      <link>http://blog.lathi.net/articles/2008/04/28/simple-expense-tracking-with-google-docs</link>
      <category>iPhone</category>
      <category>Google</category>
      <category>budget</category>
      <category>finances</category>
      <category>Disney</category>
      <category>vacation</category>
      <category>expenses</category>
    </item>
    <item>
      <title>Dynamic Constants and their Pitfalls</title>
      <description>&lt;p&gt;I&amp;#8217;ve just fixed a bug in production that took me more than eight hours to find.  When I show you the code, you&amp;#8217;ll wonder why it took me so long.  I have lots of excuses, but it&amp;#8217;s a fairly interesting bug to think about.  It shows some of the weaknesses in my usual modus operandi.  The code that looks something like this:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;class Article
  CURRENT=&amp;quot;start_publish_on &amp;lt;= #{Date.today} AND stop_publish_on &amp;gt; #{Date.today}&amp;quot;

  def self.find_latest
    find(:all, :conditions =&amp;gt; CURRENT)
  end
end&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;In retrospect the bug is obvious and probably is obvious to you as well.  The Article::CURRENT constant is dynamically generated using the date at the time the class is evaluated.  With rails in production mode, that could be a long time; certainly more than a day.  The conclusion to draw here is to be very, very careful about dynamically generating constant strings.  As a rule, I might suggest not doing it.&lt;/p&gt;


	&lt;p&gt;The most interesting thing about this is you can&amp;#8217;t write a test to catch this error.  I think that&amp;#8217;s the the biggest thing that took me so long to find the error.  I tend to be over confident in our test suite.  As the new guy to the project, I&amp;#8217;m proud of them for how conscientious they are about testing their code.  I&amp;#8217;m trying to fix this bug by triggering it in a test.  Well, it can&amp;#8217;t be done.  The difference is how the production environment cache classes versus how testing and development does it.&lt;/p&gt;


	&lt;p&gt;Here&amp;#8217;s another tidbit that threw me off the trail for a long time.  Our copy editor that is responsible for publishing articles says to fix it she simply back dates the articles by a day.  So I spent a lot of time looking for off-by-one errors.  I had recently fixed a problem with comparing times to dates and causing off-by-one, so I thought that might be it.  As it turns out, this was a red herring.  There&amp;#8217;s such a tight loop for feature request, implement, deploy that the production environment gets restarted fairly regularly (like nearly every day).&lt;/p&gt;


	&lt;p&gt;I guess what prompted me to write about this particular bug was what it said about our testing.  Clearly automated testing can&amp;#8217;t find all the bugs.  It also says something about our rapid development.  As long as we&amp;#8217;re really busy, this bug didn&amp;#8217;t bite us.  It&amp;#8217;s not until our deployment slows down (like a weekend) that it showed up.&lt;/p&gt;</description>
      <pubDate>Tue, 05 Feb 2008 15:35:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:d67c52df-4bbb-44f6-b6ec-f0bb1ca407b2</guid>
      <author>Doug</author>
      <link>http://blog.lathi.net/articles/2008/02/05/dynamic-constants-and-their-pitfalls</link>
      <category>Programming</category>
      <category>Ruby on Rails</category>
    </item>
    <item>
      <title>My First Day of Freedom</title>
      <description>&lt;p&gt;Friday was my last day at the company that won&amp;#8217;t let me blog about them.  I am very excited to be 100% independent freelancing!  This has been a goal of mine for many years and it&amp;#8217;s finally come true.&lt;/p&gt;


	&lt;p&gt;This morning &lt;a href="http://railsstudio.com/"&gt;Mark Windholtz&lt;/a&gt; is coming over to pair with me on a contract we share.  It&amp;#8217;s his good for not making me commute on my first day of independence.  I&amp;#8217;m looking forward to working with him and several other independent developers.&lt;/p&gt;


	&lt;p&gt;Hopefully now that I&amp;#8217;m not under corporate thumbs I&amp;#8217;ll be able to blog more about the types of problems I&amp;#8217;m seeing and methods for overcoming.  I&amp;#8217;ve specifically been asked to write an article on my experiences working remotely on a Scrum project.&lt;/p&gt;


	&lt;p&gt;In addition to writing more, I&amp;#8217;m also hoping to be able to contribute back to the open source community.  It&amp;#8217;s tricky when your family depends on your billable hours to also give your work away.  However, I think it&amp;#8217;s good balance to work on things my clients require as well as things I&amp;#8217;m interested in.  At first, this is likely to be helping &lt;a href="http://technomancy.us/"&gt;Phil Hagelberg&lt;/a&gt; shape up Emacs for ruby development.&lt;/p&gt;


	&lt;p&gt;So, there you go.  I&amp;#8217;m going to be working with some good guys; doing more writing; and working on more open source.  Wish me luck!&lt;/p&gt;</description>
      <pubDate>Mon, 21 Jan 2008 07:49:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:d00b9c36-9e06-403f-aafd-5c7528d1483c</guid>
      <author>Doug</author>
      <link>http://blog.lathi.net/articles/2008/01/21/my-first-day-of-freedom</link>
      <category>family</category>
      <category>consulting</category>
      <category>emacs</category>
      <category>Ruby</category>
      <category>Rails</category>
    </item>
    <item>
      <title>Small Victories in Customer Service</title>
      <description>&lt;p&gt;I bought my wife a &lt;span class="caps"&gt;GPS&lt;/span&gt; from Amazon as an early Christmas present before Thanksgiving.  I guess I was a little too eager because I ended up paying too much for it.  Just a couple weeks later, Amazon advertised to me in one of their &amp;#8220;may we suggest&amp;#8221; ads the very same &lt;span class="caps"&gt;GPS&lt;/span&gt; for a lot less money.  In the end, they refunded me the difference in price; but I can&amp;#8217;t help but feel a little miffed by the whole experience.&lt;/p&gt;


	&lt;p&gt;Let me start by saying trying to sell me the exact same device I&amp;#8217;ve already bought from them at a lower price in a targeted ad is pretty stupid.  They know everything I&amp;#8217;ve bought.  In fact, the ad said something like &amp;#8220;we know you&amp;#8217;ve looked at these &lt;span class="caps"&gt;GPS&lt;/span&gt;&amp;#8217;, may we suggest this other one?&amp;#8221;  Why would they advertise to me something I&amp;#8217;ve already bought.  And why advertise it to me if you know I paid more for the same device?  We in the web development world who control how these ads get generated need to do better than that.&lt;/p&gt;


	&lt;p&gt;I couldn&amp;#8217;t let them rub this price drop in my face, so I called up customer service.  The &lt;span class="caps"&gt;CSR&lt;/span&gt; was unsympathetic to my plight.  Nothing I said phased her.  I was nice and undemanding.  I pointed out that I was within my return window and I could just return the device for a refund and then go buy it somewhere else.  It all was a no go.  There was no getting a refund from her.&lt;/p&gt;


	&lt;p&gt;So I pulled the standard &amp;#8220;let me talk to your manager&amp;#8221; trick.  She made me wait on hold for what seemed like five to 10 minutes.  When the supervisor came on the phone she quickly summarized what she thought my concern was and then just as quickly told me she&amp;#8217;d refund me the difference between what I paid and the new price.&lt;/p&gt;


	&lt;p&gt;One the surface, I&amp;#8217;m pleased.  I paid way too much for the &lt;span class="caps"&gt;GPS&lt;/span&gt; and I&amp;#8217;m glad I didn&amp;#8217;t loose out.  Money&amp;#8217;s tight this time of year and every little bit helps.  Also, it didn&amp;#8217;t cost me too much effort to get the refund.  All told probably 30 minutes.  The refund as an hourly wage is pretty good.&lt;/p&gt;


	&lt;p&gt;On the other hand, I&amp;#8217;m frustrated by the way they handled me.  First, as I said above, why even advertise the price drop to me?  It&amp;#8217;s true I was already aware other places (like Wal-Mart) had it cheaper.  But the ad was definitely insult to injury.  Second, and this is the real kicker, why didn&amp;#8217;t the original &lt;span class="caps"&gt;CSR&lt;/span&gt; handle my concern?  Why did she resist so hard to giving me a refund when her supervisor just came on the phone and gave it to me without me having to even ask?&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;m trying to think what lesson I can learn about this in dealing with people.  I wonder if the original &lt;span class="caps"&gt;CSR&lt;/span&gt; knew her manager was going to give me what I wanted?  It seems like there&amp;#8217;s times when people have wanted things from me that I knew I&amp;#8217;d eventually give them.  For some reason though I can recall making them &amp;#8220;work for it&amp;#8221;.  Maybe such a delayed &amp;#8220;giving in&amp;#8221; has some value, but on the receiving end I&amp;#8217;m not so sure.  I think this no-then-yes tactic really just comes across as being difficult to work with.&lt;/p&gt;


	&lt;p&gt;I think the lesson to walk away from here is that when someone asks for something really think about it before you say &amp;#8220;no&amp;#8221;.  Are you saying &amp;#8220;no&amp;#8221; just because you hope they&amp;#8217;ll go away but you know the right thing to do is say &amp;#8220;yes&amp;#8221;?  There are definitely times to say &amp;#8220;no&amp;#8221; just as there are definitely times to say &amp;#8220;yes&amp;#8221;.  I guess what I&amp;#8217;m trying to come up with is don&amp;#8217;t play games with your yeses and noes.  Shoot straight.  Let your &amp;#8220;yes&amp;#8221; be yes and your &amp;#8220;no&amp;#8221; be no.&lt;/p&gt;


	&lt;p&gt;Oh, and the other lesson to walk away from here is don&amp;#8217;t give in so easily when talking to customer service.&lt;/p&gt;</description>
      <pubDate>Sat, 01 Dec 2007 11:20:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:2f3575d6-9255-40bd-81bb-f081adadeae2</guid>
      <author>Doug</author>
      <link>http://blog.lathi.net/articles/2007/12/01/small-victories-in-customer-service</link>
      <category>amazon</category>
      <category>customer</category>
      <category>service</category>
      <category>kindness</category>
      <category>honesty</category>
      <category>refund</category>
    </item>
    <item>
      <title>Jumping to Specific Windows in Emacs</title>
      <description>&lt;p&gt;OK, last emacs tip for a while.  It&amp;#8217;s ironic, but the last two years I&amp;#8217;ve written some cool elisp while at RubyConf.  I typically run emacs full screen and split buffers both vertically and horizontally to arrange bits of code.  It&amp;#8217;s not uncommon for me to end up with three, four, five or even six visible windows in emacs.  The problem though is navigating between them.&lt;/p&gt;


	&lt;p&gt;The out-of-the-box solution is to use &lt;code&gt;other-window&lt;/code&gt; (bound to C-x o) and just cycle through them.  If you&amp;#8217;re fancy you can give a prefix argument to &lt;code&gt;other-window&lt;/code&gt; and go backwards.  This window cycling is tedious to me though and I&amp;#8217;d like something faster.  Particularly when I&amp;#8217;m mostly bouncing back and forth between two windows.&lt;/p&gt;


	&lt;p&gt;To solve this problem I wrote &lt;code&gt;jump-to-buffer&lt;/code&gt;.  Of course, right now I&amp;#8217;m really enamored with the fuzzy matching in &lt;code&gt;ido-completing-read&lt;/code&gt;.  That&amp;#8217;s what allows you to type non-sequential characters to match the buffer name.  It&amp;#8217;s very similar to TextMate&amp;#8217;s pattern matching.  So, &lt;code&gt;jump-to-buffer&lt;/code&gt; uses &lt;code&gt;ido-completing-read&lt;/code&gt;.  The buffers it gives you as options for completion are only the buffers in visible windows.  It also sorts those buffers in the order of the &lt;code&gt;buffer-list&lt;/code&gt;; which is in the order of most recently accessed.&lt;/p&gt;


	&lt;p&gt;To make this work, I&amp;#8217;ve written two helper functions: &lt;code&gt;rotate-list&lt;/code&gt;, and &lt;code&gt;sort-by-other-list&lt;/code&gt;.  Without further ado:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;(defun dka-sort-by-other-list (to-sort-list other-list)
  (let* ((index 0)
         (other-alist (mapcar (lambda (buffer) 
                                (setq index (+ index 1))
                                (cons buffer index))
                              other-list))
         (swartz (mapcar (lambda (item) 
                           (cons (cdr (assoc item other-alist)) item))
                         to-sort-list))
         (sorted-list (sort swartz (lambda (a b) (&amp;lt; (car a) (car b))))))
    (mapcar 'cdr sorted-list)))

(defun rotate-list (list count)
  &amp;quot;Rotate the LIST by COUNT elements&amp;quot;
  (cond
   ((= count 0) list)
   ((not list) list)
   (t
    (rotate-list (nconc  (cdr list) (list (car list)) '()) (1- count)))))

(defun dka-jump-to-window ()
  &amp;quot;Interactively jump to another visible window based on it's `buffer-name' using `ido-completing-read'&amp;quot;
  (interactive)
  (let* ((visible-buffers (mapcar '(lambda (window) (window-buffer window)) (window-list)))
         (sorted-visible-buffers (dka-sort-by-other-list visible-buffers (buffer-list)))
         (rotated-buffer-list (rotate-list sorted-visible-buffers 1))
         (visible-buffer-names (mapcar (lambda (buffer) (buffer-name buffer)) rotated-buffer-list))
         (buffer-name (ido-completing-read &amp;quot;Enter buffer to jump to: &amp;quot; 
                                           visible-buffer-names
                                           nil t))
         (window-of-buffer
          (delq nil 
                (mapcar '(lambda (window) 
                           (if (equal buffer-name (buffer-name (window-buffer window)))
        window nil)) (window-list)))))
    (select-window (car window-of-buffer)))
)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;I&amp;#8217;m definitely interested in feedback on this code.  The &lt;code&gt;dka-sort-list-by-other-list&lt;/code&gt; method was particularly tricky for me to write.  I think it&amp;#8217;s both right and fast.  I haven&amp;#8217;t dove into &lt;a href="http://www.emacswiki.org/cgi-bin/wiki/ElUnit"&gt;elunit&lt;/a&gt; yet to know for sure if it&amp;#8217;s right.&lt;/p&gt;</description>
      <pubDate>Wed, 07 Nov 2007 20:58:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:d67cf0f1-66d6-4070-8fab-f497f3942676</guid>
      <author>Doug</author>
      <link>http://blog.lathi.net/articles/2007/11/07/jumping-to-specific-windows-in-emacs</link>
      <category>Emacs</category>
      <category>Programming</category>
      <category>elisp</category>
      <category>elunit</category>
      <category>transform</category>
      <category>schwartz</category>
      <category>sorting</category>
      <category>emacs</category>
    </item>
    <item>
      <title>Sharing the Mac Clipboard with Emacs</title>
      <description>&lt;p&gt;While I&amp;#8217;m sharing emacs hacks, I finally got around to researching this and/or figuring it out.  I almost always run emacs inside the terminal in a &amp;#8220;no window&amp;#8221; mode.  It&amp;#8217;s pretty natural for me to use M-w to copy something from emacs and then try to Cmd-V it in another Terminal window or likewise Cmd-C something in Terminal and then try paste it into emacs with C-y.  Until now, I haven&amp;#8217;t known how to share the clipboard with emacs.&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;(defun copy-from-osx ()
  (shell-command-to-string &amp;quot;pbpaste&amp;quot;))

(defun paste-to-osx (text &amp;amp;optional push)
  (let ((process-connection-type nil)) 
      (let ((proc (start-process &amp;quot;pbcopy&amp;quot; &amp;quot;*Messages*&amp;quot; &amp;quot;pbcopy&amp;quot;)))
        (process-send-string proc text)
        (process-send-eof proc))))

(setq interprogram-cut-function 'paste-to-osx)
(setq interprogram-paste-function 'copy-from-osx)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;This takes advantage of the &lt;code&gt;pbcopy&lt;/code&gt; and &lt;code&gt;pbpaste&lt;/code&gt; command line programs to access the clipboard and offers them up as elisp method for emacs&amp;#8217; &lt;code&gt;interprogram-*-functions&lt;/code&gt;.  Easy, peasy, pumkin weasy.&lt;/p&gt;


	&lt;p&gt;I need to give some props to Mark Aufflick for his post on &lt;a href="http://mark.aufflick.com/blog/2006/10/30/automatic-copy-from-x11-app-to-macos-clipboard"&gt;Automatic Copy from &lt;span class="caps"&gt;X11&lt;/span&gt; App to Mac OS Clipboard&lt;/a&gt;.  My &lt;code&gt;paste-to-osx&lt;/code&gt; is pretty much a straight rip from him.&lt;/p&gt;</description>
      <pubDate>Wed, 07 Nov 2007 20:09:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:d76e1e03-86bc-423e-95ce-eca0874b9166</guid>
      <author>Doug</author>
      <link>http://blog.lathi.net/articles/2007/11/07/sharing-the-mac-clipboard-with-emacs</link>
      <category>Emacs</category>
      <category>Mac OS X</category>
      <category>pbcopy</category>
      <category>pbpaste</category>
      <category>mac</category>
      <category>clipboard</category>
      <category>emacs</category>
    </item>
    <item>
      <title>Navigating Your Projects in Emacs</title>
      <description>&lt;p&gt;One of the things that&amp;#8217;s really nice about TextMate is the Cmd-T navigation of files in your project.  It pops up this little dialog with fancy pattern matching input to select one of the files in your project and then jumps to that file.  There&amp;#8217;s a similar command once your in a file to jump to symbols in that file.  I&amp;#8217;ve tried a couple things to achieve that behavior in emacs that I&amp;#8217;d like to talk about.&lt;/p&gt;


	&lt;p&gt;The first thing I tried was a method called &lt;code&gt;find-file-in-project&lt;/code&gt;.  It was originally implemented by &lt;a href="http://technomancy.us/"&gt;Phil Hagelberg&lt;/a&gt; as part of his &amp;#8220;Another Ruby on Rails Mode&amp;#8221; (arorem) and then also ported over to the current &lt;a href="http://rinari.rubyforge.org/"&gt;Rinari Is Not a Rails &lt;span class="caps"&gt;IDE&lt;/span&gt;&lt;/a&gt;.  Basically, it indexes all the files in a &amp;#8220;project&amp;#8221; and then provides a nice interactive completing read to switch between them.  It basically works just like Cmd-T in TextMat.  I did quite a bit of work optimizing the completing read so that it would behave nicely.  The problem is that emacs is slow to index the files in your project.&lt;/p&gt;


	&lt;p&gt;What I&amp;#8217;m using now is the tried and true &lt;code&gt;find-tag&lt;/code&gt; method which is part of &lt;code&gt;etags.el&lt;/code&gt;.  ETags depends on an external &lt;code&gt;TAGS&lt;/code&gt; file as an index of all the symbols in your project.  When you invoke &lt;code&gt;find-tag&lt;/code&gt; (by default bound to M-.) it prompts you with completing read for the symbol to find.  It then jumps directly to the file and location where that symbol is defined.  It&amp;#8217;s basically combining the find-file-in-project with find-symbol-in-buffer.  It&amp;#8217;s also very, very fast.&lt;/p&gt;


	&lt;p&gt;As an added bonus, you can use &lt;code&gt;tags-search&lt;/code&gt; to search through your project finding places that tag is used.  This is similar to TextMate&amp;#8217;s slowly grep all the files and render a buffer with those results in it, but much faster.&lt;/p&gt;


	&lt;p&gt;The bad news is you have to manually build the &lt;code&gt;TAGS&lt;/code&gt; file periodically.  Emacs is pretty good about continuing to work when you&amp;#8217;ve made modifications to the files, but if you add new methods, new files, or refactor significantly where thing are located then it gets confused.  When that happens, simply rebuild the &lt;code&gt;TAGS&lt;/code&gt; file.&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://onestepback.org/"&gt;Jim Weirich&lt;/a&gt; gave me a nice little rake task to do the job:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;module Tags
  RUBY_FILES = FileList['**/*.rb'].exclude(&amp;quot;pkg&amp;quot;)
end

namespace &amp;quot;tags&amp;quot; do
  task :emacs =&amp;gt; Tags::RUBY_FILES do
    puts &amp;quot;Making Emacs TAGS file&amp;quot;
    sh &amp;quot;xctags -e #{Tags::RUBY_FILES}&amp;quot;, :verbose =&amp;gt; false
  end
end

task :tags =&amp;gt; [&amp;quot;tags:emacs&amp;quot;]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Just put that in &lt;code&gt;lib/tasks/tags.rake&lt;/code&gt; and then run &lt;code&gt;rake tags:emacs&lt;/code&gt; when you invoke &lt;code&gt;find-tag&lt;/code&gt; and it can&amp;#8217;t find it.  That shouldn&amp;#8217;t happen very often.  I&amp;#8217;ve found it&amp;#8217;s also very fast to build the &lt;code&gt;TAGS&lt;/code&gt; file.  I might consider putting that tags task as part of the normal run tests task, but I&amp;#8217;m not sure that&amp;#8217;s necessary.&lt;/p&gt;


	&lt;p&gt;The other catch here is that the rake task above calls out the &lt;a href="http://ctags.sourceforge.net/"&gt;exuberant ctags&lt;/a&gt; rather than the ctags that comes with emacs.  The exuberant ctags knows how to parse ruby files whereas the ctags that comes with emacs can&amp;#8217;t.&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;ve installed exuberant ctags from MacPorts.  It is xctags even though MacPorts doesn&amp;#8217;t install it that way.  So (for better or worse) I&amp;#8217;ve renamed the ctags files installed with ports to xctags.  This also gets around the conflict that MacPorts thinks there is between the ctags installed with emacs and the exuberant ctags.&lt;/p&gt;


	&lt;p&gt;Give this a spin and let me know what you think.  I&amp;#8217;ve found it to be very accurate and very fast.&lt;/p&gt;</description>
      <pubDate>Wed, 07 Nov 2007 10:04:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:75998427-5d70-4875-a222-b755d83f4b9a</guid>
      <author>Doug</author>
      <link>http://blog.lathi.net/articles/2007/11/07/navigating-your-projects-in-emacs</link>
      <category>Emacs</category>
      <category>Programming</category>
      <category>Lisp</category>
      <category>Ruby on Rails</category>
      <category>Mac OS X</category>
      <category>etags</category>
      <category>xctags</category>
      <category>rinari</category>
      <category>emacs</category>
      <category>Ruby</category>
      <category>TextMate</category>
    </item>
    <item>
      <title>Remote Pair Programming</title>
      <description>&lt;p&gt;I mentioned in my post the other day about remote pair programming and someone called me out on it via email.  Since I spend probably between 40 &amp;#8211; 60% of my work time remote pair programming I thought I&amp;#8217;d give some of my experiences.&lt;/p&gt;


	&lt;p&gt;First, some background.  I&amp;#8217;ve been moonlighting as a freelance web developer for a lot of years.  I work with David Minor at &lt;a href="http://sus4.net"&gt;Sus 4&lt;/a&gt;.  He and I have done remote pair programming on almost all of our projects for the last four years.  I also telecommute for my day job into &lt;a href="http://corporatetool.blogspot.com/"&gt;&lt;em&gt;blah blah blah (lawyers made me change this)&lt;/em&gt;&lt;/a&gt;.  I travel to the headquarters in VA once a month or so, but work from home the other three or four weeks.  Probably half to three-quarters of my programming tasks at &lt;em&gt;blah blah blah (lawyers made me change this)&lt;/em&gt; I pair with another developer.  There are several different people that I&amp;#8217;ve paired with regularly over the almost two years I&amp;#8217;ve been there.  Finally, I&amp;#8217;ve talked a lot about remote pair programming at the &lt;a href="http://agileroundtable.org/"&gt;Cincinnati Agile Round Table&lt;/a&gt;.  From their &lt;a href="http://onestepback.org/"&gt;Jim Weirich&lt;/a&gt; has picked up on my techniques while doing remote pairing at &lt;a href="http://www.theedgecase.com"&gt;Edge Case&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;What I&amp;#8217;m trying to say here is that I have done a lot of remote pair programming over the years and I&amp;#8217;ve tried a lot of different techniques.  What I&amp;#8217;m about to describe here is tried, tested, and proved.&lt;/p&gt;


	&lt;p&gt;Being on a Mac, I have paid licenses of both TextMate and SubethaEdit.  They are both fine editors.  I think I prefer TextMat over Subetha simply because I think TM handles projects better.  However, I do think Subetha&amp;#8217;s networking and multi-user support is really cool.  The problem is with Rails projects I always end up with lots and lots of files open.  Subetha doesn&amp;#8217;t make it easy enough to share the files by default or for the remote guy to join their shared files by default.  Plus, with &lt;span class="caps"&gt;TDD&lt;/span&gt; you have to have some way for both partners to see the test output.&lt;/p&gt;


	&lt;p&gt;While talking about things that don&amp;#8217;t work&amp;#8230; there&amp;#8217;s just not enough bandwidth for &lt;span class="caps"&gt;VNC&lt;/span&gt;.  I&amp;#8217;ve done all I know to do to optimize it: drop the number of colors, change backgrounds to solid colors, muck with compression algorithms.  I just can&amp;#8217;t quite squeeze enough bandwidth out so that it feels interactive for both people.&lt;/p&gt;


	&lt;p&gt;So what does work?  Welcome to the past.  What I&amp;#8217;ve found is that &lt;a href="http://www.gnu.org/software/screen/"&gt;gnu screen&lt;/a&gt; running inside a terminal is the most bandwidth efficient, highly interactive, flexible multi-user environment.  One person hosts, the other connects via ssh and joins the hosts screen session.  For those who&amp;#8217;ve never used screen, both users connected see exactly the same thing.  Both users keyboards have simultaneous control of the terminal.  Combine this with a good voice/video channel with Skype or iChat and it&amp;#8217;s nearly as good as actually sitting next to someone.&lt;/p&gt;


	&lt;p&gt;Inside of screen you can have multiple tabs/windows.  What I typically do is designate my first window to run emacs.  This is my &amp;#8220;IDE&amp;#8221;.  We do all text editing from inside there.  I have another window designated for running tests (although sometimes I run tests from inside emacs).  I have another window designated for the mysql prompt.  Another is for tailing log files and another for running the server.  Screen saves the history (I typically set it to something ridiculously large).  Both people can see when you scroll through the buffer history.  Both people can see all the data.&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;ve kinda glossed over the use of emacs here.  I&amp;#8217;ve also done remote pairing with vi (well, vim anyway).  The point is that it helps a great deal if you&amp;#8217;re using an editor that both people understand.  I pair with a guy at work that only begrudgingly uses emacs.  It&amp;#8217;s not nearly as much fun for him.  I&amp;#8217;ve also paired with folks who aren&amp;#8217;t comfortable with any terminal based editor.  That&amp;#8217;s no fun either.&lt;/p&gt;


	&lt;p&gt;Like pair programming when you&amp;#8217;re actually together, there are a number of things to consider.  Editor environments is one of them.  Remote pair programming seems to heighten or exacerbate all the issues with local pair programming.  Your communication issues are bigger.  You really have to make a point to tell each other what you&amp;#8217;re doing.  Talk, talk, talk!  A definite anti-pattern is one of the people in the pair going off to work on solutions locally on their own computer while the other person can&amp;#8217;t see what&amp;#8217;s going on.  Do all work in the screen session.  Make sure that both people can see everything that&amp;#8217;s going on.  Related to this, it&amp;#8217;s hard for one person to &amp;#8220;see&amp;#8221; when the other is distracted.  If one person is checking email while the other is trying to stay on task that&amp;#8217;s no good.&lt;/p&gt;


	&lt;p&gt;The good news is that remote pair programming can work.  I find actually pair programming in person to be very fulfilling, fun, and exciting.  Remote pair programming isn&amp;#8217;t as good as actually being together in the same room.  However, it&amp;#8217;s a very good substitute when the commute cost are high.  If you&amp;#8217;re the kind of person that doesn&amp;#8217;t really dig pair programming in general, odds are you&amp;#8217;ll find remote pair programming to be even less attractive than actual pairing.&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;ll also mention I know one guy (whom I respect a lot) who&amp;#8217;s big on pair programming, but just can&amp;#8217;t get in the groove of remote pair programming.  I suspect his problem is lack of familiarity with the editor, but there may be other philosophical issues as well.&lt;/p&gt;


	&lt;p&gt;All that said, I don&amp;#8217;t find running emacs inside a screen to be some &amp;#8220;least common denominator&amp;#8221;.  In fact, I do all of my development this way&amp;#8212;even when I&amp;#8217;m not pairing.  Lately I&amp;#8217;ve been running multiple screen sessions on my box; one for each project I&amp;#8217;ve got going.  My &amp;#8220;state&amp;#8221; is always right where I left off.  When I switch from independent work to pairing, it&amp;#8217;s easy for someone to simply join my screen and we can get started.   I&amp;#8217;ll stop here and not get too carried away with singing emacs&amp;#8217; praises.  That&amp;#8217;ll be good info for another post&amp;#8230;&lt;/p&gt;


	&lt;p&gt;Before I close out, it occurs to me that screen can be pretty ugly with zero config.  I&amp;#8217;ll go ahead an post my hard status config.  This dresses things up quite a bit and makes it a lot easier to use.  Put these lines in &lt;code&gt;~/.screenrc&lt;/code&gt;:&lt;/p&gt;


&lt;pre&gt;
hardstatus on
hardstatus alwayslastline
hardstatus string "%{rk}%H %{gk}%c %{yk}%M%d %{wk}%?%-Lw%?%{bw}%n*%f%t%?(%u)%?%{wk}%?%+Lw%?" 
&lt;/pre&gt;</description>
      <pubDate>Tue, 09 Oct 2007 08:47:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:68bf14f8-b86e-4c4c-86c0-fdf6c158a2f9</guid>
      <author>Doug</author>
      <link>http://blog.lathi.net/articles/2007/10/09/remote-pair-programming</link>
      <category>Emacs</category>
      <category>Programming</category>
      <category>Commute</category>
      <category>Test Driven Development</category>
      <category>Internet</category>
      <category>Community</category>
      <category>tdd</category>
      <category>agile</category>
      <category>telecommute</category>
      <category>emacs</category>
      <category>programming</category>
      <category>pair</category>
      <category>screen</category>
    </item>
    <item>
      <title>Resizing Your Terminal</title>
      <description>&lt;p&gt;I thought I&amp;#8217;d go ahead and publish this because I found it useful (if ugly).  I do a lot of remote pair programming where my partner and I share a multi-user screen session inside a terminal.  It&amp;#8217;s very important that both partners have the same number of columns and rows visible.  Otherwise, whoever is smaller isn&amp;#8217;t going to see everything the other person sees and stuff jumps around and it&amp;#8217;s generally annoying.&lt;/p&gt;


	&lt;p&gt;So, the first thing that happens when you start a remote pairing session is you negotiate screen size.  I have my Apple Terminal.app set to show the screen size in the title bar as something like 105&amp;#215;54 or 94&amp;#215;71 or whatever.  So when my partner says, &amp;#8220;I can do 120&amp;#215;62 as my maximum size&amp;#8221; I have to click and drag my Terminal window until my size matches.  No more!&lt;/p&gt;


	&lt;p&gt;As I said above, this is pretty ugly but it works.  This shell script makes a one line applescript call through &lt;code&gt;osascript&lt;/code&gt; to tell the Terminal what size to make the window.  I put it in a shell script like this to simplify calling.  I started with a straight up applescript, but it was ugly to call it from the command line.  So I converted it to what you see here:&lt;/p&gt;


&lt;code&gt;
#!/bin/sh

/usr/bin/osascript -e 'tell application "Terminal"' -e "tell front window" -e "set the number of rows to $2" -e "set the number of columns to $1" -e "end tell" -e "end tell" 
&lt;/code&gt;

	&lt;p&gt;You can invoke it by simply saying:&lt;/p&gt;


&lt;code&gt;
$ resize_terminal 94 71
&lt;/code&gt;

	&lt;p&gt;and the front most Terminal window (likely the one you&amp;#8217;re typing in) will resize to 94 rows tall by 71 columns wide.&lt;/p&gt;</description>
      <pubDate>Fri, 05 Oct 2007 07:24:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:a5d3b52b-3319-44db-8cde-0e947458fb36</guid>
      <author>Doug</author>
      <link>http://blog.lathi.net/articles/2007/10/05/resizing-your-terminal</link>
      <category>Programming</category>
      <category>Mac OS X</category>
      <category>applescript</category>
      <category>macosx</category>
      <category>terminal</category>
      <category>osascript</category>
    </item>
    <item>
      <title>New Radiant Website</title>
      <description>&lt;p&gt;&lt;a href="http://corporatetool.blogspot.com/"&gt;&lt;em&gt;blah blah blah (lawyers made me change this)&lt;/em&gt;&lt;/a&gt; has been going through a major re-branding effort for the last long time.  This morning we&amp;#8217;re launching a major re-write of our main application.  There&amp;#8217;s a pretty cool &lt;a href="http://corporatetool.blogspot.com//personal/form/flash-demo-form"&gt;on-line demo&lt;/a&gt; that shows off our new sexiness.&lt;/p&gt;


	&lt;p&gt;Simultaneously we&amp;#8217;re rebranding our website and also restructuring most of our internal item catalog.  Pretty much everyone in the company has been involved in this effort in some way.  After months of work, we&amp;#8217;re live!&lt;/p&gt;


	&lt;p&gt;The new website is running Radiant from index to thank you page.  We have a web service for handling all of the EC business logic and multiple user facing web sites that connect to the service for managing their cart.  We&amp;#8217;ve written a &amp;#8220;store behavior&amp;#8221; to handle this xml-rpc client interface with Radiant.&lt;/p&gt;


	&lt;p&gt;This actually isn&amp;#8217;t our first production Radiant site.  Our first was our &lt;a href="http://www.rosettaworld.co.jp/"&gt;Japanese RosettaWorld&lt;/a&gt;.  That site isn&amp;#8217;t getting near the traffic that our US site does though.  The US site runs steady-state at about 5 user sessions per second.  We had a bit of a problem serving our &lt;span class="caps"&gt;CSS&lt;/span&gt; and JavaScript out of Radiant.  It was causing a session hit that forced an update to the DB.  Turns out that was a pretty big bottleneck in our load testing.  As a fix, we just moved those files out of Radiant for this rollout.  I&amp;#8217;m sure there&amp;#8217;s some in-Radiant solution to tell it not to track sessions on those pages.  We&amp;#8217;ll figure that out for this next release.&lt;/p&gt;


	&lt;p&gt;Hopefully, after all the stress of getting this release done we can take a collective deep breath.  However, I&amp;#8217;m guessing it&amp;#8217;s more likely we&amp;#8217;ll be scrambling to make all kinds of tweaks and such.&lt;/p&gt;</description>
      <pubDate>Tue, 28 Aug 2007 04:38:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:080b0b99-8ca7-4c7b-9c32-a01317383ec8</guid>
      <author>Doug</author>
      <link>http://blog.lathi.net/articles/2007/08/28/new-radiant-website</link>
      <category>Ruby on Rails</category>
      <category>rosettastone</category>
      <category>radiant</category>
    </item>
  </channel>
</rss>
