Archives / 2011 / November
  • Windows Azure Error: Failed to start Storage Emulator: the SQL Server instance ‘localhost\SQLExpress’ could not be found

    When running some of your Windows Azure applications when storage emulator is not configured you may get the following error: "Windows Azure Tools: Failed to initialize Windows Azure storage emulator. Unable to start Development Storage. Failed to start Storage Emulator: the SQL Server instance ‘localhost\SQLExpress’ could not be found.   Please configure the SQL Server instance for Storage Emulator using the ‘DSInit’ utility in the Windows Azure SDK.". Here’s how to solve this problem.


  • Making CopySourceAsHtml add-on work with VS2010

    As there are still bloggers who use CopySourceAsHtml add-on for Visual Studio to get syntax highlighted code to their blog posts and there is no guidance in CSAH site how to make it work with Visual Studio 2010 I will give my guidance here. Almost all code in this blog is syntax highlighted by this add-on (read more from my post Visual Studio add-in: CopySourceAsHTML).

    Last version of CSAH is available for VS2008 but it is easy to make it work with VS2010. Just follow these steps.

    1. Close VS2010 if it is opened.
    2. Goto folder MyDocuments\Visual Studio 2010.
    3. Move to AddIns subfolder (create it if there is no such subfolder).
    4. Create file called CopySourceAsHtml.AddIn and open it in text editor.
    5. Paste the following XML to editor:


      <?xml version="1.0" encoding="utf-8" standalone="no"?>

      <Extensibility xmlns="">


      <Name>Microsoft Visual Studio Macros</Name>




      <Name>Microsoft Visual Studio</Name>





      <Description>Adds support to Microsoft Visual Studio 2010 for copying source code, syntax highlighting, and line numbers as HTML.</Description>

      <Assembly>JTLeigh.Tools.Development.CopySourceAsHtml, Version=3.0.3215.1, Culture=neutral, PublicKeyToken=bb2a58bdc03d2e14, processorArchitecture=MSIL</Assembly>







    6. Save file and close it.
    7. Run VS2010 and activate add-on if it is not activated yet.

    That’s it. If you are heavy user of CSAH then I recommend you to bookmark this post. :)


  • ASP.NET MVC: Simple view to display contents of DataTable

    In one of my current projects I have to show reports based on SQL Server views. My code should be not aware of data it shows. It just asks data from view and displays it user. As WebGrid didn’t seem to work with DataTable (at least with no hocus-pocus) I wrote my own very simple view that shows contents of DataTable.


  • Using Lazy<T> and abstract wrapper class to lazy-load complex system parameters

    .NET Framework 4.0 introduced new class called Lazy<T> and I wrote blog post about it: .Net Framework 4.0: Using System.Lazy<T>. One thing is annoying for me – we have to keep lazy loaded value and its value loader as separate things. In this posting I will introduce you my Lazy<T> wrapper for complex to get system parameters that uses template method to keep lazy value loader in parameter class.