Monday, November 25, 2019

Teaching Kids or Coaching Kids

It was writing time or more to say a struggle time with my son to make him a better writer. His 5th grade teacher gave him an assignment to write about something of his interest using punctuation. My sons with his turbulent thoughts and racing mind raked the sentence without proper punctuation and just want  to get out of the writing captivity.  I wonder why the parents have to struggle with kids to educate the kids especially writing or solving problem while the kids are becoming rebellious to it. Is the system to be blamed or ourselves. Probably nothing is working for us as parents and he is diagnosed with ADHD. What is the utility value of forcing a child who is not interested in writing with a kid of average intelligence. The compass of internal motivation or inherent thrist is always the predictor of being good at anything. The school system which mass manufacture students and torture in the name of creating a career  for the kid is partly to blame for such a disaster and merciless crushing of the young soul. Education is important  but how to pursue it especially in this age of complex layers of knowledge and internet is a different challenge than 19th century education system. This complex problem requires different customized approach catered to the need and ability of the children. There are children who are going to be brilliant and excel academically so those children has to be nurtured properly and differently since they are the jewels and probably the people who will shape the society in STEM or political endevour. The other kids who are average but have different interest and intuition should be directed towards their intuition and capability and make the process of education as enjoyable as possible  with little instructions from the teacher. The process of discovery is what kindles a human being in the pursuit of knowledge and happiness.
How many of us in our career actually write at length and produce useful content for others to read and comprehend. Is it not our education system should to kindle the curiosity in children and encourage the process of self discovery about seeking the knowledge out of pleasure rather out of career captivity. This question has been asked countless times by people of various capacities but there is no proper political will or a solution in sight. This torture of bending the kids to assimilate them into this education system is the approach of showing light to the blind man. Rather blind man should be treated as a blind man and requires different set of approaches to develop skills that he is capable of. Every human being will contribute to the welfare of the society in any form. Agreed there  are some basic which every kid has to learn like number sense, basic vocabulary and critical reasoning which are indispensable skills and important to any endeavor the kids under take.
The root of all evil is one size fits all.  how do we teach these skills in a less painful way.
Every kids learn at their own pace. Every kid will reach their finish line but at their pace and will.
As we parents compare ourselves with other family on money, fame and wealth and not surprisingly we pass such dubious quality to our children without much effort. Kids learn by seeing and doing but not by saying. We brought them into this world in the process of being happy but we parent have a responsibility to protect our kids from this on slaught of educational system.


Friday, October 11, 2019

SQL Server Query to convert the List of strings into comma delimited string

The following code was fun to convert the list of strings into comma delimited string.
create table x(destinationTableName varchar(8000))
insert into table x('a')
insert into table x('b')
insert into table x('c')
insert into table x('d')
insert into table x('e')
insert into table x('f')

WITH expression_name (sequence,destinationTableName)
AS
(
    -- Anchor member
select cast(no as int) no,cast(destinationtableName as varchar(8000))+',' as destinationtableName from
    (select row_number() over( order by red_code) as no,destinationtableName from red_searchdomain where
  insertRecords =1) x
  where no =1
    UNION ALL
    -- Recursive member that references expression_name.
    select cast(y.no as int) no,cast(expression_name.destinationtableName+y.destinationtableName+',' as varchar(8000)) destinationtableName from expression_name
join (select row_number() over( order by red_code) as no,destinationtableName from red_searchdomain where
  insertRecords =1) y
  on y.no = expression_name.sequence+1

)
-- references expression name
SELECT substring(destinationTableName,1,len(destinationTableName)-1)
FROM   expression_name where sequence =(select max(sequence) from expression_name)

Wednesday, September 4, 2019

Permutation and Combination of Strings using Recursion

My program to generate combination of unique letters.  Given a string "ABC" the program will out put "ABC","ACB","BAC","BCA","CAB","CBA". I struggled with this program for a long time to come up with my own solution in c# which is so effective but satisfying. recursion are pretty amazing to train the brain. The problem with recursion if you go all the way down how it works you will loose the track and you get confused actually how it works. Let's say you have a problem and if you can come up with how you can divide a problem into one sub problem and solve it that's it you don't have go down the rabbit hole of visualizing how recursion works. 

public static void Permute(string s,string substr,string doNotInclude)
        {
            if(substr.Length==s.Length)
            {
                Console.WriteLine(substr);
               // ++counter;
                return;
            }
            for(int j=0;j<s.Length;j++)
            {
                if (doNotInclude.IndexOf(j.ToString())==-1)
                {
                    string result=s.Substring(j,1);
                    Permute(s,substr+result,doNotInclude+j.ToString());
                }
            }
               
        }

       Permute("abcdefgh","","");

Saturday, August 31, 2019

Recursion Generating Sub String Given a String.

I was hitting my hard for  the past 24 hours to generate sub strings out of a string. I am not particular ly good at programming(its a gift given to only few) but the kick to think hard enough about a problem is something fulfilling and satisfying. Here is the code below to generate sub strings out of a string in the order  of the string.

public class Program
    {
        static String OPEN_BRACKET = "{";
        static String CLOSED_BRACKET = "}";
        static String EMPTY_STRING = "";
        public static void Main(string[] args)
        {
            //Your code goes here
            Console.WriteLine("Hello, world!");
            recur("Operation",0,"",0);
        }
       
        public static void recur(String s, int index, String out1,int StartPos)
{
            if (s.Length==out1.Replace("{","").Replace("}","").Length)
            {
System.Console.WriteLine(out1);
                return;
            }


        int cntr=1;
for (int j = index;j<s.Length ; j++)
{
String sub_str = OPEN_BRACKET + s.Substring(StartPos, cntr)
+ CLOSED_BRACKET;
            cntr=cntr+1;
recur(s, j + 1, out1 + sub_str,j+1);
}
}
  }
}