﻿<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:blogChannel="http://backend.userland.com/blogChannelModule" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
  <channel>
    <title>Brutal Developer</title>
    <description>In the heaviest, deepest, most brutal part - Nathan Explosion</description>
    <link>http://brutaldev.com/</link>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <generator>BlogEngine.NET 2.9.1.0</generator>
    <language>en-US</language>
    <blogChannel:blogRoll>http://brutaldev.com/opml.axd</blogChannel:blogRoll>
    <blogChannel:blink>http://www.dotnetblogengine.net/syndication.axd</blogChannel:blink>
    <dc:creator>Werner van Deventer</dc:creator>
    <dc:title>Brutal Developer</dc:title>
    <geo:lat>0.000000</geo:lat>
    <geo:long>0.000000</geo:long>
    <item>
      <title>.NET Assembly Strong-Name Signer</title>
      <description>&lt;p&gt;-- &lt;strong&gt;&lt;a onclick="javascript: _gaq.push(['_trackPageview', 'StrongNameSigner_Setup.exe']);" href="http://www.brutaldev.com/file.axd?file=StrongNameSigner_Setup.exe" target="_self"&gt;Download (v1.4.2.0)&lt;/a&gt;&lt;/strong&gt; --&lt;/p&gt;  &lt;p&gt;Utility software to strong-name sign .NET assemblies, including assemblies you do not have the source code for. If you strong-name sign your own projects you may have noticed that if you reference an unsigned third party assembly you get an error similar to “&lt;em&gt;Referenced assembly 'A.B.C' does not have a strong name&lt;/em&gt;”. If you did not create this assembly, you can use this tool to sign the assembly with your own (or temporarily generated) strong-name key. The tool will also re-write the assembly references (as well as any &lt;i&gt;InternalsVisibleTo&lt;/i&gt; references) to match the new signed versions of the assemblies you create.&lt;/p&gt;  &lt;p&gt;&amp;nbsp;&lt;/p&gt;  &lt;h2&gt;Why?&lt;/h2&gt;  &lt;p&gt;I decided to write this tool because I have needed to sign assemblies myself a number of times. When contacting the developer fails, it leaves you little choice. You either leave your projects unsigned which is often not an option, or find a way around the problem.&lt;/p&gt;  &lt;p&gt;I first learnt how to do this trick from &lt;a href="http://buffered.io/posts/net-fu-signing-an-unsigned-assembly-without-delay-signing/" target="_blank"&gt;OJ Reeve’s article on signing and unsigned assembly&lt;/a&gt;. The information is somewhat dated and doesn’t mention using the &lt;em&gt;/TYPELIST&lt;/em&gt; option which is crucial to make the round-trip in some scenarios. There are some other tools out there that do this but are also out of date, lack features, are difficult to configure and sometimes create unpredictable results.&lt;/p&gt;  &lt;p&gt;Developers still struggle to overcome this problem so I wanted to create a really simple UI, command-line and API to simplify the process. I used the existing tools for inspiration and made sure that &lt;a onclick="javascript: _gaq.push(['_trackPageview', 'StrongNameSigner_Setup.exe']);" href="http://www.brutaldev.com/file.axd?file=StrongNameSigner_Setup.exe" target="_self"&gt;Strong-Name Signer&lt;/a&gt; overcame all the issues that they currently have.&lt;/p&gt;  &lt;p&gt;&amp;nbsp;&lt;/p&gt;  &lt;h2&gt;Strong-Name Signer&lt;/h2&gt;  &lt;p&gt;This application is the answer to your assembly signing needs. Whether you prefer to use an GUI, the command-line or an API, &lt;a onclick="javascript: _gaq.push(['_trackPageview', 'StrongNameSigner_Setup.exe']);" href="http://www.brutaldev.com/file.axd?file=StrongNameSigner_Setup.exe" target="_self"&gt;Strong-Name Signer&lt;/a&gt; covers all those bases.&lt;/p&gt;  &lt;h5&gt;Features&lt;/h5&gt;  &lt;ol&gt;   &lt;li&gt;Supports strong-name signing assemblies built in v1.0 to v4.5 of the .NET framework. &lt;/li&gt;    &lt;li&gt;Accessible via GUI, command-line or programmatic API. &lt;/li&gt;    &lt;li&gt;Round-trips assembly attributes (32-bit preferred, x64 only etc.) correctly. &lt;/li&gt;    &lt;li&gt;No need for an existing SNK file, one can be generated for you. &lt;/li&gt;    &lt;li&gt;Automatically backs up your files before signing. &lt;/li&gt;    &lt;li&gt;Does not require specific command-prompts or framework/SDK tools. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&amp;nbsp;&lt;/p&gt;  &lt;h5&gt;User Interface&lt;/h5&gt;  &lt;p&gt;Drag-and-drop files or directories and .NET assemblies will be detected. Kept it very simple so it’s accessible and understandable by any user.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://brutaldev.com/image.axd?picture=StrongNameSigner_UI.png"&gt;&lt;img title="" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="" src="http://brutaldev.com/image.axd?picture=StrongNameSigner_UI_thumb.png" width="660" height="437"&gt;&lt;/a&gt; &lt;/p&gt;  &lt;h5&gt;Console&lt;/h5&gt;  &lt;p&gt;Simple command-line options to automate from script files. At minimum you can provide an assembly file, the rest will be done automatically.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://brutaldev.com/image.axd?picture=StrongNameSigner_Console.png"&gt;&lt;img title="StrongNameSigner_Console" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="StrongNameSigner_Console" src="http://brutaldev.com/image.axd?picture=StrongNameSigner_Console_thumb.png" width="660" height="327"&gt;&lt;/a&gt; &lt;/p&gt;  &lt;h5&gt;API&lt;/h5&gt;  &lt;p&gt;A public API is exposed you can reference &lt;em&gt;Brutal.Dev.StrongNameSigner.dll&lt;/em&gt; and make use of the static methods on &lt;em&gt;SigningHelper&lt;/em&gt; to perform strong-name signing tasks from code or PowerShell scripts.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://brutaldev.com/image.axd?picture=StrongNameSigner_Help.png"&gt;&lt;img title="StrongNameSigner_Help" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="StrongNameSigner_Help" src="http://brutaldev.com/image.axd?picture=StrongNameSigner_Help_thumb.png" width="660" height="420"&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;-- &lt;strong&gt;&lt;a onclick="javascript: _gaq.push(['_trackPageview', 'StrongNameSigner_Setup.exe']);" href="http://www.brutaldev.com/file.axd?file=StrongNameSigner_Setup.exe" target="_self"&gt;Download (v1.4.2.0)&lt;/a&gt;&lt;/strong&gt; --&lt;/p&gt;  &lt;p&gt;&amp;nbsp;&lt;/p&gt;  &lt;h2&gt;Other Existing Tools&lt;/h2&gt;  &lt;p&gt;I investigated the following tools when developing &lt;a onclick="javascript: _gaq.push(['_trackPageview', 'StrongNameSigner_Setup.exe']);" href="http://www.brutaldev.com/file.axd?file=StrongNameSigner_Setup.exe" target="_self"&gt;Strong-Name Signer&lt;/a&gt;. I want to give the authors credit since it was the shortcomings in these tools that were the basis for a lot of the features in &lt;a onclick="javascript: _gaq.push(['_trackPageview', 'StrongNameSigner_Setup.exe']);" href="http://www.brutaldev.com/file.axd?file=StrongNameSigner_Setup.exe" target="_self"&gt;Strong-Name Signer&lt;/a&gt;.&lt;/p&gt;  &lt;h4&gt;&lt;a href="https://as.codeplex.com" target="_blank"&gt;Assembly Signer&lt;/a&gt;&lt;/h4&gt;  &lt;p&gt;This tool was last released in 2010 and contains some bugs that don’t make it a very reliable option.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Manual configuration to identify external tools location. &lt;/li&gt;    &lt;li&gt;Doesn’t handle spaces in assembly paths. &lt;/li&gt;    &lt;li&gt;Fails on certain round-trips (not using &lt;em&gt;/TYPELIST&lt;/em&gt;). &lt;/li&gt;    &lt;li&gt;Requires an existing SNK file. &lt;/li&gt;    &lt;li&gt;Can only sign DLL files and not EXE files (which are also assemblies). &lt;/li&gt;    &lt;li&gt;Requires user input from the command-line / cannot be easily automated. &lt;/li&gt;    &lt;li&gt;Can cause problems for a 2.0 assembly if the wrong tools are used. &lt;/li&gt;    &lt;li&gt;Fails to recompile 64-bit platform targeted assemblies. &lt;/li&gt;    &lt;li&gt;No graphical user interface. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&amp;nbsp;&lt;/p&gt;  &lt;h4&gt;&lt;a href="https://signer.codeplex.com/" target="_blank"&gt;Signer&lt;/a&gt;&lt;/h4&gt;  &lt;p&gt;This tool appears to be the most promising but has been abandoned since early 2007. It does most things correctly but has a number of &lt;a href="https://signer.codeplex.com/workitem/list/basic" target="_blank"&gt;open bugs&lt;/a&gt; that &lt;a onclick="javascript: _gaq.push(['_trackPageview', 'StrongNameSigner_Setup.exe']);" href="http://www.brutaldev.com/file.axd?file=StrongNameSigner_Setup.exe" target="_self"&gt;Strong-Name Signer&lt;/a&gt; fixes. I had the option of contributing to this project but I wanted to change the architecture in a way that I could unit test the functionality easily.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Requires running in Visual Studio 2005 command-prompt (2010 does not work). &lt;/li&gt;    &lt;li&gt;Does not support .NET 4.x+ assemblies. &lt;/li&gt;    &lt;li&gt;Requires an existing SNK file. &lt;/li&gt;    &lt;li&gt;Requires special handling to recompile 64-bit platform targeted assemblies. &lt;/li&gt;    &lt;li&gt;Performs manual re-writing of IL that are not required anymore with newer tools. &lt;/li&gt;    &lt;li&gt;No graphical user interface. &lt;/li&gt; &lt;/ol&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Open Source&lt;/h2&gt;  &lt;p&gt;The source code for this project is &lt;a href="https://github.com/brutaldev/StrongNameSigner/" target="_blank"&gt;available on GitHub&lt;/a&gt;.&lt;/p&gt;



