How to Improve life ?

January 4, 2019

As 2018 comes to an end these are the lessons I learned on the way, which will take me forward in 2019.  


1: Make small changes that are sustainable long term.

2: Buy time back by spending money. e.g Live close to work or work from home.

3: Find all the things you want to improve in life and pick one to work on.

4: Always have a balance in everything you do.

e.g - Health, Wealth, Happiness.

5: Learn to say no to distractions in life.

6: Give back to the community in any way possible.

7: Know that everything will pass and everything is temporary, even life.

8: Make yourself happy.

9: Learn, Learn, Learn - The more you know, you realize the more you don’t know. 

10: Always reflect on life and everything you do. 

(“ Always know the why, of what you are doing ? ”)

11: You need to make space for new things to come in life, which means you may have to remove some of the old habits or things. 

Insurance for earnings.

November 6, 2018

My insurance looks like this. It is a good one.

Time to allocate. -- 10 hours a month. 

1) Keep good contacts and relationships with the people you work with. - 3 hours.

2) Study the latest technologies - 4 hours.

3) Write a blog once a month. - 1 Hour.

4) Be good at programming and logical reasoning. - 2 hours 

I am working with Visual Studio 2012 (Premium edition). I was using spring.dll and it needs some .xml files in the bin folder. When I was publishing to the dev server it was not copying the .xml files. Then I had to make this change so that it will copy all the files.


Please see the 2 sections required in the .csproj file.

Section 1
Section 2
<Target Name="CollectAllBinFiles">
               <_CustomFiles Include="bin\**\*" />

               <FilesForPackagingFromProject  Include="%(_CustomFiles.Identity)">

Partition By in Sql server.

August 13, 2015

I thought this was cool.

I had to add a sort order for a list of unique id's in a table.
It is like a Group by. Otherwise, I had to loop through each of the records using a while loop.
INSERT INTO dbo.CommunityLists (ListCategoryId, SortOrder,CommunityId ,
LastUpdatedBy,LastUpdated )
5 ,
 as Sortorder ,
CF .CommunityID,
CF .FeatureText,
1 ,
      dbo .tbl_CommunityFeatures CF;

1) Certainty.

2) Un-certainty.

3) Significance

4) Love and Connection

5) Growth

6) Contribution.


1) Certain that I have a job. Certain that this person will be there for me.

2) Un-certainty or variety in life, do something new in life, go somewhere you have never been.

3) Significance, I feel significant that I am good at what I do. People appreciate my good work.

4) Love and connection. People love me for who I am, I have friends.

5) I grow as a human being. I learn something new every day and I become a better person.

6) Give back what you know. Share your knowledge.

These are the 6 human needs, but each of us weighs them differently, for some the most important need can be “significance” for some it is
“love and connection” for some it is a “certainty”. It also changes as we grow in life. In the end, the most important need should become “growth and contribution” because that change who you are. It is not what you have, it is who you become that matters.

Parallel programming in .net.

 Collection<DataSet> comms = new Collection<DataSet>();
                     var sp1 = new Action(() =>
                           {comms = MarketingWebsitesDataManager.GetMarketingCommunities(BuilderCode, 1);
List<IAttachment> Attachmentsnew = new List<IAttachment>();
                     var sp2 = new Action(() =>
                                  Attachmentsnew = MarketingWebsitesDataManager.GetMarketingProductAttachmentsReader(BuilderCode, 1);

System.Threading.Tasks.Parallel.Invoke(sp1, sp2);

Both of these methods will be called at the same time. This will improve performance. 

Can be used if the param we are passing to method 2 is not getting changed in method 1.

or if the returned data from method 1 is not used in method 2 then we can use this.

This is part of .net 4.0

Concepts to remember. 

1) Sql is faster in getting the data.

2) .net is faster in processing the data.

3) When you select the data from the db. No of columns and rows matter because the size of the data getting transferred or read from the disk varies if the data is big.

4)It is better to convert the data from the reader to Bo than putting the value in a dataset and then converting it into Bo.

I was getting to a stage in life where it was hard for me to manage passwords and I started clicking “forgot password” which sends an email each time I had to log into an account.

A friend suggested me to use Pass keep. Woow. I have to say it is cool.

Makes my life a lot better. No more forgot password.


It took me some time to get this setup and enter all the password but once it is set up it is cool. It works like a charm. I have this password file in google drive and it syncs to the cloud.


There is a key file that is on my local computer to keep the password file safe.

I am happy. I like the Autotype feature of Kee pass. It is a lifesaver.

There is also a browser plug-in called "Kee Fox". Which enabled me to click a link to go to the site and log in.


If you are ready to spend some extra money on this use 1password my friend is using. He is happy with this. I am using Keypass. It is free but it is not that clean. I would recommend you buying 1password. I already entered all my data to kee pass so it will take a bit of effort for me to change to 1password.

I was under the assumption that looping was really bad. The more loops the worst the performance is.


