Does HTML5/ECMAScript equal the next generation Java Virtual Machine?

The goal of write the code once and have it run everywhere has existed for a long time.  That was the promise of C (except back then it was called “portable code” and then “cross-platform”).  While the goal is admirable, in practice it means coding to the lowest common technology denominator.  Java works fine until one tries to create a compelling user interface. The same is true for HTML/Javascript in a web browser.  The best applications of today (and yesteryear) have exploited the native hardware using platform dependent APIs.

What does HTML5 offer that is better than JavaFX, Curl, Flash or Silverlight.  All the same problems exist—which browser is running (what version and what features are supported), what hardware is the browser running on (CPU speed, screen size, colors), etc…  The developer will need to write a lot of code (or trust frameworks) to test for the browser’s features which brings back memories of write once debug everywhere.

HTML5 is an evolution supported by the W3C that will make the world wide web better (over time).  It won’t replace native (OS tuned) applications.  But it does have a nice logo:

 

Microsoft Visual Studio LightSwitch Beta 1 to Production

Somehow I knew that installing the Beta 1 of LightSwitch would prevent the installation of the production bits.  While Beta 1 seemed to uninstall fine, installing the real deal failed.

The installer emitted the following error log:

[08/19/11,08:23:15] VS Scenario: [2] Error: CVSScenario::ExecuteEachBlocker returned false
[08/19/11,08:23:15] VS Scenario: [2] Error:There is a blocking condition met, the installer is blocking because of Section :
[08/19/11,08:23:15] VS Scenario: [2] Microsoft Visual Studio LightSwitch Beta 1
[08/19/11,10:02:22] VS Scenario: [2] Failed to pass the Warnings/Blocks checks in CVSScenario::Start()
[08/19/11,11:29:51] setup.exe: [2] ISetupComponent::Pre/Post/Install() failed in ISetupManager::InternalInstallManager() with HRESULT -2147023293.
[08/19/11,11:29:53] SimpleUI: [2] DepCheck indicates Microsoft Visual Studio LightSwitch 2011 – ENU is not installed.
[08/19/11,11:36:25] setup.exe: [2] ISetupComponent::Pre/Post/Install() failed in ISetupManager::InternalInstallManager() with HRESULT -2147023293.
[08/19/11,11:36:26] SimpleUI: [2] DepCheck indicates Microsoft Visual Studio LightSwitch 2011 – ENU is not installed.
[08/19/11,11:56:51] setup.exe: [2] ISetupComponent::Pre/Post/Install() failed in ISetupManager::InternalInstallManager() with HRESULT -2147023293.
[08/19/11,11:56:52] SimpleUI: [2] DepCheck indicates Microsoft Visual Studio LightSwitch 2011 – ENU is not installed.
[08/19/11,22:32:43] setup.exe: [2] ISetupComponent::Pre/Post/Install() failed in ISetupManager::InternalInstallManager() with HRESULT -2147023293.
[08/19/11,22:32:45] SimpleUI: [2] DepCheck indicates Microsoft Visual Studio LightSwitch 2011 – ENU is not installed.
[08/19/11,22:38:25] setup.exe: [2] ISetupComponent::Pre/Post/Install() failed in ISetupManager::InternalInstallManager() with HRESULT -2147023293.
[08/19/11,22:38:27] SimpleUI: [2] DepCheck indicates Microsoft Visual Studio LightSwitch 2011 – ENU is not installed.

I was hoping I could edit baseline.dat (extracted from running en_visual_studio_lightswitch_2011_web_installer_x86_682002.exe /x) to remove the check for the Beta 1 version, but no luck.  And also no luck removing all LightSwitch Beta 1 registry entries.

I guess I’ll be trying out LightSwitch on a different PC…

Dropbox and Live Mesh

When I tried Microsoft’s Mesh a few years back I thought it had great potential.  But it wasn’t clear what Microsoft was going to do with the software.  Since that time, I have been using Dropbox; which has an elegant simplicity (and works across different platforms).

Moreover, I didn’t even realize that “Mesh” is now Live Mesh and is included with Windows Live Essentials (since September 30, 2010).  Windows Live Essentials are very nice tools (which Microsoft does not market well).  Heck, if I’d known Live Mesh was available I might not have tried Dropbox—but I am glad I did.

There is a saying: Yesterday is History; Tomorrow is a Mystery; but Today is a Gift.  That is why it is called the Present.”  Master Oogway

While unable to find the original source, most web searches attribute the quote to Alice Morse Earle as “The clock is running. Make the most of today. Time waits for no man. Yesterday is history. Tomorrow is a mystery. Today is a gift. That’s why it is called the present.” and reference the book Sun dials and roses of yesterday.  While the book contains many interesting Sun-dial mottoes, nothing exactly matches.  I found this one from her book apropos:

TYME PASSETH AND SPEAKETH NOT,
DETH COMETH AND WARNETH NOT,
AMENDE TODAY AND SLACK NOT,
TOMORROW THYSELF CANNOT.

Outlook Send/Receive Error 0x80040115

While traveling I could not get Outlook on my laptop to send/receive any emails.  The Outlook status bar would say Disconnected and checking the Outlook Send/Receive Progress Errors would show “Task ‘Microsoft Exchange Server’ reported error (0x80040115) : ‘The connection to the Microsoft Exchange Server is unavailable. Outlook must be online or connected to complete this action.’”

I tried everything from ipconfig /flushdns; changing the DNS Server; repairing the mailbox; even reinstalling Outlook.  Nothing worked and I felt crippled without email (oddly/luckily I could receive emails on my Windows 7 Phone so I was not completely paralyzed).

The solution?  My work PC had Outlook still running but Outlook had crashed!  After stopping the crashed Outlook, it starting working again on my laptop.

Using Windows Phone Developer Tools with Windows Server 2008

I’d been meaning to try some Windows Phone 7 development for a while but could not get the tools installed into Visual Studio 2010 on Windows Server 2008 (the main OS that I run).  In vain I setup a Windows 7 Virtual Machine which allows for the Windows Phone Developer Tools to be installed but the XNA framework will not run within the VM.  I went as far as buying a new SSD drive to install Windows 7 onto when I found this great post on Aaron Stebner’s Weblog.

These are the eight steps from the above blog post:

  1. Download the Windows Phone Developer Tools web bootstrapper and save it to your hard drive.
  2. Extract the contents of the setup package by running vm_web.exe /x and choosing a path to extract to.
  3. Go to the folder you extracted to in step 2 and open the file baseline.dat in notepad.
  4. Look for the section named [gencomp7788]
  5. Change the value InstallOnLHS from 1 to 0 (zero means do not block).
  6. Change the value InstallOnWin7Server from 1 to 0
  7. Save and close baseline.dat
  8. Run setup.exe /web from the folder you extracted to in step 2

Note: none of this is “officially supported” (just like the Zune software on Windows Server 2008) but from my experience I have not had any issues.  I understand not wanting to test every OS combo but one needs to balance the cost vs. the community needs.  For stability reasons, I’ve been running Server OSs on my main development machine since Windows 2000.  I suspect I am not the only one who does this.

OOP with WCF: Decorate DataContract with [KnownType(typeof(aType))]

WCF makes heavy use of reflection.  In order to support object inheritance one needs to help WCF by decorating DataContract with [KnownType(typeof(aType))] so the service reference will include the proper information.  Below is a quick example:

The below data contract for an Animal also includes the known types of Cat and Dog:

[DataContract]
[KnownType(typeof(Cat))]
[KnownType(typeof(Dog))]
public class Animal
{
    [DataMember]
    public string Name
    { get; set; }
}

[DataContract]
public class Dog : Animal
{ }

[DataContract]
public class Cat : Animal
{ }

 

Here, the service contract is working only with Animal:

[ServiceContract]
public interface IServiceInterface
{
    [OperationContract]
    string GetAnimalName(Animal anAnimal);

}

And the implementation is looking for specific descendant classes (Cat & Dog):

public class ServiceInstance : IServiceInterface
{
    public string GetAnimalName(Animal anAnimal)
    {
        if (anAnimal is Dog)
            return "Dog";
        if (anAnimal is Cat)
            return "Cat";
        return "Unknown";
    }

}

 

The calling code could look something like this:

ServiceReferenceTest.ServiceInterfaceClient aClient = new ServiceReferenceTest.ServiceInterfaceClient();

var aCat = new ServiceReferenceTest.Cat();
Console.WriteLine(aClient.GetAnimalName(aCat));

Bottom line: WCF is an amazingly powerful way to build OOP web services.

If one comments out [KnownType(typeof(Cat))] and runs the program, the client will give the below runtime error:

The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:anAnimal. The InnerException message was ‘Error in line 1 position 261. Element ‘http://tempuri.org/:anAnimal’ contains data from a type that maps to the name ‘http://schemas.datacontract.org/2004/07/WcfServiceWEOTest:Cat’. The deserializer has no knowledge of any type that maps to this name. Consider using a DataContractResolver or add the type corresponding to ‘Cat’ to the list of known types – for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to DataContractSerializer.’.  Please see InnerException for more details.

Busy or productive…

Being busy does not always mean real work. The object of all work is production or accomplishment and to either of these ends there must be forethought, system, planning, intelligence, and honest purpose, as well as perspiration. Seeming to do is not doing.  Thomas A. Edison