Git lesson: cherry-pick command (possible in VS2015)

How many of you have been used cherry-pick in Git?

Cherry picking in git means to choose a commit from one branch and apply it onto another.

git cherry-pick <commit-hash>

Official documentation: https://git-scm.com/docs/git-cherry-pick

Visual Explanation: http://think-like-a-git.net/sections/rebase-from-the-ground-up/cherry-picking-explained.html

It is convinient way to copy changes from previous commit  in Visual Studio 2015

vscherrypick

Advertisements

List of All C# Collections. Use the right one.

There are a lot of types of built-in collections in C#:

Array, ArrayList, BitArray, BitVector32, Dictionary<K,V>, HashTable, HybridDictionary, List<T>, NameValueCollection, OrderedDictionary, Queue, Queue<T>, SortedList, Stack, Stack<T>, StringCollection, StringDictionary.

Consider what collection will be the optimal for the specific case. It will likely result in better performance and less room for error. For example if you want to store items as key/value pairs for quick look-up by key, so the best choice will be Generic.Dictionary<TKey, TValue>.  If you want to use items first-in-first-out (FIFO), go on Generic.Queue<T>. If you going to access elements by index frequently, go on System.Array if it’s non-generic Elements, but the best option will be Generic.List<T>, if you store elements of type T only. If you frequent action is access items sequentially, better choose Generic.LinkedList<T>.  There are a lot more considerations. More information can be found here:

My 3 recommendations. Don’t start to write your own collection class, .NET provide a large variety of existing classes, which you can you use or extend. Think about what actions will be applied on Collection more often. And Generic collections are always preferable than  non-generic.

Web Service || WCF || Web Api …What to choose?

Serious Web Services: Windows Communication Foundation (WCF), Web API, OData, and More

https://channel9.msdn.com/Events/TechEd/NorthAmerica/2013/DEV-B209#fbid=

 

http://www.codefoster.com/webservicesforward/

http://stackoverflow.com/questions/9348639/wcf-vs-asp-net-web-api

http://stackoverflow.com/questions/9778665/wcf-vs-asp-net-web-api/9859981#9859981

https://www.captechconsulting.com/blogs/aspnet-web-api-vs-windows-communication-foundation-wcf

 

https://msdn.microsoft.com/en-us/library/jj823172(v=vs.110).aspx

IIS processing of HTTP request

Working with .Net applications deployed on IIS now, I decided to refresh memories about IIS architecture. It can be helpful to any .NET developer.

IIS 7 and above have a similar HTTP request-processing flow as IIS 6.

Here is the diagram, with steps explanation below it.

introduction-to-iis-architecture-101-overviewofhttprequest0.

  1. When a client browser initiates an HTTP request for a resource on the Web server, HTTP.sys intercepts the request.
  2. HTTP.sys contacts WAS to obtain information from the configuration store.
  3. WAS requests configuration information from the configuration store, applicationHost.config.
  4. The WWW Service receives configuration information, such as application pool and site configuration.
  5. The WWW Service uses the configuration information to configure HTTP.sys.
  6. WAS starts a worker process for the application pool to which the request was made.
  7. The worker process processes the request and returns a response to HTTP.sys.
  8. The client receives a response.

In a worker process, an HTTP request passes through several ordered steps, called events, in the Web Server Core. At each event, a native module processes part of the request, such as authenticating the user or adding information to the event log. If a request requires a managed module, the native ManagedEngine module creates an AppDomain, where the managed module can perform the necessary processing, such as authenticating a user with Forms authentication. When the request passes through all of the events in the Web Server Core, the response is returned to HTTP.sys.

Diagram 2, below, shows an HTTP request entering the worker process.introduction-to-iis-architecture-101-httprequestworkerproc

It’s just a small piece of  IIS architecture.For more information about IIS go to Introduction to IIS