Carl’s Geek Notes

April 30, 2007

Clearing Most Recently Used list from Remote Desktop Client

Filed under: Windows Administration — Carl @ 9:35 am

If you’d like to clear the Most Recently Used (MRU) list from your remote desktop client, you probably Googled and found KB312169, How to Remove Entries from the Remote Desktop Connection Computer Box which describes how to edit your registry to clear this list.  You went in and blanked these all out.  You started the Remote Desktop Client, and they are all gone except the last one.  There is a file saved in your [My] Documents directory, Default.rdp, that contains this information.  If you need to clear the list completely, you’ll want to delete this file as well.

Note that you will lose your default Remote Desktop Client settings (screen size, local resources, etc.) when you delete this.

April 13, 2007

DVD to iPod: Part 3

Filed under: iPod — Carl @ 11:53 am

As promised earlier, I tried Handbrake for DVD-to-iPod video conversion.  I found it to be a very good solution; not quite in the same league as Cucusoft but definitely easier than any other solution that I’ve tried.

As a side note, Mac users have had Handbrake for a while and it seems more robust than the Windows version.  The Windows version is just not quite finished as of this writing (0.8.0 beta 1), but it certainly does the job.  There is a guide to using Handbrake in Windows here so I won’t go into too many details.  (Make sure you select mp4 as the extension for the output file.)

Handbrake requires an understanding of the way titles and chapters are organized on a DVD (just remember, your longest title is probably the movie), and allows you to select a specific title and optionally specific chapters.  Handbrake doesn’t remember settings between sessions (it’s basically a shortcut to generate a command for the Handbrake command-line interface)–that would be a nice feature to have.  Also, integrating DVD reading and giving pulldowns for title, chapter, subtitle, audio track, etc. would be nice instead of making me have to view the DVD info multiple times and remembering the number of the stream.

Ripping video seems to look best to me in 640 x 480 at 768 kbps, and I encoded audio at 160 kbps (the maximum the iPod supports) for music and 128 for dialog.  Using H.264 resulted in much smaller files than MPEG-4, but longer encoding times.  I also preferred 2-pass video encoding when playing the movie back on computer, but I didn’t notice much difference on the iPod.

I did run into one “gotcha” with the cropping feature (the way to specify how much of the left/right/top/bottom of the image to discard).  I set the video to rip as 640 x 480 and it kept coming out as 640 x 496 (i.e., incompatible with the iPod).  I discovered that the left & right crops were set to 6 (i.e., there were six pixel wide black bars on each side), which apparently tells Handbrake to crop that information off the final picture and resize to that aspect ratio.  I corrected this by setting Handbrake to “no crop.”  This leaves the black bars on the sides of the video, but that’s probably OK (and I think it can be cropped out in QuickTime Pro if you want to save the space).

I also found some STATUS_ACCESS_VIOLATION errors in a text .stackdump file that were corrected by creating an ISO of the DVD with DVD Decrypter and then encoding the video from the ISO.

Hasta la Vista, baby!

Filed under: Windows Administration — Carl @ 9:50 am

After a hard drive failure the week after Thanksgiving, I installed Windows Vista Ultimate RTM on my computer.  Last Wednesday, I reformatted the drive and returned to Windows XP.  I feel like four months for Vista was a fair shake, but I found it interfering more and more with work that I need to do.  I’d like to share my thoughts about Vista, my reasons for returning to XP, and some things that I will miss from Vista.

