My Professional Blog

BILLEISENHAUER.COM

CodeRay-ize Your Code into HTML

Filed under: Ruby, Open Source — Bill Eisenhauer at 8:09 pm on Tuesday, February 13, 2007

I recently discovered CodeRay as a means to pretty up my Rails-based tutorial examples. But unfortunately, this blog runs under WordPress which is PHP-based, so I can’t use CodeRay here. Or can I?

While not the most seamless process, I now run my code examples through my CodeRay HTML Generator and then paste them into my WordPress posts. Since I use the same stylesheets for both apps, the styles are consistent.

If you have a similar scenario, feel free to use the generator yourself. I don’t keep any snippets…but won’t I see them on your blog anyway?

GeoKit: Some Minor Feature Tweaks

Filed under: Uncategorized, Ruby on Rails, Ruby, Open Source — Bill Eisenhauer at 3:09 pm on Monday, February 12, 2007

In the last couple of days, I added a couple of minor feature tweaks.

First, the finders will now all accept optional :units and :formula keys to enable you to override the units and formula used by the model by default. This makes it possible to serve distance queries in miles or kms and even to modify the formula used in the query. Overriding the formula might be important if you know the proximity is close and you don’t care about precise accuracy. It might also be helpful in the event that your dataset grows beyond that which would perform using the more taxing Haversine (:sphere) formula.

The second feature is a bit more subtle and edge case-like. If you steer away from our defaults and customize the lat / lng attributes, then the :origin was previously unable to handle taking an instance of those rows that you seek. I made a change to enable it to detect that situation. So now, you can do this. I did find one issue and that’s with the distance_from method which counts on lat / lng. Hopefully, I can add the same introspection and tidy that up as well. This will enable full customization for lat / lng attributes. Of course, you can write your own accessors to get around this, but still…

If you have any additional feedback, feel free to send Andre or I an email.

UPDATE: The update is complete, you can now compare the distance of Mappable instances which customize their lat / lng attributes when running as acts_as_mappable. If you don’t understand what this means, you probably don’t need the feature, so don’t sweat it.

GeoKit Examples

Filed under: Uncategorized — Bill Eisenhauer at 6:59 pm on Saturday, February 10, 2007

On Friday when GeoKit was released, I wrote a pretty lame write-up.  I am fixing that now with some live examples.  I’m working on them as I write this, but you can check now or come back later.  They are located here.

GeoKit: My First Rails Plug-in

Filed under: Ruby on Rails, Ruby, Open Source — Bill Eisenhauer at 11:35 am on Friday, February 9, 2007

This is a follow-up to my last post on distance queries in Rails. Since that post, I’ve enlisted the help of Andre Lewis at Earthcode.com to help super-charge the feature set. If you don’t know Andre, he’s the author of the upcoming book Beginning Google Maps Applications with Rails and Ajax, so I think he’s uniquely qualified.

The Rdoc is the best place to go to learn more. We’ve set it up on RubyForge. But just to whet your appetite, just imagine not having to code any nasty trigonometry into your SQL to include distance columns or conditions. Or imagine having ready access to Google, Yahoo, Geocoder.us, and Geocoder.ca geocoders separately or in a failover configuration. If that’s not enough, imagine integrating geocoders into your finders! For instance:

1
2
3
stores = Store.find(:all, 
                    :origin => 100 Spear St, San Francisco, CA, 
                    :conditions => distance < 10)

where the origin value serves as the anchor for the distance calculation and gets geocoded on the fly.

All this is done through a declaration like this:

1
2
3
4
5
6
class Store < ActiveRecord::Base
  belongs_to :company
  
  # Enables distance calculations and sweet, clean distance queries.
  acts_as_mappable
end

The goal of the plug-in is to clean up client code for location-based applications. I think we’ve succeeded. Enjoy everyone!

Distance Queries in Rails

Filed under: Ruby on Rails, Ruby, Open Source — Bill Eisenhauer at 9:00 pm on Monday, January 22, 2007

