Archive for June, 2011

SQL Display Chinese Character

* Note: Only nvarchar, nchar support Chinese Characters.

Text, varchar doesn’t support unicode actually.

No Comments

Rolling Your Own Website Administration Tool

I have upgrade the version to support .aspx / page level security.

The page level security is saved in the parent folder web.config file.
ManageAccessRule

http://www.4guysfromrolla.com/articles/052307-1.aspx

No Comments

Change SharePoint Connection String

Change in Registry:
My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Secure\ConfigDb

No Comments

Math.Round Behavior

http://msdn.microsoft.com/en-us/library/3s2d3xkk.aspx

using System;

class Program
{
    static void Main()
    {
    Console.WriteLine("Classic Math.Round in CSharp");
    Console.WriteLine(Math.Round(4.4)); // 4
    Console.WriteLine(Math.Round(4.5)); // 4
    Console.WriteLine(Math.Round(4.6)); // 5
    Console.WriteLine(Math.Round(5.5)); // 6
    }
}

To round normally, (I assume that 4.5 should become 5 rather than default to 4), we have to pass a flag to Math.Round MidpointRounding.AwayFromZero

Math.Round((Decimal)number,0,MidpointRounding.AwayFromZero);

No Comments