Thursday, June 19, 2008

Rake + Cron = Goodness

Our new site does some crawler tasks that run periodically throughout the day. While in development I just kicked these off using an http request from my browser, but moving to something resembling alpha we needed to get them on a schedule. Since we're running on a Joyent OpenSolaris Accelerator we have access to old-school cron goodness for scheduling, but we needed access to our Rails application environment - simply creating a cron task to execute a .rb file wouldn't cut it.

Fortunately rake is there to save the day.

Step 1 - Create your rake file
Touch a new file called yourname.rake and put it in /yourapp/lib/tasks. I called mine 'update.rake'. Add the following:

namespace :update do
task(:say_hello => :environment) do
puts 'Hello, World!'
end
end

Putting the file in lib/tasks and using :environment makes the script seemingly magically aware of your rails environment, so you can use ActiveRecord and everything else in your application.

Step 2 - Execute and Test
Next navigate to your app's home directory and run using your environment:

rake RAILS_ENV=development update:say_hello

you should see...

Hello, World!

Step 3 - Schedule
Next set up your cron job as you would normally. With Joyent the "Schedule Cron Jobs" section of Webmin makes it a snap, but there are as many ways to use cron as decades since it was created. Set up the following command using the path to rake on your server (use "which rake" if you aren't sure) and your rails app.

cd /your/rails/app && /opt/local/bin/rake RAILS_ENV=development update:say_hello

Now you should be able to set up application-aware rails code which executes whenever you please.

Extra Credit
You can make your rake script more object-oriented by putting real Ruby methods in your rake script. Check it out!

namespace :update do

task(:say_hello => :environment) do

delegate_hello

end

def delegate_hello
puts 'Hello World!'
end

end

Saturday, June 14, 2008

Startup Hats and Combinations

In my last entry I alluded to the discrete hats that somebody needs to be wearing in any sort of web startup. Others have expressed a long list of roles, and just the other day on the Seattle Tech Startups email list someone inquired about how they could get into a Project Manager role on a startup, so it's clear there is some question over what is needed. So, here are the hats according to me, and the configurations I've seen work to cover the bases well.

Hats



Developer - Someone has to build the thing. You are generally much better off with MacGuyver than with "Wall Full of Certifications Guy", and absolutely avoid a programming theologian/idealist. They must be very fast, good at writing straightforward, readable code, use but not go overboard with object orientation, and generally be more proud of the site they create than the structure of the code they wrote.

People Skills - Evangelist, salesperson, press releaser, blogger, pitcher, glad-hander, copy-writer, PR strategist. The face and the voice of your company.

Computer Guy - Linux/Solaris Admin, caching strategist, cluster deployer, migration script writer, database maintainer, scaling planner. Someone who giggles when you say "sudo make me a sandwich".

Right Brain - Someone who knows their way around Photoshop. A user experience design pro - pixel pushing and clickstream, ideally with freehand ability for the logo. Color, font, and CSS person.

Product Specialist - Social networking sites can skip over this one, but many niche startups will have a unique skillset required for what they do. For us it's a Mathematician, but it's as specialized as your startup.

Combinations


Most startups won't start with five people one wearing each hat, nor is it maintainable for one person to wear all five - it's overwhelming. Natural combinations are between:

Right Brain - People Skills and Developer- Computer Guy

I've made the case previously that from an hours-of-work perspective that one founder wearing the developer hat isn't enough and I still think so... to me an ideal pair is:

1. Developer-Computer Guy-Product Specialist and 2. Developer-Right Brain-People Skills

Outsourcing



You periodically see MBAs (People Skills) who have "an idea" and try to get funding so they can outsource everything else. More power to them. In my opinion Developer and People Skills are integral and can't ever be totally outsourced.

Right Brain is the easiest to farm out... in my experience it's a gift your founders either have or they don't - you can study enough to fake it and get by, but inspired user experiences come from naturally talented professional designers. It's also relatively narrow-term. Once you have your UI and "experience arcs" defined, this hat is largely pixel pushing until your feature set expands.
Computer Guy is tricky. On the one hand getting set up and developing a plan to scale is very short term, but you want more than a contractor's phone number when your server says it's in "maintenance" mode at 3 am. Most good developers at least know their way around a unix box, which is enough to get started. I can't imagine a core founder who only brings the Computer Guy skill to the table for a web app, but I suppose it depends.

People Skills - A true passion for your product is the best PR skill there is. The debate over hiring a PR firm will be raging years from now, and I've never done it, so I can't say. But I do think it's important for one founder to be able to make friends and influence people, and I've yet to meet someone who could do that who wouldn't make a fine People Skills guy.

Outsourcing development is another eternal question... if you can use it to turn dollars into an earlier release date it's a lovely idea, just make sure that you actually can. If you don't have someone on staff who can review the code you're getting you will probably come to wish you did.

All that said, I don't know any perfect teams. Motivated, passionate people can move mountains, and often do a much better job at tasks they have no experience with than professional contractors would.

Thursday, June 12, 2008

Observations on Early Startup Life


Lately I've been reflecting on this fantastic job of mine, and if you'll pardon the solipsism I thought I would share some observations on what it is and isn't like.

I should preface with a little bit more than usual about what my job is... I am a full time startup co-founder building a not-quite-beta startup. I am lucky enough to be able to at least fake at wearing all the primary hats, so I do everything from programming to pixels to PR. I've been doing it and some small business contract work on the side full time for about nine months.

Founder Types

They say there are two kinds of founders, "builders" and "entrepreneurs". I have found this to be true. Builders think about problems and their instinct is to wonder what solutions could solve those problems in an elegant way... entrepreneurs think about problems and instinctively wonder what untapped markets could be opened by solving them. The best litmus test I have found is to ask "If you were wealthy (whatever number that means to you), would you still be doing this?" It isn't perfect; there are plenty of entrepreneurs for whom finding "angles" is an addiction, but builders would definitely be creating products if they didn't have to.

Bad Reasons

If you decide to create a startup because you want to "be your own boss", you're making a mistake. You'll always have people to answer to in some form or another, whether they're clients, investors, or customers. For general headache-factor, a decent boss beats any of them. Give me Voltaire's "enlightened despot" or even Edward James Olmos any day. You can't avoid dealing with people and their quirks, and in the end you probably wouldn't if you could.

If you create a startup because you want to "make your own hours" you're making an even bigger mistake. There are plenty of opportunities to work in your pajamas in 2008 and still be on someone's payroll. To do the startup thing right you are going to be working all the time. The biggest difference between a founder and a telecommuter is that the telecommuter gets to clock out at the end of the day, whereas the founder has "dinner break" before the late shift starts. The lines between "work" and "non-work" tend to blur. Additionally, I am most productive when I don't sleep in and prefer to work at a desk a lot of the time, so I'm in an office co-op called Giraffe Labs. Logistically speaking, the startup is an awful lot like a flexible corporate gig.

So what makes it such a great job? The fact that the things you create are your babies. I feel intense pride for the software I've had a major hand in the creation of. The hours are ridiculous, but the definition of work has changed completely. I'll still be "The Wantrepreneur" until I have a liquidity event, but whatever happens the experience has been a huge success... which I realize makes me a "builder".

Friday, May 30, 2008

Twitter is the new MySpace

I remember when MySpace was the hot new thing. Everyone I knew had an account; it felt much cleaner than Friendster, and you could look up bands and find fuzzy recordings that you could then take back and embed on your profile. The track would play in the background while your friends checked out your CSS templating skills. It all seems very twee and sepia toned now, but I have a handful of offline friends with whom my only active connection is with our MySpace friendship so I leave the account open to atrophy.

Twitter is rapidly becoming the same for me. Anthony Stevens wrote this morning about how the decision was like super-delegates choosing sides. Without getting too political I think the metaphor is apt only if you consider the demographics which tend to come down on either side of that particular decision. Chris Pirillo said it best that Twitter is "asynchronous IRC" - a raw feed. The loudest voices dominate my twitter window, and the noise is deafening. Finding a "new voice" is like a needle in a haystack.

FriendFeed is like Twitter with actual conversations. Someone marks an article from basically anywhere, and it forms a locus for comments on that particular topic. No more sifting through @s and "in reply to's" that don't even point to the same post anymore.

The second big advantage of FriendFeed is in the ability to widen or shrink the pipe you transmit and receive. By opting into services you control what you communicate, and with the hide function and rooms you have a dial to control the gain on the noise stream.

Third, FriendFeed is an amazing place for finding new voices. When a friend-of-a-friend comments on an article you can get a feel for their perspective as an introduction, rather than finding out where they had lunch. If you have something interesting to say it is easy to make your voice heard in context, something virtually impossible with Twitter.

Armchair pundit: the next great movement will be Seesmic + FriendFeed. Video is spectacularly expressive, and in some ways the barrier is actually lower than with written commentary. The main downside is the inability to skim... and on video especially people tend to ramble. I predict new cultural memes for mini-video brevity to fight the problem, followed eventually by software organization... FriendFeed for Seesmic.

In the meantime I'll keep my Twitter account because a lot of friends and colleagues use it, but there is no question in my mind which technology has the edge.

Tuesday, May 27, 2008

Can UGC really go bad?

There was a ReadWriteWeb post this morning from Sarah Perez about the potential for negative feedback in a blog 2.0 context. After watching a couple of startups self-destruct after getting critical write ups it's clear that even for web companies the changing structure of corporate communication has not universally sunk in.

The lines get blurry, but there are two broad categories of feedback which jump out: call them "trolls" and "critics". A good place to find some old fashioned trolling is in the comments section of most articles on TechCrunch; an especially feisty example during the Wired spat here. Does a reasonable reader believe Michael Arrington is a #(&$ #($&##@ ? Of course not... I like to think of crackpot trolls as a status symbol like paparazzi. Name calling and ad-hominem attacks (DH0/DH1 on the Paul Graham scale) can be safely ignored in almost all circumstances, and your readers will do the same. They hurt your brand in the same way someone littering a fast food bag hurts that company's brand. Given the opportunity you'd rather craft the message differently than seeing your logo in a ditch by the side of the road, but most customers will be minimally affected and any response by you would absolutely make it worse.

Negative write ups are the second best thing that can happen for your startup from a PR point of view - after positive ones. In this day and age there is such a thing as bad press but I'd argue only in the contexts of HR or accounting. An early adopter interested enough in your product to discuss why it doesn't fit their needs is bad only for your ego. First, it gets attention to your product, and second it's great constructive feedback. There is an embarrassment of riches in terms of product feedback available today, and I think we're just seeing the first glimmer of companies tapping into that in an organized way. Companies that are already doing so have the added benefits of being seen as progressive and responsive.

Saturday, May 24, 2008

Ira Glass on making things that suck



This was posted on Hacker News this morning and I thought it was worth reposting. Failing sucks, but you can't do this and be afraid to. There's no magic formula that some people are born knowing, just a few lottery winners and a few others who work harder than everyone else.

Tuesday, May 20, 2008

Instant Rails = Epic Win

This week Lappy 9500 had a little zombie problem in its hard drive (for the second time in nine months which is how old it is), so I had to switch to the creaky old silver Dell while I wait for a new hard drive to get here. Reasons why I should have bought a Mac aside, my eyes were opened to the wonder which is Instant Rails.

The migration of my desktop development envrionment consisted of:

Step 1: Copy C:\iRails folder from freshly bitten undead Lappy 9500

Step 2: Paste iRails folder onto C:\ drive of Dell Slowpoke.

Step 3: Recognize.

Seriously... Database: check. Web server: ready. Environment variables: check. IDE, are you kidding: check. Codebase: check. It was glorious.

Interestingly getting set up to use Heroku on a new Windows machine is orders of magnitude more complicated. I understand cloud hosting vs. local environment, but if the story is how super easy Heroku is to use to get up and running with RoR, there is no comparison, it fails in comparison to Instant Rails. My other gripes about Heroku are the lack of a console window and the impossibly small pipe. Building an app on free-beta Heroku can feel like riding a Ninja 250 - the rev limiter is pegged right from the start, and it starts throwing errors above 55 mph.

For the record, to get Heroku back up on Silver Lappy would require installation of Firefox, 7-Zip, GitBash, my codebase and data scripts. I know, it's apples and... green apples, but for keeping me working seamlessly Instant Rails gets my gold star this week.

While I'm digressing on scrappy bootstrapping tools, I also installed ColorPic and the Gimp. ColorPic is a lightweight way to get the hex for any color you find, then fine tune it on your site using the raw hex values. Gimp is a sad pale shadow of Photoshop, but it's free. It isn't good for details or freehanding, but if you just need a curvy shape, a color change, a scale or a crop it gets the job done. Microsoft Expression Design is targetted at doing just this sort of thing and is comparatively really good at it, but if you're going to spend the money my opinion is that you might as well get Photoshop.