October, 2007

Testing sorting algorithms

Some time ago I had to deal with sorting algorithms. Besides my main task I found a good way how to test custom sorting algorithms. This blog entry is one of early birds, more about sorting algorihtms is coming soon. Hopefully some time after TechEd 2007 for Developers. The procedure I wrote to test sorting algorithms is simple and works. Of course, I am always opened for better ideas if somebody wants to suggest some. Here’s the little overview about what I’ve done.

How to create grayscale images on .NET

In this example we will use simple color recalculation method to grayscale images. For each pixel on image we will calculate “average color” that we write back on image. Average color is sum of current color’s red, green and blue channels integer value divided by three. This value is assigned to all three channels for current pixel.

SQL-DMO and searching from meta-data

Lately I faced the need to search for specified strings in all stored procedures in given database. I found SQL-DMO library very useful for it. So, ten minutes later I had a simple form that fits my needs perfectly. And some minutes later I had there some more cool features. As a result I had form that enables me to search for strings from stored procedures, user defined functions and views.


At the end of the previous month I wrote a posting on DefensiveDatasource class that can be used to associate ASP.NET’s GridView with collections containing objects of different types and based on one and the same base class. Dividing data into pages in GridView does, however, not succeed. An error message “The data source does not support server-side data paging” is displayed.

Creating simple tasks calendar for SharePoint sidebar

I needed view of SharePoint calendar where I can see not accomplished activities from beginning of calendar until tomorrow. If you ask me why I needed something like this, there is a simple answer: this calendar contains almost everything that is going on (mainly different milestones and deadlines).

Filtering SharePoint calendar by Start Time

I had a problem when trying to filter WSS 3.0 calendar list by Start Time column. This column doesn’t appear in filtered columns list somewhy. I found solution that smells like dirty hack to me, but at least it solved my problem.


We recently implemented some changes in the software development methodology used at our company and quite by chance encountered an interesting .Net 2.0 problem. Namely, when an object array inherited from the same base class is cast on a base class and submitted to the data binder, the latter gets confused. The array contained objects from different classes but all these classes had one and the same base class.

.Net and Deep Copy

Some time ago I had to clone objects and .Net’s shallow copy proved to be insufficient – it was necessary to use deep copy. No good tools are provided by .Net itself. If required, the object to be cloned must conform to the ICloneable interface and the Clone() method can be defined for the object. As the classes were not very numerous, but relatively bulky and complicated, there was no point in writing a Clone() method for all of them. I needed something else.

ASP.NET and Hierarchical Data

In addition to other new and interesting things ASP.NET also brought along controllers supporting representation of hierarchical data. This posting introduces IHierarchyData and IHierarchyEnumerable interfaces we can use to create wrappers for classes representing hierarchical data of the business logic layer.