Chris Worfolk's Blog


Selenium Cannot assign requested address

March 15th, 2013 | Life, Tech

If you’re using BDD (Cucumber or Behat for example) with Selenium, you may find you occasionally get an error where the framework is unable to communicate with the Selenium server.

Failed to connect to 127.0.0.1: Cannot assign requested address

This seems to occur when there are two many requests going to Selenium. This can be alleviated be rewriting your tests to ensure you are now sending too many requests at once.

For example, if you’re using Behat/Mink, then avoid using the wait() function on the Session object, as this can cause excessive requests to be sent to Selenium.

The Easy; and The Worthwhile

March 14th, 2013 | Public Speaking

Last Thursday law the club level competition for the International Speech Contest.

I’m pleased to say I won the Leeds City contest and will be advancing on to the area level contest in April. I was looking forward to facing off against one of our club’s Distinguished Toastmasters, but he unfortunately dropped out. Never the less, Dinesh provided some tough competition.

If you missed it, don’t worry, the White Rose Speakers competition is happening on the 27th, so you can attend that one instead!

51% Bourbon

March 13th, 2013 | Friends

With Michelle back in town, we headed down to 51% Bourbon for some drinks.

IMG_0451 IMG_0452 IMG_0453 IMG_0458

A Blackhouse Birthday

March 12th, 2013 | Events

Where better to celebrate a birthday than Blackhouse?

IMG_0426 IMG_0430 IMG_0431 IMG_0435

Ponies

March 11th, 2013 | Photos

While up in the Dales, we found some ponies.

IMG_0364 IMG_0355 IMG_0351 IMG_0346 IMG_0341

Hollins Hall

March 10th, 2013 | Life, Photos

Last weekend, we headed up to the Yorkshire Dales for Elina’s birthday. We stayed at Hollins Hall, which is part of the Marriot chain.

It was quite a nice hotel, they have a big pool, although there were people in it which was always annoying and their spa bath was a bit rubbish. It was nice to have a decent length pool though.

The service was excellent, and the staff were friendly.

We dined in their Heathcliff’s Restaurant, which was OK, though I was a little disappointed by the roast, as the Yorkshire pudding was a bit hard and crispy. The white chocolate sauce that came with the profiteroles was a winner though.

IMG_0321 IMG_0324 IMG_0329 IMG_0323 IMG_0322 IMG_0314

Class constraints in Symfony2

March 9th, 2013 | Programming, Tech

Sometimes you need to put a constraint on a whole class, rather than a single value. Duplicate usernames are a good example of this – you don’t want to be able to set a username to one that is already in use – but if it is in use with the user you are currently working on, you don’t want to flag it up as an error!

Lets use that as an example. You have a Username constraint and a UsernameValidator object to do the actual validation. We need to supply the validator an object, so we need to put the following method inside the Username object.

public function getTargets()
{
    return self::CLASS_CONSTRAINT;
}

This will turn the first parameter in our isValid function in the UsernameValidator class to an object.

public function isValid($user, Constraint $constraint)

Finally, you can call the constraint from your YAML validation file.

User:
    constraints:
        - nocs:UniqueUsername: ~

Normally, under user you would have getters and properties – but here we’re adding a new section named “constraints” which lists all the class constraints.

Surfin’ Bird

March 9th, 2013 | Thoughts

hawaii

Often, our society fails to give scientists the credit they deserve.

Take homo erectus for example. A lot of scientists have had a lot of laughs out of the fact that they managed to convince the world that homo erectus was the name of an evolutionary step (which it is of course) and not just a really silly name they thought they would try their luck with.

But nowhere is it more clear than the people who study using the many telescopes located in Hawaii.

At some point in human history, a scientist when to a grant panel, and the grant panel asked them where the best place to put a telescope would be. Said scientist must have then looked at them slowly and sensing they trusted their judgement, decided to try their luck once again.

“Hawaii!” the scientist would have said, trying to sound more confident than they really were.

“Hawaii?” the chair of the grant panel would have enquired. “Why would Hawaii be the best place to put a telescope?”

“Well…” replies the scientist, trying to think on their feet as fast as they possibly could. “It’s the altitude you see!” “The altitude? Hawaii is an island, surely it is at sea level?” “Yes… but those mountains are very tall! Very tall indeed!”

“Seems like there would be a lot of places at high altitude. Are you sure you’re not just making this up so you can go live on a tropical island and go surfing every day?” “No, no” replies the scientist, “Hawaii has the tallest mountains and the clearest skies – it has to be Hawaii.”

“Well then”, says the grant panel chair, slamming down his approved stamp, “I guess that is that.” Thus began a golden age for science…

The Psychologist’s View of UX Design

March 8th, 2013 | Limited, Programming

If you’re interested in good user experience design (and who isn’t, right!) then it might be good to get the perspective of someone who actually studies users – someone like a psychologist for example. Luckily, one such psychologist is interested in such matters and has written rather a good article about it.

Over at UX Magazine, Susan Weinschenk has written The Psychologist’s View of UX Design and it provides a very useful breakdown of a lot of UX areas and how she views them. Well worth a read.

Potter Me Up

March 7th, 2013 | Books

Recently, I finished reading the complete Harry Potter series. Well, listening in any case.

I had read the first three and a half books as a child, and they were quite entertaining, so when I found out that I could have over one hundred hours of Steven Fry’s voice in my ears, I decided it was definitely worth a listen. That isn’t to say I didn’t agree with Stewart Lee’s take on the whole series.

But having got through them all, I’m now a sold up Potter fan! Rowling’s exploration of the magical world is entertaining, enthralling and all-round good escapism. It seems unlikely that at 26 I’ll be getting my letter from Hogwarts – but I can dream!

While some of the value is certainly lost on the adult audience – Harry’s dealings with the fairer sex for example, most of it was retained sufficiently to keep my entertained through all seven books.