Posts

Showing posts from 2016

Convert the number to words in C#.NET

Convert the number to words in C#.NET: public static string NumberToWords(int number)         {             if (number == 0)                 return "zero";             if (number < 0)                 return "minus " + NumberToWords(Math.Abs(number));             string words = "";             if ((number / 1000000) > 0)             {                 words += NumberToWords(number / 1000000) + " million ";                 number %= 1000000;             }             if ((number / 1000) > 0)             {                 words += NumberToWords(number / 1000) + " thousand ";                 number %= 1000;             }             if ((number / 100) > 0)             {                 words += NumberToWords(number / 100) + " hundred ";                 number %= 100;             }             if (number > 0)             {                 if (words != "")                  

SQL Server String Manipulations

SQL Server String Manipulations: We can use simple regular expressions for "LIKE" to filter as wild card characters.We can use [0-9] for digits and [a-z] for characters. Eg: to filter a 4 digit ZIP code we can use " where ZIP like '[0-9][0-9][0-9][0-9]'"       to filter the string that starts with digit we can use " where name like '[0-9]%'" Like same, we can use ^ for the not match condition and _ for matching one character condition. Eg: to filter names that don't start with p then we can use " where name like '[^p]%'"       to filter names that end with ir then we can use " where name like '_ir'" We can find the index of any character in a string expression with CHARINDEX function. To find the last index of any character, we can use the below... datalength(filename)-charindex('.',reverse(filename),1)

How to enable SSL for IIS Express for DEV env in Visual Studio

Image
How to enable SSL for IIS Express for DEV env in Visual Studio: For already developed projects, after we download it from TFS, if the SSL is enabled, then we need to configure the SSL for IIS Express manually with a self signed  certificate. First, we tell IIS Express to enable SSL for the required site that has been configured on a specific port. eg: https://localhost:44037 The command for the above is as below... cd C:\Program Files (x86)\IIS Express IisExpressAdminCmd.exe setupsslUrl -url:https://localhost:44037/ -UseSelfSigned  After we run the above command for the required sites to be run on SSL, we start running the application. Initially, ASP.NET will ask you to create a self signed certificate for the localhost. After accepting it, a self signed cert will be created under the Local Computer account of the cert store. This cert will be used for the IIS Express to work on SSL. Later you need to tell IIS Express to trust this certificate for the application to run.