&lt;br&gt;&lt;hr&gt;</description>
      <link>http://brutaldev.com/post/2013/10/18/NET-Assembly-Strong-Name-Signer</link>
      <author>werner@brutaldev.com</author>
      <comments>http://brutaldev.com/post/2013/10/18/NET-Assembly-Strong-Name-Signer#comment</comments>
      <guid>http://brutaldev.com/post.aspx?id=667cd255-9436-4a03-87a3-70eccf766c2a</guid>
      <pubDate>Fri, 18 Oct 2013 13:28:00 -0200</pubDate>
      <category>Automation</category>
      <category>Software</category>
      <dc:publisher>Werner</dc:publisher>
      <pingback:server>http://brutaldev.com/pingback.axd</pingback:server>
      <pingback:target>http://brutaldev.com/post.aspx?id=667cd255-9436-4a03-87a3-70eccf766c2a</pingback:target>
      <slash:comments>5</slash:comments>
      <trackback:ping>http://brutaldev.com/trackback.axd?id=667cd255-9436-4a03-87a3-70eccf766c2a</trackback:ping>
      <wfw:comment>http://brutaldev.com/post/2013/10/18/NET-Assembly-Strong-Name-Signer#comment</wfw:comment>
      <wfw:commentRss>http://brutaldev.com/syndication.axd?post=667cd255-9436-4a03-87a3-70eccf766c2a</wfw:commentRss>
    </item>
    <item>
      <title>Error reporting with PushingBox</title>
      <description>&lt;p&gt;One of my users let me know they were using a cloud service called &lt;a href="http://pushingbox.com/" target="_blank"&gt;PushingBox&lt;/a&gt; to be notified of events in &lt;a href="http://www.deventerprise.net/DirectoryMonitor" target="_blank"&gt;Directory Monitor&lt;/a&gt;. I investigated what it can do and immediately thought of a couple of interesting use cases for this service. One of those use cases being the ability to send errors to yourself from your own software in the wild. I’ll explain a little about this &lt;u&gt;free&lt;/u&gt; service and show you some sample code of how to integrate it into your applications or automation scripts using Powershell.&lt;/p&gt;  &lt;h3&gt;The PushingBox service&lt;/h3&gt;  &lt;p&gt;&lt;a href="http://pushingbox.com/" target="_blank"&gt;PushingBox&lt;/a&gt; is a free service to anyone with a Google account. You can login and it will generate a demo email scenario for you automatically. There are however many more services you can link up to including popular iPhone and Android notification apps and even Twitter. The &lt;a href="http://www.pushingbox.com/api.php" target="_blank"&gt;API&lt;/a&gt; is simply an HTTP &lt;em&gt;GET&lt;/em&gt; or &lt;em&gt;POST&lt;/em&gt; using the “DeviceID” assigned to your scenario and optional parameters that you can use to augment your push messages.&lt;/p&gt;  &lt;h3&gt;Setting up a basic scenario&lt;/h3&gt;  &lt;p&gt;To get an email for errors in your application, setup a simple email scenario in &lt;a href="http://pushingbox.com/" target="_blank"&gt;PushingBox&lt;/a&gt; (My Scenarios –&amp;gt; Create scenario). You can use parameter names enclosed in $ signs for replacement when you make a call to the service (remember this isn’t limited to just email):&lt;/p&gt;  &lt;p&gt;&lt;a href="http://brutaldev.com/image.axd?picture=pushingbox_1.png"&gt;&lt;img title="PushingBox scenrio" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="PushingBox scenrio" src="http://brutaldev.com/image.axd?picture=pushingbox_1_thumb.png" width="444" height="352" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Now you can use parameters with the same name in the URL or in your &lt;em&gt;POST&lt;/em&gt; and they will be replaced with those values when the email arrives in your inbox. When you’ve setup the scenario, remember to grab the “DeviceID”, you’ll need that to make a request to the service.&lt;/p&gt;  &lt;h3&gt;Making the service request in C#&lt;/h3&gt;  &lt;p&gt;The code to make a HTTP &lt;em&gt;POST&lt;/em&gt; in C# (or .NET in general) is very easy. Here is a basic static method (&lt;em&gt;using&lt;/em&gt; statements left out for brevity) that will &lt;em&gt;POST&lt;/em&gt; an exception to the service, remember to use your own devid in place of “YOUR_DEV_ID_HERE”.&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;class&lt;/span&gt; PushingBoxHelper
{
  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; Task PushError(&lt;span class="kwrd"&gt;string&lt;/span&gt; version, Exception error)
  {
    Contract.Requires(!&lt;span class="kwrd"&gt;string&lt;/span&gt;.IsNullOrEmpty(version));
    Contract.Assume(error != &lt;span class="kwrd"&gt;null&lt;/span&gt;);

    &lt;span class="rem"&gt;// Fire and forget but return in case you want to do something with it.&lt;/span&gt;
    &lt;span class="kwrd"&gt;return &lt;/span&gt;Task.Factory.StartNew(() =&amp;gt;
    {
      &lt;span class="kwrd"&gt;try&lt;/span&gt;
      {
        var post = &lt;span class="kwrd"&gt;new&lt;/span&gt; NameValueCollection();
        post.Add(&lt;span class="str"&gt;&amp;quot;devid&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;YOUR_DEV_ID_HERE&amp;quot;&lt;/span&gt;);
        post.Add(&lt;span class="str"&gt;&amp;quot;version&amp;quot;&lt;/span&gt;, version);
        post.Add(&lt;span class="str"&gt;&amp;quot;error&amp;quot;&lt;/span&gt;, error.ToString());

        &lt;span class="kwrd"&gt;using&lt;/span&gt; (var wc = &lt;span class="kwrd"&gt;new&lt;/span&gt; WebClient())
        {
          wc.UploadValues(&lt;span class="str"&gt;&amp;quot;http://api.pushingbox.com/pushingbox&amp;quot;&lt;/span&gt;, post);
        }
      }
      &lt;span class="kwrd"&gt;catch&lt;/span&gt; (WebException we)
      {
        Log.Error(&lt;span class="str"&gt;&amp;quot;Failed to submit error information to PushingBox.&amp;quot;&lt;/span&gt;, we);
      }
    });
  }
}&lt;/pre&gt;

&lt;p&gt;Now whenever you get an error or unhandled exception in your application that you want to get notified about, just call the &lt;em&gt;PushingBoxHelper.PushError&lt;/em&gt; method and it will quietly try to push the information to &lt;a href="http://www.pushingbox.com/api.php" target="_blank"&gt;PushingBox’s API&lt;/a&gt; so you will get an email or a push to any other service you have configured.&lt;/p&gt;

&lt;h3&gt;Making the service request in Powershell&lt;/h3&gt;

&lt;p&gt;If you do not want to write any code or just need to push a notification from a script, you can easily use any of the examples on the &lt;a href="http://www.pushingbox.com/api.php" target="_blank"&gt;API section of their site&lt;/a&gt;. I opted for a Powershell script since I wouldn’t need any other dependencies such as Python, cURL or PHP.&lt;/p&gt;

&lt;p&gt;Be careful of doing a &lt;em&gt;GET&lt;/em&gt; since you will need to encode the parameters correctly otherwise data may get lost. This is the Powershell code to make a &lt;em&gt;GET&lt;/em&gt; request:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;##############&lt;/span&gt;
&lt;span class="rem"&gt;# GET Method #&lt;/span&gt;
&lt;span class="rem"&gt;##############&lt;/span&gt;
&lt;span class="kwrd"&gt;param&lt;/span&gt; (
  [string]$version = &lt;span class="str"&gt;&amp;quot;&amp;quot;&lt;/span&gt;,
  [string]$err = &lt;span class="str"&gt;&amp;quot;&amp;quot;&lt;/span&gt;
)

&lt;span class="kwrd"&gt;begin&lt;/span&gt; {
  [System.Reflection.Assembly]::LoadWithPartialName(&lt;span class="str"&gt;&amp;quot;System.Web&amp;quot;&lt;/span&gt;) | out-null
  $get = &lt;span class="str"&gt;&amp;quot;http://api.pushingbox.com/pushingbox?devid=YOUR_DEV_ID_HERE&amp;amp;version=&amp;quot;&lt;/span&gt;
    + [System.Web.HttpUtility]::UrlEncode($version) + &lt;span class="str"&gt;&amp;quot;&amp;amp;error=&amp;quot;&lt;/span&gt; 
    + [System.Web.HttpUtility]::UrlEncode($err)
  (new-object System.Net.WebClient).DownloadString($get)
}&lt;/pre&gt;

&lt;p&gt;In the same light, you could also &lt;em&gt;POST&lt;/em&gt; from Powershell in a very similar way. I prefer this because it’s cleaner and you don’t need to encode anything, it will happen automatically for you:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;###############&lt;/span&gt;
&lt;span class="rem"&gt;# POST Method #&lt;/span&gt;
&lt;span class="rem"&gt;###############&lt;/span&gt;
&lt;span class="kwrd"&gt;param&lt;/span&gt; (
  [string]$version = &lt;span class="str"&gt;&amp;quot;&amp;quot;&lt;/span&gt;,
  [string]$err = &lt;span class="str"&gt;&amp;quot;&amp;quot;&lt;/span&gt;
)

&lt;span class="kwrd"&gt;begin&lt;/span&gt; {
  [System.Reflection.Assembly]::LoadWithPartialName(&lt;span class="str"&gt;&amp;quot;System.Web&amp;quot;&lt;/span&gt;) | out-null
  $post = new-object System.Collections.Specialized.NameValueCollection
  $post.Add(&lt;span class="str"&gt;&amp;quot;devid&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;YOUR_DEV_ID_HERE&amp;quot;&lt;/span&gt;)
  $post.Add(&lt;span class="str"&gt;&amp;quot;version&amp;quot;&lt;/span&gt;, $version)
  $post.Add(&lt;span class="str"&gt;&amp;quot;error&amp;quot;&lt;/span&gt;, $err)
  $wc = new-object System.Net.WebClient
  $wc.UploadValues(&lt;span class="str"&gt;&amp;quot;http://api.pushingbox.com/pushingbox&amp;quot;&lt;/span&gt;, $post)
}&lt;/pre&gt;

&lt;p&gt;You can execute this script from the command-line using the named parameters to send the info you need: &lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;@powershell -NoProfile -ExecutionPolicy unrestricted -file pushingbox.ps1 -version &amp;quot;1.2.3.4&amp;quot; -err &amp;quot;Something went wrong!&amp;quot;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a onclick="javascript: _gaq.push([&amp;#39;_trackPageview&amp;#39;, &amp;#39;PushingBox_Powershell.zip&amp;#39;]);" href="http://www.brutaldev.com/file.axd?file=PushingBox_Powershell.zip" target="_self"&gt;Download Powershell Script&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;I think this is an awesome service that could be used for a variety of scenarios where you would want instant notification via multiple channels when something interesting happens. Breaking builds triggering a Karotz, automating Tweets when you create a blog entry, there are so many… They also provide the source for certain Arduino shields so you can push notifications due to electrical/mechanical interaction with the environment, check out the videos on the home page for more cool ideas.&lt;/p&gt;

&lt;hr /&gt;</description>
      <link>http://brutaldev.com/post/2013/05/30/Error-reporting-with-PushingBox</link>
      <author>werner@brutaldev.com</author>
      <comments>http://brutaldev.com/post/2013/05/30/Error-reporting-with-PushingBox#comment</comments>
      <guid>http://brutaldev.com/post.aspx?id=d0606fcb-75dc-407b-a1f3-6969a779a21a</guid>
      <pubDate>Thu, 30 May 2013 17:47:13 -0200</pubDate>
      <category>Powershell</category>
      <category>C#</category>
      <category>.NET</category>
      <category>CodeProject</category>
      <category>Automation</category>
      <dc:publisher>werner</dc:publisher>
      <pingback:server>http://brutaldev.com/pingback.axd</pingback:server>
      <pingback:target>http://brutaldev.com/post.aspx?id=d0606fcb-75dc-407b-a1f3-6969a779a21a</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://brutaldev.com/trackback.axd?id=d0606fcb-75dc-407b-a1f3-6969a779a21a</trackback:ping>
      <wfw:comment>http://brutaldev.com/post/2013/05/30/Error-reporting-with-PushingBox#comment</wfw:comment>
      <wfw:commentRss>http://brutaldev.com/syndication.axd?post=d0606fcb-75dc-407b-a1f3-6969a779a21a</wfw:commentRss>
    </item>
    <item>
      <title>Maximum lossless image compression/optimization</title>
      <description>&lt;p&gt;&lt;a href="http://www.hanselman.com" target="_blank"&gt;Scott Hanselman&lt;/a&gt; has referred to lossless image compression/optimization, especially PNG files, for quite some time. I’ve also been using these tools for ages but was surprised to hear how few people were actually aware of them. I also wanted to go a step further and see if there were ways to compress and optimize JPEGs and GIFs in the same lossless fashion, this is what I found…&lt;/p&gt;  &lt;h3&gt;Image Compression Tools&lt;/h3&gt;  &lt;p&gt;&lt;a href="http://pnggauntlet.com/" target="_blank"&gt;PNGGauntlet&lt;/a&gt; is a fantastic option which uses three different tools to perform the optimizations and in parallel. However, it doesn’t provide any optimizations for JPEG or (everyone's favorite format) GIF files although it can convert them to PNG. I like to be up to date as well and the tools that it uses are not always the latest that are out there. Then along comes &lt;a href="http://imageoptim.pornel.net/" target="_blank"&gt;ImageOptim&lt;/a&gt; and &lt;a href="http://trimage.org/" target="_blank"&gt;Trimage&lt;/a&gt; which run your images through a couple more tools but, the software is only available for Mac and Linux. Based on these, this is the list of tools I settled on:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.lcdf.org/gifsicle/" target="_blank"&gt;Gifsicle&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.kokkonen.net/tjko/projects.html" target="_blank"&gt;Jpegoptim&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://jpegclub.org/jpegtran" target="_blank"&gt;Jpegtran&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://sourceforge.net/projects/optipng/" target="_blank"&gt;OptiPNG&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://pmt.sourceforge.net/" target="_blank"&gt;PNGcrush&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://advsys.net/ken/utils.htm" target="_blank"&gt;PNGOUT&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.walbeehm.com/download/index.html" target="_blank"&gt;DeflOpt&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;br /&gt;  &lt;p&gt;I won’t touch on any more information about these tools, visit the sites if you are interested in further information.&lt;/p&gt;  &lt;h3&gt;Automation Batch File&lt;/h3&gt;  &lt;p&gt;The secret is in the combination of all these tools to get the maximum compression possible, as well as using the correct options for best results. I didn't want to create a UI for it but also wanted to make it easy enough for anyone to use, so I wrote a &lt;a onclick="javascript: _gaq.push([&amp;#39;_trackPageview&amp;#39;, &amp;#39;BrutalImageOptimization_1.4.zip&amp;#39;]);" href="http://www.brutaldev.com/file.axd?file=BrutalImageOptimization_1.4.zip" target="_self"&gt;batch file&lt;/a&gt; to run your images through the tools in the correct order with the right options. All the requires is that you specify a directory path to recursively compress, this could easily be used as a shell extension as well.&lt;/p&gt;  &lt;p&gt;The &lt;a onclick="javascript: _gaq.push([&amp;#39;_trackPageview&amp;#39;, &amp;#39;BrutalImageOptimization_1.4.zip&amp;#39;]);" href="http://www.brutaldev.com/file.axd?file=BrutalImageOptimization_1.4.zip" target="_self"&gt;download&lt;/a&gt; contains two batch files.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;em&gt;&lt;strong&gt;_Download.bat&lt;/strong&gt;&lt;/em&gt; will just pull and extract the required tools off the internet (PowerShell required) so that you can always have the latest versions.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;&lt;em&gt;_Optimize.bat&lt;/em&gt;&lt;/strong&gt; will do all the heavy lifting of trawling through a directory for images to compress. &lt;/li&gt; &lt;/ol&gt;  &lt;br /&gt;  &lt;p&gt;&lt;a href="http://brutaldev.com/image.axd?picture=ImageCompressionScreenshot.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="ImageCompressionScreenshot" border="0" alt="ImageCompressionScreenshot" src="http://brutaldev.com/image.axd?picture=ImageCompressionScreenshot_thumb.png" width="515" height="213" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Even the above screenshot was compressed from 20KB to 12KB, now imagine what this can do to your whole website or even games? &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;NB: &lt;/strong&gt;Running this tool will overwrite the images in their respective directories, just be aware of that.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;NB2:&lt;/strong&gt; I have seen some rare scenarios recently where images that have gone through &lt;a href="http://www.walbeehm.com/download/index.html" target="_blank"&gt;DeflOpt&lt;/a&gt; do not render on certain mobile browsers. Be careful of this and remove the call if you experience this problem.&lt;/p&gt;  &lt;h3&gt;Conclusion&lt;/h3&gt;  &lt;p&gt;Using these tools is a fast and cheap way of reducing the bandwidth requirements for your websites and games. More people need to know that there are tools available like this and start making use of them. Stop wasting bandwidth and compress your images today, you have nothing to lose, not even image quality!&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;a onclick="javascript: _gaq.push([&amp;#39;_trackPageview&amp;#39;, &amp;#39;BrutalImageOptimization_1.4.zip&amp;#39;]);" href="http://www.brutaldev.com/file.axd?file=BrutalImageOptimization_1.4.zip" target="_self"&gt;Download Image Optimizer&lt;/a&gt;&lt;/strong&gt; – includes &lt;a href="http://www.7-zip.org/" target="_blank"&gt;7-zip&lt;/a&gt; command-line to extract the downloaded tools, don't use spaces in your path, some of the tools don't like it so the batch file doesn't try handle it.&lt;/p&gt;  &lt;hr /&gt;</description>
      <link>http://brutaldev.com/post/2012/06/17/Maximum-lossless-image-compressionoptimization</link>
      <author>werner@brutaldev.com</author>
      <comments>http://brutaldev.com/post/2012/06/17/Maximum-lossless-image-compressionoptimization#comment</comments>
      <guid>http://brutaldev.com/post.aspx?id=e38c9367-0815-4254-abeb-b6392c59614e</guid>
      <pubDate>Sun, 17 Jun 2012 17:46:00 -0200</pubDate>
      <category>Automation</category>
      <category>Software</category>
      <dc:publisher>Werner</dc:publisher>
      <pingback:server>http://brutaldev.com/pingback.axd</pingback:server>
      <pingback:target>http://brutaldev.com/post.aspx?id=e38c9367-0815-4254-abeb-b6392c59614e</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://brutaldev.com/trackback.axd?id=e38c9367-0815-4254-abeb-b6392c59614e</trackback:ping>
      <wfw:comment>http://brutaldev.com/post/2012/06/17/Maximum-lossless-image-compressionoptimization#comment</wfw:comment>
      <wfw:commentRss>http://brutaldev.com/syndication.axd?post=e38c9367-0815-4254-abeb-b6392c59614e</wfw:commentRss>
    </item>
    <item>
      <title>Logging setup in 5 minutes with NLog</title>
      <description>&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;: The latest version of NLog breaks many of these tools by &lt;a href="https://groups.google.com/d/msg/nlog-users/lwEe2cHxYwE/7YI2D9H1-DcJ" target="_blank"&gt;including NLog data by default&lt;/a&gt;. The code has been updated to correct this problem by excluding it for both Sentinel and Harvester applications.&lt;/p&gt;  &lt;p&gt;The time has come where I needed to add some sophisticated logging to &lt;a href="http://brutaldev.com/page/Directory-Monitor.aspx" target="_blank"&gt;Directory Monitor&lt;/a&gt;. I know there are a couple of frameworks out there and &lt;a href="http://www.dotnetlogging.com/comparison/" target="_blank"&gt;this comparison chart&lt;/a&gt; lays it out quite nicely although it may be quite dated. So after some quick investigation on the free ones I decided to go with &lt;a href="http://nlog-project.org" target="_blank"&gt;NLog&lt;/a&gt;.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.theobjectguy.com/dotnetlog/" target="_blank"&gt;ObjectGuy Framework&lt;/a&gt; was really appealing at only a 40KB dependency. It's really simple and actually quite powerful, &lt;span style="text-decoration: line-through"&gt;I chose not to use it because as you can see in the chart, thread safety is questionable (not sure why or hasn’t been tested) and it doesn't have built in file rotation/archiving.&lt;/span&gt; - @&lt;em&gt;Lorne&lt;/em&gt; set me straight, the&amp;#160; &lt;a href="http://www.theobjectguy.com/dotnetlog/" target="_blank"&gt;ObjectGuy Framework&lt;/a&gt; does indeed have these features, however, my decision still stands for reasons beyond this. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://logging.apache.org/log4net/" target="_blank"&gt;Log4Net&lt;/a&gt; is a good option but the license didn’t agree with me because I want to use it for closed source applications. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/cc467894.aspx" target="_blank"&gt;Enterprise Library&lt;/a&gt; is a monster with lots of other dependencies, really only for large scale applications and if you want to extend it to do crazy things. Use it at work almost exclusively but not ideal for my small app. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://nlog-project.org/"&gt;NLog&lt;/a&gt; is 372KB, works in Mono (enterprise library as well), and has a build for WP7, all versions of the framework, Silverlight etc. Because of this I didn't mind checking it out because it immediately allows me to take that learning anywhere, to almost any application I build. There is also a great monitoring tools you can use along with it such as &lt;a href="http://sentinel.codeplex.com/" target="_blank"&gt;Sentinel&lt;/a&gt; or &lt;a href="http://harvester.codeplex.com/" target="_blank"&gt;Harvester&lt;/a&gt;. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Quick Setup&lt;/h3&gt;  &lt;p&gt;You can &lt;a href="http://nlog-project.org/download" target="_blank"&gt;download and install&lt;/a&gt; it or just add it through &lt;a href="http://nuget.org/profiles/jkowalski"&gt;NuGet&lt;/a&gt; in Visual Studio.&lt;/p&gt;  &lt;h3&gt;Configuration File&lt;/h3&gt;  &lt;p&gt;Just make a config called &lt;em&gt;NLog.config&lt;/em&gt; in the root of your project.&lt;/p&gt;  &lt;p&gt;When editing the configuration file, reference the XSD and you'll get intellisense and inline comments in Visual Studio: &lt;em&gt;&lt;strong&gt;Right-click the config -&amp;gt; Properties -&amp;gt; Schemas -&amp;gt; &amp;quot;C:\Program Files (x86)\Microsoft Visual Studio 10.0\xml\Schemas\NLog.xsd&amp;quot;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;If you have a separate config file, make sure you set the &lt;strong&gt;&amp;quot;Copy to Output Directory&amp;quot;&lt;/strong&gt; is set to &lt;strong&gt;&amp;quot;Copy Always&amp;quot;&lt;/strong&gt; to avoid many tears wondering why the logging doesn't work.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://nlog-project.org/wiki/Tutorial" target="_blank"&gt;&lt;img title="CopyToOutputDirectory" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="CopyToOutputDirectory" src="http://brutaldev.com/image.axd?picture=nlog_copytooutputdir.png" width="405" height="183" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;You get &lt;a href="http://nlog-project.org/wiki/Layout_renderers"&gt;a lot of layout options&lt;/a&gt; to play with, this is my configuration file, it writes to the event log on error and fatal, creates a daily rolling log file (30 days max), everything is asynchronous and the configuration auto reloads on the fly if anything changes. It also writes to a location that you will have write access to in low privilege situations.&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="html"&gt;xml&lt;/span&gt; &lt;span class="attr"&gt;version&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;1.0&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;encoding&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;utf-8&amp;quot;&lt;/span&gt; ?&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;nlog&lt;/span&gt; &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://www.nlog-project.org/schemas/NLog.xsd&amp;quot;&lt;/span&gt;
      &lt;span class="attr"&gt;xmlns:xsi&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&lt;/span&gt;
      &lt;span class="attr"&gt;autoReload&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt;
      &lt;span class="attr"&gt;throwExceptions&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;false&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;

  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;variable&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;appName&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;YourAppName&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
  
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;targets&lt;/span&gt; &lt;span class="attr"&gt;async&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;target&lt;/span&gt; &lt;span class="attr"&gt;xsi:type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;File&amp;quot;&lt;/span&gt;
            &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;default&amp;quot;&lt;/span&gt;            
            &lt;span class="attr"&gt;layout&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;${longdate} - ${level:uppercase=true}: ${message}${onexception:${newline}EXCEPTION\: ${exception:format=ToString}}&amp;quot;&lt;/span&gt;
            &lt;span class="attr"&gt;fileName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;${specialfolder:ApplicationData}\${appName}\Debug.log&amp;quot;&lt;/span&gt;
            &lt;span class="attr"&gt;keepFileOpen&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;false&amp;quot;&lt;/span&gt;
            &lt;span class="attr"&gt;archiveFileName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;${specialfolder:ApplicationData}\${appName}\Debug_${shortdate}.{##}.log&amp;quot;&lt;/span&gt;
            &lt;span class="attr"&gt;archiveNumbering&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Sequence&amp;quot;&lt;/span&gt;
            &lt;span class="attr"&gt;archiveEvery&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Day&amp;quot;&lt;/span&gt;
            &lt;span class="attr"&gt;maxArchiveFiles&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;30&amp;quot;&lt;/span&gt;
            &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;target&lt;/span&gt; &lt;span class="attr"&gt;xsi:type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;EventLog&amp;quot;&lt;/span&gt;
            &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;eventlog&amp;quot;&lt;/span&gt;
            &lt;span class="attr"&gt;source&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;${appName}&amp;quot;&lt;/span&gt;
            &lt;span class="attr"&gt;layout&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;${message}${newline}${exception:format=ToString}&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;targets&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;rules&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;logger&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;*&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;writeTo&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;default&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;minlevel&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Info&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;logger&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;*&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;writeTo&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;eventlog&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;minlevel&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Error&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;rules&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;nlog&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;h3&gt;&amp;#160;&lt;/h3&gt;

&lt;h3&gt;Code&lt;/h3&gt;

&lt;p&gt;This is the singleton class that I use which also includes targets for &lt;a href="http://sentinel.codeplex.com/"&gt;Sentinel&lt;/a&gt; and &lt;a href="http://harvester.codeplex.com/" target="_blank"&gt;Harvester&lt;/a&gt; when I'm running a debug build.&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; NLog;
&lt;span class="kwrd"&gt;using&lt;/span&gt; NLog.Config;
&lt;span class="kwrd"&gt;using&lt;/span&gt; NLog.Targets;

&lt;span class="kwrd"&gt;namespace&lt;/span&gt; YourAppName.Logging
{
  &lt;span class="kwrd"&gt;internal&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Log
  {
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; Logger Instance { get; &lt;span class="kwrd"&gt;private&lt;/span&gt; set; }
    &lt;span class="kwrd"&gt;static&lt;/span&gt; Log()
    {
&lt;span class="preproc"&gt;#if&lt;/span&gt; DEBUG
      &lt;span class="rem"&gt;// Setup the logging view for Sentinel - http://sentinel.codeplex.com&lt;/span&gt;
      var sentinalTarget = &lt;span class="kwrd"&gt;new&lt;/span&gt; NLogViewerTarget()
      {
        Name = &lt;span class="str"&gt;&amp;quot;sentinal&amp;quot;&lt;/span&gt;,
        Address = &lt;span class="str"&gt;&amp;quot;udp://127.0.0.1:9999&amp;quot;&lt;/span&gt;,
        IncludeNLogData = &lt;span class="kwrd"&gt;false&lt;/span&gt;
      };
      var sentinalRule = &lt;span class="kwrd"&gt;new&lt;/span&gt; LoggingRule(&lt;span class="str"&gt;&amp;quot;*&amp;quot;&lt;/span&gt;, LogLevel.Trace, sentinalTarget);
      LogManager.Configuration.AddTarget(&lt;span class="str"&gt;&amp;quot;sentinal&amp;quot;&lt;/span&gt;, sentinalTarget);
      LogManager.Configuration.LoggingRules.Add(sentinalRule);

      &lt;span class="rem"&gt;// Setup the logging view for Harvester - http://harvester.codeplex.com&lt;/span&gt;
      var harvesterTarget = &lt;span class="kwrd"&gt;new&lt;/span&gt; OutputDebugStringTarget()
      { 
        Name = &lt;span class="str"&gt;&amp;quot;harvester&amp;quot;&lt;/span&gt;,
        Layout = &lt;span class="str"&gt;&amp;quot;${log4jxmlevent:includeNLogData=false}&amp;quot;&lt;/span&gt;
      };
      var harvesterRule = &lt;span class="kwrd"&gt;new&lt;/span&gt; LoggingRule(&lt;span class="str"&gt;&amp;quot;*&amp;quot;&lt;/span&gt;, LogLevel.Trace, harvesterTarget);
      LogManager.Configuration.AddTarget(&lt;span class="str"&gt;&amp;quot;harvester&amp;quot;&lt;/span&gt;, harvesterTarget);
      LogManager.Configuration.LoggingRules.Add(harvesterRule);
&lt;span class="preproc"&gt;#endif&lt;/span&gt;

      LogManager.ReconfigExistingLoggers();

      Instance = LogManager.GetCurrentClassLogger();
    }
  }
}&lt;/pre&gt;

&lt;h3&gt;&amp;#160;&lt;/h3&gt;

&lt;h3&gt;Monitoring Tools&lt;/h3&gt;

&lt;p&gt;Let &lt;a href="http://sentinel.codeplex.com/" target="_blank"&gt;Sentinel&lt;/a&gt; or &lt;a href="http://harvester.codeplex.com/" target="_blank"&gt;Harvester&lt;/a&gt; run &lt;span style="text-decoration: underline"&gt;all the time&lt;/span&gt; when you are debugging and it will pick up everything that your app is logging (screenshots from their respective project pages).&lt;/p&gt;

&lt;p&gt;&lt;a href="http://sentinel.codeplex.com/" target="_blank"&gt;&lt;img title="Sentinel" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Sentinel" src="http://brutaldev.com/image.axd?picture=sentinel.jpg" width="556" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://harvester.codeplex.com/" target="_blank"&gt;&lt;img title="Harvester" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Harvester" src="http://brutaldev.com/image.axd?picture=harvester.jpg" width="550" height="433" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;&amp;#160;&lt;/h3&gt;

&lt;h3&gt;Start Logging&lt;/h3&gt;

&lt;p&gt;Now to start log anything, anywhere in your app, just use the static log instance.&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;try&lt;/span&gt;
{
  Log.Instance.Debug(&lt;span class="str"&gt;&amp;quot;We're going to throw an exception now.&amp;quot;&lt;/span&gt;);
  Log.Instance.Warn(&lt;span class="str"&gt;&amp;quot;It's gonna happen!!&amp;quot;&lt;/span&gt;);
  &lt;span class="kwrd"&gt;throw&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; ApplicationException();
}
&lt;span class="kwrd"&gt;catch&lt;/span&gt; (ApplicationException ae)
{
  Log.Instance.ErrorException(&lt;span class="str"&gt;&amp;quot;Error doing something...&amp;quot;&lt;/span&gt;, ae);
}&lt;/pre&gt;

&lt;p&gt;This is a really simple and effective setup but you can of course get really advanced from there, all in the configuration file.&lt;/p&gt;

&lt;p&gt;The cool thing about having a separate log file is that you can send someone a modified log file that will write trace level logging or even ship the log to a web server or database for you to check out.&lt;/p&gt;

&lt;p&gt;Logging is so important in any live application. This just makes it easy while still leaving it very powerful if you ever need to use that power. The logger itself is pretty easy to debug because of it's massive internal logging and setting to expose the internals of it.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;hr /&gt;</description>
      <link>http://brutaldev.com/post/2012/03/27/Logging-setup-in-5-minutes-with-NLog</link>
      <author>werner@brutaldev.com</author>
      <comments>http://brutaldev.com/post/2012/03/27/Logging-setup-in-5-minutes-with-NLog#comment</comments>
      <guid>http://brutaldev.com/post.aspx?id=c3d6a470-80c9-4f99-a01d-1e0254378ca8</guid>
      <pubDate>Tue, 27 Mar 2012 16:37:00 -0200</pubDate>
      <category>.NET</category>
      <category>C#</category>
      <category>CodeProject</category>
      <dc:publisher>werner</dc:publisher>
      <pingback:server>http://brutaldev.com/pingback.axd</pingback:server>
      <pingback:target>http://brutaldev.com/post.aspx?id=c3d6a470-80c9-4f99-a01d-1e0254378ca8</pingback:target>
      <slash:comments>2</slash:comments>
      <trackback:ping>http://brutaldev.com/trackback.axd?id=c3d6a470-80c9-4f99-a01d-1e0254378ca8</trackback:ping>
      <wfw:comment>http://brutaldev.com/post/2012/03/27/Logging-setup-in-5-minutes-with-NLog#comment</wfw:comment>
      <wfw:commentRss>http://brutaldev.com/syndication.axd?post=c3d6a470-80c9-4f99-a01d-1e0254378ca8</wfw:commentRss>
    </item>
    <item>
      <title>Generating statistics from SVN</title>
      <description>&lt;p&gt;A subversion repository contains a tome of information about your code and looking at this data can prove very useful in identifying trends in development. Quite some time ago I put together some batch files and a small application (for filtering SVN logs) to automate the generating of statistics using &lt;a href="http://www.statsvn.org/index.html" target="_blank"&gt;StatSVN&lt;/a&gt; and &lt;a href="http://sourceforge.net/projects/svnstat/" target="_blank"&gt;SvnStat&lt;/a&gt;. I am sharing this with you today.&lt;/p&gt;
&lt;p&gt;Example of high level change overview chart. This is one of the many charts and graphs available in &lt;a href="http://www.statsvn.org/index.html" target="_blank"&gt;StatSVN&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.brutaldev.com/image.axd?picture=StatSVN_Sample.png"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="StatSVN_Sample" src="http://www.brutaldev.com/image.axd?picture=StatSVN_Sample_thumb.png" alt="StatSVN_Sample" width="576" height="367" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Example of changes per user graph. This is one of the many charts and graphs available in &lt;a href="http://sourceforge.net/projects/svnstat/" target="_blank"&gt;SvnStat&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.brutaldev.com/image.axd?picture=SvnStat_Sample.png"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="SvnStat_Sample" src="http://www.brutaldev.com/image.axd?picture=SvnStat_Sample_thumb.png" alt="SvnStat_Sample" width="559" height="248" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The reason I&amp;rsquo;ve looked at this again was because I wanted to change the helper application to a C# script file (.csx) and use &lt;a href="http://msdn.com/roslyn" target="_blank"&gt;Microsoft Roslyn&lt;/a&gt; to execute it. I never liked the fact that my simple filtering and looping was in an application, it should be scripted. Unfortunately, &lt;a href="http://msdn.com/roslyn" target="_blank"&gt;Roslyn&lt;/a&gt; does not yet support the &lt;em&gt;XDocument&lt;/em&gt; type so I couldn&amp;rsquo;t easily convert it and I really didn&amp;rsquo;t want to do it in PowerShell cause I&amp;rsquo;m lazy...&lt;/p&gt;
&lt;h3&gt;Stat Helper&lt;/h3&gt;
&lt;p&gt;In &lt;a onclick="javascript: _gaq.push(['_trackPageview', 'BrutalStatHelper_1.0.zip']);" href="http://www.brutaldev.com/file.axd?file=BrutalStatHelper_1.0.zip" target="_self"&gt;the download&lt;/a&gt; you will find the following files:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;_branches.config&lt;/strong&gt;: Local checkout locations that statistics will be generated for.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;_excludepaths.config&lt;/strong&gt;: Path to exclude like merges from &amp;ldquo;trunk&amp;rdquo;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;_excludeusers.config&lt;/strong&gt;: Users to exclude from the statistics.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;GenerateLog.bat&lt;/strong&gt;: Updates the checkout location and extracts the log.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;GenerateStats.bat&lt;/strong&gt;: Calls the external libraries to generates the statistics pages.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;BrutalStatHelper.exe&lt;/strong&gt;: Calls the batch files and performs filtering on log data.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;BrutalStatHelper.cs&lt;/strong&gt;: The source code for the filtering app.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Disclaimer&lt;/strong&gt;: The code is not the best in the world and I don&amp;rsquo;t claim it to be production code by any means but it does the job as intended. Hopefully it gives people more ideas on improving the stats that get generated. What about making a contents page linking to all the stats index pages for example?&lt;/p&gt;
&lt;h3&gt;Instructions&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a onclick="javascript: _gaq.push(['_trackPageview', 'BrutalStatHelper_1.0.zip']);" href="http://www.brutaldev.com/file.axd?file=BrutalStatHelper_1.0.zip" target="_self"&gt;Download Stat Helper&lt;/a&gt; - Extract the files anywhere you want&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.java.com/download" target="_blank"&gt;Install Java&lt;/a&gt; - You need this for both stats libraries&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.sliksvn.com/download" target="_blank"&gt;Install command-line SVN&lt;/a&gt; - You need this to extract the log&lt;/li&gt;
&lt;li&gt;Edit &lt;strong&gt;_branches.config&lt;/strong&gt; with the SVN checkout locations you want to generate stats for&lt;/li&gt;
&lt;li&gt;Edit &lt;strong&gt;_excludepaths.config&lt;/strong&gt; with any paths you want to ignore&lt;/li&gt;
&lt;li&gt;Edit &lt;strong&gt;_excludeusers.config&lt;/strong&gt; with any usernames you want to ignore&lt;/li&gt;
&lt;li&gt;Run &lt;em&gt;&lt;strong&gt;BrutalStatHelper.exe&lt;/strong&gt;&lt;/em&gt; to generate the stats&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Stats will be generated in subdirectories of the directory you are running &lt;em&gt;BrutalStatHelper.exe&lt;/em&gt; from&lt;em&gt;.&lt;/em&gt; Open up &lt;em&gt;index.html&lt;/em&gt; for &lt;a href="http://www.statsvn.org/index.html" target="_blank"&gt;StatSVN&lt;/a&gt; and &lt;em&gt;more\index.html&lt;/em&gt; for &lt;a href="http://sourceforge.net/projects/svnstat/" target="_blank"&gt;SvnStat&lt;/a&gt; info from their respective directories when the process is complete.&lt;/p&gt;
&lt;h3&gt;Extra Information&lt;/h3&gt;
&lt;p&gt;Check out the additional options available for each library. The helper will get you going quickly but it&amp;rsquo;s up to you to investigate more and see what you can get out of generating statistics.&lt;/p&gt;
&lt;p&gt;Call the helper from a Windows Scheduled Task or during an automated build (CI) to keep the stats fresh.&lt;/p&gt;
&lt;p&gt;Start looking at and analyzing more statistics. I use &lt;a href="http://rescuetime.com/ref/332532" target="_blank"&gt;RescueTime&lt;/a&gt; to gather statistics about my daily work and like any statistical analysis, it highlights areas of strength and weakness where you may not normally be able to see it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;WARNING&lt;/strong&gt;: When I introduced this into the workplace it was greeted with interest from management but major apprehension from co-workers. A lot of people don&amp;rsquo;t like the &amp;ldquo;big brother&amp;rdquo; aspect and because the data could be skewed or misinterpreted.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a onclick="javascript: _gaq.push(['_trackPageview', 'BrutalStatHelper_1.0.zip']);" href="http://www.brutaldev.com/file.axd?file=BrutalStatHelper_1.0.zip" target="_self"&gt;Download Stat Helper&lt;/a&gt;&lt;/strong&gt; - includes source code and both statistics libraries.&lt;/p&gt;

&lt;br clear="all" /&gt;

&lt;hr /&gt;

&lt;br clear="all" /&gt;
</description>
      <link>http://brutaldev.com/post/2011/10/23/Generating-statistics-from-SVN</link>
      <author>werner@brutaldev.com</author>
      <comments>http://brutaldev.com/post/2011/10/23/Generating-statistics-from-SVN#comment</comments>
      <guid>http://brutaldev.com/post.aspx?id=af39b1ba-5a79-435f-be6f-731b05c504d8</guid>
      <pubDate>Sun, 23 Oct 2011 10:13:00 -0200</pubDate>
      <category>Automation</category>
      <category>C#</category>
      <category>SVN</category>
      <dc:publisher>Werner</dc:publisher>
      <pingback:server>http://brutaldev.com/pingback.axd</pingback:server>
      <pingback:target>http://brutaldev.com/post.aspx?id=af39b1ba-5a79-435f-be6f-731b05c504d8</pingback:target>
      <slash:comments>1</slash:comments>
      <trackback:ping>http://brutaldev.com/trackback.axd?id=af39b1ba-5a79-435f-be6f-731b05c504d8</trackback:ping>
      <wfw:comment>http://brutaldev.com/post/2011/10/23/Generating-statistics-from-SVN#comment</wfw:comment>
      <wfw:commentRss>http://brutaldev.com/syndication.axd?post=af39b1ba-5a79-435f-be6f-731b05c504d8</wfw:commentRss>
    </item>
    <item>
      <title>Reset BugNET admin password</title>
      <description>&lt;p&gt;I recently ran into a situation where I had the wrong/forgot the password for my BugNET bug/project tracker site and had no way to get it back. The reasons for password recovery failure are probably due to one of the following:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;You didn’t use a real email address. &lt;/li&gt;    &lt;li&gt;You didn’t set a security question or forgot the answer. &lt;/li&gt;    &lt;li&gt;It’s the admin account, did you think it will be that easy? &lt;/li&gt;    &lt;li&gt;It’s the &lt;em&gt;only&lt;/em&gt; admin account so you can’t login and change it. &lt;/li&gt; &lt;/ol&gt;  &lt;br&gt;  &lt;p&gt;I needed a fast way to get the password reset and because everything is hashed and salted in the database (as it should be) and it’s not that easy to just update the tables with your own generated password. The only thing I could find was &lt;a href="http://www.bugnetproject.com/Forums/tabid/54/forumid/1/threadid/2317/scope/posts/Default.aspx" target="_blank"&gt;unlocking your account from the DB&lt;/a&gt;. That got me to the next point…&lt;/p&gt;  &lt;p&gt;Since &lt;a href="http://bugnetproject.com" target="_blank"&gt;BugNET&lt;/a&gt; uses the built-in &lt;a href="http://msdn.microsoft.com/en-us/library/yh26yfzy.aspx" target="_blank"&gt;ASP.NET Membership Role Provider&lt;/a&gt;, it’s actually quite easy as long as you have access to the web server or FTP site. This is a hack I’ve used before and will work for other sites as well, though usually if you have access to the web server you’re probably a big enough admin to do this and more. &lt;/p&gt;  &lt;h3&gt;Instructions&lt;/h3&gt;  &lt;p&gt;Create a page called &lt;em&gt;&lt;strong&gt;ResetPass.aspx&lt;/strong&gt;&lt;/em&gt; with the following code (or &lt;a onclick="javascript: _gaq.push(['_trackPageview', 'BugNET_ResetPass.zip']);" href="http://www.brutaldev.com/file.axd?file=BugNET_ResetPass.zip" target="_self"&gt;download it&lt;/a&gt;):&lt;/p&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="asp"&gt;&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;&lt;/span&gt;
&lt;span class="asp"&gt;&amp;lt;%&lt;/span&gt;
  &lt;span class="kwrd"&gt;try&lt;/span&gt;
  {
    MembershipUser mem = Membership.GetUser(&lt;span class="str"&gt;"admin"&lt;/span&gt;);
    &lt;span class="kwrd"&gt;if&lt;/span&gt; (mem.IsLockedOut)
    {
      mem.UnlockUser();
    }
    mem.ChangePassword(mem.ResetPassword(), &lt;span class="str"&gt;"password"&lt;/span&gt;);
  }
  &lt;span class="kwrd"&gt;catch&lt;/span&gt; (Exception ex)
  {
    Response.Write(ex.ToString());
  }
&lt;span class="asp"&gt;%&amp;gt;&lt;/span&gt;

&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;html&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;head&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Admin Password Reset&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;head&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;body&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Done resetting password...&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Please delete this page from the web server!&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;body&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;html&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;Upload the page to the root of your &lt;a href="http://bugnetproject.com" target="_blank"&gt;BugNET&lt;/a&gt; website and browse to &lt;strong&gt;&lt;em&gt;http://yourwebdomain/ResetPass.aspx&lt;/em&gt;&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;If anything goes wrong your default error page will show or the usual yellow page of death, if not the password would have been reset to “&lt;em&gt;password&lt;/em&gt;” and you’ll get a nice message.&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;&lt;strong&gt;NB: &lt;/strong&gt;&lt;u&gt;Delete the page from your web server as it poses a major security risk!&lt;/u&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;The code is simple pretty self-explanatory so I'm not going to go into detail, use it, don't use it (at your own risk).&lt;/p&gt;
&lt;b&gt;
  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:F60BB8FA-6F02-4999-8F5E-9DD4E92C4DA7:f086d1a4-85b8-4bd2-8586-e35c5ee43c06" class="wlWriterEditableSmartContent"&gt;&lt;div&gt;&lt;a href="http://www.brutaldev.com/file.axd?file=BugNET_ResetPass.zip" target="_self" onclick="javascript: _gaq.push(['_trackPageview', 'BugNET_ResetPass.zip']);"&gt;Download sample code&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/b&gt;

&lt;br clear="all"&gt;

&lt;hr&gt;

&lt;br clear="all"&gt;</description>
      <link>http://brutaldev.com/post/2011/08/22/Reset-BugNET-admin-password</link>
      <author>werner@brutaldev.com</author>
      <comments>http://brutaldev.com/post/2011/08/22/Reset-BugNET-admin-password#comment</comments>
      <guid>http://brutaldev.com/post.aspx?id=3b4221cf-9e7e-4928-ba75-59abbae9fefc</guid>
      <pubDate>Mon, 22 Aug 2011 17:38:00 -0200</pubDate>
      <category>ASP.NET</category>
      <category>Security</category>
      <dc:publisher>Werner</dc:publisher>
      <pingback:server>http://brutaldev.com/pingback.axd</pingback:server>
      <pingback:target>http://brutaldev.com/post.aspx?id=3b4221cf-9e7e-4928-ba75-59abbae9fefc</pingback:target>
      <slash:comments>2</slash:comments>
      <trackback:ping>http://brutaldev.com/trackback.axd?id=3b4221cf-9e7e-4928-ba75-59abbae9fefc</trackback:ping>
      <wfw:comment>http://brutaldev.com/post/2011/08/22/Reset-BugNET-admin-password#comment</wfw:comment>
      <wfw:commentRss>http://brutaldev.com/syndication.axd?post=3b4221cf-9e7e-4928-ba75-59abbae9fefc</wfw:commentRss>
    </item>
    <item>
      <title>Show calendar on click DateTimePicker control</title>
      <description>&lt;p&gt;Something that’s common-place on the web is clicking a text box to pop-up a calendar. What if you wanted the calendar to pop-up when simply clicking on any area of a &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datetimepicker.aspx" target="_blank"&gt;System.Windows.Forms.DateTimePicker&lt;/a&gt; control? You would expect the control to have a method to easily do this but when you notice there isn't even a public &lt;em&gt;Click&lt;/em&gt; event things start looking bleak...&lt;/p&gt;  &lt;p&gt;I found a way to get this to work by sending a &amp;quot;mouse button down/up&amp;quot; message to the control in the area where the regular display button is. By forcing this extra click in the right area it's as if you just clicked the button yourself. So I made an extension method with some parts borrowed which add an additional method on the &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datetimepicker.aspx" target="_blank"&gt;System.Windows.Forms.DateTimePicker&lt;/a&gt; control.&lt;/p&gt;  &lt;p&gt;We want to make a click happen here (in the &lt;font color="#ff0000"&gt;red&lt;/font&gt; box):&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.brutaldev.com/image.axd?picture=datetimepicker.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="datetimepicker" border="0" alt="datetimepicker" src="http://www.brutaldev.com/image.axd?picture=datetimepicker_thumb.png" width="212" height="32" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;So we can use some native calls as well as basic math to find a good position to click it and send the message like so:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;
&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Runtime.InteropServices;
&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Windows.Forms;

&lt;span class="kwrd"&gt;namespace&lt;/span&gt; Brutal.Dev.Extenstions
{
  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; DateTimePickerExtensions
  {
&lt;span class="preproc"&gt;#if&lt;/span&gt; NETCF
    [DllImport(&lt;span class="str"&gt;&amp;quot;coredll&amp;quot;&lt;/span&gt;)]
&lt;span class="preproc"&gt;#else&lt;/span&gt;
    [DllImport(&lt;span class="str"&gt;&amp;quot;user32&amp;quot;&lt;/span&gt;)]
&lt;span class="preproc"&gt;#endif&lt;/span&gt;
    &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;extern&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; SendMessage(IntPtr hWnd, &lt;span class="kwrd"&gt;uint&lt;/span&gt; uMsg,
                                  &lt;span class="kwrd"&gt;int&lt;/span&gt; wParam, &lt;span class="kwrd"&gt;int&lt;/span&gt; lParam);

    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;const&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; WM_LBUTTONDOWN = 0x0201;
    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;const&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; WM_LBUTTONUP = 0x0202;

    &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; ShowCalendar(&lt;span class="kwrd"&gt;this&lt;/span&gt; DateTimePicker picker,
                                    MouseEventArgs clickEvent)
    {
      &lt;span class="kwrd"&gt;if&lt;/span&gt; (picker != &lt;span class="kwrd"&gt;null&lt;/span&gt;)
      {
        &lt;span class="rem"&gt;// Remove any existing event to prevent an infinite loop.&lt;/span&gt;
        var suppressor = &lt;span class="kwrd"&gt;new&lt;/span&gt; EventSuppressor(picker);
        suppressor.Suppress();

        &lt;span class="rem"&gt;// Get the position on the button.&lt;/span&gt;
        &lt;span class="kwrd"&gt;int&lt;/span&gt; x = picker.Width - 10;
        &lt;span class="kwrd"&gt;int&lt;/span&gt; y = picker.Height / 2;
        &lt;span class="kwrd"&gt;int&lt;/span&gt; lParam = x + y * 0x00010000;

        &lt;span class="rem"&gt;// Ignore if the calendar button was clicked&lt;/span&gt;
        &lt;span class="kwrd"&gt;if&lt;/span&gt; (clickEvent.X &amp;lt; picker.Width - 35)
        {
          SendMessage(picker.Handle, WM_LBUTTONDOWN, 1, lParam);
          SendMessage(picker.Handle, WM_LBUTTONUP, 1, lParam);
        }

        suppressor.Resume();
      }
    }
  }
}&lt;/pre&gt;

&lt;h3&gt;Explanation&lt;/h3&gt;

&lt;p&gt;If you are using the .NET Compact Framework you need to import &lt;em&gt;coredll&lt;/em&gt; instead for the &lt;a href="http://www.pinvoke.net/default.aspx/coredll/sendmessage.html" target="_blank"&gt;P/Invoke for SendMessage&lt;/a&gt;&lt;em&gt;&lt;/em&gt; so the compiler directive is there to support that.&lt;/p&gt;

&lt;p&gt;The extra mouse click event info requirement is so that we can detect where the click happened and ignore it if it was actually on the calendar button (because otherwise it clicks again hiding the calendar – DOH!).&lt;/p&gt;

&lt;p&gt;The &lt;em&gt;EventSuppressor&lt;/em&gt; is something I picked up &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/c873d460-2f7d-41f6-8149-3055a9dd5e7a" target="_blank"&gt;on this discussion&lt;/a&gt; to stop any other events from firing and also prevent infinite loops calling your mouse events over and over (the code for this in included in the &lt;a href="http://www.brutaldev.com/file.axd?file=BrutalDatePickerExample.zip" target="_self" onClick="javascript: _gaq.push(['_trackPageview', 'BrutalDatePickerExample.zip']);"&gt;sample code&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;If you attach to the &lt;em&gt;MouseDown&lt;/em&gt; or &lt;em&gt;MouseUp&lt;/em&gt; event you can easily add one line to call the extension on you control and just like that, your calendar will pop-up: &lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; Brutal.Dev.Extenstions;

&lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; dateTimePicker1_MouseDown(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, MouseEventArgs e)
{    
  dateTimePicker1.ShowCalendar(e);
}&lt;/pre&gt;

&lt;p&gt;If you're a &lt;strong&gt;VB.NET&lt;/strong&gt; kind of person, you can easily convert this code into &lt;strong&gt;VB.NET&lt;/strong&gt; using &lt;a href="http://www.developerfusion.com/tools/convert/csharp-to-vb/" target="_blank"&gt;this online tool&lt;/a&gt; which I’ve tried and it works pretty well.&lt;/p&gt;
&lt;b&gt;
  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:F60BB8FA-6F02-4999-8F5E-9DD4E92C4DA7:84e68d8d-ab27-42ad-a108-57bfd51fc0fe" class="wlWriterEditableSmartContent"&gt;&lt;div&gt;&lt;a href="http://www.brutaldev.com/file.axd?file=BrutalDatePickerExample.zip" target="_self" onClick="javascript: _gaq.push(['_trackPageview', 'BrutalDatePickerExample.zip']);"&gt;Download sample code&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/b&gt;

&lt;br clear="all" /&gt;

&lt;hr /&gt;

&lt;br clear="all" /&gt;</description>
      <link>http://brutaldev.com/post/2011/05/04/Show-calendar-on-click-DateTimePicker-control</link>
      <author>werner@brutaldev.com</author>
      <comments>http://brutaldev.com/post/2011/05/04/Show-calendar-on-click-DateTimePicker-control#comment</comments>
      <guid>http://brutaldev.com/post.aspx?id=ee01362f-f905-4c31-a9c6-f9ded3663779</guid>
      <pubDate>Wed, 04 May 2011 21:03:00 -0200</pubDate>
      <category>.NET</category>
      <category>C#</category>
      <category>Windows Forms</category>
      <dc:publisher>Werner</dc:publisher>
      <pingback:server>http://brutaldev.com/pingback.axd</pingback:server>
      <pingback:target>http://brutaldev.com/post.aspx?id=ee01362f-f905-4c31-a9c6-f9ded3663779</pingback:target>
      <slash:comments>3</slash:comments>
      <trackback:ping>http://brutaldev.com/trackback.axd?id=ee01362f-f905-4c31-a9c6-f9ded3663779</trackback:ping>
      <wfw:comment>http://brutaldev.com/post/2011/05/04/Show-calendar-on-click-DateTimePicker-control#comment</wfw:comment>
      <wfw:commentRss>http://brutaldev.com/syndication.axd?post=ee01362f-f905-4c31-a9c6-f9ded3663779</wfw:commentRss>
    </item>
    <item>
      <title>Using the new .NET CLR without recompiling</title>
      <description>&lt;p&gt;One of the lesser known capabilities of the new CLR is &lt;a href="http://msdn.microsoft.com/en-gb/library/ee518876(VS.100).aspx" target="_blank"&gt;in-process side-by-side execution&lt;/a&gt;. This allows applications that were built on an older version of .NET (before 4.0) to use the new features of the updated CLR without even having to recompile your code!&lt;/p&gt;
&lt;p&gt;If assemblies require a specific version of the CLR then the old CLR will load along side the new one to host those assemblies. Keep in mind that, by default, applications built targeting older versions of the .NET framework will continue to run using the corresponding CLR, this is one of the big changes to the CLR preventing existing apps from being &lt;span style="text-decoration: underline;"&gt;forced&lt;/span&gt; to use the latest runtime and keeping things backward compatible.&lt;/p&gt;
&lt;p&gt;So, let&amp;rsquo;s say you have an application that was build against .NET 2.0 and you totally want to use the new thread pool features (work stealing, local queues etc.) or even better the new highly optimized background client garbage collector, just add the following to your application configuration file between the &lt;em&gt;configuration&lt;/em&gt; element:&lt;/p&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;configuration&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
...
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;startup&lt;/span&gt; &lt;span class="attr"&gt;useLegacyV2RuntimeActivationPolicy&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;supportedRuntime&lt;/span&gt; &lt;span class="attr"&gt;version&lt;/span&gt;&lt;span class="kwrd"&gt;="v4.0"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;supportedRuntime&lt;/span&gt; &lt;span class="attr"&gt;version&lt;/span&gt;&lt;span class="kwrd"&gt;="v2.0.50727"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;startup&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
...
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;configuration&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Remember that whatever the hosting executable is using as it&amp;rsquo;s runtime, other assemblies will also be jit&amp;rsquo;ed using the same CLR. Boom! Your app runs using the latest greatest features and you didn&amp;rsquo;t even need to compile using .NET. If you don&amp;rsquo;t believe it, just check the value of &lt;em&gt;System.Environment.Version&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;em&gt;useLegacyV2RuntimeActivationPolicy&lt;/em&gt; attribute is only really necessary if you are loading native assemblies (or mixed mode managed C++ assemblies). You can also specify multiple supported runtimes (in order of support) where the first one found on the system will be used but if the older version is not available on the system your app will happily use CLR4 without moaning about an incompatible framework. A full code example and further reading can be found on the &lt;a href="http://msdn.microsoft.com/en-gb/library/ee518876(VS.100).aspx" target="_blank"&gt;MSDN page&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you want to force your apps to just use the latest framework that&amp;rsquo;s available on the machine you can use this relatively undocumented &lt;em&gt;rollForward&lt;/em&gt; setting:&lt;/p&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;configuration&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
...
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;startup&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;process&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;rollForward&lt;/span&gt; &lt;span class="attr"&gt;enabled&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;process&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;startup&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
...
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;configuration&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;This is of course a great thing if you cannot control what version of the .NET framework and application is being built with (like on a build server) but want to get things running on the latest framework. It&amp;rsquo;s also a low impact way of testing that large applications continue to work when running on the latest CLR without having to build massive solutions. But you should totally start targeting .NET 4.0 to take advantage of the new &lt;a href="http://msdn.microsoft.com/en-us/library/ms171868.aspx" target="_blank"&gt;framework features&lt;/a&gt;&amp;hellip;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr /&gt;</description>
      <link>http://brutaldev.com/post/2011/05/03/Using-the-new-NET-CLR-without-recompiling</link>
      <author>werner@brutaldev.com</author>
      <comments>http://brutaldev.com/post/2011/05/03/Using-the-new-NET-CLR-without-recompiling#comment</comments>
      <guid>http://brutaldev.com/post.aspx?id=e8b02305-0eec-4993-81aa-af5833ca0614</guid>
      <pubDate>Tue, 03 May 2011 16:06:00 -0200</pubDate>
      <category>.NET</category>
      <category>CodeProject</category>
      <category>General</category>
      <dc:publisher>Werner</dc:publisher>
      <pingback:server>http://brutaldev.com/pingback.axd</pingback:server>
      <pingback:target>http://brutaldev.com/post.aspx?id=e8b02305-0eec-4993-81aa-af5833ca0614</pingback:target>
      <slash:comments>1</slash:comments>
      <trackback:ping>http://brutaldev.com/trackback.axd?id=e8b02305-0eec-4993-81aa-af5833ca0614</trackback:ping>
      <wfw:comment>http://brutaldev.com/post/2011/05/03/Using-the-new-NET-CLR-without-recompiling#comment</wfw:comment>
      <wfw:commentRss>http://brutaldev.com/syndication.axd?post=e8b02305-0eec-4993-81aa-af5833ca0614</wfw:commentRss>
    </item>
    <item>
      <title>BlogEngine.NET 2.x Poll Widget</title>
      <description>&lt;p&gt;You may or may not have noticed the Poll Widget on the left hand side of this blog... This was originally developed by &lt;a href="http://www.fatihsever.com/post/BlogEngineNET-Poll-Widget.aspx" target="_blank"&gt;Fatih Sever&lt;/a&gt; for &lt;a href="http://www.dotnetblogengine.net/" target="_blank"&gt;BlogEngine.NET&lt;/a&gt; 1.x. This widget was so successful that &lt;a href="http://blog.madskristensen.dk/" target="_blank"&gt;Mads&lt;/a&gt; himself didn’t even make one because of Fatih’s hard work.&lt;/p&gt;  &lt;p&gt;Since the major release of &lt;a href="http://www.dotnetblogengine.net/" target="_blank"&gt;BlogEngine.NET&lt;/a&gt; 2.0, many extensions and widgets (including the Poll Widget) were affected by breaking changes. Because I really needed a Poll Widget ASAP I decided to take the source and update it to work with &lt;a href="http://www.dotnetblogengine.net/" target="_blank"&gt;BlogEngine.NET&lt;/a&gt; 2.0 along with a couple of bug fixes to make it more resilient to arbitrary configuration and the new script object.&lt;/p&gt;  &lt;p&gt;Fatih has graciously allowed me to host the download on my site as I am continuously making small changes and bugging him all the time for updates is becoming an issue. So here we go:&lt;/p&gt;  &lt;p&gt;&lt;b&gt; &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:F60BB8FA-6F02-4999-8F5E-9DD4E92C4DA7:63b64ec4-f9df-4721-968d-834bcce15a78" class="wlWriterEditableSmartContent"&gt;&lt;div&gt;&lt;a href="http://www.brutaldev.com/file.axd?file=PollWidget_BE2.0.zip" target="_self" onClick="javascript: _gaq.push(['_trackPageview', 'PollWidget_BE2.0.zip']);"&gt;Poll Widget BE 2.0.zip&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://www.brutaldev.com/file.axd?file=PollWidget_BE2.5.zip" target="_self" onClick="javascript: _gaq.push(['_trackPageview', 'PollWidget_BE2.5.zip']);"&gt;Poll Widget BE 2.5.zip&lt;/a&gt;&lt;/div&gt;&lt;/div&gt; &lt;/b&gt;&lt;/p&gt; &lt;p&gt;If you are looking for the Poll Widget that works in &lt;a href="http://www.dotnetblogengine.net/" target="_blank"&gt;BlogEngine&lt;/a&gt; 1.x (because this one is not backward compatible) then you can download it from &lt;a href="http://www.fatihsever.com/post/BlogEngineNET-Poll-Widget.aspx" target="_blank"&gt;Fatih Sever's original post&lt;/a&gt;.&lt;/p&gt;  &lt;h3&gt;Important Information&lt;/h3&gt;  &lt;p&gt;&lt;u&gt;Custom Themes&lt;/u&gt;     &lt;br /&gt;Only the standard theme is updated with the required CSS stylesheet for the Poll Widget. If you are using a custom them you need to follow the steps below:  &lt;ol&gt;   &lt;li&gt;To add the CSS to the theme that you use open the file &lt;em&gt;.\themes\YourThemeName\site.master&lt;/em&gt; and add the following HTML in the HEAD tag along with any other external stylesheet declarations:       &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;link&lt;/span&gt; &lt;span class="attr"&gt;rel&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;stylesheet&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;href&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;poll.css&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;text/css&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
  &lt;/li&gt;

  &lt;li&gt;Copy the file &lt;em&gt;progress.gif&lt;/em&gt; and &lt;em&gt;poll.css&lt;/em&gt; from &lt;em&gt;.\themes\Standard\&lt;/em&gt; to your custom theme directory.&lt;/li&gt;
&lt;/ol&gt;
&lt;/p&gt;

&lt;h3&gt;Troubleshoot Problems&lt;/h3&gt;

&lt;p&gt;If the widget won't be added using your current theme you can do two things:

&lt;ol&gt;
  &lt;li&gt;Switch to the &lt;u&gt;Standard&lt;/u&gt; theme, add it, then switch back to your theme. &lt;/li&gt;
&amp;nbsp;&amp;nbsp;OR
  &lt;li&gt;Edit &lt;em&gt;.\App_Data\datastore\widgets\be_WIDGET_ZONE.xml&lt;/em&gt; and add the widget directly with the following XML:
&lt;br&gt;
    &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;widget&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;3E9B34D6-2343-11E0-829C-FB02DFD72085&amp;quot;&lt;/span&gt;
        &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Poll&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;showTitle&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Poll&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;widget&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;You can change the GUID to any valid GUID value that you want.&lt;/p&gt;

&lt;p&gt;If you get any error with the widget you can usually pick up the script error using developer tools for your browser. IE usually has the script error dialog turned on by default, look for the warning symbol in the bottom left corner.&lt;/p&gt;
  &lt;p&gt;If you have the logging extension turned on then non-script widget errors will be logged to &lt;em&gt;.\App_Data\logger.txt&lt;/em&gt; by default.&lt;/p&gt;

  &lt;/li&gt;
&lt;/ol&gt;
&lt;/p&gt;

&lt;p&gt;Thanks again to Fatih for the great widget!&lt;/p&gt;

&lt;br clear="all" /&gt;

&lt;hr /&gt;

&lt;br clear="all" /&gt;</description>
      <link>http://brutaldev.com/post/2011/02/15/BlogEngineNET-20-Poll-Widget</link>
      <author>werner@brutaldev.com</author>
      <comments>http://brutaldev.com/post/2011/02/15/BlogEngineNET-20-Poll-Widget#comment</comments>
      <guid>http://brutaldev.com/post.aspx?id=1a480ebb-3d88-495d-acf4-7a6dc7c85952</guid>
      <pubDate>Tue, 15 Feb 2011 16:49:00 -0200</pubDate>
      <category>BlogEngine.NET</category>
      <dc:publisher>Werner</dc:publisher>
      <pingback:server>http://brutaldev.com/pingback.axd</pingback:server>
      <pingback:target>http://brutaldev.com/post.aspx?id=1a480ebb-3d88-495d-acf4-7a6dc7c85952</pingback:target>
      <slash:comments>37</slash:comments>
      <trackback:ping>http://brutaldev.com/trackback.axd?id=1a480ebb-3d88-495d-acf4-7a6dc7c85952</trackback:ping>
      <wfw:comment>http://brutaldev.com/post/2011/02/15/BlogEngineNET-20-Poll-Widget#comment</wfw:comment>
      <wfw:commentRss>http://brutaldev.com/syndication.axd?post=1a480ebb-3d88-495d-acf4-7a6dc7c85952</wfw:commentRss>
    </item>
    <item>
      <title>Android applications in C# using Visual Studio</title>
      <description>&lt;p&gt;I recently got myself an &lt;a href="http://en.wikipedia.org/wiki/Android_(operating_system)" target="_blank"&gt;Android&lt;/a&gt; mobile phone and was really interested in writing applications for it. After downloading the &lt;a href="http://developer.android.com/sdk/index.html" target="_blank"&gt;Android SDK&lt;/a&gt; as well as the &lt;strong&gt;32-bit&lt;/strong&gt; &lt;a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html" target="_blank"&gt;Java SDK&lt;/a&gt; (noooooo!) I got it all installed and running the sample apps with &lt;a href="http://www.eclipse.org/downloads/" target="_blank"&gt;Eclipse&lt;/a&gt; and browsed around the code.&lt;/p&gt;
&lt;p&gt;Firstly, I wasn&amp;rsquo;t really too keen on getting into another development environment. Secondly, I really didn&amp;rsquo;t want to do any Java development if I didn&amp;rsquo;t have to. C# is my happy place, C++ is for the ugly stuff if you need it, Java is just, well, ugly... Besides the last time I did any serious Java was in college, enter &lt;a href="http://monodroid.net/" target="_blank"&gt;MonoDroid&lt;/a&gt; to save the day!&lt;/p&gt;
&lt;h3&gt;Getting Started&lt;/h3&gt;
&lt;p&gt;To get everything installed read &lt;a href="http://monodroid.net/Installation" target="_blank"&gt;this guide&lt;/a&gt;. Then you can read about the API and architecture to get a better understanding about how it all gels together. Pretty much everything you need including signing up for the newsletter can be found by going directly to &lt;a href="http://www.monodroid.net" target="_blank"&gt;www.monodroid.net&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Once you have everything installed it&amp;rsquo;s pretty easy to get going. The beauty about diving in using a language you are familiar with, means you can get used to the &lt;a href="http://developer.android.com/sdk/index.html" target="_blank"&gt;Android SDK&lt;/a&gt; without having any knowledge of Java or even C++ (for more advanced features). &lt;a href="http://monodroid.net/" target="_blank"&gt;MonoDroid&lt;/a&gt; wraps up all the calls using standard .NET constructs through a JNI bridge, plus, you get all of the power of the standard .NET API&amp;rsquo;s which work in Linux/Android.&lt;/p&gt;
&lt;h3&gt;Hello Android&lt;/h3&gt;
&lt;p&gt;Following the tradition of &amp;ldquo;Hello World&amp;rdquo;, let&amp;rsquo;s jump right in and write an &lt;a href="http://en.wikipedia.org/wiki/Android_(operating_system)" target="_blank"&gt;Android&lt;/a&gt; application.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Make sure that you have everything installed, &lt;a href="http://monodroid.net/Installation" target="_blank"&gt;this guide&lt;/a&gt; couldn&amp;rsquo;t have made it easier. &lt;br clear="all" /&gt; &lt;/li&gt;
&lt;li&gt;Create a new Project in Visual Studio: &lt;a href="http://www.brutaldev.com/image.axd?picture=MonoDroid_VisualStudioNewProject_1.jpg" target="_blank"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="New MonoDroid project in Visual Studio 2010" src="http://www.brutaldev.com/image.axd?picture=MonoDroid_VisualStudioNewProject_thumb_1.jpg" alt="New MonoDroid project in Visual Studio 2010" width="554" height="273" border="0" /&gt;&lt;/a&gt; &lt;br clear="all" /&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://monodroid.net/" target="_blank"&gt;MonoDroid&lt;/a&gt; does most of the heavy lifting for you. If you&amp;rsquo;re familiar with &lt;a href="http://en.wikipedia.org/wiki/Android_(operating_system)" target="_blank"&gt;Android&lt;/a&gt; projects in &lt;a href="http://www.eclipse.org/downloads/" target="_blank"&gt;Eclipse&lt;/a&gt; you should have any problems with the structure. Android uses layout and string resource files (the right way) for the UI. Activities are like UI controllers, all the info you need is on the &lt;a href="http://developer.android.com/index.html" target="_blank"&gt;Android Developers website&lt;/a&gt;. &lt;br clear="all" /&gt; &lt;/li&gt;
&lt;li&gt;Just run the application to check everything is working correctly, if you don&amp;rsquo;t have a device attached or an emulator running then now is the time to create one: &lt;a href="http://www.brutaldev.com/image.axd?picture=MonoDroid_SelectDevice.jpg" target="_blank"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Select a device to connect the debugger" src="http://www.brutaldev.com/image.axd?picture=MonoDroid_SelectDevice_thumb.jpg" alt="Select a device to connect the debugger" width="468" height="308" border="0" /&gt;&lt;/a&gt;&amp;nbsp; &lt;br clear="all" /&gt; &lt;br clear="all" /&gt;If you don&amp;rsquo;t see anything then just click &amp;ldquo;Start emulator image&amp;rdquo;: &lt;a href="http://www.brutaldev.com/image.axd?picture=MonoDroid_SelectEmulator.jpg" target="_blank"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Select an emulator to start or create a new one" src="http://www.brutaldev.com/image.axd?picture=MonoDroid_SelectEmulator_thumb.jpg" alt="Select an emulator to start or create a new one" width="467" height="309" border="0" /&gt;&lt;/a&gt; &lt;br clear="all" /&gt;Once again &lt;a href="http://monodroid.net/" target="_blank"&gt;MonoDroid&lt;/a&gt; holds your hand by signing the package and also installing the Mono runtime if it&amp;rsquo;s not already available. &lt;br clear="all" /&gt;&lt;strong&gt;WARNING&lt;/strong&gt;: If you are running an emulator then this will take a while, if you have a monster PC that does it in seconds then I hate you. &lt;br clear="all" /&gt; &lt;/li&gt;
&lt;li&gt;Unlock the phone/emulator and click the button: &lt;a href="http://www.brutaldev.com/image.axd?picture=MonoDroid_HelloWorlApplication_1.jpg" target="_blank"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="The default Hello World application" src="http://www.brutaldev.com/image.axd?picture=MonoDroid_HelloWorlApplication_thumb_1.jpg" alt="The default Hello World application" width="554" height="392" border="0" /&gt;&lt;/a&gt;&amp;nbsp; &lt;br clear="all" /&gt;That&amp;rsquo;s it! There is a lot of documentation on writing Android applications. Java isn't that far off in syntax to C# so it will be easy to pick up sample code all over the place.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div id="scid:F60BB8FA-6F02-4999-8F5E-9DD4E92C4DA7:6db782a1-3d96-4e79-a15c-48ea6a5fb6d2" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;"&gt;
&lt;div&gt;&lt;a onclick="javascript: _gaq.push(['_trackPageview', 'BrutalMonoDroidApplication.zip']);" href="http://www.brutaldev.com/file.axd?file=BrutalMonoDroidApplication.zip" target="_self"&gt;Download sample code&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;More Information&lt;/h3&gt;
&lt;p&gt;The best place to start is the &lt;a href="http://monodroid.net/Documentation/API_Design" target="_blank"&gt;MonoDroid API design documentation&lt;/a&gt;. Do yourself a favour and browse the classes in the Android namespace. Make sure you check &lt;em&gt;Android.Provider&lt;/em&gt; which gives you access to things like Contacts, Settings, Calls Logs etc. through static classes.&lt;/p&gt;
&lt;p&gt;This Justin guy slicked the domain &lt;a href="http://www.mono-droid.com" target="_blank"&gt;www.mono-droid.com&lt;/a&gt; in July 2010 already so this isn&amp;rsquo;t new, just widely available now and free for the time being. There is a lot of useful information on installing and developing here. He&amp;rsquo;s got videos too, everyone loves videos.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr /&gt;</description>
      <link>http://brutaldev.com/post/2011/01/15/Android-applications-in-C-using-Visual-Studio</link>
      <author>werner@brutaldev.com</author>
      <comments>http://brutaldev.com/post/2011/01/15/Android-applications-in-C-using-Visual-Studio#comment</comments>
      <guid>http://brutaldev.com/post.aspx?id=f32215c4-d443-4e5b-9747-0e2d173da8c1</guid>
      <pubDate>Sat, 15 Jan 2011 10:05:00 -0200</pubDate>
      <category>Android</category>
      <category>C#</category>
      <category>Mono</category>
      <category>MonoDroid</category>
      <category>Visual Studio</category>
      <dc:publisher>Werner</dc:publisher>
      <pingback:server>http://brutaldev.com/pingback.axd</pingback:server>
      <pingback:target>http://brutaldev.com/post.aspx?id=f32215c4-d443-4e5b-9747-0e2d173da8c1</pingback:target>
      <slash:comments>14</slash:comments>
      <trackback:ping>http://brutaldev.com/trackback.axd?id=f32215c4-d443-4e5b-9747-0e2d173da8c1</trackback:ping>
      <wfw:comment>http://brutaldev.com/post/2011/01/15/Android-applications-in-C-using-Visual-Studio#comment</wfw:comment>
      <wfw:commentRss>http://brutaldev.com/syndication.axd?post=f32215c4-d443-4e5b-9747-0e2d173da8c1</wfw:commentRss>
    </item>
  </channel>
</rss>