Friday, January 30, 2009

ANTS Profiler :- For Performance profiling and Memory Profiling.

ANTS Profiler is a product of RedGate software company i.e used to check the performance of the .Net code as well as the Memory profiling of the .Net codes.


ANTS Profiler comes in two edition:-

1. Standards
2. Pro

You can download the trial version of the ANTS profiler for only 14 days.

ANTS Profiler is a code profiling tool designed for .NET developers who want to get to the bottom of these and other related issues. Technical testers also use ANTS Profiler to pin bugs down to a specific line of code or to determine scope for optimization.


ANTS Profiler allows you to identify slow lines of code in .NET applications within 5 minutes of installation, allowing you to get on with what you do best – writing code. The program can also be used to measure line-level timings and method execution times, and to understand how your application performs.

ANTS Prifiler profile the following application:-
1. Windows Application
2. ASP.Net Web Application
3. .Net Web Services
4. COM + Application
5. Other application written in any other languages that supports the .Net Framework

You can use ANTS Profiler with the following versions of the .NET Framework:
1.1 (32-bit applications only)
2.0 (32-bit or 64-bit applications)
3.0/3.5. (32-bit or 64-bit applications)

ANTS Profiler is built with .NET 2.0, you will need to install .NET 2.0 in order to be able to use the tool.

ANTS Profiler offers the following features

  • Profile any .NET language.
  • Profile ASP.NET web applications.
  • Profile Windows Forms applications.
  • Profile .NET 3.0 and .NET 3.5 applications:- WPF, WCF, WF, XBAP
  • Profile web applications on IIS 5, IIS 5.1, IIS 6, IIS 7, and ASP.NET
  • Support for 64-bit profiling on x64 processors.
  • Integration with Visual Studio 2005 and 2008
  • Call tree which auto-expands the worst performing stack traces.

Besides the above mentioned features, it also support some additional fearures

  1. Method-level profiling (faster mode) which introduces less overhead than when the profiler also records line-level timings.
  2. Profile memory to understand how your application uses memory, and to locate memory leaks. The memory profiler allows you to take snapshots at any point in the execution of your program, so you can see what memory is in use at that point. You can take multiple snapshots at different times while your application is running, so you can compare application memory states.

Tuesday, January 6, 2009

Display a list of all fonts installed on a computer using Windows Forms and WPF Application

For displaying all the fonts available on your computer in Windows Application, we use InstalledFontCollection class. It is a sealed class, so that it is not inheritable. InstalledFontClass is available under the System.Drawing.Text namespace.

This class returns an array containg all the installed font on your system. Lets see, the following example express how to use the InstalledFontCollection and display the list of fonts in the ListBox control.



The following steps are required to use InstalledFontCollection Class for displaying all the installed font of your computer in the ListBox control.


Step 1: Create a new WinForm application. Open VS 2005 or VS 2008 > File > New > Project > Choose either Visual Basic or Visual C# in the Project Types > Choose Windows Forms application in Templates> Give a Name to the project and click OK.


Step 2: Drag and drop a Listbox on the form. We will display the list of available fonts in the listbox.


Step 3: In the ‘Form1.cs’, add a reference to the System.Drawing.Text namespace. This namespace contains the ‘InstalledFontCollection’ class which contains the functionality to represent the installed fonts.
C#
using System.Drawing.Text;


Note:- If you r using VB.Net use the following lines of code for adding the System.Drawing.Text namespace
VB.NET
Imports System.Drawing.Text
Step 4: In the Form1_Load, we will create an instance of the ‘InstalledFontCollection’ class and then use the Families property to return an array of ‘FontFamily’ objects associated with the FontCollection class. The font family names are then added to the listbox on each loop.
C#
private void Form1_Load(object sender, EventArgs e)
{
InstalledFontCollection fonts = new InstalledFontCollection();
try
{
foreach (FontFamily font in fonts.Families)
{
listBox1.Items.Add(font.Name);
}
}
catch
{
}
}


Displaying all the installed font of your computer in WPF Application the following codes are useful.

The following XAML code is used for displaying all the installed font of your computer in the ComboBox control. For creating a WPF application choose the WPF templete from the new project dialog box. For creating a WPF application we need .Net 3.5 Framework and Visual Studio 2008.























Is this blog solve your Problem?