Scott Hanselman

BeyondTV4 Upgrade Review - Media Center Alternative?

November 13, '05 Comments [4] Posted in Reviews | Coding4Fun | Web Services | Gaming
Sponsored By

I paid for Beyond TV 3.5 and a Hauppauge PVR-250 on my main desktop machine a year before I made a Media Center PC. Interestingly, the Media Center PC has turned into a heavy MAME arcade machine and is rarely used, if ever, for TV. Perhaps that will change with the XBox 360's new Media Center Extender (as the original XBox Media Extender sucked egregiously) but we will see. Until then, I keep ending up watching TV on my main PC, using Beyond TV. So, it made sense when Beyond TV 4.0 was release a few days ago that I give it a trial. Here's a few impressions

Upgrading

The upgrade from Beyond TV 3.5 was a complete fiasco. Not failure, fiasco, there's a difference. During the setup I was informed that a number of .ax files (.ax files are actually just COM DLLs that have a different extension. They are codecs for the decoding things like video and audio.) were in use can couldn't be overwritten. My options were "Retry" (Um, can't!), "Ignore" (Um, dangerous!), and "Cancel" (Um, and do what?), so I, like a putz, selected ignore. In retrospect I should have selected Cancel and figured out who was locking the files. But, I charged on.

Interestingly, to me at least, Beyond TV 4 decided that it was cool to put itself in the existing Beyond TV 3 folder called c:\program files\snapstream media\beyondtv3. Since it's not version 3, that seemed ingenuous, but perhaps I'm being too hard. Either way, it failed to start up and was unable to show video. The install was hosed at that point.

Turned out that since I'd just tried a Web Cam conversion using the new MSN Messenger 7.5 and a little QCAM USB Gooseneck camera I picked up, that MSN Messenger had loaded every registered codec on the system into msnmsgr.exe's memory space. So, I blew away Messenger and figured I'd just run the installer again and select "repair." Which would have totally worked had there been a "repair" option.

Long story short, totally uninstall and reinstall of 4.0. Afterwards though, it started fine.

Footprint

Windows Task ManagerColor me dorky but I always like to check out the system footprint of applications I run. Even more so since I started running without a paging (virtual memory) file.

Points to Snapstream for prefacing all the new processes with BTV*, but still, EIGHT processes? Um, ouch. Of course, who am I to complain considering that Microsoft released a whole new OS. (Yes, I know that's not totally true, but it's true from a marketecture point of view, so phooey on you.) There's also an extensive, but confusing series of COM interfaces that Clemens has seen fit to mess with, although there's also a Web Services API. We'll see what happens with that.

Chunks of BeyondTV are written in .NET 1.1 and there's no fewer than 28 .exe.config files that remind .NET that BeyondTV prefers .NET 1.1. There's over 130 DLLS and 30 EXEs that make the whole thing happen. It's a pretty complex goings on, but fortunately it's all in one folder and its footprint hasn't affect anything other than my curiosity. I've found it to be fantastically stable if a bit of a memory hog, but certainly less in total than any single Microsoft Office program.

Weird Things

  • Beyond TV 4 has a new "Lock Aspect Ratio" option, which is nice, but the only options are 4:3 or 16:9. That's not particularly useful when my monitor (and most desktop Widescreen LCDs) are 16:10. Valve Software's Steam is the BEST when it comes to awareness of the various aspect ratios available. GuildWars also handles odd ratios with grace.
  • Documentation is still a little sloppy. There's references to Beyond TV's 3.5 directory, old EXEs and what-not mixed in amongst the new stuff within the CHM (Help) files. Just shows a lack of attention to detail.
  • The "Web Admin" option seems to have disappeared from the right-click menu of the Beyond TV Tray Icon. The Web Server (Cassini-like) still runs on http://localhost:8129 so you can still get to it, but it seems odd to have been removed not only from the Tray but the Start Menu also. Also, it appears to be handled by BTVNetworkService.exe now, not BTVWebServer, but they both ship with 4.0.
    • UPDATE: The "Open Web Admin" feature exists but it's off by default now. Oddly enough I had to enable it FROM the Web Interface, so not exactly sure how Mort is expected to turn that chicken-and-egg feature on.
  • Beyond TV 4.0 has a great 3D accelerated video mode that does transparent overlays for all the interface elements. However, on my dual monitor machine it only works well on my primary monitor. When I try to view the TV on the secondary monitor the framerate drops precipitously. However, when I switch it to software-only rendering everything's great on the second monitor. It's more valuable for me to be able to use the second monitor as a TV, so I turned software rendering on against their recommendation and it works fine. I don't notice much of a different but the CPU does jump from 10% to 30%.
    • Literally as I was writing this sentence, while running Beyond TV 4 in Hardware Accelerated DX9 mode, I moved it from the secondary to the primary monitor and POOF. BIOS. Like, POOF. No warning, just BOOM. So, I'm running Software Accelerated now. Also interestingly that never happened while running Beyond TV 3.5, but in their defense I just upgraded my ATI's video drivers and we all know how ATI's known for stable video drivers.

Great Things

  • Beyond TV - Video Qualities - Mozilla FirefoxBeyond TV 4 has an SDK available (expect a Coding4Fun article on this from me) that includes COM, .NET and more importantly Web Service support. Any ideas on what I could do with a PVR that's totally controllable via Web Service? OK, how about something Clemens HASN'T already done? :)
  • Beyond TV 4 includes (yet another) UPnP server that makes the recorded video available to other devices on your network. Personally, I've started using TwonkyVision's server and have found it excellent and more compatible than Windows Media Connect, Nero, or any others, but Beyond TVs is meant to work primarily with their Beyond TV Link product. Beyond TV Link lets you install a small client on machines in your house that don't have a TV. It's a "Media Center Extender" that is specific to Beyond TV.
  • Beyond TV has a crapload of advanced features, most made available in the Web Admin. I like the "ShowSqueeze" option that takes my 1 hour=3 gig MPEG2 files and makes them WMV file overnight. I squish those onto the PSP.
  • It also added support for DivX as a target format along with a million other formats (see screenshot at right)
  • You can use the Web Admin as a zero-install web-only client to watch recorded shows and Beyond TV will automatically transcode (squish) them on the fly as it streams them to you. This makes it possible for me to watch my recorded TV from a hotel after VPN'ing in to the house.

