Losing the meaning of your vote

My good friend b1-66er wrote this post about how he’s decided to vote. Please go read it, then compare your thinking to his, and mine – I started this as an email to him, but I’ve decided to post it here in case any of the other four of you who read this are thinking along the same lines.

Hey sir,

I read your post about why Obama has lost your vote, and I wholeheartedly agree with all of your complaints. However, you do live in a swing state, and your vote does count for something, so I’m asking you to this about this differently.

The question you’re answering with your vote isn’t “does Obama deserve another term?” but “Who would be better to run things for the next four years?,” and Obama and Romney are the only two available choices at this point.

Please set aside your (valid! correct!) feelings about Obama’s sickening and shameful performance on this issue and vote for him anyway, because the alternative is so much worse: I truly believe that Romney would take us further back to darker ages on many issues, *including* this one, but also women’s rights, gay rights, poverty and the social safety net, strategies for the economy and job creation, taxation, foreign policy, … nearly all the issues I can think of. There’s also the matter of the two Supremes likely to be appointed next term.

Then, after the election, maybe take a stronger role with one of the groups fighting the administration over Obama’s failures: possibly even less meaningful than your specific vote, I know.

But don’t think that voting for the wrong guy (or not voting at all) out of spite would have the effect you want – that seems like a great way to have your vote mean even less.

Yer pal,
…stearno

7:44 am — GeneralComments (1)

RubyMine, Firefox, and Exception Backtraces

I use RubyMine and Firefox for most of my day-to-day Ruby on Rails development, and in spite of my best efforts, I sometimes get exceptions that result in the display of Ruby backtraces instead of the web page I asked for.

While the backtrace helpfully lists the places in my code (or Rails, or the Ruby libraries, etc) that we traversed on the way to the crash site, opening the file in RubyMine to see more context requires copying the path, invoking a RubyMine keyboard shortcut for open-file, and pasting. Work.

After a lot of this copy and pasting, it occurred to me to join Firefox’s ability to invoke a program for a particular URL scheme, and the command-line wrapper that RubyMine can produce to open files in a running RubyMine instance.

This gist is the result: it’s a Rails initializer that produces “mine:” links in backtraces. It starts with instructions on setting up Firefox and the RubyMine wrapper; once you’ve followed them, you’ll get links in the backtrace that’ll take you directly to the source where an exception occurred.

(Note: I’m using this while working on a Ruby 1.8.7 / Rails 2.3.4 application, and as you can see, it monkey-patches the backtrace functions in Exception; I fully expect to have to update it for newer Ruby and Rails versions – if you find that changes are needed, or have other suggestions, please let me know in a comment. Thanks!)

5:21 pm — GeneralComments (0)

A Christmas Tradition, from 1976

Continuing the tradition started three years ago, here’s my Dad’s fourth “obscure” Christmas card, from 1976:

(The small image is a little blurry – click on it for the full-size image.)

Previously: 1975 1974 1973

10:52 pm — GeneralComments (0)

A Christmas Tradition, from 1975

Continuing the tradition started two years ago, here’s my Dad’s third “obscure” Christmas card, from 1975:

Previously: 1974 1973

8:00 am — GeneralComments (3)

Quicker WEBrick startup

Despite its popularity WEBrick has gained some notoriety since the code is completely undocumented.
Wikipedia’s WEBrick page

WEBrick is the little web server in the Ruby standard library, and I’ve used it several times when I’ve needed to embed a little server in a project. I noticed a couple of problems in my latest little program: it took a few seconds to start up, and always included a “TCPServer Error: Address already in use – bind(2)” warning in its startup messages.

After watching this happen a few dozen times, I found solutions to both these annoyances, and they’re here in the hope that someone else will Google their way here: just create your server object like this:

# This fixes the slow startup
Socket.do_not_reverse_lookup = true
 
# Using :BindAddress to say "bind to all interfaces" fixes the address-in-use warning
server = HTTPServer.new(:Port => my_port_number, :BindAddress => "0.0.0.0")
8:45 am — GeekeryComments (0)

Running away to the circus… for a few minutes

I surprised Gina tonight with a trip to see Cirque du Soleil’s “Kooza,” which just opened in Portland. She didn’t figure it out until she saw the tent, so that’s nice: I kept throwing her off with false answers to her questions: Her: “Is this an event where I’ll have to introduce myself?” Me: “Oh, yes, everyone will.”

To cut to the chase, this was my favorite Cirque experience; I’ve seen several of their shows over the years, starting with a private performance for Apple folks in the San Francisco Civic Auditorium, sometime in the late ’80s. This time, the music was great, and the athletic performances were stellar — especially the new “Wheel of Death,” which, even with our under-the-end view, was pretty amazing.

The clowns were great, too, and Cirque’s sense of humor is always my favorite part of the show. Funny story: y’know how they pick people from the audience, and you wonder whether those people are “plants”? I now have firsthand experience that they’re not: tonight they picked me. In the five or so minutes I was up there, I got dragged around the stage, had my leg humped by one clown, the other picked a fight with me, and the ringmaster tased all three of us. (If you get picked for this, do nothing when he tases you the first couple of times. He’ll point at the other two, twitching on the stage, then tase you again – then you fall to the floor too, twitching like the others. Twitch some more when he tases your crotch.)

All in all, an incredible evening. Go see the show – it’s a lot of fun, even without me in it. Who knows – perhaps you’ll be!

11:02 pm — GeneralComments (0)

Open Source Bridge: Exciting the attentions of the Ingenious

