Archived Posts

Displaying posts 61 - 70 of 649

Snow!

Tuesday December 16, 2008 @ 03:42 PM (PST)

On Sunday we awoke to find our neighborhood buried under several inches of freshly fallen snow, a once-a-year occurrence in the Portland area. Naturally, I couldn’t resist rushing outside to snap photos.Front steps and driveway of our house, covered in snow

The snow continued to fall most of Sunday and remained on Monday. The sun returned, but temperatures stayed below freezing and the top layers of snow melted by the sun mostly turned into ice. Neighborhood children designated our driveway a sledding zone.

Tuesday saw the emergence of hungry critters eager to feast on the insects and worms chilled and exposed by the melting snow, including an opportunistic squirrel who scurried down from the treetops to seize an unguarded persimmon. He proceeded to devour his prize from a safe vantage point, seemingly unconcerned by my paparazzic invasion of his privacy.

Weather reports call for more snow tomorrow and this weekend, possibly lasting until Christmas Day or even longer, which would make this the longest stretch of snowy weather I’ve seen in over ten cumulative years of living in Portland. Looks like we moved back just in time.

Tracking Change.gov revisions using git

Monday December 01, 2008 @ 11:28 PM (PST)

Now that the Obama-Biden Transition project’s Change.gov website has been placed under a Creative Commons license allowing redistribution, it’s possible (and legal) to publicly track revisions to the site. I’ve created a change.gov git repository to do just that.

Trogdor: Burninatingly fast search using Yahoo! BOSS

Tuesday November 25, 2008 @ 04:02 PM (PST)

Everyone and their dog seems to have written an example of how to use the Yahoo! Search BOSS API to build a simple search tool. I wanted to take that one step further and build something that would serve both as an example and as a usable service, and that could be extended and enhanced by other developers. Since my day job involves constant tradeoffs between making Yahoo! Search slower (by adding features) and making it faster (by optimizing those features), my primary goal here was to make something as fast as technically possible.

To do this, I wrote a very simple JavaScript module called Trogdor that uses dynamic script nodes to make cross-domain JSONP requests to the BOSS API as you type your query. Search results are returned and rendered almost instantly on each keystroke, and you can use the up and down arrow keys (or tab) and enter to quickly select the result you want—no mouse necessary.

Trogdor doesn’t require a JavaScript framework and works great in all modern browsers (and even some ancient, crappy browsers like IE6). The entire package (HTML, CSS and JS) weighs just a smidge under 2KB after minification and gzip, and it’s wonderfully fast.

Try it out for yourself at pieisgood.org/search and be sure to grab the heavily-commented source code on GitHub. If you’ve got ideas for features and improvements, fork the repo and go nuts (and be sure to let me know what you come up with). You’re also welcome to use Trogdor (modified or unmodified) in your own projects, although I do ask that you please use your own BOSS API key rather than the one included in the example.

Update, 11/26: Changed the name of the library from FastSearch to Trogdor, since dragons are awesome (and apparently there’s a Microsoft search product called FastSearch).

The YUI Get Utility makes it easy to dynamically load CSS and JavaScript on demand, but there’s one tiny gotcha: Firefox, Safari, and other Gecko/WebKit-based browsers don’t provide a reliable way to tell when a CSS file has finished loading. As a result, when you load CSS in one of these browsers using the Get.css() method, the onSuccess callback is fired instantly.

In many cases this isn’t a problem, but if you need to ensure that you don’t perform an action (such as appending HTML to the page) until after the CSS has loaded, this can cause a race condition. There’s no way for the Get Utility to automatically work around this problem, but with a little bit of extra effort on our part, we can work around it ourselves.

The trick is to include a rule at the end of the dynamically-loaded CSS file that will send a message to our script by setting a style property on a special element. Once we see that property change, we know the CSS has finished loading.

First, the contents of our CSS file:

/* ... imagine lots of other CSS here ... */

#css-done { display: none; }

And now the JavaScript that will load it:

(function () {
  var Y = YAHOO;

  Y.util.Get.css('example.css', {
    onSuccess: function () {
      var el, poll;

      function finished() {
        alert('CSS has finished loading.');
      }

      if (Y.env.ua.gecko || Y.env.ua.webkit) {
        el    = document.body.appendChild(document.createElement('div'));
        el.id = 'css-done';

        poll = function () {
          if (Y.util.Dom.getStyle(el, 'display') === 'none') {
            // Once the element's display property changes, we know the CSS has
            // finished loading.
            el.parentNode.removeChild(el);
            finished();
          } else {
            // The element's display property hasn't changed yet, so call this
            // function again in 50ms.
            setTimeout(poll, 50);
          }
        };

        poll();
      } else {
        finished();
      }
    }
  });
})();

jsmin.rb 1.0.1 released

Monday November 10, 2008 @ 10:57 PM (PST)

I’ve released version 1.0.1 of my Ruby port of JSMin. This release fixes compatibility issues with Ruby 1.9 and brings minor performance improvements. To install or upgrade via RubyGems, run:

gem install jsmin

My car is titleless

Monday November 10, 2008 @ 06:20 PM (PST)

A few months ago, when I still lived in California, I bought a new car. Last month I moved to Oregon and began the arduous task of registering my new car with the Oregon DMV.

