November 25, 2013
Rewrote {big number} of lines of {old language} in {small number} of lines of {hip new language}
There’s lots of projects these days moving from one language to the next. Whether that’s a good idea or not varies but let’s accept that it was the right choice and the world is a better place for it. One thing really bugs me: inevitably justifications of how successful that move has been includes a claim that the number of lines of code were so significantly reduced.
We rewrote 1.5 million lines of Java in just 6,000 lines of haskell!
November 19, 2013
Wifi Under Fedora Linux on a MacBook Pro 15″ Retina
Out of the box, Fedora 19 doesn’t have support for the broadcom wifi chip in the MacBook Pro 15″ Retina. There are quite a few complex instructions for adjusting firmware and compiling bits and bobs etc, but the easiest way to get it up and running on Fedora is using rpmfusion.
You can do it by downloading a bunch of rpms and stuffing around with USB drives, but its way easier if you setup network access first via either a thunderbolt ethernet adapter (make sure its plugged in before starting up as hotplugging thunderbolt doesn’t work under Linux), or via bluetooth.
November 19, 2013
Why iCloud Keychain is My Favourite Password Manager
Password managers are like exercise, some people are really into and and you know its good for you but it always seems like too much effort.
A few times I’ve actually gotten around to trying out password managers and I went pretty far down the rabbit hole with LastPass at one point, but its never stuck with me before. LastPass was ok, but just seemed clunky and instead of making life easier always seemed to make things take just a little bit more effort.
November 17, 2013
SOLVED: Chrome Crashes on Linux (Fedora 19) When Typing Punctuation in HTML Field
If you ever copy or rsync your home directory to another drive on Linux (especially Fedora 19), you may find that Google Chrome starts to crash whenever you type punctuation, including space characters, into HTML form fields like input or textarea.
You may also find that ‘useradd’ complains that it can’t create home directory.
It turns out that this is because of SELinux having incorrectly file labels for the files in the new home directory.
November 16, 2013
New Mac Setup
Transitioning to a new Mac has always been a very smooth experience – the first run setup offers to migrate everything for you and generally it gets everything right so your new Mac comes up looking just like your old one.
Recently I’ve acquired a new MacBook Pro with Retina display and decided that after all these years of migrating everything over I’d set up from scratch. Mostly just to make me consciously choose to reinstall things instead of a heap of cruft coming across automatically which I don’t actually use anymore.
October 22, 2013
The Semantic CSS Debate
Couple of very interesting articles today on architecture of CSS. Firstly Thierry Koblentz questions the benefits of separation of concerns – advocating a coding style where most style rules map a single classname to a single CSS property.
In complete contrast Ben Darlow argues the importance of semantic meaning, pushing back against techniques like OOCSS and BEM which move away from semantic class names in the name of modularity – generally resulting in long strings of class names on elements.
September 13, 2013
Uglify/Uglify2, Rickshaw, Requirejs and Minification
If you have:
A javascript project using require.js Which is optimised using r.js Includes Rickshaw or any other library that uses the prototype class system Then you are very likely here because you’re trying to enable JavaScript optimization (minification) and finding that suddenly stuff breaks.
The problem is that the prototype class system allows overriding methods to call the original method by adding a $super as the first parameter to the function.
August 14, 2013
Automation and Selecting Web Hosts
One of the biggest challenges with selecting a web host is that it’s very difficult to determine the quality of a provider without actually setting everything up and seeing how it goes for a while. Generally that means that you either wind up avoiding the very low cost providers out of fear they won’t be reliable and possibly paying too much, or spending a lot of time and effort setting up with a provider only to then discover they’re unreliable or the performance isn’t as good as you expected.
July 24, 2013
JavaScript Drag and Drop Events
Note to self: when you next need to handle drag and drop events in javascript, just use jquery.event.drag from ThreeDubMedia. Simple jquery based API and automatically handles the most annoying part of javascript drag handlers – dealing with cases where the user starts dragging inside an element, drags right out of the element and then releases the mouse.
July 8, 2013
Injecting Stubs/Mocks into Tests with Require.js
I’ve recently embarked on a fairly complex new application, a large part of which is a webapp written in JavaScript. The application uses require.js to handle modules and loading of dependencies and we want to be able to unit test our JavaScript.
In order to test specific pieces of the application, we want to be able to inject stubs or mocks into the module being tested. For example, if we had a module:
June 11, 2013
Importing an ant buildfile multiple times
According to the ant documentation:
It is possible to include the same file more than once by using different prefixes, it is not possible to import the same file more than once.
Unfortunately, it turns out this isn’t _quite _true. In most cases, ant will indeed ignore a request to import a file for the second time, so:
<import>
<file name="utils.xml"/>
<file name="utils.xml"/>
</import> will only import utils.xml once. This is true even if there’s a chain of files being imported (so A imports B and C, then B imports C as well, C will only be imported once).
May 10, 2013
Ant Dependencies Running Twice
Most people believe that ant will only ever execute a target once per execution of ant. So if we have targets A, B, C and D, where A depends on B and C and C and D both depend on D.
<target name="A" dependencies="B, C"/>
<target name="B" dependencies="D"/>
<target name="C" dependencies="D"/>
<target name="D"/> When we run ‘ant A’, we expect each task to execute once, D first, then B and C, ending with A.