Outer-Dialogue

January 24, 2010

San Luis Obispo Typeface

Filed under: Type — mbtyke @ 11:55 pm

SLOFont.png

SLOStreetSign.jpg

After a recent trip to San Luis Obispo, I started wondering about the typeface I was seeing on the street signs.

Turns out it’s Bitstream Libra.

(thanks WhatTheFont!)

November 23, 2009

“Abort trap” error in 10.6?

Filed under: Uncategorized — mbtyke @ 6:55 pm

Are you getting a lot of errors in Terminal.app? I rely heavily on the “open” command and after upgrading to 10.6, it failed every time with this error:

Abort trap

As it turns out, there is a known bug in the debug versions of libSystem. Turning off using the debug libraries solved the problem.

Change to my .bash_login

#export DYLD_IMAGE_SUFFIX=_debug

October 30, 2009

Beginnings of a real Babelfish

Filed under: iPhone — mbtyke @ 9:49 pm

A co-worker mentioned a new iPhone app to me that seems like the iPhone Universal Translator everyone had the idea for, but that was really hard to write. We’ve always dreamed of having a device like the babelfish in A Hitchiker’s Guide to the Galaxy, the translators the Guild Navigators used in Dune, or the Nicholas Negroponte-prediction of translator devices we’d all be wearing around our necks.

Most apps will translate text that has been input by the user, and there are some mashups that require awkward user-interactions, but Jibbigo is the first app I’ve seen that breaks the holy grail of sound-to-sound translation.

May 29, 2009

Swarm safety

Filed under: Uncategorized — mbtyke @ 7:43 am

Here’s a tip: The next time bees swarm in your yard, don’t spray them with RAID, find a bee-keeper to come get them. They are happy to take wild bees off your hands. Do not kill them if you can help it. Colony-collapse is a big problem and we need all the bees we can get.

Here’s a pic of a friend’s backyard last night. A large hive had spontaneously formed on her fence. Luckily, a friend of hers was a beekeeper and came out to pick them up.
IMG_1028.JPG

Some facts I learned:

  1. Bees consider dark-colored things predators. That’s why bee-keeper suits are white. Even with a beekeeper suit and black socks, you run the risk of your ankles being stung.
  2. Bees emit a pheromone when they sting which alerts the other bees that danger is near. One sting means there may be more.
  3. Bees target your eyes as defense so if you start to be stung a lot, cover those.

IMG_1026.JPG

Overcome indentation in your init methods.

Filed under: Development — mbtyke @ 5:54 am

I really like the ideas in the Seven Pillars of Pretty Code paper at Perforce Software, especially the “Overcome Indentation” section. I try to keep my code as far to the left as is reasonable.

For instance:

if ( thing != NULL  )
{
    thing->doSomething();
    thing->doSomethingElse();
    thing->doSomethingMore();
}

… can become …

if ( !thing  )
    return;

thing->doSomething();
thing->doSomethingElse();
thing->doSomethingMore();

… and …

if (value == otherValue)
{
    thing->doSomething();
}
else
{
    thing->doSomethingElse();
}

… can become …

if (value == otherValue)
{
    thing->doSomething();
    return;
}

thing->doSomethingElse();

This is why I cringe when I see this in Apple’s tutorial documentation:

-(id)init
{
    self = [super init];
    if (self != nil) {
        // initialization code
    } else {
        return nil;
    }
    return self;
}

With this, I get to write my entire init method in two levels of indentation just so I can happily execute one return statement after the end paren.

This is also in some of XCode’s class templates, and in many cocoa books that I see. I wish they would update it to this. It looks far calmer to me.

-(id)init
{
    if ((self = [super init]) == nil )
        return nil;

    // initialization code

    return self;
}

I realize this is a small thing, but after looking over page after page of highly indented code, I get a little fatigued. I’ve really grown accustomed to tackling the small cases first so the meat of the method is at the end.

Theme: Rubric. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.