The blog has moved to a new address. The blog is now located at http://devintelligence.com

Adsense

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

DataBatcher

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.

Features

  • 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

 

 

[TypeConverter(typeof(ExpandableObjectConverter))]
public class FullName
{
private string _FirstName;
private string _LastName;


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

[DisplayName(
"First Name")]
[Description(
"First name of the person")]
public string FirstName
{
get
{
return _FirstName;
}
set
{
_FirstName
= value;
}
}

[DisplayName(
"Last Name")]
[Description(
"Last name of the person")]
public string LastName
{
get
{
return _LastName;
}
set
{
_LastName
= value;
}
}


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


 


 



[DisplayName("Full Name")]
[Description(
"Full name of the person")]
public FullName FullName
{
get
{
return _FullName;
}
set
{
_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
{
///<summary>
///Indicates whether the specified context supports
/// painting a representation of an object's value within the specified context.
///</summary>
///
///<returns>
///true if
/// <see cref="M:System.Drawing.Design.UITypeEditor.PaintValue(System.Object,System.Drawing.Graphics,System.Drawing.Rectangle)">
/// </see> is implemented; otherwise, false.
///</returns>
///
///<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;
}

///<summary>
///Paints a representation of the value of an
/// object using the specified <see cref="T:System.Drawing.Design.PaintValueEventArgs"></see>.
///</summary>
///
///<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 =
(Bitmap)Resources.ResourceManager.GetObject(resourcename);
Rectangle destRect
= e.Bounds;
countryImage.MakeTransparent();

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

}
}



 


Create new EnumTypeConverter


public class EnumTypeConverter : EnumConverter
{
private Type _enumType;
public EnumTypeConverter(Type type)
:
base(type)
{
_enumType
= 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
=
(DescriptionAttribute)Attribute.GetCustomAttribute(
fi,
typeof(DescriptionAttribute));

if (dna != null)
return dna.Description;
else
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
=
(DescriptionAttribute)Attribute.GetCustomAttribute(
fi,
typeof(DescriptionAttribute));

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

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


}

 


 


Then use attribute Editor


 



[DisplayName("Country")]
[Description(
"Country")]
[TypeConverter(
typeof(EnumTypeConverter))]
[Editor(
typeof(CountryEditor), typeof(UITypeEditor))]
public Country Country
{
get
{
return _Country;
}
set
{
_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.

 

Features

  • 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);
}

Wednesday, December 13, 2006

Html Agility Pack

This is an agile HTML parser that builds a read/write DOM and supports plain XPATH or XSLT (you actually don't HAVE to understand XPATH nor XSLT to use it, don't worry...). It is a .NET code library that allows you to parse "out of the web" HTML files. The parser is very tolerant with "real world" malformed HTML. The object model is very similar to what proposes System.Xml, but for HTML documents (or streams).
Sample applications:

