<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>These are the lessons I learn as I scale the learning curve of software development.</description><title>Learning Curve</title><generator>Tumblr (3.0; @edchapel)</generator><link>http://edchapel.tumblr.com/</link><item><title>Hey, Shadow Ed! Good to see you again.  (Taken with Instagram at...</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_m232aosgED1qgnsoho1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Hey, Shadow Ed! Good to see you again.  (Taken with &lt;a href="http://instagr.am"&gt;Instagram&lt;/a&gt; at Lucky Labrador Beer Hall)&lt;/p&gt;</description><link>http://edchapel.tumblr.com/post/20620442929</link><guid>http://edchapel.tumblr.com/post/20620442929</guid><pubDate>Fri, 06 Apr 2012 17:31:20 -0700</pubDate></item><item><title>WCF Won't Serialize an Expression Tree</title><description>&lt;p&gt;Of course WCF won&amp;#8217;t serialize an expression tree. Why would you attempt to do that?&lt;/p&gt;

&lt;p&gt;It started post-authentication as a WCF error in Silverlight while trying to get the &lt;code&gt;User&lt;/code&gt; object using WCF RIA.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://dabblerist.com/images/cant-serialize-expression-tree/debug1.png" alt="private void AuthenticateUser()
{
   WebContext.Current.Authentication.LoadUser(ApplicationUserLoaded, null);
}"&gt;&lt;/p&gt;

&lt;p&gt;The error was cryptic:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;System.ServiceModel.DomainServices.Client.DomainOperationException: &lt;strong&gt;Load operation failed for query &amp;#8216;GetUser&amp;#8217;. The remote server returned an error: NotFound.&lt;/strong&gt; &amp;#8212;-&amp;gt; &amp;#8230;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Odd, when I debug, I can see the &lt;code&gt;User&lt;/code&gt; is returnable:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://dabblerist.com/images/cant-serialize-expression-tree/debug2.png" alt="public User GetUser()
{
    var user = ServiceContext.Wrap().User;
    return user;
}"&gt;&lt;/p&gt;

&lt;p&gt;So somewhere after I return the &lt;code&gt;User&lt;/code&gt;, WCF pukes. By turning on &amp;#8220;Break for all exceptions&amp;#8221; I get a little more detail:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Type 'WorkDrivers.Models.User+&amp;lt;GetRoles&amp;gt;d__2' cannot be serialized. 
Consider marking it with the DataContractAttribute attribute, and marking all of its members
 you want serialized with the DataMemberAttribute attribute.
 If the type is a collection, consider marking it with the CollectionDataContractAttribute. 
 See the Microsoft .NET Framework documentation for other supported types.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;WAT!? What kind of property is &lt;code&gt;WorkDrivers.Models.User+&amp;lt;GetRoles&amp;gt;d__2&lt;/code&gt;. I have a &lt;code&gt;GetRoles&lt;/code&gt; method&amp;#8230;&lt;/p&gt;

&lt;script src="https://gist.github.com/1901972.js"&gt; &lt;/script&gt;&lt;p&gt;Staring at the code didn&amp;#8217;t help. How could &lt;code&gt;GetRoles&lt;/code&gt; cause a serialization error? After a night&amp;#8217;s sleep and a cup of strong coffee, the answer yielded to me:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Roles = GetRoles(value);

private static IEnumerable&amp;lt;string&amp;gt; GetRoles(...)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I set &lt;code&gt;Roles&lt;/code&gt; to an &lt;code&gt;IEnumerable&amp;lt;string&amp;gt;&lt;/code&gt;, and not just any &lt;code&gt;IEnumerable&amp;lt;string&amp;gt;&lt;/code&gt;, a method with a bunch of &lt;code&gt;yield return&lt;/code&gt; statements inside. I was &lt;strong&gt;actually&lt;/strong&gt; setting it to an expression tree behaving as an enumerable of strings. Of course that won&amp;#8217;t be properly serialized by WCF.&lt;/p&gt;

&lt;p&gt;The fix was easy:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Roles = GetRoles(value).ToArray();
&lt;/code&gt;&lt;/pre&gt;</description><link>http://edchapel.tumblr.com/post/18193500041</link><guid>http://edchapel.tumblr.com/post/18193500041</guid><pubDate>Fri, 24 Feb 2012 09:01:28 -0800</pubDate></item><item><title>Work this week has been 2 steps forward, 1 step back. I left...</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_lxmi7nR26v1qgnsoho1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Work this week has been 2 steps forward, 1 step back. I left work Friday (Jan 6th) thinking we got a lot done only to return Monday (Jan 9th) and see much of it rejected. Finally fixed the rejections this afternoon. It’s a bit of a treadmill.&lt;/p&gt;</description><link>http://edchapel.tumblr.com/post/15663334613</link><guid>http://edchapel.tumblr.com/post/15663334613</guid><pubDate>Tue, 10 Jan 2012 23:30:59 -0800</pubDate></item><item><title>LINQ makes 3 year old C# look terrible</title><description>&lt;p&gt;I ran across this pretty nugget today:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var result = new List&amp;lt;ModifierBase&amp;gt;(serviceProcedure.ProgrammaticModifiers.Length);

foreach (ModifierBase modifierBase in serviceProcedure.ProgrammaticModifiers)
{
    result.Add(modifierBase);
}

return result;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;ReSharper helps me resolve this to:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;return serviceProcedure.ProgrammaticModifiers.ToList();
&lt;/code&gt;&lt;/pre&gt;</description><link>http://edchapel.tumblr.com/post/15311775241</link><guid>http://edchapel.tumblr.com/post/15311775241</guid><pubDate>Wed, 04 Jan 2012 14:30:02 -0800</pubDate><category>linq</category><category>coding</category><category>resharper</category></item><item><title>irondavy:

Reading @waxpancake’s story today, my biggest...</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_lna349kCOX1qzwfzfo1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;a href="http://trash.davidcole.me/post/6855156263"&gt;irondavy&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Reading &lt;a href="http://waxy.org/2011/06/kind_of_screwed/"&gt;@waxpancake’s story&lt;/a&gt; today, my biggest question was: what will the new cover be? I certainly have no association with Mr. Baio or the project, but it seemed like a nice opportunity to play with pixels in a totally different aesthetic than I normally do. So: here’s a set of exercises.&lt;/p&gt;
&lt;p&gt;(Edit: and just to be clear the top right one is a wholly original drawing! Based on around 6 photos, none from that angle.)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I like the bottom-left. Kinda looks like an arm flipping Maisel off.&lt;/p&gt;</description><link>http://edchapel.tumblr.com/post/6877123354</link><guid>http://edchapel.tumblr.com/post/6877123354</guid><pubDate>Fri, 24 Jun 2011 13:48:00 -0700</pubDate></item><item><title>Why I DI with a container</title><description>&lt;p&gt;I&amp;#8217;ve been asked to document architectural decisions made on a project I am leaving during the middle of development. I&amp;#8217;ve chosen to use an Inversion of Control container for two projects and this choice has not been enthusiastically embraced by my colleagues. One of them was chosen to inherit the IoC expertise and this reading list, sir, is for you.&lt;/p&gt;
&lt;p&gt;Here are some individuals who have shared a lot of their knowledge on the matter:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a title="Martin Fowler" href="http://martinfowler.com/articles/injection.html"&gt;Martin Fowler&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://codebetter.com/jeremymiller/author/jeremymiller/"&gt;Jeremy Miller&lt;/a&gt;, creator of &lt;a href="http://structuremap.net/structuremap/"&gt;Structure Map&lt;/a&gt; &lt;br/&gt;&lt;a href="http://codebetter.com/jeremymiller/2008/11/12/evolution-of-a-developer-in-regards-to-di-ioc/"&gt;&amp;#8220;Evolution of a Developer (in regards to DI/IoC)&amp;#8221;&lt;br/&gt;&lt;/a&gt;&lt;a href="http://codebetter.com/jeremymiller/2005/09/20/what%E2%80%99s-so-great-about-inversion-of-control/"&gt;&amp;#8220;What’s so great about Inversion of Control?&amp;#8221;&lt;br/&gt;&lt;/a&gt;&lt;a href="http://codebetter.com/jeremymiller/2008/06/29/some-concepts-to-know-first/"&gt;&amp;#8220;Before you use an IoC tool, some concepts to know first&amp;#8221;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://kohari.org/2007/08/15/defending-dependency-injection/"&gt;Nate Kohari&lt;/a&gt;, creator of &lt;a href="http://ninject.org/"&gt;Ninject&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://lostechies.com/jimmybogard/"&gt;Jimmy Bogard&lt;/a&gt;, creator of &lt;a href="http://automapper.codeplex.com/"&gt;AutoMapper&lt;/a&gt; &lt;br/&gt;&lt;a href="http://lostechies.com/jimmybogard/2010/05/20/the-religion-of-dependency-injection/"&gt;&amp;#8220;The Religion of Dependency Injection&amp;#8221;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;You&amp;#8217;ll notice that a lot of the posts are several years old. That&amp;#8217;s ok, this is not a new concept. I think this list serves as an informational indoctrination into IoC containers.&lt;/p&gt;</description><link>http://edchapel.tumblr.com/post/6749927700</link><guid>http://edchapel.tumblr.com/post/6749927700</guid><pubDate>Tue, 21 Jun 2011 00:15:59 -0700</pubDate><category>C</category><category>Ninject</category><category>Software</category></item><item><title>Spring. Sunshine. Slides. Swings. Squealing.  (Taken with...</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_llf4jgP8mt1qgnsoho1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Spring. Sunshine. Slides. Swings. Squealing.  (Taken with &lt;a href="http://instagr.am"&gt;instagram&lt;/a&gt;)&lt;/p&gt;</description><link>http://edchapel.tumblr.com/post/5623628972</link><guid>http://edchapel.tumblr.com/post/5623628972</guid><pubDate>Wed, 18 May 2011 18:09:15 -0700</pubDate></item><item><title>If you have an iPhone 4, it’s been tracking where...</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_ljzl244tzt1qgnsoho1_250.png"/&gt;&lt;br/&gt; Everywhere I've been since June 23rd&lt;br/&gt;&lt;br/&gt; &lt;img src="http://24.media.tumblr.com/tumblr_ljzl244tzt1qgnsoho2_500.png"/&gt;&lt;br/&gt; Strange trip to Las Vegas I did not make&lt;br/&gt;&lt;br/&gt; &lt;p&gt;If you have an iPhone 4, it’s been &lt;a href="http://www.wired.com/gadgetlab/2011/04/iphone-tracks/"&gt;tracking where you’ve been&lt;/a&gt;. There is a &lt;a href="http://petewarden.github.com/iPhoneTracker/"&gt;free app&lt;/a&gt;, if you have a Mac, to visualize what your iPhone has stored. Mine was mostly what I expected with an exception to a short trip to Las Vegas before I even purchased it.&lt;/p&gt;</description><link>http://edchapel.tumblr.com/post/4798933289</link><guid>http://edchapel.tumblr.com/post/4798933289</guid><pubDate>Wed, 20 Apr 2011 22:10:52 -0700</pubDate></item><item><title>Trouble</title><description>&lt;p&gt;I woke up to an email that a &amp;#8220;friend was in trouble&amp;#8221; and to please send money.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span&gt;Hi,&lt;br/&gt;&lt;br/&gt;Apologies for having to reach out to you like this, but I made a quick trip to London and had my bag stolen from me with my passport and credit cards in it. The embassy is willing to help by authorizing me to fly without my passport, I just have to pay for a ticket and settle Hotel bills. Unfortunately, I can&amp;#8217;t have access to funds without my credit card, I&amp;#8217;ve made contact with my bank but they need more time to come up with a new one. I was thinking of asking you to lend me some quick funds that I can give back as soon as I get in. I really need to be on the next available flight.&lt;br/&gt;&lt;br/&gt;I can forward you details on how you can get money to me. You can reach me via email or the hotel&amp;#8217;s help desk, 08456807390. I hope to hear from you soon.&lt;br/&gt;&lt;br/&gt;Thanks&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;span&gt;Riiiiiiiiggght&amp;#8230;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Gmail didn&amp;#8217;t warn me about this email. After someone who also got the email forwarded it to me, Gmail then did warn me. Nice warning but a little late to be useful.&lt;/p&gt;
&lt;p&gt;&lt;img height="47" width="1009" alt="Gmail warned me about a phishing email" src="http://a.yfrog.com/img640/7458/cwqg.png"/&gt;&lt;/p&gt;</description><link>http://edchapel.tumblr.com/post/4783732056</link><guid>http://edchapel.tumblr.com/post/4783732056</guid><pubDate>Wed, 20 Apr 2011 13:01:04 -0700</pubDate></item><item><title>Editing numbers in Silverlight with binding and validation</title><description>&lt;p&gt;Presenting numbers in a Silverlight user interface with editing can be difficult. Binding to WCF RIA entities and requiring validation further complicate the issue.&lt;/p&gt;
&lt;p&gt;The NumericUpDown is decent (especially when you remove the up/down tickers), but clumsily handles invalid numbers by resetting the number to the previous value. Our user&amp;#8217;s have found this confusing. A TextBox works for valid numbers, but fails miserably and silently for invalid entries.&lt;/p&gt;
&lt;p&gt;Our ideal solution&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;looks and acts like a TextBox&lt;/li&gt;
&lt;li&gt;allows invalid entries (e.g. &amp;#8216;abc&amp;#8217;, &amp;#8216;1.2.3&amp;#8217;) remain on screen&lt;/li&gt;
&lt;li&gt;enforces validation that prevents submitting to the DomainService&lt;/li&gt;
&lt;li&gt;is a declarative code pattern to apply to our entities&lt;/li&gt;
&lt;li&gt;is as DRY as possible&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Our current solution is based on 4-5 hours of tinkering. It is good enough for now since we were achieving diminishing returns on our efforts.&lt;/p&gt;
&lt;p&gt;Let&amp;#8217;s set this up. Here is a sample entity as it exists on the server:&lt;/p&gt;
&lt;p class="code"&gt;&lt;span class="Modifier"&gt;public&lt;/span&gt; &lt;span class="ReferenceType"&gt;class&lt;/span&gt; ConvictionHistory&lt;br/&gt; {&lt;br/&gt;     [Key]&lt;br/&gt;     [DatabaseGenerated(DatabaseGeneratedOption.None)]&lt;br/&gt;     &lt;span class="Modifier"&gt;public&lt;/span&gt; &lt;span class="ValueType"&gt;int&lt;/span&gt;? InterviewID { get; set; }&lt;br/&gt;&lt;br/&gt;     &lt;span class="Modifier"&gt;public&lt;/span&gt; &lt;span class="ValueType"&gt;int&lt;/span&gt;? Felonies { get; set; }&lt;br/&gt;&lt;br/&gt;     &lt;span class="Modifier"&gt;public&lt;/span&gt; &lt;span class="ValueType"&gt;int&lt;/span&gt;? Misdemeanors { get; set; }&lt;br/&gt;&lt;br/&gt;     &lt;span class="Modifier"&gt;public&lt;/span&gt; &lt;span class="ValueType"&gt;double&lt;/span&gt;? Bail { get; set; }&lt;br/&gt; }&lt;/p&gt;
&lt;p&gt;Originally, the properties were bound to TextBoxes in XAML to present to the user for editing in Silverlight:&lt;/p&gt;
&lt;p class="code"&gt;&lt;span class="Element"&gt;&amp;lt;TextBox Text=&amp;#8221;{Binding Felonies, Mode=TwoWay}&amp;#8221; /&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;When the user typed in garbage, no validation occurred and the &lt;span class="Statement"&gt;Felonies&lt;/span&gt; property remained &lt;span class="Keyword"&gt;null&lt;/span&gt;. The user had &lt;strong&gt;NO&lt;/strong&gt; idea that their value was not stored. I won&amp;#8217;t blame judge you for having no sympathy for the user that types &amp;#8216;abc&amp;#8217; as a number. Let&amp;#8217;s consider the accidental &amp;#8216;o&amp;#8217; as a &amp;#8216;0&amp;#8217; &amp;#8212; that&amp;#8217;s &amp;#8220;OH&amp;#8221; as &amp;#8220;ZERO&amp;#8221;. So we treat this as a &lt;em&gt;real&lt;/em&gt; scenario.&lt;/p&gt;
&lt;p&gt;I tried converters, behaviors, inheriting from TextBox, and even modifications to the NumericUpDown control to achieve the goals above. All failed at least one of the goals. The converter couldn&amp;#8217;t affect validation. The behavior implementation moved the problem from the entity into the behavior but validation did not occur on the entity when saving. The TextBox was cleaner than the behavior but validation still failed. The attempt using the NumericUpDown was aborted in 10 minutes.&lt;/p&gt;
&lt;p&gt;The final solution is composed of several elements.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;A couple of extension methods to stay DRY&lt;/li&gt;
&lt;li&gt;An interface to expose state and a couple methods on the entity&lt;/li&gt;
&lt;li&gt;A change to the XAML binding&lt;/li&gt;
&lt;li&gt;Implementing a code pattern on each entity that has a numeric property&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Our solution is entirely within the Silverlight client, though it could be extended to the server. The code pattern must be applied to the entity in Silverlight via a partial class.&lt;/p&gt;
&lt;p class="code"&gt;&lt;span class="Modifier"&gt;public&lt;/span&gt; &lt;span class="Modifier"&gt;partial&lt;/span&gt; &lt;span class="ReferenceType"&gt;class&lt;/span&gt; ConvictionHistory&lt;br/&gt; {&lt;br/&gt;     [RegularExpression(@&lt;span class="String"&gt;&amp;#8221;^\d*$&amp;#8221;&lt;/span&gt;, ErrorMessage = &lt;span class="String"&gt;&amp;#8220;Felonies must be a number.&amp;#8221;&lt;/span&gt;)]&lt;br/&gt;     &lt;span class="Modifier"&gt;public&lt;/span&gt; &lt;span class="ReferenceType"&gt;string&lt;/span&gt; FeloniesText&lt;br/&gt;     {&lt;br/&gt;         get { &lt;span class="Statement"&gt;return&lt;/span&gt; &lt;span class="Keyword"&gt;this&lt;/span&gt;.GetNumberAsString(_ =&amp;gt; _.Felonies); }&lt;br/&gt;         set { &lt;span class="Keyword"&gt;this&lt;/span&gt;.SetIntProperty(_ =&amp;gt; _.Felonies, value, number =&amp;gt; Felonies = number); }&lt;br/&gt;     }&lt;br/&gt;&lt;br/&gt;     [RegularExpression(@&lt;span class="String"&gt;&amp;#8221;^\d*$&amp;#8221;&lt;/span&gt;, ErrorMessage = &lt;span class="String"&gt;&amp;#8220;Misdemeanors must be a number.&amp;#8221;&lt;/span&gt;)]&lt;br/&gt;     &lt;span class="Modifier"&gt;public&lt;/span&gt; &lt;span class="ReferenceType"&gt;string&lt;/span&gt; MisdemeanorsText&lt;br/&gt;     {&lt;br/&gt;         get { &lt;span class="Statement"&gt;return&lt;/span&gt; &lt;span class="Keyword"&gt;this&lt;/span&gt;.GetNumberAsString(_ =&amp;gt; _.Misdemeanors); }&lt;br/&gt;         set { &lt;span class="Keyword"&gt;this&lt;/span&gt;.SetIntProperty(_ =&amp;gt; _.Misdemeanors, value, number =&amp;gt; Misdemeanors = number); }&lt;br/&gt;     }&lt;br/&gt;&lt;br/&gt;     [RegularExpression(@&lt;span class="String"&gt;&amp;#8221;^\d*&amp;#46;?\d*$&amp;#8221;&lt;/span&gt;,&lt;br/&gt;         ErrorMessage = &lt;span class="String"&gt;&amp;#8220;Bail must be a number.&amp;#8221;&lt;/span&gt;)]&lt;br/&gt;     &lt;span class="Modifier"&gt;public&lt;/span&gt; &lt;span class="ReferenceType"&gt;string&lt;/span&gt; BailText&lt;br/&gt;     {&lt;br/&gt;         get { &lt;span class="Statement"&gt;return&lt;/span&gt; &lt;span class="Keyword"&gt;this&lt;/span&gt;.GetNumberAsString(_ =&amp;gt; _.Bail ); }&lt;br/&gt;         set { &lt;span class="Keyword"&gt;this&lt;/span&gt;.SetDoubleProperty(_ =&amp;gt; _.Bail , value, number =&amp;gt; Bail = number); }&lt;br/&gt;     }&lt;br/&gt;&lt;br/&gt;     &lt;span class="PreProcessorDirective"&gt;#region&lt;/span&gt; Text-Number Support Code&lt;br/&gt;&lt;br/&gt;     &lt;span class="Modifier"&gt;private&lt;/span&gt; IDictionary&amp;lt;&lt;span class="ReferenceType"&gt;string&lt;/span&gt;, &lt;span class="ReferenceType"&gt;string&lt;/span&gt;&amp;gt; _textProperties;&lt;br/&gt;&lt;br/&gt;     &lt;span class="Modifier"&gt;public&lt;/span&gt; IDictionary&amp;lt;&lt;span class="ReferenceType"&gt;string&lt;/span&gt;, &lt;span class="ReferenceType"&gt;string&lt;/span&gt;&amp;gt; TextProperties&lt;br/&gt;     {&lt;br/&gt;         get&lt;br/&gt;         {&lt;br/&gt;             &lt;span class="Statement"&gt;return&lt;/span&gt; _textProperties&amp;#160;??&lt;br/&gt;                 (_textProperties = &lt;span class="Keyword"&gt;new&lt;/span&gt; Dictionary&amp;lt;&lt;span class="ReferenceType"&gt;string&lt;/span&gt;, &lt;span class="ReferenceType"&gt;string&lt;/span&gt;&amp;gt;());&lt;br/&gt;         }&lt;br/&gt;     }&lt;br/&gt;&lt;br/&gt;     &lt;span class="ValueType"&gt;void&lt;/span&gt; IExposeNumbersAsText.ValidateProperty(&lt;span class="ReferenceType"&gt;string&lt;/span&gt; propertyName, &lt;span class="ReferenceType"&gt;object&lt;/span&gt; value)&lt;br/&gt;     {&lt;br/&gt;         ValidateProperty(propertyName, value);&lt;br/&gt;     }&lt;br/&gt;&lt;br/&gt;     &lt;span class="ValueType"&gt;void&lt;/span&gt; IRaisesPropertyChangedEvent.RaisePropertyChanged(PropertyChangedEventArgs args)&lt;br/&gt;     {&lt;br/&gt;         RaisePropertyChanged(args.PropertyName);&lt;br/&gt;     }&lt;br/&gt;&lt;br/&gt;     &lt;span class="Modifier"&gt;protected&lt;/span&gt; &lt;span class="Modifier"&gt;override&lt;/span&gt; &lt;span class="ValueType"&gt;void&lt;/span&gt; OnPropertyChanged(PropertyChangedEventArgs e)&lt;br/&gt;     {&lt;br/&gt;         &lt;span class="Keyword"&gt;base&lt;/span&gt;.OnPropertyChanged(e);&lt;br/&gt;&lt;br/&gt;         &lt;span class="Statement"&gt;if&lt;/span&gt; (TextProperties.ContainsKey(e.PropertyName))&lt;br/&gt;         {&lt;br/&gt;             RaisePropertyChanged(e.PropertyName + &lt;span class="String"&gt;&amp;#8220;Text&amp;#8221;&lt;/span&gt;);&lt;br/&gt;         }&lt;br/&gt;     }&lt;br/&gt;&lt;br/&gt;     &lt;span class="PreProcessorDirective"&gt;#endregion&lt;/span&gt;&lt;br/&gt; }&lt;/p&gt;
&lt;p&gt;Essentially you copy &amp;#8220;Text-Number Support Code&amp;#8221; region into your partial. By convention, you create a string property for each of your numeric properties and use the &amp;#8220;Text&amp;#8221; suffix.&lt;/p&gt;
&lt;p&gt;The XAML binding changes as well to improve the validation experience.&lt;/p&gt;
&lt;p class="code"&gt;&lt;span class="Element"&gt;&amp;lt;TextBox Text=&amp;#8221;{Binding FeloniesText, Mode=TwoWay, ValidatesOnExceptions=True}&amp;#8221; /&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Now we get the user experience we were looking for. Let&amp;#8217;s see how well we did against our goals:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;looks and acts like a TextBox&lt;br/&gt;&lt;strong&gt;Yes&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;allows invalid entries (e.g. &amp;#8216;abc&amp;#8217;, &amp;#8216;1.2.3&amp;#8217;) remain on screen&lt;br/&gt;&lt;strong&gt;Yes&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;enforces validation that prevents submitting to the DomainService&lt;br/&gt;&lt;strong&gt;Yes, because we use the RegularExpression attribute &lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;is a declarative code pattern to apply to our entities&lt;br/&gt;&lt;strong&gt;Mostly, though it uses the &amp;#8220;Text&amp;#8221; convention for property names&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;is as DRY as possible&lt;br/&gt;&lt;strong&gt;This solution falls short here. Each entity would need to duplicate about 30 lines of code and whitespace.&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;The solution isn&amp;#8217;t perfect and is not extremely intuitive or self-documenting. But it&amp;#8217;s good enough for this project.&lt;/p&gt;
&lt;p&gt;The extension methods and other code can be found at &lt;a target="_blank" href="https://gist.github.com/929974"&gt;&lt;a href="https://gist.github.com/929974"&gt;https://gist.github.com/929974&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://edchapel.tumblr.com/post/4759954989</link><guid>http://edchapel.tumblr.com/post/4759954989</guid><pubDate>Tue, 19 Apr 2011 16:27:18 -0700</pubDate><category>silverlight,</category><category>wcf ria services</category><category>coding</category></item><item><title>Why we left Team Foundation Server</title><description>&lt;p&gt;We didn&amp;#8217;t just leave TFS, we chose Subversion, TeamCity, and PivotalTracker. But leave TFS we did, and in a hurry. And mostly it was due to TFS 2010.&lt;/p&gt;
&lt;h3&gt;Background&lt;/h3&gt;
&lt;p&gt;My organization is a large government entity with many lines of business. Our team is about 18 people (FTE, contractors, managers), we focus on just 3 lines of business and create applications for (mostly) internal users. We&amp;#8217;ve been a &amp;#8220;.NET shop&amp;#8221; for 10 years; one of the central apps was originally written in .NET 1.0 beta. VSS and, later, Team Foundation Server 2008 have acted as the SCM solution for as long as anyone remembers. We&amp;#8217;ve adopted many agile practices and are currently developing with .NET 4.0, Silverlight 4, MVC 3, and Entity Framework; in other words, today we aren&amp;#8217;t a stereotypical enterprise/government IT organization.&lt;/p&gt;
&lt;p&gt;When I joined in 2009, the team was well-entrenched in TFS 2008; it served as source control, build server, project management platform, and bug tracker. I came from years of SVN and, though TFS is awkward, it wasn&amp;#8217;t all bad. The Visual Studio integration is pretty solid and this is probably the most important factor for us. Because some of the team moved into .NET from MS Access and VBA, the level of familiarity with anything not Microsoft was low. TFS worked well for them and well enough for everyone else.&lt;/p&gt;
&lt;h3&gt;The Foundation Crumbles&lt;/h3&gt;
&lt;p&gt;We were eager to jump to TFS 2010 to resolve a few of our issues with TFS 2008: improved process templates, better source control performance, better integration with Visual Studio 2010 compared to VS2008, and improved build server. After a month or so breaking in our new TFS 2010 installation, we found most of these issues were improved to our satisfaction.&lt;/p&gt;
&lt;p&gt;Strangely, we found the TFS build server had become unusable. After two weeks attempting to replicate what we had in TFS 2008, we gave up. The Windows Workflow Designer is as &amp;#8220;simple&amp;#8221; as advertised, but not the kind of simple we wanted. We&amp;#8217;d become skilled at customizing the MSBuild scripts and creating MSBuild task assemblies to accomplish our one-click build/test/deployment process. This seems to have been lost in TFS 2010. We were left with an awkward, mouse-driven UI and the extensibility was built around snippets of VB.NET. It is completely unintuitive and simply awful. If TFS 2010 could support the customization we wanted, we didn&amp;#8217;t have time left to discover how exactly to do it.&lt;/p&gt;
&lt;p&gt;TFS had always been good enough and once accepted created a disincentive to puling up the stakes and moving on. If given the chance to choose just one element of the TFS ecosystem &amp;#8212; source control, project management, build server, bug tracker, or Visual Studio integration &amp;#8212; the only one our team would settle on was the VS integration. Carrying the other four elements just for a GUI-based source control is unbearable.&lt;/p&gt;
&lt;p&gt;The manager take on TFS was the &amp;#8220;tight integration&amp;#8221; and &amp;#8220;complete package&amp;#8221;. The resulting product is focused more on integration of all parts rather than doing any one thing well. Look at many of the .NET teams within Microsoft and you&amp;#8217;ll find many not using TFS. That was enough for our manager to allow us to consider alternatives.&lt;/p&gt;
&lt;h3&gt;Picking What Works&lt;/h3&gt;
&lt;p&gt;Our approach was to pick solutions that best fit our team&amp;#8217;s culture and environment. Cost was not an issue but we intended to spend less than we did on TFS. Our selections:&lt;/p&gt;
&lt;p&gt;Source Control: &lt;strong&gt;Subversion from VisualSVN&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Subversion met the &lt;a title="Goldilocks Principle" target="_blank" href="http://en.wikipedia.org/wiki/Goldilocks_Principle"&gt;Goldilocks Principle&lt;/a&gt; for our team. TFS was far to little and Git/Mercurial are too much. With the &lt;a title="VisualSVN Server" target="_blank" href="http://www.visualsvn.com/server/"&gt;VisualSVN Server&lt;/a&gt;, we get an installation suitable for a Windows 2008 server with integrated Windows authentication, an enterprise requirement. The critical GUI integration is accomplished with the &lt;a title="VisualSVN plug-in" target="_blank" href="http://www.visualsvn.com/visualsvn/"&gt;VisualSVN Visual Studio plug-in&lt;/a&gt; that integrates Subversion and TortoiseSVN seamlessly with Visual Studio. While Git and Mercurial are next generation SCMs, they seem to require more expertise and awareness with source control than our team, as a whole, is able to commit to.&lt;/p&gt;
&lt;p&gt;Build Server: &lt;strong&gt;TeamCity&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;TeamCity came with many positive reviews and personal testimony from my own friends. I have used CruiseControl.NET for a few projects and while it far surpasses TFS, there was always friction as you added more projects. Hearing &lt;a target="_blank" href="https://twitter.com/#!/johnhoerr"&gt;John Hoerr&lt;/a&gt; talk about the transition from CC.NET to TeamCity and the ease of creating a build-per-branch sold me. TeamCity feels like the next evolution of the continuous integration server and our experience has shown this to be true. We had 12 active builds in TFS after 3 years and now have well over 20 on TeamCity after a few months. There is Visual Studio integration and integrated Windows authentication on the server.&lt;/p&gt;
&lt;p&gt;Project Management: &lt;strong&gt;PivotalTracker&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;About a year ago, &lt;a target="_blank" href="https://twitter.com/#!/obie"&gt;Obie Fernandez&lt;/a&gt; tweeted a chart from &lt;a target="_blank" href="https://www.pivotaltracker.com"&gt;PivotalTracker&lt;/a&gt; showing the current progress of a project, similar to the image below. The ability to express the status of a project in one graphic does more for our project sponsors than heaps of spreadsheets out of TFS ever did.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_lit38pGlIK1qfs6qp.png"/&gt;&lt;/p&gt;
&lt;p&gt;We found PT fit very well with the agile approach within one line of business. For a year we had some projects within TFS and others in PT. TFS is a far superior project management tool because of the breadth of information it can capture. PivotalTracker is the best &amp;#8220;customer expectation management&amp;#8221; tool. Our project sponsor can see and touch PT whereas TFS was a dev only tool. This has lead to happier customers who are grateful for the transparency. I don&amp;#8217;t think the projects have gone faster or smoother, but the customer perception has dramatically improved. And &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Reality#Reality.2C_world_views.2C_and_theories_of_reality"&gt;perception is reality&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Bug Tracker: &lt;strong&gt;PivotalTracker/Trac&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;PivotalTracker works great for about 10-15 bugs before the overload of bugs overwhelms the PT interface. We&amp;#8217;ve decided that having 15 bugs in any project in active development means you are doing it wrong. We avoid bugs by discussing our features with the entire team (PM, BA, Dev, QA, and customer) before setting to work. Before &amp;#8220;Finishing&amp;#8221; a feature, QA usually takes a quick look. Most &amp;#8220;bug reports&amp;#8221; come from a QA dev in the chair next to me while we talk over a feature before I commit the changes to source control. In the last 18 months, we&amp;#8217;ve had less than 15 bugs come from the four applications deployed to production in that period. If we ever encounter a bug-rich project, we have Trac on hand to handle the overload.&lt;/p&gt;
&lt;h3&gt;Conclusions&lt;/h3&gt;
&lt;p&gt;After 3 months in our new ecosystem, there are few complaints. In a way, we are thankful the TFS 2010 build server is so terrible as it served as the catalyst to our changes. We now have the best, or near-best, tools in each class.&lt;/p&gt;
&lt;p&gt;The most difficult transitions were more cultural than technical. We&amp;#8217;ve adapted slightly to the idiosyncrasies of the tools and changes to process. In the end, choose the tools that meet your needs for your team.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Easier build configuration and cloning in TeamCity&lt;/li&gt;
&lt;li&gt;Better failure logging and detecting when a build fails&lt;/li&gt;
&lt;li&gt;PivotalTracker is a better customer expectation management tool&lt;/li&gt;
&lt;li&gt;Subversion got us away from the check-out-before-editing workflow&lt;/li&gt;
&lt;li&gt;Less time creating detailed specifications and tracking time within the TFS process template; these data were never analyzed&lt;/li&gt;
&lt;li&gt;Visual Studio no longer hangs while opening files to edit since TFS is no longer asking permission to edit the file every time&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;TortoiseSVN has been buggy on a few machines causing updates to fail&lt;/li&gt;
&lt;li&gt;Commits and bugs are not linked to the feature or bug in PivotalTracker&lt;/li&gt;
&lt;li&gt;Multiple vendors and update schedules lead to frequent upgrades&lt;/li&gt;
&lt;/ul&gt;</description><link>http://edchapel.tumblr.com/post/4180369020</link><guid>http://edchapel.tumblr.com/post/4180369020</guid><pubDate>Tue, 29 Mar 2011 00:28:00 -0700</pubDate><category>.NET</category><category>process</category></item><item><title>Apparently MSDN documentation now indicates which .NET members...</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_lgd47fD0cr1qgnsoho1_250.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Apparently MSDN documentation now indicates which .NET members are supported by Xbox 360.&lt;/p&gt;</description><link>http://edchapel.tumblr.com/post/3201149236</link><guid>http://edchapel.tumblr.com/post/3201149236</guid><pubDate>Wed, 09 Feb 2011 10:18:51 -0800</pubDate></item><item><title>Could not load file or assembly</title><description>&lt;p&gt;I&amp;#8217;m working MVC/Razor into an ancient WebForms web application. In addition, I&amp;#8217;m converting it from IIS Classic pipeline into an Integrated pipeline. This is far from trivial. Here is an error I ran into:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span&gt;
&lt;h2&gt;&lt;em&gt;Could not load file or assembly &amp;#8216;System.Web, Version=4.0.0.0,  Culture=neutral, PublicKeyToken=31bf3856ad364e35&amp;#8217; or one of its dependencies.  The system cannot find the file specified.&lt;/em&gt;&lt;/h2&gt;
&lt;/span&gt;&lt;strong&gt;Description: &lt;/strong&gt;An unhandled exception occurred during the execution of the current web  request. Please review the stack trace for more information about the error and  where it originated in the code. &lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Exception Details: &lt;/strong&gt;System.IO.FileNotFoundException: Could not load file or assembly  &amp;#8216;System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35&amp;#8217;  or one of its dependencies. The system cannot find the file  specified.&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Source Error:&lt;/strong&gt; &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Assembly Load Trace:&lt;/strong&gt; The following  information can be helpful to determine why the assembly &amp;#8216;System.Web,  Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35&amp;#8217; could not be  loaded.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Stack Trace:&lt;/strong&gt; &lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;code&gt;An unhandled exception was generated during the execution of the  current web request. Information regarding the origin and location of the  exception can be identified using the exception stack trace below.&lt;/code&gt; &lt;code&gt;
&lt;pre&gt;WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
&lt;/pre&gt;
&lt;/code&gt; &lt;code&gt;
&lt;pre&gt;[FileNotFoundException: Could not load file or assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
   System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, Boolean loadTypeFromPartialName, ObjectHandleOnStack type) +0
   System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark&amp;amp; stackMark, Boolean loadTypeFromPartialName) +314
   System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +95
   System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +124
   System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +76

[ConfigurationErrorsException: Could not load file or assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
   System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +11360476
   System.Web.Configuration.Common.ModulesEntry.SecureGetType(String typeName, String propertyName, ConfigurationElement configElement) +69
   System.Web.Configuration.Common.ModulesEntry..ctor(String name, String typeName, String propertyName, ConfigurationElement configElement) +62
   System.Web.HttpApplication.BuildIntegratedModuleCollection(List`1 moduleList) +301
   System.Web.HttpApplication.GetModuleCollection(IntPtr appContext) +1332
   Microsoft.Web.Infrastructure.DynamicModuleHelper.CriticalStatics.Init(HttpApplication context) +302
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +546
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +325
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375

[HttpException (0x80004005): Could not load file or assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11529440
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4783925
&lt;/pre&gt;
&lt;/code&gt;&lt;/blockquote&gt;
&lt;p&gt;It&amp;#8217;s subtle, but this is the offending XML in the web.config:&lt;/p&gt;

&lt;script src="https://gist.github.com/817360.js?file=gistfile1.xml"&gt;&lt;/script&gt;&lt;p&gt;Here is the correct XML:&lt;/p&gt;

&lt;script src="https://gist.github.com/817445.js?file=gistfile1.xml"&gt;&lt;/script&gt;</description><link>http://edchapel.tumblr.com/post/3187560588</link><guid>http://edchapel.tumblr.com/post/3187560588</guid><pubDate>Tue, 08 Feb 2011 14:46:53 -0800</pubDate></item><item><title>Of my Google Alerts, the one for my name is the least...</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_leunbvhw0Z1qgnsoho1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Of my Google Alerts, the one for my name is the least interesting. The most frequent result is the publishing of a new book.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span&gt;North Carolina Life Sketches 1st &lt;strong&gt;ed Chapel&lt;/strong&gt; Hill in the Books&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://edchapel.tumblr.com/post/2713004244</link><guid>http://edchapel.tumblr.com/post/2713004244</guid><pubDate>Wed, 12 Jan 2011 06:00:06 -0800</pubDate></item><item><title>Apple AirPlay from the iPhone as Intercom</title><description>&lt;p&gt;We have an Airport Express upstairs in the bathroom that we use to listen to music or radio streaming from an iPhone while we get ready in the morning. This weekend, I was watching football on the couch while my wife was upstairs giving a bath to my 4 year old. I needed to let them know a friend was coming over in 15 minutes.&lt;/p&gt;
&lt;p&gt;It&amp;#8217;s only 20 steps up the stairs from the couch. I&amp;#8217;ve counted. But I&amp;#8217;m &lt;strike&gt;lazy&lt;/strike&gt; efficient. I gotta be able to use AirPlay&amp;#8230; right?&lt;/p&gt;
&lt;p&gt;I started with the Voice Recorder and recorded the message. Unfortunately, the AirPlay icon never popped up while I was playing the audio. After emailing myself, the iOS email client stalled downloading the attachment. I used Safari to get to the email in gmail and played the m4a. That worked.&lt;/p&gt;
&lt;p&gt;I had to run upstairs immediately to make sure it worked. It was only 20 steps.&lt;/p&gt;</description><link>http://edchapel.tumblr.com/post/2695439724</link><guid>http://edchapel.tumblr.com/post/2695439724</guid><pubDate>Mon, 10 Jan 2011 23:13:00 -0800</pubDate></item></channel></rss>
