Monday, August 1, 2016

Did I Really Install SQL Server 2016 in Just 2 Minutes?

Earlier this week, I published a video, which you can watch here I demonstrated how one can install SQL Server 2016 with all the possible features turned on. I tried to explain everything you need to know to do a default installation in SQL Server 2016. The total length of the video is 121 seconds.

After the video was published, I was asked by a couple of users that did it really took only 2 minutes for me to install SQL Server 2016. Well, here is the answer, in reality it took around 6-7 minutes, but during installation, there were many moments where the screen was just stuck in the same status for a while. I edited them out and the video is now just of 2 minutes.

Trust me, this is the best possible use of your 2 minutes of time. REMEMBER you can download SQL Server 2016 Developer version for FREE. Additionally, you will have to install SQL Server Management Studio separately in SQL Server 2016 version. Microsoft has introduced a new sample database over in SQL Server 2016. Do not miss out on all these important points. 
All the associated resources are mentioned in this blog post.

Pinal Dave

Wednesday, September 3, 2014


Very nice explanation of difference between Web Service, WCF, WCF REST and Web API.

Namaste !

Anugrah Atreya

Saturday, August 9, 2014

Unit Testing : [ExpectedException]

Hi All,

In this post I’ll explain what you need to do if you have to ensure that a particular exception must be thrown by your C# code.

The reason why I am writing this post is that some people mistakenly use keyword ExpectedException as given below:

[ExpectedException(typeof(ApplicationException), "Game has already Concluded, Start new Game !")]
public void FirstTwoRows()
  GameEngine ttt = new GameEngine();
  Assert.IsTrue(ttt.RecordMove('a', 3), "This is not a winning move");
  //Following line should throw Application Exception
  Assert.IsFalse(ttt.RecordMove('b', 6), "This is not a winning move");

Q: What is wrong with this code?
A: This test method will not fail if you get the specified Exception, but it will also pass when you don’t get it at all.

Q: So, whats the fix?
A:  You also need to add Assert.Fail after the line where you are expecting the exception.

[ExpectedException(typeof(ApplicationException), "Game has already Concluded, Start new Game !")]
public void FirstTwoRows()
  GameEngine ttt = new GameEngine();
  Assert.IsTrue(ttt.RecordMove('a', 3), "This is not a winning move");
  //Following line should throw Application Exception
  Assert.IsFalse(ttt.RecordMove('b', 6), "This is not a winning move");
  Assert.Fail("Above line should have thrown Exception of given type");
 I hope this small change will save lot of time for you and make your Test driven Development even better.

Namaste (Greetings)
Anugrah Atreya

Big O Notation : Algorithm Performance

Big-O-Notation is used to measure and express the relative representation of the complexity of an algorithm:


Did you ever tried to understand why :

·         Bubble Sort is O( n square )

·         Quick Sort is O( n log n)

or you just remember it by heart and don’t know what’s hiding behind these names/values J


Below given are two best explanations I found in a quick search:


They both use example of Telephone Book and make it so simple to understand the whole thing.

If you understand the Telephone Book example then I guarantee you that you will be able to tell the performance of any algorithm in a quick moment without referring its documentation.


Namaste (Greetings)

Anugrah Atreya


Tuesday, April 10, 2012

Debugging of UnitTest cases from network drive



This is in continuation of my original post:


Please follow below given steps in order to enable debugging of unit test cases from network drive:


1.) Open window :  Control Panel > AdministrativeTools > .NET Framework Configuration



2.) Click on “Edit Code Group Properties” :   Set permission Set to “Full Trust” as shown below





Anugrah Atreya


Friday, October 7, 2011

SQLServer Denali : OFFSET & NEXT Keywords


Hi All,


I found these two new & very useful keywords in SQLServer Denali



FROM [Order Details]



Above script returns records 21 to 27 from the tables [Order Details]. OFFSET clause will skip the first 20 rows and then returns 7 rows. Please note, this T-SQL will throw error if ORDER BY is not used in the query.


Reference: PinalDave's blog




Friday, September 23, 2011

Create a .NET Publisher Policy

Vendors of assemblies can state that previously compiled applications/clients should use a newer version of an assembly by including a publisher policy file with the upgraded assembly. The publisher policy file specifies assembly redirection and code base settings, and uses the same format as an application configuration file. The publisher policy file is compiled into an assembly and placed in the global assembly cache.
There are three steps involved in creating a publisher policy:
  1. Create a publisher policy file.
  2. Create a publisher policy assembly.
  3. Add the publisher policy assembly to the global assembly cache.
1. Creating the Publisher Policy XML file
The schema for publisher policy is described in Redirecting Assembly Versions. The following example shows a publisher policy file that redirects one version of myAssembly to another.
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <assemblyIdentity name="myAssembly"
                           culture="en-us" />
         <!-- Redirecting to version of the assembly. -->
         <bindingRedirect oldVersion=""
2. Creating the Publisher Policy Assembly
Use the Assembly Linker (Al.exe) to create the publisher policy assembly.
Type the following command at the command prompt: al /link: publisherPolicyFile /out:publisherPolicyAssemblyFile /keyfile:keyPairFile /platform:processorArchitecture
In this command:
  • The publisherPolicyFile argument is the name of the publisher policy file.
  • The publisherPolicyAssemblyFile argument is the name of the publisher policy assembly that results from this command. The assembly file name must follow the format:
policy. majorNumber . minorNumber . mainAssemblyName .dll
  • The keyPairFile: You must sign the assembly and publisher policy assembly with the same .snk file
  • The processorArchitecture argument identifies the platform targeted by a processor-specific assembly. It can be amd64, ia64, msil, or x86.
The following command creates a publisher policy assembly called policy.1.0.myAssembly from a publisher policy file called pub.config, assigns a strong name to the assembly using the key pair in the sgKey.snk file, and specifies that the assembly targets the x86 processor architecture.
al /link:pub.config /out:policy.1.0.myAssembly.dll /keyfile:sgKey.snk /platform:x86
The publisher policy assembly must match the processor architecture of the assembly that it applies to. Thus, if your assembly has a ProcessorArchitecture value of MSIL, the publisher policy assembly for that assembly must be created with /platform:anycpu. You must provide a separate publisher policy assembly for each processor-specific assembly.
A consequence of this rule is that in order to change the processor architecture for an assembly, you must change the major or minor component of the version number, so that you can supply a new publisher policy assembly with the correct processor architecture. The old publisher policy assembly cannot service your assembly once your assembly has a different processor architecture.
Another consequence is that the version 2.0 linker cannot be used to create a publisher policy assembly for an assembly compiled using earlier versions of the .NET Framework, because it always specifies processor architecture.
3. Adding the Publisher Policy Assembly to the Global Assembly Cache
  • Drag the policy dll to GAC or do it using gacutil command from console
  • Make sure that the publisher policy assembly cannot be added to the global assembly cache unless the original publisher policy file is located in the same directory as the assembly.
Anugrah Atreya