<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" xml:lang="en-US">
  <title>scie.nti.st - Home</title>
  <id>tag:scie.nti.st,2009:mephisto/</id>
  <generator uri="http://mephistoblog.com" version="0.7.3">Mephisto Noh-Varr</generator>
  
  <link href="http://scie.nti.st/" rel="alternate" type="text/html" />
  <updated>2009-04-05T23:54:04Z</updated>
  <geo:lat>34.166906</geo:lat><geo:long>-118.34366</geo:long><link rel="self" href="http://feeds.feedburner.com/scientist-home" type="application/atom+xml" /><feedburner:emailServiceId>scientist-home</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><entry xml:base="http://scie.nti.st/">
    <author>
      <name>garry</name>
    </author>
    <id>tag:scie.nti.st,2009-04-05:4623</id>
    <published>2009-04-05T23:53:00Z</published>
    <updated>2009-04-05T23:54:04Z</updated>
    <category term="Home" />
    <link href="http://feedproxy.google.com/~r/scientist-home/~3/JF1EV8H3b38/prevent-javascript-onclick-event-from-bubbling-up" rel="alternate" type="text/html" />
    <title>Prevent Javascript onClick event from bubbling up</title>
<content type="html">
            &lt;p&gt;I recently was working with some code that had an onClick event handler on the &amp;lt;TR&amp;gt; of each row
of a table.  In one of the columns, a &amp;lt;TD&amp;gt;, there were icons that also had onClick’s on them.  Something like:&lt;/p&gt;

&lt;table class="CodeRay"&gt;&lt;tr&gt;
  &lt;td title="click to toggle" class="line_numbers"&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class="code"&gt;&lt;pre&gt;&lt;span class="ta"&gt;&amp;lt;table&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class="ta"&gt;&amp;lt;tr&lt;/span&gt; &lt;span class="an"&gt;onClick&lt;/span&gt;=&lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;foo()&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class="ta"&gt;&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class="ta"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="an"&gt;onClick&lt;/span&gt;=&lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;bar()&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class="ta"&gt;&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      &lt;span class="c"&gt;&amp;lt;!-- some icons --&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class="ta"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class="ta"&gt;&amp;lt;td&amp;gt;&lt;/span&gt;&lt;span class="ta"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class="ta"&gt;&amp;lt;td&amp;gt;&lt;/span&gt;&lt;span class="ta"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    ...&lt;tt&gt;
&lt;/tt&gt;  &lt;span class="ta"&gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class="ta"&gt;&amp;lt;/table&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;Now if the icons in the first &amp;lt;TD&amp;gt; were clicked, I wanted “bar()“ to fire, but not “foo()“.  Normal behavior is to execute them both.&lt;/p&gt;

&lt;p&gt;Turned out there is a simple solution for this with jQuery.  Only tested in Firefox, but presumably this works across the board because jQuery is awesome that way.&lt;/p&gt;

&lt;p&gt;Add a class to the &amp;lt;TD&amp;gt; called “no-event-bubble-up“:&lt;/p&gt;

&lt;table class="CodeRay"&gt;&lt;tr&gt;
  &lt;td title="click to toggle" class="line_numbers"&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class="code"&gt;&lt;pre&gt;  &lt;span class="ta"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="an"&gt;onClick&lt;/span&gt;=&lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;bar()&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt; &lt;span class="an"&gt;class&lt;/span&gt;=&lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;no-event-bubble-up&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class="ta"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;And add the following JS to your page:&lt;/p&gt;

&lt;table class="CodeRay"&gt;&lt;tr&gt;
  &lt;td title="click to toggle" class="line_numbers"&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class="code"&gt;&lt;pre&gt;&amp;lt;script &lt;span class="r"&gt;type&lt;/span&gt;=&lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;text/javascript&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;&amp;gt;&lt;tt&gt;
&lt;/tt&gt;  $(&lt;span class="pt"&gt;document&lt;/span&gt;).ready(&lt;span class="r"&gt;function&lt;/span&gt;() {&lt;tt&gt;
&lt;/tt&gt;    $(&lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;.no-event-bubble-up&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;).each(&lt;span class="r"&gt;function&lt;/span&gt;() {&lt;tt&gt;
&lt;/tt&gt;      $(&lt;span class="pc"&gt;this&lt;/span&gt;).click(&lt;span class="r"&gt;function&lt;/span&gt;(e) {&lt;tt&gt;
&lt;/tt&gt;        e.stopPropagation();&lt;tt&gt;
&lt;/tt&gt;      });&lt;tt&gt;
&lt;/tt&gt;    });&lt;tt&gt;
&lt;/tt&gt;  });&lt;tt&gt;
&lt;/tt&gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;That’s all that is needed and it worked for me.&lt;/p&gt;

&lt;p&gt;Let me know if you find this useful.&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=JF1EV8H3b38:nr3t-rqnWrM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=JF1EV8H3b38:nr3t-rqnWrM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=JF1EV8H3b38:nr3t-rqnWrM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=JF1EV8H3b38:nr3t-rqnWrM:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=JF1EV8H3b38:nr3t-rqnWrM:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=JF1EV8H3b38:nr3t-rqnWrM:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=JF1EV8H3b38:nr3t-rqnWrM:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=JF1EV8H3b38:nr3t-rqnWrM:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>  <feedburner:origLink>http://scie.nti.st/2009/4/5/prevent-javascript-onclick-event-from-bubbling-up</feedburner:origLink></entry>
  <entry xml:base="http://scie.nti.st/">
    <author>
      <name>garry</name>
    </author>
    <id>tag:scie.nti.st,2008-11-02:3615</id>
    <published>2008-11-02T00:36:00Z</published>
    <updated>2008-11-09T13:28:49Z</updated>
    <category term="Home" />
    <link href="http://feedproxy.google.com/~r/scientist-home/~3/iDq6AEuzsYE/a-pledgie-for-pledgie" rel="alternate" type="text/html" />
    <title>A Pledgie for Pledgie</title>
<content type="html">
            &lt;p&gt;&lt;a href="http://pledgie.com"&gt;Pledgie&lt;/a&gt; is trying to go to the &lt;a href="http://www.philanthropymidwest.org/index.php"&gt;2008 Philanthropy Midwest Conference&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;But we need your help to get there!&lt;/p&gt;

&lt;p&gt;We need to raise $500.00 over the next couple days to reserve a booth.  We learned just yesterday that there was one last exhibitor booth available.&lt;/p&gt;

&lt;p&gt;All the details are in our &lt;a href="http://pledgie.com/campaigns/2005"&gt;Pledgie 4 Plegie&lt;/a&gt; campaign.&lt;/p&gt;

&lt;p&gt;Mark and I thank you for any support you can provide.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.pledgie.com/campaigns/2005"&gt;&lt;img src="http://www.pledgie.com/campaigns/2005.png?skin_name=chrome" alt="Click here to lend your support to: Send Pledgie to the 2008 Philanthropy Midwest Conference! and make a donation at www.pledgie.com !" /&gt;&lt;/a&gt;&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=iDq6AEuzsYE:mzOFwznke9I:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=iDq6AEuzsYE:mzOFwznke9I:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=iDq6AEuzsYE:mzOFwznke9I:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=iDq6AEuzsYE:mzOFwznke9I:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=iDq6AEuzsYE:mzOFwznke9I:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=iDq6AEuzsYE:mzOFwznke9I:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=iDq6AEuzsYE:mzOFwznke9I:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=iDq6AEuzsYE:mzOFwznke9I:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>  <feedburner:origLink>http://scie.nti.st/2008/11/2/a-pledgie-for-pledgie</feedburner:origLink></entry>
  <entry xml:base="http://scie.nti.st/">
    <author>
      <name>garry</name>
    </author>
    <id>tag:scie.nti.st,2008-10-13:3375</id>
    <published>2008-10-13T05:15:00Z</published>
    <updated>2008-10-13T05:22:46Z</updated>
    <category term="Home" />
    <link href="http://feedproxy.google.com/~r/scientist-home/~3/yMhJ3GtG2rg/get-rxvt-unicode-with-256-color-support-on-ubunut" rel="alternate" type="text/html" />
    <title>Get rxvt-unicode with 256 color support on Ubuntu</title>
<content type="html">
            &lt;p&gt;&lt;a href="http://software.schmorp.de/pkg/rxvt-unicode.html"&gt;rxvt-unicode&lt;/a&gt; (commonly called urxvt) already has 88 color support, and for most things, this is fine.  But I recently just found the &lt;a href="http://www.vim.org/scripts/script.php?script_id=2390"&gt;CSApprox&lt;/a&gt; plugin for vim, which lets you use Gvim themes in console vim.  CSApprox actually does a pretty good job interpolating for 88 colors too, but it is best at 256.&lt;/p&gt;

&lt;p&gt;So here’s my build log of compiling rxvt-unicode with the 256 color patch on Ubuntu Hardy, and debianizing (packaging) it.&lt;/p&gt;

&lt;table class="CodeRay"&gt;&lt;tr&gt;
  &lt;td title="click to toggle" class="line_numbers"&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;15&lt;tt&gt;
&lt;/tt&gt;16&lt;tt&gt;
&lt;/tt&gt;17&lt;tt&gt;
&lt;/tt&gt;18&lt;tt&gt;
&lt;/tt&gt;19&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class="code"&gt;&lt;pre&gt;# I keep all custom deb's here, use any directory you want&lt;tt&gt;
&lt;/tt&gt;cd ~/debian-src&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;# Make a place for rxvt-unicode&lt;tt&gt;
&lt;/tt&gt;mkdir rxvt-unicode&lt;tt&gt;
&lt;/tt&gt;cd rxvt-unicode/&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;# Get the source&lt;tt&gt;
&lt;/tt&gt;apt-get source rxvt-unicode&lt;tt&gt;
&lt;/tt&gt;cd rxvt-unicode-8.4/&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;# Apply 256 color patch, it's included with the source&lt;tt&gt;
&lt;/tt&gt;patch -p1 &amp;lt; doc/urxvt-8.2-256color.patch&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;# Make sure you have all depdencies to build it&lt;tt&gt;
&lt;/tt&gt;sudo apt-get build-dep rxvt-unicode&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;# Build it&lt;tt&gt;
&lt;/tt&gt;dpkg-buildpackage -us -uc -rfakeroot&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;This will actually build three separate packages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;rxvt-unicode&lt;/li&gt;
&lt;li&gt;rxvt-unicode-lite&lt;/li&gt;
&lt;li&gt;rxvt-unicode-ml&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All I care about is rxvt-unicode, but you might want -lite or -ml.  If
someone more adept in Debian package building than I am can tell me how
to just compile one of these versions, that’d be great. :)&lt;/p&gt;

&lt;p&gt;Moving along:&lt;/p&gt;

&lt;table class="CodeRay"&gt;&lt;tr&gt;
  &lt;td title="click to toggle" class="line_numbers"&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class="code"&gt;&lt;pre&gt;# Install it!&lt;tt&gt;
&lt;/tt&gt;cd ~/debian-src/rxvt-unicode&lt;tt&gt;
&lt;/tt&gt;sudo dpkg -i rxvt-unicode_8.4-1_amd64.deb&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;# As always, your arch may be different.  Replace amd64 with whatever is&lt;tt&gt;
&lt;/tt&gt;# appropriate for you.&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;Now we need to make terminfo aware that rxvt-unicode supports 256 colors.  The default terminfo entry you’ll have for rxvt-unicode will say 88, and that won’t be right for your new version.&lt;/p&gt;

&lt;table class="CodeRay"&gt;&lt;tr&gt;
  &lt;td title="click to toggle" class="line_numbers"&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;15&lt;tt&gt;
&lt;/tt&gt;16&lt;tt&gt;
&lt;/tt&gt;17&lt;tt&gt;
&lt;/tt&gt;18&lt;tt&gt;
&lt;/tt&gt;19&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;20&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class="code"&gt;&lt;pre&gt;cd ~&lt;tt&gt;
&lt;/tt&gt;infocmp -L rxvt-unicode &amp;gt; rxvt-unicode.terminfo&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;vi rxvt-unicode.terminfo&lt;tt&gt;
&lt;/tt&gt;# Change the following from:&lt;tt&gt;
&lt;/tt&gt;#&lt;tt&gt;
&lt;/tt&gt;#    lines_of_memory#0, max_colors#88, max_pairs#256,&lt;tt&gt;
&lt;/tt&gt;#&lt;tt&gt;
&lt;/tt&gt;# to:&lt;tt&gt;
&lt;/tt&gt;#&lt;tt&gt;
&lt;/tt&gt;#    lines_of_memory#0, max_colors#256, max_pairs#32767&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;# Make .terminfo dir if you don't already have it&lt;tt&gt;
&lt;/tt&gt;install -d .terminfo&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;# Rebuild terminfo for rxvt-unicode&lt;tt&gt;
&lt;/tt&gt;tic -o .terminfo/ rxvt-unicode.terminfo&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;# Cleanup&lt;tt&gt;
&lt;/tt&gt;rm rxvt-unicode.terminfo&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;That should do it.&lt;/p&gt;