I’m writing an application which has store locator-like use cases. If you’ve ever written anything like this, you know that the SQL can get quite messy. To keep my code clean and elegant, I’ve written a Rails plugin called acts_as_mappable to ease my development. Perhaps it will help others as well.

With this being my first Rails plugin, some disclaimers are in order. First, its very v0.1 and experimental. While its written to potentially support multiple databases, it not only supports MySQL. Also, as primarily a Java developer, I find it sometimes challenging to write idiomatic Ruby. If you review the source for the plugin, you may recognize opportunities for improvement. If you’d like to make some suggestions, I’m very open to receiving them. Also, any patches or bug reports would be appreciated too.

The README file contains a pretty complete guide to the plugins capabilities — it basically provides distance calculation and query services. The test suite is also fairly extensive, so you can review it to get a good idea of what you can do. In typical Rails fashion, mixing this in would like something like this:

1
2
3
4
5
6
class Location < ActiveRecord::Base
  belongs_to :company
  
  # Pretty SQL distance queries and distance calculations.
  acts_as_mappable
end

And then there’s a host of finders that become available. If this whets your appetite, give it a look.

At present, the plugin is available here, but I’ll make it available in a public SVN repository sometime soon.

Asshole or Maverick?

Filed under: Uncategorized — Bill Eisenhauer at 9:31 pm on Wednesday, December 6, 2006

I was amused recently when I read two of Guy Kawasaki’s recent book reviews.  The two books reviewed are The No Asshole Rule: Building a Civilized Workplace and Surviving One That Isn’t and Mavericks at Work: Why the Most Original Minds in Business Win.

What amused me was that I recognized myself as being an asshole (not a flattering quality).  But then I also recognized myself as being a maverick (much more admirable).  So I’m justifying the former with the theory that to be a maverick, you must also be an asshole.

The trouble with my theory is that if you are going to claim to be a maverick, you need to have the occasional win on your scorecard; mine resembles a golf scorecard (this is to say that low scores don’t win in this case).  Unfortunately, my asshole qualities to some might be considered undebatable.

And so now I subscribe to still another theory: people are a product of their environment.  So see, its not my fault after all…

Don’t Play for the Texas Rangers

Filed under: General, Business Strategy — Bill Eisenhauer at 5:45 pm on Wednesday, December 6, 2006

No, this isn’t a sports-related post on my professional blog.  Well, okay, maybe it is sort of.  Its just that sports analogies come easy to me since sports is one of my passions.

While the above post title refers to the long-languishing baseball team from my neck of the woods, this post is actually inspired by a retirement in the hockey world.  Joe Nieuwendyk retired today.  He’s one of my heroes from the 1999 Stanley Cup Championship run and beyond that an all-around great guy.

Besides being a part of a championship team, he always seemed to be the guy who scored the great goal…or the memorable goal.  I’ll never forget his game-winning goal in triple overtime in the first round in the 1999 series against a physical Edmonton team.  He had a joyous celebration jump afterwards which I can still conjure up almost exactly in mind.

But to the point.  Joe is a guy who can look back on his career and savor the memories.  He has played for winning teams and has won a championship.  Any of the Texas Rangers?  Not so much.  When you hang ‘em up, you want to be able to look back and have felt like you achieved or made a difference.

So as I heard of this retirement today, my thoughts soon focused on my own career.  Right now, I feel like I’m playing for the Rangers.  Underachieving.  Losing.  Not growing.  Retirement is still 20+ years away (if I’m lucky).  Given that, I still have time to play for a winning team and to stand out enough to maybe be remembered.  But that won’t happen defending the status quo.  I need to make something happen.

Maybe you feel the same way.  Here’s hoping we find a way to knock one (or more) outta the park…

My Winter Project / YUI + YUI EXT + Rails = Yojimbo

Filed under: Ruby on Rails, Mac OS X, YUI, YUI-Ext — Bill Eisenhauer at 7:55 pm on Monday, November 20, 2006

Yeah, I know its a crazy title.  Let me explain.

The company I currently work for permits us to define self-indulgent personal objectives which factor heavily into our bonuses each half year.  A lot of people take the easy way out (quite frankly, because they can) and do pretty basic things like give presentations or do other less-than-ambitious projects.  I try not to do this myself if my core project work is at all manageable.  Sadly, this is less often than I’d like.  But I digress.

