Category Archives: General

Talk accepted at Rails Conf 2009

My talk, “INTERFACES ARE DUMB (AND THAT’S A VERY GOOD THING)” was accepted for the 4th annual Rails Conference in Las Vegas. I’ll have more to say about this talk soon, but I wanted to let my friends know right away!

Speaking last year at RailsConf was one of the coolest things I’ve ever done, and I’m really looking forward to doing it again this year. If you’re able to come to the talk, please do!

Link up the site you’re looking at in TextMate

My buddy ReinH asked me in an off-handed way if I knew how to link up a url dragged from safari into TextMate.

I couldn’t think of an easy way, so I hacked something up. It doesn’t do the original goal, but gets pretty close. It grabs the url of the foremost safari window, and makes a textmate link (like how command+shfit+l does).

If you want to download it, you can grab the “My Junk Bundle”. If you’d rather just put the code into your own bundles, here it is:

#!/usr/bin/env ruby -wKU
require ENV['TM_SUPPORT_PATH'] + '/lib/escape.rb'
require 'erb'
require 'open-uri'
require 'net/http' 

def entity_escape(text)
  text.gsub(/&(?!([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+);)/, '&')
end

url = %x{osascript <<\EOF
tell app "Safari"
  return the URL in document 1
end tell
}

title = url
if url =~ /^http:\/\// and url != 'http://some-site.com/'
  eval 'title = fp.read.match(/<title>([^<>]*)<\/title>/i).to_a[1].strip rescue nil' if fp = open(url) rescue nil
end

input = title
puts ERB.new(ENV['TM_LINK_FORMAT']).result

Binary Game for the iPhone

My good friend John Kassimatis informed me today that I never wrote about the game he released a little over a week ago: Binary Game. After swearing he was nuts and must have just missed it, I checked and saw that, indeed, I haven’t written about it yet!

Let’s rectify that now

Binary game is pretty sweet. You’re given a target number and have to hit buttons with set values (like 128, 64, 32, etc) to match the target. It’s one of those “take a minute to learn, a lifetime to master” games. Well for me at least, looking at the High Scores, some people are much more masterful than me! (Seriously, 24 seconds to solve 16 of these things? I’m in the 60 second range…. jeeze!)

Beyond just being a cool game, I got to help John out (with our good friend Brian Woolley) with code, graphics and Word Press Hacking (the plugin I built is here: gist 64298). I really enjoy iPhone hacking. It’s tough and not intuitive in places, and there are plenty of hoops to jump through to get your app released, but where else can you go from idea, to running code IN YOUR POCKET so quickly? We live in the future!

So check it out, and let me know on twitter (@kastner), if you’re faster than my 60 seconds in speed round.

Jamis Broke Open Source!

What a jerk that Jamis Buck is, right? He’s abandoning Capistrano and related bits. At least, that’s the position some very vocal people are taking in response to his announcement (both points it seems).

From what I’ve seen, there are two main public positions people are taking:

  • Massive amounts of thanks and well wishes
  • Major pushback that Jamis is “abandoning” Cap, or at the very least that he didn’t beg for someone to take it over.

And while I always wish Jamis the best (and thank him for all of his contributions, both code and otherwise), I don’t see why the first position is predicated on his announcement. And that second viewpoint? I just don’t get it even a bit.

Let me explain, my reaction (and since I’m the one writing, we just assume I’m right, of course), was pretty much, “Oh, Ok?” So what? If I want to use capistrano, I’ll keep using it. If I find a bug that I can fix, I’ll fix it. I doubt I’ll even need to though. With our without Jamis “blessing” a specific version, there will be updates, plain and simple.

And I think that gets to what these people are really most hurt over, that Jamis didn’t follow their idea of how OSS should be transitioned. He didn’t follow an outdated, broken, pretty much anti-open-source practice of finding a successor, training them, then reluctantly giving up control.

Here’s a brilliant comment Jamis made on Hacker News:

If you’re this traumatized by my decision, then honestly, I blame you (and people like you) for my burn out. Where were your contributions to the library, your documentation patches, your discussions of better ways to implement things? Have you been in the IRC channel, daily, helping people troubleshoot problems? Have you posted frequently on the mailing list in response to questions? If you’re so dependent on Capistrano, where have you been? If your silence was because it all “just worked”, then why are you so disgusted now? It all still “just works”.

It’s a bit defensive, but if you follow the comments leading up to you, you’ll see that’s downright tame for the amount of crap being slung his way.

I’m not going to claim that this new model of Open Source is 100% attributable to GitHub, but for me, it’s the project that embodies it, as well as opened my eyes to it’s posibility. It’s still got a long way to go (mostly with regards to authority), but I think the shift has been made, and going back to what we had by default before would be a huge step backwards.

It’s been pointed out before, but I’m gonna give the very very short version of one possible path that Capistrano could take.

  • Someone very passionate about the project, and how much it’s helped them (and trust me, there’s a lot of us) realizes there’s a gap in what it provides and wants to plug that hole
  • They fork the code on github and bring the code up to their vision
  • They tell people about this change and why it rules
  • More people spread the word about this great new functionality
  • This becomes the defacto new capistrano
  • It gets fuzzy here because there are so many paths it could take:
    • Jamis could add our mystery coder as a contributor to the “main” capistrano project
    • Jamis could give the rubyforge project over to this person, and they’d update all the info to point to their code
    • Jamis could do nothing, and people will STILL FIND THE CODE (github could feature the project, DHH can say it’s what he uses now, WHATEVER)

We are in a meritocracy (with a bit of popularity thrown in), and this new model of shifting ownership and authority is just the next logical progression. What if, instead of just being burnt out, Jamis when on an 18 month world-wood-carving-tour? Would Cap just be frozen in that time? What if he decided that coding was so last century and walked away from everything?

I think what someone should be really scared of is someone coming along and making their projects better, and since they’re a control-freak jerk-face, they don’t allow someone else to contribute, and the new version becomes the standard (*cough*emacs*cough*).

Kindle 2 first impressions

I got my Kindle 2 yesterday and I wanted to jot down my first impressions before I form any long-lasting feelings.

Unboxing

The first observation is literally the first thing you see — the packaging.

I’m not usually one for unboxing pictures or stories, but Amazon killed it with this one. They’ve clearly taken a page from Apple, and spent considerable effort and thought on the experience of getting and opening up your Kindle. One area where they surpass apple is in packaging material. The device is shipped in mostly reconstituted paper (that injection molded almost plastic-like paper packaging). And once you get to the device, there’s a really cool easter-egg with the instructions (plug in your device to the wall, slide the power at the top — that’s all I’ll say!)

Hardware

I never played with the first generation of the Kindle, so my thoughts aren’t colored by that experience…

The hardware is cool. So thin, small, light. Great for reading in bed or other places you’d take a paperback. This, however, is an area where Johnny Ive clearly wasn’t involved. The keyboard is awkard, the menus aren’t the easiest things to navigate. But it’s well past the “Good Enough” threshold (at least after a few hours of playing with it)!

Buying Books…

Amazon has never been shy about making it easy to spend your money. From 1-click, to Prime, buying on amazon is easy, and the Kindle continues (and extends) that tradition. Using the “Whispernet”, you could spend a LOT of coin very easily. It’s also very very easy to buy something on the site and have it show up on your device automatically. Again it reminds me of apple with the appstore, but is very much it’s own experience.

Experimental

One thing I haven’t heard much about is the “Experimental” menu. One of the things they offer in there is a web browser! This changes the entire experience of the device. I only loaded up one webpage (mine of course), and it doesn’t really render much CSS, but so what? It, in a way, unlocks the device from Amazon’s grips and allows you to decide what you see on that gorgeous screen!

>No Clock

It’d be easy to put a clock on the device. There’s a menu bar. Refreshing just that part of the screen every minute wouldn’t be distracting. It’s powerful enough to have a clock. It could stay in sync over the network. But no. They decided to keep a clock out, and it’s the nicest little touch I’ve found so far! Why would a clock be bad? Amazon’s stated goal with the Kindle is to replicate the book experience as much as possible. When you get INTO a good book, time melts away and having a reminder always in your field of view would ruin that experience. I think it’s a bold choice (EVERYTHING has a clock!), and one I appreciate a whole lot!

Conclusion

I don’t underline passages in books. Something about forcing my observations on the next reader really turns me off (when I was first formulating this thought, I was going to say something about affecting the physical book, but that’s not it, I dog-ear ALL the time!). However with the Kindle, I’ve already marked two passages in the first book I’m reading. The UI isn’t great for it, but it’s not bad enough not to do it, and it’s just for me (and my twitter followers who I’ll be subjecting quotes to shortly).

The highlighting is, in my mind, the perfect metaphor for the device as a whole. It’s like reading a book, but not exactly. I still love paper, I think we’re a long way off from replicating the experience 100%. Despite what they say, I think Amazon’s ultimate goal isn’t to replicate reading a book, but surpass it, and that’s a tall order, but one I think they’re making baby steps towards.

So far I’m blown away by this thing! I’m finding lots of niceties still.

Counters in partials, a little-known rails feature!

I don’t normally post rails tips that are New To Me, because I always feel like I’m late to the party and everyone knows the tip already. This one however, I vetted through some very experienced rails developers and it was new to them as well. Which is strange, because looking back, I think it was first added in 2004!

The feature I’m talking about is counters in partials used in a collection. Let me show you:

<%= render :partial => “book”, :collection => @books %>

As you know, that will loop through the array of @books and use the template _book.html.erb (by default) each time. Let’s take a look at that file and see how we can use the counter:

<div>
  Number: <%= book_counter %><br/>
  Title: <%= h book.title %><br/>
  Author: <%= h book.author %><br/>
</div>

That will give us output like this:

<div>
  Number: 0<br/>
  Title: Promises in Death<br/>
  Author: J. D. Robb<br/>
</div>

<div>
  Number: 1<br/>
  Title: One Day at a Time<br/>
  Author: Danielle Steel<br/>
</div>

<div>
  Number: 2<br/>
  Title: First Family<br/>
  Author: David Baldacci<br/>
</div>

What’s this useful for?
I can think of two things off the top of my head:

  • Zebra Tables
  • Special classes for first or last elements to change them visually

Let me know here or on twitter (@kastner) if this was helpful (or any other little-known tips)

A week into February

It’s been a week since I posted my goals for February. I’m trying to make sure I don’t slip on these, so here’s how I’ve done so far:

  1. 10% more RSS / Twitter
    Twitter: 765->768. Not great
    RSS: 353->381. Not so bad
  2. 1500 On Yahoo! Reversi
    I’m now at 1437. When I made the post, I was on the 1300 range. Really tracking well on this one
  3. Put Dani to Bed a Lot
    7/7 :)
  4. 10 Blog posts
    Well. This is the second one. I have a few ideas for bigger posts. One is the coming inflection point for twitter. Another is about different personality types and how they market products.

Overall, not great progress, but I feel that looking over them like this is going to be hugely helpful.

February 2009 Goals

I’m going to approach my goals for this year a little differently than last year

Month by Month

The plan for this year is simple. S.M.A.R.T. goals. Each Month.

Day by Day

Even more importantly, I’m going to remind myself of my goals several times each day. A concept I was sure I came up with all on my own, until I noticed Damon Clinkscales‘s comment on my post from last year.

So how am I going to do this day by day stuff? With Magic Computer Voodoo™. I’m going to put my goals on my iPhone’s background image. Each time I look at them I’m going to see if I’m working towards them.

But First… a Look Back

Let’s see how I did with last years goals (which I didn’t look at until now):

  1. Finish the blog post
    This was a gimme. A quick one to get one and done. And I did that. Didn’t really build the confidence I was hoping for.
  2. Be the best father and husband I can be
    I think I did alright on this one. 50% at least.
  3. Ship 10 projects
    Not so great on this one. Let’s see:

    1. Highlite
      This was actually launched on EC2.
    2. Color Wars 2008

      (Color Wars 2009 coming in april!)
    3. elastic css textmate bundle
    4. Obama FTW!
    5. Flickr Tickler
      I haven’t written this one up yet, I actually haven’t promoted it much at all yet. It’s a Flickr viewing interface that uses your keyboard and has “infinite” scrolling. This is launched on Google’s App Engine.

    So, 5/10… again 50%

  4. Drop 20lbs of Fat
    Wow. Did I ever mess this one up? I had mistakenly thought the goal was to gain 20lbs of fat. Which I did. And then some. I Rule.