All in all, it's a great product for the money despite my complaints. I used Beyond TV 3.5 daily for over a year without trouble, and I'm confident Beyond TV 4 is an improvement on 3.5. The MAJOR feature that was added in Beyond TV 4 that I wasn't able to test is its support for HDTV. I had an ATI HDTV All-In-Wonder but it was such a complete piece of crap that I took it back. Perhaps I'll try to get my hands on some of the newer generation HDTV cards and add to this post.

If you've got an existing machine and you're even slightly thinking about a Media Center PC, just spend the ~$150 and get a Tuner/BeyondTV bundle. Seriously, I know lots of folks out there who are looking seriously at MCEPC's for more than $1000, but could really save some money with a simpler product like Beyond TV 4.

Now playing: Original Broadway Cast "Rent" - Take Me or Leave Me

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

ClickOnce and FireFox with a custom setup equals ClickThrice and be disappointed

November 11, '05 Comments [11] Posted in ASP.NET | Javascript | XML | Bugs
Sponsored By

ClickoncescreencastthumbnailChris Sells via Michael Weinhardt ported Wahoo (a Tetris Clone) to ClickOnce/.NET2.0. I happily visited and attempted to download, expecting to click once. I run Firefox as my default browser and am currently running FireFox 1.5 RC2. However, Brian Noyes via Greg Robinson says

"ClickOnce does not have a dependency on browser flavour, so it should work with Firefox or IE (5.0.3 and up), provided the FX 2.0 is installed."

so I figured I'd be OK. But, just to be careful, I loaded up IE and ran it from there. Here's the result as a screencast.

