« June 2007 | Home | August 2007 »

Entries From July 2007


July 26, 2007

Almost There...

Filed under Events

image

It is almost time for me to board a plane and head back to Texas. I'm going be at Frankies in Uptown this Saturday night (July 28, '07) from 7pm till whenever. I'm really excited about coming home. I hope all my peeps can stop by! I've missed you guys!

I look forward to wearing shorts (its 59 degrees here now), Freebirds, Dallas Cowboy fans, less smug hybrid drivers, easy parking...and no organic food all weekend! (I'm still doing my yoga, though)

Here's a countdown timer to help you remember. It is pretty easy to figure out: when the timer reads all zeros...you should be at Frankies.

How To Destroy Your Music Collection

Filed under Reviews, Software, WTF

Brought to you by Windows Media Player 11 (WMP).

I started trying to rip some CD's I recently purchased. When I put the CD in, it was labeled as "Unknown Album". If I right-clicked on the blank CD album art, I had the option of "Find Album Info". I tried this option out and it worked as expected...it found the correct album. Clicking "Finish" adds all the album information to the CD....except my CD information stayed blank.

I tried doing this using my guest account and it worked right: I inserted the CD and it immediately had the right song names, album name, artist, album art, etc.

I couldn't find any help online. I did find a solution when I was trying to find where WMP was attempting to store the CD information. I found (on Vista) that WMP stores information in C:\Users\USERNAME\AppData\Local\Microsoft\Media Player. I moved this folder to "Media Player.old" and tried again and everything worked as expected.

WMP does a great job of getting CD information. It also has the same feature for files in your music library. In WMP, if you right-click on an album in your music library, you have the option to "Find Album Info." Even though the album had all the information correct that I care about, I thought it would be interesting to see if it filled in all the missing pieces.

image

It asked me how I wanted to search, so I gave it the artist name ".38 Special."

image

Next it gave me a list of albums by .38 Special and I picked the correct one. The final screen shows you all the details of the album it found. Just click "Finish" and your information will be up to date...right?

WRONG! DON'T PRESS "FINISH"!!!

If you do, WMP will start searching your music library for music files that are about the right size to match the music file sizes for the songs on the album (Special Forces). I actually only had one song from that album (which it found correctly), but after I was done I had 6 other songs. It took a few Bee Gees songs, a Banannarama song, a .38 Special song from another album, and a Father MC song and relabeled them as songs from "Special Forces." It changed...

  • File name was changed from the correct "artist-song" format to a combination of "38 Special" and an incorrect 38 Special song
  • File location...moved the files from their correct "artist/album" folder to the "38 Special/Special Forces" folder
  • File information...artist, album, song name, etc. were all overwritten with the wrong info

I can understand software getting this wrong, it is not a perfect science. But *if* there is a chance it is going to do the wrong thing, shouldn't it show me it's proposed changes and allow me to decide if I want my beloved music collection mutilated?!?!?!?!?!

Also, I figured it would limit its search to just the album folder that I did "Find Album Info" for, but it looks like my entire music collection was fair game. That is scary! Getting those songs labeled correctly took a lot of time...but just a fraction of a second for WMP to turn it to garbage.

Luckily, I have my system backed up and I just deleted the bad files and restored them from the backup. I use Vista's excellent "Backup and Restore Center" and an external hard drive to back up changes to my system daily.

So everything is back to normal...or so I thought.

I had my Bee Gees folder open to verify the files were replaced correctly by the restore. I went on to doing something else when I noticed one by one the Bee Gees songs disappeared! Where did they go?

They went right back in the "38 Special/Special Forces" folder...and all their information was again changed back to a 38 Special information.

WTF? How did that happen?

image

It turns out that WMP stores the album information it used to update files...in case a file needs to be "fixed" again. 

To get WMP to stop changing file names, locations, and song information, I had to disable a few options. These are the options to *avoid*:

    1. "Overwrite all media information"
    2. "Rename music files using rip music settings"
    3. "Rearrange music in rip music folder, using rip music settings"

I figured I was safe, since I used "Only add missing information" with #2 and #3 (I never had #1 on). But I definitely had my information overwritten even though #1 was off!

I'm not sure if it is necessary, but I'd recommend deleting the WMP data folder (C:\Users\USERNAME\AppData\Local\Microsoft\Media Player) if you ever use "Find Album Info" or "Update Album Info" so it won't even think about renaming your files ever again.

After disabling those options, erasing WMP's memory, and restoring my old music files again...all is well.

Lesson learned:

NEVER USE THE "FIND ALBUM INFO" OR "UPDATE ALBUM INFO" IN WINDOWS MEDIA PLAYER!

July 24, 2007

WinSxS

Filed under Programming

The Problem

At work, we recently upgraded to Visual C++ 2005 Service Pack 1 (SP1). At the same time, our application stopped working for some users.

Everybody that had SP1 was able to run the application. Some people *without* SP1 were also able to run the application.

My system (not SP1) could not run the application built by the newly upgraded SP1 build machines, so I tried to figure out why.  I used Dependency Walker to find out why my application would not load.

Dependency Walker showed that the C runtime library (msvcr80.dll) could not be found. I noticed the full path of where the application was trying to get msvcr80.dll was:

C:\Windows\winsxs\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_
  8.0.50727.
762_none_24c8a196583ff03b\msvcr80.dll

I searched my system and I *did* have msvcr80.dll in my \windows folder, but not in the path the application was using.

I had not seen a path like that before for a DLL. I had no idea why the application was looking there instead of in \Windows\system32 like it normally would.

I tried copying msvcr80.dll locally to the application folder and refreshed Dependency Walker. That had no effect...the application could not find msvcr80.dll.

That used be the failsafe way to make an application see a DLL...put it in the same directory as the application. Something was very different now.

 

The Cause

Something had changed. It was Microsoft's answer to DLL Hell that was introduced with Windows XP: side-by-side assemblies (winsxs).

Visual C++ 2005 is the first version of Visual C++ that uses side-by-side assemblies for the C/C++ runtime libraries.

The definition of an assembly is not straight forward. For the purposes of this discussion, I'm going to consider an assembly the collection of DLL's that make up the C runtime library.

Side-by-side assemblies changes where a DLL is stored for global access. Instead of using C:\Windows\System32, they are stored in the side-by-side directory, C:\Windows\winsxs.

The advantage of winsxs over system32 is that you can have more than one version of a particular DLL with the same name. With system32, you had to overwrite a DLL if you wanted to add a new version with the same name. Winsxs uses directories with version information to isolate DLL's from each other.

image

In the above picture I highlighted 4 directories. These 4 directories contain 4 versions of the C runtime DLL's. Each directory contains the same three C runtime DLL's:

  • msvcr80.dll: C runtime library
  • msvcm80.dll: C runtime library for managed code (i.e. .NET support)
  • msvcp80.dll: C++ runtime library

All of these DLL's end in 80 because they are from Visual C++ 8.0 (a.k.a. Visual C++ 2005). The prefix is from MicroSoft Visual C (msvc).

The directory name is used when an application wants to load a particular version of the C runtime library. The directory name contains various pieces of information about the DLL's inside. Each piece of information is separated by an underscore. For example, consider this directory:

x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_
  8.0.50727.762_none_10b2f55f9bffb8f8

  • x86 (processor architecture): Built for x86 (32-bit Intel Processor and compatibles)
  • microsoft.vc80.crt (name): Microsoft Visual C 8.0 C RunTime
  • 1fc8b3b9a1e18e3b (public key token): A unique ID for C Runtime
  • 8.0.50727.762 (version): Version of the DLL's (right click on the DLL, select "Properties", and then the "Details" tab, and you should see this number)
  • none (language): The language these DLL's are designed for
  • 10b2f55f9bffb8f8: Not sure, but I assume this is a unique ID for this particular version of the DLL's

So how does an application know what version of a DLL it needs to load? That is where a "manifest" comes into play. A manifest is an XML file that contains information used to create the directory in C:\Windows\winsxs so that a particular DLL can be loaded. If you write an application that uses the C runtime library (99% of the time you will), then you are going to need a manifest.

Here is the manifest for an application designed to work with the above C runtime (auto-generated by Visual C++):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <dependency>
    <dependentAssembly>
      <assemblyIdentity
        type="win32"
        name="Microsoft.VC80.CRT"
        version="8.0.50727.762"
        processorArchitecture="x86"
        publicKeyToken="1fc8b3b9a1e18e3b">
      </assemblyIdentity>
    </dependentAssembly>
  </dependency>
</assembly>

The main line that is of interest is the "assemblyIdentity", which contains a "name", "version", "processorArchitecture," and a "publicKeyToken" like the above example winsxs directory.

There are two ways to store a manifest:

  1. External .manifest file. The manifest file has the same name as the .DLL or .EXE, with ".manifest" added on to the end. For example, helloWorld.exe would have an external manifest called "helloWorld.exe.manifest." The manifest is located in the same directory as the .EXE or .DLL.
  2. Embedded manifest. This is the default option for Visual C++ 2005. The XML file is store as a text resource in the .EXE or .DLL.

To chose an embedded assembly or external file, go to Visual C++ 2005 -> Project -> App Properties -> Configuration Properties -> Manifest Tool -> Input and Output -> Embed Manifest -> Yes or No.

image

Once an application is built, you may want to change which DLL's it is using. How do you change a manifest without rebuilding the application/DLL? For an external .manifest file, just edit the .manifest file and you are done.

Changing an embedded manifest is a bit more tricky. Here's what you do:

  1. Create a text file that has the manifest in it that you want to use.
  2. Select all the text and copy it to the clipboard (we'll use it later)
  3. Visual C++ 2005 -> File -> Open -> File...
  4. Select the .EXE or .DLL you want to modify and click "Open"
  5. The manifest is stored in a resource called "RT_MANIFEST" with an ID of 1. Double-click the "1" to open it in an editor.
  6. Ctrl-A to select all the text in the editor
  7. Ctrl-V to overwrite the text with the text in the clipboard.
  8. Ctrl-S to save the updated text in the .EXE/.DLL

image

The search order for DLL's has changed with winsxs. Now side-by-side directories (\windows\winsxs) are searched even before the local application directory. Here is an article about search order.

Since the winsxs directory is searched before the local application directory, it is impossible to override a .DLL in a winsxs directory, right? WRONG! This article shows how to do it. Basically, you just remove "public key token" from the application manifest and then create a manifest file for the DLL's you want to use (an assembly), like Microsoft.VC80.CRT.Manifest.

You may know the name of the DLL's you are interested in, but what is the assembly name for these DLL's? This page has a nice list of assemblies and the DLL's they point to.

I showed you earlier how to change a manifest without rebuilding an application. The next time you build the application, your manifest changes will be overwritten by Visual C++. To make your manifest changes permanent, you need to update the project settings so they are output every time you build your application.

To add information about an assembly to the application manifest...

  1. Visual C++ 2005 -> Project -> App Properties -> Configuration Properties -> Linker -> Manifest File -> Additional Manifest Dependencies
  2. In this text box, put the contents the <assemblyIdentity>, but leave out the <assemblyIdentity> open and close tags.
  3. Replace all double quotes with single quotes
  4. Enclose the entire line in double quotes

If I wanted to put the following into the auto-generated manifest file for an application...

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <dependency>
    <dependentAssembly>
      <assemblyIdentity
       
type="win32"
        name="Microsoft.VC80.CRT"
        version="8.0.50727.762"
        processorArchitecture="x86" >
      </assemblyIdentity>
    </dependentAssembly>
  </dependency>
</assembly>

...then just put this line in "Additional Manifest Dependencies"...

"type='win32' name='Microsoft.VC80.CRT'
  version='8.0.50727.762' processorArchitecture='x86'"
 

 

The Solution

So why were some people able to run the application even though they did not install SP1?

It appears that people that installed iTunes were able to run our application without SP1 installed. My theory is that version of iTunes was built against the SP1 C runtime and it installed the proper DLL in winsxs.

How did you get the application to work for people without SP1?

We decided to check to see what versions of the C runtime were available on a users system. If the version was older than the version our application was built against, we installed the SP1 C runtime libraries via the Microsoft Visual C++ 2005 Redistributable Package (x86).

  • For Visual C++ 2005, use this
  • For Visual C++ 2005 SP1, use this

Do you have to install the SP1 runtime in order to get an app built with SP1 to run?

That is certainly the preferred method, but you can also put the DLL's in the same directory as the app and bypass winsxs. One reason to not bypass winsxs is that if Microsoft pushes a fix for libraries that may have a security issue, you won't ever get the updates an your application will be left with the security holes.

We found another way that lets you work in the safety of winsxs on systems that may not have the same runtime libraries. Instead of using an explicit version of the C runtime (which requires that exact version present on your computer or else the application will crash on startup), there is a version that means "use the most recent compatible version of the C runtime". If we would have used this version in our application, it is likely that users would be able to run the application even if they don't have the SP1 C runtime library present. To get this "special" version, find the appropriate .manifest file in the C:\Windows\Winsxs\Manifests directory. Open this file and you will see a line with the XML tags "<bindingRedirect>". Basically, if you use a version in the range of "oldVersion", then the actual version that is loaded is given by "newVersion". I learned about this technique from this forum post.

 

image

In my case, versions 8.0.41204.256 through 8.0.50608.0 and 8.0.50727.42 through 8.0.50727.762 mapped to 8.0.50727.762. If you can find a version that always maps to a valid version via <bindingRedirect>, then use this version in your application's manifest and your app should work regardless of which versions of the DLL's are installed. You will need to check your user's machines to make sure they all redirect correctly in order for this method to work.

 

Conclusion

I knew *nothing* about winsxs (windows side-by-side) on Friday. It is a mess of complex topics that most people don't understand. There is a lot of information on the internet about winsxs, but it is spread all over the place and varies in degree of helpfulness. I'm certainly no expert, but I've learned a lot in the last couple of days.

Now that I understand the problem that winsxs is fixing, I can appreciate it, even if it is very messy and hard to understand.

The net result is applications will be more stable and reliable as more and more applications switch to winsxs. This is a good thing.

I wrote all this down mainly because I knew I'd forget about by the time I needed to address winsxs issues again. Hopefully this is helpful to others as well.

July 18, 2007

Who wants shotgun?

Filed under WTF

This is just amazing...and appears to be real.

 

July 14, 2007

Buying Music

Filed under Computers, Gadgets, Web

image

I'm changing the way I buy music...I'm abandoning downloading music (which I've been doing for about 6 years) and going back to buying CD's. It seems a bit backwards, but it has a lot of advantages.

I have a requirement that my music is in MP3 format...I have several devices I use (computers, iPod, car system, Xbox 360, phone) and MP3 is the only format that works in all places.

Most importantly, look at the work involved in getting music into your library.

For downloaded music...

  1. Burn downloaded track onto a CD
  2. Rip track from CD back onto computer so it is in MP3 form
  3. Update artist, song, album, genre tag information
  4. Rename the MP3 using ARTIST-SONG.mp3 format
  5. Create artist and album folders and move MP3 into correct location
  6. Add album art

For CD's...

  1. Rip track from CD

The number of steps involved with downloaded music has kept me from buying music.

Today I wanted to buy a few songs and I tried to find a place that would download MP3's, with album art, correct file names, and tag information...but I couldn't find any.

So I decided to go to amazon.com and buy CD's.

There are other advantages to using CD's over buying downloadable music...

  1. CD is used as your backup in case you have data loss
  2. CD quality is better than what you get from downloaded music
  3. The selection of music on CD *far* exceeds what you can download

Now for the disadvantages...

  1. Cost...you can't easily buy a single song on CD...you usually must buy an album. The songs I want will probably cost more than a $1/song.
  2. Instant gratification...I can't have the music I want now, I will have to wait until next week when it is delivered

I think switching back to CD's is the right answer...I'd be interested in hearing of better ways of dealing with this. Post away in the comments section if you have any ideas.

July 12, 2007

Why We Do It

Filed under Funny, Not Safe for Work (NSFW), Video Games

Sometimes I get asked why I work so hard on video games. I think I speak for many in my field...we do it for the kids. There is nothing like seeing a child completely immersed in a world you helped create. When you see the joy on their faces...that makes it all worth it.

July 9, 2007

Texas Visit

Filed under Travel

image

After five months in California, I'm making a quick trip back to Texas.

I can't technically take vacation yet, so I'm only going to be able to visit for a weekend.

I'm *really* limited on time, and I want to see a bunch of people, and I like to hang out in bars, so here's the plan:

Frankie's

7pm-???

Saturday July 28th, 2007

 

Come out and join me for a drink and some (pretty) good bar food. You can park for free in the parking garage.

Hope to see ya there!

July 8, 2007

Alcatraz and Angel Island

Filed under Travel

image

Today I visited Alcatraz and Angel Island. Photos are here.

I got my ticket from this web site. I bought my ferry ticket 5 days in advance. The only option that wasn't sold out was the 9am tour of Alcatraz and Angel Island. The ferry returned at 2pm. Cost: $51.

We left pier 33 and went to Alcatraz first. The ride was about 15 minutes. The ferry to Angel Island left at 11am, so we had about an hour and a half to explore "The Rock." We did the free audio tour, which was about an hour. You could start or stop the audio as you pleased so you could spend more time in an area than the tour permitted.

Next, we went to Angel Island, which is about a 20 minute ride from Alcatraz. We rode a free 1 hour tram tour around the outskirts of the island. Afterwards we had lunch at a cafe near the ferry dock and then returned to pier 33.

The views from Alcatraz and Angel Island are spectacular. I doubt I'll want to do the tour again...but it is certainly worth doing once.

Ok...THIS is my next phone

Filed under Gadgets

My brother pointed out the last phone I had a crush on (Toshiba G900) is not fully supporting any US networks.

But along comes a new SUPER phone! The HTC Omni!

image

Here are the deets...

  • 4" 800x480 main screen
  • GPS/A-GPS (Automatically tracks you on Google Maps)
  • Full QWERTY Keyboard
  • TV and VGA out (you can connect this phone to a projector for PowerPoint presentations or connect it to a TV for watching movies!)
  • 130 x 81 x 16 mm (Motorola Q is 116 x 64 x 12 mm for comparison)
  • Available October 2007 (birthday gift?)

July 7, 2007

Sleep

Filed under Computers, Software

image

We can't have our computers wasting power 24/7...so we should let them sleep when not in use. But sometimes we'd like them to backup our data when we are not using them. What is a green-consumer to do?

Follow these instructions and your computer can sleep whenever you aren't using it *and* will wake-up to do a backup. This is for Windows Vista only.

 

July 4, 2007

Microsoft Research: Shift

Filed under Computers, Gadgets, Software

This is cool. Shift lets you use your finger on a touch screen with pinpoint accuracy. Using Shift, selecting an individual pixel is easy.

July 2, 2007

My Motivation

Filed under Funny

Sometimes...this video is the only thing that keeps me going.

July 1, 2007

Gay Pride Parade 2007

Filed under Events, Not Safe for Work (NSFW)

image

You might be surprised to know that the Gay Pride Parade is a big deal in San Francisco...but not likely. I heard that in addition to all the natives, there are over 500,000 visitors in town for this event. A cab driver told me I should check it out, even if I am straight (which I am). The parade started at 10:30 Sunday morning and finished around 3pm.

My buddy Chris Franka somehow managed to leave just before the start of the Parade, so I went by myself.

I learned about the parade from this web site. The parade causes a lot of traffic headaches...but somehow I was able to drop Chris off at the Oakland airport and drive past the Parade which had already started and make it home without much issue. On the way home, I noticed they put a HUGE pink triangle on Twin Peaks, a hill that overlooks the parade area.

I dropped off my car at home and grabbed a cab to take me as close as possible to the parade. I started at the end of the parade route, by the Civic Center. I then swam upstream along Market street so that I got a much quicker view of the parade.

There was one guy there with a megaphone yelling as loud as he could next to the parade that homosexuals are going to HELL! He had a couple of police to protect him. He definitely was getting more attention than the parade at that point.

Probably one of the more shocking sights was naked rollerblading guy with a top hat (NRGWATH). It was amazing how crowded the streets and sidewalks were...but somehow NRGWATH had no problem gliding through the crowd. You could see his top hat in the distance rise above the crowd and in constant motion...NRGWATH never had to stop. He was like a naked Moses with rollerblades parting a sea of people.

I came across a section of the sidewalk that required crawling over a barrier. I started to do it when guess who glided next to me...NRGWATH! Even though it was my turn to straddle the barrier, I decided that the most polite thing I could do was to give NRGWATH all the space he needed to get over the barrier.

I did see several cute topless girls, so it wasn't all NRGWATH. I also saw some not so cute topless girls.

Once I got to the end of the parade, I walked back to the Civic Center, which was having a large street party called "Celebration." I'd guess it was about a 7 block by 7 block area that was sectioned off to allow drinking in the streets. The end of each street had a stage...at least 8 that I saw with various kinds of music playing. It was very crowded in most areas.

It was like a traditional street fair...only gay-er. Instead of old ladies trying to sell their candles, there were men with handlebar mustaches trying to sell calendars featuring photos of men's chests.

There was an outdoor S&M demo area that was behind a blue curtain so you could not see what was happening without paying. I think it cost $3 to go and there was a long line to get in. I didn't go.

Getting a cab home was impossible, so I just walked home. It took me about 45 minutes.

All in all...it was a great place for people watching.

There are some topless girls in these photos, so be careful where you look at this. The photos are here.

Blogging Problem...Fixed!

Filed under Blogging

Windows Live Writer

I started getting this nice message from Windows Live Writer (WLW) after I published a post to my blog:

Network Connection Error

Error attempting to connect to weblog at:

http://www.davidlenihan.com/cgi-bin/mt-3.34-v2/mt-xmlrpc.cgi

The operation has timed out

The post would show up on my blog, but sometimes there would be duplicate posts.

I also lost the ability to preview my posts using the formatting my blog uses.

I searched around on the Internet and found no help.

I searched (actually I browsed...this forum has no search! Boo!) Microsoft's WLW forum and found lots of good info and a responsive staff at Microsoft...but nothing related to my issue. If I could not figure this out on my own, I'd post a question here.

I tried to narrow down the source of this message by doing various tests.

  • I found that I could build pages fine within the web-based Movable Type editor.
  • I created a new test blog and could post to it from WLW without issue.
  • I removed many of the customizations I'd added recently (recent comments & subscribing to a blog) but that did not help.
  • I removed all my posts from the past month (last time WLW was for sure working correctly), and that did not help.

Then I stumbled on to the issue...it was taking a *long* time to post even a simple post. WLW does not give you any feedback about what it is doing, but the web-based Movable Type editor does! I noticed that the post was generated quickly, but notifying the rest of the Internet that a new blog post was available (pinging servers) was taking 5+ minutes. After the post finished, there was a line that said to check the activity log for error messages.

I looked at the activity log and I had hundreds of error messages from trying to ping servers that did not exist or would not respond.

In the past couple of weeks, I modified Movable Type to contact a list of blog servers every time I post a blog. I got the list from Wikipedia.

When I removed this list...all my issues went to away. I can use WLW without error messages and I can preview my post using my web site's formatting! All is well!

Now I only ping 3 servers when I create a new post:

These servers are ping'ed by default with Movable Type.

Chris Franka Visit

Filed under High School, Travel

Apple

My old pal from high school came over to visit me last weekend. The photos are here.

I gave Chris the traditional tour of ILM and then we went bar-hopping off Chestnut.

Chris had been to San Francisco before...so I needed to come up with something to do that would be new for him and me. He hadn't been to Silicon Valley before, and we are both big nerds, so we went on a tour of corporate campuses. We saw...

Here is a map of where we went.

Next we toured the Winchester Mystery House in San Jose. It is a beautiful mansion that was under non-stop construction for 36 years, 24 hours a day, year round. It features bizarre designs like doors and stairs that go to nowhere. The mansion had 40 bedrooms, even though the owner, Sarah Winchester, never had any guests.

GamerCard


About July 2007

This page contains all entries posted to David's Blog in July 2007. They are listed from oldest to newest.

June 2007 is the previous archive.

August 2007 is the next archive.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.34