Sunday, November 24, 2013

How we can get the installed voices using c#?

This sample code will get the installed voices using C# SpeechSynthesizer and will load in to a combo box.

using (SpeechSynthesizer synth = new SpeechSynthesizer())
{
    foreach (InstalledVoice voice in synth.GetInstalledVoices())
    {
        VoiceInfo info = voice.VoiceInfo;
        cmbVoices.Items.Add(info.Description + ", " + info.Gender + ", " + info.Age);
        installedVoices.Add(info);
    }
    if (cmbVoices.Items.Count > 0)
    {
        cmbVoices.SelectedIndex = 0;
    }
}

Tuesday, November 12, 2013

What is White framework?


What is White framework?

White framework is an open-source framework which provides a handful of features to automate UI applications. By using White framework we can simulate a user effectively.  For example, if we want to perform some stereo type actions too many times like Launch an application, Click on a button, select a value, etc.. it might be awkward. If there is no decision making required then it has much worse situation. In these kinds of situations, we can avoid a human being from doing this. Instead we can have automation tool to simulate the human being.

White framework is basically a Test Automation tool, but we can use this to do the automation also. In simple words we can launch an application, can find buttons and other controls, can simulate mouse moves and clicks, activate controls, etc… That means everything which can be possible using Windows APIs.

White framework is developed using .NET 3 runtime. This uses windows UI automation library and Windows messages. If a developer uses white framework he does not worry about the PInvoke related activities. We can say White framework is a wrapper above the UI automation library and Windows messages.

White framework can be used to automate applications which are developed using Win32, WinForms, WPF, Silverlight and SWT (Java) platforms.

White framework Architecture 

Helpful Links

Source code can be found here: https://github.com/TestStack/White


Documentation can be found here: http://teststack.azurewebsites.net/white/index.html

Sunday, May 12, 2013

Basics Of Attributes in .Net Framework

The Attributes are the declarative informations used to instruct the .Net Runtime. The attributes can work with types, fields, methods and properties. These informations are stored with the metadata file. By using the Attributes the developer can control the CLR. So we will get a dynamic behaviour from the CLR.

Eg:- Serializable is an Attribute.

Usage of Attributes in VB.Net(Sample):

<Serializable()> _
Public Class Employee
Public Name As String
Public Designation As String
End Class



Usage of Attributes in C#.Net(Sample):


[Serializable()]
public class Employee
{
public string Name;
public string Designation;
}


Note: All the attributes are classes that derived from System.Attribute class.


.Net framework has a lot of attributes that can be used for controlling XML serialization, Web services, COM interoperability etc.. And .Net provides the oppertunity to create custom attributes.

Different Methods to Load Assembly Dynamically in .Net


  1. Assembly.LoadFrom : Loads an assembly given its file name or path. Loads the assembly from the specified path, this will not search for the assembly in other directories. If an assembly with the same identity is already loaded, LoadFrom returns the loaded assembly even if a different path was specified.

  2. Assembly.LoadFile : Loads the contents of an assembly file on the specified path.

  3. Assembly.ReflectionOnlyLoad :

  4. Assembly.Load : This method takes the name of the assembly, and the runtime searches for the assembly in different locations. These locations include local directory and global assembly cache.

  5. Assembly.LoadWithPartialName :



This is an incomplete article. I will be back with more details.

Friday, May 10, 2013

Add blog to Google search

You can add your blog to google search by submitting your URL to http://blogsearch.google.com/ping. Here you need to give /atom.xml
Once it is listed by google, you need to continuously update the blog with good articles. Also need to add relevant tags. This will make the blog to be listed in the searches in the toplist.

Wednesday, April 24, 2013

How to send Email from SQL Server with attached csv file


Please see the below sample code which will send email which will have an csv attachement.



Exec [msdb].[dbo].[sp_send_dbmail] 
@profile_name = '',
@recipients = 'emailid',
@body = ' Hello Sir,Please find the attached details...',
@body_format ='HTML',
@subject = 'Subject',
   @attach_query_result_as_file = 1, 
   @query_result_header = 1,
   @query_result_no_padding = 1,
   @query = 'SET NOCOUNT ON; SELECT EmployeeName, Address FROM  EmployeeDetails',
   @query_result_separator = ' ',
   @exclude_query_output = 1,
   @query_attachment_filename = 'EmployeeDetails.csv'



landscape paintings nature art landscape art sky art illustration art artwork art human art beautiful art landscape prints nature prints sky prints illustration prints artwork prints human prints beautiful prints beautiful special promotions nature special promotions sky special promotions illustration special promotions artwork special promotions beautiful canvas prints beautiful painting canvas prints beautiful framed prints beautiful painting framed prints beautiful posters beautiful painting posters