Skip to main content

Posts

Showing posts from February, 2009

My First Lambda Expression ...

Instead of using the following code to bypass an invalid site certificate for the HTTPS web-service I'm using:

System.Net.ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CertificateValidation);
...
private bool CertificateValidation(
            Object sender,
            X509Certificate cert,
            X509Chain chain,
            SslPolicyErrors Errors)
        {
            return true;
        }

You can use a lambda expression to do the same thing - like this:

System.Net.ServicePointManager.ServerCertificateValidationCallback = ((sender, cert, chain, Errors) => true);

Sweet ;-)

The SDLC ...

Creating New User in SQL Server 2K5 and 2K8

Basically the GUI doesn't work properly - so just script it! Like this:

CREATE USER [NT AUTHORITY\NETWORK SERVICE]
FOR LOGIN [NT AUTHORITY\NETWORK SERVICE]
WITH DEFAULT_SCHEMA=[your_schema]
GO

The problem is when you want to assign a default Schema to your User - it just won't do it. You select 'your_schema', and hit 'Ok':



... only to find that your queries don't run as expected and when you go back into the settings GUI, the default Schema has gone back to 'dbo'. Grrrr ...