Set the nocount on for better performance of Stored Procedure

Hi

When working with Database, the most difficult and important thing is to ensure that the database is as fast as possible. After a few year when the number of users in a database grow and the data also start to increase, the performance starts to slide down. At this point it is very difficult to optimize the database for better performance.

This is reason enough that we should keep the performance in our mind from the very early stages of database life cycle. This is not very easy to do because of many factors like changing nature of business, unthought changes in database etc. But there are a few generic tips that can be followed for better performance of the database.

Continued...

Multiple argument passed to a JavaScript Function at runtime

Hi

Today I as working with some JavaScript code and had a function where the number of parameters would change in the runtime. Actually I had to do a validation where the number of textbox to equate the value for. I wanted to pass the array of textbox to the function. 

But then I googled a bit and found a very nice feature of JavaScript which I had heard before. In JavaScript we can pass any number of parameter and get these parameter at run time.

JavaScript functions have a special property called arguments. these contain and array of the input parameters. we can use the length property of the array and loop through the parameters passed to the function. This enables the development of function where the number of parameters can change at runtime.

<SCRIPT Language="JavaScript">

function vikFunc()

{

Continued...

New Language feature in C # 3.0 Object Initializer

Hi

Another of the new language feature in the C sharp 3.0 is the object Initializer. Types within the .NET Framework rely heavily on the use of properties.  When instantiating and using new classes, it is very common to write code like below.

   Employee  employee = new Employee();
   employee.FirstName = "Vikram";
   employee.LastName = "Lakhotia";
   employee.Age = 24;

I know we can also create a constructor and pass the value as the parameters. But lets say we do not have any constructor.

With C# 3.0 the above code can be simplified an written like this.

Continued...

New GCCollectionMode in ORCAS

Hi

With orcas there is a new addition to the GC class. There is a new overload being added to the GC class Collect method. The new overload takes two parameters, int Generation and GCCollectionMode.

Here generation is the heighest generation to collect. The value can be anything between 0 and GC.MaxGeneration. Mode can be either default, Forced or Optimized. Default has the same effect as calling the GC.Collect without providing any mode. Forced mode guarantee's a collection for all generation upto and including generation provided in earlier parameter

Continued...

How to give keyboard accessibility in web sites

Hi

In the modern day web sites where client side features have taken the front seat (AJAX), one of the very important and less talked about things is to give the user keyboard accessibility.

There are many users who do not want to go the mouse while working with a site. If we can give them some keyboard shortcuts then they would enjoy the site even more.

Adding these access keys are very simple and can be of great use to the users. For example to add the access key to a <a> tag would be as simple as adding the following attribute to the tag  accesskey="5". Now when the user clicks Alt + 5 in IE and Shift + Alt + 5 in Fire fox then the user will be taken to the link. If you press enter then then you will find yourself going to that page.

Continued...

Megabyte, Gigabyte, Terabyte, Petabyte, Exabyte, Zettabyte, Yottabyte

Hi,

Yesterday I faced a very strange question from Sadhan. What he wanted to know was what is the extent of unit for memory that has already been defined. What comes after we are finished with gigabytes and tera bytes.

This instantly caught my attention and after googling I found the answer. So I decided to put down a small blog on it. Here is the list of the Unit for the least to the top

Continued...

Formatting date time in SQL Server

Hi

In SQL Server we have many option to format a date-time string. One of the very first needs is the current date-time. We use the getdate() function to get the current date-time. This is very much used in the process where we also store the date-time of the data insertion or editing in the database. The function provides date-time based on the server it is in.

But if you need a universal date-time then you need to use the getutcdate() function. But many a time we also need to change the format of the date-time, or convert it to a string and then change the format of the string. Here is a small list of the format that can be applied for the date-time.

Continued...

New language feature in c# 3.0 Implicitly typed local variables

Hi

Another of the new feature in The C# 3.0 will be the declaration of implicitly typed local variables. This means that we can declare any local variable with the type var and it type will be inferred from the expression that is used to declare it.

This means that if we declare a local variable with type var (and there is no type named var in the scope) the declaration becomes implicitly typed local variable. Hence the following lines of code will be possible and correct in C# 3.0

var int1 = 10;

var decimal = 2.45;

var string = “Vikram Lakhotia”;

var intArray = new int[] {1,4,8,0,3};

Continued...

Asp.Net Ajax Extension new List Search Extender

Hi

Another of the new controls in Asp.Net Ajax extension is the new ListSearchExtender. The List search extender helps us to search inside a list box or a dropdown list while the user is typing the characters. This can be a very good functionality if you have a list box with many values in it.

An incremental search is performed within the list box or the dropdown list based what has already been typed so far. The message displayed when the user clicks the list can be customized with the help of css class position.

We use the TargetControlID to define the dropdown list or list box the extender should work on. The prompttext property is used to define the text prompted when the control gets focus. We can also define the position and css class for the prompt message.

Thanks
Vikram

 
Copyright © 2006 - 2008 Vikram Lakhotia