Skip to main content

Posts

Reducing flicker, blinking in DataGridView

One of my project requirement was to create a Output Window similar to Visual Studio. For that I used a DataGridView. But when I start my application , I found that there is lot of blinking, flicker, pulling... After badly hitting my head with google, I found a very easy way. We just need to create a extension method to DataGridView and it's all done: public static void DoubleBuffered(this DataGridView dgv, bool setting) {     Type dgvType = dgv.GetType();     PropertyInfo pi = dgvType.GetProperty("DoubleBuffered",           BindingFlags.Instance | BindingFlags.NonPublic);     pi.SetValue(dgv, setting, null); } CodeProject

Overview of CDN

CDN (Content Delivery Network) A computer network which has multiple copies of data stored at different points of the network.   The end user connected to a CDN will access the data from the nearest server (middle) instead of connecting to a Central server.   Few of the applications include media distribution, multiplayer gaming, and distance learning.   The end user can be a wired or wireless unit, which tries to access the content. The middle servers (or several servers forming a cluster) store the images of the content from the central (main) server. They are located at the edge of the ISP network and may be geographically separated from each other. Elements of CDN Request: A request for a specific content (for e.g. a webpage) is made from the End user, which is redirected to the nearest image server. This is done by the use of a protocol known as Web Cache Communication Protocol (WCCP).   Distribution: Once the request is received, a di...

Improving application start up time having signed assemblies

I guess all are aware that signed assemblies need verification from CA. This verification can create panic, when certification authority is not present on the same machine. In that case, assemblies require internet access. Situation can be more problematic, if there is no internet or network access on that machine. In absence of network access .Net thread might timeout waiting to connect. This issue can be avoided by adding following setting in machine.config: <configuration>     <runtime>         < generatePublisherEvidence enabled="false" />     </runtime>  </configuration>

Security concerns with serialization

Serialization can allow other code to see or modify object instance data that would otherwise be inaccessible. Therefore, code performing serialization requires the SecurityPermission attribute from System.Security.Permissions namespace with the SerializationFormatter flag specified. The GetDataObject method should be explicitly protected to help protect your data.

Inner workings of Deserialization

Within the runtime, deserialization can be a complex process. The runtime proceeds through the deserialization process sequentially, starting at the beginning and working its wasy through to the end. The process gets complicated if an object in the serialized stream refers to another object. If an object references another object, the Formatter queries the ObjectManager to determine whether the referenced object has already been deserialized (a backward reference), or whether it has not yet been deserialized ( a forward reference). If it is a forward reference, the Formatter registers a fixup with the ObjectManager . A fixup  is the process of finalizing an object reference after the referenced object has been deserialized. Once the referenced object is deserialized, ObjectManager completes the reference. 

Limiting Threads in a ThreadPool

The ThreadPool class supports methods for setting the number of minimum and maximum thread in the thread pool. In most circumstances, yhe number of threads is the pool is set at optimum numbers. If you find that your application is being constrained by the threads in th thread pool, you can set the limits yourself. There are two types of situations where you will want to change the thread pool thread limits: thread starvation and startup thread speed. In thread-starvation scenario, your application is using the thread pool but is being hampared because you have two many work items and you are reaching the maximum number of threads in the pool. To set the high watermark of threads for your application, you can simply use ThreadPool.SetMaxThreads. In cases where the startup costs of using the thread pool are expensive, increasing the minimum number of threads can improve performance. The minimum number of threads dictates how many threads are created immediately and set to wait for ...

Deploying COM-Enabled Assemblies

Although an assembly can be created visible to COM, one should follow below guidelines to ensure that things work as planned: All classes must use a default constructor with no parameters. Any type that is to be exposed must be public. Any member that is to be exposed should be public. Abstract classes will not be able to be consumed. After these criteria are met, the assembly is essentially ready to be exported. There are two mechnisms to do so. One can use VS or a command line utility(TlbExp.exe). First you need to compile the type through Visual Studio's build mechanism or through command line compiler as               csc /t:library ComVisiblePerson.cs Next you need to use Type Library Exporter Utility. This should be done from VS command prompt:               tlbexp ComVisiblePerson.dll /out:ComVisiblePersonlib.tlb Next oyu need to create ...