I had 3 collections.


Let’s say communities, Products, and attachments.

Each community has products and each product have attachments.

We had like 600 communities with close to 10 products and each product has like 12 attachments.


We had the communities and products build. We had like 11,000 attachments which we had to add to the products.

We were looping through the 6000 community products and in each of the loop, we will loop through the 11,000 attachments.

It was taking like 23 seconds.


What we did was, we used Dictionaries with a key and an attachments collection.

In dictionaries, keys are stored in Hash.





0               34 - abc                             1000 - Hashcode

                     34 - cdf


We build a dictionary of attachments with the key and the real attachments.


var attachDict = new Dictionary<string, List<IAttachment>>(StringComparer.Ordinal);


We build this collection by looping through the attachments.


foreach (var attach in Attachments)


             var key = (attach.ModelId + attach.BuilderCode.Trim()).ToUpperInvariant();

             List<IAttachment> attachments;


             if (attachDict.TryGetValue(key, out attachments))






                 attachments = new List<IAttachment>();


                 attachDict.Add(key, attachments);





Then we looped through the communities and products and add the attachments where the key matches.


  foreach (var c in communities)


             foreach (var prd in c.MarketingProducts)


                 var key = (prd.MarketingProductId + c.BuilderCode.Trim()).ToUpperInvariant();

                 List<IAttachment> attachments;

                 if (attachDict.TryGetValue(key, out attachments))


                     prd.Attachments = new Collection<IAttachment>(attachments);






After making this change the query runs in < 1 sec.


Sql - Please use distinct only when it is really required. When we use distinct it will copy the row to another temporary location to do a comparison

and see whether in the result set it exist, If it exists, it will skip that row otherwise it will add to the result set.

We as human beings judge people a lot by looks, what we wear etc...In animals, cats are not like humans they won’t judge by looks, like what color the other cat is like Grey, black, has strips etc. They sense it. The only animal in the world who will go and do massacre is human beings. Lions will not go and say let’s kill all the deers u know. They will kill one eat one. So we are different in the way we think.

People tell us what to do early in our life and we will do what they say, forget about what we really want or what we really are. We follow their template.Most of the people in the world follow a template for life. Like study well, go to good college, marry a guy, have a kid, raise them etc. There are people who are not like that too, they are just different.

We have to be happy with what we have. It is hard for human beings because we always want a better job, more money etc. we forget to live in the present and always looks for either the past or the future. We will always be more happier when we don't try to change the way people think and try to change the way we think. It helps us.

The girl I am dating/Married to can do what she wants, but my thoughts are going to be in my control. I need to change the way I think. whatever she does. I don't care. I will try to control the way I think and I will be fine. Even if I lose the job or loose the house or anything. My thoughts have to be in my control.

I cannot break down. I am going to work on it. Whoever "stays still without breaking" are those who are stable, no matter what happens to them.


Now I do whatever I want, when I want. I am like the guy who don't care, I join a new  gym when I want, as soon as I don't like the old gym.  That is good for some time, when we really grow in life is learn to accept that it is a stage in life and enjoy it. There is a point in life when we will be bored of it. I am not there yet but for sure I will be one day. Then I am and I will be, willing to share a life with someone. That is a stage when you grow more, when we are pushed to a corner and accept it. We don't respond because we learn to deal with it and be stronger. That is the point when we make changes in our life to accept other person, we don't change other person. we make changes in our life because it is easier and that is all we have to do.

Always don't forget Light always wins over darkness.

This is something which I was thinking of writing for a long time.

·         Did we go to gym and see guys who train only their arm and chest?

·         Do we see guys who have tiny legs and big upper body?

·         Why do this happen?

·         Did we ever train our lower back?


There are couple of reason why guys work out. They need big arms. They need big chest.

If that is only the goal then, fine you guys are good but you know what if there is no symmetry. You are like the kid who went to community college. It does the job. Is that what we are looking for or do we need to be like an Ivy League.

1) Health is wealth.

2) The muscles we develop need to be in proportion. The symmetry is everything.

How do we do that?

1) This is not something you can achieve in a day. No matter what. This needs to be a lifelong habit and gradually over the years you will become healthy and build.

2) I know guys who cannot walk 10 stories but they have huge arms. Is that any good?

There comes cross fit.

1) If you need the stamina of a runner and if you need the power of a power lifter. You are in good hands “cross fit” will do the job. Then some guys will say I want to be a bit built also then work out on your normal body building stuff 1-2 days a week. Rest should be cross fit or basically what I am saying is it should be a full body work out. You need to work you whole body. Pump your heart to the max and then so some strength exercise.

Eating health is another thing. None of this is possible without that. Do all the outdoor stuff? Stay active. If you can do some running or swimming etc. it is great.

Trust me guys there are guys who are so healthy like I know a person who is 57 but if I see him for the first time I will surely ask him whether he is 35. Working-out plays a big role in your life.