I’m reading “The Invention of Air” by Steven Johnson, which talks a lot about Joseph Priestly’s experiments with electricity, discovery of oxygen, etc, and also about the scientific community of the time: Priestly had many interactions with (and got much encouragement from) Benjamin Franklin; Thomas Jefferson is also involved in the story, but I’m not to that spot in the tale yet.

Where I am in the book (p71), there’s a quote, the last paragraph from a September 1753 letter from Franklin to botanist Peter Collinson:

These Thoughts, my dear Friend, are many of them crude and hasty, and if I were merely ambitious of acquiring some Reputation in Philosophy, I ought to keep them by me, ’till corrected and improved by Time and farther Experience. But since even short Hints and imperfect Experiments in any new Branch of Science, being communicated, have oftentimes a good Effect, in exciting the attentions of the Ingenious to the Subject, and so become the Occasion of more exact disquisitions and more compleat Discoveries, you are at Liberty to communicate this Paper to whom you please; it being of more Importance that Knowledge should increase, than that your Friend should be thought an accurate Philosopher.

(You can read the whole letter, which details Franklin’s recent researches into electricity, here — it starts on p148, ends on p153.)

I’m inspired to post this here because I happened to have just registered to attend Portland’s Open Source Bridge conference, coming up June 1-4 — the open source movement is the next Age of Enlightenment.

2:06 pm — GeneralComments (0)

A Christmas tradition, from 1974

Last year I started a new tradition and posted my Dad’s first “obscure” Christmas card from 1973; this year’s reposted card appears just in time, because technical difficulties knocked this site off the air for the last couple of weeks.

Here’s Dad’s 1974 card – it’s one of his easier ones, made even easier when I tell you that those white dots on the right were made with a punch and go through the card. Merry Christmas!

11:41 pm — GeneralComments (2)

Rails 2.3.3 + mocha = confusion

I just updated a project to Rails 2.3.3 for the cool new “touch” feature, and saw here that I needed to update to Mocha 0.9.7. I did that, but found that my tests were failing – I got lots of NoMethodError: undefined method `stub’ for #<SomeTest:0x7f2c1d921f80> errors.

In my project, I’d declared my dependence on the Mocha gem in my config/environment.rb file, so that “sudo rake gems:install” would load everything required for development in one shot (which is why the dependency isn’t in config/environments/test.rb). I’ll cut to the chase: I needed to add an extra option to that declaration:

config.gem 'mocha', :version => '=0.9.7', :lib => false

The problem is that mocha configures itself based on what test library you’ve already included when you require Mocha. Unfortunately, the config.gem declaration causes mocha to be loaded before Rails has loaded Test::Unit, so Mocha doesn’t configure itself… so no “stub.” Setting :lib to false postpones loading Mocha until you actually do it in your test/test_helper.rb (or wherever).

3:48 pm — GeekeryComments (1)

Automatic wireless goodness

I often work in coffeeshops and other places that provide free wireless networks. Since anyone could sniff traffic sent over these networks, I’ve set up my own virtual private network at home so that my traffic will be encrypted before it leaves my laptop, then decrypted on a server at home and sent out from my home network – this also gives me secure access to a couple of machines at home that aren’t otherwise accessible from the internet. I use OpenVPN for this; it’s open-source, it was relatively easy to set up on my Ubuntu server, and there’s good support for OpenVPN in the Network Manager included on my laptop (also running Ubuntu).

This worked great for a while, but a few things bugged me:

  • The VPN connection doesn’t happen automatically – I had to remember to do it, and would sometimes forget;
  • my favorite hangouts’ wireless networks ask me to accept terms of service every time I use them, and that got annoying;
  • and whenever the DHCP lease renews (which is every few minutes in some places), the DNS server configuration would be reset to point at the shop’s DNS server instead of the one I run (so I’d lose the ability to refer to my home machines by name; it’s also possible that the public DNS server is less secure than mine, so that’s not good).

I set out to remedy these problems, and it turned out to not be too difficult; I learned a bit about Network Manager in the process, too. Network Manager can automatically run a script when it associates with a wireless network, so I wrote this Python script; it solves the first two problems: it looks to see what network we associated with, and if it’s not my home network, it creates the VPN connection. First, though, if it’s one of the networks that requires a terms-of-service acceptance, it accepts them and submits the form. (The latter mechanism is specific to the Portland Telco Project networks we have here in Portland, but you can probably figure out how to customize it to your own networks – if not, leave a comment.)

The third problem, where DHCP renewal clobbers DNS settings, seems to be known but unfixed: here’s a bug about it. The person who reported the bug posted a workaround for this problem. I’m not sure it’s the right change for everyone, but I’m happy with it in my case: it’s a one-line addition to /sbin/dhclient-script; insert this line just after the start of the make_resolve_conf function that’s first in that file:

[ "$reason" = "RENEW" ] && return

This shortcuts the function that would be overwriting the DNS settings to do nothing if we’re renewing the DHCP settings. (Admittedly, if the DNS server addresses changed, I wouldn’t know about it, but my home DNS server’s address hasn’t changed in a while, and I wasn’t in a coffeeshop when it did.)

With these mechanisms in place, I can open my laptop and see Network Manager’s progress by looking at its icon in the menu bar: I see it associate with a network and go through the VPN connection process, without me having to do anything. Perfect.

[Update: Almost perfect: in cleaning up the script for posting, I broke it — I've fixed it.]

3:29 pm — GeekeryComments (5)
Next Page »