Oregon requires that you submit the car’s original title along with the registration paperwork. Since I financed my car rather than buying it outright, the bank holds the title until I pay off the loan. This means I had to fill out all the DMV registration paperwork, then mail that paperwork to the bank (Chase) along with a letter asking them to pretty please mail the original title and the paperwork to the Oregon DMV.

Today I got a letter from Chase acknowledging my request but saying that they could not immediately comply because they don’t have the title to my car. According to the letter, the California DMV never sent Chase the title, and apparently Chase never noticed, so now they have to request it and wait at least 45 days for it to arrive, by which time I will have exceeded Oregon’s registration grace period and will be in violation of state law.

Is Monday over yet?

So long, Dash

Monday November 03, 2008 @ 04:30 PM (PST)

Dash Navigation sealed their fate today by laying off 65% of the company and announcing that they’ll be quitting the hardware business to focus solely on software.

While the Dash Express is a reasonably good GPS device, it’s not the software that makes it special: it’s the fact that the Dash Express was the first GPS to do real-time traffic well and to have always on two-way Internet connectivity. These are things that any other GPS maker can do, and companies like Garmin and TomTom certainly have the resources and expertise to do them well; Dash just did them first.

It’s likely that Dash would have eventually failed if they had continued trying to compete in the hardware business. However, switching to a software-only business model will only delay that failure. It’s unclear which device makers Dash plans to sell their software to. Certainly not Garmin or TomTom, since their software is already far more polished and mature than Dash’s, despite missing some of Dash’s unique features. The best bet for Dash is to make deals with several smaller device manufacturers, but they’d still be fighting an uphill battle and would likely be unable to compete if Garmin or TomTom decided to challenge them by adding similar functionality to their devices.

I like my Dash Express, but unless Dash pulls something really incredible out of their hat with the next software update (supposedly coming soon), they’re most likely going to fade into obscurity.

Inquisitor now available for Firefox and IE

Thursday October 23, 2008 @ 10:38 AM (PDT)

The original Inquisitor for Safari is one of my favorite browser plugins ever. Since switching from Safari to Firefox 3, I’ve missed it terribly. Now, thanks to Yahoo! and Inquisitor creator David Watanabe, Firefox and IE users can experience the joys of Inquisitor as well. Hooray!

Going home

Monday September 29, 2008 @ 09:28 PM (PDT)

About a year and a half ago, Felicity and I left the Silicon Forest and moved to the Silicon Valley so I could take a job at Yahoo!. In a little over a month, we’ll trade Valley for Forest and return once more to drizzly Portland.

It’s strange: until Portland, I had never lived in one place long enough to think of it as home. I grew up in a military family, moving every few years, from Texas to Illinois to New Mexico to Japan to Texas again and, finally, to Oregon. When I decided to move to California I knew I would miss Portland, but I thought I’d get over it. I was wrong. Once you’ve lived in Portland you belong to it; you can leave, but only physically.

Silicon Valley, by contrast, is not the kind of place I can imagine ever calling home. People don’t so much live in the Valley as exist in it. Apart from the nearby oasis of San Francisco, there’s nothing particularly special about this place. Half a century ago, fate decided this would be the site of a world-changing technological revolution, and so a gravity well was formed that attracted innovation, which attracted money, which attracted more innovation, and so on. The result is a place people go to not because they want to be there, but because they need to be there.

Thankfully, I don’t need to be here anymore. I’m lucky to work for a company that actually cares about my happiness and is progressive enough that they’re willing to let me work remotely if that’s what will make me happy. I can’t even begin to tell you how awesome that is.

Portland, here we come!

Thoth 0.2.1 released

Tuesday September 09, 2008 @ 06:23 PM (PDT)

I’ve just released version 0.2.1 of Thoth, the simple Ruby blog engine that powers wonko.com. Notable changes in this release include:

  • Requires Sequel 2.5.x (this fixes an issue with SQLite and DateTime objects).
  • Requires RedCloth 4.0.x. Markdown syntax is no longer supported as a result.
  • Names of existing tags are now suggested as you type in the “Tags” field when creating or editing a blog post.
  • Blog post URL names can now be specified just like pages, and names are automatically validated and checked for uniqueness via Ajax. If you don’t manually enter a name, one will be created automatically based on the title.
  • Comments are now deleted via Ajax when JavaScript is enabled, making it easier to delete multiple comments without having to reload the page.
  • A rel="nofollow" attribute is now automatically added to links in user comments.
  • When minification is enabled, filenames in the public /css and /js directories that have names ending in -min.css or -min.js will be served as is since they are presumably already minified.
  • Fixed a bug that prevented client-side caching of CSS and JS when server-side caching and minification were enabled.
  • Fixed internal server error when viewing a tag that isn’t attached to any posts.

To install Thoth for the first time, run:

gem install thoth

Or, to upgrade an existing Thoth blog:

gem update thoth
cd /path/to/blog
thoth -d stop
thoth --migrate
thoth -d start

Note the database migration step, which is necessary if you’re upgrading from a version of Thoth older than 0.2.0. Your existing data will be preserved, but you may want to make a backup first if you’re paranoid.

Copyright © 2002-2012 Ryan Grove. All rights reserved.
Powered by Thoth.