&lt;p&gt;To test it out, use this &lt;a href="/dist/256colors2.pl"&gt;256colors2.pl&lt;/a&gt; script (it’s the same one included in the xterm distribution).  Download it, set it executable, open a fresh urxvt terminal, and run:&lt;/p&gt;

&lt;table class="CodeRay"&gt;&lt;tr&gt;
  &lt;td title="click to toggle" class="line_numbers"&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class="code"&gt;&lt;pre&gt;$ ./256colors2.pl&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;The output should look like:&lt;/p&gt;

&lt;p&gt;&lt;img src="/images/256colors.png" height="340" width="566"&gt;&lt;/p&gt;

&lt;p&gt;Any program that supports 256 colors that had to fallback to 88 or even 8 colors can now be used in all its glory.&lt;/p&gt;

&lt;p&gt;Does this make your consoling experience better?  Let me know, post a comment.&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=yMhJ3GtG2rg:KIsJJB5Lqn4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=yMhJ3GtG2rg:KIsJJB5Lqn4:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=yMhJ3GtG2rg:KIsJJB5Lqn4:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=yMhJ3GtG2rg:KIsJJB5Lqn4:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=yMhJ3GtG2rg:KIsJJB5Lqn4:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=yMhJ3GtG2rg:KIsJJB5Lqn4:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=yMhJ3GtG2rg:KIsJJB5Lqn4:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=yMhJ3GtG2rg:KIsJJB5Lqn4:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>  <feedburner:origLink>http://scie.nti.st/2008/10/13/get-rxvt-unicode-with-256-color-support-on-ubunut</feedburner:origLink></entry>
  <entry xml:base="http://scie.nti.st/">
    <author>
      <name>garry</name>
    </author>
    <id>tag:scie.nti.st,2008-10-11:3347</id>
    <published>2008-10-11T13:05:00Z</published>
    <updated>2008-10-11T13:06:23Z</updated>
    <category term="Home" />
    <link href="http://feedproxy.google.com/~r/scientist-home/~3/Wpa7ny4NJfY/textmate-like-file-navigation-in-vim" rel="alternate" type="text/html" />
    <title>TextMate-like file navigation in Vim</title>
<content type="html">
            &lt;p&gt;I highly recommend the new &lt;a href="http://github.com/jamis/fuzzyfinder_textmate/tree/master"&gt;fuzzyfinder_textmate&lt;/a&gt; Vim plugin.  &lt;/p&gt;

&lt;p&gt;In addition, &lt;a href="http://weblog.jamisbuck.org/2008/10/10/coming-home-to-vim"&gt;this post&lt;/a&gt; which debuts the plugin, has a ton of other useful Vim tips and trick.  If you’re a Vim user, I’ll bet you’ll learn something you didn’t know!&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=Wpa7ny4NJfY:JRWnipnPV6c:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=Wpa7ny4NJfY:JRWnipnPV6c:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=Wpa7ny4NJfY:JRWnipnPV6c:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=Wpa7ny4NJfY:JRWnipnPV6c:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=Wpa7ny4NJfY:JRWnipnPV6c:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=Wpa7ny4NJfY:JRWnipnPV6c:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=Wpa7ny4NJfY:JRWnipnPV6c:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=Wpa7ny4NJfY:JRWnipnPV6c:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>  <feedburner:origLink>http://scie.nti.st/2008/10/11/textmate-like-file-navigation-in-vim</feedburner:origLink></entry>
  <entry xml:base="http://scie.nti.st/">
    <author>
      <name>garry</name>
    </author>
    <id>tag:scie.nti.st,2008-10-01:3249</id>
    <published>2008-10-01T22:35:00Z</published>
    <updated>2008-10-01T22:37:51Z</updated>
    <category term="Home" />
    <link href="http://feedproxy.google.com/~r/scientist-home/~3/gQq5Bp4csmQ/hardy-xen-domu-doesn-t-show-login-prompt-fix" rel="alternate" type="text/html" />
    <title>Hardy Xen domU doesn't show login prompt [fix]</title>
<content type="html">
            &lt;p&gt;I have a Xen machine running Ubuntu Hardy (8.04.1).  I created a guest that was also Hardy, with xen-tools.  But after booting it up, the login prompt wouldn’t appear.  It would get as far as:&lt;/p&gt;

&lt;table class="CodeRay"&gt;&lt;tr&gt;
  &lt;td title="click to toggle" class="line_numbers"&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class="code"&gt;&lt;pre&gt;...&lt;tt&gt;
&lt;/tt&gt; * Starting OpenBSD Secure Shell server sshd                             [ OK ] &lt;tt&gt;
&lt;/tt&gt; * Running local boot scripts (/etc/rc.local)                            [ OK ] &lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;And then just not show anything.  The VM wasn’t hung, just the login prompt didin’t display.&lt;/p&gt;

&lt;p&gt;After googling to no avail, I lucked out with button mashing some options in my &amp;lt;vm&amp;gt;.cfg file.  Adding this to the end of my &amp;lt;vm&amp;gt;.cfg made it work:&lt;/p&gt;

&lt;table class="CodeRay"&gt;&lt;tr&gt;
  &lt;td title="click to toggle" class="line_numbers"&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class="code"&gt;&lt;pre&gt;extra = 'xencons=xvc console=xvc0'&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=gQq5Bp4csmQ:Wwg1soqiwLI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=gQq5Bp4csmQ:Wwg1soqiwLI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=gQq5Bp4csmQ:Wwg1soqiwLI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=gQq5Bp4csmQ:Wwg1soqiwLI:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=gQq5Bp4csmQ:Wwg1soqiwLI:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=gQq5Bp4csmQ:Wwg1soqiwLI:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=gQq5Bp4csmQ:Wwg1soqiwLI:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=gQq5Bp4csmQ:Wwg1soqiwLI:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>  <feedburner:origLink>http://scie.nti.st/2008/10/1/hardy-xen-domu-doesn-t-show-login-prompt-fix</feedburner:origLink></entry>
  <entry xml:base="http://scie.nti.st/">
    <author>
      <name>garry</name>
    </author>
    <id>tag:scie.nti.st,2008-09-21:3086</id>
    <published>2008-09-21T11:47:00Z</published>
    <updated>2008-09-21T11:48:57Z</updated>
    <category term="Home" />
    <link href="http://feedproxy.google.com/~r/scientist-home/~3/2o0miqBaXds/update-immutable-with-exceptions" rel="alternate" type="text/html" />
    <title>Update: Immutable, with exceptions</title>
