Friday, December 26, 2008

This American Bandwidth

I (and everyone who ever donated to Chicago Public Radio) just got an e-mail from Ira Glass of This American Life asking for more donations.  He suggests that free podcasts may be in danger due to the $150,000 annual costs in bandwidth.  Actually he says that more of his co-workers might be laid off due to the expense of the podcasts.  But in either case, if you were to donate to WBEZ, you would offset these costs and spare some jobs.

What I wonder is, are they really using the most cost-efficient methods for distributing the podcasts?  If money is the only object, why not ask users to spread the cost of bandwidth by donating some of their own?  This is exactly why bittorrent was invented, to spread the load of serving content from a single location to many locations.  If WBEZ just ran some trackers, I'm sure they could get enough fans to seed the episodes.  I have a feeling that they don't want to do this due to some idea of control over their content, but first, they have none, since I was able to download all 370-odd episodes one day (I did donate $20 after it was done).  And second, it's apparently an expensive level of control that they've purchased, and maybe they should be considering whether it's worth the cost.  It sounds like they could recoup most of the $150K and save a few of Ira's coworkers.

Tuesday, December 23, 2008

Rebate Failure

I got this awesome e-mail today from Microcenter.  Apparently the economic downturn will make rebates even more vile than normal.  The most insidious part is that I sent my original UPC before the 12/22 deadline, which makes it impossible to return the item.  On 12/23, they sent me this:
Dear Valued Customer,

Thank you for your recent purchase of TRENDnet products from Micro Center.  We value your business and your confidence in the TRENDnet brand.

Please note that the fulfillment company that handles your TRENDnet
mail-in-rebate check has recently declared bankruptcy. This bankruptcy
may affect the mail-in-rebate check request that you have submitted.


If you have sent in a TRENDnet mail-in rebate request, and have not yet
received your check, please use the link below to determine the status
of your rebate.

After After Credentials

Paul Graham just posted his latest essay, After Credentials.

His essays are enough to get anyone psyched about mortgaging their house and putting the proceeds into a startup. I'm with him on this one, all the way up until the penultimate paragraph:
"No one likes the transmission of power between generations—not the left or the right. But the market forces favored by the right turn out to be a better way of preventing it than the credentials the left are forced to fall back on."
I'm sorry, what? I think his editor needs to work a bit harder. The essay was fine without this baseless dig at the left. We all know that the right would never use credentials to get what they wanted. Please. Both sides use credentials, both sides make startups. Unnecessary commentary in an otherwise interesting piece.

Sunday, December 14, 2008

Quick primer on sqlite

The sqlite database I created of the US Mayors projects might be a little opaque to anyone who is not familiar with databases, but it's actually quite simple to access. I work almost exclusively in python these days so I'll give you a little example for loading the file and getting on with the querying.

Example python session:

$ python
>>> import sqlite # Get access to the sqlite library
>>> conn = sqlite.connect('mayors-data') # Connect to the database file
>>> curs = conn.cursor() # Get a database cursor

