Skip to main content

Posts

Computer performance & Clock speed

Many people use clock speed as a measure of a computer’s total computing power, but that term can be very misleading for a couple of reasons. The computer keeps all its devices synchronized by using its clock. This isn’t a regular clock—it’s a “clock in a chip,” which keeps highly accurate time and ticks much more rapidly than a wall clock. The faster the computer’s clock ticks, the more quickly the device can move on to a new task. The central processing unit  needs a certain number of clock ticks to  execute each of its instructions. Therefore, the faster the clock ticks (that is, the “clock speed”), the more instructions the CPU can execute per second.  However, that’s not the end of the story. Different processors use different instruction sets, each of which can require a different number of ticks. That means different kinds of processors may execute different numbers of instructions per second, even if they have the same clock s...

Laptops vs Notebooks vs Netbooks vs Tablets

A laptop is a computer that is intended to run anywhere as it is portable. Laptops have integrated screens and keyboards and run on batteries. Heavy use to some hardware such as GPU, DVD drives can quickly drain the batteries. Laptops have a touchpad, pointing stick, trackball, or other pointing device. Nowadays, we can add external devices like mouse, keyboard etc. Notebooks are stripped-down laptops. They are thin and have relatively small screens and are ultra-light. They rarely have CD-ROM or DVD and also have very limited graphics capabilities. As notebooks doesn’t have external media (DVD, etc), they typically have integrated network connection hardware so one can load software on to them. Network hardware can be used to access the internet. Netbooks are even more stripped down than notebooks. They typically have less powerful processors and are primarily used for networked applications as web browsers, where most of the processing happens on a remote server. A tablet is simi...

WPF: Significance of x:Key attribute

Each object declared as resource must set x : Key property. This property will be used by another elements to access the resource. But for Style objects, there is an exception. Style objects that set the TargetType property do not need to set x : Key explicitly because it is set implicitly behind the scenes. Scenario1: When x:Key is defined < Style x : Key ="myStyle" TargetType ="Button">       < Setter Property ="Background" Value ="Yellow"/> </ Style > In above example, x : Key property is used, so, style will be visible on Button, only when Style property is used explicitly on element, as shown in below snippet: < Button Style ="{ StaticResource myStyle }" Width ="60" Height ="30" /> Scenario2: When x:Key is not defined < Style TargetType ="Button">     < Setter Property ="Background" Value ="Yellow"/> </ Style > In above exam...

WPF: StaticResource vs DynamicResource

Logical resources allow you to define objects in XAML, which are not part of visual tree but can be used in your user interface. One of the examples of logical resource is Brush, which is used to provide a color scheme. Generally those objects are defined as resource, which are used by multiple elements of the applications.    < Window.Resources >         < RadialGradientBrush x : Key ="myGradientBrush">             < GradientStop Color ="Green" Offset ="0"/>             < GradientStop Color ="Blue" Offset ="2"/>          </ RadialGradientBrush >            </ Window.Resources > Now, above declared resource could be used as either static or dynamic resource. One point to remember is that, when using static resour...

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