Awhile back I wrote about removing the obnoxious left side sidebar on iGoogle with a magic URL parameter. It changed, the new secret to make the product work right is to go to
http://www.google.com/ig?hl=all
hl now, not gl.

My secret agenda is to get enough people doing this that the iGoogle team notices the traffic in their logs and makes no sidebar an official option.

techbad
  2009-06-10 14:33 Z
Yesterday I tried to load some music on my iPhone for the first time in a year. The result was a complete iPhone apocalypse. Long story short; at some point iTunes decided to do an incredibly long and slow sync of some music I didn't want to copy. With no progress bar, no indication of how long it'd take, and no cancel button. So I did the only sensible thing and unplugged the phone.

The result? Not only did I have no music on my phone, but now I had no third party applications, either. Well I had a couple, some random subset were left behind. The other apps were deleted. Along with their data. Including a month's pain-stakingly collected diet data, gone forever.

Two-way sync is hard. But it's not that hard. iTunes' model is apparently that it has the canonical copy of what's on your phone. Only it doesn't update that model correctly in all cases, and then deletes whatever is on your phone that doesn't match the incomplete copy on iTunes.

I can sort of understand that failure with the music library; your iTunes install is the only conduit for putting music on to the phone. But apps can be installed independently, and generate their own data on the phone. iTunes can't be sure it has seen all the app data; so why be so casual about deleting it? Even if you can count on the user not to unplug the phone mid-sync, what happens if iTunes crashes? Or the machine crashes? Or the cat knocks over the phone? Or the power goes out?

I've made a sport of iTunes-bashing on my blog and Twitter the past few years. It's a bit obnoxious, but every time I try to use iTunes I'm stunned at how bad it is, particularly on Windows. Apple's reputation of building humane, user-friendly software is completely misplaced in this case.

techbad
  2009-05-23 14:49 Z
About once every six months I do some hack which involves caching web pages on disk. While hacking I always just write stuff to a cache directory so I can load it / replay it quickly. And inevitably I forget about the crappy cache and when I run the job for real I only remember three days later when the directory has an unwieldy 200,000 files in it.

Operating systems fail in all sorts of charming ways when you have a directory with "a lot" of files, typically over 10,000. Both the Vista and Linux kernels no longer seem to have O(n) operations on directories, so deleting all the files is no longer O(n^2). But the tools still freak out. For example, rm * doesn't work if the expands to larger than the command line limit.

Vista has a host of joys associated with giant directories. Opening the directory in the file shell actually works. Selecting all files and deleting doesn't, though, and the entire UI becomes unresponsive on a directory with even 20,000 or so files. del * from a command line does seem to work, but is awfully slow. I finally wrote some custom Python to unlink the files quickly only to find they were in a search indexed directory; the entire deletion process would freeze for 20 seconds at a time while the indexer chewed over the removals. Ugh.

By the way, if you ever need to remove a bunch of files the lower level you do it, the better. Even rm does more examination of the file than you want. Here's a quick python hack that seems pretty efficient.

files = os.listdir('.')
for f in files:
  try: os.unlink(f)
  except Exception, e: print e
techbad
  2009-05-10 21:40 Z
Want to use Subversion on Windows Vista, with the svn+ssh protocol (you know, the only sane one?). It's remarkably tricky, but it's doable. There's a bunch of incomplete docs on the web, including Wingware and Piwigo. Here's the steps in schematic form.
  1. Install the command line Subversion client for Windows. Yes, you have to register for an account to download this free software, at least from collab.net.
  2. Install PuTTY, the free ssh client for Windows.
  3. Get PuTTY configured so it's using Pageant as an ssh key agent. When you can use Putty to log into your SVN server without typing a password, you're set.
  4. Go to a command line and verify you can run
    plink server hostname
    without typing a password. Plink is what PuTTY named the command 'ssh'.
  5. Go to
    C:\Users\username\AppData\Roaming\Subversion
    and edit the file config (in Notepad or whatever).
  6. Head down to the [tunnels] section of the config and enter this line (all one line, but with lots of \\ quoting nonsense)
    ssh = C:\\Program\ Files\\(x86\)\\PuTTY\\plink.exe
  7. Test everything from a command line.
    svn info svn+ssh://server/...
  8. Swear at Microsoft for moving the paths for everything in Vista. And swear at the Subversion community for not producing a humane Windows install.
techbad
  2009-05-05 21:51 Z
