Welcome Back

If you had previously been following /blog.feed or /stream.feed or /comments.feed, you may or may not have noticed that you weren’t getting any new posts. You probably thought it was because I only post every six months, but in fact, this time, it was because I forgot to redirect them to WordPress’s feeds, which are /feed and /comments/feed. So, if you were subscribed to the old feeds, welcome back!

ReplayGain

I would just like to say that ReplayGain is the greatest invention EVER. I am completely ashamed and embarrassed that I haven’t used this technology before. Anyone who has an MP3 collection of songs spanning more than a single decade desperately needs to download MP3Gain or something like it and apply it to your entire library. Unfortunately, now I need to re-upload all my stuff to Google Music, a rather daunting prospect with my current connectivity.

Email Lemmings

Here’s a quick way to disable a large mail network: Wait for an email titled “World wide distribution list test,” hit Reply All, and write something like “I got it.” Watch the lemmings destroy email capability.

When 4G Beats WiFi

So here at the house we switched from FIOS Triple Play back to plain old Comcast Internet, not because there was anything wrong with FIOS – in fact, in my opinion, it’s a thousand times better than Comcast in every possible way – but because of an overall strategy to lower household expenses.

So now we only have two choices for TV: Over-the-air HD television using vintage rabbit ears, or Netflix on a PS3. (Guess which one I usually pick.) And we don’t have a land line anymore. None of that is the slightest bit of concern to me, in fact I’ve wanted to “cut the cord” for a long time.

Here’s the point of all this: I only have 1Mbit downstream Internet now. That is the cheapest “broadband” available from Comcast (and it still costs 3 times as much as dial-up, but that’s another rant). So I went to watch a YouTube video on my phone this morning over WiFi, and it was all stuttering and crap. So I turned off WiFi and switched to 4G, and it played smooth as butter. Heh. I don’t know, I just thought that was funny.

Why Must Data Binding Happen After Control Events?

Okay, I know why. But just pretend like it could be different for the sake of this rant. Let’s say you have a GridView using a SqlDataSource on an ASP.NET page. Each row displays some data from a table. No problem.

Now let’s say you want to put a RadioButtonList in the first column of the grid. You want to update the underlying row when the user clicks one or the other radio buttons. You do NOT want to use the standard ASP.NET patterns for updating data because they suck and this is a slightly special case. You want to put a “Y” in a column if they click one of the radio buttons, and an “N” in the column if they click the other radio button. And you probably want to put it inside an UpdatePanel so it looks all AJAX-y.

This particular situation – handling controls inside GridViews – has baffled me since my first days of ASP.NET.

So you make a TemplateField for the column and put a RadioButtonList in it. Maybe you can bind it to the data easily, or maybe you have to setup a DataRowBound event to populate the control. Then you wire up your little SelectedIndexChanged event for the RadioButtonList. In the event handler, you cast the sender to a RadioButtonList. You look at the NamingContainer to find the GridViewRow containing the RadioButtonList. Then you pop up Intellisense and see GridViewRow.DataItem will give you the DataRowView for the underlying data so you can get the row’s ID and update the database.

Wrong.

Because, at runtime, GridViewRow.DataItem is null. What-the-eff?

Well, it’s because control events are fired long before data binding occurs. So at the time the SelectedIndexChanged fires, you have no idea what the underlying data for that row is. The only thing you know is the DataItemIndex.

Okay, no problem, surely I can stuff an ID or GUID for the row somewhere in the RadioButtonList that can be passed down to the SelectedIndexChanged event handler. Nope. You can’t do that. All you’ve got is that damnable DataItemIndex.

I have struggled for years to find an elegant solution for this, but I always end up in the same place: After fruitlessly searching for the perfect solution that must be out there but I just haven’t found yet, I give up and cache an array of database IDs on the Session during data binding so I can use it in the subsequent postback’s control event. It works, but it annoys me greatly.

No-Go Importing Paged Atom Feeds

Today I was pondering importing all of my old posts into WordPress. This is not quite as simple as you might think when trying to import from a custom blog platform. WordPress has this handy RSS Import plugin, but it requires the XML to be a file on your hard drive.

No problem, right? You just open up the source of the feed on the old site (which, in my case, is actually an Atom feed) and save it to a file. Wait, not so fast. That old feed has like 5000 posts in it. And the feed only shows the last 15. There’s a whole chain of rel=next links to follow to get the entire feed, 15 at a time.

Okay, a small setback, but easy to solve. I’ll just Google and find a tool that will download a paged Atom feed to a big file on my hard drive. Well, hours later, apparently nobody has ever written such a tool. What-The-Eff.

Comment Rules

Here are my rules for comments: If your anomymous comment contains a web site link but does not in any way mention something specifically from my post, it’s going to be considered spam. Just letting you know. I apologize in advance if I accidentally moderate something legitimate.

From Fiber to Cable

As part of an ongoing restructuring of our telecommunications connectivity here at the house, we’ve gone back to Comcast cable for Internet. We’ll be disconnecting the FIOS TV and land line soon. I’m not at all sad about losing TV or telephone, but going from a solid 25Mb (up and down) to a spotty 1Mb (down) is kind of a drag. So if I didn’t have enough incentive to move before, I definitely do now! (Just kidding. It’s still better than the connectivity at work.)

Heat Arrives

Once again, here in Richmond, winter has turned into summer with no intervening spring. Not that it was much of a winter. Now that I think about it,  winter was spring.