Sunday, 15 January 2012

What is Ajax ?

AJAX means = Asynchronous JavaScript and XML.
AJAX is not a new programming language, but a new way to use existing standards.
AJAX is the art of exchanging data with a server, and update parts of a web page - without reloading the whole page.

Difference between Functions CAST() and CONVERT() ?

Both these functions are used to convert values from one DataType to another
But there are some differences between them 

1 CAST is ANSI standard and CONVERT is specific to SQL Server
2 CAST can't be used for formating purposes.
But CONVERT can be used for formating purposes particularly on datetime and money datatype  

Example :
declare @myDate datetime
set @myDate='20121209 12:22:45'
select convert(varchar(10),@myDate,108)
declare @mny money
set @mny =123456
select convert(varchar(10),@mny ,1)
Result : 

----------
12:22:45
----------
123,456.00

Note : 

Also you should be very careful in using the both when you convert values.
Consider the following example
declare @i int
set @i=123456
select convert(char(5),@i),cast(@i as char(5))
The result is
1.----- -----
2.*     *   
It is because the size of the variable is not enough to hold the number In this case you will not get any error.
You should in advance specify the enough length

Thursday, 12 January 2012

What is the difference between a strong and weak named assemblies?

1. Weak named assemblies can be duplicated and tampered with, where as strong named assemblies cannot be tampered and duplicated.

2. Strong named assemblies can be copied into GAC(GLOBAL ASSEMBLY CACHE), where as weak named  assemblies cannot be copied.

3. A single copy of strong named assembly present in the GAC(GLOBAL ASSEMBLY CACHE) can be  shared with multiple applications, where as weak named assembly must be copied into the bin directory of each project.

What is the difference between a Label and Literal control in asp.net ?

Both the Label and Literal controls allow you to specify some text which appears
on a web page. The main difference between them is "Label" control display the
text wrapped around in a span tag. literal control doesn't do anything like that.
It just display a text without wrapping it with anything.
For example:-
Suppose you have a label and a literal control in your aspx page :-

<asp:Label ID="label1" runat="server"></asp:Label>
<br />
<asp:Literal ID="literal1" runat="server"></asp:Literal>

Now, bind your controls with some text :-

label1.Text = "label text";
literal1.Text = "literal text";

When you execute the code, you will see this:-

<span id="label1">Hello This is label text</span>
<br />
Hello This is literal text

In the above output, we see that the label text is wrapped around a span tag and
the literal text is simply putting a text in it.
Note: If you do not need styling then its better to use literal. But do remember,
label control has much more properties than the literal control, so choose wisely.

What is difference between "String" and "string" ?

string is a type in c# while String is a type in .Net CLR.
Ultimately c# type is converted into .net type.

Monday, 9 January 2012

A theme can contain how many Default and Named skin for each control ?

A theme can contain only one Default Skin for each type of control. However, a
theme can contain as many Named skins as you can. Each Named Skin must have
a unique name.

Example :
TextBox.Skin:

What is the difference between Session.Abandon() and Session.Clear()?

Session.Abandon() will end current session by firing Session_End and in the next
request, Session_Start will be fire.

Session.Clear( ) just clears the session data without killing it. With session.clear
variable is not removed from memory it just like giving value null to this session.

Session ID will remain same in both cases, as long as the browser is not closed.

Difference Json Arrary Vs Json Object ?

JSONArray
A JSONArray is an ordered sequence of values. Its external text form is a string wrapped in square brackets with commas separating the values.
[{"ircEvent": "PRIVMSG", "method": "newURI", "regex": "^http://.*"},
 {"ircEvent": "PRIVMSG", "method": "deleteURI", "regex": "^delete.*"},
 {"ircEvent": "PRIVMSG", "method": "randomURI", "regex": "^random.*"}
]
 
JSONObject
A JSONObject is an unordered collection of name/value pairs. Its external form is a string wrapped in curly braces with colons between the names and values, and commas between the values and names.

{"bindings": [
 {"ircEvent": "PRIVMSG", "method": "newURI", "regex": "^http://.*"},
 {"ircEvent": "PRIVMSG", "method": "deleteURI", "regex": "^delete.*"},
 {"ircEvent": "PRIVMSG", "method": "randomURI", "regex": "^random.*"}
 ]
};

How to Optimize Stored Procedure Optimization?

There are many tips and tricks for the same. Here are few:
  • Include SET NOCOUNT ON statement.
  • Use schema name with object name.
  • Do not use the prefix “sp_” in the stored procedure name.
  • Use IF EXISTS (SELECT 1) instead of (SELECT *).
  • Use the sp_executesql stored procedure instead of the EXECUTE statement.
  • Try to avoid using SQL Server cursors whenever possible.
  • Keep the Transaction as short as possible.
  • Use TRY-Catch for error handling.

Which are the Important Points to Note when Multilanguage Data is Stored in a Table?

There are two things to keep in mind while storing unicode data. First, the column must be of unicode data type (nchar, nvarchar, ntext). Second, the value must be prefixed with N while insertion. For example,
INSERT INTO table (Hindi_col) values (N’hindi data’)