<content type="html">
            &lt;p&gt;This is an update to my previous article: &lt;a href="http://scie.nti.st/2008/9/17/making-methods-immutable-in-ruby"&gt;Making methods immutable in Ruby&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;By popular demand, I’ve made my &lt;a href="http://github.com/up_the_irons/immutable/tree/master"&gt;Immutable&lt;/a&gt; module raise an exception, by default, if you try to override an immutable method.&lt;/p&gt;

&lt;p&gt;So, the following:&lt;/p&gt;

&lt;table class="CodeRay"&gt;&lt;tr&gt;
  &lt;td title="click to toggle" class="line_numbers"&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;15&lt;tt&gt;
&lt;/tt&gt;16&lt;tt&gt;
&lt;/tt&gt;17&lt;tt&gt;
&lt;/tt&gt;18&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class="code"&gt;&lt;pre&gt;require &lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;rubygems&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;require &lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;immutable&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class="r"&gt;module&lt;/span&gt; &lt;span class="cl"&gt;Foo&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  include &lt;span class="co"&gt;Immutable&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class="r"&gt;def&lt;/span&gt; &lt;span class="fu"&gt;foo&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class="sy"&gt;:foo&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class="r"&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;  immutable_method &lt;span class="sy"&gt;:foo&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class="r"&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class="r"&gt;module&lt;/span&gt; &lt;span class="cl"&gt;Foo&lt;/span&gt;                                      &lt;tt&gt;
&lt;/tt&gt;  &lt;span class="r"&gt;def&lt;/span&gt; &lt;span class="fu"&gt;foo&lt;/span&gt;                                       &lt;tt&gt;
&lt;/tt&gt;    &lt;span class="sy"&gt;:baz&lt;/span&gt;                                        &lt;tt&gt;
&lt;/tt&gt;  &lt;span class="r"&gt;end&lt;/span&gt;                                           &lt;tt&gt;
&lt;/tt&gt;&lt;span class="r"&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;Will raise an error: &lt;/p&gt;

&lt;table class="CodeRay"&gt;&lt;tr&gt;
  &lt;td title="click to toggle" class="line_numbers"&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class="code"&gt;&lt;pre&gt;Cannot override the immutable method: foo (Immutable::CannotOverrideMethod)&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=2o0miqBaXds:tq_U2-imTPY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=2o0miqBaXds:tq_U2-imTPY:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=2o0miqBaXds:tq_U2-imTPY:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=2o0miqBaXds:tq_U2-imTPY:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=2o0miqBaXds:tq_U2-imTPY:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=2o0miqBaXds:tq_U2-imTPY:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=2o0miqBaXds:tq_U2-imTPY:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=2o0miqBaXds:tq_U2-imTPY:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>  <feedburner:origLink>http://scie.nti.st/2008/9/21/update-immutable-with-exceptions</feedburner:origLink></entry>
  <entry xml:base="http://scie.nti.st/">
    <author>
      <name>garry</name>
    </author>
    <id>tag:scie.nti.st,2008-09-17:2984</id>
    <published>2008-09-17T12:52:00Z</published>
    <updated>2008-09-21T11:56:20Z</updated>
    <category term="Home" />
    <link href="http://feedproxy.google.com/~r/scientist-home/~3/i9b8fD_aA3A/making-methods-immutable-in-ruby" rel="alternate" type="text/html" />
    <title>Making methods immutable in Ruby (or, Death to Monkey Patching)</title>
<content type="html">
            &lt;p&gt;
Update (09-21-2008): I have a followup to this article &lt;a href="http://scie.nti.st/2008/9/21/update-immutable-with-exceptions"&gt;here&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;You’ve probably been told that in Ruby classes are always open and any code can come along and redefine your methods in any way it pleases.  Indeed, this is true.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Kinda&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;What’s not true, despite every reference I’ve read saying the contrary, is that you can’t prevent this from happening.  &lt;/p&gt;

&lt;p&gt;Ruby provides a &lt;code&gt;method_added()&lt;/code&gt; callback that is invoked every time a method is added &lt;em&gt;or redefined&lt;/em&gt; within a class.  It’s part of the &lt;code&gt;Module&lt;/code&gt; class, and every &lt;code&gt;Class&lt;/code&gt; is a &lt;code&gt;Module&lt;/code&gt;.  There are also two related callbacks called &lt;code&gt;method_removed()&lt;/code&gt; and &lt;code&gt;method_undefined()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This means you could detect when other code has redefined a method, and do something about it!  How about redefining that method (again) to point back to your original code?  Indeed, this works.&lt;/p&gt;

&lt;p&gt;I’ve encapsulated the details of this in a new module I call &lt;code&gt;Immutable&lt;/code&gt;.  It provides one class method called &lt;code&gt;immutable_method()&lt;/code&gt;.  Provide it a list of methods you don’t want touched and it’ll make sure they can’t be redefined.  Hence, &lt;em&gt;immutable&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;It’s on GitHub: &lt;a href="http://github.com/up_the_irons/immutable/tree/master"&gt;&lt;code&gt;http://github.com/up_the_irons/immutable/tree/master&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here’s an example:&lt;/p&gt;

&lt;table class="CodeRay"&gt;&lt;tr&gt;
  &lt;td title="click to toggle" class="line_numbers"&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;15&lt;tt&gt;
