Author Archives: -

Links from the past four weeks, 7th July edition





  • – The Secret to Safe Continuous Deployment: how a team at Google uses “perceptual diffs” of screenshots of their web application to detect things that usual forms of automated tests won’t

I have a few more interesting things queued, they’ll have to wait until next time though as I haven’t had time to read them properly and/or play with them.

Links from the past three weeks, 9th June 2013 edition






Links from the past three weeks

Posts by LinkedIn on how they used HTML5 local storage and implemented smooth infinite scrolling for their new iPad app:


Use offsetHeight to force redraw between CSS transition changes

Often when using CSS transitions, I need to manipulate the same elements sometimes with transitions and sometimes without.

A simple example is moving an element off the page immediately, then transitioning it back in. Due to browsers compressing property changes behind the scenes, simply adding a “noAnimate” (transition: none) class, setting left, removing the class, then setting left again results in the element being in the right place, but without any transition.

I was previously told that the solution was to put the last two steps in a setTimeout callback – and that works. However the code quickly becomes messy in non-trivial situations. While reading today, I found that all that needs to be done is to force a redraw in between, which can be done by accessing the element’s offsetHeight.

Example here:

Links of the week ending 28 April 2013

Java application cache sizing

When sizing a cache such as Ehcache, back-of-envelope calculations is what’s often done. While it may well give the right answer, the envelope never seems to be kept so when someone comes along needing to modify/tweak the caching behaviour of the application they are faced with an ehcache.xml config file full of various numbers with no indication of why they were chosen.

This is often the case with many config files, but I’ve seen that ehcache.xmls are particularly prone to this (not anything to do with Ehcache, more the people who maintain them).

So I think it’s good to do what we did in a recent project, and document the choices of various settings with comments, and the calculations in a spreadsheet checked in to source control.

Some resources I found useful while calculating cache sizes:

Ehcache BlockingCache bug, Guava caches

I’d forgotten about this one until it caught me out again recently. I can see why it can’t be fixed though: putting an element with a null value is what you do to release the lock. Thankfully it’s easy to work around by using a plain object as a “null marker”. That does cause some boilerplate in methods that use the method though, so it might make sense to create a decorator that deals with this if you have a lot of it.

Next time I need some in memory caching though, I’ll be considering the Guava caches as quite often the capabilities of Ehcache aren’t required in applications that use it. I particularly like the fact that a self populating cache can bulk load using the CacheLoader.loadAll method, unlike Ehcache’s SelfPopulatingCache.