Wednesday, January 27, 2010

Blocking Status Updates from Facebook Apps

Facebook is useful for staying in touch with friends and getting an idea what people are up to. Unfortunately, many Facebook applications post status updates on behalf of their users. To avoid wading through piles of status updates from Pillow Fight or FarmVille or ... I enlisted the help of the Google Chrome extension AdThwart. That extension does a good job of blocking ads. You can also use it to block arbitrary HTML elements in a page by using CSS selectors. Here's how I block those verbose Facebook apps:
  • in AdThwart's configuration options, choose "Add your own filters"
  • Add: facebook.com##div[data-ft*="app_id"]
P.S. Blocking the offending application doesn't alone solve the problem. Blocking prevents invites but doesn't hide the auto-posted status updates.

Friday, January 1, 2010

Snowbirding with Prolog

This time of year, when it's so cold in Wyoming I'm tempted to snowbird and wait out the chilly months somewhere toasty. Of course, many places have warm weather, so how do I choose one and how do I get there? I could drive to Tucson but that means spending two days on the road (losing billable hours), buying meals, getting a hotel, etc. I could fly to Tucson, but then I have to rent a car. Vegas has cheap flights and rental cars, maybe that's more economical. There are so many variations and each possible choice can affect other choices.

I've been learning Prolog and this seemed like a great chance to use it. I've coded up a simple snowbirding model and am pretty pleased with the results. It's really easy to add new cities and new possibilities. For instance I initially had rental cars as the only local transportation option after flying to a city. With a few lines I added options for Zip Car and public transit. Running the program instantly accounted for those two new possibilities in cities where they applied.

Here's a sample of the first 10 snowbirding options produced by the program:

1361.28 st_george [drive, drive]
1853.84 vegas [drive, drive]
2218.51 mesquite [drive, drive]
3441.47 vegas [taxi, fly, buses, fly]
3836.91 amarillo [drive, drive]
3861.47 vegas [park(long), fly, buses, fly]
4341.47 vegas [park(airport), fly, buses, fly]
5000.83 tucson [drive, drive]
5177.63 tucson [taxi, fly, buses, fly]
5597.63 tucson [park(long), fly, buses, fly]

The first line tells us that driving to St. George, UT is the least expensive option at $1,361.28 per year (housing and food costs are not included yet). The 10th most expensive option is using long-term parking at the Denver airport, flying to Tucson, using public transit while I'm there and flying home. That option runs about $5,600 per year. All these calculations are for a 3 month stay for a family of 6.

It seems like there are lots of economic decisions which could be modeled this way and for which Prolog is a natural fit. The full Prolog code is available and included below. I'm new to the language, so I gladly welcome any suggestions for improvement.