media, music comments edit

A few days ago I was listening to some music on my iPod and noticed that a couple of tracks had metadata filed as “Firstname Lastname,” which is not how I file my music. I think I picked them up off AmazonMP3, and it kind of irritated me that I had to fix it, so I tweeted:

Wondering why so many folks file their music “Firstname Lastname” instead of “Lastname, Firstname.”

That actually brought a lot of responses (more than some questions I have where I actually really need to know the answer). I got a couple of responses from folks who wondered the same thing, but the opposition to the idea cited basically two problems:

  1. Most metadata out there is stored this way so it’s easier to just use it as-is than it is to fix it for your own collection.
  2. There could be confusion if you have a solo artist who also has a band. For example, “Ben Folds” should show up by “Ben Folds Five” if you have music by both.

My logic in storing “Lastname, Firstname” is pretty simple.

  • When I go looking in the store (or at the library) for “Michael Jackson,” I don’t go looking under “M.” I don’t think that should be different on my iPod.
  • I have no desire to store separate “display data” and “sort data,” though that possibility exists. Doing it that way means double-metadata to manage and makes the list look messy.

I looked around at how libraries file things and, while I couldn’t get my hands on a copy of the Library of Congress filing rules I did gather that, generally speaking, the accepted convention for Folks Who File For a Living is:

  • If it’s an individual person: Lastname, Firstname (e.g., “Folds, Ben”)
  • If it’s a collective, corporation, or group: Firstname Lastname (e.g., “Ben Folds Five” or “Steve Miller Band”)

That’s actually how I have my music filed, and that makes sense to me. I contacted a good friend of mine who actually went to school for this stuff and he concurred. He also mentioned that there are interesting edge cases to consider - for example, “Alice Cooper” was not originally the name of the singer but the name of the band, so you could argue it either way.

That would, in fact, mean you would not normally see solo work by Ben Folds sitting alongside his group work in Ben Folds Five, and you’d see Dave Matthews Band under “D” not “M,” but if Dave Matthews had solo work, it’d be under “M.”

My friend pointed me to DMOZ, the Open Directory Project, which is a place some folks feel is a good starting place to look if you don’t know how something would be filed. This general premise - individuals as Lastname, Firstname and groups as Firstname Lastname - appears to hold there.

Of course, I see why online music stores chose to skip this - so there are no edge cases. Trade potentially “incorrect” metadata to avoid forum flame wars about why individual artists don’t appear right next to their bands and such. I guess I’ll just have to continue fixing it manually.

Now to figure out the best way to store artist collaborations - duets, for example. If only there were multiple artist fields in the ID3 spec. Oh, wait, ID3 does support that. Too bad iTunes doesn’t. (Yeah, I know, MP4 doesn’t directly support ID3 but atoms… I still think it’s possible to support multiple artists.)

General Ramblings comments edit

The holiday season has begun at home, preceded quite a bit by its start in the stores. (Stores very nearly skipped Halloween this year and went straight to Christmas, didn’t they?)

First, we got a wreath for our door from a local door-to-door salesgirl. This is important in two respects: First, I’ve never had a wreath before, and while it sounds sort of cliché, it’s nice and sort of makes me feel like “a real homeowner” (even though we’ve been at the same place for years now). Second, if your kid gets off their ass and actually does the door-to-door sales for their organization, I’ll most likely buy something; if you take the sign-up sheet to work and stick it on the break area table and expect me to register… well, good luck with that. Hard work gets rewarded.


2009 Trans-Siberian Orchestra

Second, we went to the Trans-Siberian Orchestra concert on Sunday. Not the first time we’ve seen them, but a brilliant show. Everything with TSO is always larger-than-life. Every number is huge and that just makes it full of awesome. We were in the tenth row, center section on the aisle

  • perfect seats. I snuck a few pictures toward the end with my crappy Blackberry camera. Epic stuff. I’d totally go again.

This week is Thanksgiving and I totally can’t stand turkey, nor am I really big on attempting to coordinate a bajillion disparate schedules to make sure everyone gets their “face time” in, which makes it my least favorite holiday all year. (I think it’d be more important to get together with people if we all didn’t live within 45 minutes of each other and see each other all the time.)

But I’m not going to let that drag me down. I’ve got this free-standing two-foot-tall green M&M in a Santa hat to stick by our front door and I’ve been waiting to put her out. Onward to the holidays!

net, gists, xml comments edit

