Dvorak

After my third annual attempt to switch to Dvorak it has finally “stuck”.

By “stuck” I mean I’m stuck in Dvorak because I’ve screwed up my Qwerty so bad that I can’t switch back and be productive.

At this point I think it’s mostly a geek status thing since there’s no hard evidence there’s any ergonomic or speed improvements.

This post took fourty-seven minutes to write (I kid).

At least it would appear my words-per-minute is improving:

Dvorak WPM

Horological Adventures

I am obsessed with mechanical watches and I blame Apple.

I would have happily walked around watchless for the rest of my life had my interest not been piqued. Funny enough, I have no interest in Apple’s horological offerings.


Great Grandpa’s Ball Pocket Watch

Ball Watch Co. didn’t make any watches but instead devised a standard for watches that were to be used within the Railroad Industry.

Using the serial number on my watch I detemermined it was manufactured by Waltham between 1910 and 1920.

After burning through some YouTube videos on double playback speed (seriously people, you all go too slow on your videos) and receiving some Amazon purchases, I cracked open the case and dove into the clockwork.

I removed the gears plates and screws, dropped everything into some jewelry cleaner, brushed and dried out the parts, applied some grease to the mainspring wire, lubed up the jewels with tiny drops of Moebius, and reassembled it all.

At first it seemed daunting but it became intuitive where all the tiny screws and gears were supposed to go. After it was reassembled I gave the crown a gentle twist and instead of the grinding from before I heard a satisfying click of miniature machinery storing up potential energy.

After a few more winds the balance wheel kicked into action and the second hand started ticking away. It was a proud moment.

I found that the watch would stop intermittently and I had to put additional pressure on the second wheel and free the pallet fork to get it going again. After a few rounds of this over the day I noticed this happened only when the second hand crossed below the hour hand. I popped the hands off the dial, straightened them out, and reinstalled. Not a problem since.

Mechanical debugging and software debugging feel like a very similar activity.


Antiquing

My wife is encouraging my obsession. We dropped into one of her favorite antique warehouses.

I got lost in the maze of displays. Each section its own shrine to a departed soul. I started making up stories about the people based on the things they had left behind. Then I started wondering what my shrine would look like. A stack of antique mobile computing devices most likely.

I was giving up hope that I would find anything interesting. The only watches I came across featured Marvin the Martian or Ren and Stimpy dials powered by quartz movements.

It was time to meet back up so I checked my phone. My wife had struck gold! She had sent a photo with a collection of watches she found.

The shopkeeper let me examine them all. I opened up each case and looked at the movements. Upon seeing the machines within the shopkeeper commented on how it was like popping the hood on an old car. “Not like the watches you buy these days,” she said. I suspect she doesn’t visit the same websites I do.

No purchases were made but I walked away feeling like a kid on a treasure hunt who found a little stash tucked away behind a display case in a store I had driven by hundreds of times over the years.

The game is afoot.


Seiko 5

My obsession with watches is being stoked with daily visits to Hodinkee.

After getting the Ball running I found myself wasting time staring at the clockwork. I want to waste time everywhere I go! So why not get a wristwatch?

I quickly fell in love with the Nomos Metro Nachtblau but I could never justify walking around with a cool $4K USD on my wrist (let alone afford it).

The compromise is a Seiko 5 at $55 USD. With an autamatic mechanical movement and a glass back plate I’ll have instant viewing access everywhere I go. I plan to ditch the nylon strap and fashion a leather one from some supplies I have.


Time to go stare at the Ball movement for a few minutes.

Accidental Watch Enthusiast

Accidental Watch Enthusiast

The watch had been hanging there under the glass for just about a year. It was
given to me the Christmas before by grandpa. It belonged to his father before
him.

He told me he had it serviced once and it had worked but it does not wind
anymore and certainly does not run. I unscrewed the glass and fiddled with the
case but became anxious at the thought of breaking it so I placed it back in the
display case. It remained there on the fireplace mantle with its pointing at ten
past two.


I was never one to wear a watch. I signed up for my first cell phone when I was
eighteen so always had a timekeeping device in my pocket. With Apple getting
into the watch business I decided I would see if I could handle wearing a watch
everyday so I bought a Timex Weekender. It looked nice and was cheap. I even
fashioned my own watch strap out of some leather scraps.