Every time you fetch a web page, your browser sends a special User-Agent string to the server telling it what software it's running. It's defined in RFC 2616:
This is for statistical purposes, the tracing of protocol violations, and automated recognition of user agents for the sake of tailoring responses to avoid particular user agent limitations.
Fast forward to 2009, and here's the User-Agent string you get from Google's fancy new Chrome browser:
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/1.0.154.48 Safari/525.19
It's like a browser salad! But the Google guys aren't doing anything wrong, this boneheadedness has to be there in order to satisfy the "automated recognition" part of the spec. Chrome's just a little ol' chameleon.
techbad
  2009-03-19 19:35 Z
Do you use iGoogle? Do you hate the sidebar on the left side that wastes 100 pixels with useless tabs and an advertisement for Google Talk? There's no official way to turn that sidebar off. But if you set your start page to http://www.google.com/ig?gl=all, why there's your iGoogle page without the sidebar. Lovely.

Don't get me wrong, I love iGoogle. I've been using personalized start pages for years and iGoogle is the best. It loads super fast, it's easy to configure, and it has enough useful modules to keep me occupied. Just don't appreciate some product manager deciding to keep features in front of me that I do not want.

techbad
  2009-03-19 16:40 Z
Windows networking confuses the hell out of me. I can tell you why every single bit is present in the average TCP packet header, I've surveyed hundreds of thousands of time servers on the Internet, I've actually modified the source code for BSD lpd. But I couldn't begin to explain to you how Windows filesharing is supposed to work.

I want to print to Ken's USB printer plugged into his WinXP system. Since removing our wireless ethernet bridge I can see his printer via Windows filesharing. But I doubleclick to install it and Vista demands a printer driver. It claims to have no drivers to choose from. Of course, HP doesn't have a manually installable Vista64 compatible driver for this old printer. I'm screwed.

Turns out there's a solution. Basically you manually set up a new local printer where Vista will let you manually choose from the hundreds of pre-installed printer drivers. Then you fake it out by giving a network name as the port. In detail (from the linked post)

  1. Add Printer from the Control panel
  2. Add a local printer with a new port of type "Local Port"
  3. For the port name, type the SMB share name. Ie: "\\KENSCOMPUTER\Printer".
  4. Browse the tree to choose which driver you need.
I think what you're using is Vista's support for legacy parallel port computers where the only way to identify a printer is manually. Why Vista doesn't let you manually pick drivers for other types of printers is beyond me.
techbad
  2008-09-20 19:46 Z
I try really hard to keep my privacy at home. In particular, I hate phone calls from strangers. I keep my number unlisted, I require caller ID to call me, I'm on the Do Not Call registry. And yet, even so I get junk phone calls about four times a week to my home line.

This time around on the new number it's a promotion for Dish Network TV. No doubt it's not Dish themselves but some marketing affiliate. I don't care; they call me with a fake Caller ID once a day and I can't make it stop.

Even worse are the junk calls to my cell phone, almost always one of the car warranty scams. And then there's political calls. As near as I can tell all of these marketing calls are entirely illegal. Also, as near as I can tell there's no way to stop them.

techbad
  2008-09-17 21:59 Z
Since December 2007 the Xbox 360 has been capable of playing Xvid files. But it's ridiculously complex to set up.

First of all: do not use Windows Media Center. Do not use the "Media Center" option in the Xbox. Do not set up anything called an "Extender". Windows Media Center is interesting and has a fancy UI, but for some baffling reason it does not support DivX/XviD.

Instead you need to do something simpler; just let the Xbox find the AVI file and play it. The easiest way to do this is via an external USB drive; just plug it into the Xbox 360 (it has USB ports!), go to Media/Video, press X to change source, and browse the files on the drive. It's really that easy. But copying files to a drive is a drag, what you want is to serve them over the network. And for that you need a UPnP server, a simple file sharing protocol.

There's a slew of UPnP servers out there for Linux and near as I can tell none of them work. Windows has a UPnP server built into recent versions of Windows Media Player. Launch WMP, click the obscure little arrow below the word "Library", and choose "Media Sharing". If your Xbox 360 is turned on you should see it as a device option. Allow sharing to it and you're done. You'll probably want to also do "Add to Library" to pick the folder where all your videos are. Then on the Xbox go to Media / Videos, press X to change source, and you should see your new UPnP server. Now you can browse and play.

This sharing process is all ridiculously complicated and obscure. Poor Microsoft; they really want to sell media devices, competing with iPod and iTunes and Apple TV. But it's clear their media stuff is designed by a giant committee: they lack the single person with good taste and the authority to say "make this work simply".

techbad
  2008-09-13 17:17 Z
So Comcast finally went public with a bandwidth cap: 250 gigabytes / month. That's about 50 DVDs or 100 hours of high def XviD per month. It's no accident that Comcast, a cable company with government-granted monopolies on video distribution, is taking actions that limit the use of the Internet for distributing video.
techbad
  2008-08-29 21:59 Z