Working As Intendedhttp://www.workingasintended.com/2015-10-07jdlElixir is Maturinghttp://www.workingasintended.com/2015/10/07/elixir-is-maturing/2015-10-072015-10-07jdl<p>I&rsquo;ve been using Elixir and Phoenix a lot lately. I&rsquo;ve probably shelved Clojure for the foreseeable future. Some of the major happenings lately:</p>
<ol>
<li><a href="http://elixir-lang.org/blog/2015/09/28/elixir-v1-1-0-released/">Elixir 1.1</a> was released. The amount of work that Jos&eacute; and the rest of the team are putting in is unreal. He&rsquo;s also highly active on IRC, answering questions for other developers and newbies. The whole ecosystem of code and people is very &ldquo;pre-1.0 Rails&rdquo;. There&rsquo;s a lot of excitement, and for good reason.</li>
<li><a href="http://www.phoenixframework.org/blog/phoenix-10-the-framework-for-the-modern-web-just-landed">Phoenix 1.0</a> was released. While it&rsquo;s the &ldquo;Rails for Elixir&rdquo;, it&rsquo;s far from a clone. It&rsquo;s built to take advantage of Elixir and the Erlang BEAM that all of this runs on. I&rsquo;ve played around with several of the versions leading up to this, but 1.0 finally feels like a solid platform. The biggest downside compared to Rails isn&rsquo;t really Phoenix&rsquo;s fault, but it&rsquo;s just that there aren&rsquo;t anywhere near as many 3rd party libraries to lean on.</li>
<li><a href="https://pragprog.com/book/phoenix/programming-phoenix">Programming Phoenix</a> is in beta. Only the first 122 pages are available so far, but what is there is quite good. I worked through every example so far, and learned a ton about Ecto (the database access / query builder library) and the philosophy of Phoenix in general.</li>
</ol>
<p>I&rsquo;ve been using Elixir and Phoenix a lot lately. I&rsquo;ve probably shelved Clojure for the foreseeable future. Some of the major happenings lately:</p>
<ol>
<li><a href="http://elixir-lang.org/blog/2015/09/28/elixir-v1-1-0-released/">Elixir 1.1</a> was released. The amount of work that Jos&eacute; and the rest of the team are putting in is unreal. He&rsquo;s also highly active on IRC, answering questions for other developers and newbies. The whole ecosystem of code and people is very &ldquo;pre-1.0 Rails&rdquo;. There&rsquo;s a lot of excitement, and for good reason.</li>
<li><a href="http://www.phoenixframework.org/blog/phoenix-10-the-framework-for-the-modern-web-just-landed">Phoenix 1.0</a> was released. While it&rsquo;s the &ldquo;Rails for Elixir&rdquo;, it&rsquo;s far from a clone. It&rsquo;s built to take advantage of Elixir and the Erlang BEAM that all of this runs on. I&rsquo;ve played around with several of the versions leading up to this, but 1.0 finally feels like a solid platform. The biggest downside compared to Rails isn&rsquo;t really Phoenix&rsquo;s fault, but it&rsquo;s just that there aren&rsquo;t anywhere near as many 3rd party libraries to lean on.</li>
<li><a href="https://pragprog.com/book/phoenix/programming-phoenix">Programming Phoenix</a> is in beta. Only the first 122 pages are available so far, but what is there is quite good. I worked through every example so far, and learned a ton about Ecto (the database access / query builder library) and the philosophy of Phoenix in general.</li>
</ol>
Still looking for a Clojure dev environmenthttp://www.workingasintended.com/2015/03/16/still-looking-for-a-clojure-dev-environment/2015-03-162015-03-16jdl<p>I&rsquo;ve been writing mostly all Clojure code recently. I&rsquo;m still in search of a decent development environment.</p>
<p>I&rsquo;ve tried <a href="https://www.jetbrains.com/idea/">Intellij</a> + <a href="https://cursiveclojure.com/">Cursive</a>, and it&rsquo;s decent but the REPL is super clunky. Test integration is terrible, and clearly an afterthought. The editor itself is okay, for an IDE, with the normal amount of having to use the mouse way too much to get anything done.</p>
<p><a href="http://lighttable.com/">Lighttable</a> is interesting. It&rsquo;s super clean, and instarepl is fun to play with. It&rsquo;s a feature that turns an entire file into a live REPL and shows you the output of every line at once. I can&rsquo;t remember what exactly started annoying me about this one, but overall it seemed solid. If I were to hand a Clojure project to a newbie, I would use Lighttable for sure. It was close enough to &ldquo;it just works&rdquo; to be great for this purpose.</p>
<p>I spent a couple days (again) forcing myself to use <a href="http://emacsformacosx.com/">Emacs (the clean OS X build)</a>. It&rsquo;s super cool and super annoying all at once. I was getting pretty good at remembering the Cider key combos for evaluating code in the REPL, and that seemed to go well. Emacs integrating with a Lisp interpreter is pretty much the killer feature for me when it comes to Clojure. This has been a solved problem for years, so I would expect it to work well.</p>
<p>Ultimately, I started hating the other arcane key combinations I was supposed to remember that should have been more obvious. For example, I was trying to do a <code>J</code> from vim while in emacs, which joins two lines together. In emacs the command is <code>C-n M-^</code>, which is it&rsquo;s own special level of insanity (memorize an oddball chord and have to reach M-Shift+6). I know that I could bind this to something else, but I don&rsquo;t want to bind this to something else. I want it to be designed with humans in mind in the first place (emacs evangelists, unload your vim irony here) . Also, <code>C-j</code> to get a newline with auto-indent? Seriously?</p>
<p>I think I keep trying Emacs, because <a href="http://www.braveclojure.com/">Brave Clojure</a> loves it so much. This is a really good intro to Emacs and Clojure, and I highly recommend it. I have no doubts that I&rsquo;ll be back to Emacs sooner or later. I&rsquo;m sure it&rsquo;s not done disappointing me yet.</p>
<p>Like every other time I&rsquo;ve gone through this journey to find a new IDE I&rsquo;ve ended up back at <a href="http://www.vim.org/">vim</a>. The interface to nrepl via <a href="https://github.com/tpope/vim-fireplace">fireplace</a> is decent, but not without its quirks. It&rsquo;s good enough to execute code, which is mostly what I want anyway. For autotesting I&rsquo;ve been using <a href="https://github.com/jakepearson/quickie">lein quickie</a>. This has nothing to do with vim, so I&rsquo;ll have to reevaluate my test issues with Lighttable and Intellij in light of this tool.</p>
<p>Now that I&rsquo;m sort-of-but-not-really happy with my dev setup I&rsquo;ve run into another issue. My Macbook Pro is out of RAM. Apparently the apps I run, plus multiple JVM&rsquo;s for the various REPLs that all need to be going at once have put me right up against the 8 GB limit, and everything comes to a crawl. I could play around with JVM settings to buy some room, but it&rsquo;s probably about time that I throw some new hardware at this problem anyway. I&rsquo;m writing this on a mid-2012 MBP, like a fossil. I&rsquo;m considering firing up an EC2 instance as a dev box until the new 15" Macbooks come out this summer.</p>
<p>I&rsquo;ve been writing mostly all Clojure code recently. I&rsquo;m still in search of a decent development environment.</p>
<p>I&rsquo;ve tried <a href="https://www.jetbrains.com/idea/">Intellij</a> + <a href="https://cursiveclojure.com/">Cursive</a>, and it&rsquo;s decent but the REPL is super clunky. Test integration is terrible, and clearly an afterthought. The editor itself is okay, for an IDE, with the normal amount of having to use the mouse way too much to get anything done.</p>
<p><a href="http://lighttable.com/">Lighttable</a> is interesting. It&rsquo;s super clean, and instarepl is fun to play with. It&rsquo;s a feature that turns an entire file into a live REPL and shows you the output of every line at once. I can&rsquo;t remember what exactly started annoying me about this one, but overall it seemed solid. If I were to hand a Clojure project to a newbie, I would use Lighttable for sure. It was close enough to &ldquo;it just works&rdquo; to be great for this purpose.</p>
<p>I spent a couple days (again) forcing myself to use <a href="http://emacsformacosx.com/">Emacs (the clean OS X build)</a>. It&rsquo;s super cool and super annoying all at once. I was getting pretty good at remembering the Cider key combos for evaluating code in the REPL, and that seemed to go well. Emacs integrating with a Lisp interpreter is pretty much the killer feature for me when it comes to Clojure. This has been a solved problem for years, so I would expect it to work well.</p>
<p>Ultimately, I started hating the other arcane key combinations I was supposed to remember that should have been more obvious. For example, I was trying to do a <code>J</code> from vim while in emacs, which joins two lines together. In emacs the command is <code>C-n M-^</code>, which is it&rsquo;s own special level of insanity (memorize an oddball chord and have to reach M-Shift+6). I know that I could bind this to something else, but I don&rsquo;t want to bind this to something else. I want it to be designed with humans in mind in the first place (emacs evangelists, unload your vim irony here) . Also, <code>C-j</code> to get a newline with auto-indent? Seriously?</p>
<p>I think I keep trying Emacs, because <a href="http://www.braveclojure.com/">Brave Clojure</a> loves it so much. This is a really good intro to Emacs and Clojure, and I highly recommend it. I have no doubts that I&rsquo;ll be back to Emacs sooner or later. I&rsquo;m sure it&rsquo;s not done disappointing me yet.</p>
<p>Like every other time I&rsquo;ve gone through this journey to find a new IDE I&rsquo;ve ended up back at <a href="http://www.vim.org/">vim</a>. The interface to nrepl via <a href="https://github.com/tpope/vim-fireplace">fireplace</a> is decent, but not without its quirks. It&rsquo;s good enough to execute code, which is mostly what I want anyway. For autotesting I&rsquo;ve been using <a href="https://github.com/jakepearson/quickie">lein quickie</a>. This has nothing to do with vim, so I&rsquo;ll have to reevaluate my test issues with Lighttable and Intellij in light of this tool.</p>
<p>Now that I&rsquo;m sort-of-but-not-really happy with my dev setup I&rsquo;ve run into another issue. My Macbook Pro is out of RAM. Apparently the apps I run, plus multiple JVM&rsquo;s for the various REPLs that all need to be going at once have put me right up against the 8 GB limit, and everything comes to a crawl. I could play around with JVM settings to buy some room, but it&rsquo;s probably about time that I throw some new hardware at this problem anyway. I&rsquo;m writing this on a mid-2012 MBP, like a fossil. I&rsquo;m considering firing up an EC2 instance as a dev box until the new 15" Macbooks come out this summer.</p>
Finding the source code for a Ruby method.http://www.workingasintended.com/2015/02/11/finding-the-source-code-for-a-ruby-method/2015-02-112015-02-11jdl<p>Today I discovered Ruby&rsquo;s <code>Method#source_location</code>. I was getting strange results in a test case and wanted to see what was going on inside of <code>xhr</code>.</p>
<p>I added a breakpoint to my test.</p>
<p><code>
byebug
xhr :get, :show, id: expected_user.id
</code></p>
<p>And then in the console that came up from running the test I was able to pull up the file and line number for this method.</p>
<p><code>
(byebug) self.method(:xhr).source_location
[&ldquo;/[&hellip;]/gems/actionpack-4.2.0/lib/action_controller/test_case.rb&rdquo;, 538]
</code></p>
<p>Today I discovered Ruby&rsquo;s <code>Method#source_location</code>. I was getting strange results in a test case and wanted to see what was going on inside of <code>xhr</code>.</p>
<p>I added a breakpoint to my test.</p>
<p><code>
byebug
xhr :get, :show, id: expected_user.id
</code></p>
<p>And then in the console that came up from running the test I was able to pull up the file and line number for this method.</p>
<p><code>
(byebug) self.method(:xhr).source_location
[&ldquo;/[&hellip;]/gems/actionpack-4.2.0/lib/action_controller/test_case.rb&rdquo;, 538]
</code></p>
The Clojure - Elixir Pendulumhttp://www.workingasintended.com/2015/02/08/the-clojure---elixir-pendulum/2015-02-082015-02-08jdl<p>As I&rsquo;ve written before I&rsquo;ve been alternating between Clojure and Elixir on my hobby projects. I did briefly dip into Scala for an online class on functional programming, and while it was interesting I realized that there was no chance I was going to stick with that language for the long term.</p>
<p>My latest reason for switching (in this case from Elixir back to Clojure) is that I can&rsquo;t be bothered to write roles authorization code from scratch for the umpteenth time. I could (should perhaps) start a roles library project for Elixir and attempt to solve the problem for myself and others. But I&rsquo;d much rather get something interesting done.</p>
<p>A likely upcoming scenario will be me getting annoyed at either (1) trying to hack Clojure code with vim or (2) realizing that the Clojure roles libraries like <a href="https://github.com/cemerick/friend">friend</a> are as obnoxious as making my own in the first place. Friend might be wonderful; who knows.</p>
<p>As I&rsquo;ve written before I&rsquo;ve been alternating between Clojure and Elixir on my hobby projects. I did briefly dip into Scala for an online class on functional programming, and while it was interesting I realized that there was no chance I was going to stick with that language for the long term.</p>
<p>My latest reason for switching (in this case from Elixir back to Clojure) is that I can&rsquo;t be bothered to write roles authorization code from scratch for the umpteenth time. I could (should perhaps) start a roles library project for Elixir and attempt to solve the problem for myself and others. But I&rsquo;d much rather get something interesting done.</p>
<p>A likely upcoming scenario will be me getting annoyed at either (1) trying to hack Clojure code with vim or (2) realizing that the Clojure roles libraries like <a href="https://github.com/cemerick/friend">friend</a> are as obnoxious as making my own in the first place. Friend might be wonderful; who knows.</p>
Elixir is Back on the Radarhttp://www.workingasintended.com/2015/01/30/elixir-is-back-on-the-radar/2015-01-302015-01-30jdl<p>Over the past few years I&rsquo;ve waffled between languages that I use for hobby projects, mainly bouncing between <a href="http://clojure.org/">Clojure</a> and <a href="http://elixir-lang.org/">Elixir</a>. I&rsquo;ve been screwing around with Elixir for the past month again, and now I&rsquo;m really excited because of the possibility of running this on a Raspberry Pi. I don&rsquo;t have anything resembling a goal in mind, but seeing a presentation about Erlang on the RPi got me excited.</p>
<p>I suspect that the first semi-real project will be something homebrewing related. Fermentation temperature monitoring perhaps? I realize that adding Elixir to the mix for something that simple is just overhead, but it might be a fun project anyway.</p>
<p>It&rsquo;s getting me to dust off the electronics knowledge that I&rsquo;ve completely forgotten in the 20 years since college, so that&rsquo;s a bonus.</p>
<p>Over the past few years I&rsquo;ve waffled between languages that I use for hobby projects, mainly bouncing between <a href="http://clojure.org/">Clojure</a> and <a href="http://elixir-lang.org/">Elixir</a>. I&rsquo;ve been screwing around with Elixir for the past month again, and now I&rsquo;m really excited because of the possibility of running this on a Raspberry Pi. I don&rsquo;t have anything resembling a goal in mind, but seeing a presentation about Erlang on the RPi got me excited.</p>
<p>I suspect that the first semi-real project will be something homebrewing related. Fermentation temperature monitoring perhaps? I realize that adding Elixir to the mix for something that simple is just overhead, but it might be a fun project anyway.</p>
<p>It&rsquo;s getting me to dust off the electronics knowledge that I&rsquo;ve completely forgotten in the 20 years since college, so that&rsquo;s a bonus.</p>
Playing with Hardwarehttp://www.workingasintended.com/2015/01/29/playing-with-hardware/2015-01-292015-01-29jdl<p>I pulled my Arduino Uno out of the closet and decided to actually give it a real go this time. I can&rsquo;t explain exactly what prompted this, but I have some ideas that can tie into my homebrewing. Nothing that hasn&rsquo;t been done before, but monitoring fermentation temperatures seems like a decent first step.</p>
<p>I also ordered a Raspberry Pi, because why not. My daughter is very interested in what&rsquo;s going on here, so I&rsquo;ll be including her as much as she likes. Being exposed to some C code (or Python on the RPi) will be good for her. Talking about resistors and circuits will be interesting as well.</p>
<p>I pulled my Arduino Uno out of the closet and decided to actually give it a real go this time. I can&rsquo;t explain exactly what prompted this, but I have some ideas that can tie into my homebrewing. Nothing that hasn&rsquo;t been done before, but monitoring fermentation temperatures seems like a decent first step.</p>
<p>I also ordered a Raspberry Pi, because why not. My daughter is very interested in what&rsquo;s going on here, so I&rsquo;ll be including her as much as she likes. Being exposed to some C code (or Python on the RPi) will be good for her. Talking about resistors and circuits will be interesting as well.</p>
rspec, Rails 3, and missing rake taskshttp://www.workingasintended.com/2011/08/23/rspec-rails-3-and-missing-rake-tasks/2011-08-232011-08-23jdl<p>I was setting up a fresh Rails 3 app and the following bit me.</p>
<pre><code>$ rake spec:models
rake aborted!
Don't know how to build task 'spec:models'
</code></pre>
<p>After some head scratching and a closer look at the docs, I realized that I had
forgotten to add the <code>rspec-rails</code> gem to my development environment.
I had it in only the test and cucumber environments. Seems like an odd thing to do, but it lets you run the various rake tasks in dev.</p>
<p>In <code>Gemfile</code>:</p>
<pre><code>group :development, :test, :cucumber do
gem "rspec-rails"
end
</code></pre>
<p>I was setting up a fresh Rails 3 app and the following bit me.</p>
<pre><code>$ rake spec:models
rake aborted!
Don't know how to build task 'spec:models'
</code></pre>
<p>After some head scratching and a closer look at the docs, I realized that I had
forgotten to add the <code>rspec-rails</code> gem to my development environment.
I had it in only the test and cucumber environments. Seems like an odd thing to do, but it lets you run the various rake tasks in dev.</p>
<p>In <code>Gemfile</code>:</p>
<pre><code>group :development, :test, :cucumber do
gem "rspec-rails"
end
</code></pre>
More on Blekko versus Googlehttp://www.workingasintended.com/2011/01/20/more-on-blekko-versus-google/2011-01-202011-01-20jdl<h3>Blekko versus Google for an example search.</h3>
<p>Please note right from the start that I&rsquo;m not doing this to pile on. If I didn&rsquo;t think that Blekko was in the process of making something awesome, I would simply stop using it. I&rsquo;m writing this so that someone can tell me what I&rsquo;m doing wrong, or as a bug report. Or both.</p>
<h3>Searching for Cucumber docs</h3>
<p>I was trying to execute the following search, intending to find the documentation for the selectors in Cucumber.</p>
<p><code>rails cucumber should select within</code></p>
<p>Here&rsquo;s what I found in Google.</p>
<div class="thumbnail"><a href="https://skitch.com/jdludlow/rkqdc/rails-cucumber-should-select-within-google-search"><img style="max-width:638px" src="https://img.skitch.com/20110121-ksii99i41q4ahmd87bjis3xb6k.medium.jpg" alt="rails cucumber should select within - Google Search" /></a><br /><span>Uploaded with <a href="http://skitch.com">Skitch</a>!</span></div>
<p>And my Blekko setup for /rails.</p>
<div class="thumbnail"><a href="https://skitch.com/jdludlow/rkqdb/blekko-viewing-jdl-rails"><img style="max-width:638px" src="https://img.skitch.com/20110121-x5cwunkimtrahgt6dir7dfex9j.medium.jpg" alt="blekko | viewing /jdl/rails" /></a><br /><span>Uploaded with <a href="http://skitch.com">Skitch</a>!</span></div>
<p>And the Blekko search results.</p>
<div class="thumbnail"><a href="https://skitch.com/jdludlow/rkqdg/blekko-rails-cucumber-should-select-within"><img style="max-width:638px" src="https://img.skitch.com/20110121-dhcm2wfkumy64t3t9bfsptd7bh.medium.jpg" alt="blekko | /rails cucumber should select within" /></a><br /><span>Uploaded with <a href="http://skitch.com">Skitch</a>!</span></div>
<p>Clearly there is a disconnect here. I&rsquo;m inheriting the /blekko/rails tag, and I even added the exact host.domain from the #1 Google result. Yet, I get back zero results and some non-relevant web filler.</p>
<h3>Blekko versus Google for an example search.</h3>
<p>Please note right from the start that I&rsquo;m not doing this to pile on. If I didn&rsquo;t think that Blekko was in the process of making something awesome, I would simply stop using it. I&rsquo;m writing this so that someone can tell me what I&rsquo;m doing wrong, or as a bug report. Or both.</p>
<h3>Searching for Cucumber docs</h3>
<p>I was trying to execute the following search, intending to find the documentation for the selectors in Cucumber.</p>
<p><code>rails cucumber should select within</code></p>
<p>Here&rsquo;s what I found in Google.</p>
<div class="thumbnail"><a href="https://skitch.com/jdludlow/rkqdc/rails-cucumber-should-select-within-google-search"><img style="max-width:638px" src="https://img.skitch.com/20110121-ksii99i41q4ahmd87bjis3xb6k.medium.jpg" alt="rails cucumber should select within - Google Search" /></a><br /><span>Uploaded with <a href="http://skitch.com">Skitch</a>!</span></div>
<p>And my Blekko setup for /rails.</p>
<div class="thumbnail"><a href="https://skitch.com/jdludlow/rkqdb/blekko-viewing-jdl-rails"><img style="max-width:638px" src="https://img.skitch.com/20110121-x5cwunkimtrahgt6dir7dfex9j.medium.jpg" alt="blekko | viewing /jdl/rails" /></a><br /><span>Uploaded with <a href="http://skitch.com">Skitch</a>!</span></div>
<p>And the Blekko search results.</p>
<div class="thumbnail"><a href="https://skitch.com/jdludlow/rkqdg/blekko-rails-cucumber-should-select-within"><img style="max-width:638px" src="https://img.skitch.com/20110121-dhcm2wfkumy64t3t9bfsptd7bh.medium.jpg" alt="blekko | /rails cucumber should select within" /></a><br /><span>Uploaded with <a href="http://skitch.com">Skitch</a>!</span></div>
<p>Clearly there is a disconnect here. I&rsquo;m inheriting the /blekko/rails tag, and I even added the exact host.domain from the #1 Google result. Yet, I get back zero results and some non-relevant web filler.</p>
And back to Googlehttp://www.workingasintended.com/2011/01/17/and-back-to-google/2011-01-172011-01-17jdl<p>I gave Blekko a good trial, but it&rsquo;s not quite ready. It&rsquo;s noticeably slower than Google, and the results aren&rsquo;t as good for non-programming queries. Obviously this is highly subjective, and it makes sense that my programming queries would be better since I took the time to customize them. There&rsquo;s still potential here though. I suspect that Blekko will succeed, and I will certainly try them again in a few months.</p>
<p>Also, it seems that Stack Overflow results are appearing higher up on Google than they were just a few weeks ago. Is it possible that the leech sites are getting what they deserve in their page rank?</p>
<p>I gave Blekko a good trial, but it&rsquo;s not quite ready. It&rsquo;s noticeably slower than Google, and the results aren&rsquo;t as good for non-programming queries. Obviously this is highly subjective, and it makes sense that my programming queries would be better since I took the time to customize them. There&rsquo;s still potential here though. I suspect that Blekko will succeed, and I will certainly try them again in a few months.</p>
<p>Also, it seems that Stack Overflow results are appearing higher up on Google than they were just a few weeks ago. Is it possible that the leech sites are getting what they deserve in their page rank?</p>
Experimenting With Blekko Over Googlehttp://www.workingasintended.com/2011/01/07/experimenting-with-blekko-over-google/2011-01-072011-01-07jdl<p>Google has been the home page on every browser that I&rsquo;ve used over the last 10 years. Today I switched to <a href="http://www.blekko.com/">blekko</a> on my development laptop.</p>
<h3>The Problem</h3>
<p>The catalyst for this switch comes from Google&rsquo;s degraded search results when looking up programming-related information. I post a lot on <a href="http://stackoverflow.com/users/9465/jdl">stackoverflow</a>, mainly on the topics of Ruby and/or Rails. I do this as a way to give back, since I&rsquo;ve benefited so much in the past and present from the advice that others have freely given. Finding this advice used to be easy: you just Google it. It was so easy that it became its own obnoxious pseudo-verb.</p>
<p>Part of the deal with stackoverflow is that what you post there is covered by a <a href="http://creativecommons.org/licenses/by-sa/2.5/">very open license</a>. Fine and dandy, we know that going in. It&rsquo;s inevitable with a site as good as SO that bottom feeders will scrape it into their own ad farms. Google ranks those sites poorly though right? Wrong. These toilets who I will not name here somehow manage to clog up Google&rsquo;s search results, usually appearing above the source of the original content itself. This is broken.</p>
<p>I&rsquo;ve been crying about not having a personal blacklist on Google for quite a while now. It seems that the all-powerful Google is not interested in implementing this feature. I figured I was alone in this, but <a href="http://news.ycombinator.com/item?id=2075049">this topic on HN</a> blew up with comments yesterday. I&rsquo;ve known about, and been highly uninterested in, the Chrome plugin that behaves like a blacklist for Google. I wanted something more universal than that. Plus I rarely use Chrome.</p>
<h3>Enter blekko</h3>
<p>I&rsquo;ve seen blekko thrown around on <a href="http://news.ycombinator.com/">HN</a> over the last few weeks, but paid it little attention at first. My initial reaction was, &ldquo;Wow, the all-lower-case motif is terrible. This has to be a joke, right?&rdquo; Well, I finally got around to using the thing and while it&rsquo;s not without problems I&rsquo;m going to give it a try for a couple weeks.</p>
<p>First of all, it&rsquo;s in beta and clearly not perfect. The UI tends to morph over time, and doesn&rsquo;t always match their documentation. Sometimes the site is slow to respond. It does, however, have a compelling feature that it calls <a href="http://blekko.com/ws/+/help#2">slashtags</a>. It&rsquo;s a powerful feature with a dumb name. Here&rsquo;s the beauty inherent in the system. These tags represent filters to your search. They are a combination of site whitelists and API calls that have been built for various sites like Twitter and Amazon.</p>
<p>Here is a simple example. Let&rsquo;s say that I want to search for &ldquo;string,&rdquo; meaning &ldquo;the String class in Ruby.&rdquo; This is an admittedly stupid, since I could type &ldquo;ruby string&rdquo; into any search engine in the world and get back what I&rsquo;m looking for. (If you run a search engine that this test would fail on, please do us all a favor and take a bulldozer to your server room.) In any case, searching for &ldquo;string&rdquo; typically brings back Java- and PHP-related results, since those are more popular than Ruby. However, with blekko I can type or click on my &ldquo;/rails&rdquo; or &ldquo;/ruby&rdquo; tags and have that search only apply to that which has been blessed by the tag&rsquo;s editors. Instant satisfaction, and no sites that I don&rsquo;t want to see.</p>
<p>Blekko has its own growing list of tags, which are edited by employees and volunteers. This is nice, but the cool part is that you can make your own tags. The namespace of your tags is /username/tag, but you only have to type the /tag part as blekko searches your personal namespace first. If you really want the global tag, you can force it with /blekko/tag. So far this is neat, but not worth changing my homepage over yet.</p>
<h3>The killer combo</h3>
<ol>
<li>When creating your own slashtag you can include both individual sites and other slashtags. This lets you whitelist sites that you like, but offloads the bulk of the work to the editors of the other tags that you&rsquo;ve included.</li>
<li>You can mark any site you want as spam. It becomes &ldquo;dead to you&rdquo; as they put it. Personal blacklist. So if I&rsquo;m using /blekko/rails as part of my own /jdl/rails tag and someone adds a site I don&rsquo;t like to the main tag, I can easily nuke it from orbit.</li>
</ol>
<blockquote><p><img src="https://img.skitch.com/20110108-cucrjffb64d59xuspgs7axe6pc.jpg" alt="e-freedom indeed" /></p></blockquote>
<p>Attention Google: This is what&rsquo;s called a &ldquo;useful feature.&rdquo;</p>
<p>Google has been the home page on every browser that I&rsquo;ve used over the last 10 years. Today I switched to <a href="http://www.blekko.com/">blekko</a> on my development laptop.</p>
<h3>The Problem</h3>
<p>The catalyst for this switch comes from Google&rsquo;s degraded search results when looking up programming-related information. I post a lot on <a href="http://stackoverflow.com/users/9465/jdl">stackoverflow</a>, mainly on the topics of Ruby and/or Rails. I do this as a way to give back, since I&rsquo;ve benefited so much in the past and present from the advice that others have freely given. Finding this advice used to be easy: you just Google it. It was so easy that it became its own obnoxious pseudo-verb.</p>
<p>Part of the deal with stackoverflow is that what you post there is covered by a <a href="http://creativecommons.org/licenses/by-sa/2.5/">very open license</a>. Fine and dandy, we know that going in. It&rsquo;s inevitable with a site as good as SO that bottom feeders will scrape it into their own ad farms. Google ranks those sites poorly though right? Wrong. These toilets who I will not name here somehow manage to clog up Google&rsquo;s search results, usually appearing above the source of the original content itself. This is broken.</p>
<p>I&rsquo;ve been crying about not having a personal blacklist on Google for quite a while now. It seems that the all-powerful Google is not interested in implementing this feature. I figured I was alone in this, but <a href="http://news.ycombinator.com/item?id=2075049">this topic on HN</a> blew up with comments yesterday. I&rsquo;ve known about, and been highly uninterested in, the Chrome plugin that behaves like a blacklist for Google. I wanted something more universal than that. Plus I rarely use Chrome.</p>
<h3>Enter blekko</h3>
<p>I&rsquo;ve seen blekko thrown around on <a href="http://news.ycombinator.com/">HN</a> over the last few weeks, but paid it little attention at first. My initial reaction was, &ldquo;Wow, the all-lower-case motif is terrible. This has to be a joke, right?&rdquo; Well, I finally got around to using the thing and while it&rsquo;s not without problems I&rsquo;m going to give it a try for a couple weeks.</p>
<p>First of all, it&rsquo;s in beta and clearly not perfect. The UI tends to morph over time, and doesn&rsquo;t always match their documentation. Sometimes the site is slow to respond. It does, however, have a compelling feature that it calls <a href="http://blekko.com/ws/+/help#2">slashtags</a>. It&rsquo;s a powerful feature with a dumb name. Here&rsquo;s the beauty inherent in the system. These tags represent filters to your search. They are a combination of site whitelists and API calls that have been built for various sites like Twitter and Amazon.</p>
<p>Here is a simple example. Let&rsquo;s say that I want to search for &ldquo;string,&rdquo; meaning &ldquo;the String class in Ruby.&rdquo; This is an admittedly stupid, since I could type &ldquo;ruby string&rdquo; into any search engine in the world and get back what I&rsquo;m looking for. (If you run a search engine that this test would fail on, please do us all a favor and take a bulldozer to your server room.) In any case, searching for &ldquo;string&rdquo; typically brings back Java- and PHP-related results, since those are more popular than Ruby. However, with blekko I can type or click on my &ldquo;/rails&rdquo; or &ldquo;/ruby&rdquo; tags and have that search only apply to that which has been blessed by the tag&rsquo;s editors. Instant satisfaction, and no sites that I don&rsquo;t want to see.</p>
<p>Blekko has its own growing list of tags, which are edited by employees and volunteers. This is nice, but the cool part is that you can make your own tags. The namespace of your tags is /username/tag, but you only have to type the /tag part as blekko searches your personal namespace first. If you really want the global tag, you can force it with /blekko/tag. So far this is neat, but not worth changing my homepage over yet.</p>
<h3>The killer combo</h3>
<ol>
<li>When creating your own slashtag you can include both individual sites and other slashtags. This lets you whitelist sites that you like, but offloads the bulk of the work to the editors of the other tags that you&rsquo;ve included.</li>
<li>You can mark any site you want as spam. It becomes &ldquo;dead to you&rdquo; as they put it. Personal blacklist. So if I&rsquo;m using /blekko/rails as part of my own /jdl/rails tag and someone adds a site I don&rsquo;t like to the main tag, I can easily nuke it from orbit.</li>
</ol>
<blockquote><p><img src="https://img.skitch.com/20110108-cucrjffb64d59xuspgs7axe6pc.jpg" alt="e-freedom indeed" /></p></blockquote>
<p>Attention Google: This is what&rsquo;s called a &ldquo;useful feature.&rdquo;</p>
Go on OS X and iOShttp://www.workingasintended.com/2010/11/20/go-on-os-x-and-ios/2010-11-202010-11-20jdl<p>These are the Go applications that I use the most.</p>
<h1>OS X</h1>
<p></p>
<h3><a href="http://www.gokgs.com/">KGS</a></h3>
<p>KGS is a fantastic English-language realtime Go server, created by <a href="http://www.boardgamegeek.com/user/wmshub">wms</a>. The <a href="http://www.gokgs.com/download.jsp">client</a>
is a Java program, so it works fine on Windows and Linux as well. Basic accounts are free, and give you access to almost
all of the features of the server. You can play in rated and non-rated games, access your game history, download <a href="http://senseis.xmp.net/?SmartGameFormat">SGF</a>
files of your games, comment and review your own games, and join the chat channels. The client also works as an SGF
creator and editor, letting you take notes and review variations from your games. This is the best client I&rsquo;ve found
yet for handling multiple games in a single SGF file and easily navigating heavily nested trees.</p>
<p>Here is an example of a game under review. You can do this offline with downloaded SGF files, or you can review online by loading the game into a chatroom.
Then other people can join the review. Anything that people type will appear at that point in the SGF file. We use this mode during our class matches to review
with each other prior to emailing the game record to the instructors.</p>
<p><img src="http://img.skitch.com/20101128-xrgh7gswebjxw37w2yrafgmwtr.png" alt="KGS game review" /></p>
<p>Finding a game is pretty easy, since the main tab is a list of all open games. They come and go quickly though, so by the time you&rsquo;ve decided to join one
it&rsquo;s probably already filled. I prefer to use the automatch feature. Most of the time it finds an opponent immediately. Depending on the time of day, it might
take a few minutes.</p>
<p><img src="http://img.skitch.com/20101128-kjxrg21wngi8fxj8m1ak46xd3e.png" alt="KGS automatch preferences" /></p>
<p>Paid accounts add the ability to join tournaments and watch professional lectures. You can view the lectures live and interact with the
instructor via chat. They are also stored in an archive to watch later.</p>
<p>I used a free account for years, but earlier this year switched to a paid account. Given the amount of time I spend playing
and studying on this server it&rsquo;s a bargain. Android uses should take note that <a href="http://www.gokgs.com/help/androidInfo.html">the $15 app</a> comes with two months of KGS+ included. If I had an
Android phone, I would buy this without hesitation. Since KGS uses Java for its client, wms has said in no uncertain terms that
there will not be an iOS version released anytime soon.</p>
<p><a href="http://www.lifein19x19.com/forum">Life in 19x19</a> has a dedicated <a href="http://www.lifein19x19.com/forum/viewforum.php?f=24">KGS forum</a> where wms posts.</p>
<h3><a href="http://www.sente.ch/software/goban/">Goban</a></h3>
<p>Goban is a client for playing against GNU Go. Computers aren&rsquo;t good at Go, but they can still crush newbies. If you&rsquo;re new the game, playing 9x9 games repeatedly against GNU Go is
a good way to get better. Start with a 4 stone handicap and keep at it until you can beat the computer with no handicap.</p>
<p>One quirk of this program is that the board size isn&rsquo;t found in the preferences. It&rsquo;s in the info drawer.</p>
<p><img src="http://img.skitch.com/20101128-qdum2q7ufgbg9asgfx375fun1j.png" alt="Goban info drawer" /></p>
<hr />
<h1>iOS</h1>
<p></p>
<h3><a href="http://www.smartgo.com/en/kifu.htm">SmartGo Kifu</a></h3>
<p>SmartGo Kifu is awesome. It&rsquo;s not without its quirks and faults, but it&rsquo;s a fine piece of software. By far the biggest thing that I use it for is the set of 2000+ <a href="http://senseis.xmp.net/?Tsumego">tsumego</a>
problems. Most of them are life &amp; death problems, with a few <a href="http://senseis.xmp.net/?FusekiPages">fuseki</a> and <a href="http://senseis.xmp.net/?Tesuji">tesuji</a> problems
thrown in. They are organized by difficulty, and problems that you get wrong are marked
so that you can go back and retry them later. It&rsquo;s similar to Go Grinder, but I like the SmartGo interface much better.</p>
<p>A major feature that I am just starting to use is the database of 31,000 professional games. Only 20 are annotated, and the review features are not as easy to use as KGS.
I&rsquo;m not strong enough to get much out of a pro game that isn&rsquo;t commented. I would guess that stronger players would have a lot of fun with a portable database like this.</p>
<p>There&rsquo;s an AI, with all the caveats of computers being weaker than humans. It still plays a decent 9x9 game, and will destroy newbies who don&rsquo;t take a handicap.</p>
<p>You can play against other humans, but only on the same devise. There is no network play built in. I haven&rsquo;t found this to be an issue, since I play online via KGS or just
use one of the turn-based web sites for playing on the iPad. It keeps a history of games played, organized by player, so you can review your games later.</p>
<p><img src="http://www.smartgo.com/img/kifu1.png" alt="SmartGo Kifu" /></p>
<p>iPhone users should check out SmartGo Pro. It&rsquo;s the predecessor to Kifu, and has the pro database and the Go problems included.</p>
<h3><a href="http://zombieprocess.org/">Tengen Go</a></h3>
<p>Tengen is a decent, not great, Go client for IGS. I&rsquo;m not a fan of IGS to begin with, but when I absolutely must play a real-time game on the iPad it&rsquo;s the only
option that I&rsquo;m aware of. (There&rsquo;s another iPhone IGS client called Tetsuki, but uninstalled it after having connection problems.)</p>
<p><img src="http://a1.phobos.apple.com/us/r1000/020/Purple/62/ee/42/mzl.qarpdsiw.480x480-75.jpg" alt="Tengen" /></p>
<hr />
<h1>Web</h1>
<p>A nice bonus with web-based Go servers is that they are equally useful on the Mac and the mobile devices. Almost all of the Go games that I play with
the iPad are done on a web server.</p>
<h3><a href="http://go.davepeck.org/">Dave Peck Go</a></h3>
<p>This is a simple, yet polished, web client for playing turn-based games. There are no accounts, game histories, archives, or rankings.
You set up a game, plug in the email addresses of both players, and then each of you receive a link in your email and
a reminder when it&rsquo;s your turn. It runs on Google&rsquo;s App Engine, and is an <a href="https://github.com/davepeck/appengine-go/">open source project</a>.</p>
<p>Here is a game in progress. The JavaScript controls work just fine on mobile Safari.</p>
<p><img src="http://img.skitch.com/20101128-fmhw1gsqyi7t12cunayh1ejxx1.png" alt="Dave Peck game" /></p>
<h3><a href="http://www.dragongoserver.net/">Dragon Go Server [DGS]</a></h3>
<p>DGS is a full-featured server with accounts, ratings, a ton of game options, and a generally pleasant user base. I usually start or join games with extremely
long time controls, averaging less than one move per day. Many people on this server are fine with such slow games, and are typically involved with multiple
games at once. The interface is usable, and generally doesn&rsquo;t get in your way. You click where you want to move then confirm the move. You can pull up lists
of your games, completed or in progress. Reviews need to be done externally, which usually means that you download the SGF file and load it in CGoban (the KGS client).</p>
<p><img src="http://img.skitch.com/20101128-83h2mc52uyi3jq87h12bgjrx8f.png" alt="DGS game completed" /></p>
<p>These are the Go applications that I use the most.</p>
<h1>OS X</h1>
<p></p>
<h3><a href="http://www.gokgs.com/">KGS</a></h3>
<p>KGS is a fantastic English-language realtime Go server, created by <a href="http://www.boardgamegeek.com/user/wmshub">wms</a>. The <a href="http://www.gokgs.com/download.jsp">client</a>
is a Java program, so it works fine on Windows and Linux as well. Basic accounts are free, and give you access to almost
all of the features of the server. You can play in rated and non-rated games, access your game history, download <a href="http://senseis.xmp.net/?SmartGameFormat">SGF</a>
files of your games, comment and review your own games, and join the chat channels. The client also works as an SGF
creator and editor, letting you take notes and review variations from your games. This is the best client I&rsquo;ve found
yet for handling multiple games in a single SGF file and easily navigating heavily nested trees.</p>
<p>Here is an example of a game under review. You can do this offline with downloaded SGF files, or you can review online by loading the game into a chatroom.
Then other people can join the review. Anything that people type will appear at that point in the SGF file. We use this mode during our class matches to review
with each other prior to emailing the game record to the instructors.</p>
<p><img src="http://img.skitch.com/20101128-xrgh7gswebjxw37w2yrafgmwtr.png" alt="KGS game review" /></p>
<p>Finding a game is pretty easy, since the main tab is a list of all open games. They come and go quickly though, so by the time you&rsquo;ve decided to join one
it&rsquo;s probably already filled. I prefer to use the automatch feature. Most of the time it finds an opponent immediately. Depending on the time of day, it might
take a few minutes.</p>
<p><img src="http://img.skitch.com/20101128-kjxrg21wngi8fxj8m1ak46xd3e.png" alt="KGS automatch preferences" /></p>
<p>Paid accounts add the ability to join tournaments and watch professional lectures. You can view the lectures live and interact with the
instructor via chat. They are also stored in an archive to watch later.</p>
<p>I used a free account for years, but earlier this year switched to a paid account. Given the amount of time I spend playing
and studying on this server it&rsquo;s a bargain. Android uses should take note that <a href="http://www.gokgs.com/help/androidInfo.html">the $15 app</a> comes with two months of KGS+ included. If I had an
Android phone, I would buy this without hesitation. Since KGS uses Java for its client, wms has said in no uncertain terms that
there will not be an iOS version released anytime soon.</p>
<p><a href="http://www.lifein19x19.com/forum">Life in 19x19</a> has a dedicated <a href="http://www.lifein19x19.com/forum/viewforum.php?f=24">KGS forum</a> where wms posts.</p>
<h3><a href="http://www.sente.ch/software/goban/">Goban</a></h3>
<p>Goban is a client for playing against GNU Go. Computers aren&rsquo;t good at Go, but they can still crush newbies. If you&rsquo;re new the game, playing 9x9 games repeatedly against GNU Go is
a good way to get better. Start with a 4 stone handicap and keep at it until you can beat the computer with no handicap.</p>
<p>One quirk of this program is that the board size isn&rsquo;t found in the preferences. It&rsquo;s in the info drawer.</p>
<p><img src="http://img.skitch.com/20101128-qdum2q7ufgbg9asgfx375fun1j.png" alt="Goban info drawer" /></p>
<hr />
<h1>iOS</h1>
<p></p>
<h3><a href="http://www.smartgo.com/en/kifu.htm">SmartGo Kifu</a></h3>
<p>SmartGo Kifu is awesome. It&rsquo;s not without its quirks and faults, but it&rsquo;s a fine piece of software. By far the biggest thing that I use it for is the set of 2000+ <a href="http://senseis.xmp.net/?Tsumego">tsumego</a>
problems. Most of them are life &amp; death problems, with a few <a href="http://senseis.xmp.net/?FusekiPages">fuseki</a> and <a href="http://senseis.xmp.net/?Tesuji">tesuji</a> problems
thrown in. They are organized by difficulty, and problems that you get wrong are marked
so that you can go back and retry them later. It&rsquo;s similar to Go Grinder, but I like the SmartGo interface much better.</p>
<p>A major feature that I am just starting to use is the database of 31,000 professional games. Only 20 are annotated, and the review features are not as easy to use as KGS.
I&rsquo;m not strong enough to get much out of a pro game that isn&rsquo;t commented. I would guess that stronger players would have a lot of fun with a portable database like this.</p>
<p>There&rsquo;s an AI, with all the caveats of computers being weaker than humans. It still plays a decent 9x9 game, and will destroy newbies who don&rsquo;t take a handicap.</p>
<p>You can play against other humans, but only on the same devise. There is no network play built in. I haven&rsquo;t found this to be an issue, since I play online via KGS or just
use one of the turn-based web sites for playing on the iPad. It keeps a history of games played, organized by player, so you can review your games later.</p>
<p><img src="http://www.smartgo.com/img/kifu1.png" alt="SmartGo Kifu" /></p>
<p>iPhone users should check out SmartGo Pro. It&rsquo;s the predecessor to Kifu, and has the pro database and the Go problems included.</p>
<h3><a href="http://zombieprocess.org/">Tengen Go</a></h3>
<p>Tengen is a decent, not great, Go client for IGS. I&rsquo;m not a fan of IGS to begin with, but when I absolutely must play a real-time game on the iPad it&rsquo;s the only
option that I&rsquo;m aware of. (There&rsquo;s another iPhone IGS client called Tetsuki, but uninstalled it after having connection problems.)</p>
<p><img src="http://a1.phobos.apple.com/us/r1000/020/Purple/62/ee/42/mzl.qarpdsiw.480x480-75.jpg" alt="Tengen" /></p>
<hr />
<h1>Web</h1>
<p>A nice bonus with web-based Go servers is that they are equally useful on the Mac and the mobile devices. Almost all of the Go games that I play with
the iPad are done on a web server.</p>
<h3><a href="http://go.davepeck.org/">Dave Peck Go</a></h3>
<p>This is a simple, yet polished, web client for playing turn-based games. There are no accounts, game histories, archives, or rankings.
You set up a game, plug in the email addresses of both players, and then each of you receive a link in your email and
a reminder when it&rsquo;s your turn. It runs on Google&rsquo;s App Engine, and is an <a href="https://github.com/davepeck/appengine-go/">open source project</a>.</p>
<p>Here is a game in progress. The JavaScript controls work just fine on mobile Safari.</p>
<p><img src="http://img.skitch.com/20101128-fmhw1gsqyi7t12cunayh1ejxx1.png" alt="Dave Peck game" /></p>
<h3><a href="http://www.dragongoserver.net/">Dragon Go Server [DGS]</a></h3>
<p>DGS is a full-featured server with accounts, ratings, a ton of game options, and a generally pleasant user base. I usually start or join games with extremely
long time controls, averaging less than one move per day. Many people on this server are fine with such slow games, and are typically involved with multiple
games at once. The interface is usable, and generally doesn&rsquo;t get in your way. You click where you want to move then confirm the move. You can pull up lists
of your games, completed or in progress. Reviews need to be done externally, which usually means that you download the SGF file and load it in CGoban (the KGS client).</p>
<p><img src="http://img.skitch.com/20101128-83h2mc52uyi3jq87h12bgjrx8f.png" alt="DGS game completed" /></p>
Rails 2.3.* + Metal + Sinatra + Builder == Boomhttp://www.workingasintended.com/2010/09/22/rails-23--metal--sinatra--builder--boom/2010-09-222010-09-22jdl<p>I ran into a bug in <a href="http://github.com/binarylogic/authlogic">authlogic</a>,
<a href="http://github.com/jdl/authlogic">forked it</a>, and made a
<a href="http://github.com/jdl/authlogic/commit/368a77980d675748af2a655d206db83ec8343e88">trivial fix</a>. I&rsquo;ll request a push back into the main repository, but with nearly 500 active forks I&rsquo;m guessing that those are rarely accepted. This is the summary that I added to the readme file.</p>
<blockquote><p>Very simply, this is a fork of authlogic 2.1.6 that fixes a bug in the sinatra_adapter. I didn&rsquo;t change anything else related to the core functionality of authlogic. The symptoms of the bug are as follows.</p>
<p>You are running:</p>
<ul>
<li>Rails 2.3.*</li>
<li>authlogic for some regular controllers</li>
<li>Sinatra from the metal directory, but not using authlogic for any of those classes</li>
<li>Builder</li>
</ul>
<p>What happens is that even though you don&rsquo;t care about using authlogic in your Sinatra classes, the use of Builder ultimately triggers the code that checks for the existence of the Sinatra class, which causes authlogic to load its adapter. The adapter is trying to inlcude itself into Sinatra::Request, when it should be using Sinatra::Base.</p>
<p>WARNING: I have no idea if authlogic actually works with Sinatra, because I don&rsquo;t care if it does or not. I just wanted my app to stop exploding during boot. I&rsquo;m using authlogic for my Rails controllers, not my Sinatra classes.</p></blockquote>
<ul>
<li><a href="http://github.com/jdl/authlogic">github</a></li>
<li><a href="https://rubygems.org/gems/jdl-authlogic">RubyGems</a></li>
<li>Bundler command:
gem &lsquo;jdl-authlogic&rsquo;, &lsquo;2.1.6.2&rsquo;, :require => &ldquo;authlogic&rdquo;</li>
</ul>
<p>I ran into a bug in <a href="http://github.com/binarylogic/authlogic">authlogic</a>,
<a href="http://github.com/jdl/authlogic">forked it</a>, and made a
<a href="http://github.com/jdl/authlogic/commit/368a77980d675748af2a655d206db83ec8343e88">trivial fix</a>. I&rsquo;ll request a push back into the main repository, but with nearly 500 active forks I&rsquo;m guessing that those are rarely accepted. This is the summary that I added to the readme file.</p>
<blockquote><p>Very simply, this is a fork of authlogic 2.1.6 that fixes a bug in the sinatra_adapter. I didn&rsquo;t change anything else related to the core functionality of authlogic. The symptoms of the bug are as follows.</p>
<p>You are running:</p>
<ul>
<li>Rails 2.3.*</li>
<li>authlogic for some regular controllers</li>
<li>Sinatra from the metal directory, but not using authlogic for any of those classes</li>
<li>Builder</li>
</ul>
<p>What happens is that even though you don&rsquo;t care about using authlogic in your Sinatra classes, the use of Builder ultimately triggers the code that checks for the existence of the Sinatra class, which causes authlogic to load its adapter. The adapter is trying to inlcude itself into Sinatra::Request, when it should be using Sinatra::Base.</p>
<p>WARNING: I have no idea if authlogic actually works with Sinatra, because I don&rsquo;t care if it does or not. I just wanted my app to stop exploding during boot. I&rsquo;m using authlogic for my Rails controllers, not my Sinatra classes.</p></blockquote>
<ul>
<li><a href="http://github.com/jdl/authlogic">github</a></li>
<li><a href="https://rubygems.org/gems/jdl-authlogic">RubyGems</a></li>
<li>Bundler command:
gem &lsquo;jdl-authlogic&rsquo;, &lsquo;2.1.6.2&rsquo;, :require => &ldquo;authlogic&rdquo;</li>
</ul>
Switching from OS X to Ubuntu?http://www.workingasintended.com/2010/08/19/switching-from-os-x-to-ubuntu/2010-08-192010-08-19jdl<p><em>If you aren&rsquo;t interested in a long, drawn-out navel-gazing session regarding my choice in laptops, hit abort now. You have been warned.</em></p>
<h4>The Dilemma</h4>
<p>My current computer for daily work is a <a href="http://www.everymac.com/systems/apple/macbook_pro/stats/macbook-pro-core-2-duo-2.16-15-specs.html">2006 MacBook Pro</a>. It&rsquo;s stock, except for the RAM which I upgraded to 3 GB. I love this machine, but it&rsquo;s showing its age and probably should be replaced soon. I&rsquo;m looking at a 15" MBP with an i7 processor, 8 GB RAM, 500 GB HDD, and the anti-glare screen. This would be a <em>gigantic</em> step up from what I&rsquo;m currently running. The problem is that it&rsquo;s nearly $3000 to get this to my door.</p>
<p>Looking at a semi-comparable laptop from <a href="http://www.system76.com/product_info.php?cPath=28&products_id=99">system76</a>, I can save around $1000 by going this route. One immediate downside is that all of the screen options are of the super glossy variety, which in my limited searching appears to be the norm for PC laptops these days. Why is it so hard to imagine that people would want an anti-glare screen? Another downside is that there&rsquo;s not a system76 Genius Bar five miles away from me. I haven&rsquo;t had a lot of interaction with the local Apple Store, but when I have had trouble they&rsquo;ve been helpful.</p>
<p>Since I&rsquo;m likely going to use this next laptop for 3+ years, the cost difference works out to around $30 per month over the life of the machine &ndash; yes, minus the present value of money for you finance types. Still, $1000 is $1000 and I&rsquo;d rather not spend it if I don&rsquo;t have to. What this decision will ultimately come down to is software.</p>
<h4>Operating Systems</h4>
<p>With the MBP I&rsquo;d be running OS X (duh) and occasionally Win XP via VMware. The system76 laptop would primarily run Ubuntu 10.04 and Win XP via either dual-booting or VMware.</p>
<h4>The Easy Part: Software that exists for both systems</h4>
<p>Given that most of my work involves programming Ruby and/or Java code, most of the tools that I use are readily available on OS X and Ubuntu.</p>
<ul>
<li>vim</li>
<li>MySQL + PostgreSQL</li>
<li>DbVisualizer</li>
<li>Charles Proxy: A damn good HTTP tracing tool. I don&rsquo;t use it often, but when it&rsquo;s needed it&rsquo;s golden.</li>
<li>Firefox (Firebug is an important factor here.)</li>
<li>Ruby and Java are both supported just fine on either system, and I&rsquo;m not aware of any gems or libraries that I use on one that won&rsquo;t work on the other. Given that I generally develop on OS X for deployment on Linux, this is a good thing. This also includes various other languages that I play with. Unless I plan to start developing iPhone apps, which I don&rsquo;t, languages and frameworks won&rsquo;t be a big factor.</li>
</ul>
<h4>The Moderately Difficult Part: Software that probably has a usable alternative on Linux</h4>
<ul>
<li>Mailplane: Obviously, I can access all of my various Gmail accounts via Firefox. It&rsquo;s more of a pain that way, however. Having a count of unread messages for all of my accounts is also convenient.</li>
<li>Propane: This is a Campfire client. We use Campfire constantly at <a href="http://www.zencoder.com/">Zencoder</a>. This is another case where I could use the web app, but the client app is really nice.</li>
<li>OmniOutliner + OmniFocus: I use them, but I don&rsquo;t rely on them and could easily live without them.</li>
<li>Skitch: It sounds dumb that a screen shot tool would make this list, but Skitch is so damn good it&rsquo;s scary. I still do not understand why they are not charging for their app or their service. Simple idea, brilliantly executed.</li>
<li>Terminal: I&rsquo;m used to the short cuts and behavior of the OS X Terminal app. There are plenty of options for Linux (obviously), but it will take a while to get used to the new command keys.</li>
</ul>
<h4>The Extra Painful Part: Can I live without these apps?</h4>
<ul>
<li>1Password: This is a big deal, because I use 1Password so frequently. It&rsquo;s a fantastic piece of software. As an added bonus, since I keep my key file in Dropbox my passwords are automatically synchronized between my laptop and Mac Mini.</li>
<li>OmniGraffle: I have yet to see its equal in terms of simplicity and output quality when driven by a non-artist / non-designer like me. This helps me make diagrams that look good, and it&rsquo;s dead simple to use. I also have the iPad version, but that&rsquo;s not really as good (yet).</li>
<li>Netflix Instant View: I rarely watch movies on my laptop, but it does happen. There is no reasonable way to accomplish this on Linux. I could use the iPad, but the current iPad Netflix app is awful.</li>
<li>iTunes: I guess I&rsquo;d have to sync the iPad to the Mini. I probably use this app way more than I realize, given that I&rsquo;m constantly listening to podcasts and music.</li>
</ul>
<h4>The [OS]X-Factor</h4>
<p>Over the last 15 years I&rsquo;ve jumped around between Mac and Linux. To me, OS X was the grail that the Linux world was looking for &ndash; a killer desktop UI on top of Unix. Maybe it&rsquo;s silly to switch back to Linux after so many years on OS X. The price tag is at least making me seriously consider it though.</p>
<p><em>If you aren&rsquo;t interested in a long, drawn-out navel-gazing session regarding my choice in laptops, hit abort now. You have been warned.</em></p>
<h4>The Dilemma</h4>
<p>My current computer for daily work is a <a href="http://www.everymac.com/systems/apple/macbook_pro/stats/macbook-pro-core-2-duo-2.16-15-specs.html">2006 MacBook Pro</a>. It&rsquo;s stock, except for the RAM which I upgraded to 3 GB. I love this machine, but it&rsquo;s showing its age and probably should be replaced soon. I&rsquo;m looking at a 15" MBP with an i7 processor, 8 GB RAM, 500 GB HDD, and the anti-glare screen. This would be a <em>gigantic</em> step up from what I&rsquo;m currently running. The problem is that it&rsquo;s nearly $3000 to get this to my door.</p>
<p>Looking at a semi-comparable laptop from <a href="http://www.system76.com/product_info.php?cPath=28&products_id=99">system76</a>, I can save around $1000 by going this route. One immediate downside is that all of the screen options are of the super glossy variety, which in my limited searching appears to be the norm for PC laptops these days. Why is it so hard to imagine that people would want an anti-glare screen? Another downside is that there&rsquo;s not a system76 Genius Bar five miles away from me. I haven&rsquo;t had a lot of interaction with the local Apple Store, but when I have had trouble they&rsquo;ve been helpful.</p>
<p>Since I&rsquo;m likely going to use this next laptop for 3+ years, the cost difference works out to around $30 per month over the life of the machine &ndash; yes, minus the present value of money for you finance types. Still, $1000 is $1000 and I&rsquo;d rather not spend it if I don&rsquo;t have to. What this decision will ultimately come down to is software.</p>
<h4>Operating Systems</h4>
<p>With the MBP I&rsquo;d be running OS X (duh) and occasionally Win XP via VMware. The system76 laptop would primarily run Ubuntu 10.04 and Win XP via either dual-booting or VMware.</p>
<h4>The Easy Part: Software that exists for both systems</h4>
<p>Given that most of my work involves programming Ruby and/or Java code, most of the tools that I use are readily available on OS X and Ubuntu.</p>
<ul>
<li>vim</li>
<li>MySQL + PostgreSQL</li>
<li>DbVisualizer</li>
<li>Charles Proxy: A damn good HTTP tracing tool. I don&rsquo;t use it often, but when it&rsquo;s needed it&rsquo;s golden.</li>
<li>Firefox (Firebug is an important factor here.)</li>
<li>Ruby and Java are both supported just fine on either system, and I&rsquo;m not aware of any gems or libraries that I use on one that won&rsquo;t work on the other. Given that I generally develop on OS X for deployment on Linux, this is a good thing. This also includes various other languages that I play with. Unless I plan to start developing iPhone apps, which I don&rsquo;t, languages and frameworks won&rsquo;t be a big factor.</li>
</ul>
<h4>The Moderately Difficult Part: Software that probably has a usable alternative on Linux</h4>
<ul>
<li>Mailplane: Obviously, I can access all of my various Gmail accounts via Firefox. It&rsquo;s more of a pain that way, however. Having a count of unread messages for all of my accounts is also convenient.</li>
<li>Propane: This is a Campfire client. We use Campfire constantly at <a href="http://www.zencoder.com/">Zencoder</a>. This is another case where I could use the web app, but the client app is really nice.</li>
<li>OmniOutliner + OmniFocus: I use them, but I don&rsquo;t rely on them and could easily live without them.</li>
<li>Skitch: It sounds dumb that a screen shot tool would make this list, but Skitch is so damn good it&rsquo;s scary. I still do not understand why they are not charging for their app or their service. Simple idea, brilliantly executed.</li>
<li>Terminal: I&rsquo;m used to the short cuts and behavior of the OS X Terminal app. There are plenty of options for Linux (obviously), but it will take a while to get used to the new command keys.</li>
</ul>
<h4>The Extra Painful Part: Can I live without these apps?</h4>
<ul>
<li>1Password: This is a big deal, because I use 1Password so frequently. It&rsquo;s a fantastic piece of software. As an added bonus, since I keep my key file in Dropbox my passwords are automatically synchronized between my laptop and Mac Mini.</li>
<li>OmniGraffle: I have yet to see its equal in terms of simplicity and output quality when driven by a non-artist / non-designer like me. This helps me make diagrams that look good, and it&rsquo;s dead simple to use. I also have the iPad version, but that&rsquo;s not really as good (yet).</li>
<li>Netflix Instant View: I rarely watch movies on my laptop, but it does happen. There is no reasonable way to accomplish this on Linux. I could use the iPad, but the current iPad Netflix app is awful.</li>
<li>iTunes: I guess I&rsquo;d have to sync the iPad to the Mini. I probably use this app way more than I realize, given that I&rsquo;m constantly listening to podcasts and music.</li>
</ul>
<h4>The [OS]X-Factor</h4>
<p>Over the last 15 years I&rsquo;ve jumped around between Mac and Linux. To me, OS X was the grail that the Linux world was looking for &ndash; a killer desktop UI on top of Unix. Maybe it&rsquo;s silly to switch back to Linux after so many years on OS X. The price tag is at least making me seriously consider it though.</p>
Gem collision -- heroku 1.9.1 and json_pure 1.4.3http://www.workingasintended.com/2010/07/02/gem-collision----heroku-191-and-jsonpure-143/2010-07-022010-07-02jdl<p>Simple problem with a simple solution. The new json_pure (1.4.3) makes older heroku gems explode.</p>
<h4>Symptoms</h4>
<p><code>
$ heroku console<br/>
/Users/jdl/.rvm/rubies/ruby-1.8.7-p248/lib/ruby/site_ruby/1.8/rubygems.rb:233:in `activate': can&rsquo;t activate json_pure (~> 1.2.0, runtime) for [&ldquo;heroku-1.9.1&rdquo;], already activated json_pure-1.4.3 for [&ldquo;gemcutter-0.5.0&rdquo;] (Gem::LoadError)
</code></p>
<h4>Gems involved in this collision</h4>
<p><code>
$ gem list &ndash;local | ack &ldquo;(json_pure|heroku)&rdquo;<br/>
heroku (1.9.1, 1.6.3)<br/>
json_pure (1.4.3, 1.2.4)
</code></p>
<h4>The solution</h4>
<p><code>
$ gem install heroku<br/>
Successfully installed heroku-1.9.11
</code></p>
<p>Simple problem with a simple solution. The new json_pure (1.4.3) makes older heroku gems explode.</p>
<h4>Symptoms</h4>
<p><code>
$ heroku console<br/>
/Users/jdl/.rvm/rubies/ruby-1.8.7-p248/lib/ruby/site_ruby/1.8/rubygems.rb:233:in `activate': can&rsquo;t activate json_pure (~> 1.2.0, runtime) for [&ldquo;heroku-1.9.1&rdquo;], already activated json_pure-1.4.3 for [&ldquo;gemcutter-0.5.0&rdquo;] (Gem::LoadError)
</code></p>
<h4>Gems involved in this collision</h4>
<p><code>
$ gem list &ndash;local | ack &ldquo;(json_pure|heroku)&rdquo;<br/>
heroku (1.9.1, 1.6.3)<br/>
json_pure (1.4.3, 1.2.4)
</code></p>
<h4>The solution</h4>
<p><code>
$ gem install heroku<br/>
Successfully installed heroku-1.9.11
</code></p>
Rails accepts_nested_attributes_for and fields_forhttp://www.workingasintended.com/2010/07/01/rails-acceptsnestedattributesfor-and-fieldsfor/2010-07-012010-07-01jdl<p>I ran into a gotcha today while trying to combine accepts_nested_attributes_for in my model and fields_for in my view (via <a href="http://github.com/justinfrench/formtastic">formtastic</a>). The symptom was that none of my nested fields were showing up at all. The root cause was that the parent model didn&rsquo;t have an instance of the child model.</p>
<p>The solution was to make sure that I added <code>@parent.build_child</code> in my controller&rsquo;s <code>edit</code> and <code>new</code> actions to make sure that the associated model wasn&rsquo;t nil.</p>
<script src="http://gist.github.com/460555.js?file=accepts_nested_attributes_for.rb"></script>
<p>I ran into a gotcha today while trying to combine accepts_nested_attributes_for in my model and fields_for in my view (via <a href="http://github.com/justinfrench/formtastic">formtastic</a>). The symptom was that none of my nested fields were showing up at all. The root cause was that the parent model didn&rsquo;t have an instance of the child model.</p>
<p>The solution was to make sure that I added <code>@parent.build_child</code> in my controller&rsquo;s <code>edit</code> and <code>new</code> actions to make sure that the associated model wasn&rsquo;t nil.</p>
<script src="http://gist.github.com/460555.js?file=accepts_nested_attributes_for.rb"></script>
Reducing memory footprint of CrashPlan on OS Xhttp://www.workingasintended.com/2010/05/13/reducing-memory-footprint-of-crashplan-on-os-x/2010-05-132010-05-13jdl<p>I noticed that since switching to Snow Leopard, CrashPlan was using over 500 MB of RAM in some cases.</p>
<p><a href="https://twitter.com/dornquast">Matthew Dornquast</a> <a href="https://crashplan.zendesk.com/entries/116068">posted some good info on the CrashPlan support forums</a> related to the memory footprint
of CrashPlan on OS X (and on JVM&rsquo;s in general).</p>
<blockquote>
CrashPlan doesn't actually NEED all that ram, it's not using it. Shrink the
amount allowed to something smaller.. 80MB, 100MB, etc. How much you need
depends on how much you're backing up. I would start at 100MB and work from
there. You'll know you've gone too low if you get out of memory errors in
the log. For small backup sets, you can do 50MB.
</blockquote>
<script src="http://gist.github.com/400479.js"></script>
<p>So far it seems to be working fine.</p>
<p>I noticed that since switching to Snow Leopard, CrashPlan was using over 500 MB of RAM in some cases.</p>
<p><a href="https://twitter.com/dornquast">Matthew Dornquast</a> <a href="https://crashplan.zendesk.com/entries/116068">posted some good info on the CrashPlan support forums</a> related to the memory footprint
of CrashPlan on OS X (and on JVM&rsquo;s in general).</p>
<blockquote>
CrashPlan doesn't actually NEED all that ram, it's not using it. Shrink the
amount allowed to something smaller.. 80MB, 100MB, etc. How much you need
depends on how much you're backing up. I would start at 100MB and work from
there. You'll know you've gone too low if you get out of memory errors in
the log. For small backup sets, you can do 50MB.
</blockquote>
<script src="http://gist.github.com/400479.js"></script>
<p>So far it seems to be working fine.</p>
Choosing a different Rails database.yml file for JRubyhttp://www.workingasintended.com/2010/05/03/choosing-a-different-rails-databaseyml-file-for-jruby/2010-05-032010-05-03jdl<p>
I'm working on a Rails project where I need to run under both normal C-based ruby and JRuby.
I was annoyed that when running under JRuby, I had to set the
adapter to 'jdbcmysql' instead of 'mysql'. I had to switch back and forth
a lot, and I really didn't want to set up separate environments just for
the choice of Ruby interpreter.
</p>
<script src="http://gist.github.com/388287.js"></script>
<p>
I'm working on a Rails project where I need to run under both normal C-based ruby and JRuby.
I was annoyed that when running under JRuby, I had to set the
adapter to 'jdbcmysql' instead of 'mysql'. I had to switch back and forth
a lot, and I really didn't want to set up separate environments just for
the choice of Ruby interpreter.
</p>
<script src="http://gist.github.com/388287.js"></script>
Fixing the MySQL Ruby Gem on OS X 10.4http://www.workingasintended.com/2010/03/03/fixing-the-mysql-ruby-gem-on-os-x-104/2010-03-032010-03-03jdl<p>Yes, there are a billion posts about this very topic. I&rsquo;ve installed this gem many times, and it&rsquo;s always annoying. Rather than go through the hassle of installing the gem, watching the compile fail, fixing the ulong define in the gem source code, regenerating the Makefile, and then making the gem again, there&rsquo;s an easier way.</p>
<p>In &ldquo;/usr/local/mysql/include/typelib.h&rdquo; (or wherever you have MySQL installed), add the following.</p>
<pre>
<code class="c">#define ulong unsigned long</code>
</pre>
<p>Now the <code>gem</code> command should work fine.</p>
<pre>
<code>$ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config</code>
</pre>
<p>Yes, there are a billion posts about this very topic. I&rsquo;ve installed this gem many times, and it&rsquo;s always annoying. Rather than go through the hassle of installing the gem, watching the compile fail, fixing the ulong define in the gem source code, regenerating the Makefile, and then making the gem again, there&rsquo;s an easier way.</p>
<p>In &ldquo;/usr/local/mysql/include/typelib.h&rdquo; (or wherever you have MySQL installed), add the following.</p>
<pre>
<code class="c">#define ulong unsigned long</code>
</pre>
<p>Now the <code>gem</code> command should work fine.</p>
<pre>
<code>$ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config</code>
</pre>
Almost Famous: Guo Juan uses one of my games in her Go lecture.http://www.workingasintended.com/2010/08/02/almost-famous-guo-juan-uses-one-of-my-games-in-her-go-lecture/2010-08-022010-08-02jdl<p>As I was watching the 2nd <a href="http://senseis.xmp.net/?WhatIsGo">Go</a> lecture in <a href="http://senseis.xmp.net/?GuoJuan">Guo Juan&rsquo;s</a> latest series, &ldquo;<a href="http://internetgoschool.com/lecture.vhtml?ls_id=580">Invasions for Kyu Players</a>&rdquo; one of the examples surprised me. It dawned on me that I was looking at one of my own games.</p>
<p>From earlier this term in her online group class, one of my classmates and I spent quite a while reviewing this position. During class Guo Juan talked about it quite a bit, and then it silently made its way into this lecture.</p>
<p><img src="http://img.skitch.com/20100209-8a1j5y2iiug155wfmkn1kht9ar.png" /></p>
<p>In the game, I&rsquo;m playing black. White got himself into big trouble with 3. I won&rsquo;t spoil the analysis, but this particular exercise revolves around the 1-2 exchange prior to the invasion. While we spent a lot of time between ourselves discussing 3, the pro backed us up two moves and explained what was really going on.</p>
<p>At 8 kyu, I&rsquo;m finding most of the questions in this series to be on the easy side. However, it&rsquo;s driving home some fundamental points about invasions that have made it worth watching. Direction of play is one of my major leaks, so this type of basic instruction is perfect for me right now.</p>
<p>As I was watching the 2nd <a href="http://senseis.xmp.net/?WhatIsGo">Go</a> lecture in <a href="http://senseis.xmp.net/?GuoJuan">Guo Juan&rsquo;s</a> latest series, &ldquo;<a href="http://internetgoschool.com/lecture.vhtml?ls_id=580">Invasions for Kyu Players</a>&rdquo; one of the examples surprised me. It dawned on me that I was looking at one of my own games.</p>
<p>From earlier this term in her online group class, one of my classmates and I spent quite a while reviewing this position. During class Guo Juan talked about it quite a bit, and then it silently made its way into this lecture.</p>
<p><img src="http://img.skitch.com/20100209-8a1j5y2iiug155wfmkn1kht9ar.png" /></p>
<p>In the game, I&rsquo;m playing black. White got himself into big trouble with 3. I won&rsquo;t spoil the analysis, but this particular exercise revolves around the 1-2 exchange prior to the invasion. While we spent a lot of time between ourselves discussing 3, the pro backed us up two moves and explained what was really going on.</p>
<p>At 8 kyu, I&rsquo;m finding most of the questions in this series to be on the easy side. However, it&rsquo;s driving home some fundamental points about invasions that have made it worth watching. Direction of play is one of my major leaks, so this type of basic instruction is perfect for me right now.</p>
Adding a Java Web Start application to the OS X 10.5 dock.http://www.workingasintended.com/2009/10/10/adding-a-java-web-start-application-to-the-os-x-105-dock/2009-10-102009-10-10jdl<pre><code>$ javaws /path/to/file.jnlp</code></pre>
<p>That works fine from a terminal window, but it was bugging me, because I was sure that there must be a way to launch these apps from the dock. And sure enough, it&rsquo;s dead simple.</p>
<ol>
<li>Launch /Applications/Utilities/Java Preferences.app</li>
<li>Select the Network tab.</li>
<li>Click the View Cache Files button.</li>
<li>Right-click on the app and select Install Shortcuts.</li>
</ol>
<p>This lets you save an app file, which you can then drag onto the dock.</p>
<div class="thumbnail"><a href="http://skitch.com/jdludlow/nnikp/java-preferences"><img src="http://img.skitch.com/20091010-cx2hb3fnr7rdfx173jyp2ep5ep.preview.jpg" alt="Java Preferences" /></a><br /><span style="font-family: Lucida Grande, Trebuchet, sans-serif, Helvetica, Arial; font-size: 10px; color: #808080">Uploaded with <a href="http://plasq.com/">plasq</a>'s <a href="http://skitch.com">Skitch</a>!</span></div>
<div class="thumbnail"><a href="http://skitch.com/jdludlow/nnimd/java-cache-viewer"><img src="http://img.skitch.com/20091010-r3gx46w4ptfimmc723siqm47ph.preview.jpg" alt="Java Cache Viewer" /></a><br /><span style="font-family: Lucida Grande, Trebuchet, sans-serif, Helvetica, Arial; font-size: 10px; color: #808080">Uploaded with <a href="http://plasq.com/">plasq</a>'s <a href="http://skitch.com">Skitch</a>!</span></div>
<pre><code>$ javaws /path/to/file.jnlp</code></pre>
<p>That works fine from a terminal window, but it was bugging me, because I was sure that there must be a way to launch these apps from the dock. And sure enough, it&rsquo;s dead simple.</p>
<ol>
<li>Launch /Applications/Utilities/Java Preferences.app</li>
<li>Select the Network tab.</li>
<li>Click the View Cache Files button.</li>
<li>Right-click on the app and select Install Shortcuts.</li>
</ol>
<p>This lets you save an app file, which you can then drag onto the dock.</p>
<div class="thumbnail"><a href="http://skitch.com/jdludlow/nnikp/java-preferences"><img src="http://img.skitch.com/20091010-cx2hb3fnr7rdfx173jyp2ep5ep.preview.jpg" alt="Java Preferences" /></a><br /><span style="font-family: Lucida Grande, Trebuchet, sans-serif, Helvetica, Arial; font-size: 10px; color: #808080">Uploaded with <a href="http://plasq.com/">plasq</a>'s <a href="http://skitch.com">Skitch</a>!</span></div>
<div class="thumbnail"><a href="http://skitch.com/jdludlow/nnimd/java-cache-viewer"><img src="http://img.skitch.com/20091010-r3gx46w4ptfimmc723siqm47ph.preview.jpg" alt="Java Cache Viewer" /></a><br /><span style="font-family: Lucida Grande, Trebuchet, sans-serif, Helvetica, Arial; font-size: 10px; color: #808080">Uploaded with <a href="http://plasq.com/">plasq</a>'s <a href="http://skitch.com">Skitch</a>!</span></div>
Single-digit-kyu achievedhttp://www.workingasintended.com/2009/08/18/single-digit-kyu-achieved/2009-08-182009-08-18jdl<p>I&rsquo;ve defended my 9 <a href="http://senseis.xmp.net/?Kyu">kyu</a> rank on KGS, so I&rsquo;m declaring success in my personal goal to reach single-digit-kyu by the end of 2009. The defense happened a while ago, but I waited to see if KGS dropped me back to 10k or if I&rsquo;m solid in my new rank.</p>
<p>I put in a lot of time reading, studying, and drilling this year &ndash; more than ever before. I also greatly increased the number of games that I played, both online and with my good friend Josh 5k. So, even though &ldquo;kyu&rdquo; still means that I&rsquo;m terrible, I&rsquo;m proud of the advancement.</p>
<div class="thumbnail"><a href="http://skitch.com/jdludlow/b55ca/kgs-edit-user"><img src="http://img.skitch.com/20090819-8hmnrgshw95mt284ujf8c29wmk.preview.jpg" alt="KGS: Edit User" /></a><br /><span style="font-family: Lucida Grande, Trebuchet, sans-serif, Helvetica, Arial; font-size: 10px; color: #808080">Uploaded with <a href="http://plasq.com/">plasq</a>'s <a href="http://skitch.com">Skitch</a>!</span></div>
<p>I&rsquo;ve defended my 9 <a href="http://senseis.xmp.net/?Kyu">kyu</a> rank on KGS, so I&rsquo;m declaring success in my personal goal to reach single-digit-kyu by the end of 2009. The defense happened a while ago, but I waited to see if KGS dropped me back to 10k or if I&rsquo;m solid in my new rank.</p>
<p>I put in a lot of time reading, studying, and drilling this year &ndash; more than ever before. I also greatly increased the number of games that I played, both online and with my good friend Josh 5k. So, even though &ldquo;kyu&rdquo; still means that I&rsquo;m terrible, I&rsquo;m proud of the advancement.</p>
<div class="thumbnail"><a href="http://skitch.com/jdludlow/b55ca/kgs-edit-user"><img src="http://img.skitch.com/20090819-8hmnrgshw95mt284ujf8c29wmk.preview.jpg" alt="KGS: Edit User" /></a><br /><span style="font-family: Lucida Grande, Trebuchet, sans-serif, Helvetica, Arial; font-size: 10px; color: #808080">Uploaded with <a href="http://plasq.com/">plasq</a>'s <a href="http://skitch.com">Skitch</a>!</span></div>
Firefox 3.5.2 and XMLHttpRequest.setRequestHeader()http://www.workingasintended.com/2009/08/10/firefox-352-and-xmlhttprequestsetrequestheader/2009-08-102009-08-10jdl<p>It appears that Firefox 3.5.2 broke XMLHttpRequest.setRequestHeader(). According to the <a href="http://web5.w3.org/TR/XMLHttpRequest/#setrequestheader">W3C docs</a>, in giant bold green type:</p>
<p><span style="color: #339966;"><strong>The setRequestHeader() method appends a value if the HTTP header given as argument is already part of the list of request headers.</strong></span></p>
<p>Rather than appending, it&rsquo;s overwriting the existing value entirely.</p>
<p>The particular case where I ran into this was when using jQuery to send a remote form request. My setup code includes the following line.</p>
<pre>
<code class="javascript">jQuery.ajaxSetup({
'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")}
});</code>
</pre>
<p>When firing off an Ajax remote form request with Safari or older (pre-3.5) versions of Firefox, the header would contain the following.</p>
<pre>
<code class="no-highlight">Accept: application/javascript, */*, text/javascript</code>
</pre>
<p>Or, if the browser had already decided that it was going to accept text/javascript, at worst I&rsquo;d get a duplicate.</p>
<pre>
<code class="no-highlight">Accept: text/javascript, application/javascript, */*, text/javascript</code>
</pre>
<p>With Firefox 3.5.2 I see this instead.</p>
<pre>
<code class="no-highlight">Accept: text/javascript</code>
</pre>
<p>And the HTTP error returned from the server.</p>
<pre>
<code class="no-highlight">406 Not Acceptable</code>
</pre>
<p>The workaround is simple.</p>
<pre>
<code class="javascript">xhr.setRequestHeader("Accept", "text/javascript,application/javascript,text/html")</code>
</pre>
<p>I have to set that header parameter with all of the types that should be accepted as a response to a remote form request.</p>
<p>The downside to this is that non-broken browsers almost defintely include duplicate values, but at least it still works.</p>
<p>Ex.: Safari with the workaround in place.</p>
<pre>
<code class="no-highlight">Accept: text/javascript, application/javascript, */*, text/javascript,application/javascript,text/html</code>
</pre>
<p>It appears that Firefox 3.5.2 broke XMLHttpRequest.setRequestHeader(). According to the <a href="http://web5.w3.org/TR/XMLHttpRequest/#setrequestheader">W3C docs</a>, in giant bold green type:</p>
<p><span style="color: #339966;"><strong>The setRequestHeader() method appends a value if the HTTP header given as argument is already part of the list of request headers.</strong></span></p>
<p>Rather than appending, it&rsquo;s overwriting the existing value entirely.</p>
<p>The particular case where I ran into this was when using jQuery to send a remote form request. My setup code includes the following line.</p>
<pre>
<code class="javascript">jQuery.ajaxSetup({
'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")}
});</code>
</pre>
<p>When firing off an Ajax remote form request with Safari or older (pre-3.5) versions of Firefox, the header would contain the following.</p>
<pre>
<code class="no-highlight">Accept: application/javascript, */*, text/javascript</code>
</pre>
<p>Or, if the browser had already decided that it was going to accept text/javascript, at worst I&rsquo;d get a duplicate.</p>
<pre>
<code class="no-highlight">Accept: text/javascript, application/javascript, */*, text/javascript</code>
</pre>
<p>With Firefox 3.5.2 I see this instead.</p>
<pre>
<code class="no-highlight">Accept: text/javascript</code>
</pre>
<p>And the HTTP error returned from the server.</p>
<pre>
<code class="no-highlight">406 Not Acceptable</code>
</pre>
<p>The workaround is simple.</p>
<pre>
<code class="javascript">xhr.setRequestHeader("Accept", "text/javascript,application/javascript,text/html")</code>
</pre>
<p>I have to set that header parameter with all of the types that should be accepted as a response to a remote form request.</p>
<p>The downside to this is that non-broken browsers almost defintely include duplicate values, but at least it still works.</p>
<p>Ex.: Safari with the workaround in place.</p>
<pre>
<code class="no-highlight">Accept: text/javascript, application/javascript, */*, text/javascript,application/javascript,text/html</code>
</pre>
Adding new file types to "Ack in Project" TextMate bundlehttp://www.workingasintended.com/2009/07/07/adding-new-file-types-to-ack-in-project-textmate-bundle/2009-07-072009-07-07jdl<p>If you edit with TextMate, but you haven&rsquo;t yet installed Ack in Project, you&rsquo;re missing out. It&rsquo;s much faster than TextMate&rsquo;s built-in search. My preferred fork of this bundle is <a href="http://github.com/kemayo/ack-tmbundle/tree">David Lynch&rsquo;s</a>, which adds a pull down menu of file types to focus your search on.</p>
<div class="thumbnail"><a href="http://skitch.com/jdludlow/bs5fh/ack-in-project"><img src="http://img.skitch.com/20090707-qu2dmt5tdt2rgjagjrnhypw98k.preview.jpg" alt="Ack In Project" /></a><br /><span style="font-family: Lucida Grande, Trebuchet, sans-serif, Helvetica, Arial; font-size: 10px; color: #808080">Uploaded with <a href="http://plasq.com/">plasq</a>'s <a href="http://skitch.com">Skitch</a>!</span></div>
<p>One of the cool things about file types in Ack is that they&rsquo;re more like buckets of types. Looking in ack-standalone.sh, this is the default mapping for &ldquo;Ruby&rdquo; files.</p>
<pre><code>ruby => [qw( rb rhtml rjs rxml erb )]</code></pre>
<p>I wanted to include Haml in that list, so I edited the .sh file and issued a pull request for the change. David wrote back, informing me that these mappings can be modified on the command line so I dug into that a bit deeper.</p>
<p>It turns out that you can modify an existing mapping with Ack&rsquo;s <code>&ndash;type-add</code> switch. In this example, I wanted to include both .haml and .rake files to my &ldquo;ruby&rdquo; searches.</p>
<pre><code>--type-add=ruby=.haml,.rake</code></pre>
<p>You can also add a completely new type with <code>&ndash;type-set</code>.</p>
<pre><code>--type-set=haml=.haml</code></pre>
<p>Put these in ~/.ackrc with each switch on its own line.</p>
<p>The Ack docs don&rsquo;t use the equal sign after the switch name, but I found that it&rsquo;s needed for OS X. No idea why that is, but it seems to work.</p>
<p>Ack in Project will automatically pick up these changes, because it builds the pull-down menu by parsing the output of <code>ack &ndash;help=types</code>. This also makes it convenient to see if you&rsquo;ve set up your .ackrc file properly.</p>
<pre>
<code>$ ack --help=types
...
--[no]ruby .rb .rhtml .rjs .rxml .erb .haml .rake
...</code>
</pre>
<p>Yay.</p>
<p>If you edit with TextMate, but you haven&rsquo;t yet installed Ack in Project, you&rsquo;re missing out. It&rsquo;s much faster than TextMate&rsquo;s built-in search. My preferred fork of this bundle is <a href="http://github.com/kemayo/ack-tmbundle/tree">David Lynch&rsquo;s</a>, which adds a pull down menu of file types to focus your search on.</p>
<div class="thumbnail"><a href="http://skitch.com/jdludlow/bs5fh/ack-in-project"><img src="http://img.skitch.com/20090707-qu2dmt5tdt2rgjagjrnhypw98k.preview.jpg" alt="Ack In Project" /></a><br /><span style="font-family: Lucida Grande, Trebuchet, sans-serif, Helvetica, Arial; font-size: 10px; color: #808080">Uploaded with <a href="http://plasq.com/">plasq</a>'s <a href="http://skitch.com">Skitch</a>!</span></div>
<p>One of the cool things about file types in Ack is that they&rsquo;re more like buckets of types. Looking in ack-standalone.sh, this is the default mapping for &ldquo;Ruby&rdquo; files.</p>
<pre><code>ruby => [qw( rb rhtml rjs rxml erb )]</code></pre>
<p>I wanted to include Haml in that list, so I edited the .sh file and issued a pull request for the change. David wrote back, informing me that these mappings can be modified on the command line so I dug into that a bit deeper.</p>
<p>It turns out that you can modify an existing mapping with Ack&rsquo;s <code>&ndash;type-add</code> switch. In this example, I wanted to include both .haml and .rake files to my &ldquo;ruby&rdquo; searches.</p>
<pre><code>--type-add=ruby=.haml,.rake</code></pre>
<p>You can also add a completely new type with <code>&ndash;type-set</code>.</p>
<pre><code>--type-set=haml=.haml</code></pre>
<p>Put these in ~/.ackrc with each switch on its own line.</p>
<p>The Ack docs don&rsquo;t use the equal sign after the switch name, but I found that it&rsquo;s needed for OS X. No idea why that is, but it seems to work.</p>
<p>Ack in Project will automatically pick up these changes, because it builds the pull-down menu by parsing the output of <code>ack &ndash;help=types</code>. This also makes it convenient to see if you&rsquo;ve set up your .ackrc file properly.</p>
<pre>
<code>$ ack --help=types
...
--[no]ruby .rb .rhtml .rjs .rxml .erb .haml .rake
...</code>
</pre>
<p>Yay.</p>
Public penance. Me being destroyed in my latest Go game.http://www.workingasintended.com/2009/03/30/public-penance-me-being-destroyed-in-my-latest-go-game/2009-03-302009-03-30jdl<p>Bask in the ineptitude of my latest Go game. Poor decisions early, plus getting into 30 second byoyomi by move 127 made for a painful experience on my end.</p>
<p>Sensei <a href="http://www.gokgs.com/gameArchives.jsp?user=icepick">Mathews 5k</a> has kindly provided comments on this game.</p>
<p><noscript><p><i>If you had JavaScript enabled, you&rsquo;d see the EidoGo SGF viewer here.</i></p></p>
<p>
<a href="/files/woozuwa-bray-commented.sgf">You can download the SGF file anyway.</a>
</p>
<p></noscript></p>
<div class="eidogo-player-auto" sgf="/files/woozuwa-bray-commented.sgf"></div>
<p>I&rsquo;m playing black, going by the name <a href="http://www.gokgs.com/gameArchives.jsp?user=bray">Bray</a> on <a href="http://www.gokgs.com/">KGS</a>.</p>
<p>Bask in the ineptitude of my latest Go game. Poor decisions early, plus getting into 30 second byoyomi by move 127 made for a painful experience on my end.</p>
<p>Sensei <a href="http://www.gokgs.com/gameArchives.jsp?user=icepick">Mathews 5k</a> has kindly provided comments on this game.</p>
<p><noscript><p><i>If you had JavaScript enabled, you&rsquo;d see the EidoGo SGF viewer here.</i></p></p>
<p>
<a href="/files/woozuwa-bray-commented.sgf">You can download the SGF file anyway.</a>
</p>
<p></noscript></p>
<div class="eidogo-player-auto" sgf="/files/woozuwa-bray-commented.sgf"></div>
<p>I&rsquo;m playing black, going by the name <a href="http://www.gokgs.com/gameArchives.jsp?user=bray">Bray</a> on <a href="http://www.gokgs.com/">KGS</a>.</p>
TextMate test runner and "Rails requires RubyGems" errorhttp://www.workingasintended.com/2009/02/22/textmate-test-runner-and-rails-requires-rubygems-error/2009-02-222009-02-22jdl<p>Out of the blue I started getting the following error from TextMate&rsquo;s test runner for Rails tests.</p>
<pre><code>Rails requires RubyGems >= 1.1.1 (you have 1.0.1). Please `gem update --system` and try again.</code></pre>
<p>On the command line, I&rsquo;d see the following:</p>
<pre>
<code class="bash">jdl ~ $ which gem
/opt/local/bin/gem
jdl ~ $ which ruby
/opt/local/bin/ruby
jdl ~ $ gem -v
1.3.1
jdl ~ $ ruby -v
ruby 1.8.6 (2008-03-03 patchlevel 114) [i686-darwin9.3.0]</code>
</pre>
<p>Pretty clearly, TextMate was picking up the wrong Ruby installation on my system. With JRuby and at least one other &ldquo;normal&rdquo; Ruby installed, it didn&rsquo;t seem impossible. But why now? I still don&rsquo;t know the answer to that question, but I did fix the problem.</p>
<p>Digging through the TextMate Ruby bundles, I kept seeing a reference to &ldquo;TM_RUBY&rdquo;. In the advanced preferences I set this to have a value of my desired Ruby install, and everything was happy again.
<img src="http://img.skitch.com/20100412-tnypwunkmta36r47xhmmf1q95j.png" alt="Setting the TextMate TM_RUBY variable in advanced preferences" title="TextMate TM_RUBY variable" width="530" height="482" class="size-full wp-image-50" /></p>
<p>Out of the blue I started getting the following error from TextMate&rsquo;s test runner for Rails tests.</p>
<pre><code>Rails requires RubyGems >= 1.1.1 (you have 1.0.1). Please `gem update --system` and try again.</code></pre>
<p>On the command line, I&rsquo;d see the following:</p>
<pre>
<code class="bash">jdl ~ $ which gem
/opt/local/bin/gem
jdl ~ $ which ruby
/opt/local/bin/ruby
jdl ~ $ gem -v
1.3.1
jdl ~ $ ruby -v
ruby 1.8.6 (2008-03-03 patchlevel 114) [i686-darwin9.3.0]</code>
</pre>
<p>Pretty clearly, TextMate was picking up the wrong Ruby installation on my system. With JRuby and at least one other &ldquo;normal&rdquo; Ruby installed, it didn&rsquo;t seem impossible. But why now? I still don&rsquo;t know the answer to that question, but I did fix the problem.</p>
<p>Digging through the TextMate Ruby bundles, I kept seeing a reference to &ldquo;TM_RUBY&rdquo;. In the advanced preferences I set this to have a value of my desired Ruby install, and everything was happy again.
<img src="http://img.skitch.com/20100412-tnypwunkmta36r47xhmmf1q95j.png" alt="Setting the TextMate TM_RUBY variable in advanced preferences" title="TextMate TM_RUBY variable" width="530" height="482" class="size-full wp-image-50" /></p>
Bidding in Goa: The Basicshttp://www.workingasintended.com/2009/02/21/bidding-in-goa-the-basics/2009-02-212009-02-21jdl<p>I played <a href="http://www.boardgamegeek.com/boardgame/9216">Goa</a> last night with a couple of people who were newish to that game, but experienced gamers all around. It reminded me that not everyone understands the huge effect that opportunity cost has in that game.</p>
<p>Bidding is a once-around affair, where each player has a turn to offer up a new tile. The offerer hears the others' bids, and then either accepts the high bid (taking the cash from the bidder) or outbids everyone else and pays his money to the bank. This means that buying your own auctions costs you more than double what the high bidder was willing you pay you.</p>
<p>For example, let&rsquo;s say you offer a double-ginger plantation and the high bid is 6. If you pay the bank 7, you really just paid 13 (7 real ducats + 6 ducats you passed on). Not only that, but you&rsquo;ve taken money out of the game economy, inflating the value of the money that&rsquo;s left in circulation. Since it was your money being siphoned off, that&rsquo;s probably not a great thing for you.</p>
<p>Bidding on the flag is interesting, because later in the game, not everyone&rsquo;s actions are worth the same amount of money. If you buy the flag for 5, and you can perform the money action for 6, then at the very worst you can use the free action to make a profit. However, if you put the flag up for auction and the person to your right bid 4, then buying it for 5 in this situation would be a money loser. That doesn&rsquo;t mean that you shouldn&rsquo;t buy the flag, but you need to have a very good reason to justify its cost.</p>
<p>I played <a href="http://www.boardgamegeek.com/boardgame/9216">Goa</a> last night with a couple of people who were newish to that game, but experienced gamers all around. It reminded me that not everyone understands the huge effect that opportunity cost has in that game.</p>
<p>Bidding is a once-around affair, where each player has a turn to offer up a new tile. The offerer hears the others' bids, and then either accepts the high bid (taking the cash from the bidder) or outbids everyone else and pays his money to the bank. This means that buying your own auctions costs you more than double what the high bidder was willing you pay you.</p>
<p>For example, let&rsquo;s say you offer a double-ginger plantation and the high bid is 6. If you pay the bank 7, you really just paid 13 (7 real ducats + 6 ducats you passed on). Not only that, but you&rsquo;ve taken money out of the game economy, inflating the value of the money that&rsquo;s left in circulation. Since it was your money being siphoned off, that&rsquo;s probably not a great thing for you.</p>
<p>Bidding on the flag is interesting, because later in the game, not everyone&rsquo;s actions are worth the same amount of money. If you buy the flag for 5, and you can perform the money action for 6, then at the very worst you can use the free action to make a profit. However, if you put the flag up for auction and the person to your right bid 4, then buying it for 5 in this situation would be a money loser. That doesn&rsquo;t mean that you shouldn&rsquo;t buy the flag, but you need to have a very good reason to justify its cost.</p>