Some notes on software development... RSS 2.0
# Thursday, 21 August 2008

The following SQL will return all English error codes and messages:

SELECT      Error,
            Severity,
            Description
FROM        master.dbo.sysmessages
WHERE       msglangid = 1033
ORDER BY    Error


It returns about 7549 rows:

image

Thursday, 21 August 2008 13:24:03 (GMT Standard Time, UTC+00:00)  #    -
SQL Server
# Wednesday, 20 August 2008

The following function returns the number of SQL Server statements from a SQL text file using GO as the batch separator:

private int GetBatchCount(string scriptFile)
{
    string allSql = string.Empty;

    using (StreamReader sr = new StreamReader(scriptFile)) 
    {
        allSql = sr.ReadToEnd();
        sr.Close();
    }
    
    Regex regex = new Regex(@"^\s*GO\s*$", RegexOptions.IgnoreCase | RegexOptions.Multiline);

    return regex.Split(allSql).Length - 1;    
}
Wednesday, 20 August 2008 12:32:22 (GMT Standard Time, UTC+00:00)  #    -
C#
# Friday, 15 August 2008

When trying to use anonymous methods called by Control.Invoke, like so:

this.Invoke(delegate { txtTest.Text = "Hello World"; });


you get the follow compiler error:

image

This is because the Delegate class, expected by the Control.Invoke method, is not a delegate type which the anonymous method is.
To work round this you can cast the anonymous method to a MethodInvoker delegate.
Our previous code now becomes:

this.Invoke((MethodInvoker)delegate { txtTest.Text = "Hello World"; });


Guy Mahieu has a nice blog about it here.

 
Friday, 15 August 2008 16:13:17 (GMT Standard Time, UTC+00:00)  #    -
C#
# Thursday, 14 August 2008

Mark Russinovich has a great blog entry describing the Windows OS memory limits. He explains why you never get the full 4Gb on 32-bit Windows XP machine.

Links
Pushing the Limits of Windows: Physical Memory
Mark Russinovich's Blog

Thursday, 14 August 2008 15:47:00 (GMT Standard Time, UTC+00:00)  #    -
Windows
Navigation

Sign In
Extras
Statistics
Total Posts: 116
This Year: 0
This Month: 0
This Week: 0
Comments: 36
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2017
Hadrian Phillips

All Content © 2017, Hadrian Phillips
DasBlog theme 'Business' created by Christoph De Baene (delarou)