>>> # Execute a query against the database
>>> curs.execute("select pr.name, count(*) from programs pr join projects
pj on pr.program_id = pj.program_id group by pr.name")

>>> rows = curs.fetchall() # Retrieve all values from the query
>>> histogram = dict(rows) # Turn the tupled values into a dictionary
>>> print histogram # Show the result
{'Airport': 366.0,
'Amtrak': 41.0,
'CDBG': 2412.0,
'Energy': 942.0,
'Housing': 431.0,
'Public Safety': 979.0,
'Schools': 652.0,
'Streets/Roads': 2404.0,
'Transit': 628.0,
'Water': 2536.0}

That works, but let's go one step better and turn those decimal values into integers, since there is really no reason to consider a fraction of a project.

>>> histogram = dict((name,int(count)) for name, count in rows)
{'Airport': 366,
'Amtrak': 41,
'CDBG': 2412,
'Energy': 942,
'Housing': 431,
'Public Safety': 979,
'Schools': 652,
'Streets/Roads': 2404,
'Transit': 628,
'Water': 2536}

You now have a dictionary of the 10 program types. The name of each type maps to the number of projects of that type.

You could print one of them out like this:

>>> print histogram['Schools']
652

Happy hacking!

Saturday, December 13, 2008

wifi nearby

Nearest wifi access points visible from my upstairs bathroom (KED is taking a bath while I nerd it up):
  • 06B408524730
  • L7IF1
  • pheared
  • sKary
  • V3XP0
My access point should be obvious (this is not in order of strength). When I started running wireless here I was the only one, so I definitely give props to sKary for acknowledging my cred on this block. Minus points from the people who couldn't be bothered to set an interesting name, but at least they didn't have common defaults, leaving them open to rainbow table attacks.

Needy Mayors

I made some data more useful today. The US Conference of Mayors published a big wishlist of projects that they would like to spend money on in the near future. They'd like to get a "Main Street Stimulus" from the new administration. Some bloggers have pointed out that certain items sound more like pork than stimulus. I volunteered to make the data a little more accessible, so that maybe we can throw together a web site that could crowdsource the vetting process, and hand off a good list of projects to Obama.

Friday, December 12, 2008

Dual boot your XPS M1330

There are a lot of people with warnings and instructions on how to install Ubuntu alongside Vista on their Dell XPS M1330. Many of them talk about serious problems and total failure, and they are mostly talking about older versions of Ubuntu (8.04 and back). Last night I finally had some time to give it a shot and was left wondering: Why was it so hard for everyone else?

I am a Linux user. It was the Fall of 1999 and I was sitting at the desk below my bunked bed in our off-campus rental house, and Windows 98 had blue-screened for the umpteenth time while trying to burn a CD on my Panasonic 8x CD-R. I didn't go to bed until RedHat 6 was booting and burning CDs successfully while I *gasp* used the computer to do other things. So it may seem strange for me to care about dual-booting my new laptop, nearly a decade later. My only excuse is that sometimes you really just need to use a Windows application to get work done and you don't have time to wait for the community to write it. You also run into issues when the support people ask you to perform tasks in the Operating System that was shipped with the device when you have removed said Operating System. I figured it would be best to try not to invalidate the warranty on this thing before I got a chance to make sure everything works.

I'll detail the steps I took that lead to the most success. My laptop now boots Vista 64-bit, Ubuntu 8.10 64-bit, and Dell MediaDirect, and I didn't have to reinstall anything.

First, boot the Ubuntu 8.10 liveCD. To accomplish this, insert the disc and reboot/power-on the computer. You have a fleetingly short amount of time to hit the F12 button to get to the alternative boot menu, so start pressing it repeatedly now. Once in the boot menu, choose the CD/DVD drive. Ubuntu's boot menu will appear and you should select your language and then tell it to boot the live CD.

By default, the Dell 1505 Draft-n wireless is broken. It's a distraction at this point to get it working, but if you're just curious about playing with Ubuntu, you need to do the following: sudo rmmod sbb; sudo rmmod wl; sudo modprobe wl. The ssb module doesn't play well with the wl module. After updating my system, this problem went away, but if you need to update over the wireless post-install, use this trick to get things running.

The next step is to make some room for Ubuntu. Dell has taken up all of the primary partitions so you only have logical partitions left. Contrary to a lot of misinformation out there, these will work just fine. You need to create at least two new partitions, one for Ubuntu's root and one for swap. The tool we use is called GParted, and it is available from the menu under System/Administration/Partition Editor. Once you've started GParted, identify and resize the Vista partition. This will be the largest partition on the disk and is labeled "OS" on my computer. Shrink it from the right by the amount of disk space you wish to give to Ubuntu. Next, you need to increase the size of the extended partition. Grow it from the left until it touches the Vista partition. Finally, create the two new partitions in the space before the Dell MediaDirect partition, inside of the extended partition. Create the swap partition (the size here is somewhat subjective -- I created a swap partition that was as big as my RAM (4GB)) and set the type to Linux swap. Create your root partition with whatever space is left.

Now think carefully about what you're about to do before you do it. The final step of the partition resizing is to tell GParted to actually make the changes. These changes may cause you to lose all of your data. Have you backed up your Vista data? Oh good you have. In that case, click Apply and pour yourself a beer. This stage of the installation took 5 hours for me, so make it a good beer because you've got time to relax.

When GParted finishes, reboot into Vista. Vista will probably complain about its new cramped quarters, saying something about repairing the disk. Just say yes to whatever it wants and it will repair its partition. It will reboot and ask to check the disk; let it. Eventually you'll be back in Vista but with less disk space then before. Reboot, and boot the Ubuntu CD once again.

This time, you're ready to install Ubuntu. Boot the live CD and then double-click the Install icon on the Desktop. When you get to the partitioning, choose the guided install and it should find space to work with on your drive. Finish the install as normal and reboot. You now have the choice of Ubuntu, Vista, and MediaDirect. You can even launch MediaDirect with the special button. No doom, no fail required.

Thursday, December 11, 2008

Mountain traffic

What happens when you drive your rear-wheel drive BMW up Snowshoe mountain's only road from the bottom?Why, you cause a traffic jam for everyone else who showed up with all-wheel drive and four-wheel drive. Glad I wasn't that guy.

Wednesday, December 3, 2008

ZPUGDC Meets Me

I attended a ZPUGDC meeting for the first time last night. It was on my todo list for some time and the planets had aligned such that I would be free to attend without being a delinquent family member. These are some interesting people who have been playing with a lot of interesting python features. For instance, I've read a lot about easy_install/setuptools but I never saw it in action, but Matt and Alex were able to take a virgin python installation and turn it into a working social networking site in about as long as it took to download the packages and with minimal work. Unfortunately, I don't have the luxury of easy_install at work. But as someone with this particular experience pointed out, easy_install will burn you some day when you're deploying and PyPi goes down. Ouch!

Another really neat tool was virtualenv. If you ever run two applications that expect different versions of the same python module, virtualenv will save your sanity.

Also I learned that Zope and Plone are both frightening.