  • Page fixing or generation. You can fix a page the way you want, modify the DOM, add nodes, copy nodes, well... you name it.
  • Web scanners. You can easily get to img/src or a/hrefs with a bunch XPATH queries.
  • Web scrapers. You can easily scrap any existing web page into an RSS feed for example, with just an XSLT file serving as the binding. An example of this is provided.

 

Download Html Agility Pack

[Via Roy Osherove's Blog]

Tuesday, December 12, 2006

How to capture the form and save it to a bitmap

The following example source code shows how to capture the form and save it to a bitmap. Hope you find it useful.

Point point = new Point();
Rectangle rectangle
= new Rectangle(point, this.Size);
Bitmap bitmap
=
new Bitmap(rectangle.Width, rectangle.Height, PixelFormat.Format32bppRgb);
// render the form to the bitmap
this.DrawToBitmap(bitmap, rectangle);
bitmap.Save(
@"d:\MyForm.bmp");

ReSharper 2.5

ReSharper 2.5 is an add-in to Visual Studio 2005. Besides further improvement of ReSharper 2.0 stability and performance in all areas, the new version provides a number of new features:

 

  • Navigate from here - You can view the possible navigation destinations from the place where the caret currently rests
  • Enabling and disabling context actions
  • New context actions and quick fixes
  • Value analysis - Use these options to define the means of code inspections: lists of assertion and terminating methods, and code annotations.
  • Code preview in the Find Results window - Results of usages search display in the Find Results window that enables you to perform a number of actions.

Monday, December 04, 2006

HnD - Customer Support Server

HnD is a Customer Support system, integrating helpdesk features and a forum system, and was built as an example of what you can do with LLBLGen Pro.

 

It's been released as open source software (using the GPL v2 license) and you can download and use it for free.

Requirements

To successfully install HnD, you need to have the following installed / available to you on the webserver:
  • .NET 2.0
  • IIS 5 or higher with ASP.NET 2.0 installed
  • Access to an SMTP server

HnD stores its data in a database, and you can use Microsoft SqlServer 7 / 2000/ 2005 / Express or MSDE.

Features

  • Unlimited forums can be organised into as many sections as you like.
  • Both public and private forums using role-based security
  • Queueing facility for support teams, enabling claiming questions and moving threads between queues. Threads can be auto-queued through forum settings.
  • Role-based security system for easy right management
  • Flexible attachment system for messages which is configurable per forum and user role.
  • Attachment approval system for moderators.
  • Editing all messages, editing thread properties and closing and moving threads for moderators.
  • Powerful search facility utilizing SqlServer's full-text search.
  • Native ASP.NET 2.0 code written in C#
  • Using LLBLGen Pro v2.0 for all data-access functionality.
  • Standard UBB message formatting with various font styles and sizes as well as allowing quoting, code display, attachments and automatic URL linking.
  • Email notification of replies to your topics.
  • Allows fine grained control over access to viewing, posting, replying, marking threads as 'done', thread memos and many other options.
  • Personal profile creation and management.
  • Administration centre with forum and section setup, complete group and member management, extensive ban management, support queue management, role management, mass emailing of groups and users by the administrator and many other options.
  • Complete control of fonts and colors by ASP.NET 2.0 theme support.
  • Open source, so changes and additions can be easily implemented.
  • And many more...

 

[Via Roy Osherove's Blog]

Paint.NET v3.0 Beta 1 is now available!

Change log:

  • New effect: Clouds
  • New menu command: Edit->Fill Selection (shortcut key: Backspace). This will fill any selected area with the primary color.
  • New toolbar item / hotkey: The brush size may be manipulated with +/- buttons in the toolbar. Hotkeys for this are [ and ], and you may hold Ctrl to increment or decrement by 5.
  • New translations: They are not complete yet, and in fact some have just been started. They are mostly in place right now in order to get the code correct: Chinese (Simplified), French, German, Japanese, Korean, Portugese, and Spanish. You will have the ability to choose one of these languages during installation, and from the Help->Language menu, but the text will still be either mostly or completely English. Complete translations will be finished by February.
  • Added left-handed shortcut keys for Cut (Shift+Del), Copy (Ctrl+Ins), Paste (Shift+Ins)
  • Upper-left coordinate of selection is now displayed in the status bar
  • When moving text with the Text tool, the anchor point coordinate is now displayed in the status bar
  • Fixed: In high-DPI mode (120dpi), the color swatch would translate the mouse location to the wrong color palette entry
  • Fixed: Alpha-channel handling for bicubic and super-sampling image resampling methods
  • Fixed: Very slow download speeds for updates in Vista
  • Fixed: In Vista, the updater would relaunch Paint.NET with the same administrator privileges that the installer executed in. Now it will relaunch Paint.NET with the pre-elevation user and privilege level. Note that this fix will not be apparent until the next update to Paint.NET.
  • Fixed some layout and rendering issues with the floating tool windows in Vista
  • Fixed a rendering issue with the font selection dropdown list
  • Fixed a performance issue with the font selection dropdown list in Vista
  • Right-clicking on a color in the palette will now set the secondary color
  • Palette files now allow comments to be placed after color values
  • Fixed: If Edit->Paste in to New Image was pasting a bitmap with transparency (from Paint.NET), it would have a white background instead of a transparent background.
  • Fixed: Right-clicking on a .PDN file in Explorer and then selecting "Print" would not work if Paint.NET was already open
  • Fixed over 10 user-reported crash bugs
  • Fixed several out-of-memory crashes
  • Fixes for many other miscellaneous, mostly minor, bugs

    You can download it at http://www.getpaint.net/files/PaintDotNet_3_0_Beta1.exe

    [Via Rick Brewster's blog]

  •