Live Writer HTML Source tab reminds me of old school WordPerfect reveal codes

I made an error with formatting in a blog posting after inserting a code snippet into Live Writer using Paste from Visual Studio.

Like in Microsoft Word, I found it near impossible to correct my error from the Edit tab of Live Writer.  Luckily Live Writer provides a Source tab making it possible (although tedious) to fix up my incorrect HTML.  When fixing the HTML I couldn’t help but recall the reveal codes in the DOS WordPerfect software–a very useful and missed feature of most current software.  A key factor in the popularity of the simplistic XML/HTML documents is the ability to “human read” the information.  WordPerfect had that right back in the 1980s.

Never forget the primary key (PK) on a table!

Want to kill an hour?  Forget to include a primary key constraint on a SQL table and use the Visual Studio auto-generated dataset.

You will get this error when issuing the Update() command on an adapter:

“Update requires a valid UpdateCommand when passed DataRow collection with modified rows.”

If you look at the code in yourdataset.Designer.cs file for

private void InitAdapter()

it will not include the necessary INSERT INTO, DELETE FROM and UPDATE commands—it will only include the INSERT INTO. Of course it makes sense that MSDataSetGenerator would not know how to generate proper SQL code without a primary key… But all the code behind code makes debugging difficult!

WCF Service Library IIS 7 deployment—where does the .dll go?

After you have built your release WCF Service Library .dll in VS 2010, when deploying to IIS 7, the .dll file(s) should go under the bin folder of the application root of the web site.  This must be common knowledge, but it took me a few “bings” to find the answer from this link:

… As a precompiled .dll file located in the global assembly cache (GAC) or in the application’s \bin directory. Precompiled binaries are not updated until a new version of the class library is deployed.

IIS 7 / WCF / .Net 4 configuration update

To make sure IIS 7 is setup to work with the latest WCF and .Net 4 framework, use these two utilities: aspnet_regiis.exe and ServiceModelReg.exe.

On an x64 machines, both of these utilities can be found in the folder: C:\Windows\Microsoft.NET\Framework64\v4.0.30319

From a command prompt launched with “Run as administrator” rights run aspnet_regiis –i –enable

Per MSDN, this

Installs the version of ASP.NET that is associated with Aspnet_regiis.exe and updates the script maps at the IIS metabase root and below.

Only the script maps for applications that use an earlier version of ASP.NET are updated. Applications that use a later version are not affected.

According to MSDN, ServiceModelReg manages the registration of a ServiceModel.  Basically, as I understand it, this makes sure that .svc files use the proper .Net framework (in this case .Net 4).  Run the following command: ServiceModelReg –ia

Your IIS 7 configuration should now be set to properly use WCF with the .Net 4 Framework.

To confirm, verify that the Application Pools .Net Framework Version shows v4.0 as shown below.IISConfig_2

 

DebuggerDisplayAttribute or ToString() to help debugging

[DebuggerDisplay("Customer={CustomerName} Phone={CustomerPhone}")]
class WEOTestClass
{
    public WEOTestClass(string _name, string _phone)
    {
        CustomerName = _name;
        CustomerPhone = _phone;
    }

    public string CustomerName { get; set; } 
    public string CustomerPhone { get; set; }

    public override string ToString()
    {
        return( "Customer: " + CustomerName + " Phone: " + CustomerPhone );
    }
}

For viewing classes when debugging in the Visual Studio IDE, both DebuggerDisplay and a ToString() work well.  While ToString() is more typing, it has the added benefit when logging to files or other output (besides the debugger).

Love & Hate with Microsoft Development Tools (VS 2010 & .Net 4.0)

For about an hour, all I wanted to do was use a WebGet attribute by adding this line of code to a test WCF application I was creating:

using System.ServiceModel.Web;

I went to the Add Reference dialog and looked for the assembly…  But as you can see below, for this project, it wasn’t available.image_2

 

The eventual solution amazed me.  My Target framework was set to .Net Framework 4 Client Profile (as the Add Reference dialog above showed with Filtered to: .Net Framework 4 Client Profile).  For some reason this is the default for newly created console applications.

image_4

Changing the Target framework to .Net Framework 4 solved my mystery.

image_6

These kinds of awkward behaviors are huge time killers.  While I believe Microsoft is trying to hide complexity for developers—to make it “easy”—I would rather see everything happening under the covers rather than try to figure it out after the fact.  Developing software is hard enough with out the tools making assumptions.

And a special thanks Patrick Cauldwell for saving me even more time searching for a solution.

A couple more web application desktops—both in Silverlight

myOSity.com reminds me of the original Microsoft Windows 3 Program Manager—an icon based launching pad to windowed applications (several of which are from various authors from around the web).  Interestingly, according the the creator’s blog the project will be going open source onto CodePlex.

And for a very clever twist, check out Wiki-OS.  The concept is to bring wiki-like editing to applications.  The overall program (or perhaps I should call it a WebOS) is exceptionally well done.  The company behind Wiki-OS is Userware.

Version Control–Going Open Source with SVN

Subversion works great and is easy to install on Windows using Visual SVN Server.  Rather than using text commands to checkout/commit/log/etc, TortoiseSVN  seamlessly integrates with the Windows File Explorer as a shell extension providing excellent visual tools such as a Repo-Browser, Revision Graph, and Log Statistics.

While TortoiseSVN has a visual diff tool, Beyond Compare from Scooter Software offers better visuals and more features.

To use Beyond Compare instead of TortoiseMerge, change the TortoiseSVN Diff Viewer setting to:

“C:\Program Files (x86)\Beyond Compare 3\BComp.exe” %base %mine /title1=%bname /title2=%yname /leftreadonly

image_2

And if you need to managing development teams that are using Subversion with TortoiseSVN, check out SVN-Monitor—a great way to quickly see who is doing what where (with some cool trigger/notification capabilities as well).

Fixing the missing right click “Open in Expression Blend…” in Visual Studio 2010 (Running on x64 system)

Using RegEdit, find the location of BlendLaunchPath.

On my Windows Server 2008 box, the REG_SZ BlendLaunchPath was under [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Expression\Blend\4.0\VS]

The proper location is:

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Expression\Blend\VS]

Below you can see the new VS key added with the BlendLaunchPath:

image_2

Solution originally found in Tim Heuer’s blog.