Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Monday, December 08, 2008

feedback and the appearance of intelligence

One of my undergrad degrees is "Weapons and Systems Engineering," which sounds scarier than it is. Weapons and Systems is basically controls track electrical engineering, but at USNA it's taught within the Weapons and Systems Engineering department. I took the major because it collided nicely with my love of video games and control systems -- plus, where else could you build robots that tried to destroy other robots?

The underlying fun -- both of writing games and building feedback-driven control systems -- is that reacting to the inputs and the world around you is what makes something seem to be alive. Whether a simple Eliza-style chatbot, an enemy AI rider who seeks you out cause you hit them, or a stepper motor tied to a camera that makes a water pistol face track, reacting is what makes things feel smart. Feel intelligent.

Nobody who's worked in that space can fail to love this movie:



It sure feels like our robot overlords are close to arriving.

Saturday, December 06, 2008

some media learnings

I have a lot of computers and media floating around at home and last weekend it was once again time to build some tools to better manage them. Wrote some Ruby and used rb-appscript to bend iTunes to my will. Along the way learned a few lessons:

First, ASTranslate is teh shizznitz.  It takes a pile of AppleScript and spits out working rb-appscript.  Since I really wanted to minimize the amount of AppleScript I needed to learn -- and wanted to be able to work my magic on headless machines, this worked quite well.  Let's say you want to take a Quicktime reference movie, insert it into iTunes, and then trick iTunes into managing it like a TV show:

episode = app('iTunes').add(MacTypes::Alias.path("#{path}/#{name}"))
if episode
  episode.video_kind.set(:TV_show)
  episode.show.set(name)
  episode.episode_number.set(episode_num)
  episode.season_number.set(season_num)
end

Want to search TV shows?

app('iTunes').user_playlists["TV Shows"]. \
tracks[(its.name.contains(searchname))].get

Easy peasy. ASTranslate running next to Apple's Apple Script editor and Doug's amazing repository of Apple Scripts made it easy to dig through this stuff.

Second, reference movies. If you use Perian (you do have Perian installed, right?), Quicktime and Front Row will play all kinds of movie types. However, iTunes won't load them. Reference movies are snippets of XML that allow you to work around this:

def create_reference_movie(dir, name, season, destdir)
  def raw_urlencode(str) # need to escape reference name
    str.gsub(/[^a-zA-Z0-9_\.\-\/]/n) {|s| sprintf('%%%02x', s[0]) }
  end

  File.open("#{destdir}/#{refname}", "w") do |file|
    file.puts("<?xml version=\"1.0\"?>")
    file.puts("<?quicktime type=\"application/x-quicktime-media-link\"?>")
    file.puts("<embed src=\"file:#{raw_urlencode("#{dir}/#{name}")}\" />")
  end
end

That's right, three lines of XML that you can create -- by hand, even -- to let you drag drop odd formats into iTunes.

Third, a gotcha which makes all of this less cool. Even though iTunes can share and stream video, it turns out that it will not do this for reference movies. Boo!

Fourth, this is well known within the Ruby community, but multibyte string support in 1.8 is weak. Lost a few hours this afternoon to a bug that was obvious once the "oh, strings aren't UTF-8 yet!" thought hit me.

Thanksgiving was mostly about cooking but it was fun to get a bit of coding time in!

Tuesday, February 05, 2008

37signals and getting real

37Signals published -- and posted online -- a book about software development called "Getting Real." It's the type of book that will generate hyperbolic praise -- read Seth Godin's jacket blurb -- and "this isn't new at all" derision. The truth, of course, is somewhere in between. If you are a software developer, manage software developers, need to work with software developers, or want to understand the process of creating software a bit more, you should read it.

The 37Signals folks deserver a ton of credit for writing down the basic tenants of good software and product development. Most good organizations are already doing most of these things and -- like Joel's test -- should be aspiring to do more of them. The authors, again to their credit, also don't claim that much of what they are doing is new, but do present their ideas in a clean, easy to digest manner. It also feels a lot less cultish than a lot of the scrum or xp tomes. They are also cleverly giving it away, since this allows their ideas -- which just happen to mesh nicely with 37Signals' products -- to percolate widely. That's how I found it, which is great.

I also enjoyed reading it from the standpoint of how development is done at Linden Lab. We agree on most of the principles, even if reality and ideal don't alway match perfectly. The one area where their book needs be read carefully is that 37Signals is still a very small team. Communication and coordination challenges scale at least polynomially -- and probably exponentially -- so everything doesn't just get harder as your organization gets bigger, it gets much harder.

But, as I said, their book is a good ideal. So, if you have an hour, go read it.