Also known as “the most the most useful piece of software [someone else] wrote in [a] calendar year,” rewritten.
Today Mark Dominus blogged about f, a wholly fantastic and tiny Perl script that changes:
ps aux | awk ‘{print $2}’</strong> to <strong>ps aux | f 2
Of course there’s the deeply embedded urge of every geek to take something like this and reproduce it in all possible languages (plus there was a syntax error running the Perl script on my end), so here we have it in Ruby!
#!/usr/bin/ruby
($stderr.print "f.rb usage: fieldnumber\n"; exit) if ARGV.empty?
$stdin.each { |l| puts l.split[ARGV.first.to_i-1] }
Download.
As we walk down the street, she bounds into the air, biting at the leash. With joy in her face she pulls and skips. She flips in the air, much to the amusement of passersby.
“You are not in the present moment! [1]”, I think to myself. You are missing the enveloping smell of the Angel Trumpets to our left; The smile of the child’s face to our right. But then I realize that to Addi, in that moment, I am the present. I’ve spent the day at the office, as she’s spent the day on the couch, my bed, or whichever comfortable spot she deems appropriate in my tiny studio apartment.
She becomes the present moment for me. I no longer am distracted by what would normally grab my attention. I love her wholly and this moment is a precious one. I remember now words given to me that remind us that focusing our energy towards the present allows us to fully embrace all that we care about; my dog included. And me to her.
[1] “You shouldn’t chase after the past or place expectations on the future. What is past is left behind. The future is as yet unreached. Whatever quality is present you clearly see right there, right there.”
—Buddha
So many people seem to judge success based on how much money one makes. This is a terrible misconception though, as success is not defined by monetary gain, but by happiness. This inspires an entirely different way of thinking about our lives; in particular our jobs. What if we didn’t strive to make money, but instead to make happiness?
When I first iterated over this article, I went back and forth on whether or not to include bullet points refining the concept. I found it difficult to articulate, because I was quick to inject my own inspirations for contentment. Everyone has a different definition of “happiness,” but there are a various ways you can look at your job in which are most encouraging. I believe I’ll continue to post on this concept, but here are a few things I find important and that could lend themselves to others as well.
1) Layout a base set of criteria that makes you happy. Like profiling an application for performance gain, you can’t know you’ve reached your goal unless you’ve set one. But how does one determine what happiness means? It’s actually fairly easy. Slow down, take a deep breath, and think about what makes you smile (smiling on the inside counts as well). What makes your entire body reverberate with that indescribable feeling?
2) Make just enough money to be able to provide these things for yourself.
3) If you make more money than you need to be happy, use it to inspire happiness in others.
4) Ensure that your means of making money contributes to your overall happiness. Sacrificing your well-being for delayed reward is a broken model. Some would argue this point, saying that there are necessary evils; Someone has to do the dirty work. But one can be content in their work, glamorous or not, based on their perception of the work itself and its benefit to the greater good.
5) Love unconditionally.
6) Add pictures of cats to whatever projects you work on. This guarantees, without the glimmer of a doubt, the happiness of not only yourself but your users as well.
Ok ok, the last one was a joke, but seriously … who doesn’t like cat pictures.
Dear friends, family, close relations, guys, gals, second cousins twice removed, and the web a large,
I’m moving. Moving to sunny, sunny California. I’m kinda flying by the seat of my pants right now, but I’ll initially be in Palo Alto for about 3 months, staying with Jesse, and then it’s a hop, skip,
and a jump into SF.