I found that I quiet liked wearing a watch after all. The biggest benefit I
found was that I took my phone out less which meant I used Twitter and Instagram
less. I soon silenced all notifications on my phone which was also freeing.

Who would have thought that strapping the time to my wrist would free it up.


I pulled the pocket watch back off the mantle and started fiddling with it again.

I could just about get the movement to swing on the case hinge and maybe get a
look inside. The stem the crown was on was preventing it from moving any
further. I wanted to get inside this watch!

It was time to apply force. I gripped the case in one hand, grabbed the crown
with my fingers and yanked.

Pop

The crown moved a little. The movement swung out and I caught my first glance
behind the white, enameled face.

It was beautiful. I couldn’t look away. The tiny gems and gears intricately
placed between polished metal pieces.

Trademark Ball Watch Company

21 Jewels

Sapphire Pallets

My new mission in life is to get this watch ticking again.

Mainsail Tear

Mainsail Tear

On the last sail I saw a tear in the leech of the mainsail I hadn’t noticed before.

It follows the top edge of one of the batten pockets. It looks like this batten pocket has been ripped and sewn back on. There was a temporary piece of nylon tape holding it together.

I ordered some Tear-Aid Type A for a temporary repair. I think I’ll be breaking out the sewing machine to put a proper dacron patch on there. I already get to put my recent reading to use!

I’m attempting to do things the hard way with Nirvana so maybe I can make a new mainsail following Karl Deardorff’s instruction. I just need to find some plans for a San Juan 7.7 mainsail.

Sailing Reading Material

I hope to be taking some multi-day cruising adventures so I’ve been diving into books.


Plain Sailing
by Dallas Murphy

If you’ve already had your first sail in a dinghy this book has been great in going past “the basics” when it comes to sail trim and points of sail.

I really enjoyed Plain Sailing and it has already built some confidence for the next sail.


Complete Rigger’s Apprentice
by Darril Gibson

Complete Rigger’s Apprentice goes deep into running and standing rigging on boats. Not only does it show how to tie many kinds of knots it also explains their histories and uses.

The diagrams can be hard to follow so a visit to the Animated Knots by Grog helps clear everything up.

Nirvana will need new standing rigging sooner than later and this helped lay some base knowledge even if a lot of it was for out-of-date techniques.


Canvaswork & Sail Repair
by Don Casey

A useful reference when it comes to maintaining sails and other parts of the boat covered in canvas.

I already have a tear to repair in the aging mainsail and a custom dodger might be in my future.

Achieving Nirvana

Achieving Nirvana

My name is now on the title of a Clark Boat’s San Juan 7.7 Bermuda rigged fractional sloop named Nirvana.

As a proud boat owner I now get to fix all the broken things on it. Maybe I’ll even sail it!

I hope this is the beginning of some grand adventures in the Salish Sea.

Learning to Like Exceptions

If you would have told me two years ago that I would being writing Java for my livelihood I would have punched you.

Transitioning from more dynamically typed environments to Java felt like I was being bossed around by javac and I hated it. The most tedious example of this was exception handling. A few projects and library later I’ve learned to love them.

Your Methods Lie

Look at any Android project’s source code you’re going to see source code riddled with null checks like this:

Object thing = mWidget.getThing();

if (thing != null) {
  thing.doSomething();
}

The problem is mWidget.getThing() lied to us. It says it returns Object but it in fact can return nothing or in Java: null1.

Usually the null check exists because at some point calling thing.doSomething() caused a NullPointerException and some poor user experienced a crashing app.

In Java you can’t completely avoid null checks but you can do things to avoid exacerbating the problem.

Don’t be Afraid to Throw

In my efforts to make things easier I find that many times I create a utility method that wraps another “exception happy” method (like working with io).

public class UploadUtil {

  public static Uri uploadImage(Bitmap image) {
    try {
        String filename = BitmapUtil.generateUniqueJpgFilename(filenamePrefix);
        File file = BitmapUtil.saveBitmapAsJpg(photo, Environment.getExternalStoragePublicDirectory(
                Environment.DIRECTORY_PICTURES), filename);

        return Uri.fromFile(file);
    } catch (IOException exception) {
      return null;
    }
  }

}

