August 2007 Blog Posts
I just released a tool which validates files committed to Subversion repository - Svn Pre-Commit Validator (short SvnPCV). The tool is written in .NET 2 (C#) and is customisable via XML configuration file.
I decided to write such tool when working on a project where external textural content was edited by non-developers and submitted to Subversion. These content files had to comply to a certain standard, which was rearly the case when i got those, so i had to correct them. So i though it would be good is they just can't commit until the files are valid.
I wrote it and...
Came across this great article that shows some useful things that you can use when writing a custom configuration classes.
Things i found useful:
Has good examples
Lists all validators that are available in .NET 2.0 (e.g. RegexStringValidator)
Lists type converters (e.g. CommaDelimitedStringCollectionConverter)
Performance optimisation tips
Custom configuration proved to be every useful indeed. Writing custom configuration classes might look a bit over the top at first, but it's actually very quick and easy.
Another useful resource is here
Tags: .NET, Configuration
Came across Nini - .NET configuration library.
Might find it useful as some stage.
Tags: .NET, Configuration, Tools
Looking at HTML code highlighting options i found these:
http://www.manoli.net/csharpformat/ - online tool that allows you to format your C#, VB, HTML, XML, T-SQL or MSH (code name Monad) code for publishing on a web site or in a blog.
http://code.google.com/p/syntaxhighlighter/ - JavaScript syntax highlighting.
http://www.codeproject.com/aspnet/CSharpColorizer.asp - automate posting of formatted and colorized C# source code in four different ways (source in C#)
http://www.actiprosoftware.com/.../CodeHighlighter/ - free (no source though) web control with lots of supported languages.
http://projectdistributor.net/...projectId=11 - currently supports 23 languages by default and...
I have developed a simple error reporting component for web applications (and infact for and windows and console applications too) which sends email alerts to developer(s). It has flood sport feature and support for mupliple recipients with individual alert settings, so you have a first level suport receives an alert immediately and the second level support receives supports an alers only if a specified time interval has passed since first error (e.g. after one hour)
The conficuation is xml based, e.g:
<ErrorReporter fromAddress="email@domain.com" fromName="Error Reporter" subject="Error" ...
While using SubSonic, i noticed ActiveRecord.LoadFromPost method, so i googled to see what this method does. It turns out that it loads object properties from form post by control names, i.e. it finds all the controls with the same name as the your ActiveRecord descendant object properties (column names) and initializes the object from them.
I say it's great!
Tags: SubSonic, DAL, .NET
To find out what program/process is using a particular file use Unlocker
Simply right click the folder or file and select Unlocker
Tags: Windows, Tools
While rewriting Permissions class (with Allow/Deny/Inherit flags), i did some performance testing on different implementations:
3 sets of enum flags encapsulated in a class
3 sets of enum flags encapsulated in a struct
Dictionary implementation (Dictionary<PermissionsItem, AllowType>)
Here are test results:
Performance (using simple timers):
There's no performance difference between using struct instead of class
Indexer: at least 5 time faster than using Dictionaries
ToString: class implementation provided fastest results. Structs and dictionaries were about the same (1.5 times slower)
Construction...
Today i had some frustration with passing objects to XSLT using AddExtensionObject.
Calling methods from XSLT worked, but not the properties.
I did some googling but couldn't find the answer. It seem as if XSLT doesn't support object properties. This is such a nuisance.
Update:
I found a solution! It turnes out that .NET creates getter and setter methods for each property in IL.
E.g. if you had a read/write property Address, the in the ILĀ it'll have corresponding methods get_Address() and set_Address(string).
So you can access property from XSLT by calling "get_[PropertyName]()" method.
Tags: .NET, XML, XSLT
Recently i needed to provide RSS feeds on a website and i searched for code that will enable me to do it quickly and easily. I found these:
Argotic Syndication Framework - The Argotic Syndication Framework is a Microsoft .NET class library framework that enables developers to easily consume and generate web content syndication services from within their own applications. The framework makes reading and writing syndication data sources in common formats such as RSS, Atom, OPML, RSD, etc. very easy while still remaining powerful enough to handle the myriad of syndication extensions commonly in use today....
Today i finally had time to test SubSonic - code generation tool for your DAL. I must say i was impressed how easy it was to set it up and how useful it proved to be. I was anti- code generation in the past, but it turned out that for quick/small projects this is indeed very handy. It creates all your objects based on your database, so you interact with data using object without dealing with SQL directly.
If you haven't used any DAL frameworks, it's certainly worth a try.
Tags: .NET, SubSonic, DAL
Hi everyone,
Today is the day I decided to start a blog. I found myself searching for useful stuff for .NET and other programming stuff almost on a daily basis. So i though i'll share it with others.
Your feedback is appreciated.