<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:a10="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Brendan Kowitz's .NET Blog</title><link>http://www.kowitz.net/rss</link><description>All things .NET and HTML5</description><language>en-AU</language><copyright>© Copyright 2010 Brendan Kowitz</copyright><managingEditor /><category>Html</category><category>JavaScript</category><category>Mobile</category><category>.NET</category><category>Code Snippets</category><category>HTML5</category><category>General</category><category>Apple</category><category>Product Reviews</category><category>Errors and Bugs</category><category>ASP.NET</category><category>NHibernate</category><generator>Blazing Blog 1.0.0.0</generator><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/OverTheCode" /><feedburner:info uri="overthecode" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><guid isPermaLink="false">http://www.kowitz.net/mobile-web-toolkits</guid><link>http://feedproxy.google.com/~r/OverTheCode/~3/sPqn-b-t6HQ/mobile-web-toolkits</link><category>Html</category><category>JavaScript</category><category>Mobile</category><title>Mobile Web Toolkits</title><description>&lt;p&gt;&lt;strong&gt;Mobile Interface Toolkits&lt;/strong&gt;
&lt;br /&gt;
These toolkits are currently free* and provide many styles and effects for developing mobile websites for Webkit based mobile browsers. From a .NET perspective they are particularly effective to use with ASP.NET MVC style development.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[jqTouch][1]&lt;/li&gt;
&lt;li&gt;[IU...&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OverTheCode?a=sPqn-b-t6HQ:N5r2hapw9go:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OverTheCode?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OverTheCode?a=sPqn-b-t6HQ:N5r2hapw9go:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OverTheCode?i=sPqn-b-t6HQ:N5r2hapw9go:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OverTheCode/~4/sPqn-b-t6HQ" height="1" width="1"/&gt;</description><pubDate>Tue, 29 Jun 2010 10:05:10 Z</pubDate><feedburner:origLink>http://www.kowitz.net/mobile-web-toolkits</feedburner:origLink></item><item><guid isPermaLink="false">http://www.kowitz.net/lambda-function-factory</guid><link>http://feedproxy.google.com/~r/OverTheCode/~3/ZINS_WnXorA/lambda-function-factory</link><category>.NET</category><category>Code Snippets</category><title>Lambda Function Factory</title><description>&lt;p&gt;Ever dreamed of owning a Function Factory? Unfortunately this one might not make money, but it does make functions. &lt;/p&gt;

&lt;p&gt;The reason you might use something like this is if you are required to make a late-bound call to a specific method on an object at runtime. Of course there are various reasons and ...&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OverTheCode?a=ZINS_WnXorA:YSQ11HkfjKs:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OverTheCode?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OverTheCode?a=ZINS_WnXorA:YSQ11HkfjKs:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OverTheCode?i=ZINS_WnXorA:YSQ11HkfjKs:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OverTheCode/~4/ZINS_WnXorA" height="1" width="1"/&gt;</description><pubDate>Sat, 19 Jun 2010 16:07:45 Z</pubDate><a10:updated>2010-06-19T16:12:34Z</a10:updated><feedburner:origLink>http://www.kowitz.net/lambda-function-factory</feedburner:origLink></item><item><guid isPermaLink="false">http://www.kowitz.net/new-blog</guid><link>http://feedproxy.google.com/~r/OverTheCode/~3/zF-PgGpdx7M/new-blog</link><category>HTML5</category><category>General</category><title>New Blog</title><description>&lt;p&gt;I've finally had time to update my blog to HTML5 and ASP.NET MVC2.&lt;/p&gt;

&lt;p&gt;Although there is a little bit of work left to get things humming along, where's whats wired in (so far):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[ASP.NET MVC2][1]&lt;/li&gt;
&lt;li&gt;[Autofac2][2] for IoC&lt;/li&gt;
&lt;li&gt;[NHibernate2][3]&lt;/li&gt;
&lt;li&gt;[HTML5][4] markup&lt;/li&gt;
&lt;li&gt;[JQuery1.4][5]&lt;/li&gt;
&lt;li&gt;Article ...&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OverTheCode?a=zF-PgGpdx7M:nyZ5sBsqBHY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OverTheCode?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OverTheCode?a=zF-PgGpdx7M:nyZ5sBsqBHY:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OverTheCode?i=zF-PgGpdx7M:nyZ5sBsqBHY:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OverTheCode/~4/zF-PgGpdx7M" height="1" width="1"/&gt;</description><pubDate>Sat, 12 Jun 2010 14:31:15 Z</pubDate><feedburner:origLink>http://www.kowitz.net/new-blog</feedburner:origLink></item><item><guid isPermaLink="false">http://www.kowitz.net/html5/browsers</guid><link>http://feedproxy.google.com/~r/OverTheCode/~3/GKOPmoPTa68/browsers</link><category>HTML5</category><category>Apple</category><title>HTML5 Browsers</title><description>&lt;p&gt;&lt;strong&gt;Who supports HTML5?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The following sites have some good charts on the most cutting edge browsers sporting the latest HTML5 support&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[html5readiness.com][1]  shows the progress of current browser support for HTML5.&lt;/li&gt;
&lt;li&gt;[WTF is HTML5][2]&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;br /&gt;
&lt;strong&gt;Safari&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Webkit based browsers are de...&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OverTheCode?a=GKOPmoPTa68:_fkbxZLac6I:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OverTheCode?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OverTheCode?a=GKOPmoPTa68:_fkbxZLac6I:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OverTheCode?i=GKOPmoPTa68:_fkbxZLac6I:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OverTheCode/~4/GKOPmoPTa68" height="1" width="1"/&gt;</description><pubDate>Wed, 09 Jun 2010 07:22:06 Z</pubDate><feedburner:origLink>http://www.kowitz.net/html5/browsers</feedburner:origLink></item><item><guid isPermaLink="false">http://www.kowitz.net/archive/2009/12/12/roll-your-own-ajax-extender-for-jquery-calendar</guid><link>http://feedproxy.google.com/~r/OverTheCode/~3/fEdSXc5iiDA/roll-your-own-ajax-extender-for-jquery-calendar</link><title>Roll your own AJAX Extender for JQuery Calendar</title><description>&lt;p&gt;Just for something different, I’ve created my first impromptu screencast demonstrating how easy it is to create your own AJAX Extender for JQuery controls, as opposed to using the AjaxToolkit. &lt;/p&gt;  &lt;p&gt;I did realise that the sound quality wasn’t the greatest at first, and I wasn’t using any special equipment apart from my MacBook’s built-in mic and &lt;a href="http://www.microsoft.com/Expression/products/Encoder_Overview.aspx"&gt;Expression Encoder&lt;/a&gt;, hopefully I’ll get the hang of it in the future. &lt;/p&gt; &lt;object width="400" height="300"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=8133320&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=8133320&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300" /&gt;&lt;/object&gt;  &lt;p&gt;&lt;a href="http://vimeo.com/8133320"&gt;Roll Your Own JQuery AJAX Extender&lt;/a&gt; from &lt;a href="http://vimeo.com/user2787940"&gt;Brendan Kowitz&lt;/a&gt; on &lt;a href="http://vimeo.com"&gt;Vimeo&lt;/a&gt;.&lt;/p&gt; &lt;strong&gt;Links&lt;/strong&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://code.google.com/p/overthecode/source/browse/trunk/WebApplicationJQueryUI"&gt;Sourcecode example&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.kowitz.net/archive/2009/12/12/roll-your-own-ajax-extender-for-jquery-calendar.aspx"&gt;Roll your own AJAX Extender for JQuery Calendar&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OverTheCode?a=fEdSXc5iiDA:hpaqCbZs2iI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OverTheCode?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OverTheCode?a=fEdSXc5iiDA:hpaqCbZs2iI:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OverTheCode?i=fEdSXc5iiDA:hpaqCbZs2iI:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OverTheCode/~4/fEdSXc5iiDA" height="1" width="1"/&gt;</description><pubDate>Sun, 13 Dec 2009 19:21:32 Z</pubDate><feedburner:origLink>http://www.kowitz.net/archive/2009/12/12/roll-your-own-ajax-extender-for-jquery-calendar</feedburner:origLink></item><item><guid isPermaLink="false">http://www.kowitz.net/archive/2009/09/03/your-code-via-ndepend</guid><link>http://feedproxy.google.com/~r/OverTheCode/~3/VDAwjPQQbvc/your-code-via-ndepend</link><category>.NET</category><category>Product Reviews</category><title>Your code via NDepend</title><description>&lt;p&gt;Recently I’d had the opportunity to begin exploring code through the eyes of &lt;a href="http://www.ndepend.com/"&gt;NDepend&lt;/a&gt;. I’ve pointed NDepend at my code, open source projects, code at work, just about anything I’ve had the time to load into Visual Studio. Has it been a useful experience? I’d have to say at this point, yes. I’d like to now present a roundup of the features that I’ve enjoyed the most.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What is NDepend&lt;/strong&gt;&lt;/p&gt;
&lt;blockquote style="MARGIN-RIGHT: 0px" dir="ltr"&gt;
&lt;p&gt;NDepend is a tool that simplifies managing a complex .NET code base. Architects and developers can analyze code structure, specify design rules, plan massive refactoring, do effective code reviews and master evolution by comparing different versions of the code. (&lt;a href="http://www.ndepend.com/"&gt;ndepend.com&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Top Features&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;NDepend, in my opinion is fairly complex, and there seems to be a fair depth to the number of features that you’ll discover as you continue using it, however, here are the features I found initially to be the most useful.&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;The predefined CQL Queries &lt;/li&gt;
    &lt;li&gt;Query results &lt;/li&gt;
    &lt;li&gt;Metrics window &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Predefined CQL&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I think the predefined CQL queries window really is the quick way to get up and running in learning about your code. There a dozens of queries ranging from design issues, naming issues, boxing, complex code to just name a few. Not only that, it’s really easy to actually get in there and customise the query to suit what you’re looking for. &lt;/p&gt;
&lt;p&gt;The first feature I was able to use here was to generate and export a report of potentially unused methods. Most codebases seem to somehow accumulate orphan code that can be removed, however its probably hard to find easily without such tools. &lt;/p&gt;
&lt;p&gt;The query I have running in the window below was helping diagnose the portion of the codebase still depending on Hashtables and ArrayLists. The very cool thing I noticed here was that NDepend won’t just tell you the underlying classes that contain these lists, it will shade in on the metric view ALL code effected by it. Even if the lists are wrapped and used elsewhere much higher up.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.kowitz.net/images/www_kowitz_net/WindowsLiveWriter/NDepend_D4AA/image_4.png"&gt;&lt;img title="image" border="0" alt="image" width="609" height="249" src="http://www.kowitz.net/images/www_kowitz_net/WindowsLiveWriter/NDepend_D4AA/image_thumb_1.png" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Related to the CQL, the Query Results window is one that I really wish was a dockable panel inside Visual Studio. By clicking on any member displayed here NDepend will just to the corresponding line of code. Very simple and easy to explore.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.kowitz.net/images/www_kowitz_net/WindowsLiveWriter/NDepend_D4AA/image_5.png"&gt;&lt;img title="image" border="0" alt="image" width="203" height="275" src="http://www.kowitz.net/images/www_kowitz_net/WindowsLiveWriter/NDepend_D4AA/image_thumb.png" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Metrics&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The Metrics view was useful to provide an at a glance distribution of the current code query. It can also show the members that have changed when comparing multiple versions of an assembly. One of the projects I tried was a change comparison between DNN4.9.2 to 5 However, although the core libraries had significant change it did not drastically effect many of the public interfaces.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.kowitz.net/images/www_kowitz_net/WindowsLiveWriter/NDepend_D4AA/image_7.png"&gt;&lt;img title="image" border="0" alt="image" width="520" height="264" src="http://www.kowitz.net/images/www_kowitz_net/WindowsLiveWriter/NDepend_D4AA/image_thumb_2.png" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Visual Studio Integration&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The plug-in for visual studio provides a large array of quick queries and lookups, I like to think of it as ‘Find all References’ on steroids because it gives so many more options and so much 'deeper' information. This starts to relate to things such as Efferent and Afferent coupling, knowing about these factors may definitely assist you when it comes to making refactoring decisions.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.kowitz.net/images/www_kowitz_net/WindowsLiveWriter/NDepend_D4AA/image_9.png"&gt;&lt;img title="image" border="0" alt="image" width="331" height="229" src="http://www.kowitz.net/images/www_kowitz_net/WindowsLiveWriter/NDepend_D4AA/image_thumb_3.png" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Code Comparisons&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Code comparison of a slightly core modified version of DotNetNuke 4.9.1 to 5&lt;/p&gt;
&lt;p&gt;# IL instructions    229 806 to 268 470      (+38 664   +16.8%) &lt;br /&gt;
# Assemblies    11 &lt;br /&gt;
# Namespaces    95 to 110      (+15   +15.8%) &lt;br /&gt;
# Types    725 to 830      (+105   +14.5%) &lt;br /&gt;
# Methods    9 165 to 10 813      (+1 648   +18%) &lt;br /&gt;
# Fields    2 954 to 3 362      (+408   +13.8%) &lt;/p&gt;
&lt;p&gt;Tier code used by the application: &lt;br /&gt;
# Tier Assemblies used    12 &lt;br /&gt;
# Namespaces used    68 to 67      (-1   -1.5%) &lt;br /&gt;
# Types used    565 to 573      (+8   +1.4%) &lt;br /&gt;
# Methods used    1 671 to 1 750      (+79   +4.7%) &lt;br /&gt;
# Fields used    64&lt;/p&gt;
&lt;p&gt;Viewing NDepend’s class browser in Code Comparison mode guides you through what’s changed. Everything from changes in the number of lines of IL, public methods, fields, namespaces, assemblies to test coverage. It may be nice to have these stats, however well structured release notes will do me much better than telling my a library has grown by 33%. I think the more important factor here is capturing changes to public interfaces and also test coverage %.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Getting to know your code…or someone elses&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;When you first come across a new codebase and start to familiarise yourself there are always a number of things that you may want to look at including&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;What are the most important namespaces, classes and methods; NDepend provides this this by a simple lookup then displays it visually. You can also make use of the ‘MethodRank’ feature to find the most used methods. &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;What are the classes with the highest coupling, not necessarily the most important classes. These are the ones to watch out for as they may be the ones doing ‘too much’. Kind of along the lines of the &lt;a href="http://en.wikipedia.org/wiki/Single_responsibility_principle"&gt;Single Responsibility Principle&lt;/a&gt; and even &lt;a href="Separation of concerns"&gt;Separation of concerns&lt;/a&gt;. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Wishlist&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I think in terms of ‘what’ NDepend does, all the information is there ready to be accessed, however there are a few suggestions I’d really love to see that would make having the data a little more ‘at your fingertips’.&lt;/p&gt;
&lt;p&gt;More Visual Studio Integration, there are already some useful integration menus but I see a lot more potential for the information that NDepend can provide. If I had one feature request, it’d be to have that Query Results window as a Visual Studio dockable panel. The idea of not having to keep switching away from VS while I explore the results would be a good thing. &lt;/p&gt;
&lt;p&gt;Although NDepend mostly has this covered, back in 2006 when I was trialing Parasoft’s .TEST one of the really handy concepts was to present you with 10 issues that you should fix today. So the idea of helping to progressively improve your codebase. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Thanks&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Shout-out to &lt;a href="http://codebetter.com/blogs/patricksmacchia/default.aspx"&gt;Patrick Smacchia&lt;/a&gt; for giving me the opportunity to test drive NDepend.&lt;/p&gt;
&lt;p&gt;I think I’ll continue to use NDepend going forward to see what else I am able to discover, and perhaps write a more advanced post. For now, I think it has shown that there are enough easy to use feature in there that even new uses can obtain some immediate value.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Links&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ndepend.com/"&gt;NDepend Homepage&lt;/a&gt; &lt;br /&gt;
&lt;a href="http://www.kowitz.net/archive/2009/09/03/your-code-via-ndepend.aspx"&gt;Your code via NDepend&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OverTheCode?a=VDAwjPQQbvc:7oZoy0rw_3k:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OverTheCode?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OverTheCode?a=VDAwjPQQbvc:7oZoy0rw_3k:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OverTheCode?i=VDAwjPQQbvc:7oZoy0rw_3k:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OverTheCode/~4/VDAwjPQQbvc" height="1" width="1"/&gt;</description><pubDate>Fri, 04 Sep 2009 11:41:33 Z</pubDate><feedburner:origLink>http://www.kowitz.net/archive/2009/09/03/your-code-via-ndepend</feedburner:origLink></item><item><guid isPermaLink="false">http://www.kowitz.net/archive/2009/08/19/cr_classcleaner-now-with-refactor-key</guid><link>http://feedproxy.google.com/~r/OverTheCode/~3/YwsUt0T3UA4/cr_classcleaner-now-with-refactor-key</link><category>.NET</category><category>Code Snippets</category><title>CR_ClassCleaner now with Refactor key</title><description>&lt;p&gt;On occasions I’m sure I’m one of many that take advantage of the &lt;a href="http://www.codeplex.com/CRClassCleaner"&gt;CR_ClassCleaner&lt;/a&gt; plug-in for &lt;a href="http://www.devexpress.com/Products/Visual_Studio_Add-in/Coding_Assistance/"&gt;CodeRush&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;For one reason or another the other day, I somehow managed to bork some of the shortcut keys which made calling ClassCleaner fairly impossible. On that note, I’ve always preferred the context-sensitive refactoring suggestions anyway. So with not a lot of effort I’ve added the RefactorProvider to CR_ClassCleaner. Here’s what you get when pressing the Refactor key on a class definition:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.kowitz.net/images/www_kowitz_net/WindowsLiveWriter/CR_ClassCleanernowwithRefactorkey_12B05/image_2.png"&gt;&lt;img style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title="image" border="0" alt="image" width="529" height="231" src="http://www.kowitz.net/images/www_kowitz_net/WindowsLiveWriter/CR_ClassCleanernowwithRefactorkey_12B05/image_thumb.png" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Feel free to download and try out the compiled dll, or grab the SVN patch to apply to your own source.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Downloads&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://www.kowitz.net/files/CR_ClassCleaner.zip"&gt;CR_ClassCleaner with RefactorKey&lt;/a&gt; (compiled against 9.1.5)&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://www.kowitz.net/files/CR_ClassCleaner_Add_RefactorKey.zip"&gt;CR_ClassCleaner_Add_RefactorKey.patch&lt;/a&gt; (if you want to apply the patch to the codeplex SVN source)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Links&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://www.kowitz.net/archive/2009/08/19/cr_classcleaner-now-with-refactor-key.aspx"&gt;CR_ClassCleaner now with Refactor key&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OverTheCode?a=YwsUt0T3UA4:6CZpHW8zWcw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OverTheCode?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OverTheCode?a=YwsUt0T3UA4:6CZpHW8zWcw:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OverTheCode?i=YwsUt0T3UA4:6CZpHW8zWcw:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OverTheCode/~4/YwsUt0T3UA4" height="1" width="1"/&gt;</description><pubDate>Thu, 20 Aug 2009 19:15:54 Z</pubDate><feedburner:origLink>http://www.kowitz.net/archive/2009/08/19/cr_classcleaner-now-with-refactor-key</feedburner:origLink></item><item><guid isPermaLink="false">http://www.kowitz.net/archive/2009/08/17/replace-default-dnn-calendars-with-ajax-toolkit-calendar-extender</guid><link>http://feedproxy.google.com/~r/OverTheCode/~3/5iMoPydbrhg/replace-default-dnn-calendars-with-ajax-toolkit-calendar-extender</link><category>.NET</category><category>Code Snippets</category><category>Errors and Bugs</category><category>ASP.NET</category><title>Replace default DNN calendars with AJAX Toolkit Calendar Extender</title><description>&lt;p&gt;Although DNN is a very capable CMS, one thing I’d really like to do is send this guy back to 1993:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.kowitz.net/images/www_kowitz_net/WindowsLiveWriter/ReplacedefaultDNNcalendarswithAJAXToolki_C80E/image_2.png"&gt;&lt;img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title="image" border="0" alt="image" width="232" height="295" src="http://www.kowitz.net/images/www_kowitz_net/WindowsLiveWriter/ReplacedefaultDNNcalendarswithAJAXToolki_C80E/image_thumb.png" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;While using a component we purchased (FormMaster), by simply ticking a box, you can call the default DNN calendar for any text field. While this is a cool feature to have it just so happens that the poor ‘ol default DNN Calendar looks like it’s been forgotten about for quite some time.&lt;/p&gt;
&lt;p&gt;The first problem you find if you want to put this thing out of its misery is, you can’t. Navigating in the code to “DotNetNuke.Common.Utilities.Calendar” you find the following signature: &lt;/p&gt;
&lt;pre class="brush: c-sharp;"&gt;“Public Shared Function InvokePopupCal(ByVal Field As System.Web.UI.WebControls.TextBox) As String”. 
&lt;/pre&gt;
Is it a provider: no, so we can't just extend it easily.
&lt;p&gt;One solution, besides modifying the core is to write another module which can ‘hijack’ the DNN Calendars and replace them with the AJAX Toolkit Extender.&lt;/p&gt;
&lt;p&gt;Take it or leave it as a solution, here’s what I’ve done.&lt;/p&gt;
&lt;p&gt;This piece of code may be considered a little angry, but essentially, it just loops through the controls on the page and looks for Calendar ‘asp:Hyperlinks’.&lt;/p&gt;
&lt;pre class="brush: c-sharp;"&gt;
public static void FindNestedCalendarLinks(ControlCollection current, List&amp;lt;Control&amp;gt; foundCalendars)
{
    foreach (Control c in current)
    {
        if (c is HyperLink &amp;amp;&amp;amp; ((HyperLink)c).NavigateUrl.StartsWith("javascript:popupCal('Cal'"))
        {
            foundCalendars.Add(c);
        }
        if (c.Controls != null)
            FindNestedCalendarLinks(c.Controls, foundCalendars);
    }
}
&lt;/pre&gt;
&lt;p&gt;Next, I have a method which is called on the “Page.LoadComplete” event, which adds the AJAX Toolkit Calendar Extender:&lt;/p&gt;
&lt;pre class="brush: c-sharp;"&gt;
public void ReplaceCalendars(ControlCollection controls)
{
    var foundCalendars = new List&amp;lt;Control&amp;gt;();
    FindNestedCalendarLinks(controls, foundCalendars);
    foreach (Control c in foundCalendars)
    {
        string dnnString = ((HyperLink)c).NavigateUrl;

        //extracts the UniqueID: dnn_ctr45232_FormMaster_ctl_e015a64a4a214eaf812836b9f40eb57d
        string textBoxId = matchTextBoxUniqueID.Replace(dnnString, "$1");
        //extracts the original control id: ctl_e015a64a4a214eaf812836b9f40eb57d
        Match textBoxMatch = matchTextBoxOriginalID.Match(textBoxId);

        if (textBoxMatch.Success)
        {
            AjaxControlToolkit.CalendarExtender cal = new AjaxControlToolkit.CalendarExtender();
            c.Parent.Controls.Add((Control)cal);

            //Set properties
            cal.CssClass = CalendarCssClass;
            cal.Format = DateFormat;
            cal.PopupButtonID = c.ID;
            cal.TargetControlID = textBoxMatch.Result("$1");
        }
    }
}
&lt;/pre&gt;
&lt;p&gt;Just for good measure, there’s also a settings page, incase you need to change some of the properties of the Ajax calendars:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.kowitz.net/images/www_kowitz_net/WindowsLiveWriter/ReplacedefaultDNNcalendarswithAJAXToolki_C80E/image_6.png"&gt;&lt;img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title="image" border="0" alt="image" width="438" height="161" src="http://www.kowitz.net/images/www_kowitz_net/WindowsLiveWriter/ReplacedefaultDNNcalendarswithAJAXToolki_C80E/image_thumb_2.png" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;That’s pretty much the bulk of the work. The end result, a much nicer experience:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.kowitz.net/images/www_kowitz_net/WindowsLiveWriter/ReplacedefaultDNNcalendarswithAJAXToolki_C80E/image_4.png"&gt;&lt;img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title="image" border="0" alt="image" width="408" height="243" src="http://www.kowitz.net/images/www_kowitz_net/WindowsLiveWriter/ReplacedefaultDNNcalendarswithAJAXToolki_C80E/image_thumb_1.png" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Downloads&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://www.kowitz.net/files/Ajax.Modules.CalendarExtender.zip"&gt;AJAX Toolkit Calendar Extender for DNN Module&lt;/a&gt; &lt;/li&gt;
    &lt;li&gt;&lt;a href="http://www.kowitz.net/files/Ajax.Modules.CalendarExtender_source.zip"&gt;AJAX Toolkit Calendar Extender for DNN Module Source&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Links&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://www.kowitz.net/archive/2009/08/17/replace-default-dnn-calendars-with-ajax-toolkit-calendar-extender.aspx"&gt;Replace default DNN calendars with AJAX Toolkit Calendar Extender&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OverTheCode?a=5iMoPydbrhg:dVzS78Ej7pA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OverTheCode?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OverTheCode?a=5iMoPydbrhg:dVzS78Ej7pA:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OverTheCode?i=5iMoPydbrhg:dVzS78Ej7pA:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OverTheCode/~4/5iMoPydbrhg" height="1" width="1"/&gt;</description><pubDate>Tue, 18 Aug 2009 15:07:13 Z</pubDate><feedburner:origLink>http://www.kowitz.net/archive/2009/08/17/replace-default-dnn-calendars-with-ajax-toolkit-calendar-extender</feedburner:origLink></item><item><guid isPermaLink="false">http://www.kowitz.net/archive/2009/07/29/my-organisation-has-a-vision</guid><link>http://feedproxy.google.com/~r/OverTheCode/~3/Y3m1g-y4SNU/my-organisation-has-a-vision</link><category>General</category><title>Organisations and vision</title><description>&lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I’d just like to share this small snippet from one of my masters Leadership assignments. To me one of the things that can mean the difference between ‘I’m only here because I get paid’ and ‘I’m here because I feel like I’m really making a difference’ can be a leader’s belief and sense of purpose. I believe this starts in the organisation’s own vision, mission and values.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why have a meaningful vision?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Without going into the argument of why an organisation should have a true and meaningful vision and mission statement, Byrne &amp;amp; Rees (2006, p. 15) point out that “if an organizational mission statement is not ‘brought to life’ through the day-to-day activities of the organization, it may become a liability in that the staff will see it as a sham rather than as a motivator”.&lt;/p&gt;
&lt;p&gt;Further to this “leaders can sustain their effectiveness only if they empower employees around a shared purpose. Leaders must convey passion for the business every day while maintaining clarity about the mission of the organisation” (George 2007). In some organisations, perhaps the meaning of the vision, mission, and values are there, they just may be portrayed awkwardly. &lt;/p&gt;
&lt;p&gt;Even at a basic level any leader should be able to answer the phase “I love companyX because...”, “we give our customers a great family holiday at an affordable rate”, or even as simple as “we make accommodation easy”. Whatever the response, when leaders truly believe in a vision and and believe in making it an everyday reality, others will follow.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;Byrne, J-AC &amp;amp; Rees, RT 2006, The Successful Leadership Development Program: How to Build it and How to Keep it Going, Pfeiffer, San Francisco.&lt;/li&gt;
    &lt;li&gt;George, B 2007, True North: Discover your Authentic Leadership, Jossey-Bass, San Francisco.&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OverTheCode?a=Y3m1g-y4SNU:ssnIGLzNp9A:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OverTheCode?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OverTheCode?a=Y3m1g-y4SNU:ssnIGLzNp9A:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OverTheCode?i=Y3m1g-y4SNU:ssnIGLzNp9A:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OverTheCode/~4/Y3m1g-y4SNU" height="1" width="1"/&gt;</description><pubDate>Thu, 30 Jul 2009 21:06:01 Z</pubDate><feedburner:origLink>http://www.kowitz.net/archive/2009/07/29/my-organisation-has-a-vision</feedburner:origLink></item><item><guid isPermaLink="false">http://www.kowitz.net/archive/2009/07/19/create-nhibernate-classes-using-t4</guid><link>http://feedproxy.google.com/~r/OverTheCode/~3/F-34LOsqf8M/create-nhibernate-classes-using-t4</link><category>.NET</category><category>ASP.NET</category><category>NHibernate</category><title>Create NHibernate classes using T4</title><description>&lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Over the last little while there have been a raft of posts about using T4 templates, I think most of this seemed to be sparked from the drive to extend and gain more control over the Linq-to-Sql classes. So while there are a few good T4 templates to convert DBML files into classes there have been a number of drawbacks, some of these are pointed out &lt;a href="http://www.pnpguidance.net/Post/SampleFluentNHibernateT4TemplatesCodeGenerationLINQToSQL.aspx"&gt;here&lt;/a&gt;. The fact that L2S doesn’t support many-to-many relationships and the designer doesn’t let you specify the column lengths make using it for NHibernate (NH) related purposes fall a little short.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;NHibernate XML Intellisense&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;On the next point, I know there has been a fair amount of hype around the Fluent NHibernate Mapping scene as well. I have never really found a few XML mapping files that hard to deal with. Here’s why:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.kowitz.net/images/www_kowitz_net/WindowsLiveWriter/AutosyncpropertiesforNHibernateusingT4_6A86/image_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.kowitz.net/images/www_kowitz_net/WindowsLiveWriter/AutosyncpropertiesforNHibernateusingT4_6A86/image_thumb_1.png" width="483" height="210" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Yep, once you’ve added the xsd definitions into Visual Studio’s schemas folder there’s intellisense and validation over any NH config.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;T4 for Hbm.xml&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;If you’re creating a new project there is always the hassle of ensuring that your NH mappings have the same properties as your classes and all the methods and properties are virtual etc. So instead of converting a DBML file to NH mappings and classes, as mentioned before it is not really intended for this purpose. Here’s a small T4 template that you can use to convert .hbm.xml files into partial classes. So now, all you need to do is maintain an xml mapping file and let your class properties be automatically synchronised. My sample solution looks like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.kowitz.net/images/www_kowitz_net/WindowsLiveWriter/AutosyncpropertiesforNHibernateusingT4_6A86/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.kowitz.net/images/www_kowitz_net/WindowsLiveWriter/AutosyncpropertiesforNHibernateusingT4_6A86/image_thumb.png" width="270" height="272" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Inside the “BusinessObjectsGenerator.tt” is a simple generator that includes the desired business object structure and then specifies which xml files in the solution to generate partial classes for. The classes are &lt;a href="http://msdn.microsoft.com/en-us/library/wa80x488.aspx"&gt;partial&lt;/a&gt; so you can extend them with custom changes if needed in another file.&lt;/p&gt;  &lt;pre class="brush: c-sharp;"&gt;&amp;lt;#@ template language="C#v3.5" debug="True" hostspecific="True"  #&amp;gt;

&amp;lt;#@ include file="..\..\T4Templates\BusinessObjectsStructureTemplate.tt" #&amp;gt;
&amp;lt;#@ output extension="log" #&amp;gt;
&amp;lt;#

BusinessObjectStructureTemplate template = new BusinessObjectStructureTemplate();
var pathBase = new System.IO.FileInfo(Host.TemplateFile).DirectoryName;

BusinessObjectStructureTemplate.RenderClassFromHbm(pathBase, @"Mapping\Product.hbm.xml", template);
BusinessObjectStructureTemplate.RenderClassFromHbm(pathBase, @"Mapping\Order.hbm.xml", template);
BusinessObjectStructureTemplate.RenderClassFromHbm(pathBase, @"Mapping\Customer.hbm.xml", template);

#&amp;gt;&lt;/pre&gt;

&lt;p /&gt;

&lt;p&gt;If you’ve previously downloaded and looked into &lt;a href="http://l2st4.codeplex.com/"&gt;Damien’s L2S templates&lt;/a&gt; they look fairly complex. The easiest way I’ve found to produce T4 is with the &lt;a href="http://t4toolbox.codeplex.com/"&gt;T4 toolbox&lt;/a&gt;, and also using the &lt;a href="http://t4-editor.tangible-engineering.com/"&gt;T4 Editor&lt;/a&gt; by Tangible Engineering. However, currently if you’ve download the T4Toolbox, I had to download and compile rev#34560 which corrects an error when having T4 templates in a project that is nested in a solution folder.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;On the inside&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Most of the work is done inside the “BusinessObjectsStructureTemplate.tt” file. What I’ve done to try and keep things simple is use NH’s own ‘MappingDocumentParser’ class to parse the Xml file, then simply iterate through the config to populate some custom data structures that are applied to the template. The reason for this is the custom data classes inside the T4 templates can be extended and changed later if more flexibility is needed, also meaning a new adapter could be written instead of the NH version.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sourcecode&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://code.google.com/p/systembusinessobjects/source/browse/trunk/T4Templates"&gt;Visit the T4 repository&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Choose one of these:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;System.BusinessObjects version: BusinessObjectsStructureTemplate.tt&lt;/li&gt;

  &lt;li&gt;Generic POCO version: BusinessObjectsStructurePOCOTemplate.tt&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And then include that file into the generator:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;BusinessObjectsGenerator.tt&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Links&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.kowitz.net/archive/2009/07/19/create-nhibernate-classes-using-t4.aspx"&gt;Create NHibernate classes using T4&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OverTheCode?a=F-34LOsqf8M:CYZTOZJsVTM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OverTheCode?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/OverTheCode?a=F-34LOsqf8M:CYZTOZJsVTM:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OverTheCode?i=F-34LOsqf8M:CYZTOZJsVTM:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/OverTheCode/~4/F-34LOsqf8M" height="1" width="1"/&gt;</description><pubDate>Mon, 20 Jul 2009 08:30:53 Z</pubDate><feedburner:origLink>http://www.kowitz.net/archive/2009/07/19/create-nhibernate-classes-using-t4</feedburner:origLink></item></channel></rss>
