Friday, 29 November 2019

Reverse string using Recursion and loop in c#

Method I. 

       ///// Call- ReverseString('abcdefg');

        //Recursion method; simple, for small strings 
        public string ReverseString(string str)
        {
            if (str.Length <= 1) return str;
            else return ReverseString(str.Substring(1)) + str[0];
        }

     ///// Result- ReverseString - gfedcba


Method II. 

       ///// Call- ReverseString('gfedcba', 0);

       //Recursion method; Need to starting index as 0,  for long strings
        public string ReverseString(string str, int Chrindex)
        {
            char[] chr = str.ToCharArray();
            int len = chr.Length;
            if (Chrindex < len / 2)
            {
                char c = chr[Chrindex];
                chr[Chrindex] = chr[len - Chrindex - 1];
                chr[len - Chrindex - 1] = c;
                Chrindex++;
                return ReverseString(new string(chr), Chrindex);
            }
            else
            {
                return new string(chr);
            }
        }

     ///// Result- ReverseString - gfedcba
Method III.

       ///// Call- ReverseString('abcdefg');

        //Using Another array, need to traverse full array. 
        public string ReverseString(string str)
        {
            char[] chr = str.ToCharArray();
            char[] result = new char[chr.Length];
            for (int i = 0, j = str.Length - 1; i < str.Length; i++, j--)
            {
                result[i] = chr[j];
            }
            return new string(result);
        }

     ///// Result- ReverseString - gfedcba

Method IV.

       ///// Call- ReverseString('abcdefg');

      //Using swap method; need to traverse only half of the array. 
        public string ReverseString(string str)
        {
            char[] chr = str.ToCharArray();
            for (int i = 0, j = str.Length - 1; i < j; i++, j--)
            {
                char c = chr[i];
                chr[i] = chr[j];
                chr[j] = c;
            }
            return new string(chr);
        }

     ///// Result- ReverseString - gfedcba


Thursday, 21 November 2019

Visual Studio always opening a new browser window for ASP.NET MVC application

//////////////// Process

Step 1. Open Visual Studio go to -

       Go to Tools ->Options -> Debugging -> General -> 
          
Unchecked the : Enable JavaScript Debugging for ASP.NET (Chrome and IE) 



Wednesday, 20 November 2019

Get the list of created and / or modified on a operations in sql server

/////////////////////


SELECT * FROM sys.procedures WHERE create_date > '20191110'  ---Particular for the procedure

SELECT * FROM sys.tables WHERE create_date > '20191110'  ------Particularfor the table

SELECT * FROM sys.views WHERE create_date > '20181110'   ------Particular for the View

SELECT * FROM sys.table_types                       -    ----- Particular for the table type

---Get All operated type

SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE CREATED > '20191010' 

---Get All operated type

SELECT * FROM sys.objects WHERE DATEDIFF(D,modify_date, GETDATE()) < 7  



/////////////////////////////////

Wednesday, 6 November 2019

Get List tables in MS Access database

///////// Query



select MSysObjects.name
from MSysObjects
where
   MSysObjects.type In (1,4,6)
   and MSysObjects.name not like '~*'  
   and MSysObjects.name not like 'MSys*'
order by MSysObjects.name



//////////Result/////////

                               

How to highlight selected text in notepad++

  –> To highlight a block of code in Notepad++, please do the following steps step-1  :- Select the required text. step-2  :- Right click...