InquiryLabs

Politics, Programming and Possibilities

Archive for July, 2008

Gazelle takes your junk for you


I just found out about this Gazelle service which takes your junk for you and responsibly disposes of it or resells it if possible. What’s more, they’ll pay you a little bit too, something like what you’d get at a garage or yard sale. I’ve left my “referral” account on the link above, so feel free to use that link if you’d like to share the proceeds. I’ll let you know what my experience with them is like soon.

Is it just me, or is GoodReads exploding?

My wife and I have had a ton of invitations to goodreads.com lately. Is it just our friend network that’s been “blessing” us, or is this going on everywhere?

  • 1 Comment
  • Filed under: Life and Family
  • Cuil Search Debuts Today

    The Cuil (pronounced “cool”) search engine debuts today. So far I’m liking it. Nice search results, beautiful layout, authoritative sources. It was started by 4 former Google engineers, and they say it’s “not for sale” this time.

    My only complaint… apparently I don’t have consistent or authoritative enough photos of myself on the internet: why is there a picture of a woman in my “search result” spot? :)

    Screencasting Some Coding Insights

    I’d like to start screencasting once in a while to share tips, tricks and workflow in software design. I have a few ideas for where I’ll be taking this, but for now, let me introduce you to my first screencast: Searching for Textmate Commands.



    P.S. I know this one is a bit lacking. I spent most of my time learning about the workflow of screencasting itself, so I apologize for the lower quality of output. Expect better soon :)

    Sensibly Outraged

    Impeachment hearings began today! This man, Vincent Bugliosi, was an eloquent representative of those who call for continued hearings and justice… listen to his powerful voice as he appeals to Rep. Conyers and the American people for justice in the deaths of over 4,000 Americans and 100,000 Iraqis.

    Indeed, Mr. Bugliosi is right to call for outrage. Any sensible person with a heart and open mind would be disgusted by this president and his administration. Even if the war were for a noble cause (which I can’t rule out entirely, but I doubt very much) the means through which the war was carried out was evil—pure and simple, it was deceptive, dishonest, and intentional. I support Rep. Wexler and Rep. Kucinich and the many other congress men and women who seek to uphold the constitution by becoming the check and balance to this wildly out-of-balance administration.

  • 0 Comments
  • Filed under: Politics
  • Rails-Doc.org

    Taryn recently posted a comment on my recent Theory of Mind post, and so I went off to look at her blog. The first thing I found was a great run-down of the new rails-doc.org Rails documentation site. I was pleasantly surprised by the offering… thanks for the post, Taryn!

    Working With File Names

    There is likely a way to do what I’m about to blog about, but I thought this might be useful in case there isn’t. Basically, I want a File object, but without the necessity of it actually being a file on the filesystem. For example, I’d kind of like to call "/tmp/myfile.txt".dirname and get "/tmp" back.

    Ruby’s File class does not allow the following, unless /tmp/myfile.txt actually exists:

    f = File.new("/tmp/myfile.txt")

    And what’s worse (imo), you can’t do this once you have the file handle:

    f.dirname

    But it does allow this:

    File.dirname("/tmp/myfile.txt")

    When you have a lot of this kind of thing going on (getting dirname, basename, extname, etc.) it gets tiresome to type “File” all over the place. What we really need is a Filename object. And it should proxy methods to the File.* class methods. Here it is:

    ##
    # Simple class that makes File.* class methods available on a
    # Filename object
    #
    # doctest: Can call File's class methods on a Filename object
    # >> Filename.new ("/tmp/myfile.png").dirname
    # => "/tmp"
    #
    # doctest: Can create a Filename from another Filename object
    # >> path = "/tmp/myfile.png"
    # >> Filename.new(Filename.new(path)).to_s
    # => path
    #
    # doctest: Filename can create a filepath from segments
    # >> Filename.new("/tmp", "inner", "other.txt").to_s
    # => "/tmp/inner/other.txt"
    #
    class Filename
      def initialize(*segments)
        @filepath = File.join(*(segments.map{ |s| s.to_s }))
      end
    
      def to_s
        @filepath
      end
    
      def method_missing(method, *args, &proc)
        File.send(method, *([@filepath] + args), &proc)
      end
    end
    

    A Recursive Theory of Mind

    One of my long time friends, Eric, and I had a fascinating conversation about will power the other day. We were looking at ways to improve ourselves and to become more consistent over time. One of the things that struck us was that “will power” is an oft-used idea that actually lends itself poorly to describing what this “power” actually is. In other words, the term provides no underlying model with which we can improve this personal trait, other than the idea that it can be “increased” or “decreased”, supposedly in an abstract dimension called “strength”.

    One model that has worked well for me is to understand myself as a sort of melding of minds. Even though there is only one physical brain inside me, it seems that there are in fact, more than one mind vying for attention and trying to satisfy their needs.

    I think of these kind of like a family: there is the father mind that wants to take charge of the others, and the mother mind that is more aware of the others’ needs. There is the older brother that acts seriously most of the time; the second child that just wants to have fun; the youngest daughter that’s kind of spoiled and but cute anyway.

    There are a number of families that you could imagine, probably more like your own family than my description of a family above; but the point is that there are distinct minds up there in our heads that have different needs and wants, and that together they make us who we are. We experience times of weakness (disunity) and strength (consensus), for example. As we learn from the world, new information appeals to one “mind” more than the other, and perhaps persuades us to behave differently. The model starts to help us to become better people.

    This playful model can also be extended to a broader context, and perhaps made a little more formal. I call the broader model the “Recursive Theory of Mind”, and it goes like this:

    1. Society is a mind.
    2. A mind consists of two or more minds that are less complex.

    In other words, intelligence itself is a recursive construction, and our conscious state is attached at one particular level of recursion: there is a grander intelligence of which we are a part; and, our own intelligence consists of lesser intelligences (”minds”).

    There are a number of interesting corollaries to this Recursive Theory of Mind, one of which is that it might be possible to “strengthen your will” if you treat yourself as a collection of minds vying for attention and self-fulfilled needs. The task then becomes one of understanding, logic, rhetoric, and persuasion rather than “increasing or decreasing the strength-of-will-o-meter.” In fact, it might be better to think of someone who is determined (i.e. “strong-willed”, in the good sense) as someone who has a sustained consensus among his or her various minds. Strengthening the will in the fullest sense, could be a matter of wide-spread appeal, not of single-mindedness.

    For example, one mind may be more susceptible to logical persuasion while another is much more interested in pleasure and excitement. If you’re the kind of person who has been brought up thinking that pleasure and excitement are “bad” and that serious contemplation is “good”, then it might take some introspection and meditation to discover that there is this other, valid part of you that needs to be understood. In fact, it might surprise you to find out that you have these hard-wired requirements that you can’t suppress forever—with this discovery, then, you can learn to accommodate the needs of the fun-loving self and make appropriate changes so that what you thought of as “bad” is now just “you”.

    Since the Recursive Theory of Mind applies at all levels of intelligence, I think it may be useful to apply our understanding of sociology to the problem of improving ourselves. For example, how will we govern our minds? Is it a democracy, or something else? Could it be that a strong-handed dictator deserves citizens (after years of repression) who rebel against him? Likewise, could a strong-handed “father” mind eventually undermine its own bid for stability by suppressing the other minds and requiring nothing but subjection? I think this could be an interesting way to think of “will power” and may forewarn us of the dangers of “willing ourselves” to do unbalanced things for an indefinite period—maybe at some point we’ll just snap.

    One last thought regarding this “mind” that we are: since each of us us a part of a larger mind (i.e. “society”), we each have connections to one another, like our brains have dendrites and synapses. We learn from each other and improve our individual intelligence while also improving the overall intelligence of humanity. What an interesting thing it is to be a node in a network that spans both horizontally as well as vertically. What will we think of next?

    P. S. I’ve left out some interesting thoughts from this discussion because I’m not knowledgeable enough in larger contexts to make anything useful of this model—nevertheless, it’s interesting to speculate about grander minds of which our society or humanity are a part. Is the universe intelligent? Does it have a mind? What is “mind”? Perhaps I’ll never know, but in the meantime, this Recursive Theory of Mind is a helpful working hypothesis for me.

    GetDoc: A Simple CMS for eRuby

    Following up on my earlier post about Rails deployment (it can still be a pain), I’ve made my first little Ruby CMS using eRuby (i.e. Ruby without Rails). The idea is simple: Google has a wonderful word processor that clients can use to edit web pages. Why not harness that ability for simple web pages that need just a little bit of content editing here and there?

    The GetDoc class uses hpricot to parse and cache a public Google document, and then show the result wherever is needed in the web page. Here is a sample .rhtml file from the project. The source code is available at github:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
       "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <%
      require File.join(File.dirname(__FILE__), "ruby/get_doc")
      # Default document is a Google word processing document
      google_doc = GetDoc.new("dcjnq5tv_4gw4qk2")
    
      # Getting a document from somewhere other than google
      # docs is possible, but it is a little more complicated,
      # because we need to specify the following:
      # 1. The URL of the post without the domain
      # 2. The domain of the blog, and the location in the
      #    string to insert the post (%s)
      # 3. A transformation proc which can extract the content
      #    from the blog using hpricot
      blog_post = GetDoc.new(
        "2008/07/15/lucky-to-be-a-programmer",
        "http://blog.inquirylabs.com/%s") do |hpricot|
          (hpricot / ".PostHead h1:first").to_html +
          (hpricot / ".PostContent:first").inner_html
      end
    
      # Uncomment the following line to have the cache cleared
      # for EVERY page load:
      # GetDoc.reset_cache
    %>
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
      <head>
        <title>Sample GetDoc Page</title>
        <style type="text/css" media="screen">
          #left {
            width: 50%;
            float: left;
          }
          #right {
            width: 50%;
            float: right;
          }
        </style>
      </head>
      <body>
        <div id="container">
          <div id="top">
            <div id="header">
              <div id="title">Sample GetDoc Page</div>
            </div>
            <div id="content">
              <div id="left">
                <h1>Google Doc</h1>
                <%= google_doc %>
              </div>
              <div id="right">
                <div class="sideitem">
                  <h1>Blog Post</h1>
                  <%= blog_post %>
                </div>
              </div>
            </div>
        </div>
      </body>
    </html>
    

    Note that it is also possible (as demonstrated above) to customize GetDoc for blogs or other sources of HTML data. What a wonderful web!

    Lynnleigh Schooling Show

    Kelty took me to Lynnleigh Farms on Wednesday where she performed a level 1 dressage test in front of the judges there. Kelty tells me she didn’t do as well this time as she did last time, but it was fun having her mom and friend, Dione, there to watch her play afterward! Here are a few photos from the occasion. Keep it up, Kelt!

    Extended Trot

    IMG_1554

    IMG_1548

    IMG_1531