Archive for 2006

Updated Collapsible Amazon

Just a quick heads up that I’ve uploaded a new version of Collapsible Amazon. It’s a Greasemonkey script that lets you collapse any section of the standard Amazon detail page. This update makes it work on a lot more sections – the only one it can’t collapse that I’ve found is the Customer Discussions section. Basically, wherever you see an orange header, you can click it and its content will disappear – and the script will remember that you want that type of section collapsed everywhere.

An Example Screenshot of Collapsible Amazon

Honestly, I’m no fan of Jane Austen – I was just looking for a screenshot! If you like this script, you should check out some of my other Greasemonkey scripts.

Creating nested custom configuration sections in ASP.NET 2.0

This weekend I decided to go through the hodgepodge of common code that's shared between a lot of my ASP.NET websites and refactor it a bit. I'd only just learned about the magic of HttpModules and HttpHandlers, and I immediately saw a lot of canidates in my copy-paste code and global.asax handlers where a HttpModule would be a better solution. One of these was the code I was using to redirect old pages to new pages whenever I moved them. For example, at some point I had moved http://www.numbera.com/rome/tools.aspx to http://www.numbera.com/rome/tools/, and I wanted anyone who visited the old URL to get redirected to the new one. Previously, I just had some code in global.asax that hooked Application_OnError, checked to see if it was an HttpException (a 404 file not found, specifically), and then redirected if it knew where the file really was. Pretty simple, but not very general. So I broke it out into an HttpModule that basically did the same thing, but no longer required me to cut and paste code into my global.asax. However, one improvement I wanted to make was to allow for configuration through my web.config file, instead of having to hardcode an if/else tree for each redirect. I basically wanted to have a section in my web.config like this:

XML:
  1. <configsections>
  2.     <sectiongroup name="brh.web">
  3.        <section name="redirectOldUrls"
  4.          type="Brh.Web.RedirectConfigurationHandler, Brh.Web.Utility"
  5.        />
  6.    </sectiongroup>
  7.   </configsections>
  8.  
  9.   <brh .web>
  10.     <redirectoldurls>
  11.       <redirect filePattern="tools.aspx" url="~/tools/" />
  12.       <redirect filePattern="strategy.aspx" url="~/strategy/" />
  13.         <redirect filePattern="military_people.aspx" url="~/people/" />
  14.         <redirect filePattern="history.aspx" url="~/history/" />
  15.         <redirect filePattern="teacher.aspx" url="~/teacher/" />
  16.     </redirectoldurls>
  17.   </brh>

(more...)

Hogblog

It seems these days that everyone has a blog (or two). There are big news blogs, little blogs with useful articles (such as the many C# blogs I read), the countless teenagers with MySpace or livejournal blogs. There are blogs about tech, politics, clothing... there are even blogs about blogging! Even I have been sucked into the blogging scene. Even my Xbox 360 has a blog. So why shouldn't my hedgehog have a blog?

On the Wheel


So that's what I did. Right after we got Pliny and got him set up with a nice cage and a big wheel, I started thinking about how I could get him to blog. I thought about teaching him how to type and operate WordPress, but as cute as he is, he's not very smart. So I took the technological route. I built a little sensor out of a magnet and a reed switch and attached it to his wheel. After about 4 months of on-off (mostly off) C# coding, I had a client built up that would poll the sensor, log Pliny's wheel activity, and post to his blog. The Hogblog was born! It posts his activity, along with charts and occasionally a pic from Flickr. It's all automatic, and I'm subscribed to his RSS feed to find out just how much running he's been doing while I was asleep. It's already brought up some interesting information. For two days his wheel was stuck - the little log he sleeps in was jammed up against it. In the two days since he's run almost half a mile!

This has been a really fun project that has tied together a lot of fun aspects - playing with physical elements like the sensor, coding in C# (and interacting with the parallel port to get the stats!), and making web services calls to WordPress and Flickr. I'm already thinking up more ways to improve his blog, but for now I'm going to sit back and watch for a bit!

How to save power from your gaming devices

A few weeks ago I watched the Al Gore slideshow-in-a-theater "An Inconvenient Truth". Al Gore parts aside, I thought it was very good, and while it didn't tell me much I didn't already know, it did make me think about my power usage. In general, I hate waste - wasted money, wasted time, wasted material, wasted code. Wasting energy is just as bad. This is sort of at odds with my tech-heavy lifestyle, though. I realized that my entertainment center probably wastes a lot of energy while I'm sleeping, what with the TV, the stereo, the powered subwoofer, the Xbox 360, the PS2, the Xbox, and who knows what else casually sipping electricity just to stay in "standby" mode. I don't know what standby mode does, but I don't think it's worth having power flowing into those devices for the 18-odd hours I'm not using them each day. So I went to Target and bought a remote switch - the one I got cost less than $25 and included two remote switches that are controllable by one remote. All I needed to do was put this between the wall outlet and my power strip, and now I can just push a button on a remote when I go to bed to save energy. The other switch now controls the lamp over in the corner. It's perfect. And I bet within a year I'll have saved enough on my electricity bill to pay off the switch. In that time I'll be using just that much less electricity, saving that much carbon dioxide, and sparing my equipment that much wear and tear. Seems like a win overall.

Passport changes screw up XBList 2.2

I'm still working on XBList 3.0 (though not as much as I'd like, between work and a social life). However, I noticed today that XBList won't auto-signin to Passport anymore. Bummer. It has to do with the new live.com ID stuff. I promise this will be fixed in XBList 3.0, but in the meantime, you can just fire up Internet Explorer, log in to Xbox.com, and XBList will start working again.