Quick Q-And-A

Q: What would you do, if you are administering a website, when your website is loading slowly?
A: When you visit a Web site, your browser sends an HTTP request for each resource and receives an HTTP response from the server with the requested content. Inspect each HTTP request and response to what exactly is being transmitted from the server to the client when a request for an underperforming page is visited. Maybe there is a very large CSS or JavaScript file being shuttled back and forth, or maybe the image background size is too large.
A: Go to fiddlertool.com

Q: What is the difference between IComparable and IComparer?
A: IComparable can be realised by a class that is comparable e.g. realise IComparable in a car class with a model and a collection of cars to be sorted by model. IComparer can be realised by a "Comparer" class that can compares two objects with a unique comparison method e.g. realise IComparer in CarYear class and have a List.Sort(IComparer) of cars or construct SortedDictionary<TKey,TValue>(IComparer) of cars to sort the the collection using the CarYear class.
A: IComparer.Compare(a,b) method expects to return: return value < 0 : a is less than b, return value = 0 : a is equal to b, return value > 0: a is greater than b.

Q: I want to perform an interop service (e.g. set focus on, disable control) on a running process instance (i.e. another running application) in Windows. How do I do that?
A: Interop services often uses a handle pointer to point to the target application. use .NET's System.Diagnostics.Process class and static methods to obtain the required details of the process instance and use these details in the interop methods.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License