New Goals

I have some overarching goals for 2009 and beyond, but I’m going to focus just on this month for now.

Here they are:

  1. Gain 10% more RSS subscribers
  2. Gain 10% more twitter followers
  3. get to 1500 rank in reversi on Yahoo! Games
  4. Put Danika to bed as many nights as possible
  5. 10 blog posts

10% More with RSS and Twitter

These are purely ego based and not useful to anyone but me. For too long, I’ve been blasé about the brand that is “Erik Kastner”. I’m going to try and work on that a little bit. And while it doesn’t matter how many followers or subscribers I have, it acts as a proxy for the real goal.

As of today, I have 765 following on twitter and 353 subscribed here. For those of us how hate mental math, that means I want to have (at the peak) 842 followers and 389 subscribers.

1500 Rank in Yahoo! Games Reversi

I used to play a lot of Reversi (Othello) around 2000. I picked it back up a few months ago (thanks iPhone!), and I’ve found it has changed how I approach all kinds of problems. It gets me in the mindset to think ahead a few moves, while still keeping options open. It also makes me insanely happy.

Put Danika to Bed as Much as Possible

My favorite new habit is helping Amy with Danika’s bath, then putting her to bed. The wrinkle is that sometimes I get home too late. By making this my #1 priority, I’m going to keep it in my mind and get home as much as possible.

