Wednesday, January 29, 2014

Editing the Hosts file on Windows 8

In previous versions of Windows, I was always able to edit the hosts file whenever I was logged in as an Administrator and when I had UAC turned off.

However, in Windows 8, I noticed that even under these circumstances, I was still not able to edit and save my changes to the Windows Hosts file!!

As it turns out, Windows 8 seems to have implemented additional security on the Windows Hosts file which requires any text editor (such as Notepad) to be run with Administrative privileges before being allowed to edit and save changes to the hosts file. 

This requires simply opening the text editor of choice by using "Run As Administrator" before beginning to edit and save changes to the hosts file.

You can read more about the specific set of steps to accomplish this on Windows 8 here: http://www.petenetlive.com/KB/Article/0000674.htm


Friday, January 24, 2014

Managing Wireless Network profiles on Windows 8

If you have ever worked with managing Wireless Networks in Windows 7, you may have noticed that there is a GUI interface to manage wireless networks in Windows 7 which allows you to add, change and delete Wireless Networks that have been configured on Windows 7.

Unfortunately, Windows 8 has removed the ability to manage and maintain the complete list of wireless network profiles from the User Interface.  I am not quite sure why Microsoft decided to make this change, but it now requires reverting to the command line in order to view and manipulate all of the available wireless network profiles configured on your Windows 8/8.1 machine.

The article on how to accomplish this can be found here: http://windows.microsoft.com/en-us/windows-8/manage-wireless-network-profiles

Creating a new Custom VM using VMWare Workstation

It is relatively easy to create a new virtual machine using VMWare Workstation.

VMWare Workstation offers both a "Typical" configuration as well as a "Custom" configuration.  In most instances, I use a custom configuration in order to be able to specify all of the individual settings that I need for building and creating my virtual machine.

You can find the formal VMWare Workstation documentation here: https://www.vmware.com/support/pubs/ws_pubs.html

For the VMWare Workstation User Manual/User Guide, you can download it here: http://www.vmware.com/pdf/desktop/ws10-using.pdf

The screenshots provided below are for VMWare Workstation 10, but the process should be similar for other versions of VMWare Workstation as well:















Tuesday, January 14, 2014

Data binding to an ASP.NET GridView control using LINQ and Entity Framework DbContext

I have been using Entity Framework for quite a few years and when I first started using Entity Framework, the only option was using traditional ObjectContext.

However, with the more recent releases of Entity Framework, the recommendation is to now use DbContext in favor of ObjectContext

Therefore, I began updating all of my Entity Framework Class Libraries over to the new DbContext, but after compiling my solution and attempting to use a LINQ Query to bind to an ASP.NET GridView, I received the following error message:

Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery) is not supported. Instead populate a DbSet with data, for example by calling Load on the DbSet, and then bind to local data. For WPF bind to DbSet.Local. For WinForms bind to DbSet.Local.ToBindingList().

After doing some research on the web as to the nature of this error message, I discovered, that I simply had to cast my LINQ Query to a List (by appending .ToList() to the end of the LINQ Query result).

Once I did that, I was able to successfully bind my LINQ Query to the GridView control without receiving any further error messages!!

Monday, January 13, 2014

ADO.NET ConnectionString for Rocket Universe database

 

If you have not been keeping up with the latest developments in .NET in regards to Rocket Universe development, you may not know that Rocket has developed libraries that now support use of ADO.NET as well as Entity Framework!

You can download the latest .NET libraries that are part of the U2 Client from here: http://www.rocketsoftware.com/products/rocket-u2-clients-and-dbtools/try-now

However, once you download and install the latest .NET Client, you will notice that none of the code samples demonstrate how to use a connectionString in the App.config or Web.config file!  Instead, the samples simply use the U2ConnectionStringBuilder to build a connection string manually in the code file.

Fortunately, you can readily deduce the required structure for the App.config or Web.config file from this code sample which results in the following connection string format:

<connectionStrings><add name="(Connection String Name)" connectionString="Server=(Server Name);Database=(Database Name);UID=(Windows user ID);Pwd=(Windows Password);ServerType=UNIVERSE;Pooling=false;" providerName="U2.Data.Client" /></connectionStrings>


A sample of the connection string looks like this:


<connectionStrings>
<add name="UNIVERSEConn" connectionString="Server=localhost;Database=HS.SALES;UID=MyUser;Pwd=MyPassword;ServerType=UNIVERSE;Pooling=false;" providerName="U2.Data.Client"/>
</connectionStrings>

Wednesday, January 8, 2014

Installing Entity Framework v. 5.0

As many developers already know, Entity Framework v. 6.0 has already been released.  Therefore, when you open the NuGet Package Manager from within Visual Studio, you will only be presented with the option to install the latest and greatest version of Entity Framework.



Well, unfortunately, Entity Framework 6 has some specific requirements for versions of the .NET Framework, versions of ASP.NET MVC etc. which may not be practical for all current web applications.

Therefore, what if you want to install an older version of the Entity Framework, such as version 5.0??  Well, unfortunately, this cannot be managed through the NuGet User Interface, but it can be handled through the NuGet Package Manager Console as described in this article: http://www.nuget.org/packages/EntityFramework/5.0.0

You simply have to type the following command in the NuGet Package Manager Console (which can be accessed from the Tools --> Library Package Manager --> Package Manager Console menu item in Visual Studio).



Install-Package EntityFramework -Version 5.0.0

That is all!  NuGet will then install the appropriate version of Entity Framework for you (v. 5.0).

Monday, January 6, 2014

Changing the logging level of MSBuild in the Visual Studio IDE

If you have ever had to troubleshoot problems with build compilation, you probably know that, by default, Visual Studio, does not provide you with a lot of error detail in the Output window.

Well, fortunately, since Visual Studio internally uses the MSBuild engine, you can modify the build logging detail or verbosity directly from within the IDE!!

  1. From the Tools menu, select Options
  2. Expand the "Projects and Solutions" menu item to display the "Build and Run" menu option
  3. Change the MSBuild logging level for the "MSBuild project build output verbosity" and "MSBuild project build log file verbosity" settings
  4. Re-compile your project or solution to see the additional details in your build compilation!




Don’t forget to import the System.Linq namespace!!


I was recently working within an ASP.NET User Control’s code behind class file, when I noticed that while returning the result of a LINQ query from a method, none of the LINQ Extension methods were available!
In addition, because LINQ is a set of extension methods, Visual Studio will NEVER warn you to tell you that this namespace is missing!

Instead, you will simply get the following set of methods available from within Visual Studio when attempting to apply additional filter queries on a LINQ expression:


However, once you add the System.Linq namespace to the top of the class file, you will once again be able to view the familiar set of LINQ Extension methods: