Minor highlights of the life of Otto…

Let’s see, haven’t posted here in a while… what to say…

Lorelle invited me to make some guest posts this month on her blog. I wrote a short little technical ditty about how to integrate Microformats and WordPress Themes. If you’re into WordPress, or CMS’s in general, it’s worth a look. Since I use this site as a sort of test bed, I might also mention that it’s currently showing nine, count ’em, nine different microformats. And a few other things that aren’t microformats as well.

Went to the Art on Tap beer festival this last weekend. Had a hell of a good time, but was rather disappointed in the food selection. Also, it was one of the only beer festivals I’ve ever seen where all the beer was poured out of bottles. The exception was the homebrews poured by The Bluff City Brewers, which were all really good. I recall getting back to the Saucer, I don’t quite recall going home. So clearly, I had a good time. Paul posted some shots of the fest, some of which include yours truly.

The Rapscallions won at Trivia tonight, amazingly enough. Pete has clearly been making the questions harder, as we only scored 79 out of a possible 160-something. Still, that was enough for a tie, and we won the tie-breaker. $50 in the pot for the next party!

I received an invitation to the wedding of Chris, a friend of mine currently living in Atlanta. I kinda wonder about it, the wedding reception is at a beach resort in Alabama, but it’s in November. Anybody know what the weather is like at Gulf Shores in November?

Along with the invite, I received a summons from Zach for the Bachelor Party in October. Unfortunately, I’m told that it’s the same day as the Great Decatur Beer Tasting Festival. That’s just poor planning, man. Although, a beer tasting in the afternoon, followed by a Bachelor Party all evening… I’m not sure I’m capable of that anymore. I’m not as young as I used to be. Still, it’s doable, and damnit, I think I’m going to have to try. And then this weekend, I have the Cooper-Young festival to cope with. Along with a keg party a block away from the festivities.

Oh yeah, and Raiford’s is reopening, with Raiford back at the turntables. Now that I live about 2 blocks away from that point, I can see many 40’s in my future.

So, the fall is looking busy.

Virtual Bartender

Paul found a thing called MyFountain on somebody’s website. It’s basically an automated bartender.

Now, I’ve seen these before, but mostly as do-it-yourself type projects. The basic idea is that you get a bunch of liqour and beer and such, hook it up to a bunch of pumps and tubes, and hook those to a computer to portion each one out properly. Simple enough. The trick, of course, is programming the computer properly. Running pumps and such is no big deal.

This MyFountain thing takes it to a whole other level. The cheap version (which is still $2500 or so) is a basic bartender. It can go online to get new recipes and such, and it knows what you have in the fridge so it can tell you what you’re capable of making. The advanced version is basically geared towards managing an entire bar, in that it networks with multiple units, can estimate drinking patterns and call headquarters to schedule deliveries of more beverages automatically, etc, etc. Very clever indeed.

Still, I think it would be a fun project to build my own unit. I’ll need a mini fridge or freezer of some design to hold the beverages, but I’ll have to be willing to cut holes in the thing for the necessary tubes to pass through. So if anybody knows of a fridge/freezer design suitable for such a project, capable of holding, say, 6-10 bottles of liquor and possibly 1 or 2 mini kegs, let me know.

Fun with a Roomba

So I purchased a Roomba at the Woot off the other day. After I bought the condo, a good friend of mine (who also lives here) mentioned the device, but didn’t know the name. Being the consummate geek that I am, I knew he was talking about the Roomba, and furthermore knew that they had several flavors of it now. And the fact of the matter is that he was right, it seems perfectly suited for this place. So when I saw one at the Woot off for only $120 (+$5 shipping), it seemed like a good idea. In fact, I think it turned out to be one of the best bargains ever.

The one I got is a “Discovery 4296” which is nothing more than a word with a number, really. The thing is basically an automatic sweeper. With hardwood or low carpets/rugs (not shag) it’s clearly perfect. Basically it sweeps the floor with rotating brushes and sweeps the crap into a bin, whereupon you dump it. It’s particularly good with hair and other small debris, like the weird pebbles that keep falling out of my ceiling. It also does a decent job of dust in general, although it tends to throw it about a bit. But it seems to get it after a few passes.

One thing I do not like is the bin. It’s too small, and it’s positioned wrong. The upshot of this is that you have to use it every other day, and you have to be *extremely* careful when emptying it. The first time I emptied it, I dumped a large amount of crap onto the floor. Takes some practice, so expect it.

Naturally, being a geek, I’m interested in the algorithms involved. It has a few. They probably have technical names, but here’s the lowdown:
1. Roaming – It roams off in some random direction for a long distance. This is the primary way that it cleans the center of rooms. However, when you consider it, the center areas of rooms don’t tend to be the dirty ones.. It’s the edges that build up the mess. So it has…
2. Edge finding – I think the manual calls this wall roaming. It tends to do this a lot, however I’ve seen it walking the edge of my rug as well. Which is actually a good thing, as those edges tend to pick up debris too. Finally, it has:
3. Spot cleaning – This is an interesting mode. You can force it by placing it somewhere and hitting the “spot” button, but in normal “clean” mode, it will wander around and occasionally switch into this mode. A blue light labeled “dirt detector” comes on, and it runs around in circles for a while, eventually heading off in some random direction.

Few other things:
– Home base – If you get the model with the home base charger, then after it’s satisfied with the area or low enough on battery, it will go home and dock for charging. This can be forced as well with the remote (if you have one). Watching it dock is a lot of fun for your average geek, because the way it does it is clearly via two infrared beams on either side of the dock. It hits them, and turns away from them, back and forth, hunting, until it finds the home point. Very clever.
– Virtual Walls – These are similar, just infrared transmitters (each takes 2 D-cell batteries!) that shoot out a beam which cause the thing to act like it hit a wall and turn. It will follow the beam just like it follows walls. The beams are a bit wide, so put them back a bit inside doorways and such.

The primary way it knows about things is hitting them. The whole front piece, about 140-150 degrees or so, is a movable bump mechanism. When it hits something, this pushes in and the thing stops and turns around some seemingly random amount, or just a bit in edge finding mode. It also appears to be able to sense distance from any wall, because in edge finding, it will follow a wall very precisely without touching it at all, which is weird, because I can’t find any obvious sensors there.

As far as cleaning goes, the one I got is basically a sweeper/vacuum. Works great on hardwood, decent on low cut rug/carpet, probably would not work on shag or similar. The gist of it is that it has a side sweeper to pull in things, a front sweeper to push things up, a rotor brush to pull things in, and a ramp to force things into the bin. There’s also a spinning mechanism inside which might produce some very minor vacuum effect, to get things “over the hump” of the bin and keep dust inside. The bin is on the back, and it sucks. Pick the thing upright before removing the bin. You’ll see the method after 1 spill, trust me.

The docking station does not work particularly well on hardwood floors. It slides, and the Roomba drags it around while trying to disengage. Put it on rug or carpet. I ended up putting it on some carpet samples underneath my bar area. Speaking of which, the dock *MUST* be in an area where it has a pretty good view of the room. Otherwise the Roomba will not find it. So forget a closet or something, it must be in the main area, somewhere.

The cat is completely freaked out by the thing, but the Roomba does not appear to mind his presence. :D

It’s loud. Not as loud as an actual vacuum cleaner, but the Roomba takes longer. However, given that mine has a scheduling feature, I can set it to work when I’m not here. Haven’t tried that yet, might try it later this week. The scheduler is cool, built into the remote. You program the times, and then send the schedule to the Roomba and to the virtual wall units. It runs for that time and the wall units turn on at the same moment. Very conservative on battery power that way.

One thing that bugs me is that the remote doesn’t offer any easy way to really remote control the thing. You can send it commands, but they’re really more like suggestions as far as I can tell. Which is frankly too much work. It covered my living room and kitchen by itself twice before running out of power, and since I didn’t follow the charging directions, it didn’t find home base when it did so. Follow the damn directions, charge it for 16 hours before the first use. Trust me on this one.

Hacking: There are myriad abilities to hack the thing. It has a serial port, and can accept commands to move around and such, as well as provide feedback of all the sensors on it. Worth a look if you’re into that sort of thing. I’m considering building a bluetooth serial link to it and hacking it a bit. With some minor effort (okay, maybe not so minor), I could control the thing and make it work much better for my specific space. Given that the unit’s more or less “random” method works pretty well, it does seem to take a while to accomplish anything. I mean, it works, but seems inefficient. I could improve that. I browsed through the documentation on irobot.com while it was working, and it’s pretty comprehensive. Worth a look if you’re the hackish type.

All in all, I’d say it’s worth the $125. Maybe $170. But not the default $220 price. Find the bargains on it, stick with those. Amazon has the remanufactured ones on the cheap (this is the same one I got). And if you’re all hardwood with no rugs/carpets, look for the one that actually mops instead of just sweeps and vacuums.

Fully Integrating Google Apps for your Domain

Having two email accounts can be a pain. I’ve been using my GMail account for a long time, but I like the niceness of my ottodestruct.com domain better. It’s cleaner, overall. A bit more professional as well.

I also use Firefox with the Google Toolbar. One of the nice things about it is the little GMail icon that checks your GMail every 10 minutes or so, and shows if you have new messages. It also lets you search your email right from the toolbar. Very handy.

However, I also use Google Apps for your Domain for my email. This basically makes all my ottodestruct.com email go through Google and their GMail interface. The Google Toolbar doesn’t work too well with that.

So I got bored and fixed all that. How to do it can be found after the jump…

Continue reading “Fully Integrating Google Apps for your Domain”

HOW-TO: Make WordPress Blogroll's smarter

Warning: Heavy geek content ahead. If you’re not interested in PHP code, you can safely skip this post.

One thing that not a lot of people know about is that WordPress is capable of checking your bookmarks/blogroll links for you and organizing them according to the time they were last updated.

The reasons people don’t know this are:
a) It’s not automatically setup and working, and
b) It rarely works in the first place.
Continue reading “HOW-TO: Make WordPress Blogroll's smarter”

Enable Firefox spell checking in WordPress 2.1

Important note: This plugin only applies to WordPress 2.1 – 2.1.2. The fix is included in the 2.1.3 source by default, and this plugin will no longer be needed.

Edit: Yes, I’ve just looked at 2.1.3 (which was just released) and this fix is in there. Do not use this plugin with 2.1.3 and up.

Lots of people like the new WordPress 2.1, but I noticed several complaints over on the WordPress support forums about the fact that the Firefox inline spell checking seems to not be working with the new editor.

I investigated, and it turns out to simply be one of the default settings of the version of TinyMCE that is being used. Even though it has a spell check button, some people prefer Firefox’s automatic spell checking. I can understand that, I use it all the time myself.

Fortunately, WordPress includes hooks for changing those TinyMCE settings, so it was a matter of a few minutes to create a plugin to deal with the issue.

Here’s a plugin to do just that. It’s simple to use, just upload to the plugins directory, then activate it in the Plugin panel. No configuration needed, it just turns the Firefox automatic spell checker back on in TinyMCE. Simple.

Download FFSpell

Enjoy!

Picasa Web WordPress Widget

THIS PLUGIN DOES NOT WORK ANYMORE. I doubt I’ll be updating it any time soon.

Playing around with my new Picasa Web access, I found the RSS feeds quite nice. So I made a widget for them.

Picasa Web Widget

Basically it puts a slideshow of photo thumbnails from one or more Picasa Web RSS feeds into your sidebar. You can click them to go to the photo’s page on Picasa Web. Uses divs and names and all that good CSS stuff to make styling them easy, if you want.

Enjoy!

—-

Update: Version 1.1 actually works now. )

—-

Update: Version 1.2 now has four additional options. Now you can:
-Turn javascript image rotation on/off.
-Limit how many images will be rotated through.
-Display more than just the one image.
-Control whether or not the images are shown in a random order.

The image rotation script has also been corrected to work in both IE and Firefox (and probably others as well).

—-

Update: Version 1.3 adds Brian’s fix for filenames with unusual characters in them being in your web album.

—-

Update: Version 1.4
– Output will now validate as valid XHTML. Should work all the time. Important note: Use the class for CSS styling of anything, the ID is only there when you are only showing one image.
– Added the ability to display descriptions below the thumbnail. It even works with rotating images. )
– Fixed the case where you are showing multiple images in a non-random order.

—-

Update: Version 1.5 – Corrected a problem where it would only show the last feed when you give it multiple feeds.

—-

Update: Version 1.6 – Corrected some cases where the rotate images javascript would fail to work in certain scenarios.

Fun with PHP and WordPress

Guy over here asked how to display hockey scores on his blog. Here?s my solution?

Edit: Fixed a minor problem with the regular expression. Some of the soccer team names caused problems on that feed.

A quick googling tells me that exactscores.com seems to have feeds for scores for lots of stuff, however they also put horrible amounts of advertising into the RSS feed. Nevertheless, that can be worked around, if you want. )

The actual score information in the feeds comes in the titles, and it looks like this:

(No)001/1 (BST+2h,Start at)03:00 (Home Team)EDM OILERS (Final)3-6 (Away Team)ANA MIGHTY DUCKS (Status)Finished (First Period)0-3 (Second Period)3-2 (Third Period)0-1 (Full Time)3-6 (Over Time)- (Penalties)- (Scorers)LUPUL(19)

Now, that is pretty ugly. But, at least it?s in a semi normalized format: (Key)Value? The Scorers at the end isn?t pretty, but we can deal with that later. Also, thankfully, the actual scores in all the ones I checked always start with (No), so we can use that to determine which bits of the feed are actual scores and which are not.

So here?s a simple script to retrieve a feed and then display only those bits that start with (No):

< ?php
require_once(ABSPATH . WPINC . '/rss-functions.php');
$rss = fetch_rss('http://www.exactscores.com/HockeyLivescoreRss.xml');
echo '
    '; foreach ($rss->items as $item ) { if (preg_match('/^(No).*/i',$item['title'])) echo '
  • '.$item['title'].'
  • '; } echo ''; ?>

Obviously, the output of this is ugly, but it proves that we?re only getting scores out of the feed.

So, now we need to parse that string and get more useful data out of it. Here?s where preg_split and some rather disturbing regular expression syntax is your friend?

$uglyscores = preg_split('/^(([^)]*))[^s]|s(([^)]*))[^s]/',
	$item['title'], -1, PREG_SPLIT_DELIM_CAPTURE);

I called it $uglyscores for a reason. This returns an array with the bits of the scores nicely parsed out, but because of the regular expression I used, there?s a blank string between each pair of data, so let?s reformat this mess into something nicer:

$i=1; // skip the first element
$scores = array();
while ($i<count ) {
	$scores[$uglyscores[$i]]=$uglyscores[$i+1];
	$i+=3; // skip the blank separator
}

This gives us a nice array of elements that we can then reference by the key names. So we can use stuff like $scores[?Final?] and such.

So now that we don?t have to display everything, let?s put it all together. Here?s a combination of all of the above that outputs the two teams and the final score only:

< ?php
require_once(ABSPATH . WPINC . '/rss-functions.php');
$rss = fetch_rss('http://www.exactscores.com/HockeyLivescoreRss.xml');
echo '
    '; foreach ($rss->items as $item ) { if (preg_match('/^(No).*/i',$item['title'])) { echo '
  • '; $uglyscores = preg_split('/^(([^)]*))[^s]|s(([^)]*))[^s]/', $item['title'],-1,PREG_SPLIT_DELIM_CAPTURE); $i=1; // skip the first element $scores = array(); while ($i<count ) { $scores[$uglyscores[$i]]=$uglyscores[$i+1]; $i+=3; // skip the blank separator } echo "Home Team: ".$scores["Home Team"].""; echo "Away Team: ".$scores["Away Team"].""; echo "Final Score: ".$scores["Final"]; echo '
  • '; } } echo ''; ?>

And there you have it. If you want to display different information, just modify the stuff in those echo lines towards the end.

The key is finding the RSS feed with the data you?re interested in. Once you have that, it?s usually fairly straightforward to parse it and redisplay it nicely. )

30boxes Widget

Narendra Rocherolle asked me to convert the Google Calendar widget into a 30boxes capable widget. No problem, it only took like 10 minutes.

So if you use 30boxes and want a nice and simple WordPress Widget for displaying events on your calendar, well, here you go: 30boxes Widget

This is, of course, a first stab at it only. I can and probably will add more functionality to it (like start and end dates). But that can wait until later. Right now I need BBQ! D

Coastr Widget

Ran across Coastr yesterday while I was reading some blogs about beer. It’s kinda nifty. Very simple app. It lets you put what beers you like to drink and where you like to drink them and tells you other people who have similar tastes. The idea being that maybe you can find some new beers by looking at what other people who are similar to you like.

I made a post on the guys blog about adding RSS feeds for the individual users, and to my surprise, he had it up and going the next morning. Very cool.

So naturally, I made a widget for it. You can see it in my ever-growing sidebars somewhere (bottom right, at the moment).

And so here it is: The Coastr Widget.

Update: Version 1.1 adds some code to handle the beer names and such properly, so it won’t cause validation errors on your blog anymore.