I was having the rather irritating issue with my Surface Pro where I’d hop on the train for my morning or afternoon commute, and the screen wouldn’t rotate (change the orientation) when I was trying to read with my Kindle app. What made it frustrating was that it’d start working again when I arrived. I read the troubleshooting document and then contacted Microsoft support and they weren’t able to reproduce the issue. This morning, I finally figured out what was going on.
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 (http://remoat.com), 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.
Is your Ajax application running really slowly for users on IE7 (poor folks)? Have you narrowed down the cause to updating the history with location.hash? Is dynaTrace showing you that it’s actually the native DOM call hanging for more than 5 seconds?
If so, disable the Internet Explorer 7 Developer Toolbar and associated Browser Helper Object (BHO).
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.
- SapiErrorInvalidImport A rule reference to an imported grammar cannot be resolved.
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.
The following assumes you’re starting from scratch and need to install the basic software to get going.
- Install Eclipse.
- Download the appropriate version from http://www.eclipse.org/downloads/ . I usually get the Java EE version.
- Unzipping this will take a moment. I highly recommend using 7-Zip and making sure you don’t unzip over/on a network drive.
- Copy the extracted files to an appropriate place. I drop mine in the Program Files folder.
- Create a desktop icon / shortcut for eclipse.exe.
- Download and install Java Development Kit JDK.
- Download the appropriate version from http://www.oracle.com/technetwork/java/javase/downloads/index.html
- This takes even longer.
- Start Eclipse and set up the Google Eclipse plug-in. The first time you start Eclipse, it’ll prompt you for a location for the workspace.
- Click the Help-menu, and then click Install New Software….
- Enter the appropriate plug-in installation path from http://code.google.com/eclipse/docs/download.html, and then click Add….
- Enter Google Plug-in or similar into the Name field, and then click OK.
- Check Plugin and SDKs.
- Follow the instructions to finish the wizard.
- Restart Eclipse when prompted.
The Keyspan ER-RF1 USB remote is designed to work with Macs, but I just plugged it into my Vista machine and it showed up as a standard HID compliant device just fine. The keys, as far as I’ve had time to figure them out, are:
|+ ||Up Arrow |
|- ||Down Arrow |
|<< ||Left Arrow |
|>> ||Right Arrow |
|Play/Pause ||Space |
|Menu ||Command-Esc (Mac) |
|Mute ||Mute |
|Eject ||Eject (Mac) |
|Sleep ||Command-Option-Eject (Mac) |
Now all I have to do is get some steering wheel bezels and suitable buttons to hook that up to the CarPC.
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
- Applications can be “previewed” in the browser before installation since the application is the same in both the browser and out.
“Detaching” is the term of moving (installing) a Silverlight application from browser onto the desktop.
- Name, Title, and Description
- Application icons
- APIs on Application
- Detach method (must be called from a user interaction)
- ExecutionState property
- ExecutionStartChanged event
- RunningOffline property
- 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 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
- 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
- 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.
- (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.
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
- 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)
- 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
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”
- 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
- No Commanding support
- Isolated Storage performance problems fixed