First, problems with Vista:

  • Program incompatibilities.  When I installed Microsoft Visual Studio 2005 and SQL Server 2005, both warn me that there are known compatibility issues.  Developers are usually the first to evangelize new OSs–why provide them with an OS that doesn’t suit their development environment?  Instead, it raises questions like:
    • “Will applications that I compile under Vista be compatible with client systems?”
    • “Will my applications have problems because they were compiled under Vista?”
    • “Will my applications be compatible with Vista?”
  • Speed.  My computer is a hyperthreaded 3.0 GHz Pentium 4, 1 GB RAM, 128 MB nVidia graphics card running dual DVI displays, and 250 GB hard drive–not the absolute latest and greatest, but no slouch either.  The “Welcome” screen on login would display for nearly 2 minutes.  Logging out or shutting down took at least 30 seconds.  Hitting Win + L to lock the computer gives a message that Windows is locking my computer, waits, and then locks the computer.  What’s it doing behind the scenes that it takes 20 seconds to lock the computer?  I didn’t notice any speed difference on applications when they were doing their own thing, but interactions with the OS were painful.
  • Spurious, odd, untraceable errors.  I “randomly” but regularly got the error message “Windows could not connect to the System Event Notification Service service [sic].  This problem prevents limited users from logging on to the system.  As an administrative user, you can review the System Event Log for details about why this service didn’t respond.”  I tried several of the fixes in this MSDN thread, but just when I thought it was fixed it would reoccur.  I’m sure that errors like this will be found and fixed by MS, but with any new OS it takes time to build up the body of knowledge to successfully deal with odd problems.
  • User Account Control.  Could Apple have made a better commercial than the one with the sunglass-wearing, suited guy asking PC if he wanted to Accept or Reject everything that Mac said to him?  (Not that I care for the ad campaign; aside from the caricature portrayal, PC is cast as the underdog and gets the best lines while Mac is your neighbors’ annonying kid who graduated from college but came back to live with Mom & Dad and spends all night publishing his latest iMixes rather than getting a real job.  George Ou from ZDNet also has an interesting post about UAC vs. Mac OS X privilege escalation; I love his point that if you can’t figure out how to turn it off you don’t need to be doing so.)  I quickly turned UAC off–but that’s not the way to deal with security issues.  A simple checkbox for “Allow this in the future” would have made all the difference–I was developing a TCP/IP based listener service at the time I first installed Vista and got tired of authorizing it for each compile and run.
  • File dialog boxes and Explorer folder windows.  This, for me, was the “killer feature” (and I don’t mean that in any good sense) for Vista.  Opening a shortcut to Documents was guaranteed to take 45 seconds.  File dialog boxes and folder browser dialogs were similarly slow.  The last straw for me was when it took longer to open the File Save dialog box than to download a 6 MB file!
  • Flashing.  Sometimes you had to wait when the whole desktop repainted itself multiple times.  I especially noticed this opening email in Outlook Web Access.
  • Wordiness of dialogs.  After 4 months of Vista, I still had to read the “Copy and Replace/Copy and Don’t Replace/Cancel” dialog to make sure that I was picking the one that was “Yes” in XP.  The checkbox for “Do this for all conflicts” was easy to miss, and less clear than “Yes to All.”
  • Dumb changes that don’t solve problems.  Logging off in XP was simple: Click Start, then Log Off.  (Of course, it’s also dumb to click Start to turn your computer off, but that’s a problem with language rather than operability.)  In Vista, you have to find the dumb little arrow and click it.  They got rid of as many menus as possible (which is why I found Office 2007 intolerable).  They made the “This device may be safely removed” notification a dialog box that needs a click to dismiss instead of a balloon notification.  Dumb things like that…

Vista had several features that made me want to like it:

  • The clean, stylish look.  Apple has understood for years that a pleasant interface makes for user happiness.  MS is just now catching on to that.  Vista (and especially Aero) was a good first cut at that, and I expect this only to improve.
  • Stacking.  This is a neat feature and great way to deal with your documents.  I could stack all of my MP3s together by artist so I can copy all my Poison songs in one virtual icon.  (Um… I don’t have any Poison MP3s… really…)  I used this feature frequently.
  • Install process.  The install for Vista was clean and easy to use, and also fast.  It also prompts you for information up front, so you can start it and come back later to find that it’s finished rather than waiting for one more prompt from you.
  • Navigation in the address bar of file dialogs.  It was easy to move up the directory tree (but I still missed the Folder Up button).
  • All Programs under the Start menu.  This is handled so much more cleanly than the menu expansion in XP.
  • Sidebar gadgets.  I like the nice calendar and clock (but Rainlendar and Rainmeter do the same thing, and are more customizable–or you can use Samurize and go whole hog).
  • Security.  Windows Defender for realtime antispyware, isolated mode Internet Explorer, UAC (yes, after I rag on it above, privilege escalation still beats having to log out and log back in as Administrator), outbound firewall–several significant, positive changes there.
  • Previews and thumbnails.  The preview feature is nice–the icon, taskbar mouseover preview, and Alt + Tab task switching preview look like what the file contains or application is doing at the moment.
  • Removing “My” from everything.  Now it’s Computer, Documents, Music, Pictures, etc.  I don’t need the continual reaffirmation that I own the computer and its contents–I’d rather save keystrokes (not to mention not having to deal with the spaces in command line interfaces).
  • Multimedia friendliness.  Vista is far more aware of metadata (EXIF information in images, tags in MP3 files) than XP–even able to edit tags within the Explorer interface.

So, I’m happy to see XP again on my computer.  My feelings are that I would rather use XP but administer Vista (especially for non-computer-aware friends and relatives!).  I would purchase a new Vista computer, but I would not upgrade a perfectly good XP computer to Vista.

Don’t construe this as Microsoft-bashing; in general, they have a pretty raw deal these days (or as raw a deal as any multi-billion dollar company can have).  First, Microsoft is the victim of its own success; Vista solves no real problems for me.  XP lets me do what I need to do in my computing life, and is hard to fundamentally improve.  The same can be said of Office and several other applications.  It’s hard to get users to upgrade when what they have works perfectly well for them.

