Skip to main content

Posts

Problem with Primary key as an Integer

We all know that any good database design has a unique primary key. Now point is how to decide, whether our primary key should be integer or not ? Well, primary key as an Integer works well with local systems and easy to use and also works great while writing manual SQL statements. But what if one is not working on local system and working in a distributed environment where one has to deal with replication scenarios. In such scenarios, Integers can't be primary key as they have state (sequencing) and can become a major security threat. Now here system demand for something unique apart from integers. And here comes GUID into picture, which provides globally unique id. You might be thinking that, is it a good choice to use 16 bytes of primary key instead of 4 bytes, then my answer will be definitely YES only when sync'ing is required. Using GUID as a row identity feels more truely unique and databse guru Joe seems to agree. But again performance issues arises in various scenarios

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 distribution element

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.