Navigate Yahoo! Search Results Using Only Your Keyboard

Google has an experimental search page where you can test drive new search result layouts. My favorite is the Keyboard Shortcuts option. This lets you navigate and view search results
using only the keyboard – no mouse required! It’s a huge benefit for Quicksilver fans.

Now that Yahoo! is my default search engine, I desperately didn’t want to give up the keyboard shortcuts feature. Thanks to jQuery and Greasemonkey I don’t have to.

Make sure you’re using Firefox and have the Greasemonkey plugin loaded. Then,
click here to install.

I’ve chosen the same shortcut keys as Google. J and K move you up and down through the search results. Press return to view the selected link. You can even browse through multiple pages when you hit the end of the results. Pressing / will jump you to the search box if you’d like to run a new search. Hit escape to move back to the results.

You can view the source on Google Code.

Retain Your Employees With Your Ideals, Not Your Perks

Earlier today I was asked what I look for in a job. Specifically, what it would take to retain me past the typical “three year burnout” period tech workers often find themselves up against. The usual answers came to mind: a fun corporate environment, challenging assignments, working with people smarter than myself. Those are all important factors, but they’re also very vanilla. Who wouldn’t want to work in a fun workplace? Unless you have a serious ego, why wouldn’t you want to be around smart people?

The person I was talking to pressed on looking for a more concrete answer. I thought back to previous jobs and why I had left them. I know that burnout had been a significant factor in leaving one position. The job became stale – repetitive. I lost hope that things would ever change, and, more importantly, that I could even influence change. The result? I stopped caring. Is that a fault of management? Most definitely. Is it also a fault of my own personality and work ethic? Yep, that, too.

I’ve never quit a job out of malice. But I came close once. During a performance review with my immediate supervisor and the president of the company, I was asked what my “dream job” would be within the organization. I think everyone probably gets asked this at some point. It’s a standard interview question designed to uncover where you’ll fit in. Of course, the problem with this is that it only works if you answer honestly. And who is ever completely honest answering a question like this during an interview? But during a performance evaluation? This is a rare opportunity to get reassigned to a better project or tweak your job description. I’d be an idiot to pass it up.

In a rare moment of unrestrained what-the-fuck-it-cant-hurt-to-try I was totally honest. I said I’d scrap the entire corporate website and rebuild it using best practices – valid HTML and CSS, minimal use of Flash, and a heavy emphasis on making everything accessible. I explained that not only would this help our search engine rankings, but we’d be better people for ensuring that anyone willing to try would be able to access our website – whether it be through a cellphone, text browser, or screen reader.

There wasn’t much hesitation in the answer I got back. The COO said flatly “Who cares if our website is accessible? Blind people aren’t going to buy [our product name] anyway.”

I was a little shocked. Up until this point I had thought quite highly of him and the corporate ideals he and the other executives often spoke about. I had even gotten swept up in the company’s mantra (which I’ll refrain from repeating here) and genuinely believed we could have a positive impact on the world. But with that statement I realized that despite all the corporate good intentions, in the end he was just another MBA out to make a buck.

Like I said above, I didn’t leave out of malice. I left (in fact, two weeks later) out of disappointment.

So, what’s the point of this story? The point of this whole post? It’s that I don’t think there can be a real answer or set of answers to ensure employees stay with a company long term. No corporation can be everything to every employee. They shouldn’t even try. Instead, they should focus on fostering the ideals that they as a company hold dear. They should communicate those ideals strongly in the workplace. The result will be a natural sifting-out of employees who don’t match. The stronger those beliefs are held in the corporate culture, the faster the sifting, and the less time wasted on both sides. Employers don’t waste time and money trying to fit round employees into a square cubicle. And employees can quickly move on with their lives and to a job that fits who they are.

50 States Programming Puzzle

Anders Pearson posted an interesting programming puzzle today on Thraxil.org:

Take the names of two U.S. States, mix them all together, then rearrange the letters to form the names of two other U.S. States. What states are these?

He found out about it from Mark Nelson who, in turn, heard it on NPR. It’s not a terribly difficult riddle if you take a moment to think about it. But from a programmer’s perspective it smells like one of the many brain teasers we face in early Computer Science exams or job interviews. The puzzle isn’t so much about being the first person with the correct answer or even getting the right answer at all. These problems are designed to reveal how you approach them. They’re designed to show how you think.

That’s what intrigued me so much about Anders’ post. He used it as an opportunity to compare programming styles between low and high level languages (and, by extension, how low and high level programmers think). In this case, Nelson solved the problem in C++ using STL libraries. (Damn.) Anders wrote his solution in Python.

Both solutions are valid. Each arrives at the same answer. However the ease at which the solution is attained is radically different – not only in time spent writing the program but also in the readability of the code.

I see this dynamic every day in the code I write. My day job uses PHP, but at night I’m programming in Objective-C. I’m still a novice at ObjC and Cocoa (although I do have a strong C/C++ background), so perhaps inexperience is clouding my judgement, but there are so many times where I find myself longing for the flexibility of a high level, scripting language.

In any case, here’s my analogous solution to the 50 States problem using PHP. (For obvious reasons, my code is nearly line by line identical to Anders’ Python solution.)

<?PHP
    $states = array("alabama","alaska","arizona","arkansas","california","colorado",
        "connecticut","delaware","florida","georgia","hawaii","idaho",
        "illinois","indiana","iowa","kansas","kentucky","louisiana",
        "maine","maryland","massachusetts","michigan","minnesota",
        "mississippi","missouri","montana","nebraska","nevada",
        "newhampshire","newjersey","newmexico","newyork","northcarolina",
        "northdakota","ohio","oklahoma","oregon","pennsylvania","rhodeisland",
        "southcarolina","southdakota","tennessee","texas","utah","vermont",
        "virginia","washington","westvirginia","wisconsin","wyoming");

    $data = array();

    foreach($states as $state1)
    {
        foreach($states as $state2)
        {
            if($state1 == $state2) continue;

            $letters = array();
            $str     = $state1 . $state2;

            for($k = 0; $k &lt; strlen($str); $k++)
                $letters[] = $str[$k];

            sort($letters);
            $sorted = implode($letters);

            if(isset($data[$sorted]))
            {
                list($s1, $s2) = $data[$sorted];
                if($s1 != $state2 || $s2 != $state1)
                    exit("$s1, $s2 and $state1, $state2\n");
            }
            else
                $data[$sorted] = array($state1, $state2);
        }
    }

    echo "No pairs found\n";