&lt;/tt&gt;16&lt;tt&gt;
&lt;/tt&gt;17&lt;tt&gt;
&lt;/tt&gt;18&lt;tt&gt;
&lt;/tt&gt;19&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;20&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;21&lt;tt&gt;
&lt;/tt&gt;22&lt;tt&gt;
&lt;/tt&gt;23&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class="code"&gt;&lt;pre&gt;require &lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;rubygems&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;require &lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;immutable&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class="r"&gt;module&lt;/span&gt; &lt;span class="cl"&gt;Foo&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  include &lt;span class="co"&gt;Immutable&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class="r"&gt;def&lt;/span&gt; &lt;span class="fu"&gt;foo&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class="sy"&gt;:foo&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class="r"&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;  immutable_method &lt;span class="sy"&gt;:foo&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class="r"&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class="c"&gt;# Now re-open Foo and redefine foo()&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class="r"&gt;module&lt;/span&gt; &lt;span class="cl"&gt;Foo&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class="r"&gt;def&lt;/span&gt; &lt;span class="fu"&gt;foo&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class="sy"&gt;:baz&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class="r"&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class="r"&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;include &lt;span class="co"&gt;Foo&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;foo &lt;span class="c"&gt;# =&amp;gt; :foo&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;&lt;code&gt;foo()&lt;/code&gt; returns &lt;code&gt;:foo&lt;/code&gt;, not &lt;code&gt;:baz&lt;/code&gt;, even though we redefined &lt;code&gt;foo()&lt;/code&gt; to return &lt;code&gt;:baz&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If this makes you think of Java’s &lt;code&gt;final&lt;/code&gt; method modifier, you’d be almost right in saying &lt;code&gt;immutable_method&lt;/code&gt; is similar.  But there’s one important difference: with &lt;code&gt;immutable_method&lt;/code&gt; you can still redefine methods in &lt;em&gt;subclasses&lt;/em&gt;.  This makes sense, as one can argue that if you want to reimplement or extend a method, a child class is the only place where you should be doing that anyway.  I tend to agree, call me a purist.&lt;/p&gt;

&lt;p&gt;Why would this be useful to you?  I don’t know.  But I can tell you what motivated me.&lt;/p&gt;

&lt;p&gt;My motivation for writing something that provides what some may call “evil” functionality (heh, and monkey patching &lt;em&gt;isn’t&lt;/em&gt; evil?) of closed methods/classes came from my trials of trying to improve Rails loading time by reimplementing some ActiveSupport methods in C (Ruby extension).  &lt;/p&gt;

&lt;p&gt;I absolutely needed my C versions of certain methods to be present, and not clobbered by ActiveSupport.  &lt;/p&gt;

&lt;p&gt;So why didn’t I just load my extension after ActiveSupport?  Because by then it is too late.  Rails is already loaded, along with slow running methods that get called over 10,000 times during initialization.  &lt;/p&gt;

&lt;p&gt;Run the profiler and see for yourself:&lt;/p&gt;

&lt;table class="CodeRay"&gt;&lt;tr&gt;
  &lt;td title="click to toggle" class="line_numbers"&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class="code"&gt;&lt;pre&gt;  ./script/performance/profiler &amp;quot;require 'config/environment'&amp;quot;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;This is a prelude to my next post, when I present the plugin I’ve built that takes away over 30% of overhead from Rails loading time.  Stay tuned (or subscribe :)&lt;/p&gt;

&lt;p&gt;But for now, if you want to try &lt;code&gt;Immutable&lt;/code&gt;, clone it from GitHub, or if you have RubyGems 1.2.0 or higher, do this:&lt;/p&gt;

&lt;table class="CodeRay"&gt;&lt;tr&gt;
  &lt;td title="click to toggle" class="line_numbers"&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class="code"&gt;&lt;pre&gt;# Requires RubyGems 1.2.0+ (or so I'm told...)&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;gem sources -a http://gems.github.com&lt;tt&gt;
&lt;/tt&gt;sudo gem install up_the_irons-immutable&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;Then you can run the example above.  You’re all set.&lt;/p&gt;

&lt;p&gt;See the &lt;a href="http://github.com/up_the_irons/immutable/tree/master/README"&gt;README&lt;/a&gt; for further details.&lt;/p&gt;

&lt;p&gt;Enjoy (or flame me for ruining your monkey patching).&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=i9b8fD_aA3A:cTPHtQO-lOs:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=i9b8fD_aA3A:cTPHtQO-lOs:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=i9b8fD_aA3A:cTPHtQO-lOs:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=i9b8fD_aA3A:cTPHtQO-lOs:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=i9b8fD_aA3A:cTPHtQO-lOs:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=i9b8fD_aA3A:cTPHtQO-lOs:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=i9b8fD_aA3A:cTPHtQO-lOs:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=i9b8fD_aA3A:cTPHtQO-lOs:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>  <feedburner:origLink>http://scie.nti.st/2008/9/17/making-methods-immutable-in-ruby</feedburner:origLink></entry>
  <entry xml:base="http://scie.nti.st/">
    <author>
      <name>garry</name>
    </author>
    <id>tag:scie.nti.st,2008-09-03:2711</id>
    <published>2008-09-03T01:36:00Z</published>
    <updated>2008-09-03T01:47:00Z</updated>
    <category term="Home" />
    <link href="http://feedproxy.google.com/~r/scientist-home/~3/GI7fVgFR6YI/nicely-formatted-json-on-command-line" rel="alternate" type="text/html" />
    <title>Nicely formatted JSON on the command line</title>
<content type="html">
            &lt;p&gt;You have a URL that outputs JSON, and you want to quickly see its contents from the shell, but nicely formatted, not the raw output wget spits; just do:&lt;/p&gt;

&lt;table class="CodeRay"&gt;&lt;tr&gt;
  &lt;td title="click to toggle" class="line_numbers"&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class="code"&gt;&lt;pre&gt;$ wget foo.com/bar.json -O - --quiet | ruby -rubygems -e \ &lt;tt&gt;
&lt;/tt&gt;  'require &amp;quot;json&amp;quot;; puts JSON.parse($stdin.gets).to_yaml'&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;I broke it up into two lines for easier reading, but you can type it all out in one line, or better yet, turn it into a shell script with a single URL argument.&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=GI7fVgFR6YI:M2WsPezuN3M:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=GI7fVgFR6YI:M2WsPezuN3M:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=GI7fVgFR6YI:M2WsPezuN3M:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=GI7fVgFR6YI:M2WsPezuN3M:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=GI7fVgFR6YI:M2WsPezuN3M:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=GI7fVgFR6YI:M2WsPezuN3M:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=GI7fVgFR6YI:M2WsPezuN3M:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=GI7fVgFR6YI:M2WsPezuN3M:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>  <feedburner:origLink>http://scie.nti.st/2008/9/3/nicely-formatted-json-on-command-line</feedburner:origLink></entry>
  <entry xml:base="http://scie.nti.st/">
    <author>
      <name>garry</name>
    </author>
    <id>tag:scie.nti.st,2008-08-22:2388</id>
    <published>2008-08-22T00:56:00Z</published>
    <updated>2008-08-22T05:19:52Z</updated>
    <category term="Home" />
    <link href="http://feedproxy.google.com/~r/scientist-home/~3/jaIQ388m430/gnu-screen-with-vertical-split-support" rel="alternate" type="text/html" />
    <title>GNU screen with vertical split support</title>