There are two ways to launch this particular app. You can launch the setup.exe that confirms you have Windows Installer 3.1 (a requirement of MicrosoftUpdate.com) or you can launch it directly via the .application file. The application's manifest gets sent based on it's mime/type to the ClickOnce engine, dfsvc.exe. This application is responsible for reading the manifest and downloading the application into a per-user*per-application cache in C:\Documents and Settings\<you>\local settings\Apps\2.0. The application.manifest mime-type is application/x-ms-application and if you look in Windows (not Internet) Explorer's FileTypes dialog you see that it's open command is "rundll32.exe dfshim.dll,ShOpenVerbApplication %1" which tells rundll32.exe to call the ShOpenVerbApplication method on dfshim.dll also known as the Application Deployment Support Library. Since the setup.exe is calling ShellExecuteEx, it seems that Firefox as the default browser gets first dibs.

Note that the setup.exe isn't a requirement of ClickOnce, just a decision that MichaelW made to ensure a certain prereqs are available. (UPDATE: This has since been updated on the site but still doesn't work in FireFox) The ClickOnce deployment creates a .html file that does some interesting javascript in order to "do the right thing." The Javascript parses the UserAgent, looking for the presence of the CLR. This works on IE because IE's UserAgent string is modified when you install the .NET CLR and various other things. For example, my IE UserAgent is "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727; Avalon 6.0.5070; WinFX RunTime 3.0.50727)" while my FireFox one is "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051107 Firefox/1.5".

UseragentmodifiedNOTE: These User Agents are added in a list in the registry under HKEY_LOCAL_MACHINE\SOFTWARE\
Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent\Post Platform
. See screenshot at next.

THOUGHT: Seems to me that FireFox on Windows could save us a hassle if it would respect and use this list in its own User-Agent string.

function Initialize()
{
  if (HasRuntimeVersion(runtimeVersion))
  {
    InstallButton.href = directLink;
    BootstrapperSection.style.display = "none";
  }
}
Opening Wahoo.applicationfunction HasRuntimeVersion(v)
{
  var va = GetVersion(v);
  var i;
  var a = navigator.userAgent.match(/\.NET CLR [0-9.]+/g);
  if (a != null)
    for (i = 0; i < a.length; ++i)
      if (CompareVersions(va, GetVersion(a[i])) <= 0)
		return true;
  return false;
}

Nutshell is, one page is generated by the deployment wizard, but different browsers get different client-side-modified pages based on this (and other) Javascript.

OperaClickOnceInterestingly the identical problem occurs when I use Opera 8.0. It downloads to a temp folder and runs, failing in the exact same way. Both Opera and Firefox download to the Local Settings\Temp, while IE downloads to the bowels of Temporary Internet Files\schmutz.

Hacking

I opened the XML-based .application file and noted this:

<dependentAssembly dependencyType="install" codebase="Wahoo_1_0_0_16\Wahoo.exe.manifest" size="10640">

which was mentioned in the error log file

 * Activation of C:\DOCUME~1\shanselm\LOCALS~1\Temp\wahoo-5.application resulted in exception. Following failure messages were detected:
  + Downloading
http://www.hanselman.com/blog/content/binary/Wahoo.exe.manifest did not succeed.
  + Could not find file 'C:\Documents and Settings\shanselm\Local Settings\Temp\Wahoo_1_0_0_16\Wahoo.exe.manifest'.

So, I downloaded http://www.sellsbrothers.com/wahoo2/Wahoo_1_0_0_16\Wahoo.exe.manifest and saved it to C:\Documents and Settings\shanselm\Local Settings\Temp\Wahoo_1_0_0_16 manually. Then I tried to run Wahoo.application again from FireFox and everything worked. Seems to me that could be a security hole. Dfsvc.exe shouldn't be thrilled to find a file it was responsible for downloading already present in the folder it was responsible for populating. I would have expected a failure to download, not success just because I did its work for it. However, what do I know about security? I tried to edit the .application file and of course was greeted with a tamper proof label, as expected:   

