Some notes on software development... RSS 2.0
# Wednesday, 16 September 2009

If you get a NotSupportedException of ‘WaitAll for multiple handles on a STA thread is not supported when using multi-threading’ in an MSTest project your need to modify the test project from being STA to MTA.

For Visual Studio 2008:
Open up the LocalTestRun.testrunconfig file for the project and add <ExecutionThread apartmentState=”1” /> after the <Description> tag:

image

Re-opening the solution and running the test again will now work without the exception.

Links:
Running MSTest In An MTA

Wednesday, 16 September 2009 07:16:50 (GMT Standard Time, UTC+00:00)  #    -
Testing
# Monday, 14 September 2009

From the www.smashingmagazine.com article, 10 Ways To Make Your XHTML Site Accessible Using Web Standards

<script type="text/javascript">  
//<![CDATA[  
$(function() {  
$('#divone').tipsy({fade: true, gravity: 'n'});  
$('#divtwo').tipsy({fade: true, gravity: 'n'});  
});  
//]]>  
</script>

Links
10 Ways To Make Your XHTML Site Accessible Using Web Standards
Monday, 14 September 2009 07:57:37 (GMT Standard Time, UTC+00:00)  #    -
Web Dev
# Friday, 11 September 2009

Here is an extension method that will swap two list items for any class that implements IList

public static void SwapElements<T>(this IList<T> obj, int index1, int index2)
{
    if (index1 > (obj.Count() - 1) ||
        index2 > (obj.Count() - 1) ||
        index1 < 0 || index2 < 0)
    {
        throw (new IndexOutOfRangeException());
    }

    T tempHolder = obj[index1];
    obj[index1] = obj[index2];
    obj[index2] = tempHolder;
}


And a quick test:

static void Main(string[] args)
{
    List<string> testList = new List<string>();

    testList.AddRange(new string[] { "Test1", "Test2", "Test3", "Test4", "Test5" });

    Console.WriteLine("Original List Contents");
    testList.ForEach(s => Console.WriteLine("{0}", s));

    testList.SwapElements(1, 3);

    Console.WriteLine(Environment.NewLine);
    Console.WriteLine("Swapped Item 1 with 3 List Contents");
    testList.ForEach(s => Console.WriteLine("{0}", s));

    Console.ReadLine();
}


The result:

image

Don’t forget that lists are zero-based ;-)

Friday, 11 September 2009 10:39:22 (GMT Standard Time, UTC+00:00)  #    -
C#
# Tuesday, 08 September 2009

If you change the name of a computer running SQL server you must also update the system metadata stored in sys.servers.
First check the current name by using

If @@SERVERNAME does not show the correct computer name you should change it using the following commands:

select @@SERVERNAME

sp_dropserver <old_name\instancename>
GO

sp_addserver <new_name\instancename>, local
GO



Last step is to restart the SQL Server instance.

Links
How to: Rename a Computer that Hosts a Stand-Alone Instance of SQL Server

Tuesday, 08 September 2009 08:26:13 (GMT Standard Time, UTC+00:00)  #    -
SQL Server
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 2018
Hadrian Phillips

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