This half (note that much of the half is already expired!) I have decided to combine several of my personal technology interests into a project which will reinforce my knowledge of each.  The project will be a Rails-powered website which leverages the YUI and YUI-Ext user interface widgets.  The database will be MySQL and I will endeavor to keep the markup clean and semantic and the Javascript unobtrusive.  I’m going to make some concessions in the validatability of the markup and the degradability of the site because I’ll be making heavy use of Javascript.  That said, alternative UIs are definitely possible, I’m just probably not going to bother.

So what is the application?  Its modeled after a Mac-based information organizer utility called Yojimbo.  You can store bookmarks, notes, web page archives, serial numbers, and passwords within the Mac-based utility.  This is obviously easily done in a Wiki or online spreadsheet, but the point is not necessarily to create a whiz-bang application, but to learn the technology.

Since Yojimbo is designed to be run on a Mac, it has a single-user usage model.  I’m going to tweak that slightly and add some multi-user facets to make it a useful utility for my team at work.  Quite frankly, I need something like this to track various serial number and passwords that come into play daily.  I’m not blessed with great mental recall, so this utility will be helpful for me at the very least.

My secondary objectives are to expose my workplace to some of these “new” technologies.  We are completely Java right now.  Further, most people have a tenuous grasp on standards-based markup and next to no knowledge of Javascript.  As you might expect, our apps most of the time resemble the Extreme Makeover Home Edition before house.

Along the way, I hope to post a few notes on the implementation here.  I’ve not seen much blogging on YUI + Rails, so maybe I’ll help to fill a void.  I’m not sure how the folks at Bare Bones Software (makers of Yojimbo) will respond to this type of project, so its unlikely that I’ll be able to put the site up publicly.  If they are amenable, I’ll see what I can do and maybe make it available.

Hopefully, this is of interest to some who may wander by.

How to be a Rockstar Programmer

Filed under: Open Source, Business Strategy — Bill Eisenhauer at 10:21 pm on Sunday, November 12, 2006

In these Web 2.0 days, there’s never been a better time to aspire to be a Rockstar Programmer. You’ve seen these people, right? They are household names in our industry, they write the must-read blogs, they write the best-selling books, and they are coveted speakers at our industry conferences. Let’s face it, our jobs aren’t considered among the sexiest, but somehow a select group of folks elevate beyond the stereotype and enjoy the splendors.

So imagine the life: you command the blogosphere, you never eat alone at conferences, you headline magazine covers…and you even parlay this good fortune into a date or two or even a spouse! If you are exceptional, maybe you become the next Mark Cuban.

This sounds pretty good to me, so how do we get there? Today’s your lucky day, I’m going to tell you exactly how. What’s that you say? You say you’ve never heard of me and so how could I possibly tell you how to reach this state of nerdy nirvanna? That’s a fair point. Just consider me the guitar teacher that teaches you your first chords and the discipline to practice. Or the art teacher that teaches you to see beyond the stroke of a brush. The point is, I can tell you what you need to do, but most of this will be up to you.

