Overactive Vocabulary

When In Doubt, Ameliorate

RSS

Kernel#backtrace

The other day I was cranking along on part of our Spreedly codebase, furiously working to get it ready for the launch of our new marketing site and the publicity that (we hoped) was due to come with it. Now, it may not be obvious from the outside, but we re-did a lot more than just the look and feel of Spreedly, and as part of that I was working on getting billing working smoothly throughout the system.

One of the key things about how we bill is that a lot of it’s made up of very small metered charges. Because they’re so small, it’s not a huge deal if a metered fee here or there falls on the floor, and so as long as we never over charge a customer we’re more concerned with fixing issues that come up than we are with capturing every last penny. Thus there are various places in the chain of “add a fee” where things could go wrong that we just let them fail and notify ourselves rather than writing fancy recovery code.

But of course, this only works if you notify yourself in such a way that you can fix the problem, and that means a stack trace should show up in the notification. As I coded along I found myself in a situation where something could go wrong and yet it wasn’t due to an exception but rather just due to an “unexpected input” situation. That meant I had no exception to grab the stack trace off of, and for a few minutes I was stumped.

Now, I knew about Kernel#caller, but the problem with it is that it starts with (as indicated by the name) your caller’s stack, and in this case I wanted the stack to start right where I was creating the notification. Turns out there’s a simple solution:

1
2
3
4
5
module Kernel
  def backtrace
    caller
  end
end

I dropped that code in a Rails initializer and then just called backtrace when building my notification, and it works beautifully.

Now, I’m pretty cautious about going in and adding methods to Kernel, but I think this is a good example of why it’s nice that Ruby lets us do so when we want to. If you find yourself needing a backtrace without raising an exception, I hope this helps you out!

Do It Again

When you’re raising six children, you repeat yourself. A lot. Sometimes it’s words: “No singing at the table, please.” Sometimes it’s actions: by the time number six came around, I’d done the “put the kids to bed” thing thousands of times. And often it’s pure joy: I’ll never tire of giving out hugs and kisses, and I’ll never tire of receiving them either.

Fact is, kids thrive on repetition. Knowing what comes next lets them anchor their constantly changing minds and bodies in something steady and unsurprising. If you give them a drink every night before they get in bed and then forget one night, they’ll be up five minutes later reminding you that you missed your cue. If they take a nap every day in the afternoon and for some reason it’s missed, the whining will commence and you’ll know exactly from whence it springs.

The dawning realization I’ve had over the past few months is that it’s not just children that are well served by thoughtful repetition. Turns out I’m a lot happier and healthier when my life has a cadence as well. By dint of living in a house full of little ones I’ve found myself slotted into a whole bunch of different repeating cycles whether I like it or not, and I’m finding that I do like it, and even thrive on it.

Of course as adults we’re used to having a degree of ritual in our life. We typically have some sort of weekday routine - get up, get pretty, get fed, get to work, get working, get home, get relaxed, get to bed - and the weekends are another cycle that repeats every week without fail. But often these are seen as indicative of drudgery, and something we should always be looking for an escape from. “Leave the work-a-day routine behind!” they say, and we nod our heads in agreement as we begrudge each time the wheel goes around and we find ourselves still on it.

But what if the problem isn’t the repitition, but rather our attitudes about it? What if what’s really needed is a more child-like mind, resting in the stability that a routine provides, and delighting in the things that can be learned and experienced within it? Going back to fundamentals, who gets tired of breathing a few times a minute, or eating a few times a day, and wishes they could escape from the terrible sameness of repeating those activities again and again?

I’m finding that my mistake as I left the routines of my parents’ household was that I let routines happen to me, instead of purposefully building routines that I could embrace and enjoy. I know I’ve certainly gone months feeling dislocated each time a particular cycle repeated itself, largely because I’d allowed it to be imposed upon me without ever thinking through whether it was worthwhile or if it could be tweaked to make it more enjoyable. If you’re going to do something over and over again, it ought to be something you enjoy!

When properly applied, repetitive practices are powerful, and an inescapable part of what it means to be alive. I’ve decided to reclaim the word “ritual” from its spot on the list of “things you’d never intentionally add to your life” and use it to describe these patterns that can be really meaningful and powerful if embraced. And in future posts I want to walk through some of the rituals I and our family as a whole now enjoy, and talk about how we’ve both accidentally stumbled into them and at other times deliberately instituted them.

And hopefully, with a bit of “ritual” applied to my writing, it will become regular enough for those future posts to actually happen!

Putting Facebook on Ice

This is the last thing posted to my Facebook profile, probably forever:

"Time to ice my Facebook account. Going to cut it to just family, turn off the Twitter bridge, and disable all notifications."

This morning I did exactly that: I hopped on Facebook, removed all my non-family friends, deleted all my “Likes”, deleted all the Apps I had given access, left all groups, and went through and (laboriously!) turned off every email notification Facebook has. I now exist on Facebook, but really only as a pointer to where I’m actually participating online.

So two questions immediately come up: why? And why not go all the way and delete the account altogether?

The why is pretty easy: I’ve come to despise the social model of Facebook. The simplistic, synchronous “friend” model is good at putting content in front of me that I feel compelled to read, but bad at putting content in front of me that actually enriches my relationships. Add to that the giant sucking sound that is Facebook’s effort to grab as much personal content and then make that content as public as they can get away with, and I end up with a tinge of self-loathing every time I lose a half-hour to reading about the intimate details of the lives of people I don’t even know any more (if I ever did at all).

