Op Manager

September 4, 2019


I have been working on website/Application development for many years. This tool is really helpful, there are a lot of tools that provide these features. It is up to us to choose which one to use. 

What we made with this tool looks awesome.




We had a TV in our development team space and we project these graphs on the TV. It looks awesome. Anyone who comes to the room can tell how the production servers are doing.

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)">

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 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.

This is something which all the clients ask you when you are working for a small firm or when you work as an Independent freelancer. Do we have an answer for this ? Really ya... Any way from 100$ to ~(Infinity). In my experiences I have been in all the places. Working for a forture 500 where they spend millions of $ developing site to the best way possible. I also worked for small clients where I could complete developing a site in a day or 2. So it is kind of tricky to answer this Question. when I was hit with this Question I used to ask "what kind of budget are you looking at ?" This was giving a wrong impression to the clients who has no Idea how to develop a website because they thought i was trying to get as much money as I can but really I was not. Then I started answering the question a bit differently. I was amazed to see the responce. I will tell I can get something up and running for 100$ then some of the clients are a bit relectent to appeciate my skills. To be Frank there is no real answer to this Question. You can develop a site in any amount of $. I created my site up and running in 2 days then it was all about writing the content periodically. How much google spend to keep their site up and running.. ? Most of the people dont know what they need so we have to give some idea to educate them with what they need based on their busineess needs. This is too broad an area. you can go with 10$ hosting from godaddy or have a dedicated load balenced server farm. Who needs what is so important.


I used to talk to a lot of people in this area to get an idea of what we should be looking for.?


1) Are we making any profit from the site which is the key. If we are making a 1000$ a day trust me 10$ hosting with godaddy is not enough. some will argue yes we can then it comes to what is right and what is not right.

2) No of users is another key factor. 

3) what kind of data are we showing also matters. Privacy , Size of data etc, I can go on like this for another 2-3 hours.

Best thing I will say is talk to as many people as you can and gather as much details as you can and think a bit about the future plans before you decide on something.




Mvc overview.

December 9, 2011

It is pretty cool. I got my hands dirty developing sites in Mvc. So I thought I will write my initial feel of it. Everyone will say it is pretty cool. Is it like buying a new Ipad, Could be.. The best part of it is the ajax and the javascript libraries that make it pretty nice. Going forward I feel we don’t need much c# or vb.net, I feel if we can connect to db from javascript. I never tried that area though. The reason I was telling this is we can create a grid in javascript and likewise pretty much anything so that is cool right if you know javascript or some of it libraries.

Let me get to mvc now. The different types of view engines, granular control over the html we are creating. Friendly Url’s and now we don’t need the pageload getting called again and again for all postback and we don’t need to check Ispostback == true etc..  The get and post request are going to call different methods so that overload of interpreting the same code again and again will not be there.

Is it  like vb or asp now ? Where we write the code in-line with the html yes it is and it makes me feel that are we going to a better version of vb or asp. If you ask someone who has seen the technology coming and evolving you will know. It is like a vicious circle. We involve improve and start doing things which we did 10 years back and think it is pretty new.. is it ..ya..na..yaa could be… separation of concern is something which was pretty cool. Like a company where there are process and procedure and teams and tasks and each one is supposed to do certain things. I mean controller is person who calls the model and get data but don’t ask him how the data is going to be presented to the user. It is pretty nice for large scale development where I can create a model and controller which out even creating the view and some other team can work on the views. (UI guys) who are extremely good at user interface and the guys who are extremely good at building frameworks or writing business rules can concentrate on that.

Come on people no more pageload() and ispostback()..

Then I asked myself what are the disadvantages of using MVC over webforms. Umm..You know what now you cannot drag and drop a grid view control and assume everything is done for you. You need to write your own code. That suckes..but you can build more controlling and custom UI but you need to be good at UI because you have to do everything.

See some of the site I worked on



Basics of encryption

December 28, 2010

Why do we need encryption ? There will be lot of reasons.

I just want to specifically talk about encrypting Database values. We don't want the administrators to figure out the content in the database by doing a simple select query. What values do we encrypt ? Mostly password , credit card info etc.

How do we encrypt ? I am using c# and .net framework to explain this process.

This is all we need to do. we need to convert the specified string into bytes. we need to use some kind of hashing algorithm to do the encryption. The easily available one are "Rijndael","TripleDES","RC2","SHA512". Then it is a couple of lines of code.

HashAlgorithm h = HashAlgorithm.Create("SHA512");

ret = Convert.ToBase64String(h.ComputeHash(bytes));

Best way to check for user authentication when the password is encrypted.

Read the existing encrypted password in the database and then check it with the user entered password but please encrypt the user entered password before you do a compare so that the values can be equated if both of them are equal. you know what to do..