So without further ado (no, its not adieu), here’s the list:

  • Discover your niche. Being a rockstar means you are going to play the same songs over and over as you tour the world. As such, you better like the songs, right? Same goes for you. Figure out where to focus your interests and ensure that your passion has staying power.
  • Read cutting edge books and blogs. You need to dig in and be in the top one percentile of those who are considered experts in your niche of choice. In short, figure out who the cool kids are and then figure out which cool kids know what they are talking about. Read them religiously. Basically, I’m telling you to listen to their songs and attend their concerts.
  • See beyond present day usages and limitations for current technologies. Rockstars play the impossible solos. You take a technology and do something amazing with it. You extend it and make it seem like magic. You empower others to make magic.
  • Start locally. To be a rockstar, you must rock your local venues. This means that you should start at your place of work or in your home town. Build your reputation and your chops locally and then broaden your horizons. What can you do locally? Attend user groups and speak often.
  • Master fundamentals and tools.  To be a rockstar, you must be more productive than the most person.  Few people completely master their toolsets and thus leave a lot of productivity on the table.  You will not make this mistake.  Mastering your tools means more energy and time will be spent creating your magic.
  • Apprentice with other rockstars. Find an open source project and begin contributing. Work your way to trusted committer. In other words, learn from others before you strike out on your own. Accompany Kurt Cobain, but become David Grohl. Realize that playing the small clubs help you refine your act for stadium venues.
  • Blog substantially and regularly. You must establish your “brand” and share your insights and secrets. You must cultivate loyal followers. Your followers will legitimize your efforts and your brand. You must create a stir; electrify the blogosphere.
  • Be a mensch. This advisement stolen from Guy Kawasaki. The point is that you must share your work, your time, and your enthusiasm generously and expect no immediate return. Instead, consider these interactions as long-term investments.
  • Write books and speak at conferences. You must spread the word in person and through formal channels. Be on the record. Establish name recognition. Write well, speak well. Be entertaining. Let the power of your passion embolden you and spark interest among those who share your interests.
  • Maintain an outstanding web presence. Yeah, you have a blog, but you need more. Your presence is your online resume. If you are a programmer, its implied that your website will do cool things or teach others how to do cool things. If you are a web designer, its expected that your design will always be inspired and innovative. NOTE: this is a do as I say, not as I do advisement as my current design reflects poorly on my skills! Remember: Me => your teacher; You: => Grasshopper.

You expected more? There really is no more to it. Follow the list and you’ll be a rockstar. The problem is, most people are unable or unwilling to do so.

Before you go, here are a few rockstars that you might look to for inspiration:

  • Rod Johnson and Juergen Hoeller. These are the founders of the Java-based Spring Framework. These guys won’t bowl you over with flamboyance. They are simply great technicians with a framework whose benefits are an easy sell for the disenfranchised EJB (and otherwise) community.
  • David Heinemeier Hansson. The creator of the Ruby on Rails web framework. You have to admire a guy who thumbs his nose at established enterprise technologies and goes maverick with a not so well-known language like Ruby. The Rails framework has fueled many Web 2.0 creations.
  • Jeffrey Zeldman. The poster child for standards-based web design. No rockstar has ever been so articulate and entertaining in spreading the word. As an aside, I think Jeffrey actually played keyboards in a past life. Rockstardom sometimes takes a while or gives you second chances.

So there you go, I wish you good fortune in your quest to rock the house.

Interaction Design / Improving Online Defensive Driving

Filed under: Design — Bill Eisenhauer at 5:28 pm on Saturday, November 4, 2006

Though my job title currently labels me an Application Architect, I have always been interested in web page design. I recognize that I’m not as talented as many of the rock star designers that are currently popular on the web, so I try to read what they read and publish. So recently, I’ve been surveying books on interaction design.

But sometimes you don’t have to read books or blog posts to recognize an obvious improvement in a site.

Someone I know (I promise its not me), recently took an online defensive driving course over the web. Such courses provide video or written content that you must pay attention to and then they quiz you to ensure that you’ve comprehended the material. To get credit for the course, you must be able to pass the quizzes.

Needless to say, the quiz interface design is critical since the quiz enables you to ultimately accomplish your goal of completing the course. However, this particular person was confused by the quiz question data entry. The answers were standard radio buttons, but the submit button was a non-standard image with a label that wasn’t intuitive. As such, the button wasn’t pressed and the alotted time for the question expired.

Now granted, this is not an egregious design failure. Once you miss one question, you figure it out quite readily on the next question. And if you are web savvy, you probably aren’t caught by this problem at all. But a more considered design might have done a couple of things to ensure users got off to a good start. First, if users are likely to be on the low end of web savvy, then use standard user interface controls (e.g. use the ugly gray button). Additionally, incorporate a test quiz into the flow to ensure that the user works through any usage issues. This enables them to work the kinks out while the stakes aren’t quite so high. Lastly, these days screencasts are all the rage. A brief video tour would demonstrate how to take the quiz and complete any other required tasks.

« Previous PageNext Page »