Tuesday, November 29, 2016

Configuring an Executable to Run as a Service on Windows Server?


Windows NT Resource Kit provides below two utilities that allow you to run an executable as a service

Instrsrv.exe
Srvany.exe
 

More details regarding the same can be found at the below links.


Wednesday, October 26, 2016

Deploy/Use assemblies which require Unsafe/External Access with CLR and T-SQL


I believe, I don’t have to write anything more, instead redirect you to the below fantastic blog which explains the same in detail
.

Wednesday, September 28, 2016

How to Cast int to enum and back in C#?

How to Cast int to enum and back in C#

To cast an int to enum just do the bellow

MyEnum foo = (MyEnum)myInt;                        

To cast to enum from a string value do the below


MyEnum foo = (MyEnum) Enum.Parse(typeof(MyEnum), myString)

Tuesday, September 27, 2016

How do I convert byte[] to stream in C#?

The easiest way to convert a byte array to a stream is using the MemoryStream class:

Stream stream = new MemoryStream(byteArray);

Thursday, June 30, 2016

How to ignore certificate errors while debugging...


While debugging we use to come across certificate errors when talking to other sites. One of the solution to ignore these certificate errors while debugging is to add the below code as first statement in Program.cs  

 

ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;



 


Tuesday, January 12, 2016

The timestamp syntax is deprecated, use rowversion instead

The timestamp syntax is deprecated. This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.


Have a look here https://msdn.microsoft.com/en-us/library/ms182776.aspx