Source Code Readability Tips

I was reading the article Source Code Readability Tips http://msdn.microsoft.com/en-us/magazine/dn802600.aspx and saw the code

 

var min = Int32.MaxValue;

 

By looking at var, is this var an int? Is this var an Int32 or something else?

 

So I think if you do the following will be more readable.

 

int min = Int32.MaxValue;

 

or

 

Int32 min = Int32.MaxValue;

 

Unless you think int is not an int, and Int32 is not an Int32.

Posted in .Net | Tagged , | Leave a comment

Working ASP.NET sample for VS 14 CTP 4 TailspinSpyworks

Beside those sample applications I blog in the articles

The TailspinSpyworks is another application that you can run in VS 14 CTP 4 and it has been working since Visual Studio 2010 for me.

The only trick that I always need to do is attach the database to the MS SQL Server. For this case I am using MS SQL Server 2012.

The original connection string is

<add name=CommerceEntities connectionString=metadata=res://*/Data_Access.EDM_Commerce.csdl|res://*/Data_Access.EDM_Commerce.ssdl|res://*/Data_Access.EDM_Commerce.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Commerce.mdf;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True&quot; providerName=System.Data.EntityClient />

Change it to

<add name=CommerceEntities connectionString=metadata=res://*/Data_Access.EDM_Commerce.csdl|res://*/Data_Access.EDM_Commerce.ssdl|res://*/Data_Access.EDM_Commerce.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.\SQLEXPRESS;initial catalog=commerce;Integrated Security=True;MultipleActiveResultSets=True&quot; providerName=System.Data.EntityClient />

This should work for you.

Reference:

http://chanmingman.wordpress.com/2014/10/15/asp-net-samples-that-run-in-visual-studio-14-ctp-4/

Posted in .Net | Tagged , , , | Leave a comment

Write XML Tree to XML file (LINQ to XML) with sub child

In my article Write XML Tree to XML file (LINQ to XML) http://chanmingman.wordpress.com/2012/07/21/write-xml-tree-to-xml-file-linq-to-xml/ the XElement tree only has on level. In this sample, I added another level to the tree.

  class Program

  {

    static void Main(string[] args)

    {

      XmlWriter xw = XmlWriter.Create(“output.xml”);

      // Create a tree with a child element.

      XElement xmlTree1 = new XElement(“Root”,

          new XElement(“Child1″, 1)

      );

 

      XElement xmlTreeSub1 = new XElement(“Child1″,

        new XElement(“SubClihd”, 3)

        );

 

      // Create an element that is not parented.

      XElement child2 = new XElement(“Child2″, 2);

 

      // Create a tree and add Child1 and Child2 to it.

      XElement xmlTree2 = new XElement(“Root”,

          xmlTree1.Element(“Child1″),

          xmlTreeSub1,

          child2

      );

 

      // Compare Child1 identity.

      Console.WriteLine(“Child1 was {0}”,

          xmlTree1.Element(“Child1″) == xmlTree2.Element(“Child1″) ?

          “attached” : “cloned”);

 

      // Compare Child2 identity.

      Console.WriteLine(“Child2 was {0}”,

          child2 == xmlTree2.Element(“Child2″) ?

          “attached” : “cloned”);

 

      xmlTree2.WriteTo(xw);

      xw.Flush();

    }

  }

 

You can also download a single solution from http://skydrive.live.com. The sample file name is ConAppXML1.zip My MSN ID is chanmmn@hotmail.com.

Posted in .Net | Tagged , , | 2 Comments

Free ebook: Creating Mobile Apps with Xamarin.Forms, Preview Edition

Download the free book from http://blogs.msdn.com/b/microsoft_press/archive/2014/10/08/free-ebook-creating-mobile-apps-with-xamarin-forms-preview-edition.aspx?loc=zatfz_zTS1z&prod=zWPz&tech=zOtScenz&lang=zCSz_zXMLz&prog=zPressz&type=zBlz&country=zUSz.

Remember, Xamarin is not a free tool even the book is free.

Posted in .Net | Tagged , , , | Leave a comment

7-zip or Winrar

In layman term, I have a folder with 4.76 GB, 19,875 files, and 3,803 folders. Using 7-zip version 9.2 I zipped into 2.2 GB. Using Winrar 5.11 I zipped into 2 GB.

Will I choose 7-zip or Winrar? Well, it depends. 7-zip can edit a file without unzip it somehow I don’t think Winrar has that feature.

Download:

7-zip http://www.7-zip.org/

Winrar http://www.rarlab.com/

Posted in .Net | Tagged , , , | Leave a comment

Bing Map SDK for Windows 8.1 will not work for VS 14 CTP 4

Don’t spend your time if you are thinking to run Bing Map in VS 14 CTP 4 at this moment.

BingWin81 

Posted in .Net | Tagged , | Leave a comment

ASP.NET samples that run in Visual Studio 14 CTP 4

So far I have tried 3 samples. I am running Visual Studio 14 CTP 4 in Windows 10.

1. The Wingtip Toys run without doing anything http://www.asp.net/web-forms/tutorials/aspnet-45/getting-started-with-aspnet-45-web-forms/introduction-and-overview.

2. Bug Tracker you need to change the .NET Framework to 4.5.3 Core. http://blogs.msdn.com/b/webdev/archive/2014/10/06/asp-net-vnext-in-visual-studio-14-ctp-4.aspx.

3. MVC Music Store I am not able to make it work for 1 hour. Maybe you can.  http://blogs.msdn.com/b/webdev/archive/2014/10/06/asp-net-vnext-in-visual-studio-14-ctp-4.aspx

Posted in .Net | Tagged , , , , | 1 Comment