System.Deployment.Application.InvalidDeploymentException (SignatureValidation) - Manifest XML signature is not valid.

That's comforting, though.

No conclusion here yet, folks. I was unable to get either the setup.exe version or the .application version to work any on of three machines, all running FireFox as the default browser. Of course, if I switch to IE as the default, everything works great.

Seems to me that I should be able to download and click on a .application file anywhere and have dfsvc.exe just handle it, copying things to wherever it needs to. It doesn't seem to expect to have .application downloaded to other locations.

Good news is, it's been reported as a bug and I expect we will here something soon. I'll post as soon as I get more info. Feel free to comment if I've gotten something wrong.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Request.Browser.Version may not be a double

November 11, '05 Comments [7] Posted in ASP.NET
Sponsored By

Avoid writing code like this to do browser detection:

if(Double.Parse(Request.Browser.Version) < 5.2) { // 5 or less

Why might this be a problem? Well, Request.Browser.Version is typed in the Base Class Library as a string. It's a string for a reason - because it may not necessarily be a double. When one writes Double.Parse(someString) they're basically saying that the folks who chose the type for Request.Browser.Version were mistaken, and that a double would have been a better chose.

This can be a problem when a browser like IE7.0 beta comes out and the value of Request.Browser.Version is "7.0b." This also applies to Mac's Safari and its User agent version which changed recently from 2.0 to 2.0.1 or 2.0.2.

Exception: Input string was not in a correct format.
Exception: System.FormatException
Message: Input string was not in a correct format.
Source: mscorlib
at System.Number.ParseDouble(String s, NumberStyles style, NumberFormatInfo info)
at System.Double.Parse(String s, NumberStyles style, IFormatProvider provider)
at System.Double.Parse(String s)

Unexpected exceptions tend to cramp one's style. I like the philosophy that "if you ever get an unexpected exception, you didn't test your code well enough." Why? Because clearly it wasn't anticipated, otherwise there'd have been code to handle it. This line (and the code around it you can't see) never expected a non-double to be in Request.Browser.Version, but the property's string type was the first tip that other things could happen.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

When .NET 2.0 Applications Attack - Debugging weirdness after installing the .NET Runtime

November 10, '05 Comments [10] Posted in Learning .NET | Bugs
Sponsored By

WeirdLogitechRemotingBugI've been developing using the Logitech io2 Pen SDK recently and also, coincidentally installed .NET 2.0 and Visual Studio 2005 around the same time.

I got this error a few days ago upon docking the pen: "Ticks must be between DateTime.MinValue and DateTime.MaxValue" and noticed that remoting was involved in the stack dump:

System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Logitech.Pen.Device.IPen.get_LastSynchronizationTime()
   at Logitech.Pen.TrayIcon.PenBalloon.DoRefresh()

So, two assemblies were chatting each other up via remoting and something went wrong. Logitech has a number of EXEs that all work together to make io2 Pen Services available in multiple contexts. Don't worry, they don't all run at the same time; they come and go as needed.

Io2Software

I knew that Logitech used .NET 1.1 for their development and I knew that on systems that have both .NET 2.0 and .NET 1.1 that 1.1 EXEs would get the 1.1 CLR loaded by default. However, the only thing that changed was the installation of 2.0.

Which of these was running .NET 2.0? Using Sysinternal's glorious ProcExp that can highlight processes that contain a .NET runtime as well as show exactly what DLLs are loaded in a process's memory space. Looks like Pen.LplsHost.exe gets 2.0 loaded, while EVERY other .EXE gets 1.1.

LplsHost

That's weird, and it would make sense that if a .NET 1.1 application remoted into a .NET 2.0 application that something odd might happened (Honest question: Doesn't it?).

When you install .NET 2.0, does it changed any 1.1 DLLs? Yes and no. The system-wide CLR loader, mscoree.dll changes when you install a new version of the .NET Framework. It's always the last version. This is necessary because the loader ultimately makes the decision of which CLR to load into that process. So, mscoree was updated to make the 1.0, 1.1 or 2.0 decision. 