I’m very excited to announce that I’ve joined the team at Obvious, who of course made something called Odeo, to work on Twitter. I landed at Twitter for a number of reasons, but most importantly because I love and use it, as well as truly believe in what we’re working on. Twitter allows me (and you!) to talk about all the oddities of life, of which there are most definitely plenty. It provides an outlet for that strange little voice in your head that normally lies silent. The one that should at times stay quiet, but often wants to jump up and down and scream something like “HEY! Why is the mall Santa running through my neighborhood naked with a bottle of scotch!?”
Twitter the site aside, I’ll be joining an absolutely stunning team of passionate and creative people. I’ll also be leaving the same here in Lexington. I truly love the people at Voltaic, and words escape me in trying to describe the time I’ve spent there. I will miss them very much.
Anyway, enough for now. Lots of exciting stuff coming up!
This has been covered elsewhere. I did it in the past, but of course life has a way of kicking out old info to make space for the new.
Without being too terribly long winded, I will say that the reason for making this post is due to the fact that when I wanted to figure out how to dynamically create variables with ruby, I did a google search for a number of derivations of: ruby programmatically creating variables. This came up with a lot of nothing. I quickly realized this was turning into one of those dreaded cases of having to know the method name you’re looking for before you can find it. I’m a bit embarrassed to say I didn’t check this one, but thanks to blink on #ruby-lang, I’m posting just incase someone else searches with the same terms.
So at its very simplest:
eval "ans = 42"
Read more about eval at Jim Weirich’s always excellent blog.
Furthermore, instance variables of a class can be set via set_instance_variable.
class DeepThought
end
question = DeepThought.new
question.instance_variable_set("@ans", 42)
def question.what_is_the_answer
return @ans
end
question.what_is_the_answer
=> 42
It’s commonality on the web. A site asks you for something you consider sacred (it’s a strong word, I know): your email, your username, your password, before it gives something useful back to you. Sure, it may give you view-only access to information, but in order to actually participate in a community, you have to supply them with something first.
But what if this didn’t have to be the case? What if it shouldn’t be the case? A web application should be giving, loving, and excited about its users, even if they aren’t already defined by a particular identity. The web, at its heart, is largely anonymous. Sure, it knows things about you without your consent: your browser, your IP, your location, whether or not you have flash, etc, etc. But the web doesn’t know you; you as a person. If you are most webapps (you know who you are), then you ask the user to give this up, oftentimes before showing them what exactly they’ll be getting in return.
You are standing at a bar, hanging out with a variety of webapps.
Sitting next to you are some people you have heard of before (hey, they have a rep!): Digg, Gmail, Flickr. You’re an outgoing person, and you’ve heard about how amazing these people are, so you introduce yourself.
But to your left is a newcomer. Maybe they’re respectable looking, maybe they’re not. Maybe you’re immediately intrigued by their mystique, instantly wanting to get to know them. Maybe you’re not. Now in a perfect world, everyone would introduce themselves to everyone and immediately get along famously, becoming instant friends. Unfortunately, that’s not the world we live in, and nor is it the web at large. There are people who want to know you for their own benefit. So you’re jaded, and quietly sit there sipping your appletini.
But what if they turned to you and and started telling you a fantastic story, something about themselves that you would have never gleamed at first sight, especially in a bar as big as this one. You talk back and forth for a while, entertaining each-other with common interests and tales of the good-ol’-days, and eventually it comes out.
“Hey, by the way, my name is Britt.”
“Oh hi, I’m Twitter.”
And there it is. The beginning of a beautiful relationship.
If you don’t already read Kathy Sierra’s Creating Passionate Users, you most probably should!
Her Valentines day post (linked above), was on “Loveocracy” and how what’s good for the user is good for you. I’d like to add something that she implied in the post, but didn’t mention specifically.
Not only do you want passionate users, but passionate developers. It seems obvious, and should go without saying, but is very important. Love the software you write. USE the software you write! In an ideal world we, as developers, could love every application we create. Unfortunately for some, especially in the case of contract development, this isn’t always the case. But whenever possible, one is blessed with working on an application that they not only enjoy developing, but using as well. When you care about something, you nurture it. In the software world, this means more creative and intuitive applications, which are ultimately well written with fewer bugs.
In the end, don’t simply create passionate users, but be one yourself.
Well, you don’t see this every day.
One client of ours wants to add some shopping cart jazz to a few of his websites. Nothing new here, especially since we’ve developed our own kick ass shopping cart. The oddity is that he wants most of the static content of some very old-school sites imported in pure HTML form to a CMS for online editing. No layouts or cleanup, just the old, pure HTML. Actually, one of the sites used image maps for navigation (the whole page is solely images!), so we are doing a bit of cleanup there.
Comatose is a nice ‘microCMS’ that sits happily ontop of an existing Rails app. Today I whipped up a script to import a static site into comatose.

It’s not much … you can download it here.
Usage is simple:
html2Comatose: Import HTML into the Comatose MicroCMS
Usage: ./html2comatose app-root html_pages_root [additional extensions you'd like to import]
Example: html2Comatose ~/devel/myapp ~/var/www/httpdocs php rhtml
After the import is complete, you’ll want to put something like this in your /config/routes.rb ..
map.comatose_admin
map.comatose_root '/site', :layout => nil
map.connect '', :controller => 'comatose', :action => 'show', :index => '', :page => 'index'
Haha, I’m not sure if anyone will every find a need for this, but let me know if you end up using it for anything.