<content type="html">
            &lt;p&gt;Just a quick post here.  I recently recompiled screen with vertical split support on Ubuntu 8.04.  Here’s how you do it:&lt;/p&gt;

&lt;table class="CodeRay"&gt;&lt;tr&gt;
  &lt;td title="click to toggle" class="line_numbers"&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;15&lt;tt&gt;
&lt;/tt&gt;16&lt;tt&gt;
&lt;/tt&gt;17&lt;tt&gt;
&lt;/tt&gt;18&lt;tt&gt;
&lt;/tt&gt;19&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;20&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;21&lt;tt&gt;
&lt;/tt&gt;22&lt;tt&gt;
&lt;/tt&gt;23&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class="code"&gt;&lt;pre&gt;# Install dependencies to build screen&lt;tt&gt;
&lt;/tt&gt;sudo apt-get build-dep screen&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;# Create an area to hold the source&lt;tt&gt;
&lt;/tt&gt;cd ~/debian-src&lt;tt&gt;
&lt;/tt&gt;mkdir screen&lt;tt&gt;
&lt;/tt&gt;cd screen&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;# Get the source&lt;tt&gt;
&lt;/tt&gt;apt-get source screen&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;# Apply vertical split patch&lt;tt&gt;
&lt;/tt&gt;cd screen-4.0.3/&lt;tt&gt;
&lt;/tt&gt;wget http://vsp4sdl.yuggoth.org/wrp_vertical_split_0.3_4.0.2.diff.bz2&lt;tt&gt;
&lt;/tt&gt;bunzip2 wrp_vertical_split_0.3_4.0.2.diff.bz2&lt;tt&gt;
&lt;/tt&gt;patch -p1 &amp;lt; wrp_vertical_split_0.3_4.0.2.diff&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;# Build it!&lt;tt&gt;
&lt;/tt&gt;dpkg-buildpackage -us -uc -rfakeroot&lt;tt&gt;
&lt;/tt&gt;cd ..&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;# Install it!&lt;tt&gt;
&lt;/tt&gt;sudo dpkg -i screen_4.0.3-0.4ubuntu2_amd64.deb&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;That’s it.&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=jaIQ388m430:hJY8D3eLZZA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=jaIQ388m430:hJY8D3eLZZA:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=jaIQ388m430:hJY8D3eLZZA:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=jaIQ388m430:hJY8D3eLZZA:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=jaIQ388m430:hJY8D3eLZZA:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=jaIQ388m430:hJY8D3eLZZA:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=jaIQ388m430:hJY8D3eLZZA:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=jaIQ388m430:hJY8D3eLZZA:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>  <feedburner:origLink>http://scie.nti.st/2008/8/22/gnu-screen-with-vertical-split-support</feedburner:origLink></entry>
  <entry xml:base="http://scie.nti.st/">
    <author>
      <name>garry</name>
    </author>
    <id>tag:scie.nti.st,2008-08-19:2354</id>
    <published>2008-08-19T21:25:00Z</published>
    <updated>2008-08-19T21:54:28Z</updated>
    <category term="Home" />
    <link href="http://feedproxy.google.com/~r/scientist-home/~3/B36gj-T2eF4/1-minute-post-hostname-as-screen-window-title" rel="alternate" type="text/html" />
    <title>Automatically setting hostname as GNU screen window title</title>
<content type="html">
            &lt;p&gt;I’m starting to put this in ~/.bashrc of all my servers now:&lt;/p&gt;

&lt;table class="CodeRay"&gt;&lt;tr&gt;
  &lt;td title="click to toggle" class="line_numbers"&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class="code"&gt;&lt;pre&gt;# Set screen window title&lt;tt&gt;
&lt;/tt&gt;case &amp;quot;$TERM&amp;quot; in&lt;tt&gt;
&lt;/tt&gt;screen)&lt;tt&gt;
&lt;/tt&gt;  PROMPT_COMMAND='echo -ne &amp;quot;\033k$HOSTNAME\033\\&amp;quot;'&lt;tt&gt;
&lt;/tt&gt;  ;;&lt;tt&gt;
&lt;/tt&gt;esac&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;When I log into the machine, the &lt;a href="http://www.gnu.org/software/screen/"&gt;screen&lt;/a&gt; window title (which displays on the hard status line, and in turn my &lt;a href="http://software.schmorp.de/pkg/rxvt-unicode.html"&gt;urxvt&lt;/a&gt; window title bar) automatically changes to the hostname of the machine I’m logged into.  I used to set this manually, but now I don’t have to, yay!&lt;/p&gt;

&lt;p&gt;If your distro doesn’t set up your environment so ~/.bashrc is sourced upon login, you’ll want to put this into ~/.bash_login instead.&lt;/p&gt;

&lt;p&gt;To get this code on a lot of servers at once, save the above snippet to a file called “prompt-command.sh” and execute:&lt;/p&gt;

&lt;table class="CodeRay"&gt;&lt;tr&gt;
  &lt;td title="click to toggle" class="line_numbers"&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class="code"&gt;&lt;pre&gt;for i in hostname1 hostname2 hostname3; do cat prompt-command.sh | ssh $i 'cat &amp;gt;&amp;gt; ~/.bashrc'; done&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;Of course, change “hostname1”, “hostname2”, etc… to the real hostnames of your machines.&lt;/p&gt;

&lt;p&gt;Cool, huh?&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=B36gj-T2eF4:RggIDoiSkrc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=B36gj-T2eF4:RggIDoiSkrc:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=B36gj-T2eF4:RggIDoiSkrc:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=B36gj-T2eF4:RggIDoiSkrc:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=B36gj-T2eF4:RggIDoiSkrc:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=B36gj-T2eF4:RggIDoiSkrc:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=B36gj-T2eF4:RggIDoiSkrc:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=B36gj-T2eF4:RggIDoiSkrc:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>  <feedburner:origLink>http://scie.nti.st/2008/8/19/1-minute-post-hostname-as-screen-window-title</feedburner:origLink></entry>
  <entry xml:base="http://scie.nti.st/">
    <author>
      <name>garry</name>
    </author>
    <id>tag:scie.nti.st,2008-07-31:1863</id>
    <published>2008-07-31T22:01:00Z</published>
    <updated>2008-07-31T22:11:31Z</updated>
    <category term="Home" />
    <link href="http://feedproxy.google.com/~r/scientist-home/~3/M2peLz2xFRM/cacheable-flash-and-jquery" rel="alternate" type="text/html" />
    <title>Cacheable Flash and jQuery</title>
<content type="html">
            &lt;p&gt;I’ve been using this great plugin on &lt;a href="http://pledgie.com"&gt;Pledgie&lt;/a&gt; called &lt;a href="http://pivots.pivotallabs.com/users/brian/blog/articles/276-cacheable-flash"&gt;Cacheable Flash&lt;/a&gt; to show flash messages on page cached pages.  &lt;/p&gt;

&lt;p&gt;A few weeks ago, we implemented page caching on the campaign landing pages, because that is the first page one sees when they click on a badge in the wild, and so I wanted to make sure there was no delay in delivering that content to the user.&lt;/p&gt;

&lt;p&gt;The only bump in the road in implementing Cacheable Flash was that it relies on Prototype.  We don’t use Prototype on Pledgie, instead we prefer &lt;a href="http://jquery.com"&gt;jQuery&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So I &lt;a href="http://github.com/up_the_irons/cacheable-flash/tree/master"&gt;forked&lt;/a&gt; Cacheable Flash on GitHub and ported it from Prototype to jQuery.  For anyone that wants to use Cacheable Flash with jQuery, wait no longer, clone this repo:&lt;/p&gt;

&lt;table class="CodeRay"&gt;&lt;tr&gt;
  &lt;td title="click to toggle" class="line_numbers"&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class="code"&gt;&lt;pre&gt;$ git clone git://github.com/up_the_irons/cacheable-flash.git&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;… and enjoy!&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=M2peLz2xFRM:hbk2qKdnRVk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=M2peLz2xFRM:hbk2qKdnRVk:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=M2peLz2xFRM:hbk2qKdnRVk:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=M2peLz2xFRM:hbk2qKdnRVk:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=M2peLz2xFRM:hbk2qKdnRVk:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=M2peLz2xFRM:hbk2qKdnRVk:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=M2peLz2xFRM:hbk2qKdnRVk:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=M2peLz2xFRM:hbk2qKdnRVk:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>  <feedburner:origLink>http://scie.nti.st/2008/7/31/cacheable-flash-and-jquery</feedburner:origLink></entry>
  <entry xml:base="http://scie.nti.st/">
    <author>
      <name>garry</name>
    </author>
    <id>tag:scie.nti.st,2008-07-16:1718</id>
    <published>2008-07-16T02:13:00Z</published>
    <updated>2008-07-16T23:57:14Z</updated>
    <category term="Home" />
    <link href="http://feedproxy.google.com/~r/scientist-home/~3/ybnLNVY9hXQ/noisy-fan-on-the-x300" rel="alternate" type="text/html" />
    <title>Fix for Noisy Fan on the ThinkPad X300</title>
<content type="html">
            &lt;p&gt;One thing that got annoying with my new ThinkPad X300 was the fan seemed to run at full speed almost all the time.  I’m running Ubuntu 8.04 Hardy.&lt;/p&gt;

&lt;p&gt;Once again, &lt;a href="http://www.thinkwiki.org/"&gt;ThinkWiki&lt;/a&gt; came to the rescue in their article on &lt;a href="http://www.thinkwiki.org/wiki/How_to_control_fan_speed"&gt;How to control the fan speed&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Using my new found knowledge, I wrote a little script that made it easy to control the fan speed:&lt;/p&gt;

&lt;table class="CodeRay"&gt;&lt;tr&gt;
  &lt;td title="click to toggle" class="line_numbers"&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;15&lt;tt&gt;
&lt;/tt&gt;16&lt;tt&gt;
&lt;/tt&gt;17&lt;tt&gt;
&lt;/tt&gt;18&lt;tt&gt;
&lt;/tt&gt;19&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;20&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;21&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class="code"&gt;&lt;pre&gt;#!/bin/sh                           &lt;tt&gt;
&lt;/tt&gt;#&lt;tt&gt;
&lt;/tt&gt;# Control fan on a ThinkPad.&lt;tt&gt;
&lt;/tt&gt;#&lt;tt&gt;
&lt;/tt&gt;# Be sure to add the following to /etc/modprobe.d/options:&lt;tt&gt;
&lt;/tt&gt;#&lt;tt&gt;
&lt;/tt&gt;#    options thinkpad_acpi fan_control=1&lt;tt&gt;
&lt;/tt&gt;#&lt;tt&gt;
&lt;/tt&gt;# and reboot, before using this script.&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;usage() {&lt;tt&gt;
&lt;/tt&gt;  echo &amp;quot;$0 &amp;lt;level&amp;gt; (&amp;lt;level&amp;gt; is 0-7, auto, disengaged, full-speed)&amp;quot;&lt;tt&gt;
&lt;/tt&gt;  exit&lt;tt&gt;
&lt;/tt&gt;}&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;if [ -z &amp;quot;$1&amp;quot; ]; then&lt;tt&gt;
&lt;/tt&gt;  usage&lt;tt&gt;
&lt;/tt&gt;  exit&lt;tt&gt;
&lt;/tt&gt;fi&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;sudo sh -c &amp;quot;echo level $1 &amp;gt; /proc/acpi/ibm/fan&amp;quot;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;Be sure to modify your /etc/modprobe.d/options as specified in the comments.&lt;/p&gt;

&lt;p&gt;Then just run:&lt;/p&gt;

&lt;table class="CodeRay"&gt;&lt;tr&gt;
  &lt;td title="click to toggle" class="line_numbers"&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class="code"&gt;&lt;pre&gt;$ ./fan.sh 2&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;for a much quieter fan (low speed) that doesn’t seem to sacrifice cooling when coding (vi, Firefox, mutt, and Gnome is what I run mainly).&lt;/p&gt;

&lt;p&gt;You’ll want to switch it back to ‘auto’ if you’re gonna do anything processor intensive.&lt;/p&gt;

