The Joy of Browser Selection
Anyone who’s done much work with JavaScript has probably discovered that the selection APIs are completely different in Internet Explorer vs the rest of the world, what comes as a bit more of a surprise once you start using them in anger is that FireFox is actually quite different to all the other W3C compliant browsers in an important way as well.
If all you ever want to do is retrieve the selection or you only want to work with ranges rather than selection, you’ll probably never encounter this, but as soon as you use window.getSelection().addRange() you’re going to get bitten. The difference is that FireFox will preserve whatever range you give it precisely as you original created it. The other browsers won’t.
Job Application Tips
This has been said before but apparently even really smart people aren’t listening. So here’s my top two tips for job applications:
- Tailor your résumé. If you’re applying for a JavaScript job, highlight the JavaScript experience you have first and foremost. Even something as simple as the order you list skills in makes a difference – if JavaScript is at the end of a list of skills, it’s probably not a priority, if it’s first it makes it seem more important to you, so you seem more qualified.
- Get a blog, make it look good, fill it with good content.
The corollary to number 2 is that you should set your FaceBook page to private – it never seems to be what you want to have turn up. It’s surprising how many blogs have relatively good technical content but look terrible. Even if you’re not going to be applying for design jobs, having a decent layout without broken images is always helpful.
RightScale AWS Amazon EC2 Library for Ruby
I’ve always known you could do a lot of programmatic stuff with Amazon but I’ve simultaneously been too lazy to actually look into it in detail and never really needed to. However, I’ve stumbled across instructions for auto-mounting an EBS volume which turns out to be very handy, and leads on to the particularly awesome right_aws ruby gem.
Lots of useful looking stuff for working with EC2, S3 and EBS volumes that I can see me taking a lot more advantage of in the future.
Ephox in the IBM Cloud
Ephox EditLive! is now part of the IBM cloud offering on Amazon Web Services. EditLive! OEM edition is bundled in the cloud offering of IBM WCM. This means you can now quickly run up a new instance of IBM’s WCM system on Amazon EC2 and configure it to use EditLive! as the editor.
If you want to take advantage of the extra benefits of the Enterprise Edition (track changes, commenting, accessibility checking, image editing and more), you can install that as normal once the system is running. Currently Ephox doesn’t have per-hour pricing through Amazon but you can contact our sales team so they can discuss the options available.
Stop Concatenating CSS Files
One of the common examples of the limits of Maven and other “strict” build tools was how difficult is to concatenate CSS files together as part of the build. It’s nice to be able to split CSS files up to categorize things but the extra HTTP requests really slow down page loads, so the build should concatenate them back together. What I’ve come to realise though, is that building a custom concatenation script is just another instance where people are reinventing the wheel in build systems, and getting less power as a result.
The Fear of Reading Code
From yield thought – On The Fear of Reading Code:
When I was learning to program someone told me that I should try to read as much code as possible. Budding genius that I was, I thought this was advice for stupid people who needed to learn from their betters. I thought the only reason to read code was to pick up tricks from it.
How wrong I was. The real reason to read code has nothing to do with learning from the programmer who wrote it.
Name the New Ephox Mascots
The other day a couple of surprise packages arrived in the Ephox UK office – our new squishy conference giveaways! The ever popular red sports cars are out and in their place are a cute little Koala and a Kangaroo pair.

It was quickly suggested that we need names for them, so here’s your chance to go down in Ephox history. What should we call them?
Wanted: Open Source Evangelist/TinyMCE Guru
From the job description:
We are seeking a Software Developer who is experienced in creating sophisticated, highly interactive, JavaScript applications. Ideally we desire someone that has experience in TinyMCE or has experience working as part of an open source project. The right person will have the ability to work remotely in a highly collaborative manner with virtual teams. I’m pretty excited about this new opening within Ephox. Lots of great stuff to come out of it hopefully, but in particular helping Ephox to start working better with Open Source communities and developing some awesome stuff with JavaScript. While TinyMCE experience is something we’re particularly keen to have “ready to go” if possible, whoever fills this role is going to become a web content editor expert in general from Tiny to CK, Dojo and of course our personal favourite EditLive!
Returning Parameters in JMock 2
If you have a method like:
String getParameter(String name, String defaultValue)
where defaultValue is returned if the parameter isn’t specified, it can be challenging to get the right behavior in JMock without just hard coding what the defaultValue should be. Fortunately, a custom match which doubles as an Action can solve this pretty easily:
import org.hamcrest.*;
import org.jmock.api.*;
public class CapturingMatcher<T> extends BaseMatcher<T> implements Action {
public T captured;
public boolean matches(Object o) {
try {
captured = (T)o;
return true;
} catch (ClassCastException e) {
return false;
}
}
public void describeTo(Description description) {
description.appendText("captured value ");
description.appendValue(captured);
}
public Object invoke(Invocation invocation) throws Throwable {
return captured;
}
}
It can then be used like:
Show Me the Metrics
There’s been a lot of new innovations going on in programming languages and development techniques in general lately, but there’s a really key missing element: metrics.
Seeing posts like Stephan Schmidt’s Go Ahead: Next Generation Java Programming Style and the response from Cedric Otaku really should make any professional software engineer concerned about the future of their craft. Not because either of them are necessarily right or wrong, but because two highly skilled engineers are engaged in debate based purely on pure personal preference. There’s barely even any anecdotal evidence provided, let alone actual measurements to see what impact on productivity, quality or other desirable qualities the proposed approaches have.
Auto-update is a Killer Technology
There’s a huge amount of new technology pouring out into the world these days – lots of it focussed around the web and consumers and the key term that keeps being talked about it ubiquity. Flash brought video to the web because it was ubiquitous, HTML5 will kill flash once it’s ubiquitous, mobile web access is becoming ubiquitous etc. The most striking thing in all of this is just how quickly these new technologies are actually finding their way into real world usage.
On Funny Variable Names
Emmanuel Lécharny – Pick good names for your methods/data structures…
5 years later, when I come back into this crap, I have *no* bloody idea about what is what. Is Twix for the frontend or the backend ?
When you pick a name, and when you think it’s funny, just think about those, and probably you, who will not have fun at all when it’ll be time to fix some code in this area, with no clue about what Twix and Snickers are…