Older blog entries for Skud (starting at number 220)

The problem with doing one thing well

You’ve probably heard the tech startup aphorism “do one thing well”, or a variant on it. “Don’t try to do too many things”. “Focus.” Whatever.

I’m not very good at following it, as is pretty apparent from what I’m working on. Growstuff has several things it’s trying to do (crops database, garden journal, seed sharing, community building), all interlinked.

Every so often someone points me at a website that does just one thing of the set of things we’re trying to do. For instance, the other day I got an email from a Transition Town contact, suggesting I look at RipeNearMe, which offers produce sharing/trading. If you’ve got extra lemons or zucchini or eggs, you can offer them for sale to people nearby. Great! The website looks fantastic, and they’re starting to get people listing stuff. (If you want to see some examples of what they’ve got available for trade, check this neighbourhood near me, which has a few things listed, though it’s sometimes slow to load.)

The Transition contact went on to say that maybe Growstuff should “join forces” with RipeNearMe, so as to avoid duplicating effort.

The problem is, we can’t. RipeNearMe doesn’t have any way for us to integrate with their data. There’s no API, and their terms of use are restrictive and prevent us from using their data in any way. (There’s also no open development community we could join, but that’s not what I’m discussing in this post.)

There are a lot of gardening sites out there that do one thing, often very well indeed: a Q&A forum, a seed swap site, a database of planting times, garden layout tools. But when we talked to people who used them, they said “I used this site for a while, and it was useful for that one thing, but I really wanted $other_thing as well.” Usually there is another site that offers the desired feature, but it doesn’t integrate with the first one. As a gardener, you need to use a dozen disparate sites, re-entering your garden data in each one, and having to check in on each of them regularly to keep them updated. It’s no wonder that so many gardening sites, flourishing at first, start to die down after a season. Before long you can see weeds growing everywhere.

That’s not to say that open data and APIs solve everything — I’ve written before about how importing data is hard — but without them it’s impossible to integrate anything.

I’m reminded of Anil Dash talking about the web we lost: heavily interlinked, easily syndicated, less silo-ed. I’m also reminded of the Unix philosophy and especially of pipelines. Unix commands “do one thing well” — sort a series of lines, count words, spit out the contents of a file — but they don’t work alone. You can chain them together to say things like “show me the wordcounts of all these files in descending order”, or express even more complex ideas, as if building a tower from blocks.

Now think of that in terms of gardening websites. How awesome would it be if you could say “take my garden layout from SmartGardener and import it into my to-do list on Growstuff, then cross-reference it with the planting dates on Gardenate and the weather feed from the Bureau of Meteorology, and tell me when to plant things. Then when I harvest the results, let me post my excess across to RipeNearMe and, heck, why not CraigsList too?”

That’s pretty unlikely to happen, but until it does, I feel pretty justified in not doing “just one thing” with Growstuff. “Just one thing” only works if you can integrate with other things. If you build one amazing feature and put a fence around it so nothing can get in or out, what’s the point?

Syndicated 2013-07-27 01:17:12 from Infotropism

A realisation about working for myself

One of the best things about leading my own project has been not having to pretend I’m some sort of shit hot programmer. It’s nice to be able to to say “argh, that’s too hard, fuck it” or “I have no idea how this works” without worrying about my performance review.

Of course, I also like to claim that I’m providing a visible example that it’s okay not to be perfect or know everything, to help make it less scary for our newer contributors. But mostly it just feels good to realise that the pressure’s off, I don’t have to pretend to be what I’m not, and I can learn and get shit done at my own pace.

Syndicated 2013-06-13 05:20:48 from Infotropism

Travels: SFO for the weekend, PDX for Open Source Bridge

Hey, I am massively disorganised this week, but I figured I should probably mention that I’m going to be travelling and would like to catch up with people.

Saturday 15th to Monday 17th June, I will be in San Francisco, mostly in the Castro/Mission/ish area. Social activities planned so far include:

  • Saturday afternoon: hanging out on Liz Henry’s patio in Bernal Heights, with laptops and snacks and generally socialising. Likely to be a hackerish/feminist crowd. If you know Liz and where she lives, just show up. If you don’t, then she says to email her and she’ll give you directions.
  • Saturday evening: drinks and foods at The Liberties, corner of Guerrero and 23rd. My old local. I believe that a space has been booked for a group in either the back or side room. Not sure what time this’ll go to, but just a warning that I’m not likely to make a very late night of it what with jetlag and stuff.
  • Sunday morning: brunch at Erica’s, and again, if you know her then you know the drill.

Sunday afternoon/evening are unscheduled, but I would expect that we’ll probably have some kind of dinner plans, so let me know if you’d like to be part of them.

Monday I’m hoping to have lunch with the Metaweb crew at Google (I’d better email them about that, huh?), meet up with some other folks (yipe, gotta email them too), and then off to PDX in the evening.

PDX: mostly I’m just gonna be at OSBridge. I’ll be keynoting Wednesday morning, and splitting my time between talks and the hack lounge. I think there has been talk of an outing to yarn and/or fabric stores at some point. Yes? Then, the weekend afterwards, some Growstuff folks are going to carpool and head out into the country to visit some farms and community gardens and stuff like that.

I would love to catch up with as many people as possible, so please, drop me a line if you’d like to have tea or burritos or go yarn shopping or whatever. See you soon!

Syndicated 2013-06-12 08:48:44 from Infotropism

Sadly, I suspect that cosplay would be frowned upon.

Not many people will be as excited about this as I am, but I just found out that the local Unitarian Universalist Church has a lecture about “Muscular Christianity and the English boarding school system” on Sunday July 14th. I am so there. </nerd>

Syndicated 2013-06-11 09:24:25 from Infotropism

Meetups, redux

Me: “Hey, housemate, do I want to go to the local technology group’s monthly hack night tonight? They posted about it to the mailing list but didn’t mention the time, the facilities available, or whether there’d be food, but I managed to figure out the location by looking at older mailing list posts, and I’m guessing it might be at 6pm, the same time they hold their meetups. There’s no information about it on their website.”

Housemate: “What’s the best case and worst case scenarios?”

Me: “Best case: it’s where and when I think it is. There are bunch of cool people hacking on awesome projects. I find someone who is knowledgeable but doesn’t yet have a project to hack on, and they pair with me on Growstuff. Someone has provided pizza, including good vegetarian options, and there are drinks other than beer. We get lots of good stuff done, and they sign up as a contributor long-term.”

Housemate: “And worst case?”

Me: “I take public transport for over an hour to get there, find a motley group of people, some of whom I dislike or who dislike me, others of whom just dismiss me as not a serious/cool enough coder. There is no food, and I haven’t had dinner, so I wind up low blood sugar and cranky. I try to work by myself but nothing goes right and I give up in frustration. I spend over an hour getting home again. In the rain.”

Housemate: “I have to say, the worst case sounds more likely. If you want to get out of the house that badly, you could just go for a walk.”

Housemate gives good advice. I’m going to go for a walk. I wonder if the grocery store has paneer?

Syndicated 2013-06-11 06:38:07 from Infotropism

Thankfulness

A while ago I realised I was starting to get ridiculously cranky and negative about things, so I’ve been trying to turn that around a bit. Lately whenever I catch myself feeling shitty about stuff, I mentally list three things to be thankful for. I try not to repeat stuff (at least not too close together), and I try to think the full sentence, “I’m thankful for…” for each thing, rather than just making a quick list. It seems to be helping so far. So if I seem slightly less cranky lately, that’s partly why.

PS. anyone who refers to this as a “life hack” will get to witness me rolling my eyes and/or miming sticking fingers down my throat, which is way better than the punch in the face that would previously have been my default response.

Syndicated 2013-06-01 02:52:28 from Infotropism

Rails controller specs: matching on redirect URLs

Yet another thing I figured out painstakingly, by finding random bits of documentation in places other than the documentation, because apparently that’s how Rails rolls.

Here’s my situation. I have a controller spec like this:

  describe "GET checkout" do
    it "redirects to Paypal" do
      member = FactoryGirl.create(:member)
      sign_in member
      order = Order.create!(:member_id => member.id)
      get :checkout, {:id => order.to_param}
      response.should redirect_to "http://paypal.com/..."
    end
  end

Basically I want to check that when someone checks out, they get sent to Paypal. Easy peasy, right? The thing is, I don’t know the exact URL they’ll get sent to — it’ll be big and complicated and have lots of parameters on it, and it’ll be different in test anyway, and umm… ok, well, basically I just want to test whether I get redirected, and whether it’s to somewhere paypal-like. Ideally I want to do something like:

# doesn't work
response.should redirect_to /paypal\.com/

… and have it do a match against the URL it’s redirecting to. But that doesn’t work.

I googled every-fucking-where trying to find out what else I could do with the response object, but it doesn’t appear to be documented anywhere official. In the end I found this blog post on Response object methods by Jeff Roush. Thanks, Jeff!

In conclusion, here’s how I’m testing for a redirect that matches against a regexp:

response.status.should eq 302
response.redirect_url.should match /paypal\.com/

(There’s also a redirect_url_match? but it seems to be deprecated.)

Hope that helps someone else, and that they find the answer more quickly than I did.

Syndicated 2013-05-31 02:11:54 from Infotropism

Testing PayPal Express with ActiveMerchant’s BogusGateway (and how to make it work)

If you’re writing a Rails app with PayPal Express checkout, and having trouble testing because ActiveMerchant’s BogusGateway doesn’t support PayPal-specific methods like setup_purchase, here’s a fix. I spent a while figuring this out the other day so I thought I’d note it here in case someone else is googling.

The problem

Presumably you are writing a Rails app, and are following the instructions in the RailsCast #146 Paypal Express Checkout, or something along those lines.

In your config/environments/test.rb you have:

config.after_initialize do
  ActiveMerchant::Billing::Base.mode = :test
  ::STANDARD_GATEWAY = ActiveMerchant::Billing::BogusGateway.new
  ::EXPRESS_GATEWAY = ActiveMerchant::Billing::BogusGateway.new
end

The BogusGateway just mocks the behaviour of a real payment gateway, so that you can run your tests without connecting to a real one — even in test mode. This means you can run your tests offline, for example.

So far so good. Then in your controller you have something like:

response = EXPRESS_GATEWAY.setup_purchase(order.total,
    :ip                => request.remote_ip,
    :return_url        => new_order_url,
    :cancel_return_url => products_url
  )

When you try to test the checkout method in your controller, however, you see an error message like:

undefined method `setup_purchase' for #<:billing::bogusgateway:0x000001296aca50/>

The problem is that ActiveMerchant::Billing::PayPalExpressGateway provides a number of methods that BogusGateway doesn’t duplicate. Why not? Well, apparently PayPal Express is a bit of an odd duck in the ActiveMerchant world, and mumble mumble no real reason.

The solution

There’s a pull request by sideshowcoder submitted to ActiveMerchant which creates a PayPalBogusGateway that does all the necessary PayPal-Express-specific things, but it got turned down as “not a common enough use case”. Personally I think that ActiveMerchant shouldn’t have shipped the Paypal Express functionality in an untestable form, but whatevs. You can use sideshowcoder’s fix in your own app, as follows.

First of all, in order to monkeypatch in this way, you’re going to have to take a copy of the gem and put it in your vendor/ directory. I did so following the instructions in this blog post, specifically:

  • Download the activemerchant gem from rubygems.org
  • gem unpack ~/activemerchant-1.33.0.gem --target vendor/gems
  • Repeat for the active_utils gem, which is also required.

Then in my Gemfile, I have:

gem 'activemerchant', '1.33.0',
  :path => 'vendor/gems/activemerchant-1.33.0',
  :require => 'active_merchant'
gem 'active_utils', '1.0.5',
  :path => 'vendor/gems/active_utils-1.0.5'

Finally, after running “bundle install” to make sure that all worked, I dropped paypal_bogus.rb into the appropriate place in my vendors/ directory.

Congratulations, you can now test your Rails app’s interaction with PayPal Express. Hopefully the googles will take note, and the next person searching for this won’t have to pound their head against it quite as hard as I did.

(Thanks also to Ben Bleything for some help on Twitter with the vendored gem part of this.)

Syndicated 2013-05-31 01:57:09 from Infotropism

Fed up with meetups

I went to a tech meetup the other night, an introductory session about a technology I’m interested in using. It was advertised for 6pm, so I arrived at 5:59, and found a note on the door saying it was starting at 6:30. I wasted half an hour wandering around and went back, to find a bunch of people standing around drinking beer. I didn’t know any of them, I was cranky about having shovelled in an early dinner and hauled ass into the city to be on time when it wasn’t necessary, and I don’t drink beer, so instead of socialising I decided to just grab a seat and mess around on my phone. The seats were epically uncomfortable. I looked around and saw a couple of nicer seats, so I moved to one of those. Better. I checked my email and read some of my RSS feeds.

The event organiser — friendly guy, and good on him for being sociable, I’m not complaining about that — came over and asked where I was from. I was momentarily discombobulated. Melbourne? Thornbury? I’ve just come all the way from Thornbury to be here. What did he want to know? I looked confused, and he rephrased: where did I work? Oh. I told him about Growstuff, and why I was interested in the technology the meetup was about. We chatted for a minute and he moved on.

The first talk was interesting, I guess, though I found it hard to enjoy because I’d been kicked off my comfy seat by someone who “owned” it — he worked at the company hosting the meetup and had brought his desk chair to sit in — and I was in one of the back-breaking plastic monstrosities they’d set out for the group. The talk seemed to mostly be a tour of one of the basic examples/tutorials for the technology in question, but with added commentary/advice/thoughts from someone who really knew his way around it. That was good. But was it good enough to make up for the pain and crankiness and general unpleasantness? I had a headache coming on. I took out my knitting, which at least is soothing and lets me listen without otherwise fidgeting. It helped a bit.

After the first talk there was a break, with pizza. They hadn’t advertised the pizza or mentioned it in the meetup announcement. Had I known, I wouldn’t have rushed to eat something before 6pm, and now I wasn’t hungry. There was still nothing to drink except for beer. Everyone was standing around chatting and they were all cooler and trendier and smarter than me and I wanted to cry.

I went home early.

Syndicated 2013-05-31 00:18:53 from Infotropism

An interesting documentary

A couple of weeks ago I was reading an article about Israeli politics and found myself turning to Wikipedia to fill in some of the gaps in my knowledge. Approximately 200 Firefox tabs later I found myself watching orthodox Jewish women’s headscarf howtos on Youtube, learning about Third Order Franciscan monks and nuns, and — eventually — watching documentaries about Anabaptist sects in North America.

This is one of the most interesting I found: