@Blog.Author(Nandip Makwana) .LearningExperience(ASP.NET, ASP.NET MVC, IIS, jQuery & Technology Surrounding it...)

May 22, 2009 comment

What are different types of JIT compilation in .NET?


There are three types of JIT compilation in .NET as described follow.
.
· Pre - JIT: - In Pre-JIT compilation, complete source code are converted into native code in a single cycle. This is done at the time of application deployment.
.
· Econo - JIT: - In Econo-JIT compilation, compiler compiles only those method which are called at run time. After execution of this method compiled method are removed from memory.
.
· Normal - JIT: - In Normal-JIT compilation, compiler compiles only those method which are called at run time. After executing this method, compiled method are stored in memory cache. Now further calling to compiled method will execute method from memory cached.

comment

What is managed code in .NET?


Managed code run under the environment of CLR or .NET runtime. CLR execute this managed code.
.
In short all IL codes are managed code hence it is run under the control of CLR.
.
But if we are using component which is not built on .NET then such referenced codes are called unmanaged code since CLR does not have control over the execution of this referenced code.
.
For example, using of activex component built using VB 6.0 is unmanaged code in .NET.

May 21, 2009 comment

Performing delete operation with client script confirmation in ASP .NET


THIS IS A2R (ANSWER TO READER) ARTICLE.
.
Hi Dorababu, you can follow one of following method to delete record from emp table.
.
I think asking employee id or name is not good thing instead you can populate dropdowncombo box with employee name or id or both and place one button for deleting employee. Clicking on that button will confirm from user and finally delete record if user wants!
.
OR
.
You can also fill gridview with employee id and name. Enable deleting in grid view.
.
I will explain this second method in which user confirmation is done with client script.
.
I have used northwind database from SQL Server 2000 in this example.
.
  • Take one gridview on webpage
  • Right click gridview and choose "Show smart tag".
  • In a choose datasource select new datasource
  • Configure datasource so it can display employee id and name.
  • Don't forget to GENERATE "DELETE SQL STATEMENT" by clicking advanced button at the time of configuration.
  • Now enable deleting in gridview.
  • That's all you have done.
  • To add user confirmation for deleting record apply following logic.
  • From the "Smart tag" menu of gridview click "edit columns…"
  • Now in selected field select "Delete" and click on "convert this field to templatefield".
  • Click Ok Button





  • Now open html markup for webpage.
  • Modify gridview markup as follow.
  • You can find that there are <asp:TemplateField> Tag inside gridview markup.
.
.
  • Now add the following attribute in the <asp:LinkButton> Tag of <ItemTemplate>.
  • OnClientClick="return confirm('DO YOU REALLY WANT TO DELETE?');"
  • Now whenever you click on "Delete" Link it Will ask for user confirmation and if user press ok then and then delete operation will be performed otherwise delete operation will be aborted.
.

comment

What is CTS (Common Type System) in .NET?


CTS is another standard developed by Microsoft to integrate different language under .NET. We can say that CTS is a subset of CLS.
.
We know that in .NET different assembly can be written in different language. And these assemblies can execute together.
.
Have you ever think how these assemblies can communicate with each other? Because each language have different data types, different memory size.
.
This is place where CTS comes in picture.
.
We have already discuss that .NET Framework understand only MSIL. And every source code is converted into MSIL whether we have use any language
.
In .NET each data types of language are mapped to data types of MSIL or types defined by CTS. So at time of converting in MSIL code each data types are converted in corresponding type defined in CTS.
.
For example Integer of VB.NET and int of C# both are mapped to Int32 type of CTS. So at the time of converting in MSIL both this data types will be converted in Int32 type. Now communication between two language are possible.
.
Following are table of C# data type and their mapped CTS Type in .NET
.
C# Data Types
Mapped CTS Type
Size in Bytes
byte
Byte
1
sbyte
SByte
1
short
Int16
2
ushort
UInt16
2
int
Int32
4
unit
UInt32
4
long
Int64
8
ulong
UInt64
8
float
Single
4
double
Double
8
bool
Boolean
1
char
Char
2
decimal
Decimal
12

comment

What is CLS (Common Language Specification) in .NET?


