<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://dotnet.org.za/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Colin&amp;#39;s Blog</title><subtitle type="html" /><id>http://dotnet.org.za/colin/atom.aspx</id><link rel="alternate" type="text/html" href="http://dotnet.org.za/colin/default.aspx" /><link rel="self" type="application/atom+xml" href="http://dotnet.org.za/colin/atom.aspx" /><generator uri="http://communityserver.org" version="3.0.20611.960">Community Server</generator><updated>2007-03-30T08:57:50Z</updated><entry><title>Team SOAK wins Imagine Cup 2008</title><link rel="alternate" type="text/html" href="http://dotnet.org.za/colin/archive/2008/07/09/team-soak-wins-imagine-cup-2008.aspx" /><id>http://dotnet.org.za/colin/archive/2008/07/09/team-soak-wins-imagine-cup-2008.aspx</id><published>2008-07-09T11:23:00Z</published><updated>2008-07-09T11:23:00Z</updated><content type="html">&lt;p&gt;Well done to &lt;a href="http://davidburela.wordpress.com/"&gt;David Burela&lt;/a&gt; from &lt;a href="http://www.readify.net/"&gt;Readify&lt;/a&gt; and the rest of the SOAK team for winning the Imagine Cup. &lt;/p&gt;
&lt;p&gt;Read More:&lt;/p&gt;
&lt;p&gt;&lt;a title="http://www.smh.com.au/news/technology/aussies-beat-the-world-in-imagine-cup/2008/07/09/1215282896605.html" href="http://www.smh.com.au/news/technology/aussies-beat-the-world-in-imagine-cup/2008/07/09/1215282896605.html"&gt;http://www.smh.com.au/news/technology/aussies-beat-the-world-in-imagine-cup/2008/07/09/1215282896605.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a title="http://davidburela.wordpress.com/2008/05/22/2008-imagine-cup-australian-winner-project-soak/" href="http://davidburela.wordpress.com/2008/05/22/2008-imagine-cup-australian-winner-project-soak/"&gt;http://davidburela.wordpress.com/2008/05/22/2008-imagine-cup-australian-winner-project-soak/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a title="http://apcmag.com/imagine_cups_surprise_winners_a_boon_for_farmers.htm" href="http://apcmag.com/imagine_cups_surprise_winners_a_boon_for_farmers.htm"&gt;http://apcmag.com/imagine_cups_surprise_winners_a_boon_for_farmers.htm&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I only met David a couple of days before he left for Paris, when I &lt;a href="http://dotnet.org.za/colin/archive/2008/06/12/life-reset.aspx"&gt;joined Readify&lt;/a&gt; so I really can&amp;#39;t give any insider knowledge other than the internal mailing lists have been buzzing about it for weeks now. Andrew has some &lt;a href="http://mrandypuppy.spaces.live.com/Blog/cns!DD1DBF44B68E3310!682.entry?wa=wsignin1.0"&gt;more on his blog&lt;/a&gt;.&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://dotnet.org.za/colin/archive/2008/07/09/team-soak-wins-imagine-cup-2008.aspx&amp;amp;;subject=Team+SOAK+wins+Imagine+Cup+2008" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/07/09/team-soak-wins-imagine-cup-2008.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://dotnet.org.za/colin/archive/2008/07/09/team-soak-wins-imagine-cup-2008.aspx&amp;amp;;title=Team+SOAK+wins+Imagine+Cup+2008" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/07/09/team-soak-wins-imagine-cup-2008.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://dotnet.org.za/colin/archive/2008/07/09/team-soak-wins-imagine-cup-2008.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/07/09/team-soak-wins-imagine-cup-2008.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://dotnet.org.za/colin/archive/2008/07/09/team-soak-wins-imagine-cup-2008.aspx&amp;amp;title=Team+SOAK+wins+Imagine+Cup+2008" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/07/09/team-soak-wins-imagine-cup-2008.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://dotnet.org.za/colin/archive/2008/07/09/team-soak-wins-imagine-cup-2008.aspx&amp;amp;;title=Team+SOAK+wins+Imagine+Cup+2008" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/07/09/team-soak-wins-imagine-cup-2008.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://dotnet.org.za/colin/archive/2008/07/09/team-soak-wins-imagine-cup-2008.aspx&amp;amp;;title=Team+SOAK+wins+Imagine+Cup+2008&amp;amp;;top=1" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/07/09/team-soak-wins-imagine-cup-2008.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://dotnet.org.za/aggbug.aspx?PostID=476688" width="1" height="1"&gt;</content><author><name>colin</name><uri>http://dotnet.org.za/members/colin.aspx</uri></author><category term="Readify" scheme="http://dotnet.org.za/colin/archive/tags/Readify/default.aspx" /></entry><entry><title>Life.Reset();</title><link rel="alternate" type="text/html" href="http://dotnet.org.za/colin/archive/2008/06/12/life-reset.aspx" /><id>http://dotnet.org.za/colin/archive/2008/06/12/life-reset.aspx</id><published>2008-06-12T09:00:06Z</published><updated>2008-06-12T09:00:06Z</updated><content type="html">&lt;p&gt;In about a week I&amp;#39;ll be landing in Melbourne to take up a position with &lt;a href="http://www.readify.net/"&gt;Readify&lt;/a&gt;. It sounds like a great place to work with a bunch of very skilled people. It will force me to jump in the deep end again and get on top of the latest Microsoft products.&lt;/p&gt;  &lt;p&gt;Melbourne is a beautiful city and I think it&amp;#39;s going to be a good place for me and my family to live. By all accounts the &lt;a href="http://savage.org.za/colin/labels/Windsurfing.html"&gt;windsurfing&lt;/a&gt; is good there too!&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://dotnet.org.za/colin/archive/2008/06/12/life-reset.aspx&amp;amp;;subject=Life.Reset()%3b" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/06/12/life-reset.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://dotnet.org.za/colin/archive/2008/06/12/life-reset.aspx&amp;amp;;title=Life.Reset()%3b" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/06/12/life-reset.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://dotnet.org.za/colin/archive/2008/06/12/life-reset.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/06/12/life-reset.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://dotnet.org.za/colin/archive/2008/06/12/life-reset.aspx&amp;amp;title=Life.Reset()%3b" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/06/12/life-reset.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://dotnet.org.za/colin/archive/2008/06/12/life-reset.aspx&amp;amp;;title=Life.Reset()%3b" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/06/12/life-reset.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://dotnet.org.za/colin/archive/2008/06/12/life-reset.aspx&amp;amp;;title=Life.Reset()%3b&amp;amp;;top=1" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/06/12/life-reset.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://dotnet.org.za/aggbug.aspx?PostID=452098" width="1" height="1"&gt;</content><author><name>colin</name><uri>http://dotnet.org.za/members/colin.aspx</uri></author></entry><entry><title>Fluent Argument Validation</title><link rel="alternate" type="text/html" href="http://dotnet.org.za/colin/archive/2008/05/29/fluent-argument-validation.aspx" /><id>http://dotnet.org.za/colin/archive/2008/05/29/fluent-argument-validation.aspx</id><published>2008-05-29T09:18:00Z</published><updated>2008-05-29T09:18:00Z</updated><content type="html">&lt;p&gt;Roger Alsing has written some neat code for argument validation using &lt;a href="http://en.wikipedia.org/wiki/Fluent_interface"&gt;fluent&lt;/a&gt; C# extension methods. Read the &amp;quot;&lt;a href="http://rogeralsing.com/2008/05/10/followup-how-to-validate-a-methods-arguments/"&gt;How to validate a method’s arguments?&lt;/a&gt;&amp;quot; blog entry. Here&amp;#39;s a sample taken from that blog entry.&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; MyMethod(&lt;span class="kwrd"&gt;string&lt;/span&gt; someArg,&lt;span class="kwrd"&gt;int&lt;/span&gt; someOtherArg)
{
   someArg.RequireArgument(&lt;span class="str"&gt;&amp;quot;someArg&amp;quot;&lt;/span&gt;)
          .NotNull()
          .ShorterThan(10)
          .StartsWith(&lt;span class="str"&gt;&amp;quot;Roger&amp;quot;&lt;/span&gt;);

   someOtherArg.RequireArgument(&lt;span class="str"&gt;&amp;quot;someOtherArg&amp;quot;&lt;/span&gt;)
               .InRange(10,100)
               .NotEqual(33)
               .NotEqual(51)
    &lt;span class="rem"&gt;//do stuff&lt;/span&gt;
}&lt;/pre&gt;
&lt;p&gt;He&amp;#39;s also put together some of his other code into a &lt;a href="http://rogeralsing.com/2008/05/28/argument-validation-framework-released/"&gt;mini-framework for download&lt;/a&gt;. The &lt;a href="http://rogeralsing.com/2008/05/09/async-calls-fork/"&gt;async fork&lt;/a&gt; is another another class worth taking a look at for a nice clean way to run asyncronous tasks.&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://dotnet.org.za/colin/archive/2008/05/29/fluent-argument-validation.aspx&amp;amp;;subject=Fluent+Argument+Validation" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/05/29/fluent-argument-validation.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://dotnet.org.za/colin/archive/2008/05/29/fluent-argument-validation.aspx&amp;amp;;title=Fluent+Argument+Validation" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/05/29/fluent-argument-validation.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://dotnet.org.za/colin/archive/2008/05/29/fluent-argument-validation.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/05/29/fluent-argument-validation.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://dotnet.org.za/colin/archive/2008/05/29/fluent-argument-validation.aspx&amp;amp;title=Fluent+Argument+Validation" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/05/29/fluent-argument-validation.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://dotnet.org.za/colin/archive/2008/05/29/fluent-argument-validation.aspx&amp;amp;;title=Fluent+Argument+Validation" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/05/29/fluent-argument-validation.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://dotnet.org.za/colin/archive/2008/05/29/fluent-argument-validation.aspx&amp;amp;;title=Fluent+Argument+Validation&amp;amp;;top=1" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/05/29/fluent-argument-validation.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://dotnet.org.za/aggbug.aspx?PostID=440657" width="1" height="1"&gt;</content><author><name>colin</name><uri>http://dotnet.org.za/members/colin.aspx</uri></author><category term="C#" scheme="http://dotnet.org.za/colin/archive/tags/C_2300_/default.aspx" /></entry><entry><title>Maps Addin Photos</title><link rel="alternate" type="text/html" href="http://dotnet.org.za/colin/archive/2008/05/23/maps-addin-photos.aspx" /><id>http://dotnet.org.za/colin/archive/2008/05/23/maps-addin-photos.aspx</id><published>2008-05-23T08:00:05Z</published><updated>2008-05-23T08:00:05Z</updated><content type="html">&lt;p&gt;Jorge Mozo was kind enough to send me some photos of the &lt;a href="http://dotnet.org.za/colin/archive/2005/07/28/google-maps-on-your-xp-media-center.aspx"&gt;Google Maps Addin&lt;/a&gt; for Windows Media Center running on his big screen TV using an XBox 360 extender. I think it looks pretty cool!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotnet.org.za/blogs/colin/WindowsLiveWriter/MapsAddinPhotos_8C92/Xbox360_1.jpg"&gt;&lt;img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px;" height="184" alt="Xbox360" src="http://dotnet.org.za/blogs/colin/WindowsLiveWriter/MapsAddinPhotos_8C92/Xbox360_thumb_1.jpg" width="244" border="0" /&gt; &lt;img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px;" height="184" alt="GMAPS" src="http://dotnet.org.za/blogs/colin/WindowsLiveWriter/MapsAddinPhotos_8C92/GMAPS_thumb.jpg" width="244" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;He also has the new Moon and Mars maps addin installed.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotnet.org.za/blogs/colin/WindowsLiveWriter/MapsAddinPhotos_8C92/GMOON.jpg"&gt;&lt;img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px;" height="184" alt="GMOON" src="http://dotnet.org.za/blogs/colin/WindowsLiveWriter/MapsAddinPhotos_8C92/GMOON_thumb.jpg" width="244" border="0" /&gt;&lt;/a&gt;&lt;a href="http://dotnet.org.za/blogs/colin/WindowsLiveWriter/MapsAddinPhotos_8C92/GMARS.jpg"&gt;&lt;img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px;" height="184" alt="GMARS" src="http://dotnet.org.za/blogs/colin/WindowsLiveWriter/MapsAddinPhotos_8C92/GMARS_thumb.jpg" width="244" border="0" /&gt;&lt;/a&gt;&amp;#160; &lt;/p&gt;  &lt;p&gt;Jorge has also been helping me to translate the instructions into Spanish.&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://dotnet.org.za/colin/archive/2008/05/23/maps-addin-photos.aspx&amp;amp;;subject=Maps+Addin+Photos" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/05/23/maps-addin-photos.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://dotnet.org.za/colin/archive/2008/05/23/maps-addin-photos.aspx&amp;amp;;title=Maps+Addin+Photos" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/05/23/maps-addin-photos.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://dotnet.org.za/colin/archive/2008/05/23/maps-addin-photos.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/05/23/maps-addin-photos.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://dotnet.org.za/colin/archive/2008/05/23/maps-addin-photos.aspx&amp;amp;title=Maps+Addin+Photos" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/05/23/maps-addin-photos.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://dotnet.org.za/colin/archive/2008/05/23/maps-addin-photos.aspx&amp;amp;;title=Maps+Addin+Photos" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/05/23/maps-addin-photos.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://dotnet.org.za/colin/archive/2008/05/23/maps-addin-photos.aspx&amp;amp;;title=Maps+Addin+Photos&amp;amp;;top=1" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/05/23/maps-addin-photos.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://dotnet.org.za/aggbug.aspx?PostID=436642" width="1" height="1"&gt;</content><author><name>colin</name><uri>http://dotnet.org.za/members/colin.aspx</uri></author><category term="Media Center" scheme="http://dotnet.org.za/colin/archive/tags/Media+Center/default.aspx" /></entry><entry><title>Browse the Moon and Mars from your couch too</title><link rel="alternate" type="text/html" href="http://dotnet.org.za/colin/archive/2008/04/25/browse-the-moon-and-mars-from-your-couch-too.aspx" /><id>http://dotnet.org.za/colin/archive/2008/04/25/browse-the-moon-and-mars-from-your-couch-too.aspx</id><published>2008-04-25T09:19:00Z</published><updated>2008-04-25T09:19:00Z</updated><content type="html">&lt;p&gt;&lt;a href="http://dotnet.org.za/blogs/colin/WindowsLiveWriter/BrowsetheMoonandMarsfromyourcouchtoo_9FFB/Untitled_2.png"&gt;&lt;img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px;" height="184" alt="Untitled" src="http://dotnet.org.za/blogs/colin/WindowsLiveWriter/BrowsetheMoonandMarsfromyourcouchtoo_9FFB/Untitled_thumb.png" width="244" align="left" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Google introduced maps of the Moon and Mars a while ago, now you can access those maps using the JavaScript API. I&amp;#39;ve created Windows Media Center addins for those too in case you&amp;#39;ve run out of places to explore on earth. &lt;/p&gt;  &lt;p&gt;Get the installs for GMAPMCE, GMOONMCE and GMARSMCE from &lt;a href="http://savage.org.za/mediacenter.htm"&gt;http://savage.org.za/mediacenter.htm&lt;/a&gt;&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://dotnet.org.za/colin/archive/2008/04/25/browse-the-moon-and-mars-from-your-couch-too.aspx&amp;amp;;subject=Browse+the+Moon+and+Mars+from+your+couch+too" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/04/25/browse-the-moon-and-mars-from-your-couch-too.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://dotnet.org.za/colin/archive/2008/04/25/browse-the-moon-and-mars-from-your-couch-too.aspx&amp;amp;;title=Browse+the+Moon+and+Mars+from+your+couch+too" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/04/25/browse-the-moon-and-mars-from-your-couch-too.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://dotnet.org.za/colin/archive/2008/04/25/browse-the-moon-and-mars-from-your-couch-too.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/04/25/browse-the-moon-and-mars-from-your-couch-too.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://dotnet.org.za/colin/archive/2008/04/25/browse-the-moon-and-mars-from-your-couch-too.aspx&amp;amp;title=Browse+the+Moon+and+Mars+from+your+couch+too" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/04/25/browse-the-moon-and-mars-from-your-couch-too.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://dotnet.org.za/colin/archive/2008/04/25/browse-the-moon-and-mars-from-your-couch-too.aspx&amp;amp;;title=Browse+the+Moon+and+Mars+from+your+couch+too" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/04/25/browse-the-moon-and-mars-from-your-couch-too.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://dotnet.org.za/colin/archive/2008/04/25/browse-the-moon-and-mars-from-your-couch-too.aspx&amp;amp;;title=Browse+the+Moon+and+Mars+from+your+couch+too&amp;amp;;top=1" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/04/25/browse-the-moon-and-mars-from-your-couch-too.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://dotnet.org.za/aggbug.aspx?PostID=427645" width="1" height="1"&gt;</content><author><name>colin</name><uri>http://dotnet.org.za/members/colin.aspx</uri></author><category term="Media Center" scheme="http://dotnet.org.za/colin/archive/tags/Media+Center/default.aspx" /></entry><entry><title>WebUnitAsp 2 : An experiment in unit testing asp.net</title><link rel="alternate" type="text/html" href="http://dotnet.org.za/colin/archive/2008/04/22/webunitasp-2-an-experiment-in-unit-testing-asp-net.aspx" /><id>http://dotnet.org.za/colin/archive/2008/04/22/webunitasp-2-an-experiment-in-unit-testing-asp-net.aspx</id><published>2008-04-22T16:38:38Z</published><updated>2008-04-22T16:38:38Z</updated><content type="html">&lt;p&gt;After the dismal failure of &lt;a href="http://dotnet.org.za/colin/archive/2006/08/10/WebUnitAsp.aspx"&gt;WebUnitAsp&lt;/a&gt; (thanks to the 2 people that downloaded it and the 1 person that spammed the discussion group), I thought that I might have another go and address some of the shortcomings of the original. For those that don&amp;#39;t know what it is, it&amp;#39;s a testing library based around the &lt;a href="http://nunitasp.sourceforge.net"&gt;NUnitAsp&lt;/a&gt; model of control testers for each of the asp.net built in controls (i.e. there&amp;#39;s a ButtonTester for Buttons, PanelTester for Panels etc.) and uses browser automation to load the pages.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://savage.org.za/downloads/WebUnitAsp2.zip"&gt;Download WebUnitAsp2.zip&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The code above is really just a proof of concept and builds on some other applications and code. &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://haacked.com/archive/2006/12/12/using_webserver.webdev_for_unit_tests.aspx"&gt;haacked: Using WebServer.WebDev For Unit Tests&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;WebServer.WebDev is the built in web server in Visual Studio 2005 so you&amp;#39;ll need that to be able to run the tests. Not a big ask since I&amp;#39;m sure most people develop asp.net in Visual Studio. I have modified the original code slightly to allow me to point it at an existing directory and start a webserver there.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://watin.sourceforge.net/"&gt;WatiN&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The latest release (2.0 CTP) from WatiN has support for Internet Explorer and Firefox automation. While asking Phil Haack for permission to use the webserver code above, he asked how it&amp;#39;s different from WatiN; the answer is &lt;em&gt;not much.&lt;/em&gt; Instead of duplicating the effort of browser automation, I have built this version on top of WatiN. For Firefox automation you&amp;#39;ll need to install the JSSH plugin as detailed on the WatiN website.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.nunit.org/"&gt;NUnit&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The unit tests are written using NUnit but it is not necessary to use NUnit.&lt;/p&gt;  &lt;p&gt;What all this allows you to do is to write tests like the code below:&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:1ccc68a3-3119-456f-9d0d-506a0c91e626" style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;"&gt;&lt;pre style="background-color:White;"&gt;&lt;div&gt;&lt;span style="color:#000000;"&gt;[Test]
&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt; SimpleTest()
{
    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;using&lt;/span&gt;&lt;span style="color:#000000;"&gt; (TestWebServer webserver &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;new&lt;/span&gt;&lt;span style="color:#000000;"&gt; TestWebServer(&lt;/span&gt;&lt;span style="color:#000000;"&gt;12345&lt;/span&gt;&lt;span style="color:#000000;"&gt;, &lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;/Foo&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;, &lt;/span&gt;&lt;span style="color:#000000;"&gt;@&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;C:\WebUnitAsp.TestSite&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;))
    {
        Uri baseUri &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; webserver.Start();
        &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;string&lt;/span&gt;&lt;span style="color:#000000;"&gt; startPage &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; baseUri &lt;/span&gt;&lt;span style="color:#000000;"&gt;+&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;Buttons.aspx&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;;
        &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;using&lt;/span&gt;&lt;span style="color:#000000;"&gt; (IBrowser browser &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;new&lt;/span&gt;&lt;span style="color:#000000;"&gt; FireFox(startPage))
        {
            WebForm form &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;new&lt;/span&gt;&lt;span style="color:#000000;"&gt; WebForm(browser, webserver);
            ButtonTester disabled &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;new&lt;/span&gt;&lt;span style="color:#000000;"&gt; ButtonTester(&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;_disabledButton&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;, form);
            Assert.IsFalse(disabled.Enabled, &lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;Button should be disabled&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;);
        }
    }
}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Note that the webserver starts on the specified port and will compile any asp.net content in the specified directory, so in this case baseUri will be &lt;a href="http://localhost:12345/Foo/"&gt;http://localhost:12345/Foo/&lt;/a&gt; . Because the web server is started using managed code, you can then use a tool like &lt;a href="http://ncover.org/"&gt;NCover&lt;/a&gt; to obtain the code coverage of the unit tests on the server side asp.net code. &lt;/p&gt;

&lt;p&gt;&lt;a href="http://dotnet.org.za/blogs/colin/WindowsLiveWriter/WebUnitAsp2Anexperimentinunittesting.net_104DB/coverage.png"&gt;&lt;img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px;" height="126" alt="coverage" src="http://dotnet.org.za/blogs/colin/WindowsLiveWriter/WebUnitAsp2Anexperimentinunittesting.net_104DB/coverage_thumb.png" width="244" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;The &amp;quot;Tester&amp;quot; objects take care of resolving the content in the browser like a button inside a nested MasterPage has an ID of &amp;quot;_ctl0__ctl0_ContentPlaceHolder1_ContentPlaceHolder2_button&amp;quot; when the page runs with with &amp;lt;xhtmlConformance mode=&amp;quot;Legacy&amp;quot;/&amp;gt; in the web.config and an ID of &amp;quot;ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder2_button&amp;quot; when there is &amp;lt;xhtmlConformance mode=&amp;quot;Strict&amp;quot;/&amp;gt; in web.config. There is an example of this in the download with the following test code:&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;div class="wlWriterSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:112fe515-e6bf-4646-85a9-6edde722e4e2" style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;"&gt;&lt;pre style="background-color:White;"&gt;&lt;div&gt;&lt;span style="color:#0000FF;"&gt;string&lt;/span&gt;&lt;span style="color:#000000;"&gt; startPage &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; String.Format(&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;{0}{1}&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;, BaseUrl, &lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;NestedMasterPageWebForm.aspx&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;);
browser.GoTo(startPage);
WebForm form &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;new&lt;/span&gt;&lt;span style="color:#000000;"&gt; WebForm(browser, &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;this&lt;/span&gt;&lt;span style="color:#000000;"&gt;.WebServer);
MasterPageTester master1 &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;new&lt;/span&gt;&lt;span style="color:#000000;"&gt; MasterPageTester(form);
MasterPageTester master2 &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;new&lt;/span&gt;&lt;span style="color:#000000;"&gt; MasterPageTester(master1);
ContentPlaceHolderTester content1 &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;new&lt;/span&gt;&lt;span style="color:#000000;"&gt; ContentPlaceHolderTester(&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;ContentPlaceHolder1&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;, master2);
ContentPlaceHolderTester content2 &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;new&lt;/span&gt;&lt;span style="color:#000000;"&gt; ContentPlaceHolderTester(&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;ContentPlaceHolder2&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;, content1);
ButtonTester button &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;new&lt;/span&gt;&lt;span style="color:#000000;"&gt; ButtonTester(&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;button&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;, content2);
Assert.IsTrue(button.Visible, &lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;Control Exists&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;It is intended that from any Tester object, that you can also access the underlying html elements. It is quite a big stack of technologies, but I&amp;#39;d like to hear any ideas, criticism, problems etc.&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://dotnet.org.za/colin/archive/2008/04/22/webunitasp-2-an-experiment-in-unit-testing-asp-net.aspx&amp;amp;;subject=WebUnitAsp+2+%3a+An+experiment+in+unit+testing+asp.net" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/04/22/webunitasp-2-an-experiment-in-unit-testing-asp-net.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://dotnet.org.za/colin/archive/2008/04/22/webunitasp-2-an-experiment-in-unit-testing-asp-net.aspx&amp;amp;;title=WebUnitAsp+2+%3a+An+experiment+in+unit+testing+asp.net" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/04/22/webunitasp-2-an-experiment-in-unit-testing-asp-net.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://dotnet.org.za/colin/archive/2008/04/22/webunitasp-2-an-experiment-in-unit-testing-asp-net.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/04/22/webunitasp-2-an-experiment-in-unit-testing-asp-net.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://dotnet.org.za/colin/archive/2008/04/22/webunitasp-2-an-experiment-in-unit-testing-asp-net.aspx&amp;amp;title=WebUnitAsp+2+%3a+An+experiment+in+unit+testing+asp.net" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/04/22/webunitasp-2-an-experiment-in-unit-testing-asp-net.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://dotnet.org.za/colin/archive/2008/04/22/webunitasp-2-an-experiment-in-unit-testing-asp-net.aspx&amp;amp;;title=WebUnitAsp+2+%3a+An+experiment+in+unit+testing+asp.net" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/04/22/webunitasp-2-an-experiment-in-unit-testing-asp-net.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://dotnet.org.za/colin/archive/2008/04/22/webunitasp-2-an-experiment-in-unit-testing-asp-net.aspx&amp;amp;;title=WebUnitAsp+2+%3a+An+experiment+in+unit+testing+asp.net&amp;amp;;top=1" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/04/22/webunitasp-2-an-experiment-in-unit-testing-asp-net.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://dotnet.org.za/aggbug.aspx?PostID=427187" width="1" height="1"&gt;</content><author><name>colin</name><uri>http://dotnet.org.za/members/colin.aspx</uri></author><category term="C#" scheme="http://dotnet.org.za/colin/archive/tags/C_2300_/default.aspx" /></entry><entry><title>I didn't know I could do that #5 : Send html form via email</title><link rel="alternate" type="text/html" href="http://dotnet.org.za/colin/archive/2008/02/21/i-didn-t-know-i-could-do-that-5-send-html-form-via-email.aspx" /><id>http://dotnet.org.za/colin/archive/2008/02/21/i-didn-t-know-i-could-do-that-5-send-html-form-via-email.aspx</id><published>2008-02-21T12:07:50Z</published><updated>2008-02-21T12:07:50Z</updated><content type="html">&lt;p&gt;Until now I thought the only way to send email from a web page was using a hyperlink and the mailto: syntax e.g.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#808080"&gt;&amp;lt;a href=&amp;quot;mailto:name@example.org?subject=Rhubarb&amp;amp;amp;body=This is the body&amp;quot; &amp;gt;Send mail&amp;lt;/a&amp;gt;&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;and the content of the email was limited to how much data you can fit into 2048 characters (the url length limit in IE).&lt;/p&gt;  &lt;p&gt;However, today it occurred to me that instead of using the anchor tag &amp;lt;a&amp;gt;, to use a &amp;lt;form&amp;gt; tag and POST the data to the mailto address by submitting the form. Doh! it&amp;#39;s so obvious now...&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#808080"&gt;&amp;lt;form action=&amp;quot;mailto:name@example.org?subject=rhubarb&amp;quot;&amp;quot; method=&amp;quot;POST&amp;quot;&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;!-- input, hidden fields etc go here --&amp;gt;        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;bigdata&amp;quot; value=&amp;quot;some really long data&amp;quot; /&amp;gt;        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;input type=&amp;quot;submit&amp;quot; value=&amp;quot;send mail&amp;quot; name=&amp;quot;submit&amp;quot;/&amp;gt;        &lt;br /&gt;&amp;lt;/form&amp;gt;&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;It works that way in IE at least, Firefox still has a size limit. &lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://dotnet.org.za/colin/archive/2008/02/21/i-didn-t-know-i-could-do-that-5-send-html-form-via-email.aspx&amp;amp;;subject=I+didn%27t+know+I+could+do+that+%235+%3a+Send+html+form+via+email" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/02/21/i-didn-t-know-i-could-do-that-5-send-html-form-via-email.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://dotnet.org.za/colin/archive/2008/02/21/i-didn-t-know-i-could-do-that-5-send-html-form-via-email.aspx&amp;amp;;title=I+didn%27t+know+I+could+do+that+%235+%3a+Send+html+form+via+email" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/02/21/i-didn-t-know-i-could-do-that-5-send-html-form-via-email.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://dotnet.org.za/colin/archive/2008/02/21/i-didn-t-know-i-could-do-that-5-send-html-form-via-email.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/02/21/i-didn-t-know-i-could-do-that-5-send-html-form-via-email.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://dotnet.org.za/colin/archive/2008/02/21/i-didn-t-know-i-could-do-that-5-send-html-form-via-email.aspx&amp;amp;title=I+didn%27t+know+I+could+do+that+%235+%3a+Send+html+form+via+email" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/02/21/i-didn-t-know-i-could-do-that-5-send-html-form-via-email.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://dotnet.org.za/colin/archive/2008/02/21/i-didn-t-know-i-could-do-that-5-send-html-form-via-email.aspx&amp;amp;;title=I+didn%27t+know+I+could+do+that+%235+%3a+Send+html+form+via+email" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/02/21/i-didn-t-know-i-could-do-that-5-send-html-form-via-email.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://dotnet.org.za/colin/archive/2008/02/21/i-didn-t-know-i-could-do-that-5-send-html-form-via-email.aspx&amp;amp;;title=I+didn%27t+know+I+could+do+that+%235+%3a+Send+html+form+via+email&amp;amp;;top=1" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/02/21/i-didn-t-know-i-could-do-that-5-send-html-form-via-email.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://dotnet.org.za/aggbug.aspx?PostID=338382" width="1" height="1"&gt;</content><author><name>colin</name><uri>http://dotnet.org.za/members/colin.aspx</uri></author><category term="HTML" scheme="http://dotnet.org.za/colin/archive/tags/HTML/default.aspx" /></entry><entry><title>When the power goes out...</title><link rel="alternate" type="text/html" href="http://dotnet.org.za/colin/archive/2008/02/04/when-the-power-goes-out.aspx" /><id>http://dotnet.org.za/colin/archive/2008/02/04/when-the-power-goes-out.aspx</id><published>2008-02-04T09:45:35Z</published><updated>2008-02-04T09:45:35Z</updated><content type="html">&lt;p&gt;Since the rolling blackouts in ZA are here to stay for a while, here&amp;#39;s a scrap of C# 2.0 code I wrote to notify me when the power goes out at my house. I have an old laptop that my Internet connection is plugged into, so it switches onto battery power but the wireless iburst connection stays connected. It runs as a windows service but I&amp;#39;ll leave the basics of that to &lt;a title="Walkthrough: Creating a Windows Service Application in the Component Designer" href="http://msdn2.microsoft.com/en-us/library/zt39148a(VS.80).aspx"&gt;this article&lt;/a&gt;. In my case it sends an email but it could perform some other action.&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:08ee2141-567a-435f-bac6-eedf49c3c750" style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;"&gt;&lt;pre style="background-color:Silver;"&gt;&lt;div&gt;&lt;span style="color:#0000FF;"&gt;using&lt;/span&gt;&lt;span style="color:#000000;"&gt; System;
&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;using&lt;/span&gt;&lt;span style="color:#000000;"&gt; System.ServiceProcess;
&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;using&lt;/span&gt;&lt;span style="color:#000000;"&gt; System.Net.Mail;
&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;using&lt;/span&gt;&lt;span style="color:#000000;"&gt; System.Windows.Forms;
&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;using&lt;/span&gt;&lt;span style="color:#000000;"&gt; System.Configuration;

&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;partial&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;class&lt;/span&gt;&lt;span style="color:#000000;"&gt; Battery : ServiceBase
{
    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;private&lt;/span&gt;&lt;span style="color:#000000;"&gt; PowerLineStatus _status &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; PowerLineStatus.Unknown;
    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;private&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;string&lt;/span&gt;&lt;span style="color:#000000;"&gt; _from, _to, _smtpHost;
    
    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; Battery()
    {
        InitializeComponent();
    }

    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;protected&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;override&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt; OnStart(&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;string&lt;/span&gt;&lt;span style="color:#000000;"&gt;[] args)
    {
        PowerLineStatus _status &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; SystemInformation.PowerStatus.PowerLineStatus;
        _from &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; ConfigurationManager.AppSettings[&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;from&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;];
        _to &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; ConfigurationManager.AppSettings[&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;to&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;];
        _smtpHost &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; ConfigurationManager.AppSettings[&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;smtp&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;];
    }

    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;protected&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;override&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;bool&lt;/span&gt;&lt;span style="color:#000000;"&gt; OnPowerEvent(PowerBroadcastStatus powerStatus)
    {
        PowerLineStatus newStatus &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; SystemInformation.PowerStatus.PowerLineStatus;
        &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;if&lt;/span&gt;&lt;span style="color:#000000;"&gt; (powerStatus &lt;/span&gt;&lt;span style="color:#000000;"&gt;==&lt;/span&gt;&lt;span style="color:#000000;"&gt; PowerBroadcastStatus.PowerStatusChange &lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span style="color:#000000;"&gt; newStatus &lt;/span&gt;&lt;span style="color:#000000;"&gt;!=&lt;/span&gt;&lt;span style="color:#000000;"&gt; _status)
        {
            _status &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; newStatus;
            MailMessage message &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;new&lt;/span&gt;&lt;span style="color:#000000;"&gt; MailMessage(
                _from, 
                _to, 
                String.Format(&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;Power status is {0}&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;, _status),
                DateTime.Now.ToString());
            SmtpClient smtp &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;new&lt;/span&gt;&lt;span style="color:#000000;"&gt; SmtpClient(_smtpHost);
            smtp.Send(message);
        }

        &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;return&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;base&lt;/span&gt;&lt;span style="color:#000000;"&gt;.OnPowerEvent(powerStatus);
    }
}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Perhaps combined with some GPS coordinates and an online map, a view of the current power state for the whole country could be possible?&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://dotnet.org.za/colin/archive/2008/02/04/when-the-power-goes-out.aspx&amp;amp;;subject=When+the+power+goes+out..." target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/02/04/when-the-power-goes-out.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://dotnet.org.za/colin/archive/2008/02/04/when-the-power-goes-out.aspx&amp;amp;;title=When+the+power+goes+out..." target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/02/04/when-the-power-goes-out.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://dotnet.org.za/colin/archive/2008/02/04/when-the-power-goes-out.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/02/04/when-the-power-goes-out.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://dotnet.org.za/colin/archive/2008/02/04/when-the-power-goes-out.aspx&amp;amp;title=When+the+power+goes+out..." target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/02/04/when-the-power-goes-out.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://dotnet.org.za/colin/archive/2008/02/04/when-the-power-goes-out.aspx&amp;amp;;title=When+the+power+goes+out..." target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/02/04/when-the-power-goes-out.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://dotnet.org.za/colin/archive/2008/02/04/when-the-power-goes-out.aspx&amp;amp;;title=When+the+power+goes+out...&amp;amp;;top=1" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2008/02/04/when-the-power-goes-out.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://dotnet.org.za/aggbug.aspx?PostID=309988" width="1" height="1"&gt;</content><author><name>colin</name><uri>http://dotnet.org.za/members/colin.aspx</uri></author></entry><entry><title>Adding JScript.Net Scripting to C# Application</title><link rel="alternate" type="text/html" href="http://dotnet.org.za/colin/archive/2007/09/25/adding-jscript-net-scripting-to-c-application.aspx" /><id>http://dotnet.org.za/colin/archive/2007/09/25/adding-jscript-net-scripting-to-c-application.aspx</id><published>2007-09-25T17:10:50Z</published><updated>2007-09-25T17:10:50Z</updated><content type="html">&lt;p&gt;&lt;a href="http://savage.org.za/downloads/CsJScriptDemo.zip"&gt;Download Code: CsJScriptDemo.zip&lt;/a&gt; 46KB&lt;/p&gt;  &lt;p&gt;I didn&amp;#39;t find much on the &amp;#39;net when I was looking for ways to do this so here is my solution for adding basic scripting functionality to a C# application with an object model. This method uses CodeDOM to generate and compile a JScript.net class on the fly, using the classes and interfaces from the C# application. It uses .Net 2.0, and a Visual Studio 2005 solution is provided.&lt;/p&gt;  &lt;p&gt;For the purposes of this exercise, I have a windows forms application as shown below. The application has a Listbox bound to a collection of items on the left, a Textbox to type scripts into on the right and a Button to execute the script.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://savage.org.za/images/AddingJScript.NetScriptingtoCApplication_F517/jscsapp.png"&gt;&lt;img id="id" style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px;" height="124" alt="jscsapp" src="http://savage.org.za/images/AddingJScript.NetScriptingtoCApplication_F517/jscsapp_thumb.png" width="244" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;For the object model I have 2 objects: &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;em&gt;Application&lt;/em&gt; has a Title property that changes the title of the main form, and a generic collection of &lt;em&gt;Item&lt;/em&gt; objects which is bound to the list on the left. &lt;/li&gt;    &lt;li&gt;&lt;em&gt;Item &lt;/em&gt;has a single property &lt;em&gt;Text.&lt;/em&gt; &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Jumping into the code, the Item and Application objects are shown below. Note that both objects inherit from JSObject to get the &lt;a href="http://en.wikipedia.org/wiki/Associative_array#JavaScript"&gt;associative array behaviour&lt;/a&gt; that you would expect in javascript, but it is not required. The Application constructor has a reference to the Form object so that we can change the text.&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:21b9bbee-ac23-49c8-9959-e99c38ef8128" style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;"&gt;&lt;pre style="background-color:Silver;"&gt;&lt;div&gt;&lt;span style="color:#0000FF;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;class&lt;/span&gt;&lt;span style="color:#000000;"&gt; Item:Microsoft.JScript.JSObject 
{ 
    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;private&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;string&lt;/span&gt;&lt;span style="color:#000000;"&gt; _text; 
    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; Item(&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;string&lt;/span&gt;&lt;span style="color:#000000;"&gt; text) 
    { 
        _text &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; text; 
    } 

    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;string&lt;/span&gt;&lt;span style="color:#000000;"&gt; Text { &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;get&lt;/span&gt;&lt;span style="color:#000000;"&gt; { &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;return&lt;/span&gt;&lt;span style="color:#000000;"&gt; _text; } &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;set&lt;/span&gt;&lt;span style="color:#000000;"&gt; { _text &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; value; } } 

}

&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;class&lt;/span&gt;&lt;span style="color:#000000;"&gt; Application:Microsoft.JScript.JSObject 
{ 
    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;private&lt;/span&gt;&lt;span style="color:#000000;"&gt; Collection&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;Item&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; _items; 
    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;private&lt;/span&gt;&lt;span style="color:#000000;"&gt; System.Windows.Forms.Form _form; 

    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;internal&lt;/span&gt;&lt;span style="color:#000000;"&gt; Application(System.Windows.Forms.Form form) 
    { 
        _items &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;new&lt;/span&gt;&lt;span style="color:#000000;"&gt; Collection&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;Item&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;(); 
        _form &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; form; 
    } 

    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; Collection&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;Item&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; Items { &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;get&lt;/span&gt;&lt;span style="color:#000000;"&gt; { &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;return&lt;/span&gt;&lt;span style="color:#000000;"&gt; _items; } } 

    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;string&lt;/span&gt;&lt;span style="color:#000000;"&gt; Title { &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;get&lt;/span&gt;&lt;span style="color:#000000;"&gt; { &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;return&lt;/span&gt;&lt;span style="color:#000000;"&gt; _form.Text; } &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;set&lt;/span&gt;&lt;span style="color:#000000;"&gt; { _form.Text &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; value; } } 
}

&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;The main form has an instance of the Application object which will be passed to the script when it is executed.&lt;/p&gt;

&lt;p&gt;
  &lt;div class="wlWriterSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:baad68ad-e071-4493-949d-910acfb39161" style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;"&gt;&lt;pre style="background-color:Silver;"&gt;&lt;div&gt;&lt;span style="color:#0000FF;"&gt;private&lt;/span&gt;&lt;span style="color:#000000;"&gt; Savage.CsJScriptDemo.Model.Application _application;

&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; Form1()
{
    InitializeComponent();

    _application &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;new&lt;/span&gt;&lt;span style="color:#000000;"&gt; Savage.CsJScriptDemo.Model.Application(&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;this&lt;/span&gt;&lt;span style="color:#000000;"&gt;);
    UpdateList();           
}

&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;private&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt; UpdateList()
{
     &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;this&lt;/span&gt;&lt;span style="color:#000000;"&gt;._listBox.DataSource &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;null&lt;/span&gt;&lt;span style="color:#000000;"&gt;;
     &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;this&lt;/span&gt;&lt;span style="color:#000000;"&gt;._listBox.DataSource &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; _application.Items;
     &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;this&lt;/span&gt;&lt;span style="color:#000000;"&gt;._listBox.DisplayMember &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;Text&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;;
}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;To execute the script I have a single method on an interface called &lt;em&gt;ICompiledScript.Go &lt;/em&gt;which takes the &lt;em&gt;Application&lt;/em&gt; instance. You can change this or add more methods that with different arguments and return types if you need to. The JScript will be compiled into a class that implements that interface, so that we don&amp;#39;t need to use invoke to call the methods.&lt;/p&gt;

&lt;p&gt;
  &lt;div class="wlWriterSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:16df65b2-433b-4ce3-8e73-dbffe3ab7bac" style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;"&gt;&lt;pre style="background-color:Silver;"&gt;&lt;div&gt;&lt;span style="color:#000000;"&gt;ICompiledScript compiled &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; ScriptCompiler.Compile(_scriptTextBox.Text);
compiled.Go(_application);
UpdateList();&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;I&amp;#39;ll refer you to the source code attached for the entire ScriptCompiler class because CodeDOM is quite verbose as you can see from the fragment below:&lt;/p&gt;

&lt;p&gt;
  &lt;div class="wlWriterSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:513336a9-a50f-44be-99a5-8578beeb1d53" style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;"&gt;&lt;pre style="background-color:Silver;"&gt;&lt;div&gt;&lt;span style="color:#008000;"&gt;//&lt;/span&gt;&lt;span style="color:#008000;"&gt;could easily be C# or VB&lt;/span&gt;&lt;span style="color:#008000;"&gt;
&lt;/span&gt;&lt;span style="color:#000000;"&gt;CodeDomProvider codeProvider &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;new&lt;/span&gt;&lt;span style="color:#000000;"&gt; JScriptCodeProvider();

&lt;/span&gt;&lt;span style="color:#008000;"&gt;//&lt;/span&gt;&lt;span style="color:#008000;"&gt;Namespaces&lt;/span&gt;&lt;span style="color:#008000;"&gt;
&lt;/span&gt;&lt;span style="color:#000000;"&gt;CodeNamespace codeNamespace &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;new&lt;/span&gt;&lt;span style="color:#000000;"&gt; CodeNamespace(&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;some.arbitrary.name.space&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;);
codeNamespace.Imports.Add(&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;new&lt;/span&gt;&lt;span style="color:#000000;"&gt; CodeNamespaceImport(&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;System&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;));
codeNamespace.Imports.Add(&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;new&lt;/span&gt;&lt;span style="color:#000000;"&gt; CodeNamespaceImport(&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;Savage.CsJScriptDemo.Model&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;));

&lt;/span&gt;&lt;span style="color:#008000;"&gt;//&lt;/span&gt;&lt;span style="color:#008000;"&gt;Scripting Class&lt;/span&gt;&lt;span style="color:#008000;"&gt;
&lt;/span&gt;&lt;span style="color:#000000;"&gt;CodeTypeDeclaration codeTypeDecl &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;new&lt;/span&gt;&lt;span style="color:#000000;"&gt; CodeTypeDeclaration(className);
codeTypeDecl.IsClass &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;true&lt;/span&gt;&lt;span style="color:#000000;"&gt;;
codeTypeDecl.BaseTypes.Add(&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;typeof&lt;/span&gt;&lt;span style="color:#000000;"&gt;(&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;object&lt;/span&gt;&lt;span style="color:#000000;"&gt;));
codeTypeDecl.BaseTypes.Add(&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;typeof&lt;/span&gt;&lt;span style="color:#000000;"&gt;(ICompiledScript));
codeNamespace.Types.Add(codeTypeDecl);

&lt;/span&gt;&lt;span style="color:#008000;"&gt;//&lt;/span&gt;&lt;span style="color:#008000;"&gt;...snip
&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;There are no special tricks in the &lt;em&gt;ScriptCompiler&lt;/em&gt; class, it creates a class that implements &lt;em&gt;ICompiledScript, &lt;/em&gt;adds a constructor and the &lt;em&gt;Go&lt;/em&gt; method containing the script provided. The assembly is then compiled in memory and an instance of the class returned. &lt;/p&gt;

&lt;p&gt;There are some quirks in this method that you&amp;#39;ll need to experiment with for your application e.g. &lt;/p&gt;

&lt;p&gt;The case of toString() is ToString() so either implement the other method or use a regex to replace the offending text before compiling the script. &lt;/p&gt;

&lt;p&gt;You will run into code access security permissions at some point if you are accessing files or UI elements etc.&lt;/p&gt;

&lt;p&gt;Your JScript class cannot inherit from a C# class but you can implement interfaces.&lt;/p&gt;

&lt;p&gt;Because you are referencing the C# assembly, all the public classes exposed in that assembly are available to the JScript (if the user knows the namespaces) so be careful what you make available. You could also use regex to check for those kind of things before you compile.&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://dotnet.org.za/colin/archive/2007/09/25/adding-jscript-net-scripting-to-c-application.aspx&amp;amp;;subject=Adding+JScript.Net+Scripting+to+C%23+Application" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/09/25/adding-jscript-net-scripting-to-c-application.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://dotnet.org.za/colin/archive/2007/09/25/adding-jscript-net-scripting-to-c-application.aspx&amp;amp;;title=Adding+JScript.Net+Scripting+to+C%23+Application" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/09/25/adding-jscript-net-scripting-to-c-application.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://dotnet.org.za/colin/archive/2007/09/25/adding-jscript-net-scripting-to-c-application.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/09/25/adding-jscript-net-scripting-to-c-application.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://dotnet.org.za/colin/archive/2007/09/25/adding-jscript-net-scripting-to-c-application.aspx&amp;amp;title=Adding+JScript.Net+Scripting+to+C%23+Application" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/09/25/adding-jscript-net-scripting-to-c-application.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://dotnet.org.za/colin/archive/2007/09/25/adding-jscript-net-scripting-to-c-application.aspx&amp;amp;;title=Adding+JScript.Net+Scripting+to+C%23+Application" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/09/25/adding-jscript-net-scripting-to-c-application.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://dotnet.org.za/colin/archive/2007/09/25/adding-jscript-net-scripting-to-c-application.aspx&amp;amp;;title=Adding+JScript.Net+Scripting+to+C%23+Application&amp;amp;;top=1" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/09/25/adding-jscript-net-scripting-to-c-application.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://dotnet.org.za/aggbug.aspx?PostID=208786" width="1" height="1"&gt;</content><author><name>colin</name><uri>http://dotnet.org.za/members/colin.aspx</uri></author><category term="C#" scheme="http://dotnet.org.za/colin/archive/tags/C_2300_/default.aspx" /><category term="JScript.Net" scheme="http://dotnet.org.za/colin/archive/tags/JScript.Net/default.aspx" /></entry><entry><title>WiX v3.0, LGHT0217 error and Light.exe unhandled exception on Vista</title><link rel="alternate" type="text/html" href="http://dotnet.org.za/colin/archive/2007/09/12/wix-v3-0-lght0217-error-and-light-exe-unhandled-exception-on-vista.aspx" /><id>http://dotnet.org.za/colin/archive/2007/09/12/wix-v3-0-lght0217-error-and-light-exe-unhandled-exception-on-vista.aspx</id><published>2007-09-12T14:16:07Z</published><updated>2007-09-12T14:16:07Z</updated><content type="html">&lt;p&gt;Here&amp;#39;s 2 tips for developers using &lt;a href="http://wix.sourceforge.net/"&gt;WiX 3.0&lt;/a&gt; on Vista: &lt;/p&gt; &lt;ol&gt; &lt;li&gt;If you are getting &lt;em&gt;&lt;strong&gt;error MSB6006: &amp;quot;Light.exe&amp;quot; exited with code -532459699&lt;/strong&gt;&amp;nbsp; &lt;/em&gt;or light.exe crashes with an unhandled exception and you are running v3.0.2925.0 or earlier build, get one of the later nightly builds from &lt;a href="http://wix.sf.net/releases"&gt;http://wix.sf.net/releases&lt;/a&gt;. I used v3.0.3307.0 and that fixed the problem.&lt;/li&gt; &lt;li&gt;If you are getting this error: &lt;em&gt;&lt;strong&gt;light.exe : error LGHT0217 : An unexpected external UI message was received: The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2738.&lt;/strong&gt;&lt;/em&gt; I found the answer &lt;a href="http://www.nabble.com/Re%3A-unexpected-external-ui-message-p6834428.html"&gt;here&lt;/a&gt;, it turns out that vbscript.dll is not registered and some of the installer validations are written in vbscript. To fix the problem, open a command prompt as administrator, and run the following command:&lt;/li&gt;&lt;/ol&gt; &lt;blockquote&gt; &lt;p&gt;&lt;strong&gt;C:\&amp;gt;regsvr32.exe C:\Windows\System32\vbscript.dll&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://dotnet.org.za/colin/archive/2007/09/12/wix-v3-0-lght0217-error-and-light-exe-unhandled-exception-on-vista.aspx&amp;amp;;subject=WiX+v3.0%2c+LGHT0217+error+and+Light.exe+unhandled+exception+on+Vista" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/09/12/wix-v3-0-lght0217-error-and-light-exe-unhandled-exception-on-vista.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://dotnet.org.za/colin/archive/2007/09/12/wix-v3-0-lght0217-error-and-light-exe-unhandled-exception-on-vista.aspx&amp;amp;;title=WiX+v3.0%2c+LGHT0217+error+and+Light.exe+unhandled+exception+on+Vista" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/09/12/wix-v3-0-lght0217-error-and-light-exe-unhandled-exception-on-vista.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://dotnet.org.za/colin/archive/2007/09/12/wix-v3-0-lght0217-error-and-light-exe-unhandled-exception-on-vista.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/09/12/wix-v3-0-lght0217-error-and-light-exe-unhandled-exception-on-vista.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://dotnet.org.za/colin/archive/2007/09/12/wix-v3-0-lght0217-error-and-light-exe-unhandled-exception-on-vista.aspx&amp;amp;title=WiX+v3.0%2c+LGHT0217+error+and+Light.exe+unhandled+exception+on+Vista" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/09/12/wix-v3-0-lght0217-error-and-light-exe-unhandled-exception-on-vista.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://dotnet.org.za/colin/archive/2007/09/12/wix-v3-0-lght0217-error-and-light-exe-unhandled-exception-on-vista.aspx&amp;amp;;title=WiX+v3.0%2c+LGHT0217+error+and+Light.exe+unhandled+exception+on+Vista" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/09/12/wix-v3-0-lght0217-error-and-light-exe-unhandled-exception-on-vista.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://dotnet.org.za/colin/archive/2007/09/12/wix-v3-0-lght0217-error-and-light-exe-unhandled-exception-on-vista.aspx&amp;amp;;title=WiX+v3.0%2c+LGHT0217+error+and+Light.exe+unhandled+exception+on+Vista&amp;amp;;top=1" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/09/12/wix-v3-0-lght0217-error-and-light-exe-unhandled-exception-on-vista.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://dotnet.org.za/aggbug.aspx?PostID=206526" width="1" height="1"&gt;</content><author><name>colin</name><uri>http://dotnet.org.za/members/colin.aspx</uri></author><category term="MSI" scheme="http://dotnet.org.za/colin/archive/tags/MSI/default.aspx" /></entry><entry><title>He that fights and runs away...</title><link rel="alternate" type="text/html" href="http://dotnet.org.za/colin/archive/2007/08/20/he-that-fights-and-runs-away.aspx" /><id>http://dotnet.org.za/colin/archive/2007/08/20/he-that-fights-and-runs-away.aspx</id><published>2007-08-20T04:49:14Z</published><updated>2007-08-20T04:49:14Z</updated><content type="html">&lt;p&gt;On Thursday last week I was chatting to someone on instant messenger about the&amp;nbsp;free &lt;a href="http://savage.org.za/mediacenter.htm"&gt;ZaEpg&lt;/a&gt; service that I have been running, and the question of how long I planned to continue providing the service came up. I said that I had no intention to stop, but who knows what can happen in the future. Ironically the next day it happened.&lt;/p&gt; &lt;p&gt;For those that don&amp;#39;t know, I was scraping the tv guide content from the dstv.com website and and supplying it to users in xmltv format for the Mediaportal,&amp;nbsp;Mythtv&amp;nbsp;and other&amp;nbsp;HTPC users, the EPG format required for Windows Media Center, and in pdf. &lt;a href="http://dotnet.org.za/colin/archive/2005/10/25/47663.aspx"&gt;Originally I had written a scraper that anyone could use&lt;/a&gt; but that seemed to cause problems for the dstv website so it was removed in favour of one person downloading the epg and delivering it to the other users.&lt;/p&gt; &lt;p&gt;On Friday afternoon&amp;nbsp;at&amp;nbsp;14:22&amp;nbsp;I received an emailed&amp;nbsp;letter from multichoice&amp;#39;s lawyers, demanding that I cease and desist publishing their copyrighted EPG&amp;nbsp;and notify them&amp;nbsp;within 48 hours of receiving the letter. Now I know you&amp;#39;re all thinking : &amp;quot;That&amp;#39;s a bit heavy handed, why didn&amp;#39;t they just send an email instead of reaching for their lawyers?&amp;quot; and &amp;quot;That&amp;nbsp;really is a strange time to send a letter and demand notice&amp;nbsp;within 48 hours&amp;quot;&amp;nbsp;and &amp;quot;Surely the people using the EPG are their subscribers?&amp;quot; and &amp;quot;Perhaps they think all the HTPC users will buy a multichoice PVR?&amp;quot;.&lt;/p&gt; &lt;p&gt;To be fair, they are right that I was publishing the copyrighted info, and in accordance with the terms of their emailed letter, I have ceased and desisted. All the content was removed on Friday afternoon and they were notified via email at 17:33 on the same day. Furthermore I have no intention of continuing to provide to anyone&amp;nbsp;the dstv EPG in any format whatsoever.&lt;/p&gt; &lt;p&gt;The approximately 1400 people using the various services: Since&amp;nbsp;it was a free service, I have nothing to gain by getting into a legal scrap with multichoice. I am not going to provide the&amp;nbsp;scraper software to assist dstv subscribers to download the epg from the dstv website, as I see no reason to support the people paying the company that is sending lawyers at me. It should be apparent how much multichoice cares about you.&amp;nbsp;Perhaps your R440 could buy you a new dvd box set to watch&amp;nbsp;every month, a computer game to play on those powerful HTPCs you have or maybe a few books to read instead.&lt;/p&gt; &lt;p&gt;If I can get the EPG data in electronic format from SABC and ETV, I&amp;#39;ll restart the ZaEpg and xmltv services for those channels, so if anyone&amp;nbsp;knows who to contact there, please let me know.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:d6001b82-e8ba-4755-9b1d-f2776f13a2a7" style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px;"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/Media%20Center" rel="tag"&gt;Media Center&lt;/a&gt;, &lt;a href="http://technorati.com/tags/EPG" rel="tag"&gt;EPG&lt;/a&gt;, &lt;a href="http://technorati.com/tags/xmltv" rel="tag"&gt;xmltv&lt;/a&gt;&lt;/div&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://dotnet.org.za/colin/archive/2007/08/20/he-that-fights-and-runs-away.aspx&amp;amp;;subject=He+that+fights+and+runs+away..." target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/08/20/he-that-fights-and-runs-away.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://dotnet.org.za/colin/archive/2007/08/20/he-that-fights-and-runs-away.aspx&amp;amp;;title=He+that+fights+and+runs+away..." target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/08/20/he-that-fights-and-runs-away.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://dotnet.org.za/colin/archive/2007/08/20/he-that-fights-and-runs-away.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/08/20/he-that-fights-and-runs-away.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://dotnet.org.za/colin/archive/2007/08/20/he-that-fights-and-runs-away.aspx&amp;amp;title=He+that+fights+and+runs+away..." target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/08/20/he-that-fights-and-runs-away.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://dotnet.org.za/colin/archive/2007/08/20/he-that-fights-and-runs-away.aspx&amp;amp;;title=He+that+fights+and+runs+away..." target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/08/20/he-that-fights-and-runs-away.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://dotnet.org.za/colin/archive/2007/08/20/he-that-fights-and-runs-away.aspx&amp;amp;;title=He+that+fights+and+runs+away...&amp;amp;;top=1" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/08/20/he-that-fights-and-runs-away.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://dotnet.org.za/aggbug.aspx?PostID=202297" width="1" height="1"&gt;</content><author><name>colin</name><uri>http://dotnet.org.za/members/colin.aspx</uri></author></entry><entry><title>Media Center Addin : Missed Skype Call Notification</title><link rel="alternate" type="text/html" href="http://dotnet.org.za/colin/archive/2007/08/17/media-center-addin-missed-skype-call-notification.aspx" /><id>http://dotnet.org.za/colin/archive/2007/08/17/media-center-addin-missed-skype-call-notification.aspx</id><published>2007-08-17T11:42:06Z</published><updated>2007-08-17T11:42:06Z</updated><content type="html">&lt;p&gt;I have a&amp;nbsp;Skype dualphone plugged into my Windows Media Center because that&amp;#39;s the PC that is online most of the time. I don&amp;#39;t have a keyboard plugged into it because I prefer to control the whole thing with the remote only, and use the dualphone&amp;nbsp;handset for Skype. To this end I have disabled as many notifications and popups as Skype will allow. There are two problems with running this arrangement:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Without minimizing the media center full screen UI, I can&amp;#39;t easily see if there are missed calls.&lt;/li&gt; &lt;li&gt;Whenever I make an outgoing call with Skype, the Skype application grabs the window&amp;nbsp;focus from media center, causing the remote to not work anymore, screensavers kick in while you&amp;#39;re watching TV,&amp;nbsp;the screen&amp;nbsp;blanks while it changes mode&amp;nbsp;...just annoying things that shouldn&amp;#39;t happen normally.&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;Originally I set out to solve both problems but after experimenting with the Skype api&amp;nbsp;and setting&amp;nbsp;&amp;quot;silent_mode&amp;quot; on, the api stops responding to requests about missed calls. i.e. Problem 2 is still a problem. I did however manage to solve problem 1 with this little addin.&lt;/p&gt; &lt;p&gt;&lt;a href="http://savage.org.za/images/MediaCenterAddinMissedSkypeCallNotificat_C495/skypescreenshot1.png"&gt;&lt;img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px;" height="180" src="http://savage.org.za/images/MediaCenterAddinMissedSkypeCallNotificat_C495/skypescreenshot.png" width="240" border="0" alt="" /&gt;&lt;/a&gt; &lt;a href="http://savage.org.za/images/MediaCenterAddinMissedSkypeCallNotificat_C495/skypescreenshotvista1.png"&gt;&lt;img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px;" height="140" src="http://savage.org.za/images/MediaCenterAddinMissedSkypeCallNotificat_C495/skypescreenshotvista.png" width="240" border="0" alt="" /&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Before you get too excited, it is not a full&amp;nbsp;Skype client in media center like &lt;a href="http://www.scendix.com/"&gt;mcePhone&lt;/a&gt;, it only does notifications of missed calls and active incoming calls. However it is free and it does work on XP MCE and&amp;nbsp;32 bit&amp;nbsp;Vista. I may add other notifications if necessary.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;You can download the installer from here [&lt;/strong&gt;&lt;a href="http://savage.org.za/downloads/SkypeInMce%201.0.0.0.zip"&gt;&lt;strong&gt;download: SkypeInMce 1.0.0.0.zip&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;]&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;em&gt;Sidenote: This addin was developed using the free &lt;/em&gt;&lt;a href="http://www.icsharpcode.com/OpenSource/SD/Default.aspx"&gt;&lt;em&gt;Sharpdevelop 2.2 IDE&lt;/em&gt;&lt;/a&gt;&lt;em&gt; which has built in &lt;/em&gt;&lt;a href="http://wix.sourceforge.net/"&gt;&lt;em&gt;Wix&lt;/em&gt;&lt;/a&gt;&lt;em&gt; support. I was really impressed by the progress the IC#Code team has made since the last time I looked at SD. Well done,&amp;nbsp;it has become a very polished product.&lt;/em&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:5a62f9d9-700a-46e8-b1e1-3aed7c2a12c7" style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px;"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/Windows%20Media%20Center" rel="tag"&gt;Windows Media Center&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Skype" rel="tag"&gt;Skype&lt;/a&gt;&lt;/div&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://dotnet.org.za/colin/archive/2007/08/17/media-center-addin-missed-skype-call-notification.aspx&amp;amp;;subject=Media+Center+Addin+%3a+Missed+Skype+Call+Notification" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/08/17/media-center-addin-missed-skype-call-notification.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://dotnet.org.za/colin/archive/2007/08/17/media-center-addin-missed-skype-call-notification.aspx&amp;amp;;title=Media+Center+Addin+%3a+Missed+Skype+Call+Notification" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/08/17/media-center-addin-missed-skype-call-notification.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://dotnet.org.za/colin/archive/2007/08/17/media-center-addin-missed-skype-call-notification.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/08/17/media-center-addin-missed-skype-call-notification.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://dotnet.org.za/colin/archive/2007/08/17/media-center-addin-missed-skype-call-notification.aspx&amp;amp;title=Media+Center+Addin+%3a+Missed+Skype+Call+Notification" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/08/17/media-center-addin-missed-skype-call-notification.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://dotnet.org.za/colin/archive/2007/08/17/media-center-addin-missed-skype-call-notification.aspx&amp;amp;;title=Media+Center+Addin+%3a+Missed+Skype+Call+Notification" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/08/17/media-center-addin-missed-skype-call-notification.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://dotnet.org.za/colin/archive/2007/08/17/media-center-addin-missed-skype-call-notification.aspx&amp;amp;;title=Media+Center+Addin+%3a+Missed+Skype+Call+Notification&amp;amp;;top=1" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/08/17/media-center-addin-missed-skype-call-notification.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://dotnet.org.za/aggbug.aspx?PostID=201578" width="1" height="1"&gt;</content><author><name>colin</name><uri>http://dotnet.org.za/members/colin.aspx</uri></author></entry><entry><title>Vista Media Center EPG Discovery Service Hotfix</title><link rel="alternate" type="text/html" href="http://dotnet.org.za/colin/archive/2007/06/19/vista-media-center-epg-discovery-service-hotfix.aspx" /><id>http://dotnet.org.za/colin/archive/2007/06/19/vista-media-center-epg-discovery-service-hotfix.aspx</id><published>2007-06-19T18:45:00Z</published><updated>2007-06-19T18:45:00Z</updated><content type="html">&lt;p&gt;The &lt;a href="http://www.epgstream.net/"&gt;epgStream&lt;/a&gt; people definitely have their ears closer to the ground than me. &lt;/p&gt; &lt;p&gt;If you occasionally get the &amp;quot;Invalid country or region&amp;quot; or &amp;quot;Unsupported country/region&amp;quot; error message in &lt;u&gt;vista&lt;/u&gt; media center when it tries to download the epg from an alternate source like &lt;a href="http://savage.org.za/mediacenter.htm"&gt;ZaEpg,&lt;/a&gt; then this is for you. To get media center to download the epg from another location, the registry key&lt;i&gt; HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center\Service\EPG\&lt;b&gt;discSvc &lt;/b&gt;&lt;/i&gt;needs to point to the new url but media center&amp;nbsp;resets it sometimes.&lt;/p&gt; &lt;p&gt;There is a hotfix &lt;b&gt;KB935685&lt;/b&gt; which allows you to prevent media center from resetting the registry key. There is no download link so you&amp;#39;ll have to phone microsoft support to get it. Once the hotfix is&amp;nbsp;installed you can set the registry key &lt;i&gt;HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center\Service\EPG\&lt;b&gt;disableUpdateDiscSvc &lt;/b&gt;&lt;/i&gt;to 1&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.epgstream.net/Support/tabid/75/Default.aspx"&gt;More details here&lt;/a&gt; &amp;nbsp;&lt;/p&gt; &lt;p&gt;After installing the hotfix and&amp;nbsp;setting the registry keys, ZaEpg could be uninstalled and the registry keys should stay the same and ZaEpg continues to supply the epg to your media center&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:2eab796a-2d40-470f-84d4-6abde097c883" style="margin:0px;padding:0px;display:inline;"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/Media%20Center" rel="tag"&gt;Media Center&lt;/a&gt;, &lt;a href="http://technorati.com/tags/EPG" rel="tag"&gt;EPG&lt;/a&gt;&lt;/div&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://dotnet.org.za/colin/archive/2007/06/19/vista-media-center-epg-discovery-service-hotfix.aspx&amp;amp;;subject=Vista+Media+Center+EPG+Discovery+Service+Hotfix" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/06/19/vista-media-center-epg-discovery-service-hotfix.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://dotnet.org.za/colin/archive/2007/06/19/vista-media-center-epg-discovery-service-hotfix.aspx&amp;amp;;title=Vista+Media+Center+EPG+Discovery+Service+Hotfix" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/06/19/vista-media-center-epg-discovery-service-hotfix.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://dotnet.org.za/colin/archive/2007/06/19/vista-media-center-epg-discovery-service-hotfix.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/06/19/vista-media-center-epg-discovery-service-hotfix.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://dotnet.org.za/colin/archive/2007/06/19/vista-media-center-epg-discovery-service-hotfix.aspx&amp;amp;title=Vista+Media+Center+EPG+Discovery+Service+Hotfix" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/06/19/vista-media-center-epg-discovery-service-hotfix.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://dotnet.org.za/colin/archive/2007/06/19/vista-media-center-epg-discovery-service-hotfix.aspx&amp;amp;;title=Vista+Media+Center+EPG+Discovery+Service+Hotfix" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/06/19/vista-media-center-epg-discovery-service-hotfix.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://dotnet.org.za/colin/archive/2007/06/19/vista-media-center-epg-discovery-service-hotfix.aspx&amp;amp;;title=Vista+Media+Center+EPG+Discovery+Service+Hotfix&amp;amp;;top=1" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/06/19/vista-media-center-epg-discovery-service-hotfix.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://dotnet.org.za/aggbug.aspx?PostID=187158" width="1" height="1"&gt;</content><author><name>colin</name><uri>http://dotnet.org.za/members/colin.aspx</uri></author></entry><entry><title>First Postcard</title><link rel="alternate" type="text/html" href="http://dotnet.org.za/colin/archive/2007/04/11/first-postcard.aspx" /><id>http://dotnet.org.za/colin/archive/2007/04/11/first-postcard.aspx</id><published>2007-04-11T21:14:00Z</published><updated>2007-04-11T21:14:00Z</updated><content type="html">&lt;p&gt;The Media Center EPG solution &lt;a href="http://savage.org.za/mediacenter.htm"&gt;ZaEpg 1.1.0.0&lt;/a&gt; is &lt;a href="http://en.wikipedia.org/wiki/Postcardware"&gt;postcardware&lt;/a&gt; and after nearly 2 months and 300 users the first postcard arrived.&lt;/p&gt; &lt;p&gt;Thanks Clinton for sending the first postcard.&lt;/p&gt; &lt;p&gt;&lt;a href="http://dotnet.org.za/blogs/colin/WindowsLiveWriter/FirstPostcard_14626/scan0002%5B1%5D.jpg"&gt;&lt;img src="http://dotnet.org.za/blogs/colin/WindowsLiveWriter/FirstPostcard_14626/scan0002.jpg" style="border:0px none;" border="0" height="166" width="240" alt="" /&gt;&lt;/a&gt;&lt;a href="http://dotnet.org.za/blogs/colin/WindowsLiveWriter/FirstPostcard_14626/scan0003%5B1%5D.jpg"&gt;&lt;img src="http://dotnet.org.za/blogs/colin/WindowsLiveWriter/FirstPostcard_14626/scan0003.jpg" style="border:0px none;" border="0" height="166" width="240" alt="" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;I&amp;#39;m extending the thanks to Brendon, Werner&amp;nbsp;and Chris for picking up the ZaEpg&amp;nbsp;bandwidth tab.&lt;/p&gt; &lt;p&gt;With some help from &lt;a href="http://dotnet.org.za/craign/"&gt;Craig&lt;/a&gt; there is now a 64bit version of ZaEpg&amp;nbsp;available for &lt;a href="http://savage.org.za/mediacenter.htm"&gt;download&lt;/a&gt;.&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://dotnet.org.za/colin/archive/2007/04/11/first-postcard.aspx&amp;amp;;subject=First+Postcard" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/04/11/first-postcard.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://dotnet.org.za/colin/archive/2007/04/11/first-postcard.aspx&amp;amp;;title=First+Postcard" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/04/11/first-postcard.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://dotnet.org.za/colin/archive/2007/04/11/first-postcard.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/04/11/first-postcard.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://dotnet.org.za/colin/archive/2007/04/11/first-postcard.aspx&amp;amp;title=First+Postcard" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/04/11/first-postcard.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://dotnet.org.za/colin/archive/2007/04/11/first-postcard.aspx&amp;amp;;title=First+Postcard" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/04/11/first-postcard.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://dotnet.org.za/colin/archive/2007/04/11/first-postcard.aspx&amp;amp;;title=First+Postcard&amp;amp;;top=1" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/04/11/first-postcard.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://dotnet.org.za/aggbug.aspx?PostID=128924" width="1" height="1"&gt;</content><author><name>colin</name><uri>http://dotnet.org.za/members/colin.aspx</uri></author></entry><entry><title>Duplicate Enum values</title><link rel="alternate" type="text/html" href="http://dotnet.org.za/colin/archive/2007/03/30/duplicate-enum-values.aspx" /><id>http://dotnet.org.za/colin/archive/2007/03/30/duplicate-enum-values.aspx</id><published>2007-03-30T07:57:50Z</published><updated>2007-03-30T07:57:50Z</updated><content type="html">&lt;p&gt;I discovered this feature of C# while changing Enum value names in one project, where the same enum is used in another project. I needed it to work for both the old and new names because the enum is used in xml serialization which&amp;nbsp;writes the name rather than the value.&lt;/p&gt; &lt;p&gt;&lt;pre&gt;&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System;
&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Diagnostics;

&lt;span style="color:#0000ff;"&gt;enum&lt;/span&gt; Foo
{
    ValueA = 0,
    ValueC = 1,
    [Obsolete("&lt;span style="color:#8b0000;"&gt;Don't use this anymore&lt;/span&gt;")]
    ValueB = 1,
    ValueD = 2
}
&lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; Program
{
    &lt;span style="color:#0000ff;"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Main(&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;[] args)
    {
        Foo valA = Foo.ValueA;
        Foo valB = Foo.ValueB;
        Foo valC = Foo.ValueC;
        Foo valD = Foo.ValueD;
        
        Debug.WriteLine(valA.ToString(), "&lt;span style="color:#8b0000;"&gt;A&lt;/span&gt;");
        Debug.WriteLine(valB.ToString(), "&lt;span style="color:#8b0000;"&gt;B&lt;/span&gt;");
        Debug.WriteLine(valC.ToString(), "&lt;span style="color:#8b0000;"&gt;C&lt;/span&gt;");
        Debug.WriteLine(valD.ToString(), "&lt;span style="color:#8b0000;"&gt;D&lt;/span&gt;");
        
        Debug.Assert(valA != valB);
        Debug.Assert(valB == valC);
    }
}&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Note that ValueB and ValueC have the same integer value, so the output of the program indicates that the order of the&amp;nbsp;enum names&amp;nbsp;is important.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;A: ValueA&lt;br&gt;B: ValueC&lt;br&gt;C: ValueC&lt;br&gt;D: ValueD&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;You will get a compiler warning on&amp;nbsp;&lt;em&gt;Foo valB = Foo.ValueB;&lt;/em&gt; because of the Obsolete tag.&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://dotnet.org.za/colin/archive/2007/03/30/duplicate-enum-values.aspx&amp;amp;;subject=Duplicate+Enum+values" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/03/30/duplicate-enum-values.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://dotnet.org.za/colin/archive/2007/03/30/duplicate-enum-values.aspx&amp;amp;;title=Duplicate+Enum+values" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/03/30/duplicate-enum-values.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://dotnet.org.za/colin/archive/2007/03/30/duplicate-enum-values.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/03/30/duplicate-enum-values.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://dotnet.org.za/colin/archive/2007/03/30/duplicate-enum-values.aspx&amp;amp;title=Duplicate+Enum+values" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/03/30/duplicate-enum-values.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://dotnet.org.za/colin/archive/2007/03/30/duplicate-enum-values.aspx&amp;amp;;title=Duplicate+Enum+values" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/03/30/duplicate-enum-values.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://dotnet.org.za/colin/archive/2007/03/30/duplicate-enum-values.aspx&amp;amp;;title=Duplicate+Enum+values&amp;amp;;top=1" target="_blank" title = "Post http://dotnet.org.za/colin/archive/2007/03/30/duplicate-enum-values.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://dotnet.org.za/aggbug.aspx?PostID=120699" width="1" height="1"&gt;</content><author><name>colin</name><uri>http://dotnet.org.za/members/colin.aspx</uri></author><category term="C#" scheme="http://dotnet.org.za/colin/archive/tags/C_2300_/default.aspx" /></entry></feed>