Remoat Home Automation Software

June 30, 2012 17:31 by docbliny 

Since I missed the May Home Automation Month, I really need to make up for it somehow. So here’s a quick video of Remoat (, a little utility I’ve been putting together in my spare time. It’s not really production-ready, but I’ll make the source available for the hackers out there.

Currently it needs/supports the following:

  • Windows Media Player: Plays music from your library.
  • MiCasaVerde Vera: Allows you to turn on binary devices, such as lights that you’ve got configured.
  • mControl 2.X: There’s some old code in the package from when I was running mControl on my WHS box (which had sequential disk failures and in the end killed my RAID –> switched to a QNAP NAS). Unsupported.
  • Windows Vista/7 speech recognition: This is required (part of the operating system anyway).
  • Windows text-to-speech: You can specify which audio device is used for speech output. This lets you hook up a pair of speakers that are always on and have the PC hooked up to you’re a/V system for better quality playback. Part of the operating system.

System.Speech.SpeechRecognizer works, SpeechRecognitionEngine doesn’t

April 24, 2011 08:53 by docbliny 

I believe I've found an issue with the managed speech recognition libraries. The short problem description is that I am unable to use SRGS/.grxml files that contain "ruleref" elements pointing to other files with System.Speech.Recognition.SpeechRecognitionEngine (InProc). They load fine when using SpeechRecognizer.

After debugging (and finally making a custom build of System.Speech.dll), I've narrowed down on the issue. When you use an InProc recognizer, RecognizerBase.cs sets a custom grammar loader (ISpGrammarResourceLoader). Unfortunately, the RecognizerBase.LoadResource method that is used will receive a null value for the last argument ("pbstrRedirectUrl"), and cause a null exception when it tries to do a split on the null string. This also explains why SpeechRecognizer does not have any issues with the same files.

The same issue happens with both 3.5 and 4.0 versions of the Framework.


I can’t get a speech recognition project I started in 2008 to correctly load the grammar definition files (.grxml / SRGS) in my current environment (Windows 7 64-bit) with SpeechRecognitionEngine.


Well, turns out that the shared SpeechRecognizer will correctly load the exact same GRXML files with external ruleref definitions. After hunting through the .NET source code, the culprit might be in the RecognizerBase.cs method named LoadSapiGrammarFromCfg(). It sets a custom grammar loader for SAPI only when using an InProc recognizer (which SpeechRecognitionEngine is). The comments even state “The rulerefs will be resolved locally.”

So, I have the following options:

  • Continue debugging .NET to see if the behavior has changed, and I’m simply missing some element in the XML file. This doesn’t seem likely, as ProcMonitor clearly states that only the first file even gets a open/read attempt. I’ve tried setting the base URI, used absolute paths, did a quick attempt at loading from a URL. The problem is made worse by the fact that I can’t step through the .NET code in either Visual Studio 2008 or 2010. Fixing that will take its own time… I could try using the .NET Framework code (fingers crossed all the required files are available) directly.
  • Switch to using SpeechRecognizer. I don’t want this, because I’d end up with a broader dictionary which will reduce accuracy.
  • Merge my GRXML files. Yuck. There’s a reason for ruleref support in the files. In addition, the app is meant to be extensible, and having to merge files just makes things harder for the developer and end users.
  • Go down the path of using SpeechLib/SAPI, but looking at the amount of code in the Framework, this seems totally redundant.

Error Info

  • SapiErrorInvalidImport A rule reference to an imported grammar cannot be resolved.
  • 0x80045024
  • -2147200988

Why does System.Speech.Internal.SrgsCompiler.CompileStream() default to “es-us” CultureInfo?

April 23, 2011 09:16 by docbliny 

UPDATE: Nevermind, this is a patch for the "es-us" culture which has the ID 0x540A.

I been trying to track down why I can’t get GRXML files that have ruleref elements pointing to external files working with Windows 7 (64-bit), and ran into the following line of code:

culture = (backend.LangId == 0x540a) ? new CultureInfo("es-us") : new CultureInfo(backend.LangId);

Note the "es-us" locale. Weird. Now back to banging my head against the original problem.

Silverlight 3 WriteableBitmap requires call to Invalidate() after Render()

September 6, 2009 18:20 by docbliny 

All of the samples I cam across using WriteableBitmap seemed to be from a prerelease version. They call the constructor with an additional parameter and don't call Invalidate() which is required for the anything to actually show up in the bitmap.

private void UpdatePreview() {     
     WriteableBitmap bitmap = new WriteableBitmap((int)imageSource.Width,
     bitmap.Render(imageSource, new TranslateTransform());
     imgPreview.Source = bitmap;

Problem connecting to an Access database on x64

April 26, 2009 22:11 by docbliny 

I know I’ve seen the solution to this one somewhere, but if you’re getting the following error on a 64-bit platform, the solution is to set your application to compile as “x86” and not “Any CPU”:

ERROR: 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.


Using BBAuth with the Yahoo! Address Book

April 25, 2009 12:11 by docbliny 

There have been several people requesting help using the Yahoo! Address Book web services in the .NET Developer Forum. People are getting 403 or 404 error codes back.

I did some digging into the issue this morning and the cause for the 404 error turns out to be an invalid URL for the DOCTYPE declaration for the returned XML data. In short the URL set as the DOCTYPE for the resulting successful web service call XML data is invalid.

This causes problems when using the Yahoo.Authentication class methods, such as GetAuthenticatedDataSet(), resulting in a 404 when the .NET XmlReader attempts to validate the data against the DTD.

The way to work around this issue is to use your own XmlReader with custom XmlReaderSettings specifying to ignore the DTD.


Out of Browser with Silverlight 3

March 18, 2009 14:46 by docbliny 

One big surprise for me was that out of browser support made it into version 3. While it is nowhere near as comprehensive as Adobe Air, its main advantages are that users don’t need a separate runtime download and for developers the programming model is pretty much the same for in and out of browser.

View the session.



Installing a Silverlight application is easy for the user, and making an application available is easy for the developer.

  • Shortcuts can be placed on desktop and Start-menu.
  • No Control Panel Add/Remove Programs item added (listening to feedback).
  • Right-click: Remove this application.
  • Multiple icon sizes can be provided. Must be PNGs (transparency supported).
    • Install dialog
    • Taskbar
    • Window
  • Applications can be “previewed” in the browser before installation since the application is the same in both the browser and out.

Detaching APIs

“Detaching” is the term of moving (installing) a Silverlight application from browser onto the desktop.

  • Manifest
    • Name, Title, and Description
    • Application icons
  • APIs on Application
    • Detach method (must be called from a user interaction)
    • ExecutionState property
    • ExecutionStartChanged event
    • RunningOffline property

Updating Applications

  • Optimized for “instant on”. No check for “new version” is done when the application starts.
  • Silverlight downloads update in the background.
  • Next application launch runs the new version.
  • Event raised when an update has been downloaded. This lets you prompt the user to restart the application if necessary.

Network Availability

  • Network access information is key for out of browser applications
  • Silverlight adds functionality
    • IP address changed event
    • Network availability property
      • Any net interface, connected, not looped back
  • Best practice is to “ping” server by attempting to download a small file when state changes and a valid IP address exists. There maybe cases where the network is “available”, but limited to the local network (automatically generated private IP address).

Saving Data Locally

  • OoB Isolated Storage limit is increased to 25MB
    • Limit is increased when the application is detached
  • SaveFileDialog
    • Allows you to set file types (filter)
    • Application gets access to a Stream, but not the path


  • HTML DOM Bridge is not available
  • Shortcuts point to a small Silverlight host application that contains a browser instance
  • LocalLow\Microsoft\Offline\[ApplicationName]
  • LocalLow\Microsoft\is\[random]\[random]\[etc…]
  • Bundles are used on Macs


  • Use MessageBox for startup with Application_UnhandledException
  • Use Attach to Process on slhost.exe in Visual Studio. Will be improved post beta.

Differences vs. In Browser

  • Additional key access (Function keys for example)
  • No HTML DOM Bridge
    • No mouse wheel
    • No XmlHttp
  • Currently no HTML interop or rendering.
  • Out of browser will currently always have operating system window chrome.

Best Practices

  • (See above for network availability testing)
  • Download local data in the OoB instance after the application has been detached. 
    • Check RunningOffline to see if you’re out of browser
  • Don’t fire off more than one HWR at a time.
  • Keep all your code in the XAP
    • Silverlight versions for you making updates easy to manage
    • Assets can go outside
  • If your data model changes, require a restart.
  • Show UI for major updates so user knows things have changed.


Mike Harsh’s Slidentity Silverlight “PowerPoint” application.

MSDN pre-release documentation.

What's New in Silverlight 3

March 18, 2009 12:54 by docbliny 

Here’s a quick rundown (mostly of the slide content) presented by Joe Stegman. View the session.

As I mentioned in my previous post, there were a couple of nice surprises that I didn’t believe wouldn’t make version 3, but in addition to those there are a ton of new features as listed below.



  • Perspective 3D
    • Rotate any visual object by its X/Y/Z axes
  • Effects and Pixel Shaders
  • Pixel APIs
    • Dynamic bitmap generation
    • Render a visual tree (elements) to a bitmap
    • Image editing and effects
    • Clone visuals
    • DirectX SDK used to generate

Raw Audio/Video APIs

  • Dynamic sound generation
  • Custom audio/video decoders

Local Messaging

  • Cross plug-in Silverlight communication: cross plug-in/tab/browser/out-of-browser
  • Shared memory implementation
  • Exposed like "named pipes"
  • String based messages only (no byte-based, maybe later based on feedback)
  • Same domain required with opt-in

UI Framework Improvements

  • Merged Resource Dictionaries
  • BasedOn Styles
  • Styles can be “cleared”
  • Multi-select ListBox
  • Listening to “handled” routed events
  • New VSM “Invalid” states
    • Supported on TextBox, CheckBox, ComboBox, ListBox, RadioButton, PasswordBox (coming later)

Other Improvements

  • SystemColors
    • Especially useful for “high contrast” settings
  • Text Improvements
    • ClearType Text (post beta)
    • CaretBrush (SL 2 caret was black)
    • Flag to optimize for animating text
    • Glyphs support for system font
  • Image Refinements
    • Getting size
    • Bypass cache

New SDK Controls

  • DockPanel
  • Expander
  • Label
  • etc

Other Big Additions

  • Save File Dialog
  • Navigation Framework
    • “Native” integration with the browser history
  • Data Control Additions
  • SEO Support
  • n-Tier data support
  • Binary XML, SOAP faults, Credentials

Out of Browser

  • Silverlight runs sandboxed on desktop
  • Built into the core Silverlight runtime
  • Enabled per “application”
    • Manifest update required
  • More storage space by default: 25MB
  • User gesture required to take “out of browser”
    • Right-click context menu option
    • Custom buttons (user action required to trigger event)
  • New networking APIs
    • Connected, disconnected and changed state
    • Available in the browser, too
  • Offline APIs
  • Launch state, update APIs
  • Add icon to install dialog
  • “Take a XAP offline” – easy to deploy if everything is in the XAP. Doesn’t have to be.


  • No printing support.
  • No FlowDocument.
  • 3 behavior changes that aren’t backwards compatible
    • Quirks-mode available
  • No Commanding support
  • Isolated Storage performance problems fixed



Microsoft MIX 09 Keynote

March 18, 2009 10:25 by docbliny 

Here’s a quick rundown of the items covered during the initial Mix09 keynote. View keynote.




Beta available today.

Allows you to compare the rendering of a web page in different browsers. Supports both local installations of browsers and a cloud-based service to render in other browsers.

Read more on the Expression Blog.


Shipping today.

ASP.NET 4 and VS 2010

Even better IDE for C#/VB and web developers.

Web Platform Installer

Version 2.0 beta available today. Now allows web applications to be installed along with any dependencies.


  • FastCGI/PHP and .NET full trust
  • SQL Data Services
  • .NET Services

Commercial release this year.

Silverlight 3

Two surprises from left-field: Out of Browser and Multitouch support!

Current Numbers

  • 350+ million installations
  • 300,000 Developers & Designers
  • 200+ partners worldwide
  • 200+ Microsoft Products and Websites
  • 10,000’s of apps globally

Silverlight 3 Media Enhancement

  • GPU hardware acceleration
  • New codec support (H.264, AAC, MPEG-4)
  • Raw bitstream Audio/Video API, use .NET to access stream data
  • Improved logging for media analytics

IIS Media Services

  • Free for IIS
  • On-demand smooth streaming
  • Live smooth streaming
  • Edge caching
  • Web playlists
  • Bit-rate throttling
  • Advanced logging

Silverlight 3 Graphics

  • GPU acceleration and hardware compositing
  • Perspective 3D
  • Bitmap & pixel API
  • Pixel shader effects
  • Deep Zoom improvements

Application Development

  • Deep linking, navigation and SEO
  • Improved text quality (ClearType)
  • Multi-touch support
  • 100+ controls available
  • Library caching support (finally! Like a Global Assembly Cache for Silverlight)
  • Eclipse Support for Silverlight (on the Mac)

Silverlight 3 Data

  • Data-binding improvements
  • Validation error templates
  • Server data push improvements
  • Binary XML networking support
  • Multi-Tier REST data support

Out of Browser

Run Silverlight applications on the desktop for both Windows and Mac.

  • Extend media experiences
  • Companion applications for your website
  • Lightweight data snacking applications
  • Simple consumer friendly experience
  • Safe, secure, sandboxed environment
  • Built-in auto-update support
  • Build offline-aware applications
  • Integrate with underlying operating systems

Download Size

Total size: ~4.4MB. 40k smaller than Silverlight 2!

  • Thousands of new APIs
  • Hundreds of new features
  • New codecs
  • Out of browser support


  • Single beta planned
  • Ship later this year
  • Silverlight 3 Beta
  • Expression Blend 3 Preview
  • Silverlight 3 Tools for Visual Studio 2008
  • IIS Media Services

Expression Blend 3

Be sure to watch the keynote by Bill Buxton. Great energy and view on design.

View keynote

View Interview

  • SketchFlow
    • Flow diagram for different parts of an application.
    • Wiggly” controls. Working controls that look like conceptual prototypes.
    • Free viewer application to view “sketches”.
    • Supports multiple options.
    • Supports displaying transitions with animations.
    • Supports giving feedback. Notes and drawing on the sketches directly. Send to Blend and view in context.
    • Export to Word to auto-generate documents for clients.
  • Adobe Photoshop and Illustrator import
  • Behaviors
  • Designing with data
  • Source code controls
  • XAML, C# and VB code Intellisense

Source code for DvrConvert posted

March 8, 2009 10:29 by docbliny 

I just added the source code that Drew requested to the Downloads page.