Writing comments is something you need to get used to; sooner or later you will understand it’s worth writing comments. Haven’t you find yourself in a sitation where you don’t understand what a couple of lines of YOUR OWN code do? I have…
XML documentation comments are also important, particularly for public members/methods. Even if your project doesn’t require generating full XML documentation of the code, using Intellisense can be much more effective if it summarizes the method you are trying to use. If you want to generate XML documentation for C# in the twinkling of an eye you MUST install Roland Weigelt’s GhostDoc plugin for Visual Studio. Let me cite the author:
Continue reading ‘Robust generation of XML documentation comments for C#’
Following my friend’s post I decided to change the plugin for highliting code snippets on this blog from Google Code Prettifier to Google Syntax Highlighter for WordPress.
This tool is much better – now code looks more fancy and you can always show/copy to clipboard the very code (without additional characters that need removing). If you’re running a blog where you publish fragments of code – don’t wait and install this tool now!
The only problem that change introduced was I had to change all old posts so that code is picked up by this plugin. It took an hour but was worth it.
When you RDC (connecting remotely using Remote Desktop Connection) to a server and get “Terminal server has exceeded maximum number of allowed connection” message there’s still light at the end of the tunnel.
Solution (tested on Windows 2003)
RDC to another server in the same workgroup as the one you cannot access and go to Administrative Tools / Terminal Services Manager.
Continue reading ‘Terminal server has exceeded maximum number of allowed connection – how to kill open sessions?’
The beginning of the stack trace I got today looked as below:
2009-05-19 11:01:45,078 ERROR [5232] XXX - Speaker already deleted: Castle.ActiveRecord.Framework.ActiveRecordException: Could not perform Delete for Speaker ---> NHibernate.Exceptions.GenericADOException: could not delete collection: [XXX#XXX][SQL: SQL not available] ---> System.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'SpeakerId', table 'XXX.dbo.lnk_Session_Speaker'; column does not allow nulls. UPDATE fails.
The statement has been terminated.
...
at SpeakerProxy3e9fd3b0e82745c2b91b8a353acaa93d.DeleteAndFlush()
Background
I had three tables and classes representing them: Session / app_Session, Speaker / app_Speaker, and SessionSpeaker / lnk_Session_Speaker.
Continue reading ‘Castle.ActiveRecord.Framework.ActiveRecordException: Could not perform Delete for XXX —> NHibernate.Exceptions.GenericADOException: could not delete collection’
Since I received Nokia e51 I’ve been browsing web pages with Opera Mini. This is a decent browser which makes reading pages easier but it can’t do all. The best case is when not only the browser cares to display the page best it can, but also the owner of the page does so, i.e. only important content is downloaded so that the page is lighter and loads faster (which is important if you are not having a free WI-FI connection).
Continue reading ‘Adapt your blog for mobile devices’
For those who work with C# I’d like to recommend a book which is a kind of summary of knowledge on C# 3.0. The book is quite short (and small by the way – yet pocket reference) but it covers lots of details on C# and describes what’s new in C# 3.0. Everything in short and simple, with code snippets.
I read this book as a first step towards TS: Microsoft .NET Framework – Application Development Foundation. Basically, I’ve started wondering if passing this exam is not a good step in my .NET career and this is the entry point.
Anyway this book is not a C# bible, but it can really help as a knowledge reresher.
Recommended.
Today I spend A LOT OF time on trying to display a percentage – string representation of a decimal but without trailing zeros, e.g. 15.1% instead of 15.10%.
In the application I already had NumberFormatInfo for displaying monetary values and percentages. An object of that type was defined as follows:
NumberFormatInfo nfi = new NumberFormatInfo();
nfi.PercentDecimalDigits = 2;
// some additional settings for nfi
// (including monetary and numeric attributes)
Continue reading ‘C#, decimal.toString(), and how to get rid of trailing zeros’