I use log4net for logging in various applications, but every time I start a new app I forget this and it never quite comes up in Google for me, so here we go.

Most of the examples on the log4net site showing configuration shows it right in the App.config/Web.config file for the application. That’s a painful way to go if you have, say, a single log4net.config that you want used in several projects or if you otherwise want to stick log4net.config somewhere else.

The magic bit that at least I can’t easily find and always forget is:

If you add an appSettings key called “log4net.Config” you can put an app-relative path to an external log4net.config file in there and everything will automatically configure itself using that.

It looks like this:

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="log4net.Config" value="log4net.config" />
  </appSettings>
</configuration>

That example puts the log4net.config file right in the root of the application. You could specify “config/log4net.config” to put it in a “config” subfolder, too, for example. You don’t even have to call the XmlConfigurator.Configure method or mark your assembly with an XmlConfiguratorAttribute or anything. Magic happens. It just works.

This is specifically for the default “log4net-default-repository” repository. If you’re doing something fancy with different repositories, YMMV. I’ve not tried that.

For folks interested in spelunking, this is a hardcoded setting that takes effect in the private log4net.Core.DefaultRepositorySelector.ConfigureRepository(Assembly, ILoggerRepository) method which gets called from the public log4net.Core.DefaultRepositorySelector.CreateRepository(Assembly, Type, String, Boolean) method.

media, windows comments edit

In both Vista and Windows 7, when running at full 1920 x 1080 resolution, I found that I would occasionally see a one or two pixel “line” along the right side of my TV when playing video. It looked like some sort of artifact left from the menu I was just using to select the video, but I couldn’t tell. I started down the road of trying to figure out if I needed to tweak some overscan setting or something when I posted to The Green Button forums to see if anyone else saw this.

Turns out there’s a hotfix for this specific issue.

KB 974324: “Black and white pixels unexpectedly appear on the right side of the screen when you run Windows Media Center in full-screen mode in Windows 7 or in Windows Vista.”

Downloaded and installed the hotfix, problem solved. If you’re seeing this problem, grab the hotfix.

gists, net, vs, csharp comments edit

A long time ago I posted a little sample showing how to get context menus working with your DXCore plugin. As part of a new plugin I’m working on, I wanted to get an icon to show up in the context menu next to my entry in the menu, something like the icon you see for the Refactor! menu.

It’s possible, but it’s not really documented, so here’s what you do.

First, make sure you’re working with a DevExpress.CodeRush.Menus.IMenuButton. This is the type of thing you can click on and have something happen, as opposed to a DevExpress.CodeRush.Menus.IMenuPopup which is what allows you to have nested menus (like if you hover over it another context menu will fly out). The IMenuButton can have an icon, the IMenuPopup can’t.

Now make two 32 x 32 bitmap images. The first is going to be the icon you want to display. The second is the transparency mask so the menu knows what to show and what to hide. The color image will look like this:

Color version of the button.

Note that in your transparency mask, black pixels are the parts of the image I want shown and the white pixels are parts you want to be transparent.

To make it easy, I used the Visual Studio icon editor. You could do this in your favorite paint program or whatever, but I’m lazy. This has the added benefit of embedding the icons as resources (which, again, you could do after creating these in a paint program).

Once you have your icon and your transparency mask, you can create your button, set the style to show both the icon and the caption (text), then call SetFace()` to set the “Face” property to be the color icon and the “Mask” to be the transparency mask. It’ll look something like this:

MenuBar editorContextMenu = DevExpress.CodeRush.VSCore.Manager.Menus.Bars[VsCommonBar.EditorContext];
var contextMenuButton = editorContextMenu.AddButton();
contextMenuButton.Style = ButtonStyle.IconAndCaption;
contextMenuButton.SetFace(
  Properties.Resources.ContextButtonIcon.ToBitmap(),     Properties.Resources.ContextButtonIconMask.ToBitmap());
  // ...and set other properties, too:
  // * Caption
  // * Enabled
  // * Click event handler
  // * etc.

Note the “ToBitmap()” call I have there - that’s because the “Face” and “Mask” properties take bitmaps but I used the icon editor so the format needs to be transformed into a bitmap from an icon. If you embed a bitmap directly, you won’t have to do anything additional.

Once you have that, your button should have the proper icon with transparency in the context menu. Done!

UPDATE 3/4/2010: Rather than setting “Face” and “Mask” separately, use the “SetFace” method. Setting the properties manually works in VS2008 but fails in VS2010; using “SetFace” works in both.