.NET C#

GO Contact Sync is alive!

Ok, this post is long overdue, but... First of all my apologies to all the people who sent me an email and i have not had a chance to respond to. Having a second child, moving house, working full time, studying part time at uni, and so on.  I was hoping to come back to those bugs and fix them, but as time went by i've realised it's less and less likely to happen. Luckily there were some proactive people who forked the project and continue to actively maintain it. Thanks, big-r, createsoftware, cybdis, floriwan. So, for those of you that have not lost hope...

SmartBiller Development

I'm working hard to bring you a PDA (Windows Mobile) version of SmartBiller and the next version of desktop SmartBiller. Here's what's coming: PDA version Synchronization API Synchronization Server and Cost Center Data import (to load clients, project and categories) Extra fields for entries Bug fixes We are expecting to have the next version ready in December 2009. Watch this space. Tags: .NET, C#, Tools, SmartBiller

GO Contact Sync Proxy Support

This morning i have received an email from Craig who has suggested a very simple solution to enable proxy in GO Contact Sync. The trick is to created a config file GOContactSync.exe.config in installation directory and put this content in: <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.net> <defaultProxy enabled="true" useDefaultCredentials="true"> <proxy bypassonlocal="true" proxyaddress="http://proxy:80/" /> </defaultProxy> </system.net> </configuration> Then replace "http://proxy:80/" with...

SmartBiller

I'm happy to announce a release of SmartBiller - a time tracking tool for consultants. It's implemented as an application which sits in the system tray and you just double-click its icon to start a timer. There are 2 flavours available: Free and Professional. Professional edition comes with Plugin API so you can extend the application and integrate it with other systems. Free edition naturally has some limitations - namely number of timers you can run simultaneously, number of clients, projects and tasks. There's no time limit though. See feature comparison table. Give it at try and see how you spend your day at work or on your...

ClassFromConfig v1.4.0

I'm happy to announce a new release of ClassFromConfig - v1.4.0! Lots of improvements there. I had to rewrite the code generation code almost from scratch so it is more managable and easy to extend later on. Changes include: Rewritten the code generator engine to be more managable.  Added lost of tests.  Added "options file" support which enables to store ConfigFromClass settings in project .config file.  Added ability to update config file and automaticallt register generated custom sections. Added support for default collections  ...

GO Contact Sync update

Hi, I've released GO Contact Sync v1.0.0.3 where expiration date is removed. So it will work without any limits. I'm still in the process of migrading GO Contact Sync to open source (have decided to go with sourceforge.net), so those of you who have errors with synchronizing will have to wait a bit longer. Tags: Tools, Google, Outlook, .NET, C#, Open Source

GO Contact Sync! Go Open Source!

It's been awhile since my last update. Lots of things happened during this time. I may write about some of them in my next posts as it relates to why i'm writing the following: I had some good feedback about GO Contact Sync over past few months. Thanks guys. I also got some error reports (yes, there were error belive it or not :). Some of the errors are quite tricky to tackle as it involves a Google account and an Outlook Contacts folder both which are unique to a particular user. You can guess that replicating the same error is not easy. Plus i...

FxCop in CruiseControl.NET

I have finally integrated FxCop into my automated build process. Now i can see FxCop summary and detailed reports on the CruiseControls.NET dashboard. Initially I was misguided somewhat by CruiseControl.NET's documentation when it said We don't currently support running FxCop directly from CruiseControl.NET, but we plan on enabling this in a later release. It seemed that the only way FxCop could be used with CC.NET is via NAnt. However it turned out to be very easy to do it just via Executable Task. Here's what i did: Added FxCop project file to my solution (so i could select which assemblies to...

Path Helper Methods

A couple of helper methods to work with file paths: /// <summary> /// Returns filepath's path that is relative to root /// </summary> /// <param name="root"></param> /// <param name="filepath"></param> /// <returns>If filepath is not under root, /// returns filepath</returns> public static string GetRelativeFileName(string root, string filepath) { if (filepath.StartsWith(root, StringComparison.OrdinalIgnoreCase)) { if (root.EndsWith("\\")) return filepath.Substring(root.Length); else return filepath.Substring(root.Length+1); } else return filepath; } /// <summary> /// Returns the...

ClassFromConfig v1.3.1

I have finally migrated ClassFromConfig project to SourceForge.net Now there's version control (Subversion), Issue Tracker, Wiki, Forum and more. So, if you want to contribute to the project - let me know. As for the update - it's a minor release, which includes: ability to load linked config files (via configSource attribute).  node collection can now be any tag (not limited to "<add ...", can use "<item ...", etc.) - must be at least 2 in the config to recognise it as a collection. I've got several enhancements on my to-do list: Ability to create nested classes...

