The blog has moved to a new address. The blog is now located at


Sunday, December 02, 2007

SHA1 hash calculation in C#

The SHA1 algorithm can be used to calculate check sum, that very useful when you want to ensure the string is not broken .Also for simple  password verification.The example below show how to calculate SHA1 for given string .


/// <summary>
/// Calculates SHA1 hash
/// </summary>
/// <param name="text">input string</param>
/// <param name="enc">Character encoding</param>
/// <returns>SHA1 hash</returns>
public static string CalculateSHA1(string text, Encoding enc)
byte[] buffer = enc.GetBytes(text);
SHA1CryptoServiceProvider cryptoTransformSHA1 =
new SHA1CryptoServiceProvider();
string hash = BitConverter.ToString(
cryptoTransformSHA1.ComputeHash(buffer)).Replace("-", "");

return hash;

The result SHA1 hash for the string "first string":


Technorati Tags: ,,,

Tuesday, November 20, 2007

Visual Studio 2008 and .NET Framework 3.5 Training Kit containing Labs, Demos and Powerpoint Presentations

The Visual Studio 2008 and .NET Framework 3.5 Training Kit includes powerpoint presentations, hands-on labs, and demos. This training kit is designed to help you learn how to utilize the Visual Studio 2008 features and a variety of framework technologies including: LINQ, C# 3.0, Visual Basic 9, WCF, WF, WPF, ASP.NET AJAX, VSTO, CardSpace, SilverLight, Mobile and Application Lifecycle Management.

Download Visual Studio 2008 and .NET Framework 3.5 Training Kit

Wednesday, August 22, 2007

Free tool that allows administrators to schedule various SQL jobs for SQL Server Express and other versions of SQL Server

SQLScheduler is a fully functional client/server application written in C# that allows administrators to schedule various SQL jobs for SQL Server Express and other versions of SQL Server.


  • Supports all versions of SQL Server 2000 and 2005
  • Supports unlimited SQL Server instances with an unlimited number of jobs.
  • Allows to easily schedule SQL Server maintenance tasks: backups, index rebuilds, integrity checks, etc.
  • Runs as Windows Service
  • Email notifications on job success and failure

Download SQLScheduler

Monday, July 23, 2007

JavaScript SyntaxHighlighter

SyntaxHighlighter is here to help a developer/coder to post code snippets online with ease and have it look pretty. It's 100% Java Script based and it doesn't care what you have on your server.The idea behind SyntaxHighlighter is to allow insertion of colored code snippets on a web page without relying on any server side scripts.

Monday, July 02, 2007

Fiddler 2.1 Released

Fiddler v2 is a new version of the Fiddler Debugging proxy.  Fiddler2 is freeware and can debug traffic from virtually any application, including IE, Firefox, Safari.
Fiddler2 supports viewing and tampering with HTTPS traffic.Read a quick summary of getting started with Fiddler.
Download Fiddler2

Friday, June 29, 2007

Manage Subversion servers on Windows.

PainlessSVN provides you with the ability to completely manage your Subversion  Repositories & Server conviently and effectively without the using of command line interface.

PainlessSVN Features

  1. Creates and Deletes Repositories
  2.  Creates and Deletes Directories
  3.  Creates and Deletes Users
  4.  Creates Dump Files
  5.  Creates Hot Copies
  6.  Manages access to repositories
  7. Uses the Microsoft Management Console.

Download PainlessSVN Professional Preview 3

Monday, June 25, 2007

.NET Framework 3.0 Virtual Labs

.NET Framework version 3.0 is Microsoft’s managed-code programming model for developing software on the Windows platform. .NET Framework 3.0 includes Windows Presentation Foundation, Windows Communication Foundation, Windows Workflow Foundation, and Windows CardSpace technologies.Today you can learn these new technologies through a series of guided, hands-on labs which can be completed in 90 minutes or less.


Windows CardSpace Virtual Labs

Core Features of Windows CardSpace

Windows Presentation Foundation Virtual Labs

Building Windows Presentation Foundation Applications C# Part 1
Building Windows Presentation Foundation Applications C# Part 2
Building Windows Presentation Foundation Applications VB Part 1
Building Windows Presentation Foundation Applications VB Part 2

Windows Communication Foundation Virtual Labs

A Server Scenario Lab with Windows Communication Foundation
Understanding Windows Communication Foundation
The Fundamentals of Programming the Windows Communication Foundation
Reliable and Transacted Messaging with the Windows Communication Foundation

Windows Workflow Foundation Virtual Labs

A Server Scenario Lab with Windows Workflow Foundation
Getting Started with Windows Workflow Foundation

You get a downloadable manual and a 90-minute block of time for each module. You can sign up for additional 90-minute blocks at any time.

Wednesday, June 20, 2007

Building Silverlight Applications using .NET Talk (by ScottGu )

Scott used a few slides to explain each programming model concept in Silverlight, and then showed a very base sample for each concept that helped present concretely how it worked.


