Jordan Brock

About Me

I'm a Ruby developer who works for Five Senses Coffee. I ride bikes.

Recent Posts

Selenium "ElementNotDisplayedError"

Jun 23, 2011

If you do integration/request testing of an AJAXified web application using Rspec, Capybara and Selenium there is a pretty good chance that you might have run into this error:

Selenium::WebDriver::Error::ElementNotDisplayedError:
Element is not currently visible and so may not be interacted with

After spending way too long to try and solve this problem (“THE ELEMENT IS VISIBLE DAMN YOU!!!!”) I found a few little tweaks to my setup that help remove and/or mitigate the error.

The key to this error is that Capybara is trying to find and/or interact with an element and it’s not quite ready on the page yet because some JavaScript hasn’t executed yet, or there’s a delay with the test web server.

jQuery Effects

If you’re running tests, there’s a pretty good chance you don’t care about any jQuery effects. You’re just interested in the result. If that’s the case, then add this line to your page layout:

= javascript_tag '$.fx.off = true;' if Rails.env.test?

That will turn jQuery effects off in the Rails test environment.

Capybara “wait_for”

This is a particularly helpful method that, like its name implies, causes Capybara to take a chill pill, and wait for a particular condition to be met. Call it like this:

wait_for(15) {page.should have_content "Some text."}
wait_for(30) {page.should have_button "Button Text"}

This just gives the page a little time to catch up before Capybara blows up on you.

capybara-webkit

A new Selenium driver from the fine folks at Thoughtbot, this is a headless (this just means it doesn’t open a visible window) browser that Capybara can interact with. Ideally it should be faster than opening up a browser window for each test. I managed to get it working, mostly. It’s still kind of new, so there are a few things missing, but it might be a good idea to watch the github project.

Or is it just because people don't like your new stuff?

May 20, 2011

A quote from John Butler on the Music Industry Piracy Investigations site:

“We sell about 40 per cent less albums than we did three or four years ago because of [illegal] downloading” - John Butler

Of course, it’s got nothing to do with the quality of the stuff they’re putting out now. No. It’s all because of the computers. Because computers weren’t around three or four years ago.

I found this site because they’d just sent a takedown notice to Cameron Adams over his brilliant Definitive Daft Punk mashup, which has got to do more to promote sales of Daft Punk than any threat of legal action will ever accomplish.

CoffeeScript, bistro_car, homebrew, and passenger gotcha

Apr 08, 2010

File under “Things for me to remember when reinstalling stuff”

For me, one of the best things about using Ruby/Rails/Sinatra for web development is HAML/SASS, which allow me to quickly write and maintain HTML/CSS without having to worry about all the pointless stuff, like brackets etc. A by-product of using HAML/SASS is that when you have to write in something else, it causes me grief. JavaScript is a case in point.

Coffeescript (and to a lesser extent) bistro_car solve this. It brings the beauty of a ruby-like language to writing JavaScript, so that once again you don’t have to worry about all the crap that goes along with it.

However, I ran into a slight problem when following Dr Nic’s setup tutorial today. CoffeeScript worked, bistro_car worked within the console, but it didn’t work when accessing the page through the browser. But some path re-working, and a kind word or two from @sutto, and we’re good to go.

For future reference, here’s what I did. I’m using the homebrew package manager. Mainly because it’s awesome, and I use MacOS X, which is also awesome.

So, I installed node.js, coffeescript and bistro_car like so:

brew install node
brew install coffee-script
gem install bistro_car

Then, add the following to your environment.rb file:

config.gem 'bistro_car'

Create an ‘app/scripts’ directory in your Rails app, which is where you can store all your .coffee files (application.coffee etc).

You then get bistro_car to include those script files by putting this in your layout/template/page/whatever:

coffee_script_bundle

Then, you load the page, and bistro_car automagically uses coffee-script to convert your .coffee files to javascript. Except, of course, when it doesn’t work because something is screwed somewhere.

As with almost every problem on a *nix computer, the problem is a path one, and thankfully solved with some simple symlinks. It seems passenger operates in it’s own little world when it comes to paths, and it just didn’t want to play nice with my environment. So, I tricked it as follows:

sudo ln -s /usr/local/bin/coffee /usr/bin/coffee
sudo ln -s /usr/local/bin/node /usr/bin/node

And that, my friend, is how you skin the unix path cat.

Back from the Edge