It is said that programmer can choose language of his choice for programming on .NET Framework. Have you ever think how it is possible?
.
Here is answer.
.
CLS is just nothing but guideline developed by Microsoft which must be followed by language if that language want to provide programming on .NET Framework.
.
For example I have developed one language!
.
And I decide that my language should provide facility to programming on .NET Framework.
.
So I have to develop compiler for my language which translate source code to IL code or .NET Managed code.
.
And at the time of developing such compiler I have to follow CLS.
.
That's what CLS is just.

May 20, 2009 comment

Responsibility of CLR in .NET Framework


Garbage Collection: - CLR manages memory to avoid memory leaks. When objects are not referred GC automatically releases those memories and allocates it back to OS.
.
Code Access Security: - CAS grants rights to program. This granted right is dependent upon the configuration of machine.
.
Code Verification: - This ensures proper execution of .NET application and prevents .NET application to perform illegal operation such as accessing in valid memory location etc.
.
IL to Native translators and optimizer: - CLR uses JIT compiler to translate to IL code to machine code or native code depending on target machine. Thus final execution of .NET application happened!

comment

What is IL or MSIL in .NET?


IL (Intermediate Language) is also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .NET source code is compiled to IL.
.
IL is then converted to executable code at run-time by a JIT (Just In Time) compiler.
.
IL is similar to byte code in JAVA.

comment

From Distributed computing to .NET

The best way to define .NET is to think about what .NET is going to do. Microsoft believes a silent shift to distributed computing is happening
.
There are lots of examples of such distributed applications today
.
Instant messaging, where you have a rich client that talks to a buddy list in the cloud and communicates with each other is the most used distributed applications
.
So .NET is aimed at accelerating this next generation of distributed computing. This can be achieved in three steps
.
There are three steps to make this distributed computing generation happen as fast as it can
.
Web services: - The first step is that everything needs to be a web service. This applies to both pieces of software and resources in the network like storage
.
Aggregation and integration: - The second step is that once you have these web services, you need to be able to aggregate and integrate these web services in very simple and easy ways
.
Simple and compelling user experience: - The third step to accelerate distributed computing is you need to have a simple and compelling end user experience
.
.NET is really aimed to accelerate the move to distributed computing.

comment ,

What is Assemblies in .NET Framework?

An assembly is the actual .dll file on your hard drive where the classes of the .NET Framework are stored
.
For example, all the classes contained in the ASP.NET Framework are located in an assembly named System.Web.dll.
.
More accurately, an assembly is the primary unit of deployment, security, and version control in the .NET Framework. Because an assembly can span multiple files, an assembly is often referred to as a "logical" dll
.
There are two types of assemblies:
.
Private Assemblies: - A private assembly can be used by only a single application
.
Shared Assemblies: - A shared assembly, can be used by all applications located on the same server
.
Shared assemblies are located in the Global Assembly Cache (GAC).
.
For example, the System.Web.dll assembly and all the other assemblies included with the .NET Framework are located in the Global Assembly Cache.
.
To use any particular class in the .NET Framework, you must do two things. First, your application must reference the assembly that contains the class. Second, your application must import the namespace associated with the class
.
In most cases, you won't worry about referencing the necessary assembly because the most common assemblies are referenced automatically
.
However, if you need to use a specialized assembly, you need to add a reference explicitly to the assembly
.
For example, if you need to interact with Active Directory by using the classes in the System.DirectoryServices namespace, then you will need to add a reference to the System.DirectoryServices.dll assembly to your application
.
We can add a reference to an assembly in ASP.NET applications explicitly by selecting the menu option Web Site, Add Reference, and selecting the name of the assembly that you need to reference
.
For example, adding a reference to the System.Messaging.dll assembly reflects following changes in the web configuration file of ASP.NET application
.
<Configuration>
<system.web>
<Compilation>
<Assemblies>
<add assembly="System.Messaging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
</assemblies>
</compilation>
</system.web>
</configuration>

comment

What is Common Language Runtime (CLR) in .NET Framework?