Pretty simple to follow: provide a Bitmap get back a Uri and do something with the Uri:

Uri uri = UploadUtil.uploadImage(myBitmap);

Request request = new StreamFileUploadRequest(uri);

But now whenever I use the UploadUtil.uploadImage(Bitmap) method I have to remember to do a null check every time.

If another developer (e.g. my future self) were to use this method they probably won’t know to do a null check unless:

  1. They have access to the source code and read it
  2. The null case is documented
  3. They read the documentation

I thought I was saving myself some effort by handling the exception in one place, but it’s now even worse because instead of a compile time error this has a high chance of not being discovered until a NullPointerException crash.

Nothing is Wrong

The method signature of UploadUtil.uploadImage(Bitmap) says it returns a Uri, so let’s make sure we’re not lying anymore by also returning nothing:

public class UploadUtil {

  public static Uri uploadImage(Bitmap image)
  throws IOException {
    String filename = BitmapUtil.generateUniqueJpgFilename(filenamePrefix);
    File file = BitmapUtil.saveBitmapAsJpg(photo, Environment.getExternalStoragePublicDirectory(
            Environment.DIRECTORY_PICTURES), filename);

    return Uri.fromFile(file);
  }

}

That’s easy, just throw the exception. Now the user of uploadImage(Bitmap) will have an explicit code path for handling this:

try {
  Uri uri = UploadUtil.uploadImage(myBitmap);
  Request request = new StreamFileUploadRequest(uri);
} catch (IOException exception) {
  Log.e(TAG, "Failed to upload", e);
  notifyUser(exception);
}

Another benefit is the compiler will now point out all the places you should have been checking for null.

Be Nice to Others

I used to hate using methods that threw exceptions because of the try/catch dance but I have learned that a thrown Exception is another developer looking out for me.

I have some general guidelines for myself now concerning exceptions:

  1. Instead of returning null throw an Exception if it makes sense.
  2. Wait to catch exceptions at the highest level possible. Ideally when the software is directly interacting with the user.

Exceptions can feel heavy handed and don’t make sense in every case so I’m not dogmatic about these guidelines. If you’re doing Android development using Android Studio then take a look at Nullable annotations.


  1. One exciting thing about Swift is that it solves this problem with optionals.↪︎

Android Debugging with JDB and TextMate

For android development I do my best to avoid Eclipse by using TextMate and the command line. The biggest missing piece with this setup was an easy way to get a debugger up and running. A quick trip to Google landed me on Command Line Android Development: Debugging which outlines how to get jdb attached to a running Android app instance.

I quickly grew tired of typing all of the breakpoints out and invoking a handful of commands, so I hacked together a TextMate bundle I named Android Debug to automate the process.

I have never found a use for TextMate’s bookmarking feature so it seemed like a great place to identify breakpoints. When you invoke the debugging command from TextMate it will find all of the bookmarked lines in the *.java files in your src folder and dump them into a .jdbrc file.

4_26_13_6_22_PM

To figure out which app to launch I parse the AndroidManifest.xml file for the package id and main Activity then launch the app in Waiting For Debugger mode.

4_26_13_6_27_PM

Once the app is up and waiting a jdb instance is launched and reads the breakpoints in from the .jdbrc file. After getting familiar with all the jdb commands I feel pretty comfortable debugging this way.

4_26_13_6_29_PM

Now that I finally have a quick way to debug I can go easy on adb logcat. I’m going to try to automate more parts of my Android development workflow in this bundle. There’s probably some good stuff to steal from the abandoned Android TextMate Bundle.

The only remaining pain point for me in this whole setup is ant. I’d really love it if someone could show me how to get ant debug to compile faster. Currently changing a single *.java file requires 30 seconds to get an apk compiled. It looks like dx is taking a long time to merge all of the pre-dexed libraries the WordPress for Android project is using.

You are not your home directory.

You are not the contents of your source repository.

You are not your farking editor.

You are the all-singing, all-dancing self-replicating code of the universe.

And you are shutting down, one day at a time.

– Comment by reddit user grout_nasa