Nov 12, 2009

Last week, I was lucky enough to be involved with the 2009 Edge of the Web conference, which was organised by AWIA and Red Horizon Events here in Perth. We had speakers from around the world, around Australia and from Perth, who all gave great talks to an eager and attentive audience.

My role at the conference was basically to be the room monitor for the main auditorium, which meant that I only really got to see those speaking in that room. As a result, I didn’t really get to see all that I wanted to see, but I can’t complain in the slightest, because there were some fantastic presentations. And I got to see them for free. Which was nice.

So, here’s a brief run-down of who I saw, and what I remember. Unfortunately, I didn’t have a chance to take notes, so some of this is going to be hazy.

Anil Dash (@anildash)

For a few days it looked as though Anil wasn’t going to be able to make it to Perth at all. Some last minute flight shuffling, and some program jiggling saw our opening and closing keynotes swapping. This meant that Anil would be able to come, and I’m fairly sure everyone was glad that he did. It was the perfect opening for the conference: an inspirational call to arms, urging us to embrace the open web and build the apps and sites that people will be talking about. Perth can be isolated, both mentally and physically, and it was great to hear someone talk about breaking the myth of Silicon Valley.

Just a quick time out to thank Anil for his superhuman efforts in coming to speak. He ended up only being in Perth for about 35 hours, and spent 45 hours travelling to do that. I can’t imagine how he felt at the end of the trip. Thanks heaps Anil.

Lachlan Hardy (@lachlanhardy)

Having received the perfect lead in from Anil, Lachlan spoke in depth about the open web, the technologies available and the ethos behind keeping information free from copyright and the patent-lock. A great talk that hopefully encouraged attendees to challenge themselves to use open technologies.

View on slideshare

Dmitry Baranovskiy (@DmitryBaranovsk)

Always entertaining, Dmitry has the knack of making a detailed and technical journey into the world of JavaScript highly entertaining. Quote of the day: “The public scope in JavaScript is like a public toilet. You don’t know who’s done what in there, but if you have to use it, touch it as little as possible”

View on slideshare

Nick Cowie (@nickobec)

Local web legend Nick Cowie gave an informative talk on some of the upcoming features of CSS3, and how well they are supported in local browsers. He had a surprising example of some features that are supported by even the venerable IE6. One for the code monkeys.

View on slideshare

Alex Payne (@al3x)

Alex gave the opening keynote on day 2, and it was a great start to the day (ok, the coffee was the real start to the day). He spoke about how the languages and tools that we use shape the way that we approach our work. Watching Alex’s talk, I was reminded of his tweet from when he was researching the talk:

bq. “Researching tech history is a good reminder not to get too worked up about the tech of today. It mostly looks ridiculous in ten years.” - http://twitter.com/al3x/status/5327550871

While we all love a good language fight every now and then, seeing a laundry list of forgotten languages, specs and companies certainly showed that it’s not worth getting too worked up over.

Quote of the day: “Throw the wallaby over the bush fire.”

View on slideshare

Kevin Yank (@sentience)

Being entirely in love with HAML and SASS I had only paid the slightest of attention towards CSS frameworks. Kevin gave a good run through of what they are, when they’re a good idea, and how they work. I suppose it made an impact, because I actually started using aspects of the 960 Grid on a project at work.

View on slideshare

Ash Donaldson (@ashdonaldson)

Unfortunately, I only got to catch the last part of Ash’s talk, so I can’t really say a great deal about it, except that he has introduced me to an insanely addictive iPhone game: Doodle Jump

View on slideshare

Malcolm Day

After two days of talking about the benefits of various development methodologies and discussions on W3C standards and the like, it was refreshing to hear a talk about money, and to earn it. Malcolm, CEO of Adult Shop (NSFW!), gave an entertaining (and potentially libellous) talk on his journey from being an engineer for a mining exploration company to the CEO of a publicly traded ecommerce company.

Derek Powazek (@fraying)

Wow, what a close! Derek was an exceptional presenter, taking us through the types of “crazy” that we encounter while building communities on the web, and how to deal with each of those crazies. Highly entertaining and hilarious, it was a brilliant end to the conference.

View on Slideshare

I’d like to thank everyone involved in the conference, particularly the AWIA events committee (Myles, Miles, Kay and Helen) for their tireless efforts in putting on a wonderful show. I’d also like to give props to our international speakers, for taking time out of their lives to travel to the other side of the world to give a little something to the Australian Web community.

