InquiryLabs

Politics, Programming and Possibilities

Confusing Leadership

I give John McCain a little bit of leeway for occasionally being surprisingly honest about things. But for the most part, as noted in the video below, his starkly honest views are overwhelmed by his starkly delusional ones. In the words of Jed Report, this video might be “devastating“. Ironically, it was created by a (Ron Paul) Republican, not a Democrat:

  • 0 Comments
  • Filed under: Politics
  • New TextMate Footnotes Plugin 3.2

    José Valim has been up to no good, improving the TextMate Footnotes plugin behind our backs… it’s at version 3.2 now!

    José added a summary of database queries to each request, so you can inspect what happened without resorting to parsing log files. Thanks again!

    What Obama Means

    I rarely get teary-eyed when I talk about politics, but when it comes to how Obama is changing the zeitgeist and inspiring hope in individuals, I just keep giving in. Here are a couple of excerpts:

    As an African American—let me be specific—as an African, born to a Kenyan Mother and Kenyan Dad, I cried on this day, this is historic. I am a mother to an African American Boy, I will tell him that, he can crash the boundaries, and be anything he ever wants to be … anything, not matter your origin. —Bochaberi

    The reputation of Americans has been tarnished by George W. Bush’s failed foreign policies and the simple act of electing Obama as the Democratic nominee has already gone far to restore a positive image.

    Let it be said, I am not an American. I am an ex-pat living in Holland with close ties to the U.S. I lived there for 4 years (in the Clinton days) and I have many relatives there. I’ve never seen so much enthusiasm and interest in American politics from outsiders like myself looking in. Even my two year old can identify and name Obama, Clinton and McCain! Now onto the White House! —Tischa

    My grandfather died in 2003; I truly wish he could have lived to see this. He was born in the ’20s in Deep South Alabama and probably never dreamed that a black man would have the chance to run this country. Black people have had the feelings that “We can build this country on our backs as slaves, but can’t run it.” Now, it’s a new day. We have that opportunity. —SandieAT

    Right now, we need something to rally behind, something other than war. It seems to me that in Obama we have been reminded of what it means to be American in the good sense—to be tolerant, to appreciate diverse views, to stand up for one another. These are the good things I see, and for a moment, I think I’d like to just appreciate them without looking for the other side. Congratulations to all those who have worked beside the new Democratic nominee!

  • 0 Comments
  • Filed under: Politics
  • A rule to save us all time

    I like this suggestion from Wolperts Blog:

    1. if you initiated the call and it drops you call the other person back.

    2. if you received the call and it drops you just wait for the call back.

    It’s about time we made this an explicit society-wide assumption. I can’t believe how often I’m left in that “should I call, or wait for them to call?” state!

  • 1 Comment
  • Filed under: Life and Family
  • Testing Wengo Visio

    I had a couple of ideas with Apple’s iChat and started looking around for implementations of “my” idea. It turns out Wengo (a French company) has done something like what I imagined: video chat on the blog. I’ll try it here:

    Update: It doesn’t look like it’s working. Hmph. Neat idea though.

    Update 2: Let’s try Stickam instead:

    Update 3: Or not. How about tokbox?

    [removed tokbox widget for now]
    Yep, Tokbox works! Cool.

    Super Digg Feed

    I love digg, but I can’t stand how they make me go to the site for every single article. Use this feed from Georgy Woods instead:

    Super Digg Feed v2.0

    And by the way, if you aren’t already using one, and if you visit several websites a day to “keep up on the news” or to find out if one of your friends has posted some news lately, you should definitely use a feed reader, like NewsFire on the Mac, or Google Reader on the web. (Leah, I’m talking to YOU :) )

    I thought this was very interesting. The plans for the highway haven’t been well publicized, so this was a refreshing summary on the house floor of what’s going on by Rep. Marcy Kaptur from Ohio.

    While I support progress in transportation and technology, the objection I have with this is in the foreign ownership of highway systems, and particularly in the undemocratic process by which the plans for its construction are being made. Without a democratic process and a voice to represent our interests, you can bet that our people will not be served well, and in fact, will lose big.

  • 0 Comments
  • Filed under: Politics
  • Flock Rocks

    I’m using Flock (1.2 beta) right now, and I have to say, I’m hooked.  Imagine the amazingness of FireFox, enhanced with the ability to keep in touch with all of your friends using facebook, flickr, digg and their blogs.  It’s like a special world-view just for me.

    When I open it up, I can see who’s added new photos to their flickr stream, or what friends are doing right now on facebook.  I just found out that my old buddy from Rock Creek, Adam Mars, went on a trip to Europe that I didn’t know about! :)

    I’ll play around with it for a little while longer and see if the two of us (me and Flock) have any “irreconcilable differences” before switching.  Anyway, nice job, Flock team!

    Simplifying Rails Fixtures with Contexts

    The Fixture Debate

    If any of the debates at the Mountain West RubyConf last March could be called “heated”, I’d say the hottest one came when we started to discuss unit tests and functional tests in Rails.  I might be reading my own story into things, but what I got out of the discussion was that there is a consensus surrounding the idea that unit tests are good, and we’re all glad that Rails ships with a testing suite, but the brittleness of testing with fixtures is something that has yet to be solved universally.

    The Flexible Solution, Redux

    I’ve approached this problem before and offered a “flexible fixtures” patch (twice) to the core team that never made it in.  (It’s ok, I’m not bitter… I just think it’s a higher priority than they do).  With that patch having long been laid aside, I offer here a simple fix that will add much of the same functionality with a small change (fewer than 20 lines of reasonable length) to your test_helper.rb file (see below).

    What you get is the ability to specify the directory (i.e. the “context”) from which to load certain fixtures. For example, you might have several fixtures that are always loaded (e.g. drop-down box data or other basic data that is required just for your app to run) and then several scenarios or contexts that rely on that base level of data.

    This is how your unit test would look using this “context_fixtures” call:

    class AccountingRulesTest < Test::Unit::TestCase
      context_fixtures base, :cities, :countries, :holidays
      context_fixtures three_clients, :users, :accounts, :transactions
    
      def test_transactional_banking
        # … etc.
      end
    
      # … etc.
    
    end
    

    You can use context_fixtures in your functional tests this way, too.  I organize my test/fixtures directory into subfolders such as test/fixtures/base, and test/fixtures/three_clients, etc.  Note that this solution is not as flexible as the “flexible fixtures” patch, since it still requires that the fixture files map one-to-one to the tables in your database.  As usual, however, it’s ok to choose not to load data into some tables.

    Keeping Your Deprecated Fixtures Around

    If you’re in the middle of a project and you realize that you need these contexts in order to reduce the complexity of writing tests, what do you do with the test cases and data that are already working just wonderfully?  You don’t want to have to discard those.  Instead, you could create your own custom TestCase classes, like this:

    module Test
      module Unit
        class DeprecatedFixturesTestCase < TestCase
          self.fixture_path =
            File.join(RAILS_ROOT,
                      test, deprecated_fixtures)
        end
      end
    end
    
    module ActionController
      class DeprecatedFixturesTestCase < TestCase
        self.fixture_path =
          File.join(RAILS_ROOT,
                    test, deprecated_fixtures)
      end
    end
    

    After adding the above code to your test_helper.rb file,

    1. Rename the current “fixtures” directory to “deprecated_fixtures”, and
    2. Use this DeprecatedFixturesTestCase class as the superclass of all of your “deprecated tests”.

    It took me just a minute or two to search and replace “TestCase” with “DeprecatedFixturesTestCase”. With that change, from here on out, just use the regular TestCase class for your new tests and use “context_fixtures” instead of “fixtures”.

    Context Fixture Source Code for “test_helper.rb”

    ENV["RAILS_ENV"] = test
    env = File.dirname(__FILE__) + /../config/environment
    require File.expand_path(env)
    require test_help
    
    # Add a little more granularity to our fixture
    # directories so that we can load some fixtures from
    # one directory (context), and other fixtures from
    # other directories.
    class Fixtures < (RUBY_VERSION < '1.9' ? YAML::Omap : Hash)
      superclass_delegating_accessor :contexts
      self.contexts = {}
    
      alias context_free_initialize initialize
      def initialize(connection, table_name,
                     class_name, fixture_path,
                     file_filter = DEFAULT_FILTER_RE)
        if contexts.has_key?(table_name.to_s)
          fixture_path =
            File.join(RAILS_ROOT, test, fixtures,
                      contexts[table_name.to_s],
                      table_name.to_s)
        end
        context_free_initialize(
          connection, table_name,
          class_name, fixture_path,
          file_filter)
      end
    end
    
    module Test
      module Unit
        class TestCase
          self.use_transactional_fixtures = false
          self.use_instantiated_fixtures  = false
    
          # Provide the ‘context_fixtures’ class method
          # in conjunction with our modded Fixtures class
          # above.
          def self.context_fixtures(context, *fxtrs)
            fxtrs.each do |f|
              Fixtures.contexts[f.to_s] = context
            end
            fixtures *fxtrs
          end
        end
      end
    end

    Tags: , , ,

    I’m a fan of capitalism.  But increasingly, I have begun to see socialism in a light that has softened my view somewhat.

    As I blogged about earlier, you can take capitalism to its extreme and see that it doesn’t work at every level of society: what would it be like, I asked, if capitalism were employed at the family level of society?  It would be absurd to not have things in common, or to let the fastest children eat first and let the others starve.  But on the other hand, capitalism has clearly taken us (humanity) a long way—in fact, it is still at present the most efficient economic system in the world—but I wonder if some of its underlying assumptions might be changing.

    Adam Smith’s “invisible hand” is a remarkable product of the exchange that happens when an individual makes a prudent decision in behalf of him- or herself—more often than not, the decision also benefits society in a way that leads to progress for the whole.  In contrast to competition in the marketplace, however, cooperation is almost always more beneficial for the individuals and the group.  The problem is that cooperation does not scale.

    Things are changing, though.  Technology is shrinking the distance between people and cultures, and enabling us to see more, connect more, and even think better about large-scale problems (for example, see this visualization presentation by Hans Rosling on world statistics). Given this trend, what if cooperation could outsmart and outperform even the almighty market?  What if cooperation could become scalable on the level of a whole country, or even the entire planet?

    I think of capitalism as the most efficient system with the “lowest common denominator” for a large number of independently acting agents.  Because these agents (i.e. you and I) have no way of making intelligent decisions in behalf of people whom we don’t know and don’t understand (i.e. almost everyone else), then the best possible decision we can make is whatever will most benefit us and those we are aware of.  So capitalism can be a local “win” when it is moderated by good judgment and compassion.  On the flip side, though, capitalism is often harmful to many people even though the people doing the harm can’t see a direct connection between a decision and its effects.  (If you’d like a good example of this, see the documentary film, The Corporation. Many of the CEOs of large companies don’t know or don’t want to know what their bottom line is doing to people.)

    So you have this interesting paradox where smaller communities and even smaller families work on socialist principles—for example, having access to public parks, or sharing bedrooms, toys, food, living space, etc.—while the larger communities (corporations, multinationals, each of the states, and the federal government) are primarily working on capitalist principles.  Somewhere in the middle, these two ideologies meet and we have flames from both sides erupting into a firestorm of words and blame.  We have the Democratic party and the Republican party.  We have public schools, and private schools.  We have the USPS and we have Fedex.

    What I’m really curious about is whether or not technology—specifically internet-based social networking—can help bring these two apparently paradoxical ideologies into some kind of hybrid that is better than any system we’ve ever created.  One inspiring video was created by a professor of Cultural Anthropology, Michael Wesch, at Kansas State University which explains where the social web is now and where it’s taking us.  Have a look at Web 2.0 … The Machine is Us/ing Us:


    Professor Wesch brings home the idea that we are the machine.  It’s not just that we are using a computer anymore: we are creating something larger than ourselves—the computer is using us too.  This ties in very closely with the futurist ideas of Ray Kurzweil that I’ve been reading about.  In his book, The Singularity is Near, machines are described as an extension of what it means to be human.  The 1980s may have done us all a bit of a disservice by fixing us on a somewhat limited view of what a “robot” and “artificial intelligence” is.  Smarter and smarter programs are becoming a part of our everyday lives… whether it’s an automated flight system, or the bartering for electricity that happens at the utility company, or the massive flow of human information now available on the web.

    In short, I think it will soon be possible for us to solve the capitalism / socialism paradox by making it easier to know about and understand others and by increasing our capacity to reason about problems on a larger scale.  When these two ideals meet, then perhaps we will become an even more efficient and compassionate society by capitalizing on cooperation.

    Thanks to ReadWriteWeb for an excellent article on Social Media that pointed me to Wesch’s work.

    Tags: , , , , ,

  • 4 Comments
  • Filed under: Politics