Archives

Archives / 2007 / October
  • 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. Also I was able to search strings from mentioned objects names. I tested it on a little bit larger MS SQL Server database, iterating approximately through 500 database objects and searching for given string and I mentioned no performance problems. So, here's the example.

  • MoreDefensiveDatasource

    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). As it is common calendar and everybody wants to see everything then there is no need for personalized filter. And there was one more requirement - there must be support for states of tasks describing if event is planned, done or canceled, so we can show in sidebar calendar only the planned tasks or events.

  • 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. Oooh, this SharePoint is sometimes so kinky.... I'm almost sur ethere is better way to do that but if you are in hurry and need a working hack then here we go!

  • DefensiveDatasource

    We recently implemented some changes in the software development methodology used at Developers Team 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.