Edge of the Web - Derek Powazek

Oct 08, 2009

Derek Powazek is presenting the opening keynote at the upcoming edition of the Edge of the Web conference in Perth on November 4-6, 2009. He will be talking on the “Wisdom of Community”.

_Your keynote at Edge of the Web is titled “The Wisdom of Community”. How do you define a community on the web?_

I like to take the broadest possible definition, so I’d say that a community is any group of people brought together by some common denominator. Lots of things have invisible communities around them - people who care about that thing - even if they haven’t ever met each other. The web gives us the power to find each other, which is why it’s such a powerful, and terrible, place for social interactions.

_It seems that, given enough people, a comment thread can quickly devolve into rapid fire insults and grandstanding. How can we foster and encourage thoughtful commentary and participation?_

There are two parts to this, and you can only control one of them.

The part you can’t control is human nature. People are weird, messy, and complicated. They react strangely to things. They behave irrationally in groups. And you can’t change that.

The part you can control is how your website interfaces with that strange mass of humanity. Certain interfaces stand up better to the weirdness of humanity than others. It takes a lot of trial and error, and the line is always moving because we’re evolving.

We’re all still learning how to behave online. It’s the first time in human history that you can be both alone and in a group at the same time. How weird is that? It’s no wonder we haven’t figured it out yet.

_One of the benefits of investing your time and efforts in building a community is the the personal rewards that come from interacting with the members of the community. One of the perils of that can be when things start to go wrong and it can lead to heartbreak. You had a fairly public parting of the ways with JPG Magazine. Not wishing to get into specifics with you, but how hard was that to deal with, and did the community that you and Heather helped foster help you “heal”?_

JPG was an enormous learning experience for me, both for what I learned about fostering creative communities, as well as learning some hard truths about founding a company. There are a million stories out there about founding partners in a startup falling apart. In fact, it’s probably what happens more than anything else. The only difference in this case was that I chose to talk about it publicly. I did that because I had to - the community that built JPG deserved to know what happened. But one side-effect was that many other founders and entrepreneurs came out of the woodwork to tell me their stories. It helped me immensely to know that I wasn’t alone.

The web never ceases to amaze me. When you approach it with honesty, it comes back a thousand fold.

_With seriously large amounts of money going after the “Social Web”, do you see people having multiple social locations (eg facebook, twitter, flickr, Goole Reader etc) as a hinderance, or does this fragmentation actually help, by allowing us to compartmentalise our social interactions into different areas, much like we do in our offline lives._

Good question! To a geek, this repetition of signup, login, create profile, over and over, just seems like an inefficiency. But people are inefficient. We all maintain multiple identities already. Who we are with our parents isn’t the same as who we are with our friends. So I’m not as bothered by all these disparate digital identities as some. In fact, I think trying to meld them is going against human nature.

_“Strange Light” was an intensely quick project, born from an idea and fully realised in less than two days, and seems to have had an incredible response both from photographers and from the web at large. Do you see these magazines as having their own community? Or one that augments existing online ones (such as flickr)?_

I think that magazines are, essentially, communities. At least, the successful ones are.

In the case of the first issue of Strange Light, there were two groups out there: the people who experienced it were a community of experience, and the rest of us who saw the astounding photographs coming out of the storm formed a loose-knit community of interest.

I was hoping that a few of those two groups would want a beautiful printed edition of photos from the storm, and they did! What I like about this is it allows the web to do what it’s good at (connect people) and print to do what it’s good at (create a coveted object).

_And finally, when the hell is MagCloud going to deliver to Australia? It’s not like we’re on the other side of the world or something._

The short answer is, I don’t know. But I can tell you why it’s complicated.

Most of the printed matter around you right now is printed in China, put on a boat, and then a truck, maybe a train, and then another truck, and finally makes its way to you. It’s horribly inefficient and disastrous for the environment.

MagCloud is changing all that, because we’re going to have print partners all over the world. So when you buy a magazine on MagCloud, it’ll always be printed as near to you as possible. That way the buyer pays less, the publisher makes more, and we expend less carbon shipping paper all over the world.

But that means shipping is much more complicated than just licking a stamp. We’re setting up printing partners as quickly as possible, but it takes time. We’ll get shipping here as soon as possible. Promise.


Derek will also be running a workshop on “Creative Community Building. Tickets available now!