Second, it’s hard to be all things to all people.  I’d like to see a “slider” for what type of user I am that corresponded to the OS interface that I dealt with.  As a power user/developer, it should hide annoying prompts and confirmations from me, but if I classify myself as “uncomfortable with computers” it should not allow other software to make serious changes to my computer without giving me the information to make an educated decision.  (The Catch-22, of course, is that if I understood the ramifications of installing an unsigned ActiveX control from crashmysystem.com I’d probably be a power user already; I’m not professing to know the remedy but pointing out the difficulty of the problem.)

You can probably make as good a case that I am not ready for Vista as that Vista is not ready for me, but when a notorious early adopter and computer junkie like me has been driven by annoyance to reformat my drive to downgrade to XP, there’s a problem…

April 9, 2007

Converting DVD audio to MP3 revisited

Filed under: iPod — Carl @ 1:58 pm

In a previous post, I mentioned converting audio from a DVD to MP3 format for use on an iPod.  Then I made an interesting discovery–the iPod will play the audio portion of a video if the type of the video file is set to Music Video, and play it as a video if selected through the Videos->Music Videos menu.  Therefore, encoding it as a video lets you play the audio under normal and shuffle modes, and you can watch the actual footage if you like!

Pros of converting from DVD to video:

  • It’s a video that you can watch as well as a track that you can play (um, do I really have to point this out?).
  • There are more obvious conversion paths from DVD to iPod video, both commercial and non-commercial.
  • Plays as both a music track and a video.

Pros of converting from DVD to MP3:

  • Wider format support for MP3 music files than MP4/H.264 video.
  • Better quality audio; the maximum audio stream bitrate for iPod videos is 160 kbps.
  • Smaller file size.
  • Support gapless playback (see end of article).

No huge make or break issues there, for me anyway.  I prefer 192 kbps for music, but listening at 160 or 128 doesn’t destroy the experience–I largely notice that the 192k track has more “presence” (for lack of a better word) than lower bitrate rather than thinking the lower bitrate one is inferior.  While I’m down to only 15GB free on an 80GB iPod, I’ve ripped virtually everything that I plan to rip (and in case you hadn’t noticed, hot new classical music releases are a little few and far between, so it’s not like I’m putting 20 new CDs a month on it).

I determined my requirements for a video converter (single-product or solution) to be these:

  • Must support direct conversion from either DVD itself or the DVD file structure (VOB files)–no conversion to AVI (or whatever) and then conversion to iPod format (or at least do it in a manner where I never have to see the intermediary file).
  • Must support batching of videos for conversion (it seems to be a lengthy process); shutdown upon completion is a nice feature for leaving it running overnight.
  • Must be able to extract video as a single file or as chapters.
  • Must be able to make properly-formatted iPod video regardless of input aspect ratio (no squishing or cropping to fit it on the iPod screen).

I looked first for commercial products, and downloaded demo versions of several.  The clear winner was Cucusoft’s DVD to iPod converter ($29.95).  It was easy to install and use, and could easily split into chapters or rip the whole title as one track.  It required little understanding of DVD structure (you just have to pick which title you’d like to convert) but had the power to select a specific language/audio track or subtitles.  It supports high-complexity H.264 video (640 x 480 video for 30GB/80GB iPods).

If I were not a cheapskate or I had more than two DVDs that I cared about converting, I’d buy Cucusoft’s product in a heartbeat.  If discussion of VOBs, IFOs, and stream processing bother you, don’t read any farther, spend $30 and get to ripping!

Ah, you continued on–as did my conversion search.  Once again, I downloaded an array of products before settling on one: the Videora iPod Converter (free), in conjunction with DVD Decrypter to allow access to the DVD.  Videora gives an excellent guide to converting using this method, and it worked well for me.

Step 4 of their guide is important because Videora will not merge VOBs on the fly, and VOBs are typically split at 1GB.

To do the conversion by chapters, before Step 5 you should select the chapter(s) that you want on the lower left of the Input tab.  If you’re doing chapters separately, you should select one at a time, decrypt, and rename the resultant VOB file (it’ll probably be something like VTS_01_1.VOB) so that it’s not overwritten when you convert the next chapter.  (It’s OK to overwrite the IFO file produced by the decryption.)

You can queue up several VOB files for processing by repeating steps 7 and 8 while a file is processing.  Check Shutdown PC upon completion if you want the computer to shut off by itself when it finishes at 3 am.

A coworker introduced me to open-source, Mac/Linux/Windows-compatible, straight-from-DVD Handbrake this morning; I’ll try it out tonight and post a followup if it’s worthy.  It appears to not like Vista (which I can certainly relate to), so I’ll use my XP machine for it.

