October 2011 Entries

Free Anti-Virus software that is reliable

I often get this question: "I want a free but good and reliable anti-virus software". I can honestly say that the AVG anti-virus package is not only free, but well supported and I have used it for probably over ten years and never had an issue with neither the software nor with viruses on my machine. I however also have to add that I think we should support the commercial versions as those folks also have to make a living, and when comparing prices AVG is very competitive. Of course the commercial ......

T-Sql - rename a table or column name via stored procedure

Goal: Rename a database table or column name using a t-sql stored procedure. How to: Rename a table: EXEC sp_rename 'TableToBeRename', 'NewTableName' Rename a column: EXEC sp_rename @objname = 'TableNameColumnToBeRenamed, @newname = 'NewColumnName', @objtype = 'COLUMN' ......

.Net Rounding issue (MidpointRounding)

Issue: .Net rounding does not work as you would expect. -2.5 rounds to -2 and not -3. What?! Yes! By default .Net uses MidpointRounding.ToEven which will round it to -2. BUT if you round off -3.5 it works as you would expect to -4. If you round off -6.5 you think it would also round off to -7, but you would be wrong, -6! What about 2.5, the default rounds off the 2 and not 3 as you would expect. So what is going on? You can read more about it at http://msdn.microsoft.com/e... ......

.Net - find business days

Goal: Find the business days; i.e. exclude weekends How to: Here is some code to get the first business day after or before the weekend. It is surprisingly simple but thought the code may help save folks some time. Just a note that there is no built-in .Net feature to give you public US or other holiday calendar dates, you need to build your own using a table to keep track of public holidays in most situations. Simple enough to do, extend the methods below to query a database or xml or JSON, etc, ......