10 Blog Posts

Since the first of the year, I’ve been blogging a lot more, both in frequency and content. I can’t believe how much I’m enjoying doing this again. This also happens to be the 4th year of Meta | ateM, as good a time as any to really get back into it.

The Image!

02-09-goals-dani1

I Kicked a Server – A Love story

Part the first: The What

The end of the first month of the year brings many things. Fiscal closings, abandoned resolutions, ruminations on groundhogs… For us however, it brings another, more insidious creature: Inventory.

And so, once again, changes need to be made to rickety old code that gets dusted off once a year. I pop open the PHP code to make a change here or there only to feel my heart sink at this blight of bytes. Quickly rebounding, my heart races, and I feel the rush of the possibility, “Rewrite” I exclaim! Alas, there’s no time for that.

My hopes dashed, I take a second look at the code and decide all that’s possible, all that can be hoped for is to leave the code better than I found it. Not so hard, I’ll just put it under git, and start making changes.

Woah! Not so fast. The Debian Noid is here, and he says that libc6 is out of date, and the only way out is to upgrade the kernal.

Tinkering, tinkering, toiling and typing, I get the system to an unbootable state in record time. At one point, I lamented aloud that I was in bootloader hell. Shortly thereafter, I introduce said machine to the leather on the underside of my foot. We both win. The computer feels no pain, and I feel a measure of relief.

Luckily (or is it unluckily?) I backed up the code. The team handed me the keys to a shiny new server, and soon enough it was ready to code.

Part the second: The Where

“Where” as a concept has been forever altered by our series of tubes. This code. Does it live on a server? Does it summer in New Jersey? Or does it only fully live in memory, both virtual and physical? It also has a “where” temporally. It was written around 2004, tweaked a bit each year and now settled into it’s current desolation.

Where? Where should the 2009 version of me come in and get this piece of code ready to be put through it’s paces (and I mean that in the simplest way possible. No unit tests, no QA, just hard-working folks doing a dry run). The code goes into git. I start first with the crux of the app &ndash: the code that takes an item and logs it into the database.

Abstracting and centralizing the database calls, cleaning out impossible to reach code branches, Un-repeating myself… I come up for air and realize that the store closed half an hour ago, and I’m stuck inside with high-tech motion detectors ready to betray me. It’s the first time I’ve gotten into the flow state with code I’m this disgusted by.

Part the third: The Why

Why did I do this? What have I learned here?

I could have just done a search and replace to get this code runnable for the test and ultimately the actually inventory, but that felt wrong this time. Not just a little wrong like it has every other year, but deeply and uncomfortably wrong. Instead, I took the long, scenic route to arive at a place I’m a little less ashamed of. And that, that has made all the difference.

Tiny Goals

In the coming days, I’ll be talking a lot more about goals and goal-setting (it is almost a new kastner-year), but right now I want to talk about a tiny goal I just set.

3 more feed items

Google Reader (43)

Only 3 items left and I’m down to 40 unread items (for those of you who would rather go shopping). I’ve been whittling this down for a little while now, and I’m getting very close. The problem is that I’ve long since blown through the “easy” items like Flickr photos, Makezine posts and Dropbox event notices. All I’m left with is great content by awesome people that I really want to savour.

Why this? Why now? Why only 3?

I should be in bed, working on stuff that matters or even knitting. But I’m staying up and reading these 3 items (actually, right now I’m writing about reading them, but when you read this, I’ll be long done – hopefully with both the writing AND the reading).

Some people even think reading feeds is a total waste of time. Even if I agreed (which I don’t, more on that later), I’d still want to hit this goal. I need a win right now. Any win will do. By hitting this, I get to go to bed knowing I accomplished something (no matter how trivial), and I reinforce the belief that I can set, and achieve goals.

As for why 3… well why not? I know how meaty each item I have left is, and 3 gets me to a nice round number.

Finally, a small request…

stop making cool stuff