In the talk Scott covered fallowing Silverlight concepts:

  • XAML
  • Using Shapes and Text
  • Using Controls
  • Layout (Canvas and Layout Managers)
  • Brushes
  • Transforms
  • Handling Events and Writing Code
  • Building Custom UI Controls
  • Reaching out and Programming the HTML of a page from a Silverlight control
  • Handling HTML Events in Managed Code (e.g. html button click handled in C#/VB on the client)
  • Exposing managed APIs to HTML JavaScript in the browser
  • Using the File Open Dialog support
  • Using the HTTP Network APIs
  • Using the Web Service APIs
  • Isolated Storage for local data caching


You can download the slides + demos of this talk below:

Included in the .zip download are readme instructions on how to run all of the samples on your own machine.

Technorati tags: , ,

Thursday, June 14, 2007

Updated utilities from Mark Russinovich

Updated utilities are ZoomIt, Streams, String, PsExec, SigCheck and DiskExt.

List of changes:

  • ZoomIt - you can type text while zoomed and you can also create scratch pad by clearing screen.

  • Streams - Streams now supports printing and deleting streams on volume root directories. There is also new -accepteula switch - hope so it will be included with every single utility :(

  • String - improving performance by limiting no. of bytes that it is reading

  • PsExec - Officially this release to PsExec, a utility for running programs on remote systems, corrects a buffer overflow bug caused by long command line arguments. Unofficially as I found out - it also fixes bug with running PsExec against local computer (PsExec \\%ComputerName% cmd is giving you error regarding user name or password). Finally :) This is quite pain when you got automated processing.

  • SigCheck - new switches -a and -m (more version data and manifests)

  • DiskExt - now reports the mappings for volume that have not been mounted by a file system.


[Via MartinZugec's blog ]

Technorati tags: ,

Thursday, May 24, 2007

Developing with Microsoft® ASP.NET AJAX Extensions


In this 2-hour clinic you will learn about the rich functionality that ASP.NET AJAX Extensions provides for building highly responsive and enhanced web applications. In addition to learning about the different server and client components of ASP.NET AJAX, you will also learn how to build new ASP.NET AJAX applications and how to upgrade existing ASP.NET applications to take advantage of ASP.NET AJAX.

Clinic Content

Clinic Overview
Navigation Overview
Overview of ASP.NET AJAX
Introduction to AJAX and ASP.NET AJAX
Introduction to the Architecture of ASP.NET AJAX
Programming with ASP.NET AJAX
Building a Simple ASP.NET AJAX Application
Using the AJAX Library to Enhance Web User Interfaces
Calling Web Services and Web Methods from the Client
Additional Information

Learn WPF,WCF,WWF for free

This collection of 3 2-hour premium clinics teaches about the new capabilities provided by the .NET Framework 3.0. These clinics are for experienced(2 years) Developers and SW Architects who are looking to integrate Microsoft's next generation technology within their projects.

Topics covered within the offer include:

Clinic 5135: Introduction to Developing with Windows® Presentation Foundation and Visual Studio® 2005

Clinic 5136: Introduction to Developing with Windows® Workflow Foundation and Visual Studio® 2005

Clinic 5137: Introduction to Developing with Windows® Communication Foundation and Visual Studio® 2005

Tuesday, March 06, 2007


With DataBatcher you can perform the following tasks in a batch-processed manner:

  • Copy files / folders from one location to another
  • Create new files / folders
  • Delete files / folders
  • Create shortcuts to files / folders
  • Change the attributes of files / folders
  • Touch files / folders (i.e. change their modified, created, accessed times)
  • Execute a batch file (.bat; .cmd) in the Cmd.exe command interpreter (e.g. to rename files)
  • Convert image files from one format to another
  • Run a Windows PowerShell 1.0 script that is able to interact with DataBatcher's runtime environment.


  • Set up and run (and re-run) batch-processed jobs
  • Configure each step in a job to behave exactly as you wish
  • Process sets of files on an assembly line basis
  • Full logging of all activity when a job runs
  • Pre-prepare collections of files to be processed when a job runs
  • Minimize the GUI application to the task bar or system tray when a job runs
  • Run jobs in a hands-free manner using DataBatcher's console application
  • Set up portable jobs that run correctly on different machines
  • Full undo / redo for all editable documents
  • Open, XML-based formats are used for all of DataBatcher's own files (e.g. job files), allowing them to be processed by other programs
  • An SDK (software development kit) for writing your own plugin modules is included with each installed copy of DataBatcher.

Download DataBatcher for free

Wednesday, February 28, 2007

How To Print a DataGridView in C# and .NET

The DataGridView control in .NET 2.0 is an incredible data representation control, and contains many features that you could benefit from. The only thing that is not supported by this control is the printing feature.Salan Al-Ani created the class for this feature and share it with others.

PowerShell Editor and Analyzer

PowerShell Analyzer is a rich interactive environment for Windows PowerShell. Its goal is to be the PowerShell host of choice for IT professionals and system administrators. It has all the typical editor and IDE functionality that you would expect when working on a modern language, but it focuses on the real time interactive experience as if you were at the console, helping you compose the commands you want to use, and also giving you rich graphical visualization of the results. PowerShell may seem to just return text like the average Unix shell, but in reality, it is returning rich self describing Dotnet objects. PowerShell Analyzer not only helps you with the INPUT, but also with the output. It shows you the properties of the rich objects that the commands return, as well as specific visualizers to help you interact with output such as XML, HTML, charts, tables, and hierarchical data structures.


Download PowerShell Analyzer

Video Demos

Author's Blog

Sunday, February 18, 2007

Change font style for specific cell in datagridview

The way to change font for a single cell in an unbound datagridview.


int columnIndex = 1;
int rowIndex = 2;
// create bold font based on the default font
Font newFont = new Font(dataGridView1.Font, FontStyle.Bold);
dataGridView1[columnIndex, rowIndex].Style.Font
= newFont;


Using this simple technique you can change foreground or background color ( and many more style related properties ) for specific cell .

Monday, February 05, 2007

Propertygrid: How to show and edit "aggregated" property

Sometimes we need to edit  aggregated property - I mean the property that represents object with few properties .The simple way to do this - we can use TypeConverter with ExpandableObjectConverter as shown in the example



public class FullName
private string _FirstName;
private string _LastName;

public FullName(string _FirstName, string _LastName)
this._FirstName = _FirstName;
this._LastName = _LastName;

"First Name")]
"First name of the person")]
public string FirstName
return _FirstName;
= value;

