Wednesday, April 11, 2018

Uncaught typeerror: cannot read property 'msie' of undefined | Solution

Solution 1


 Downloaded jquery-migrate.1.2.1.js and referenced that file in the error page  

Solution 2

Copy the code below to the page

 <script>  
 jQuery.browser = {};  
 (function () {  
 jQuery.browser.msie = false;  
 jQuery.browser.version = 0;  
 if (navigator.userAgent.match(/MSIE ([0-9]+)\./)) {  
 jQuery.browser.msie = true;  
 jQuery.browser.version = RegExp.$1;  
 }  
 })();  
 </script>  


Sunday, January 7, 2018

Encrypt and Decrypt string using SQL

Sample Code


 Declare   
 @myData nvarchar(max) = 'My data',  
 @seqKey nvarchar(20) = 'UniQKey07x@a',  
 @encryptedData varbinary(2000)  
 set @encryptedData = EncryptByPassPhrase(@seqKey, @myData)  
 print @encryptedData  
 print convert(nvarchar(max),DecryptByPassPhrase(@seqKey, @encryptedData ))--Decrypted data  

Output

 0x010000008076CB00D6FB7820D77D4B9C3768D596BA1812019E4CFCAEF9B190DAD462A3E3  
 My data  

Encrypt And Decrypt String Without Using Special Character In C#

Encrypt


 public static string Encrypt(string plainText)  
     {  
       try  
       {  
         System.Text.Encoding encoding = System.Text.Encoding.Unicode;  
         Byte[] stringBytes = encoding.GetBytes(plainText);  
         StringBuilder sbBytes = new StringBuilder(stringBytes.Length * 2);  
         foreach (byte b in stringBytes)  
         {  
           sbBytes.AppendFormat("{0:X2}", b);  
         }  
         return sbBytes.ToString();  
       }  
       catch (Exception tx)  
       {  
         return "0";  
       }  
     }  

Decrypt


  public static string Decrypt(string encryptedText)  
     {  
       try  
       {  
         System.Text.Encoding encoding = System.Text.Encoding.Unicode;  
         int numberChars = encryptedText.Length;  
         byte[] bytes = new byte[numberChars / 2];  
         for (int i = 0; i < numberChars; i += 2)  
         {  
           bytes[i / 2] = Convert.ToByte(encryptedText.Substring(i, 2), 16);  
         }  
         return encoding.GetString(bytes);  
       }  
       catch (Exception ex)  
       {  
         return "0";  
       }  
     }  

Wednesday, October 18, 2017

Show all Date Time Formats in Sql Server

SQL Query
 DECLARE @i int=0  
 L1:  
 IF @i<200  
 BEGIN  
      BEGIN TRY  
           print convert(nvarchar(max),@i+0) +'. ' + convert(nvarchar(max),getdate(),@i)  
      END TRY  
      BEGIN CATCH  
      END CATCH  
      SET @i = @i + 1  
      GOTO L1  
 END  

Output
 0. Oct 19 2017 10:30AM  
 1. 10/19/17  
 2. 17.10.19  
 3. 19/10/17  
 4. 19.10.17  
 5. 19-10-17  
 6. 19 Oct 17  
 7. Oct 19, 17  
 8. 10:30:56  
 9. Oct 19 2017 10:30:56:513AM  
 10. 10-19-17  
 11. 17/10/19  
 12. 171019  
 13. 19 Oct 2017 10:30:56:513  
 14. 10:30:56:513  
 20. 2017-10-19 10:30:56  
 21. 2017-10-19 10:30:56.513  
 22. 10/19/17 10:30:56 AM  
 23. 2017-10-19  
 24. 10:30:56  
 25. 2017-10-19 10:30:56.513  
 100. Oct 19 2017 10:30AM  
 101. 10/19/2017  
 102. 2017.10.19  
 103. 19/10/2017  
 104. 19.10.2017  
 105. 19-10-2017  
 106. 19 Oct 2017  
 107. Oct 19, 2017  
 108. 10:30:56  
 109. Oct 19 2017 10:30:56:517AM  
 110. 10-19-2017  
 111. 2017/10/19  
 112. 20171019  
 113. 19 Oct 2017 10:30:56:517  
 114. 10:30:56:517  
 120. 2017-10-19 10:30:56  
 121. 2017-10-19 10:30:56.517  
 126. 2017-10-19T10:30:56.517  
 127. 2017-10-19T10:30:56.517  
 130. 29 محرم 1439 10:30:56:517AM  
 131. 29/01/1439 10:30:56:517AM