Jan 072015
 

After updating to Yosemite, which updated Safari to version 8, autofill stopped working for localhost. After some searching, it appears that this is due new security rules for Safari and OS X. Of course, that didn’t stop me from trying to get this working again as it made developing on localhost very cumbersome. The fix is pretty simple.

All you need to do is edit your /etc/hosts file and add a fully-qualified domain name alias for 127.0.0.1. Here’s how mine looks:

I added the cleanspeak.inversoft.com entry. Now I can access localhost using this alias and Safari nicely does autofill on form fields.

Jan 132014
 

Mac command line gold!

Copy a file to the clipboard:

The contents of my .zshrc are now on the clipboard and I can paste them into any other application (Mail.app, Word, whatever).

Paste the clipboard contents to the shell:

Anything that was on the clipboard is now in the file foo.txt.

Oct 252013
 

A cool bit of CLI trickery that James Humphrey shared with me. This allows you to use IDEA for diffing and merging via git’s mergetool and difftool commands.

First, add IDEA to your path (everything is in Mac-speak here):

Bash

Fish

Next, add these lines to your ~/.gitconfig file:

That’s it. Now you can use IDEA to diff and merge from git CLI like this:

Mar 082013
 

I’ve found another annoyance with MyBatis (there are many so be on the lookout for a long blog post that covers everything). This one has to do with how MyBatis handles missing TypeHandlers and required a bit of time stepping through their code.

If you have an object that contains a field whose type is not registered with the TypeHandler registry, MyBatis does not always produce a nice exception for you. Instead, it sometimes decides to return null instead of creating your object.

Here is an example:

I’m using Joda’s DateTime object here. If you don’t register this with MyBatis, it can cause this code to fail:

The fix is to register the TypeHandler like this:

Mar 062013
 

If you are using MyBatis TypeHandlers in your Configuration, you need to register them BEFORE you add your Mapper instances. As it turns out, MyBatis proactively parses your XML and completely configures each mapper when it is registered. If you mapper XML uses results that need a TypeHandler, you must register those before hand.

Here’s some quick code:

This works because the TypeHandler is registered before the mapper that requires it. This won’t work: