<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://srtsolutions.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Patrick Steele</title><link>http://srtsolutions.com/blogs/patricksteele/default.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><item><title>Monorail Dynamic Actions = Reusable Goodness!</title><link>http://srtsolutions.com/blogs/patricksteele/archive/2008/08/29/monorail-dynamic-actions-reusable-goodness.aspx</link><pubDate>Fri, 29 Aug 2008 22:15:44 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:4424</guid><dc:creator>Patrick Steele's .NET Blog</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://srtsolutions.com/blogs/patricksteele/rsscomments.aspx?PostID=4424</wfw:commentRss><comments>http://srtsolutions.com/blogs/patricksteele/archive/2008/08/29/monorail-dynamic-actions-reusable-goodness.aspx#comments</comments><description>Monorail gives you a nice, easy to use MVC implementation on top of ASP.NET. Dynamic Actions is a feature that allows code reuse across controllers without restricting you to specific inheritence model. In classic MVC style, Monorail controllers expose actions. Any &amp;quot;public void&amp;quot; method on a controller class is considered an action: public void Index() { ... } public void NotOpen() { ... } public void OrderClosed() { ... } Sometimes, you may want the same action available on multiple controllers. Since a controller is simply a .NET class, you could use inheritence, but more often than not, that doesn&amp;#39;t fit well into your solution. For my example, I&amp;#39;ve got a Monorail application I wrote for my daughter&amp;#39;s grade school. I used the techniques described here to provide a textbox with AJAX autocomplete used to select a particular guardian (NOTE: we have to be politcally correct here as the person who is the actual guardian may not be the parent. Hence, we use the term &amp;quot;Guardian&amp;quot;). It works great and was easy to set up. The NVelocity template code is simply: Find by Guardian Name (Last, First): $AjaxHelper.InputTextWithAutoCompletion(&amp;quot;parentsName&amp;quot;, &amp;quot;FindGuardians.ashx&amp;quot;, &amp;quot;%{}&amp;quot;, &amp;quot;%{}&amp;quot;) My &amp;quot;FindGuardians&amp;quot; action (method) is pretty simple too: public void FindGuardians( string parentsName) { if (parentsName.Length &amp;gt; 0) { Guardian[] g = Guardian.FindAllStartingWith( this .CurrentSchool, parentsName); PropertyBag[ &amp;quot;parents&amp;quot; ] = g; } } The &amp;quot;CurrentSchool&amp;quot; property is on a base class from which all of my controllers derive from. It lets all of the other controllers know what school the current user is enrolled in. And, as you saw in the previous link, our view for &amp;quot;FindGuardians&amp;quot; that renders the autocomplete list is simple: &amp;lt;ul&amp;gt; #foreach($parent in $parents) &amp;lt;li&amp;gt;$parent.ContactInfo.LastName, $parent.ContactInfo.FirstName&amp;lt;/li&amp;gt; #end &amp;lt;/ul&amp;gt; So the first time I needed this lookup on a different view, I just did a quick copy paste. C&amp;#39;mon -- a 9-line method and a single view? Just copy it. Well, as time moved on, I needed this lookup in a number of different controllers. I turned to Monorail&amp;#39;s Dynamic Actions and Shared Views to get me some reusable goodness! A Dynamic Action is an action that is added to the controller during initialization. It&amp;#39;s an action on the controller, accessible by a name, but is not one of the &amp;quot;public void&amp;quot; methods compiled with the class. It&amp;#39;s a class in itself that implements IDynamicAction. When the action is called, the IDynamicAction.Execute of the dynamic action is called. Converting the controller code to a dynamic action was pretty straightforward. I had to deal with pulling the &amp;quot;parentsName&amp;quot; out of the request manually since I&amp;#39;m not going through SmartDispatcherController. And I moved the FindGuardians view code to a shared view so it could also be accessed by the dynamic action from anywhere. Here&amp;#39;s the final code: public class FindGuardiansAction : IDynamicAction { #region IDynamicAction Members public object Execute(IEngineContext engineContext, IController controller, IControllerContext controllerContext) { ControllerBase baseCtlr = (ControllerBase)controller; string parentsName = engineContext.Request.Params[ &amp;quot;parentsName&amp;quot; ]; if (parentsName.Length &amp;gt; 0) { Guardian[] g = Guardian.FindAllStartingWith(baseCtlr.CurrentSchool, parentsName); baseCtlr.PropertyBag[ &amp;quot;parents&amp;quot; ] = g; } baseCtlr.RenderSharedView( &amp;quot;Shared/Lookups/FindGuardians&amp;quot; , true ); return null ; } #endregion } One last thing I did was create a static method on the FindGuardiansAction class to make installation easy: public static void InstallOn(Controller controller) { controller.DynamicActions[ &amp;quot;FindGuardians&amp;quot; ] = new FindGuardiansAction(includeStaff); } Now when I need the FindGuardians action on a controller, I call the InstallOn during initialization of the controller: public override void Initialize() { base .Initialize(); FindGuardiansAction.InstallOn( this ); } There&amp;#39;s a couple of other AJAX autocomplete lookups I&amp;#39;ve created using these methods and it makes my life so much easier and the development is so much quicker....(&lt;a href="http://srtsolutions.com/blogs/patricksteele/archive/2008/08/29/monorail-dynamic-actions-reusable-goodness.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=4424" width="1" height="1"&gt;</description></item><item><title>Announcing Mads Torgersen as keynoter at CodeMash!</title><link>http://srtsolutions.com/blogs/patricksteele/archive/2008/08/29/announcing-mads-torgersen-as-keynoter-at-codemash.aspx</link><pubDate>Fri, 29 Aug 2008 19:16:26 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:4422</guid><dc:creator>Patrick Steele's .NET Blog</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://srtsolutions.com/blogs/patricksteele/rsscomments.aspx?PostID=4422</wfw:commentRss><comments>http://srtsolutions.com/blogs/patricksteele/archive/2008/08/29/announcing-mads-torgersen-as-keynoter-at-codemash.aspx#comments</comments><description>Just announced (about 45 minutes ago): Microsoft Language PM Mads Torgersen will be a keynote speaker at CodeMash ! This is great news! I visited one of Mads&amp;#39; session at the MVP Summit this year and it was really good. He&amp;#39;s a great speaker and has an enormous amount of C# and .NET knowledge to share....(&lt;a href="http://srtsolutions.com/blogs/patricksteele/archive/2008/08/29/announcing-mads-torgersen-as-keynoter-at-codemash.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=4422" width="1" height="1"&gt;</description></item><item><title>Euler 10</title><link>http://srtsolutions.com/blogs/patricksteele/archive/2008/08/27/euler-10.aspx</link><pubDate>Wed, 27 Aug 2008 13:10:52 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:4406</guid><dc:creator>Patrick Steele's .NET Blog</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://srtsolutions.com/blogs/patricksteele/rsscomments.aspx?PostID=4406</wfw:commentRss><comments>http://srtsolutions.com/blogs/patricksteele/archive/2008/08/27/euler-10.aspx#comments</comments><description>After tackling number 9 yesterday , I thought I&amp;#39;d do #10 real quick since it seemend pretty easy. Calculate the sum of all the primes below two million. The code for the algorithm was a simple 2 lines: var range = GeneratePrimes().TakeWhile(x =&amp;gt; x &amp;lt; 2000000); int sum = range.Sum(); But I have to confess that I took most Bill&amp;#39;s GeneratePrimes() from is solution to Euluer #7 . I say &amp;quot;most&amp;quot; because I didn&amp;#39;t grok his implementation of IsPrime(). I read his description a number of times and even stepped through the code a couple of iterations, but I still didn&amp;#39;t &amp;quot;get&amp;quot; his use of the List&amp;lt;int&amp;gt; to keep a list of already found primes. So I wrote my own IsPrime(). I used the canonical definition of a prime number (&amp;quot;a number which is evenly divisible by one 1 and itself&amp;quot;). public static bool IsPrime( this int number) { if (number == 1) return false ; if (number == 2) return true ; var range = Enumerable.Range(2, number - 2).ToList(); return range.TrueForAll(n =&amp;gt; number % n != 0); } So I started running my solution. After about 10 minues, I paused and saw that I was still generating prime numbers in the 20,000-30,000 range. Hmmm... Ok, I&amp;#39;ll just let it run overnight. I got up about 7.5 hours after going to bed and my app was still running! I paused it and saw it was only in the 950,000 range of determining primes below 2 million (not even half way through!). So I decided to take 20 seconds and really THINK about my IsPrime() method and realized how inefficient it was to generate that huge range to use the &amp;#39;TrueForAll&amp;#39; on. So I eliminated the LINQ code and did a simple for loop that will break out as soon as it finds a number that is evenly divisible: public static bool IsPrime( this int number) { if (number == 1) return false ; if (number == 2) return true ; for ( int n = 2; n &amp;lt; number; n++) { if (number % n == 0) return false ; } return true ; } Now I ran the code and after about 20 minutes ran into a new problem: An overflow exception calling range.Sum(). On the good side, it only took about 20 minutes to get my primes under two million. On the bad side, I should have thought about that line of code a little more. Adding up all of the primes below two million is probably going to produce a huge number (much bigger than a 32-bit integer could hold). So I decided to move the range &amp;quot;up&amp;quot; to use longs (I didn&amp;#39;t feel like going back and changing the extension method to use longs): var longrange = range.Cast&amp;lt; long &amp;gt;(); var sum = longrange.Sum(); Success in about 20 minutes! PS - I went back and ripped out my IsPrime() and put Bill&amp;#39;s back in. Now it completes in about 5 minutes. How come the boss is always right?...(&lt;a href="http://srtsolutions.com/blogs/patricksteele/archive/2008/08/27/euler-10.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=4406" width="1" height="1"&gt;</description></item><item><title>Project Euler #9</title><link>http://srtsolutions.com/blogs/patricksteele/archive/2008/08/26/project-euler-9.aspx</link><pubDate>Tue, 26 Aug 2008 21:22:00 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:4400</guid><dc:creator>Patrick Steele's .NET Blog</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://srtsolutions.com/blogs/patricksteele/rsscomments.aspx?PostID=4400</wfw:commentRss><comments>http://srtsolutions.com/blogs/patricksteele/archive/2008/08/26/project-euler-9.aspx#comments</comments><description>So I decided to start looking into the Project Euler problems. A number of fellow SRT employees have been tackling these over the past few months and after recently reading Bill&amp;#39;s solutions for problems #7 and #8 I decided to look at #9 . Find the only Pythagorean triplet, {a, b, c}, for which a + b + c = 1000. I thought about this for quite a while. I was trying to see how I could utilize LINQ to make this easier. In the end, I decided to just use the brute force method of nested loops: private static void Euler9() { for ( int a = 0; a &amp;lt; 1000; a++) { for ( int b = a + 1; b &amp;lt; 1000; b++) { for ( int c = b + 1; c &amp;lt; 1000; c++) { if (a + b + c == 1000 &amp;amp;&amp;amp; (Math.Pow(a, 2) + Math.Pow(b, 2) == Math.Pow(c, 2))) { Console.WriteLine( &amp;quot;{0},{1},{2}&amp;quot; , a, b, c); return ; } } } } } I added a few optimizations in an effort to speed this up: Since a+b+c has to equal 1000, no single element (a or b or c) can be greater than 1000. Therefore my loops are pretty short. I took advantage of C#&amp;#39;s short-circuiting to do the simple &amp;quot;a + b + c == 1000&amp;quot; check before doing the squares. It runs pretty quick (under a second). The first time I ran it I took out the &amp;quot;return&amp;quot; to make sure my logic only produced a single result. It did! :)...(&lt;a href="http://srtsolutions.com/blogs/patricksteele/archive/2008/08/26/project-euler-9.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=4400" width="1" height="1"&gt;</description></item><item><title>Ann Arbor Give Camp - Angel's Place</title><link>http://srtsolutions.com/blogs/patricksteele/archive/2008/07/15/ann-arbor-give-camp-angel-s-place.aspx</link><pubDate>Tue, 15 Jul 2008 17:48:03 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:3885</guid><dc:creator>Patrick Steele's .NET Blog</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://srtsolutions.com/blogs/patricksteele/rsscomments.aspx?PostID=3885</wfw:commentRss><comments>http://srtsolutions.com/blogs/patricksteele/archive/2008/07/15/ann-arbor-give-camp-angel-s-place.aspx#comments</comments><description>I was fortunate enough to be not only an organizer for the Ann Arbor Give Camp, but I also put myself on the development team for Angel&amp;#39;s Place -- a local charity that helps place developmentally and physically challenged adults into good homes. Our team of Paul Vollweiler, Carl Furrow, Aditya (Adi) Thakker and myself had a great time with our assigment. After Friday&amp;#39;s night&amp;#39;s dinner, we met with our charitiy representative Marcie Levey and started working on a solution for their ever-growing waiting list (that is currently stored in Excel!). Once we had a good idea of what we wanted to do, Paul set up an SVN repository for us to use for the weekend and then Carl jumped on the UI. Paul, Adi and I whiteboarded the schema until about 1am Saturday morning. Then we started coding our domain model using ActiveRecord . We were just about done at 2am, but we kept going for about another hour writing some code to populate the inital tables. On Saturday we finalized the domain model and started work on the UI (WinForms). Carl had organized the form into different tabs which related to the different sections of the paper form the Angel&amp;#39;s Place staff is already familiar with. In addition, he set up an architecture where each tab had a separate user control that was used to display data for a particular applicant. This allowed all of us to work together on the same UI without having to worry about conflicts in VS.NET&amp;#39;s &amp;quot;designer&amp;quot; files. We just concentrated our UI coding on a particular user control! That along made us very productive in the home stretch. All in all it was a great success! We didn&amp;#39;t complete our app 100% before Sunday, but Paul has put a lot more work into it and we&amp;#39;ll be handing it over to the charity some time this week. Technorati tags: annarborgivecamp...(&lt;a href="http://srtsolutions.com/blogs/patricksteele/archive/2008/07/15/ann-arbor-give-camp-angel-s-place.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=3885" width="1" height="1"&gt;</description></item><item><title>Ann Arbor Give Camp - The Internet Speaks!</title><link>http://srtsolutions.com/blogs/patricksteele/archive/2008/07/15/ann-arbor-give-camp-the-internet-speaks.aspx</link><pubDate>Tue, 15 Jul 2008 17:36:23 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:3886</guid><dc:creator>Patrick Steele's .NET Blog</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://srtsolutions.com/blogs/patricksteele/rsscomments.aspx?PostID=3886</wfw:commentRss><comments>http://srtsolutions.com/blogs/patricksteele/archive/2008/07/15/ann-arbor-give-camp-the-internet-speaks.aspx#comments</comments><description>People are blogging about their experience at Give Camp. Here&amp;#39;s just a few: http://www.michaeleatonconsulting.com/blog/archive/2008/07/14/ann-arbor-give-camp---wrap-up.aspx http://srtsolutions.com/blogs/mikewoelmer/archive/2008/07/14/ann-arbor-give-camp-and-the-developers-in-room-be-240.aspx http://fullextension.blogspot.com/2008/07/ann-arbor-give-camp-report.html http://theumlguy.spaces.live.com/blog/cns!B4665B67C2981533!231.entry http://www.codinggeekette.com/2008/07/ann-arbor-give-camp-day-3.aspx http://www.joshholmes.com/2008/07/14/AnnArborGiveCamp2008.aspx https://blogs.msdn.com/johnmullinax/archive/2008/07/13/giving-at-give-camp.aspx http://markegilbert.wordpress.com/2008/07/13/amusing-bits-from-ann-arbor-give-camp/ And even the press is getting involved: http://www.wwj.com/Ann-Arbor-Give-Camp---Amazing-/2595217 http://www.earthtimes.org/articles/show/developers-create-500000-in-custom,467966.shtml Technorati tags: annarborgivecamp...(&lt;a href="http://srtsolutions.com/blogs/patricksteele/archive/2008/07/15/ann-arbor-give-camp-the-internet-speaks.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=3886" width="1" height="1"&gt;</description></item><item><title>Ann Arbor Give Camp - WOW!</title><link>http://srtsolutions.com/blogs/patricksteele/archive/2008/07/15/ann-arbor-give-camp-wow.aspx</link><pubDate>Tue, 15 Jul 2008 17:26:31 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:3883</guid><dc:creator>Patrick Steele's .NET Blog</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://srtsolutions.com/blogs/patricksteele/rsscomments.aspx?PostID=3883</wfw:commentRss><comments>http://srtsolutions.com/blogs/patricksteele/archive/2008/07/15/ann-arbor-give-camp-wow.aspx#comments</comments><description>Wow! Wow! All I can say is WOW! As one who helped organize this event (along with Microsoft&amp;#39;s Jennifer Marsman , John Hopkins and Todd Bohlen) I was simply amazed, impressed and astounded about the weekend&amp;#39;s events. We had an awesome group of developers give up a beautiful July weekend in Michigan (and if you know Michigan, there haven&amp;#39;t been too many nice weekends this summer) to come out and help charities solve their IT problems -- mostly by developing/enhancing a website or creating some kind of small data collection app. While the majority of the weekend was head&amp;#39;s down development, one of the best parts was Sunday afternoon where everyone (charities and developers) got together and showed the work that was done. It was amazing to see the amount of work accomplished in a single weekend. You&amp;#39;ve got to realize we had some charities come in with nothing -- no domain name, no website, no email, nothing! -- and walked out Sunday afternoon with a full CMS-backed website that allowed them to get their message out. Awesome! I can&amp;#39;t wait to be a part of the next Give Camp! Thanks to Jennifer for bringing me in on this. Technorati tags: annarborgivecamp...(&lt;a href="http://srtsolutions.com/blogs/patricksteele/archive/2008/07/15/ann-arbor-give-camp-wow.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=3883" width="1" height="1"&gt;</description></item><item><title>Moving from NVelocity to Brail</title><link>http://srtsolutions.com/blogs/patricksteele/archive/2008/07/10/moving-from-nvelocity-to-brail.aspx</link><pubDate>Fri, 11 Jul 2008 03:58:27 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:3835</guid><dc:creator>Patrick Steele's .NET Blog</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://srtsolutions.com/blogs/patricksteele/rsscomments.aspx?PostID=3835</wfw:commentRss><comments>http://srtsolutions.com/blogs/patricksteele/archive/2008/07/10/moving-from-nvelocity-to-brail.aspx#comments</comments><description>I&amp;#39;m a big fan of Castle&amp;#39;s Monorail -- an MVC implementation for ASP.NET. One of the nice things about it is that you get to pick which view engine you want to use. The engines currently available are NVelocity , Brail (based on Boo ) and AspView . There&amp;#39;s also a new view engine for Monorail based on NHaml . When people first start learning Monorail, a lot of them use NVelocity. It&amp;#39;s a very simple templating language (which kind of forces you to keep complex logic out of the view) and most all of the Monorail documentation has samples using NVelocity. I&amp;#39;ve used NVelocity for the few small Monorail projects I&amp;#39;ve done and I&amp;#39;ve been pretty happy with it. I wanted to give Brail a try so I pulled out one of my older Monorail sample projects (doesn&amp;#39;t everybody build a small sample app when they&amp;#39;re first learning something?). Monorail supports registering more than one view engine so I just updated my web.config to include brail as well. This seemed like an easy way to run NVelocity and Brail side-by-side so I could play around with converting my old views to Brail as well as creating new ones. I did notice one thing right away: You can&amp;#39;t have a layout in one engine and the view in another. My controller had a &amp;quot;default&amp;quot; layout (called default.vm). I added a new method to the controller called &amp;quot;BrailTest&amp;quot; and then created my view &amp;quot;BrailTest.brail&amp;quot;. When Monorail found the &amp;quot;BrailTest.brail&amp;quot;, that meant the layout had to be called &amp;quot;default.brail&amp;quot;. When the layout &amp;quot;default.brail&amp;quot; wasn&amp;#39;t found, I got an error. So even though it&amp;#39;s technically possible to use two view engines at the same time, note that you&amp;#39;ll have to maintain two layout files. I don&amp;#39;t even know what would happend with view components! :) Starting Fresh With Brail So I decided to start a new Monorail project that would use Brail as the view engine. Accessing my PropertyBag variables is almost exactly the same: $myVar in NVelocity vs. ${myVar} in Brail. What I fell in love with his having a real .NET CLR language (Boo) for my view engine. If I need some tricky logic, I just create a small helper method in Boo and I&amp;#39;m all set. Very nice! So here&amp;#39;s a few points for anyone thinking about moving from NVelocity to Brail: Brail is case sensitive. As a C# programmer, I usually keep my &amp;quot;case&amp;quot; in order, but I got sloppy with NVelocity and used a lot of lowercase everywhere. Can&amp;#39;t do that with Brail anymore. Layouts: While NVelocity uses &amp;quot;$childContent&amp;quot; to indicate the location of the rendered view, Brail uses &amp;quot;${ChildOutput}&amp;quot;. If you decide to create a function in Brail (&amp;quot;def&amp;quot;), it needs to be the first thing in the Brail file -- before any rendering code. Boo uses indenting for blocks. Brail adds an additional requirement of having an &amp;quot;end&amp;quot; keyword. Not a big deal for me since I haven&amp;#39;t done any real coding in Boo. Make sure you include the &amp;quot;:&amp;quot; with your else statements! This one had me puzzled for quite a while. If you&amp;#39;re not familiar with blocks in Boo/Brail, he&amp;#39;s a sample if statement: if charity.AssignedRoom is not null: // do some stuff end Note the &amp;quot;end&amp;quot; is specific to Brail (not Boo). Well, if you need to add an else clause, make sure you include the &amp;quot;:&amp;quot; with the else: if charity.AssignedRoom is not null: // do some stuff else: // do some other stuff end All in all, I really like Brail and don&amp;#39;t think I&amp;#39;ll be moving back to NVelocity any time soon. Well done Ayende !...(&lt;a href="http://srtsolutions.com/blogs/patricksteele/archive/2008/07/10/moving-from-nvelocity-to-brail.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=3835" width="1" height="1"&gt;</description></item><item><title>Lansing Day of .NET Recap</title><link>http://srtsolutions.com/blogs/patricksteele/archive/2008/06/23/lansing-day-of-net-recap.aspx</link><pubDate>Tue, 24 Jun 2008 02:25:23 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:3666</guid><dc:creator>Patrick Steele's .NET Blog</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://srtsolutions.com/blogs/patricksteele/rsscomments.aspx?PostID=3666</wfw:commentRss><comments>http://srtsolutions.com/blogs/patricksteele/archive/2008/06/23/lansing-day-of-net-recap.aspx#comments</comments><description>I had a great time at the Lansing Day of .NET on Saturday! Not only are people blogging about it , but it made the news too! Awesome job guys. You packed a lot of great stuff in one day. As someone who helped plan the Ann Arbor Day of .NET last year, I know that it takes a lot of time and legwork to put one of those together. I didn&amp;#39;t get there in time to see Michael Eaton&amp;#39;s ActiveRecord talk. But I did catch Jay&amp;#39;s Windsor talk. After lunch, I did my Monorail presentation. This was an expanded version of my 30-minute Monorail &amp;quot;overview&amp;quot; I gave during a vendor session at CodeMash this past January. I took out a couple of the &amp;quot;flashy demos&amp;quot; of scaffolding and AJAX and got a bit more into the details of Monorail. It went pretty well, but after doing a post-mortem (I always jot down notes on how I feel I did), I think I&amp;#39;d do this talk a little differently in the future. Probably a bit more of me actually coding a few controllers and less viewing code &amp;quot;concepts&amp;quot; in Powerpoint. But the best part was my speaker badge signed by The Elder himself! I will cherish it for years to come....(&lt;a href="http://srtsolutions.com/blogs/patricksteele/archive/2008/06/23/lansing-day-of-net-recap.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=3666" width="1" height="1"&gt;</description></item><item><title>Speaking at Lansing Day of .NET</title><link>http://srtsolutions.com/blogs/patricksteele/archive/2008/05/28/speaking-at-lansing-day-of-net.aspx</link><pubDate>Thu, 29 May 2008 02:44:21 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:3331</guid><dc:creator>psteele</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://srtsolutions.com/blogs/patricksteele/rsscomments.aspx?PostID=3331</wfw:commentRss><comments>http://srtsolutions.com/blogs/patricksteele/archive/2008/05/28/speaking-at-lansing-day-of-net.aspx#comments</comments><description>&lt;p&gt;I got an email last week informing me that my &lt;a href="http://www.castleproject.org/monorail/index.html" target="_blank"&gt;Monorail&lt;/a&gt; talk has been accepted for &lt;a href="http://www.dayofdotnet.org/Lansing/2008/Default.aspx" target="_blank"&gt;Lansing&amp;#39;s Day of .NET&lt;/a&gt; on June 21st.&amp;nbsp; Woo Hoo!!&amp;nbsp; If you check out the &lt;a href="http://www.dayofdotnet.org/Lansing/2008/Sessions.aspx" target="_blank"&gt;session list&lt;/a&gt;, you&amp;#39;ll see that &lt;a href="http://mjeaton.net/" target="_blank"&gt;Michael Eaton&lt;/a&gt; will be presenting an &lt;a href="http://www.castleproject.org/activerecord/index.html" target="_blank"&gt;ActiveRecord&lt;/a&gt; session and &lt;a href="http://jrwren.wrenfam.com/blog/" target="_blank"&gt;Jay Wren&lt;/a&gt; will be using &lt;a href="http://www.castleproject.org/container/index.html" target="_blank"&gt;Windsor Container&lt;/a&gt; for is IoC talk.&amp;nbsp; We&amp;#39;ve got just about the whole &lt;a href="http://www.castleproject.org/" target="_blank"&gt;Castle Project&lt;/a&gt; stack covered -- in one day!&amp;nbsp; And the event is totally free!&amp;nbsp; Don&amp;#39;t miss it!&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.dayofdotnet.org/Lansing/" target="_blank"&gt;&lt;img alt="Lansing Day of .Net, 21 June 2008 - I&amp;#39;ll be there!" src="http://www.dayofdotnet.org/Lansing/2008/images/ldodn-160x100inv.png" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=3331" width="1" height="1"&gt;</description></item><item><title>Ann Arbor GiveCamp</title><link>http://srtsolutions.com/blogs/patricksteele/archive/2008/05/23/ann-arbor-givecamp.aspx</link><pubDate>Fri, 23 May 2008 21:29:43 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:3262</guid><dc:creator>psteele</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://srtsolutions.com/blogs/patricksteele/rsscomments.aspx?PostID=3262</wfw:commentRss><comments>http://srtsolutions.com/blogs/patricksteele/archive/2008/05/23/ann-arbor-givecamp.aspx#comments</comments><description>&lt;p&gt;I&amp;#39;m proud to announce that we&amp;#39;ve now got a website for the &lt;a href="http://www.annarborgivecamp.org/" target="_blank"&gt;Ann Arbor Give Camp&lt;/a&gt;.&amp;nbsp; This is a great opportunity for local developers to give back to the local community.&amp;nbsp; The &lt;a href="http://www.annarborgivecamp.org/" target="_blank"&gt;website&lt;/a&gt; has all the details but here it is in a nutshell: Local charities gives us a brief overview of some development-related task they need help with (building a new website, updating an existing website, a small data collection app, etc...).&amp;nbsp; We take a bunch of local developers that have volunteered their time for a weekend and we get stuff done!&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.wearemicrosoft.com/WAM/Home.aspx" target="_blank"&gt;Dallas&lt;/a&gt; and &lt;a href="http://coders4charities.org/" target="_blank"&gt;Kansas City&lt;/a&gt; have recently done &lt;a href="http://givecamp.org/" target="_blank"&gt;Give Camps&lt;/a&gt; and they&amp;#39;ve gone over very well.&amp;nbsp; We&amp;#39;ve got a great set of folks to help organize this event: Microsoft&amp;#39;s &lt;a href="http://blogs.msdn.com/jennifer/default.aspx" target="_blank"&gt;Jennifer Marsman&lt;/a&gt;, &lt;a href="http://srtsolutions.com/blogs/billwagner/" target="_blank"&gt;Bill Wagner&lt;/a&gt;, myself, &lt;a href="http://www.dotnetrockstar.com/index.html" target="_blank"&gt;John Hopkins&lt;/a&gt; and many others.&amp;nbsp; Our timeframe is pretty short, but we&amp;#39;ve already gotten a ton of interest from local developers when we&amp;#39;ve mentioned this at user group meetings.&lt;/p&gt; &lt;p&gt;If you want to help out as a developer, go &lt;a href="http://www.annarborgivecamp.org/DevRegister.aspx" target="_blank"&gt;register at the site&lt;/a&gt;.&amp;nbsp; We&amp;#39;re looking for all types of people -- PHP, Ruby, MySql, .NET, Sql Server, Web -- not just .NET developers.&amp;nbsp; We&amp;#39;ll be holding the event at &lt;a href="http://www.wccnet.edu/" target="_blank"&gt;Washtenaw Community College&lt;/a&gt; on July 11th, 12th and 13th.&amp;nbsp; WCC is a great venue.&amp;nbsp; We&amp;#39;ve held a number of Day of .NET events there in the past and have been very happy with them.&amp;nbsp; And to show just how great WCC, &lt;strong&gt;&lt;em&gt;they&amp;#39;ve donated the space and internet access for this event!&lt;/em&gt;&lt;/strong&gt;&amp;nbsp; Awesome!&lt;/p&gt; &lt;p&gt;If you know of any charities that need help, &lt;a href="http://www.annarborgivecamp.org" target="_blank"&gt;send them over to the site&lt;/a&gt;.&amp;nbsp; Verio has already committed to providing &lt;strong&gt;free webhosting for two (2) years&lt;/strong&gt; to any charity that we help out during the Give Camp!&lt;/p&gt; &lt;p&gt;If you have any questions, &lt;a href="http://weblogs.asp.net/psteele/contact.aspx" target="_blank"&gt;drop me an email&lt;/a&gt; or check out the &lt;a href="http://www.annarborgivecamp.org" target="_blank"&gt;website&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=3262" width="1" height="1"&gt;</description></item><item><title>Come to GANG next week!</title><link>http://srtsolutions.com/blogs/patricksteele/archive/2008/05/16/come-to-gang-next-week.aspx</link><pubDate>Fri, 16 May 2008 12:54:59 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:3198</guid><dc:creator>psteele</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://srtsolutions.com/blogs/patricksteele/rsscomments.aspx?PostID=3198</wfw:commentRss><comments>http://srtsolutions.com/blogs/patricksteele/archive/2008/05/16/come-to-gang-next-week.aspx#comments</comments><description>&lt;p&gt;Next week, our local user group (&lt;a href="http://www.migang.org/" target="_blank"&gt;GANG&lt;/a&gt;) is having Jason Beres -- INETA Speaker and Director of Product Management for Infragistics -- come and talk about building applications with Silverlight 2.0.&amp;nbsp; I&amp;#39;m really looking forward to this one since I haven&amp;#39;t had time to dive into Silverlight myself.&amp;nbsp; Come on down to &lt;a href="http://www.microsoft.com/about/companyinformation/usaoffices/heartland/southfield.mspx" target="_blank"&gt;Microsoft&amp;#39;s Southfield, Michigan offices&lt;/a&gt; on Wednesday, May 21st at 6:30pm.&lt;/p&gt; &lt;p&gt;PS: Sorry about the &lt;a href="http://www.migang.org/" target="_blank"&gt;GANG website&lt;/a&gt; -- it&amp;#39;s a little plain right now.&amp;nbsp; We&amp;#39;re in the middle of re-working the website and should have the new one up before next weeks meeting.&lt;/p&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=3198" width="1" height="1"&gt;</description></item><item><title>The Elder will be back!</title><link>http://srtsolutions.com/blogs/patricksteele/archive/2008/05/14/the-elder-will-be-back.aspx</link><pubDate>Wed, 14 May 2008 16:43:19 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:3166</guid><dc:creator>psteele</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://srtsolutions.com/blogs/patricksteele/rsscomments.aspx?PostID=3166</wfw:commentRss><comments>http://srtsolutions.com/blogs/patricksteele/archive/2008/05/14/the-elder-will-be-back.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://keithelder.net/blog/Default.aspx" target="_blank"&gt;Keith Elder&lt;/a&gt; will be &lt;a href="http://feeds.feedburner.com/~r/keithelder/~3/287527204/Speaking-at-Lansing-MI-Day-of-.Net-Thanks-To-Passing.aspx" target="_blank"&gt;back in Michigan&lt;/a&gt; next month for the &lt;a href="http://www.dayofdotnet.org/" target="_blank"&gt;Lansing Day of .NET&lt;/a&gt;!&amp;nbsp; This is great news.&amp;nbsp; Keith is a great presenter and is always entertaining and informative.&amp;nbsp; I&amp;#39;ve submitted a couple of abstracts myself.&amp;nbsp; Even if I don&amp;#39;t present, I&amp;#39;ll still be there.&lt;/p&gt; &lt;p&gt;Keep watching &lt;a href="http://www.dayofdotnet.org/" target="_blank"&gt;the site&lt;/a&gt; to see what other great speaker speakers will be sharing their expertise at this FREE all-day event.&lt;/p&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=3166" width="1" height="1"&gt;</description></item><item><title>Lazy Loading/Eager Loading</title><link>http://srtsolutions.com/blogs/patricksteele/archive/2008/05/07/lazy-loading-eager-loading.aspx</link><pubDate>Wed, 07 May 2008 14:02:14 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:3082</guid><dc:creator>psteele</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://srtsolutions.com/blogs/patricksteele/rsscomments.aspx?PostID=3082</wfw:commentRss><comments>http://srtsolutions.com/blogs/patricksteele/archive/2008/05/07/lazy-loading-eager-loading.aspx#comments</comments><description>&lt;p&gt;The &lt;a href="http://blogs.hibernatingrhinos.com/nhibernate/Default.aspx" target="_blank"&gt;NHibernate FAQ&lt;/a&gt; has a &lt;a href="http://blogs.hibernatingrhinos.com/nhibernate/archive/2008/05/06/loading-a-complex-object-graph.aspx" target="_blank"&gt;new post&lt;/a&gt; about complex object graphs and lazy loading.&amp;nbsp; If you use &lt;a href="http://www.nhibernate.org/" target="_blank"&gt;NHibernate&lt;/a&gt; (or, &lt;a href="http://www.castleproject.org/activerecord/index.html" target="_blank"&gt;ActiveRecord&lt;/a&gt; -- which makes NHibernate a whole lot easier), it&amp;#39;s worth a look.&amp;nbsp; The technique described can greatly improve the way your app interacts with the database.&amp;nbsp; &lt;a href="http://en.wikipedia.org/wiki/Object-relational_mapping" target="_blank"&gt;OR mappers&lt;/a&gt; are nice, but you need to make sure you understand what is happening with the database calls that are made automatically by your OR framework.&lt;/p&gt; &lt;p&gt;If you&amp;#39;re using &lt;a href="http://www.castleproject.org/activerecord/index.html" target="_blank"&gt;ActiveRecord&lt;/a&gt;, here&amp;#39;s a few more items regarding lazy loading:&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.castleproject.org/activerecord/documentation/v1rc1/usersguide/lazy.html" target="_blank"&gt;Enabling Lazy Loading in ActiveRecord&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.castleproject.org/activerecord/documentation/trunk/advanced/tuning.html" target="_blank"&gt;Tuning ActiveRecord&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.ayende.com/Blog/archive/7627.aspx" target="_blank"&gt;Combating the Select N + 1 Problem In NHibernate&lt;/a&gt;&lt;/p&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=3082" width="1" height="1"&gt;</description></item><item><title>Navigating around in the VS.NET IDE</title><link>http://srtsolutions.com/blogs/patricksteele/archive/2008/05/05/navigating-around-in-the-vs-net-ide.aspx</link><pubDate>Mon, 05 May 2008 15:01:03 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:3073</guid><dc:creator>psteele</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://srtsolutions.com/blogs/patricksteele/rsscomments.aspx?PostID=3073</wfw:commentRss><comments>http://srtsolutions.com/blogs/patricksteele/archive/2008/05/05/navigating-around-in-the-vs-net-ide.aspx#comments</comments><description>&lt;p&gt;Last week, &lt;a href="http://srtsolutions.com/blogs/billwagner" target="_blank"&gt;Bill Wagner&lt;/a&gt; and I were providing some C# training for one of our clients.&amp;nbsp; Bill showed the class how to use F12 to jump to the definition of a method.&amp;nbsp; One of the students asked how to go back to your previous position and Bill didn&amp;#39;t know the key binding off hand.&lt;/p&gt; &lt;p&gt;As someone who comes from a VB6 background, I&amp;#39;ve maintained my VB6 keyboard mappings since I moved to C# in 2003.&amp;nbsp; Navigating around inside the VS.NET IDE has been a no-brainer for me since all of the keystrokes I used for the 7 or 8 years of VB development are the same in VS.NET -- assuming you use the VB6 keyboard layout.&lt;/p&gt; &lt;p&gt;I decided to see if C# has a default key binding to jump back to your previous positions after jumping to a method definition using F12.&amp;nbsp; First off, I wanted to see what IDE command is mapped to my &amp;quot;go back&amp;quot; function.&amp;nbsp; I pulled up the VS.NET IDE keyboard options, clicked on the &amp;quot;Press shortcut keys&amp;quot; texbox and hit the keyboard keystroke I use for jumping back to my previous position (Ctrl+Shift+F2):&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px;" height="386" alt="image" src="http://srtsolutions.com/blogs/patricksteele/WindowsLiveWriter/NavigatingaroundintheVS.NETIDE_9A61/image_6.png" width="648" border="0" /&gt; &lt;/p&gt; &lt;p&gt;Looking in the &amp;quot;Shortcut currently used by&amp;quot; field, I see &amp;quot;View.NavigateBackward&amp;quot; is the command used in the IDE to navigate back to your previous position.&amp;nbsp; Now I changed my keyboard mapping scheme to C# and entered &amp;quot;View.NavigateBackward&amp;quot; into the &amp;quot;Show commands containing&amp;quot; field:&lt;/p&gt; &lt;p&gt;&lt;img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px;" height="386" alt="image" src="http://srtsolutions.com/blogs/patricksteele/WindowsLiveWriter/NavigatingaroundintheVS.NETIDE_9A61/image_9.png" width="648" border="0" /&gt; &lt;/p&gt; &lt;p&gt;So I see control and &amp;quot;-&amp;quot; (minus) is the keystroke to jump back in C#.&amp;nbsp; I changed my IDE settings to use C# and tested this out.&amp;nbsp; Sure enough, I can use F12 to jump to a method definition and then ctrl+- to return to my previous position -- sort of like having my own little callstack within the IDE.&amp;nbsp; :)&lt;/p&gt; &lt;p&gt;And now I&amp;#39;ve changed my settings back to VB6 mapping scheme since I&amp;#39;m a creature of habit!&lt;/p&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=3073" width="1" height="1"&gt;</description></item></channel></rss>