My file sizes seem to be about 6.5-7.0 MB/minute of video using this method.

Then I learned some important lessons on importing the videos into iTunes:

  • By default, iTunes takes the new videos and puts them under the Movies category.  Right-click on the file, choose Get Info, go to the Video tab and change the type to Music Video.  Then the video will disappear from the Movies screen and reappear under Music.
  • For some inexplicable reason, that option isn’t settable by selecting multiple files and choosing Get Info–so you have to do it one at a time (using Next and Previous in the single-file Get Info box makes it a little quicker, but it’s still a pain).
  • Once you’ve gotten them into the Music library, if you’d like them to act like your other music files, do Get Info (multiple tracks are OK here) again and set Remember Position to No.  Otherwise, if you skip a track, the next time the iPod plays it you’ll start at the point where you skipped, and it makes it more difficult to skip backwards.
  • Videos either don’t honor or don’t technically support gapless playback.  It’s grayed out on the single-file Get Info screen (but settable through the multiple-track one).  The iPod seems to pause a bit before it starts playing the track.

Once again, don’t steal music; the DVD you’re ripping is significantly cheaper than your computer or your iPod, and purchasing the DVD lets the makers know (in the most tangible way possible) that you’d like to see more from them.

April 7, 2007

MS Updates KB925902 (MS07-017) and KB928843 (MS07-008) break RealTek audio HD control panel

Filed under: Windows Administration — Carl @ 10:58 am

After the last round of MS security patches, my computer gave the following error message after boot:

RTHDCPL.EXE - Illegal System DLL Relocation

The system DLL user32.dll was relocated in memory.  The application will not run properly.  The relocation occurred because the DLL C:\WINDOWS\system32\HHCTRL.OCX occupied an address range reserved for Windows system DLLs.  The vendor supplying the DLL should be contacted for a new DLL.

Microsoft has released a hotfix for this issue (designated KB935448), apparently caused by an incompatibility between the above security hotfixes and RealTek’s audio HD control panel.

April 3, 2007

Translating System.Windows.Forms.Keys to char data in ProcessCmdKey

Filed under: C#/.NET, Computers, Programming, Winforms — Carl @ 9:47 am

ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData) provides more powerful features than KeyDown, KeyPress, and KeyUp.  ProcessCmdKey can look at certain keys that are not received by the KeyDown et al. events (in the application where I encountered this problem, a DataGridView hosts a derived ComboBox and the DataGridView prevents certain keys from reaching the KeyPress event of the derived ComboBox), and ProcessCmdKey occurs before any of the Key events.

This means that you don’t have access to e.KeyChar from the KeyEventArgs parameter of the Key events.  To further complicate matters, the DataGridView does not pass on the WM_CHAR message to the derived ComboBox, so you never have the translated value of the message (i.e., you get the message representing the key that has been pressed but never the key character).  The upshot is that you can never trust (char)keyData or (char)msg.WParam.ToInt32() to be accurate; you have to look at the value of the key and modifiers to understand the meaning.

Another complication is that keys that represent the same character have different literal values.  The numeral 4 is actually Keys.D4 if you type the one at the top of your keyboard and Keys.NumPad4 if you use the number pad, and the conversion of the integer values to characters is different between them.

I wrote a simple function to translate from the Keys enumeration to a char:

public static char GetCharFromKeys(Keys keyData)
{
  char KeyValue;
  switch (keyData)
  {
    case Keys.Add:
    case Keys.Oemplus:
      KeyValue = '+';
      break;
    case Keys.OemMinus:
    case Keys.Subtract:
      KeyValue = '-';
      break;
    case Keys.OemQuestion | Keys.Shift:
      KeyValue = '?';
      break;
    case Keys.OemQuestion:
    case Keys.Divide:
      KeyValue = '/';
      break;
    default:
      if ((0x60 <= (int)keyData) && (0x69 >= (int)keyData))
      {
        KeyValue = (char)((int)keyData - 0x30);
      }
      else
      {
        KeyValue = (char)keyData;
      }
      break;
  }
  return KeyValue;
}

There are several problems with this approach.  Obviously, this function is incomplete–I mapped the keys that I need for this particular implementation.  I’m assuming a US keyboard layout.  I’m probably relying on either ASCII values or that the character’s Unicode mapping is the same as the key value.  I’m not carefully checking Num Lock, Caps Lock, and Shift status.

Question being this: there obviously has to be a better way to do this.  Any suggestions?  My kludge works for the intended application, but it’s not the right way to do it.

For a full writeup of the intricacies of dealing with keyboards, check out Michael Kaplan’s 10-part series “Getting all you can out of a keyboard layout.”  One day I will study this, understand it, and be a better programmer for it…

Theme: Silver is the New Black. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.