"Last Name")]
"Last name of the person")]
public string LastName
return _LastName;
= value;

///Returns a <see cref="T:System.String"></see>
/// that represents the current <see cref="T:System.Object"></see>.
///A <see cref="T:System.String"></see>
/// that represents the current <see cref="T:System.Object"></see>.
public override string ToString()
return _FirstName + " " + _LastName;



[DisplayName("Full Name")]
"Full name of the person")]
public FullName FullName
return _FullName;
= value;

Result - the editor for aggregated object

Source( russian )

Propertygrid: How to display combo with icons for enum type?

We need to cretate new type inhereted from UITypeEditor with custom painting( in our case the images located in resource file - where each image name equals to memeber of the enum ) as shown below


public class CountryEditor : UITypeEditor
///Indicates whether the specified context supports
/// painting a representation of an object's value within the specified context.
///true if
/// <see cref="M:System.Drawing.Design.UITypeEditor.PaintValue(System.Object,System.Drawing.Graphics,System.Drawing.Rectangle)">
/// </see> is implemented; otherwise, false.
///<param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext">
/// </see> that can be used to gain additional context information. </param>
public override bool GetPaintValueSupported(ITypeDescriptorContext context)
return true;

///Paints a representation of the value of an
/// object using the specified <see cref="T:System.Drawing.Design.PaintValueEventArgs"></see>.
///<param name="e">A <see cref="T:System.Drawing.Design.PaintValueEventArgs">
/// </see> that indicates what to paint and where to paint it. </param>
public override void PaintValue(PaintValueEventArgs e)
string resourcename = Enum.GetName(typeof (Country), e.Value);

// retrive image from resource file
Bitmap countryImage =
Rectangle destRect
= e.Bounds;

// paint
e.Graphics.DrawImage(countryImage, destRect);



Create new EnumTypeConverter

public class EnumTypeConverter : EnumConverter
private Type _enumType;
public EnumTypeConverter(Type type)
= type;

public override bool CanConvertTo(ITypeDescriptorContext context,
Type destType)
return destType == typeof(string);

public override object ConvertTo(ITypeDescriptorContext context,
CultureInfo culture,
object value, Type destType)
FieldInfo fi
= _enumType.GetField(Enum.GetName(_enumType, value));
DescriptionAttribute dna

if (dna != null)
return dna.Description;
return value.ToString();

public override bool CanConvertFrom(ITypeDescriptorContext context,
Type srcType)
return srcType == typeof(string);

public override object ConvertFrom(ITypeDescriptorContext context,
CultureInfo culture,
object value)
foreach (FieldInfo fi in _enumType.GetFields())
DescriptionAttribute dna

if ((dna != null) && ((string)value == dna.Description))
return Enum.Parse(_enumType, fi.Name);

return Enum.Parse(_enumType, (string)value);




Then use attribute Editor


typeof(CountryEditor), typeof(UITypeEditor))]
public Country Country
return _Country;
= value;


 Now we can see the combo box as editor for our Enum type


Source ( russian )

Friday, January 12, 2007

Open source C# SourceForge implementation

SharpForge supports collaborative development and management of multiple software projects. Similar to SourceForge or CodePlex but for your own team or organisation. The software is written in C# for .NET 2.0 is integrates with Subversion for source control and is released under the New BSD License.



  • Multi Portal
  • Multi Project
  • Subversion Administration
  • Work Item Tracking
  • Project Forums
  • Release Management
  • Subversion Wiki
  • Browse Source Code
  • News Feed Aggregation


Download SharpForge

[Via Larkware News]

Tuesday, January 09, 2007

A function to calculate the opposite color of given color

/// <summary>
/// Calculates the opposite color
/// </summary>
/// <param name="clr">Given color</param>
/// <returns></returns>
public static Color CalculateOppositeColor(Color clr)
return Color.FromArgb(255 - clr.R, 255 - clr.G, 255 - clr.B);