Common Language Runtime or CLR is the core part of .NET Framework. Common Language Runtime or CLR is responsible for executing your application code. Code running under the control of CLR is also called managed code.
.
When you write an application for the .NET Framework with a language such as C# or Visual Basic .NET, your source code is never compiled directly into machine code.
.
Instead, the C# or Visual Basic compiler converts your code into a special language named MSIL (Microsoft Intermediate Language).
.
Then, CLR compile MSIL into platform-specific code.
.
When your application actually executes, the MSIL code is just-in-time compiled (also known as JIT Compilation) into machine code by Just-In-Time or JIT Compiler.
.
Normally, your entire applications not compiled from MSIL into machine code.
.
Instead, only the methods that are actually called during execution are compiled.
.
In reality, the .NET Framework understands only one language that is MSIL.
.
However, you can write applications using languages such as Visual Basic .NET and C# for the .NET Framework because the .NET Framework includes compilers for these languages that enable you to compile your code into MSIL.
.
You can write code for the .NET Framework using any one of different languages supported by .NET Framework including the following.
.
  • Ada
  • Apl
  • Caml
  • COBOL
  • Eiffel
  • Forth
  • Fortran
  • JavaScript
  • Oberon
  • PERL
  • Pascal
  • PHP
  • Python
  • RPG
  • Scheme
  • Small Talk
-Reference, "ASP.NET 3.5 UNLEASHED" By Stephen Walther
Published By Sams Publishing

comment ,

What is Namespaces in .NET Framework?

There are almost 13,000 classes in the .NET Framework. This is an overwhelming number. If Microsoft simply jumbled all the classes together, then you would never find anything. Fortunately, Microsoft divided the classes for similar tasks into separate namespaces
.
A namespace is simply a category. For example, all the classes related to working with the file system are located in the System.IO namespace. All the classes for working with a Microsoft SQL Server database are located in the System.Data.SqlClient namespace
.
Before you can use a class in a page, you must indicate the namespace associated with the class. There are multiple ways of doing this
.
First, you can fully qualify a class name with its namespace. For example,
.
System.IO.File.Exists ("SomeFile.txt")
.
Because the File class is contained in the System.IO namespace, you can use the above statement to check whether a file exists or not.
.
Specifying a namespace each and every time you use a class can become tedious (it involves a lot of typing). A second option is to import a namespace. You can add an <%@ Import %> directive to an ASP.NET page to import a particular namespace.
.
The following directive near the very top of the ASP.NET page imports the System.Net.Mail namespace.
.
<%@ Import Namespace="System.Net.Mail" %>
.
After you import a particular namespace, you can use all the classes in that namespace without qualifying the class names.
.
Finally, if you discover that you are using a namespace in multiple pages in your ASP.NET application, then you can configure all the pages in your application to recognize the namespace.
If you add the following web configuration file in your ASP.NET application, then you can use the classes from the System.Net.Mail namespace in each pages without adding <%@ Import %> directive to each pages.
.
<Configuration>
<system.web>
<Pages>
<Namespaces>
<Add namespace="System.Net.Mail"/>
</namespaces>
</pages>
</system.web>
</configuration>

comment

What is .NET Framework Class Library?

The .NET Framework contains thousands of classes that you can use when building an application. The .NET Framework Class Library was designed to make it easier to perform the most common programming tasks. Here are just a few examples of the classes in the framework.
.
File class: - This class can be used to represent a file on hard drive. We can use this class to check whether a file exists, to create a new file, to delete a file, or to manipulate file.
.
Graphics class: - This class can be used to work with different types of images such as GIF, PNG, BMP, and JPEG images. We can also use the Graphics class to draw rectangles, arcs, ellipsis, and other elements on an image or to manipulate any image.
.
Random class: - This class can be used to generate a random number.
.
SmtpClient class: - This class can be used to send email. You can use the SmtpClient class to send emails that contain attachments and HTML content.
.
These are only four examples of classes in the .NET Framework. The .NET Framework contains almost 13,000 classes you can use when building applications.
.
The Microsoft .NET Framework 2.0 includes 18,619 types; 12,909 classes; 401,759 public methods; 93,105 public properties; and 30,546 public events. The .NET Framework 3.0 and 3.5 build on top of this base set of types with even more classes.
-Reference, "ASP.NET 3.5 UNLEASHED" By Stephen Walther
Published By Sams Publishing

Featured Content

Resources & Tools

About Nandip Makwana

Nandip Makwana is passionate about digital world and web. He completed his Masters in Computer Application in June 2011. Currently he is working as a Software Engineer. He has shown great promise and command over ASP.NET and technologies surrounding it during his academic years and professorial life...continue reading