My Little Corner of the Net

My First Practical Prism App

I downloaded Mozilla’s Lab’s new software Prism a while back. The concept behind Prism is pretty cool–basically it provides a desktop interface to a website. With most-basic use this means that your favorite web site gets an icon in your start menu and runs wrapped in a custom window without the standard browser features like location bar and nav buttons. If you want to get more fancy you can add advanced features like custom style sheets to alter the look of the site.

As cool as Prism seemed, I really couldn’t come up with a practical use of it. Sure, I wrapped GMail and a couple of other sites, but launching a separate program to get to those site seemed kind of pointless since I pretty much spend my day in Firefox already; I rarely use bookmarks as it is, rather I just start typing URLS and use auto-completion to navigate through the sites I visit regularly.

This morning I came up with a good use–Pandora. I often listen to Pandora while I work, running the “mini” pop-up player in a Firefox window. The only problem is that when Firefox crashes the music stops. So today I figured out the URL of the mini player’s page and created a new Prism app pointed at it. Since the Prism version runs in a different process from Firefox, the music keeps playing when an endless JavaScript loop kills Firefox (not that I ever create endless loops in JavaScript…). Plus, unlike some of the stand-alone Pandora apps out there, this one keeps the ads (that Pandora counts on for revenue–it is a free service, after all) showing.

Speechwriters LLC

Thanks to the awesome music app Pandora I have discovered a cool new band.

Speechwriters LLC is an acoustic rock band from So Cal. Their sound is a mix of Jack Johnson, Jason Mraz, and Red Hot Chili Peppers with some funky slide guitar riffs thrown in for good measure. The song CHBB (or Crazy Heart-Breaking Bitches as it is named on the MP3) got me interested, but several other tracks, including Clones and The Ballad of Johnny Lo frequently get stuck in my head when they pop up in my iPod’s shuffle.

While some of the band’s feature albums are available on CD or for download through iTunes and Amazon, nearly all of their catalog is available as free downloads on various “mix tapes” in the SWLLC Digital Archive.

Summer Must Be Coming

My thermometer says it is 81 °F in my office right now. Yahoo Widgets says it is 67 °F outside. Summer my be getting close. Maybe, if I get lucky, they might fix my A/C this year.

CSS Tricks: .noprint and .noscreen

Cascading style sheets (CSS) make it easy to target web pages to multiple output media. For example, using different CSS rule sets it is possible to design a single web page that looks visually different on screen, on a hand-held device, or when printed.

On way that I’ve extensively used different CSS media types is to provide printer friendly versions of a page. Since real estate on an 8.5″ x 11″ sheet of paper is limited, I like to remove any extraneous content from my pages when somebody prints them–content such as navigation, that has no meaning on the printed page. To do this I often use a “noprint” class definition in my print stylesheets:

.noprint {display: none;}

Then, in my (X)HTML markup I simply set the class attribute of tags I want to exclude from the printed page to no print. (Note that I often take advantage of the seemingly forgotten fact that an element can use multiple classes):


<ul id="navbar" class="nav noprint">
...
</ul>

Easy shmeasy…now when you print the page the navigation links aren’t there. Since the “screen” style sheet doesn’t define a “noprint” class the browser ignores the fact that it is present on some elements and displays those elements according to other rules.

Likewise, I occasionally want to include something on the printed page that isn’t visible on screen. For example, I’ll often use a background image as page header. Since backgrounds generally don’t print, I’ll often include a text and/or a lightweight image title inside the header div that I want to display only when the page is printed. For this, if you can’t guess already, I use a “noscreen” class in my screen-targeted stylesheet.


<div id="header"><span class="title noscreen">This is the site title</span></div>

Unlike the noprint definition, however, there are many reasons why I would like to still have the noscreen elements to be considered part of the page. For example, since background images have no alt text, users of screen readers won't hear the content if I use display:none to hide it, even if it is repeated in the background image. Instead, I use a variation on the Fahrner Image Replacement technique to move the "hidden" content off the edge of the screen. This has the effect of visually hiding the unwanted content while keeping it available in non-visual circumstances:

.noscreen {margin-left: -999em; height: 0; overflow:hidden;}

This shifts the element way off the edge of the screen (the actual value is arbitrary—any negative value should do, -999em is just the value used in an example I once saw somewhere) and forces it to a height of zero so that it won’t effect the layout of other elements. Since the element is still technically visible screen readers and text-based browsers will still acknowledge it.

I could extend this technique to other media, such as hand-held devices, as well, but at this point I rarely target anything except screens and (indirectly) printers. Further, if I was targeting hand-held devices I would probably use some other technique such as browser detection to determine the device and send out an alternate “light” view to save on bandwidth.

I Want some roBlocks

I just read about roBlocks in an editorial email from Dr. Dobb’s Journal. Basically, they’re little magnetic blocks that you stick together and build robots. The blocks are smart enough to know how they are arranged and can automatically provide various functionality based on that arrangement.

There are currently about 21 different blocks available, each serving a specific function. The blocks are categorized as sensors (light, sound, touch, motion, etc.), actuators (lights, sirens, movements), operators (inverse, sum, max, min, etc.), and utility blocks (power, passive, blocker, and comm).

The creators–a professor and PH.D. candidate from Carnegie Mellon University–are hoping to have the blocks in mass production and on the shelves by December. When they become the hot new item at Christmas, remember that you heard about them here first!

For now, though, have fun with the simulator.

<