&lt;p&gt;Enjoy!&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=ybnLNVY9hXQ:vo4xYVDu1ts:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=ybnLNVY9hXQ:vo4xYVDu1ts:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=ybnLNVY9hXQ:vo4xYVDu1ts:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=ybnLNVY9hXQ:vo4xYVDu1ts:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=ybnLNVY9hXQ:vo4xYVDu1ts:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=ybnLNVY9hXQ:vo4xYVDu1ts:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=ybnLNVY9hXQ:vo4xYVDu1ts:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=ybnLNVY9hXQ:vo4xYVDu1ts:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>  <feedburner:origLink>http://scie.nti.st/2008/7/16/noisy-fan-on-the-x300</feedburner:origLink></entry>
  <entry xml:base="http://scie.nti.st/">
    <author>
      <name>garry</name>
    </author>
    <id>tag:scie.nti.st,2008-05-07:1170</id>
    <published>2008-05-07T00:31:00Z</published>
    <updated>2008-05-07T00:54:15Z</updated>
    <category term="Home" />
    <link href="http://feedproxy.google.com/~r/scientist-home/~3/cHS6hgEGXfY/github-and-pledgie-bff" rel="alternate" type="text/html" />
    <title>GitHub and Pledgie BFF</title>
<content type="html">
            &lt;p&gt;The guys over at &lt;a href="http://github.com"&gt;GitHub&lt;/a&gt; have integrated &lt;a href="http://pledgie.com"&gt;Pledgie&lt;/a&gt; badges into their site as a “[way] for every public project on GitHub to, dare I say, make money.”  &lt;a href="http://blog.locusfoc.us"&gt;Mark&lt;/a&gt; and I are super excited to support GitHub in this effort and hope to see more Pledgie badges for OSS projects around the ‘net!&lt;/p&gt;

&lt;p&gt;To see how it works, click here: &lt;a href="http://github.com/blog/57-getting-paid-the-open-source-way"&gt;http://github.com/blog/57-getting-paid-the-open-source-way&lt;/a&gt;&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=cHS6hgEGXfY:dX7nWk6Wjck:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=cHS6hgEGXfY:dX7nWk6Wjck:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=cHS6hgEGXfY:dX7nWk6Wjck:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=cHS6hgEGXfY:dX7nWk6Wjck:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=cHS6hgEGXfY:dX7nWk6Wjck:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=cHS6hgEGXfY:dX7nWk6Wjck:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=cHS6hgEGXfY:dX7nWk6Wjck:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=cHS6hgEGXfY:dX7nWk6Wjck:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>  <feedburner:origLink>http://scie.nti.st/2008/5/7/github-and-pledgie-bff</feedburner:origLink></entry>
  <entry xml:base="http://scie.nti.st/">
    <author>
      <name>garry</name>
    </author>
    <id>tag:scie.nti.st,2008-04-30:1110</id>
    <published>2008-04-30T11:48:00Z</published>
    <updated>2008-04-30T11:48:55Z</updated>
    <category term="Home" />
    <link href="http://feedproxy.google.com/~r/scientist-home/~3/WTDoEqJph2k/programming-for-pain" rel="alternate" type="text/html" />
    <title>Programming for Pain</title>
<content type="html">
            &lt;p&gt;Try this “programming exercise”:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[garry@garry-thinkpad] ~ (master) $ irb
irb(main):001:0&gt; i = 0
=&gt; 0
irb(main):002:0&gt; i += 1; r = rand(10); puts "r = #{r}, i = #{i}"
r = 7, i = 1
=&gt; nil
irb(main):003:0&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;See the value of “r”?  Drop down and do that many push-ups.&lt;/p&gt;

&lt;p&gt;Pop back up and hit your favorite key for repeating the last command:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;irb(main):003:0&gt; i += 1; r = rand(10); puts "r = #{r}, i = #{i}"
r = 3, i = 2
=&gt; nil
irb(main):004:0&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That’s right, drop and do “r” more push-ups.&lt;/p&gt;

&lt;p&gt;If you get a “0”, you get to rest for 1 minute.&lt;/p&gt;

&lt;p&gt;When “i” reaches 52, you’re done.&lt;/p&gt;

&lt;p&gt;This is a variation of “prison push-ups” that I tried because I didn’t have a deck of cards.&lt;/p&gt;

&lt;p&gt;This is quite a challenging workout.  It might sound easy, depending on how fit you are, but wait until “i” reaches around 20 or so. :)&lt;/p&gt;

&lt;p&gt;Homework: Wrap this in a nice script so you just press a key to get the next count, and have it record your time.&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=WTDoEqJph2k:Kik9zhyv-V4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=WTDoEqJph2k:Kik9zhyv-V4:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=WTDoEqJph2k:Kik9zhyv-V4:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=WTDoEqJph2k:Kik9zhyv-V4:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=WTDoEqJph2k:Kik9zhyv-V4:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=WTDoEqJph2k:Kik9zhyv-V4:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=WTDoEqJph2k:Kik9zhyv-V4:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=WTDoEqJph2k:Kik9zhyv-V4:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>  <feedburner:origLink>http://scie.nti.st/2008/4/30/programming-for-pain</feedburner:origLink></entry>
  <entry xml:base="http://scie.nti.st/">
    <author>
      <name>garry</name>
    </author>
    <id>tag:scie.nti.st,2008-04-08:875</id>
    <published>2008-04-08T23:50:00Z</published>
    <updated>2008-04-08T23:52:15Z</updated>
    <category term="Home" />
    <link href="http://feedproxy.google.com/~r/scientist-home/~3/_yDbqcUV1b8/rubyforge-now-has-git-support" rel="alternate" type="text/html" />
    <title>RubyForge now has Git support</title>
<content type="html">
            &lt;p&gt;Just thought I’d get the word out.  More info is &lt;a href="http://tomcopeland.blogs.com/juniordeveloper/2008/04/rubyforge-now-h.html"&gt;here&lt;/a&gt;.  Very cool!&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=_yDbqcUV1b8:huM4PQZHNww:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=_yDbqcUV1b8:huM4PQZHNww:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=_yDbqcUV1b8:huM4PQZHNww:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=_yDbqcUV1b8:huM4PQZHNww:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=_yDbqcUV1b8:huM4PQZHNww:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=_yDbqcUV1b8:huM4PQZHNww:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/scientist-home?a=_yDbqcUV1b8:huM4PQZHNww:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/scientist-home?i=_yDbqcUV1b8:huM4PQZHNww:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content>  <feedburner:origLink>http://scie.nti.st/2008/4/8/rubyforge-now-has-git-support</feedburner:origLink></entry>
</feed>