Html Agility Pack

Recently I was working on a project that involved "scraping" information from a website. A did a bit of research for available libraries that provide the toolset to do these efficiently. I found Html Agility Pack, created by Simon Mourier. It's a parser that transforms any real world HTML into valid XML, from which you can then extract information by using XPath. I also had to use a FormProcessor add-on for Html Agility Pack to simulate login process. These tools proved to be very useful. Tags: .NET, C#, Open Source, Tools

NGenerics

Recently i found this .NET 2 library - NGenerics: "A class library providing generic data structures and algorithms not implemented in the standard .NET framework." If has some very nice and useful data structures: Association<TKey, TValue>Bag<T>BinaryTree<T>BinarySearchTree<TKey, TValue>Deque<T>GeneralTree<T>Graph<T>Heap<T>MatrixPascalSetPriorityQueue<T>SkipList<TKey, TValue>SortedList<T>SortedList<T>RedBlackTree<T>ReadOnlyPropertyCollection <T, TProperty>ObjectMatrix<T>HashList<TKey, TValue>VisitableHashTable<TKey, TValue>VisitableLinkedList<T>VisitableList<T>VisitableQueue<T>VisitableStack<T> Definitely useful. Tags: .NET, Libraries

ClassFromConfig v1.3

Better later than never: Happy New Year! And as a New Year gift to you all i'm pleased to announce  a release of ClassFromConfig version 1.3 with support for supports custom sections, e.g if you had <configuration> <ErrorReporter fromAddress="email@domain.com" fromName="Error Reporter" subject="Error: {0}, {1}" floodSubject="Error Flood" enabled="true" ...

ClassFromConfig v1.2

I have updated ClassFromConfig to version 1.2. Now it supports connection strings, e.g if you had <connectionStrings> <add name="MyConnection" connectionString="..."/></connectionStrings> in your config, you could access it as follows: Config.ConnectionStrings.MyConnection Unfortunately there was a problem in previous releases. It was a "works on my machine" syndrome. Doh! Luckily it was discovered, thanks to Gabriel. Anyway, check out ClassFromConfig - it'll save you time. Tags: .NET, C#, Open Source, Configuration, Tools

Forms Authentication in Web Services

Recently I was working on a project where a Windows Application needed to access Web Application via Web Services. Web Application was using FormsAuthentication. And Windows Application had to "log-in" to the Web Service in order to interact with it. So the solution I found to be working as desired is as follows. My Web Service has a LogIn method: public void LogIn(string username, string password){ if (!System.Web.Security.Membership.Provider.ValidateUser(username, password)) throw new System.Security.SecurityException("Enable to login"); System.Web.Security.FormsAuthentication.SetAuthCookie(username, true);} And my Windows Application has this code to call my Web Service: private MyWebService myWebService;private void Form1_Load(object sender, EventArgs...

A Proper Build Server

Recently I have installed CruiseControl.NET – a continuous integration server. It was a good move. My previous encounter with continuous integration involved just a set batch scripts. Although I could do just fine with batch scripts, I feel much better now when I have a proper build server setup. My build server consists of the following components: CruiseControl.NET – continuous integration server. Subversion – version control system. MSBuild – my build tool of choice. NUnit – unit testing framework. CruiseControl.NET CruiseControl.NET is and continuous integration server and it’s an integral...

ClassFromConfig v1.1.1

An update to my previous post: I have updated ClassFromConfig to automatically recognise value types. Types that it can recognise: Boolean Integer Double DateTime String array (String[]) I'm planning to add generation of connection string properties, e.g if you had <connectionStrings> <add name="MyConnection" connectionString="..."/></connectionStrings> in your config, you could access it as follows: Config.ConnectionStrings.MyConnection Tags: .NET, C#, Open Source, Configuration, Tools

Generate Class From Config for C#

.NET configuration is great. But i don't really like working with ConfigurationManager.AppSettings, because i get annoyed: that i have to remember key names that i may accidentally make typos in the key names, and then spend time looking for it. I'd rather have a class with all my configuration items presented as properties, so i can enjoy intellisence when reading my app settings. There are two options here: Write a simple wrapper class that reads app settings and provides access to those via properties Write a custom configuration provider with would...

Svn Pre-Commit Validator

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...

.NET 2.0 Configuration

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

Nini

Came across Nini - .NET configuration library. Might find it useful as some stage. Tags: .NET, Configuration, Tools

Error Reporting in .NET

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" ...

SubSonic LoadFromPost method

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

Performance testing

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...

AddExtensionObject and XSLT

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

Syndication Frameworks

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....

SubSonic

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