Some notes on software development... RSS 2.0
# 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();
    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)  #    -
# 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:


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)  #    -
# 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.

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

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

Eindhoven University of Technology have a great tool called SequoiaView for displaying a treemap of the contents from a hard drive.
With it you can easily see what large files are consuming your disk space. Here is a pic of my drive:


Eindhoven University of Technology

Thursday, 17 July 2008 18:36:47 (GMT Standard Time, UTC+00:00)  #    -

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

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

© Copyright 2018
Hadrian Phillips

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