Facebook feels (to me) like Pleasure Island in the story of Pinocchio - a fun place designed to draw you in and make an ass of you, so that eventually you’ll turn a profit for the owners. I don’t feel that there is much empathy from the organization for their users, rather that the trajectory of the company is to exploit baser human tendencies to “drive higher engagement” and make a quick buck. Even the usage of an advertising business model in a social context just feels crass in a way that (for instance) Google ads never have; sort of like that person you found out invited you into their social circle so that they could sell you Amway products.

This is of course just my personal take: I know many folks get a lot of mileage out of Facebook, and feel that it has merit, and I say, “More power to them!” Which brings me to the second question, well put by Mr. Bass:

"Go all the way… just deactivate it completely!"

Why not go all the way and just delete the account? Well, first of all, there is no such thing as “delete” on Facebook, at least not as far as I can tell. While going through and cutting my Friend list down, there were two people, including one Matthew Bass, who were still in it even though they had “deleted” their account. So it seems kind of like a pointless gesture.

More importantly, my goal here is to stop putting value into Facebook, not to punish myself by disappearing from it completely. People can still find me by my email addresses, see where I’m actually hanging out via the links in my profile, know that I am related to that other Talbott they know, etc. If anything my super minimal ongoing presence on the site makes more of a statement than deleting the account would, by saying, “Yes, I know about Facebook, and I actively choose not to participate in it.”

And, with a still valid Facebook account, I can continue to check out the services that require it, take a peek when Facebook does something new to tick off the internet (I bet your listed email address on the site is @facebook.com, isn’t it?), and generally not get totally out of touch with non-geek consumers, which is an important set of people to understand. And I get all of these ongoing benefits without much more attachment to the site than I would have had I “deleted” my account.

So, going forward, you can find me on App.net and Twitter. And contact me via email. And read my latest thoughts here on the blog. And you can probably even send me a message on Facebook… but if a message gets sent via Facebook and there’s no email notification, will it ever get read? Probably not.

Enabling Fields With Capybara’s Rack-test Driver

I was writing a Cucumber test for Spreedly today, and was getting frustrated when the fields I was filling in were silently being ignored. It turns out that when using the rack-test driver with Capybara, it (rightly so) will not submit any form fields marked as disabled. This is great and all, but since these form fields are normally enabled via Javascript as the form is interacted with, I was stumped. How to get them to be passed without monkeying around with a driver that does full Javascript?

Turns out it is possible, but you have to dig pretty deeply into Capybara’s guts to make it work. If you’re using Cucumber, just drop this into your support directory:

Then use it by calling it within a step definition with whatever fields you want enabled.

It should also adapt easily to non-Cucumber environments; just make it accessible and call it alongside the code that attempts to set the fields.

Hopefully this saves someone else some time; I’ll never get that half-hour back myself!

The Great Blog Reorg

I’ve found my desire to write goes through phases; for awhile I’ll feel like I have nothing to say, and barely even scratch out the occasional tweet. But then I’ll go through a time when I have a bunch of ideas bubbling up that I want to explore in prose, and while “micro-blogging” (whether it be app.net or Twitter) is fun, it just doesn’t suffice.

The problem is, if I don’t like the place that I have to blog, I’ll tend not to write anything, which means I miss out on the thinking process involved with composing longer writing. It’s been a couple of years now since I’ve been happy with my blogging setup, and just recently I’ve been getting the writing itch really bad and its finally culminated in me getting my blogging house in order.

The whole thing is complicated enough that I actually sat down and mapped it out. I had two key goals: first, I wanted to separate out a family blog (birth announcements, Christmas letters, funny kid quotes) from my personal geeky musings. And I wanted to put both of those blogs onto platforms that made sense for them, rather than forcing Katie (and eventually the kids) to use the same tools as myself.

I also had a key requirement: do not break the internets. In other words, preserve permalinks, comments, etc. I’m not willing to abandon old content just because I’m moving to a new platform, and as they say, “We have the technology.” So a migration plan was key.

Here’s my final map:

  • blog.talbott.ws -> Page sending folks to either family.talbott.ws or nathaniel.talbott.ws
    • blog.talbott.ws/[permalink] -> Octopress serving archived postings
    • blog.talbott.ws/archives -> Octopress archive page
  • family.talbott.ws -> Tumblr
    • Link to blog.talbott.ws archive page
    • Link to talbottkids.tumblr.com archives
    • Link to nathaniel.talbott.ws
  • nathaniel.talbott.ws -> Octopress

I used the Jekyll migrator to export the old Mephisto content into an Octopress repo, then deployed it to Heroku. Thankfully Mephisto used a sane url structure, so it was easy enough to preserve the article links. I tweaked the default theme a bit so that it looked similar to the old one, and also put in some handling for legacy (pre-Disqus) comments imported from Mephisto.

Next I set up a Tumblr blog for the family; Tumblr has a nice iPhone app, looks good with short snippets of content, and is just generally maintenance free. Still on the list is figuring out a solid way to back up the content there, though I think that’s doable via their API.

Finally, I’m getting my personal blog rolling. It’s also Octopress, and I’m deploying it to Github. The plan is to shortly replace the default Octopress theme, though that’s not my main priority at the moment.

And now I have a solid place to write - w00t! As they say on the internets:

FEELS GOOD MAN