Now, the real question is: What is it about Pen.LplsHost.exe that causes it to load .NET 2.0?

Here's why! It's NOT a .NET application! Reflector reminds me that it's an unmanaged C++ application. It does load the CLR though, so it's likely a CLR Host that does something like this to load the CLR:

LPWSTR pszFlavor = L"wks";
ICorRuntimeHost *pHost = NULL;
hr = CorBindToRuntimeEx(
                      //version
                      null,      
                      // svr or wks                       
                      pszFlavor,   
                      //domain-neutral"ness" and gc settings
                      STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN_HOST |       
                      STARTUP_CONCURRENT_GC,
                      CLSID_CorRuntimeHost,
                      IID_ICorRuntimeHost,
                      (void **)&pHost);

However, if you don't pass in a value for version, MSDN says:

"If the caller specifies null for pwszVersion, the latest version of the common language runtime is loaded. Passing null gives the host no control over which version of the runtime is loaded. While this may be appropriate in some scenarios, it is strongly recommended that the host supply a specific version to load."

So instead, they should note http://msdn.com/library/en-us/cpgenref/html/grfuncorbindtoruntimeex.asp and try this instead: 

LPWSTR pszVer = L"v1.1.4322"; // <!---- Oy!
LPWSTR pszFlavor = L"wks";
ICorRuntimeHost *pHost = NULL;
hr = CorBindToRuntimeEx(
                      //version
                      pszVer,  // <!---- Oy!
                      // svr or wks                       
                      pszFlavor,   
                      //domain-neutral"ness" and gc settings
                      STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN_HOST |       
                      STARTUP_CONCURRENT_GC,
                      CLSID_CorRuntimeHost,
                      IID_ICorRuntimeHost,
                      (void **)&pHost);

Speculation: I'd bet $100 that the devs aren't asking for .NET 1.1 in Pen.LplsHost.exe and they should have if they were following best practices. As I said, you can override it with the .config file, but the RIGHT thing to do (in the short term) is to ask for the version you want.

I'm chatting with Logitech Support about this, so until I update this post everything I've said so far is just my opinion and speculation and in no way means to impugn they or there developers. It's a difficult thing to anticipate these things and to include version-specific information, especially as a CLR Host.

Short term fix: You can easily force Pen.LplsHost.exe (or any application for that matter) to load the .NET 1.1 framework by dropping the attached file into C:\Program Files\Logitech\io2Software. I have done this and haven't see any problems since and noted with ProcExp that 1.1 is now correctly loaded in this process's space.

<configuration>
    <startup>
        <requiredRuntime version="v1.1.4322"  />
    </startup>
</configuration>

File Attachment: Pen.LplsHost.exe.config (118 bytes)

UPDATE: Matt Davis (see the comments for this post) nailed it. I was mistaken. I spoke to the team at Logitech and it was, in fact, C++ calling a .NET Assembly via COM Interop. This  could be controlled via the RunTimeVersion key for the InproServer32 key for this RCW within the Registry. However, everything in this post up to the CorBindToRuntimeEx conclusion holds, and the .exe.config solution is also workable one. Logitech is exploring ways to make this easier. My question is, what about Explorer.exe and hosting multiple shell extensions each written in different versions of .NET?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Windows Clippings - A Cropper Contender

November 10, '05 Comments [2] Posted in Reviews | ASP.NET
Sponsored By

I dig Cropper in a big way. It's a great, elegant and lightweight way to do screenshot. However, lately I've been using Kenny Kerr's Windows Clippings 1.0 for posting to my blog.

It goes in the tray and when you double click on it the screen dims. You single click on the window you want to get a screenshot of and just that window brightens. A double-click then will send the screenshot to the clipboard, OneNote, or a Folder. It's even smart enough to pick a good filename based on the Window's Title.

Not only that, but it will create transparency in all the appropriate places, which is very useful when you consider that even Windows Explorer uses irregular regions and curved edges.

Kudos to Kenny for another killer util!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.