Some notes on software development... RSS 2.0
# Thursday, 07 January 2010

Create a new folder anywhere and call it GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}

image

Thursday, 07 January 2010 11:07:51 (GMT Standard Time, UTC+00:00)  #    -
Windows
# 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#
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)