Posts Tagged ‘Performance’

Today I faced some spyware attack on my machine and it totally controlled my machine where I can’t run any exe based program like browsers, installables, visual studio, cmd … etc

I struggled for some time and finally resolved it by doing following steps …

I tried to notice what process is running when I run any exe based program and I found it as nuk.exe. I tried to find the exe location thru process properties in task manager and then I killed all nuk.exe based processes. Later I have renamed the nuk.exe to nuk.exe.txt to stop it running on opening any exe based program. Later I deleted it.

After that I installed following spyware trail version software (Webroot SecurityAnywhere) from webroot and scanned the pc and removed threats.

After that I installed Advanced SystemCare Free software and cleaned up malware, registry, shortcuts, history and junk files.


1. Centralized event handling

This will be used in cases where we have a number of similar elements or structures on a page that share similar behaviour when a user-action is performed against them.

In JavaScript, there’s a known bubbling effect in the language so that if an element such as a link or button is clicked, that event is bubbled up to the parent, informing them that something lower down the tree has been clicked. We can use this effect to our advantage.

Ex: In following example we can bind click event to ul and can handle every li click separately with out binding different functions directly to each li. This will also improve performance by minimizing the DOM access for binding/unbinding and by avoiding the event handling for each element separately.

 <li class=’one’>One</li>
 <li class=’two’>two</li>
 <li class=’three’>three</li>
 <li class=’four’>four</li>
 <li class=’five’>five</li>

stateManager = {
    fly: function () {
        var self = this;
        $(‘ul’).unbind().bind(“click”, function (e) {
            var target = $(e.originalTarget || e.srcElement);
            if (“”)) {
            else if (“li.two”)) {
    handleLIOne: function (elem) {
        //Do your own implementation for first li element click
    handleLITwo: function (elem) {
        //Do your own implementation for second li element click

Use JavaScriptSerializer to convert JSON object to C# object and backwards. It is very useful to build AJAX based web pages for thinner network traffic and for better client side html computation …

using System.Web.Script.Serialization;

public class Employee
 public string Name { get; set; }
        public string Age { get; set; }
        public string ID { get; set; }

Employee oEmployee1 = new Employee { Name = “name1”, ID = “1”, Age = “5” };
Employee oEmployee2 = new Employee { Name = “name2”, ID = “2”, Age = “7” };
Employee oEmployee3 = new Employee { Name = “name3”, ID = “3”, Age = “8” };
List<Employee> oList = new List<Employee>() { oEmployee1, oEmployee2, oEmployee3 };

JavaScriptSerializer oSerializer = new JavaScriptSerializer();
string sJSON = oSerializer.Serialize(oList);
List<Employee> oNewList = (List<Employee>)oSerializer.Deserialize(sJSON, typeof(List<Employee>));
Response.Write(oNewList.Count + “”);

string sJSON2 = oSerializer.Serialize(oEmployee1);
Employee emp = (Employee)oSerializer.Deserialize(sJSON2, typeof(Employee));
Response.Write(emp.Name + “”);

Are you worried with query performance due to huge data in tables, use Table partitioning of SQL Server 2008. It’s easy and very useful.

You can partition data to different db data files stored in different hard disks on the server to increase parallelism with I/O. It’s been simplified in SQL Server 2008 compared to SQL Server 2005/2000. We can use wizard based or script based approach to create partitions on new or existing tables. Refer following links for more info.