tag:blogger.com,1999:blog-91679811967297844882024-03-12T20:23:35.519-05:00Welcome to My Nerditoriumdaugerhttp://www.blogger.com/profile/12756737682194998551noreply@blogger.comBlogger51125tag:blogger.com,1999:blog-9167981196729784488.post-88957845144439686972013-01-09T23:24:00.001-06:002013-03-09T21:12:11.865-06:00This Blog Has MovedI've revamped this blog at a new location. Please visit it at:<br />
<a href="http://nerditorium.danielauger.com/">http://nerditorium.danielauger.com</a><br />
<br />
I will eventually move posts from this blog over to the new one, and hopefully figure out some sort of way to do redirects for the more popular posts.daugerhttp://www.blogger.com/profile/12756737682194998551noreply@blogger.com0tag:blogger.com,1999:blog-9167981196729784488.post-54588662061069652232011-11-30T22:42:00.001-06:002013-03-09T23:46:14.583-06:00Your ASP.NET.* Project is Not Just Your UI Layer<script language="JavaScript">
if (document.URL.indexOf("your-aspnet-project-is-not-just-your-ui") !== -1)
{
window.location.href = "http://nerditorium.danielauger.com/blog/2011/11/30/your-asp-dot-net-dot-star-project-is-not-just-your-ui-layer/";
}
</script><br />
<br />
In <a href="http://lostechies.com/jimmybogard/2011/11/28/dealing-with-transactions/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+LosTechies+%28LosTechies%29">this</a> post by Jimmy Bogard about “dealing with non-transactional operations that must happen if some transaction succeeds,” the often embraced, but sometimes criticized, <a href="https://www.google.com/search?gcx=c&sourceid=chrome&ie=UTF-8&q=session+per+request">Session Per Request</a> pattern (aka Transaction Per Request), came under fire in the comments.<br />
<a href="http://lh4.ggpht.com/-jST-nPyEIPg/TtcFxTOTGJI/AAAAAAAAAN4/YhWV3Dhp_4U/s1600-h/image%25255B10%25255D.png"><img alt="image" border="0" height="782" src="http://lh3.ggpht.com/-aJBrablBtSQ/TtcFyK-vZ3I/AAAAAAAAAOA/FsjBWVGEHoc/image_thumb%25255B6%25255D.png?imgmax=800" style="background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="620" /></a><br />
I’ve had this conversation with other developers who have raised similar concerns before, and the reason brought up against going with this pattern is based off of the notion that the “Web” project must not orchestrate or indirectly know about the other layers of the application because it is the “UI” layer.<br />
The fact is, that the web project houses two conceptual layers:<br />
<ol><li>It houses the UI layer for the application.</li>
<li>It houses the entry point / bootstrapping for the infrastructure of the application. It is the application.</li>
</ol>I am perfectly fine with the plumbing of the web project directly managing transactions. Some part of the application must manage this, and I a believe that the it should be pushed as far out to the seams of the application platform as possible. daugerhttp://www.blogger.com/profile/12756737682194998551noreply@blogger.com0tag:blogger.com,1999:blog-9167981196729784488.post-8619213720442446162011-08-08T20:06:00.004-05:002013-03-09T21:12:45.540-06:00All Paths to a Sitefinity Image are not Equal<script language="JavaScript">
if (document.URL.indexOf("all-paths-to-sitefinity-image-are-not") !== -1)
{
window.location.href = "http://nerditorium.danielauger.com/blog/2011/08/08/all-paths-to-a-sitefinity-image-are-not-equal/";
}
</script><br />
<br />
<p>Recently, while doing a performance pass through a Sitefinity 4 application, I noticed that a public facing page had an unusually slow load time. Of course, the first thing I did was open up Firebug to see where the time was being spent. To my surprise, the majority of the time was spent waiting for the initial response from the server. After a little digging, I narrowed down the time-sink to a custom widget that pulled images from a Sitefinity image album. In particular, the query to figure out which images to display was the source of slothness.</p><p>A few things to note:</p><ul><li>There were about 250 image albums in the CMS (all but 5 or so of them were empty at the time of discovery, however). </li>
<li>There were roughly 30 images in the album we were querying against. </li>
<li>When the original query was written, there were only a few images in the system, and that is why the issue wasn’t apparent right when the query was written. </li>
</ul><p>Here’s an approximation of the original call to retrieve the images through the Sitefinity API:</p><div><script src="https://gist.github.com/1133189.js?file=gistfile1.cs"></script></div><p>In this bit of code, we are querying for all images that belong to the image album named “Foo”. Note that the query is structured in a way where we query through the image object to determine what album it belongs to.</p><p>The above query took about 2 seconds to return roughly 30 Sitefinity Image objects. This would not do. Therefore, I took to tweaking the query. I tried several different things while maintaining the original approach, but since Sitefinity’s LINQ provider isn’t a complete implementation, I couldn’t make much headway.</p><p>I eventually decided to rethink the approach and query for the images by going in through the album instead of going through the image object. </p><div><script src="https://gist.github.com/1133244.js?file=gistfile1.cs"></script></div><p>This reduced the query time down to about .2 seconds.</p>daugerhttp://www.blogger.com/profile/12756737682194998551noreply@blogger.com0tag:blogger.com,1999:blog-9167981196729784488.post-19625941064336357312011-05-15T19:36:00.002-05:002013-03-09T21:13:03.339-06:00Matt Chat–The YouTube Channel You Should be Watching if You Played Video Games in the 80s or 90s<script language="JavaScript">
if (document.URL.indexOf("matt-chatthe-youtube-channel-you-should") !== -1)
{
window.location.href = "http://nerditorium.danielauger.com/blog/2011/05/15/matt-chat-the-youtube-channel-you-should-be-watching-if-you-played-video-games-in-the-80s-or-90s/";
}
</script><br />
<br />
<a href="http://lh5.ggpht.com/_q7jyIQc7ftY/TdBxmiqC3iI/AAAAAAAAALg/aH92h50kcrU/s1600-h/mattChat%5B2%5D.jpg"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="mattChat" border="0" alt="mattChat" align="right" src="http://lh5.ggpht.com/_q7jyIQc7ftY/TdBxm6aFWyI/AAAAAAAAALk/rp0UTDFeOAg/mattChat_thumb.jpg?imgmax=800" width="92" height="92" /></a> <p>Nerd service announcement:</p><p>If you played video games in the 80s and/or 90s and have never heard of, or watched <a href="http://www.youtube.com/user/blacklily8">Matt Chat</a>, you you are in for a treat. One of my friends aptly described it as, “Behind the Music for vintage video games.” </p><p>Matt Barton (College Professor and Author) debuted <a href="http://www.youtube.com/user/blacklily8">Matt Chat</a> in February 2009 with a low-production-quality, but loving, retrospective of SSI’s classic AD&D CRPG, “Pool of Radiance.” Since then, Matt has produced an additional 100 episodes, and has made leaps-and-bounds in production value. In addition to his editorial retrospectives, Matt began doing interviews with game developers around episode 40. </p><p>To whet your appetite, here is a <a href="http://eab.abime.net/showthread.php?t=59007">listing</a> of the first 101 episodes of <a href="http://www.youtube.com/user/blacklily8">Matt Chat</a> :</p><p>1: Pool of Radiance <br />
2: Myst <br />
3: Defender of the Crown <br />
4: M.U.L.E. <br />
5: Elite <br />
7: The Sims <br />
8: The Secret of Monkey Island <br />
9: The Oregon Trail <br />
10: Lemmings <br />
11: Civilization <br />
12: Metroid <br />
13: Adventure <br />
14: The Lost Vikings <br />
15: The PLATO Computer System <br />
16: Lode Runner <br />
17: Ultima VII, The Black Gate <br />
18: Summer Games <br />
19: Gauntlet <br />
20: Worms and Artillery Games <br />
21: Super Mario Kart <br />
22: Deja Vu, Uninvited, Shadowgate, and MacVentures <br />
23: Planescape Torment <br />
24: Star Control II and the Spacewar Legacy <br />
25: Knights of the Old Republic <br />
26: David Crane's Ghostbusters <br />
27: Autoduel <br />
28: Maniac Mansion <br />
29: Wizardry <br />
30: Fallout <br />
31: A Rockstar Ate My Hamster <br />
32: Tomb Raider <br />
33: Jade Empire <br />
34: System Shock 2 <br />
35: Alone in the Dark <br />
36: Starcraft <br />
37: Syndicate <br />
38: Legacy of the Ancients <br />
39: World of Warcraft Part One <br />
39: World of Warcraft Part Two <br />
40: Sword of Fargoal with Jeff McCord <br />
41: The History of Cinemaware with Bob Jacob <br />
42: Dragon Age Origins <br />
43: Archon <br />
44: Ralph Baer, the Father of Videogames <br />
45: Rogue <br />
46: Choose Your Own Adventure with R.A. Montgomery <br />
47: Quest for Glory <br />
48: Dungeons of Daggorath <br />
49: Nancy Drew featuring Jessica Chiang <br />
50 Part 1: Leisure Suit Larry featuring Al Lowe <br />
50 Part 2: Leisure Suit Larry featuring Al Lowe <br />
51: Interview with John Romero (Early Days) <br />
52: Wolfenstein 3D with John Romero <br />
53: Doom with John Romero <br />
54: Quake with John Romero <br />
55: Daikatana with John Romero <br />
56: Ocarina of Time <br />
57: Tunnels of Doom <br />
58: Heroes of Might and Magic <br />
59: The Settlers <br />
60: X-COM, UFO Defense <br />
61: Sid Meier's Pirates <br />
62: Chris Avellone's Early Days <br />
63: Planescape Torment with Chris Avellone <br />
64: Sean Cooper's Early Days <br />
65: Syndicate with Sean Cooper <br />
66: Fallout with Tim Cain, Pt. 1 <br />
67: Fallout with Tim Cain Pt. 2 <br />
68: Arcanum and More with Tim Cain <br />
69: Howard Scott Warshaw's Early Days <br />
70: ET and Yar's Revenge with Howard Scott Warshaw <br />
71: The Bard's Tale <br />
72: Deus Ex <br />
73: The Dig <br />
74: Dune II <br />
75: Interview with Megan Gaiser and Rob Riedl of Her Interactive <br />
76: King's Quest <br />
77: Darklands <br />
78: Arnold Hendrick Interview Pt. 1 <br />
78: Interview with Arnold Hendrick Pt. 2 <br />
78: Interview with Arnold Hendrick Pt. 3 <br />
79: Scott Adams' Early Days <br />
80: Adventureland with Scott Adams <br />
81: Questprobe and More with Scott Adams <br />
82: Interview with Rebecca "Burger" Heineman Pt. 1 <br />
83: Rebecca Heineman Pt. 2 <br />
84: Rebecca Heineman Pt. 3 <br />
85: Rebecca Heineman Pt. 4 <br />
86: Bard's Tale IV and Wasteland II with Rebecca Heineman <br />
87: Twilight Scene it with Don Kurtz (censored) <br />
88: The Donimator Gets His <br />
89: Bard's Tale and Wizardry with Brian Fargo <br />
90: Wasteland and Fallout with Brian Fargo <br />
91: The Fall of Interplay with Brian Fargo <br />
92: Mail Order Monsters <br />
93: Scratches and Asylum with Agustín Cordes <br />
94: Interview with Agustín Cordes Pt. 2 <br />
95: Skylanders and more with Paul Reiche and Fred Ford <br />
96: Star Control and More with Paul Reiche and Fred Ford <br />
97: The Horde and More with Fred Ford and Paul Reiche <br />
98: Scott Miller Interview Pt. 1 <br />
99: Duke Nukem with Scott Miller <br />
100: Scott Miller will Live Forever <br />
101: Baldur's Gate</p>daugerhttp://www.blogger.com/profile/12756737682194998551noreply@blogger.com0tag:blogger.com,1999:blog-9167981196729784488.post-43332101202460199262011-04-12T18:49:00.001-05:002013-03-09T21:13:29.314-06:00My Sister Always Said I’d Turn Out to be a Nerd<p><a href="http://lh6.ggpht.com/_q7jyIQc7ftY/TaTk_ckA4JI/AAAAAAAAALI/1Mw74GkfMTU/s1600-h/smokingNerd%5B2%5D.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px; padding-top: 0px" title="smokingNerd" border="0" alt="smokingNerd" align="right" src="http://lh4.ggpht.com/_q7jyIQc7ftY/TaTk_uJ9dsI/AAAAAAAAALM/IibDIViYlkY/smokingNerd_thumb.jpg?imgmax=800" width="244" height="186" /></a>Today was a good day. As <a href="http://mynerditorium.blogspot.com/2011/02/moving-on.html">mentioned</a> <a href="http://mynerditorium.blogspot.com/2011/03/full-stack-interview-coding-challenges.html">previously</a>, I’ve been looking for a new career opportunity for the past month-and-a-half or so. My journey came to a head yesterday when I received two fantastic job offers. I’m happy to report that I have accepted an offer to join  <br />
<a href="http://www.nerdery.com/">the Nerdery</a> as a Software Engineer. I’m looking forward to working with this group of people who are way smarter than I am, and for the chance to grow with this unique company.</p><p>Additionally, I’ve been reflecting on the overall job search experience. I am very aware of how lucky I am to have rubbed shoulders with many insanely smart and experienced professionals. I really appreciate the time everyone took to meet with me. Life is good.</p>daugerhttp://www.blogger.com/profile/12756737682194998551noreply@blogger.com1tag:blogger.com,1999:blog-9167981196729784488.post-5793922706829918572011-03-25T15:23:00.001-05:002013-03-09T21:13:57.202-06:00Full Stack Interview Coding Challenges<p><a href="http://lh3.ggpht.com/_q7jyIQc7ftY/TYz5pDkKmEI/AAAAAAAAALA/lBPjdkKerno/s1600-h/Challenge%20Accepted%5B3%5D.jpg"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="Challenge Accepted" border="0" alt="Challenge Accepted" align="right" src="http://lh6.ggpht.com/_q7jyIQc7ftY/TYz5phRfk0I/AAAAAAAAALE/GofCG35o9pI/Challenge%20Accepted_thumb%5B1%5D.jpg?imgmax=800" width="244" height="94" /></a>It’s been seven years since I was last looking for a job, so I’m not sure if this is a new trend or not: Over half the companies I’ve started the interview process with have given me time-unlimited full-stack coding challenges as part of the interview process. I just completed my third one in two weeks and I thought I’d share my thoughts about this practice in general.</p><h4>Challenge Requirements <br />
<font size="2"><font style="font-weight: normal">Here are highly condensed versions of the requirements for each challenge:</font></font></h4><p><strong>Company A:</strong></p><ol><li>Create an ASP.NET MVC application that consists of one page that allows users to add, remove, and rate movies. Movie ratings are to be indicated with a star rating control similar to what Netflix uses.</li>
<li> <div align="left">Create a Javascript widget that a user can host on their blog which pulls and displays their movie ratings from the application.</div></li>
</ol><p align="left"><strong>Company B:</strong></p><p align="left">Create an ASP.NET MVC website that allows users to upload and view images. If the image is more than 500 pixels wide, or 700 pixels tall, downsize the image to the maximum allowed size, but maintain the aspect ratio. All images should be stored on the server, including the original image when images are resized.</p><p align="left"><strong>Company C:</strong></p><p align="left">Create an ASP.NET application (Webforms or MVC) that allows users to add and vote on Xbox game titles for the company break room. Users can only vote once a day, and they cannot vote on the weekends. Any user can mark a game as owned, in which case it ends up on a list of owned games. The titles and votes will be stored / retrieved via a set of WCF services that are provided for you. In addition to sending the code in for review, submit a URL to a running copy of the application.</p><h4></h4><h4>What I Liked About the Process</h4><p>First off, I really liked that these companies wanted to see code. I think far too many places hire developers without seeing a line of code. True, you can determine what somebody is capable of through conversation (especially at senior / expert levels), but I think it’s a pretty big risk. Some people are really good at talking, and / or look good on paper when in truth they don’t know what they are doing.</p><p>Secondly, I really enjoyed doing these challenges. They’ve helped me from getting rusty during this period of unemployment. Additionally, I had to learn at least one thing for each of the applications. For company A’s challenge, I had to learn how to create a widget that used <a href="http://en.wikipedia.org/wiki/JSONP">JSONP</a>. For company B’s challenge I had to learn to resize an image while keeping its aspect ratio using only the core .NET framework. For company C’s challenge, I learned how to use the <a href="http://mvccontrib.codeplex.com/">MVCContrib</a> Grid and the <a href="http://www.datatables.net/">jquery.dataTable</a> plugin. I also learned and used <a href="http://appharbor.com/">AppHarbor</a> to host the application.</p><h4>What I didn’t Like or was Uncomfortable With During the Process</h4><p>Finding time to do all three of these within a couple of weeks was a little rough. I did find the time, but part of me was wondering if the companies were wondering why I hadn’t turned the challenge in yet. In reality they didn’t know that I was working on three of them simultaneously. This is something I probably should have communicated to them. <br />
<br />
The thing I was most uncomfortable with was that I felt like I had more than enough rope to hang myself with in terms of doing things that weren’t wrong per say, but that the reviewer might frown upon due to personal taste. One thing that I was really torn on was how C# 2/3/4 idiomatic I should make my code. Taking advantage of generics, lambdas, linq, anonymous types, etc… could cause the code to look like gibberish to the reviewer if he or she is still writing code in C#1 style. On the flip side, I felt that I would look like I was stuck in the past if I didn’t write modern C#. I’m not sure that finding the middle ground is the right thing to do in this case either as it could look inconsistent. <br />
<br />
Along the same lines, I found it very difficult to decide on the right level of architectural complexity to use. These apps were all a bit more than trivial, so I could have gone either way with the complexity. As with idiomatic C#, I found myself wondering if the reviewer was going to think I was oversimplifying or overcomplicating things. Additionally the reviewer may actually want me to overcomplicated things a bit to show what architectural patterns I know.  <br />
<br />
These two issues are things that usually get sorted out when you hash over ideas with people in person, but I found it difficult to know who my audience was when given nothing but a set of requirements. <br />
</p><h4>Final thoughts</h4><p>All-in-all, I thought it was a positive and enjoyable experience. If I’m ever in the position to help with hiring again, I would probably really push hard for code samples to be part of the process. However, I probably wouldn’t give such open ended challenges. I’d probably give multiple smaller and more focused problems. </p>daugerhttp://www.blogger.com/profile/12756737682194998551noreply@blogger.com2tag:blogger.com,1999:blog-9167981196729784488.post-9206140104023861452011-02-28T21:03:00.016-06:002013-03-09T21:14:18.967-06:00.NET Dependency Management in a Pre-Nuget World<script language="JavaScript">
if (document.URL.indexOf("net-dependency-management-in-pre-nuget") !== -1)
{
window.location.href = "http://nerditorium.danielauger.com/blog/2011/02/28/dot-net-dependency-management-in-a-pre-nuget-world/";
}
</script><br />
<p class="MsoNormal">This post is an attempt to capture how my previous team dealt with dependency / package management. The team, at its largest point, consisted of about 15 developers. There were roughly 200 3<span class="Apple-style-span">rd</span> party dlls, and roughly 150 internal dlls in the dependency mix. No single app needed all 350 dlls, but groups of these dlls were common to applications in the same domain space of the enterprise. 3<span class="Apple-style-span">rd</span> party dlls were things such as the MS Enterprise Library, image conversion libraries, desktop scanner interop libraries, etc… Internal dlls were things such as common utility libraries, WCF service contracts, DTOs etc…<o:p></o:p></p><p class="MsoNormal"></p><p class="MsoNormal">Until the recent development of projects such as <a href="http://haacked.com/archive/2010/10/06/introducing-nupack-package-manager.aspx">Nuget</a> and <a href="http://www.openwrap.org/">OpenWrap</a>, dependency management in .NET has been a big problem. The larger a development group’s topology is, the more of a pain point it is. Because this is the case, a lot of teams don’t even realize they are going to have issues until the pain is upon them. Additionally, I think the complexity of describing the problem has helped to keep package management as an elephant in the .NET room for a long time. <o:p></o:p></p><p class="MsoNormal"></p><p class="MsoNormal">Since there has been abundant discussion on this issue lately, I’m going to skip describing the problems with dependency management and get straight into what we tried over the years, and what the final solution ended up being. It’s important to note that my team used TFS (2008) for source control because some of the steps we took were in response to TFS’ weaknesses.</p><p class="MsoNormal"></p><p class="MsoNormal"><b>First attempt ending in Failure:</b><br />
</p><ul><li><b>Manage all 3rd party dlls by putting them in a [sln]/bin folder (tracked by TFS).</b></li>
<li><b> Manage all internal dependencies as shared projects across multiple slns. </b></li>
</ul>I’m sure some of you are already cringing after reading the last bullet point, but you’ll have to admit it is the first solution that comes to mind to a lot of developers. Additionally, it is a very simple solution. The biggest issue with this solution is with sharing a project over several slns. Unfortunately, any bit of code in those shared projects is easily changeable from multiple slns; therefore it is very easy to break several slns in one fell swoop. Secondly configuration management goes out the window because every time a sln is compiled, each shared project gets a new version that bypasses any sort of change management.<p></p><p></p><p class="MsoNormal"><span class="Apple-style-span"><b>Second attempt ending in failure:</b></span><br />
</p><ul><li><b>Manage all 3rd party and internal dlls by putting them in a [sln]/bin folder.</b> </li>
</ul>This solution complicates things slightly (in a positive way) by requiring each sln to use a proper release of all internal dlls; therefore you are able to have some degree of configuration management. However, this solution failed for us because of one simple fact: TFS does not track binaries well. We never ran into this weakness with the first solution because all of the 3rd party dlls were set-and-forget. They never changed after setting the initial reference. The internal dlls however, would change daily, or even hourly. At first this seemed like the perfect solution, however all sorts of strange errors started occurring. One person would get latest and everything would work, but another person would get latest and have errors. TFS simply could not tell if you needed a new version of the dlls in the /bin folder. Sadly, even a “clean all" and "get specific version" didn't fix things a lot of the time.<br />
<p></p><p class="MsoNormal"><span class="Apple-style-span"><b>Third attempt ending in Success:</b></span><br />
</p><ul><li><b>Build a custom package management system.</b> </li>
</ul>Our custom package management system worked thusly: We created a network share. For each logical release (i.g. MS EntLib, Internal.Common.Util) we created both a [networkShare]\[package]\LatestRelease folder and a [networkShare]\[package]\Release_[version number] folder. We then created a console EXE with a bunch of options that would: 1) go and grab all of the latest dlls for all projects and dump them into one pre-defined “latest” folder on the developer PC and 2) Recreate the “releases” tree structure on the developer PC. This way, developers have the ability to drink from the fire-hose (the latest folder) or go for set releases (from the releases folder tree). TFS is not tracking dlls at all. Rather, we are relying on an absolute path file reference. Additionally, calling this executable becomes a build task on the CI server.<p></p><p class="MsoNormal">This solution isn't perfect. Namely, it relies on developers to remember to run the executable from time to time. Additionally, there are potentially some versioning scenarios that could occur between packages that expect a different versions of sub dependencies. However that issue never manifested itself in our environment.</p><p class="MsoNormal"><span class="Apple-style-span"><b>Nuget is not the final answer for teams using TFS</b><br />
<del>I've been following the Nuget dev list closely, and Nuget is considered to be a development time dependency resolver only, not a build time resolver. This means that if you use TFS to track your Nuget package folders, you could still run into dll versioning issues.</del><br />
<br />
<b>Update (4/17/2011)</b><br />
Nuget team member David Ebbo has blogged that functionality has been added to allow use of Nuget without committing the packages folder to source control.<a href="http://blog.davidebbo.com/2011/03/using-nuget-without-committing-packages.html">http://blog.davidebbo.com/2011/03/using-nuget-without-committing-packages.html</a></span></p><p class="MsoNormal"><b>Update (4/30/2011)</b><br />
According to Phil Haack, Nuget is going to be getting official support for non-committed packages: <a href="http://haacked.com/archive/2011/04/27/feedback-request-for-using-nuget-without-committing-packages.aspx">http://haacked.com/archive/2011/04/27/feedback-request-for-using-nuget-without-committing-packages.aspx</a></p><p class="MsoNormal"><span class="Apple-style-span"><br />
</span></p><p class="MsoNormal"><span class="Apple-style-span"><br />
I know that many of us have had to face this problem, therefore I'd really enjoy hearing about how you addressed this issue.</span></p><p class="MsoNormal"><b><br />
</b></p><p class="MsoNormal"></p><p class="MsoNormal" style="font-size: 15px; font-family: Calibri,sans-serif; line-height: 17px;"><o:p></o:p></p><p></p><p></p><p></p>daugerhttp://www.blogger.com/profile/12756737682194998551noreply@blogger.com11tag:blogger.com,1999:blog-9167981196729784488.post-80074056833301666922011-02-23T12:18:00.004-06:002013-03-09T21:16:03.317-06:00Moving OnYesterday was a tough day. I resigned from my position of seven years as a Developer / Analyst for the Office of the Minnesota Secretary of State. <br />
<br />
Over the past couple of months, the development group has gone through several reorganizations. Yesterday another reorganization happened, including a substantial software platform shift. I did not feel this shift was good for my career, nor was it something I wanted to participate in. Additionally, I think the days of in-house software development for government agencies are coming to an end at light speed. Therefore, with heavy heart, I felt it was time for me to go. Up until recently, it was the most enjoyable job of my career. I wish my former coworkers the best of luck, and I look forward to hearing their war stories as time goes on.daugerhttp://www.blogger.com/profile/12756737682194998551noreply@blogger.com1tag:blogger.com,1999:blog-9167981196729784488.post-50187733816272056742011-02-16T09:18:00.013-06:002013-03-09T21:35:00.472-06:00The Case of Web Deploy 2.0 and the Missing MSDeploy.exe<script language="JavaScript">
if (document.URL.indexOf("case-of-web-deploy-20-and-missing") !== -1)
{
window.location.href = "http://nerditorium.danielauger.com/blog/2011/02/16/the-case-of-web-deploy-2-dot-0-and-the-missing-msdeploy-dot-exe/";
}
</script><br />
This week, I decided to install the newly released Web Deploy 2.0 on my machine at work. I already had Web Deploy 1 on my machine, so I decided to uninstall that first before installing 2.0. After the installation I begain getting the following error when trying to execute VS2010 created web deployment packages from the command line:<br />
<br />
<pre class="bash" name="code">Error: The system was unable to find the specified registry key or value
msdeploy.exe is not found on this machine. Please install Web Deploy before exe
cute the script.
Please visit http://go.microsoft.com/?linkid=9278654
=========================================================
=========================================================
</pre><br />
Of course the first thing I did was validate that MSDeploy was indeed installed with Web Deploy 2.0. It was. I then tried adding MSDeploy's location to the path environment variable. No dice. I then tried reinstalling Web Deploy 2.0. Still no luck. After trying some other things I cracked open the deployment package's cmd file and found this:<br />
<pre class="bash" name="code">@rem ---------------------------------------------------------------------------------
@rem if user does not set MsDeployPath environment variable, we will try to retrieve it from registry.
@rem ---------------------------------------------------------------------------------
if "%MSDeployPath%" == "" (
for /F "usebackq tokens=2*" %%i in (`reg query "HKLM\SOFTWARE\Microsoft\IISExtensions\MSDeploy\1" /v InstallPath`) do (
if "%%~dpj" == "%%j" (
set MSDeployPath=%%j
))
</pre><br />
For whatever reason, Web Deploy 2.0 did not add either of these items during install. I ended up adding the MSDeployPath environment variable, and all was good.daugerhttp://www.blogger.com/profile/12756737682194998551noreply@blogger.com3tag:blogger.com,1999:blog-9167981196729784488.post-26992740065176819342011-01-11T21:28:00.003-06:002013-03-09T22:23:57.977-06:00Programming is a Craft<script language="JavaScript">
if (document.URL.indexOf("programming-is-craft") !== -1)
{
window.location.href = "http://nerditorium.danielauger.com/blog/2011/01/11/programming-is-a-craft/";
}
</script><br />
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhN824k997FieS8WDZ9kBJRvjz7nHdwGm3f1prerYHTZeCoU0JZ2UUGGT7PYdArc0t5QSGgipn-Hq92JmPj7IwXHEZQTJ_swcS2hx0XBnoB56ufvf_aiBQNDxdBN2WX8rQj7eiUy1fNNmqm/s1600/witchcraft1.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 243px; height: 400px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhN824k997FieS8WDZ9kBJRvjz7nHdwGm3f1prerYHTZeCoU0JZ2UUGGT7PYdArc0t5QSGgipn-Hq92JmPj7IwXHEZQTJ_swcS2hx0XBnoB56ufvf_aiBQNDxdBN2WX8rQj7eiUy1fNNmqm/s400/witchcraft1.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5561136420018273266" /></a><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: transparent; "><span id="internal-source-marker_0.7762323848437518" style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">Here are my initial thoughts after reading: <a href="http://dannorth.net/2011/01/11/programming-is-not-a-craft/">Programming is not a Craft</a></span><br />
<span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; font-size: 11pt; background-color: transparent;"></span><br />
<span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">“craft -noun 1. an art, trade, or occupation requiring special skill, esp. manual skill: the craft of a mason." (<a href="http://dictionary.reference.com/browse/craft">dictionary.com</a>)</span><br />
<span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; font-size: 11pt; background-color: transparent;"></span><br />
<span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">“In English, to describe something as a </span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: italic; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">craft</span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "> is to describe it as lying somewhere between an </span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: italic; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">art</span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "> (which relies on talent) and a </span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: italic; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">science</span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "> (which relies on knowledge). In this sense, the English word </span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: italic; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">craft</span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "> is roughly equivalent to the ancient Greek term</span><a href="http://en.wikipedia.org/wiki/Techne" style="font-family: Times; font-size: medium; "><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "> </span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap; ">techne</span></a><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">." (</span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap; "><a href="http://en.wikipedia.org/wiki/Craft">wikipedia.com</a></span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">)</span><br />
<span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; font-size: 11pt; background-color: transparent;"></span><br />
<span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">In my opinion, on a whole, software development is a combination of craft and primitive engineering (<a href="http://www-2.cs.cmu.edu/afs/cs.cmu.edu/project/compose/ftp/pdf/shaw_90.pdf">which is slowly emerging as a true engineering discipline</a>). The term craft usually means </span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: italic; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">how</span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "> something was made, not </span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: italic; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">what</span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "> was made or the perceived value of the end result by the layman. One of the commenters on the original post mentioned carpentry as a craft that may not always be defined by the value placed on the end product by the layman. In this vein, I will also mention that witchcraft is considered a craft.</span><br />
<span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; font-size: 11pt; background-color: transparent;"></span><br />
<span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">One of the hallmarks of craft is that that it is filled with heuristics and folklore. Much of the work of today's software developer is squarely within this realm. More often than not, there is no clear-cut way to solve a problem. We craft a solution based off of our experiences and the folklore we encounter. It is worth noting that I consider blogs, google searches, MSDN, visits at a coworker's desk, irc, and </span><a href="http://stackoverflow.com/" style="font-family: Times; font-size: medium; "><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap; ">stackoverflow.com</span></a><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "> to be sources of folklore. </span><br />
<span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; font-size: 11pt; background-color: transparent;"></span><br />
<span style="background-color: transparent; vertical-align: baseline; "><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: 11pt; white-space: pre-wrap;">I must say that I do agree with much of the post, but I think the terminology that is presented is incorrect. I think it would have been wiser to say that software development is <i>most often not</i> an art, and ego has no place in it. </span></span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: transparent; "><span style="background-color: transparent; vertical-align: baseline; "><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: 11pt; white-space: pre-wrap;"><br />
</span></span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: transparent; "><span style="background-color: transparent; vertical-align: baseline; "><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: 11pt; white-space: pre-wrap;">I also have to concede that in hindsight, I believe that the <a href="http://manifesto.softwarecraftsmanship.org/">software craftsmanship manifesto</a> was a bad idea. I recently learned there was a period of time when it was being debated if there should be clause in it to forbid using anything (tools, languages, etc...) that was not OSS. In my opinion the manifesto only serves to force a definition on something that needs no additional definition.</span></span></span></div>daugerhttp://www.blogger.com/profile/12756737682194998551noreply@blogger.com1tag:blogger.com,1999:blog-9167981196729784488.post-73294547593249412902011-01-09T20:48:00.005-06:002013-03-09T22:59:36.268-06:00The Mythology of Commodore Told in about 15 Minutes by Jim Butterfield<p><a href="http://lh6.ggpht.com/_q7jyIQc7ftY/TSpziRvuMhI/AAAAAAAAAKs/8oGSCYcEbY0/s1600-h/jimbutterfield-centrefold%5B10%5D.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="jimbutterfield-centrefold" border="0" alt="jimbutterfield-centrefold" align="left" src="http://lh5.ggpht.com/_q7jyIQc7ftY/TSpziudkquI/AAAAAAAAAKw/L-FNOyTOCWY/jimbutterfield-centrefold_thumb%5B3%5D.jpg?imgmax=800" width="171" height="244" /></a></p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p>I was cleaning up the data drive on my computer tonight and I came across this gem, which is also hosted on blip.tv: </p><br />
<br />
<center><script type="text/javascript" src="http://blip.tv/scripts/pokkariPlayer.js?ver=2009070701"></script> <script type="text/javascript" src="http://blip.tv/syndication/write_player?skin=js&posts_id=3086397&source=3&autoplay=true&file_type=flv&player_width=&player_height="></script> <div id="blip_movie_content_3086397"><a rel="enclosure" href="http://blip.tv/file/get/RobertBernardo-JimButterfieldAtTheChicagoCExpo1998405.wmv" onclick="play_blip_movie_3086397(); return false;"><img title="Click to play" alt="Video thumbnail. Click to play" src="http://blip.tv/file/get/RobertBernardo-JimButterfieldAtTheChicagoCExpo1998405.wmv.jpg" border="0" title="Click To Play" /></a> <br />
<a rel="enclosure" href="http://blip.tv/file/get/RobertBernardo-JimButterfieldAtTheChicagoCExpo1998405.wmv" onclick="play_blip_movie_3086397(); return false;">Click To Play</a> </div></center><br />
<br />
<p>Many of us owe our career to <a href="http://en.wikipedia.org/wiki/Jim_Butterfield">Butterfield</a>, and the father of the 65XX - <a href="http://en.wikipedia.org/wiki/Chuck_Peddle">Chuck Peddle</a>. <br />
If you are interested in the history of Commodore, please check out Brian Bagnall’s: <a href="http://www.variantpress.com/books/on-the-edge">Commodore: A Company on the Edge</a>. </p><p> </p><p><img style="display: block; float: none; margin-left: auto; margin-right: auto" src="http://www.pcmuseum.ca/images/jimglobe.gif" /></p>daugerhttp://www.blogger.com/profile/12756737682194998551noreply@blogger.com0tag:blogger.com,1999:blog-9167981196729784488.post-59158898958690051442010-12-26T19:43:00.021-06:002013-03-09T23:13:47.306-06:00Getting RVM to Work when GVim is Launched from Ubuntu's Menu<script language="JavaScript">
if (document.URL.indexOf("getting-rvm-to-work-when-gvim-is") !== -1)
{
window.location.href = "http://nerditorium.danielauger.com/blog/2010/12/26/getting-rvm-to-work-when-gvim-is-launched-from-ubuntus-menu/";
}
</script><br />
If you want to use GVim as your Ruby editor in Ubuntu (and most likely any other Gnome based distro), you've probably found out that your .bashrc file is not read when launching GVim from the Gnome menu. This means that your RVM paths are not available in the scope of apps launched from the menu. However, when launching apps from the menu, the launcher can access your .profile file. That being the case, here is a quick work-around for this issue:<br />
<br />
1) Add the following code to your ~/.profile file:<br />
<pre class="Bash" name="code"># This loads RVM into the session scope of the launcher.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"</pre>2) Create a script that you can use to start up GVim. Example ~/Apps/GVim/gvimstart.sh. In this script, place the following:<br />
<pre class="bash" name="code">#!/bin/bash
source ~/.profile
gvim</pre>3)Right click on the applications menu and choose "Edit Menus". Then find your GVim launcher and point the command entry to your script.<br />
<br />
I am, by no means, a Gnome expert, so please let me know if you are aware of a better solution.<br />
<br />
Happy coding!daugerhttp://www.blogger.com/profile/12756737682194998551noreply@blogger.com0tag:blogger.com,1999:blog-9167981196729784488.post-90024423720563896212010-12-10T00:39:00.004-06:002013-03-10T01:35:46.557-06:00Learn WPF for Free<script language="JavaScript">
if (document.URL.indexOf("earn-wpf-for-free") !== -1)
{
window.location.href = "http://nerditorium.danielauger.com/blog/2010/12/10/learn-wpf-for-free/";
}
</script><br />
<p>In my <a href="http://mynerditorium.blogspot.com/2010/08/time-until-productivity-in-wpf.html">last WPF related post</a> I spoke a bit about my WPF learning experience. I was fortunate enough to have an MSDN Universal subscription and any book I wanted via my employer as I went down the path. Unexpectedly, I recently received an email from a reader who wanted to learn WPF on a budget of $0.00. After thinking for a bit, I came to the conclusion that WPF can be learned without spending any money (assuming you have a computer that can run the tools). Below is a roadmap on how to do so.</p><h3>Get the tools for free</h3><p>Visual Studio Express, which is able to create WPF apps can be found here: <br />
<a href="http://www.microsoft.com/express/Windows/">http://www.microsoft.com/express/Windows/</a></p><p>If you need any other tools, such as SQL Server Express, you can most likely find them via the Web Platform Installer here: <a href="http://www.microsoft.com/web/downloads/platform.aspx">http://www.microsoft.com/web/downloads/platform.aspx</a></p><h3>Learn the Framework</h3><p>Between MSDN and the community, there is more than enough well-written documentation out there to help one become an expert on the WPF framework itself. In his book, “<a href="http://joshsmithonwpf.wordpress.com/advanced-mvvm/">Advanced MVVM</a>”, WPF expert, Josh “The Maestro” Smith, recommends the following documents to come up to speed with the WPF framework:</p><p><strong>Introduction to WPF</strong>: <a href="http://msdn.microsoft.com/en-us/library/aa970268.aspx">http://msdn.microsoft.com/en-us/library/aa970268.aspx</a> <br />
<strong>WPF Architecture</strong>: <a href="http://msdn.microsoft.com/en-us/library/ms750441.aspx">http://msdn.microsoft.com/en-us/library/ms750441.aspx</a> <br />
<strong>A Guided Tour of WPF</strong>: <a href="http://joshsmithonwpf.wordpress.com/a-guided-tour-of-wpf/">http://joshsmithonwpf.wordpress.com/a-guided-tour-of-wpf/</a> <br />
<strong>Customize Data Display with Data Binding and WPF</strong>: <a href="http://msdn.microsoft.com/en-us/magazine/cc700358.aspx">http://msdn.microsoft.com/en-us/magazine/cc700358.aspx</a> <br />
<strong>ItemsControl: ‘I’ is for the Item Container</strong>: <a href="http://drwpf.com/blog/2008/03/25/itemscontrol-i-is-for-item-container/">http://drwpf.com/blog/2008/03/25/itemscontrol-i-is-for-item-container/</a> <br />
<br />
A lot of the information in the above links is difficult to absorb, but I think it is very worthwhile to go through the material, <b>and work through the examples</b>, at least once. If some of the documents are unclear, you can always go back to them as you learn more and need more clarification.</p><h3>Learn MVVM</h3><p>Many people blow off MVVM as “the latest popular design pattern”, but learning MVVM is essential to working with WPF. This is because MVVM is a natural pattern to use considering the way databinding works with WPF. Yes, you can write WPF apps using tried-and-true code-behind and click event handlers like people did with winforms, but you’ll be doing yourself a disservice.</p><p>When learning MVVM, the first place to look is this very simple video by the Jason “The Enigma” Dolinger, where he explains what MVVM is, and what the pattern’s strengths are: <a href="http://blog.lab49.com/archives/2650">http://blog.lab49.com/archives/2650</a> <br />
<br />
The next place I would look is the “MVVM In the box” training by Karl “The Educator” Schifflett: <br />
<a href="http://karlshifflett.wordpress.com/2010/11/07/in-the-box-ndash-mvvm-training/">http://karlshifflett.wordpress.com/2010/11/07/in-the-box-ndash-mvvm-training/</a> <br />
<br />
As a lesson summary, an in-depth overview of MVVM written by Josh Smith can be found here: <a href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx">http://msdn.microsoft.com/en-us/magazine/dd419663.aspx</a></p><h3>Apply what you’ve learned</h3><p>While there is no WPF “best practices” sample that I am aware of, I think the following can get one to see how WPF fits into an application architecture.</p><p><strong>Building a Desktop TO-DO application with NHibernate:</strong> <a href="http://msdn.microsoft.com/en-us/magazine/ee819139.aspx">http://msdn.microsoft.com/en-us/magazine/ee819139.aspx</a> <br />
<strong>Understanding the MVVM Pattern:</strong> <a href="http://live.visitmix.com/MIX10/Sessions/EX14">http://live.visitmix.com/MIX10/Sessions/EX14</a> <br />
<strong>Build Your Own MVVM Framework:</strong> <a href="http://live.visitmix.com/MIX10/Sessions/EX15">http://live.visitmix.com/MIX10/Sessions/EX15</a> <br />
<br />
Not strictly MVVM, but worth looking at as application and framework samples:</p><p><strong>PRISM:</strong> <a href="http://compositewpf.codeplex.com/">http://compositewpf.codeplex.com/</a> <br />
<strong>Caliburn Micro:</strong> <a href="http://caliburnmicro.codeplex.com/">http://caliburnmicro.codeplex.com/</a> <br />
<strong>Caliburn Micro Soup To Nuts Series:</strong> <a href="http://caliburnmicro.codeplex.com/documentation">http://caliburnmicro.codeplex.com/documentation</a> <br />
<strong>MVVM Light:</strong> <a href="http://mvvmlight.codeplex.com/">http://mvvmlight.codeplex.com/</a> </p><h3>Keep Learning</h3><p>Read Blogs! Search out WPF related blogs. There are enough out there to fill your news reader every day. <a href="http://10rem.net/">Pete “6510” Brown</a>  puts out a Windows Client roundup frequently which is a good starting point.</p><p>Read and participate in the knowledge dump at <a href="http://stackoverflow.com/questions/tagged/wpf">http://stackoverflow.com/questions/tagged/wpf</a>. <br />
At first you may find that some of the questions are the same things you are wondering about. After awhile, you will find that you can answer some of the questions. As you answer questions, you’ll reinforce what you’ve learned.</p><h3>Share</h3><p>Software development is still largely a folklore based discipline. It is your duty to share what you have learned in the best way you know how.</p>daugerhttp://www.blogger.com/profile/12756737682194998551noreply@blogger.com0tag:blogger.com,1999:blog-9167981196729784488.post-45590295550778448452010-11-22T21:49:00.004-06:002013-03-09T23:49:09.683-06:00Katamari Code<script language="JavaScript">
if (document.URL.indexOf("katamari-code") !== -1)
{
window.location.href = "http://nerditorium.danielauger.com/blog/2010/11/22/katamari-code/";
}
</script><br />
<p>We’ve all worked on projects where the codebase is a mess. Here are a couple of common messy codebase analogies I’ve heard over the years:</p><p>The House of Cards Codebase:</p><div style="padding: 0px; margin: 0px; display: inline; float: none;" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:ff47ad36-f929-4c85-9e92-e3f4a1780e17" class="wlWriterEditableSmartContent"><div id="a3501f16-5059-4c2c-95e7-98b023f61559" style="margin: 0px; padding: 0px; display: inline;"><div><a href="http://www.youtube.com/watch?v=rheUs9v6hQo" target="_new"><img src="http://lh6.ggpht.com/_q7jyIQc7ftY/TOs51P0yf5I/AAAAAAAAAKc/7j-5mymkAX0/video03b0f9aaa0c7%5B14%5D.jpg?imgmax=800" style="border-style: none;" galleryimg="no" onload="var downlevelDiv = document.getElementById('a3501f16-5059-4c2c-95e7-98b023f61559'); downlevelDiv.innerHTML = "<div><object width=\"448\" height=\"252\"><param name=\"movie\" value=\"http://www.youtube.com/v/rheUs9v6hQo?hl=en&hd=1\"><\/param><embed src=\"http://www.youtube.com/v/rheUs9v6hQo?hl=en&hd=1\" type=\"application/x-shockwave-flash\" width=\"448\" height=\"252\"><\/embed><\/object><\/div>";" alt="" /></a></div></div></div><p>The Jenga Codebase:</p><div style="padding: 0px; margin: 0px; display: inline; float: none;" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:050b977a-eee5-43ec-8a6c-e656c25cbe30" class="wlWriterEditableSmartContent"><div id="dcd7158d-b58a-4a3b-bbe5-b616080b6758" style="margin: 0px; padding: 0px; display: inline;"><div><a href="http://www.youtube.com/watch?v=RdNeaSgqcFg" target="_new"><img src="http://lh5.ggpht.com/_q7jyIQc7ftY/TOs51kVTQOI/AAAAAAAAAKg/O2bD6U-Q7rs/videof2597c0d10dd%5B12%5D.jpg?imgmax=800" style="border-style: none;" galleryimg="no" onload="var downlevelDiv = document.getElementById('dcd7158d-b58a-4a3b-bbe5-b616080b6758'); downlevelDiv.innerHTML = "<div><object width=\"448\" height=\"252\"><param name=\"movie\" value=\"http://www.youtube.com/v/RdNeaSgqcFg?hl=en&hd=1\"><\/param><embed src=\"http://www.youtube.com/v/RdNeaSgqcFg?hl=en&hd=1\" type=\"application/x-shockwave-flash\" width=\"448\" height=\"252\"><\/embed><\/object><\/div>";" alt="" /></a></div></div></div><p>Although I can appreciate the above analogies, more often than not, I think Beautiful Katamari is the most appropriate analogy.</p><div style="padding: 0px; margin: 0px; display: inline; float: none;" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:db6caaf3-dbef-4ede-a0f3-3c1fc27ab153" class="wlWriterEditableSmartContent"><div id="5c3a494b-00a6-4b84-95cf-d7ec50e8d421" style="margin: 0px; padding: 0px; display: inline;"><div><a href="http://www.youtube.com/watch?v=r2-5oM5bE4I" target="_new"><img src="http://lh6.ggpht.com/_q7jyIQc7ftY/TOs51xNn-DI/AAAAAAAAAKk/YJijf5HJKGE/video9282ae344e46%5B3%5D.jpg?imgmax=800" style="border-style: none;" galleryimg="no" onload="var downlevelDiv = document.getElementById('5c3a494b-00a6-4b84-95cf-d7ec50e8d421'); downlevelDiv.innerHTML = "<div><object width=\"448\" height=\"252\"><param name=\"movie\" value=\"http://www.youtube.com/v/r2-5oM5bE4I?hl=en&hd=1\"><\/param><embed src=\"http://www.youtube.com/v/r2-5oM5bE4I?hl=en&hd=1\" type=\"application/x-shockwave-flash\" width=\"448\" height=\"252\"><\/embed><\/object><\/div>";" alt="" /></a></div></div></div>daugerhttp://www.blogger.com/profile/12756737682194998551noreply@blogger.com0tag:blogger.com,1999:blog-9167981196729784488.post-7799787420262283852010-08-10T21:51:00.003-05:002013-03-10T00:38:15.648-06:00Time Until Productivity In WPF<script language="JavaScript">
if (document.URL.indexOf("time-until-productivity-in-wpf") !== -1)
{
window.location.href = "http://nerditorium.danielauger.com/blog/2010/08/10/time-until-productivity-in-wpf/";
}
</script><br />
<p><a href="http://lh6.ggpht.com/_q7jyIQc7ftY/TGIQL_U4H3I/AAAAAAAAAJ8/rsVGNcA5RLQ/s1600-h/kingkongtorso%5B5%5D.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="kingkongtorso" border="0" alt="kingkongtorso" align="left" src="http://lh6.ggpht.com/_q7jyIQc7ftY/TGIQMO87i8I/AAAAAAAAAKA/q-0YNh9UQ6o/kingkongtorso_thumb%5B3%5D.jpg?imgmax=800" width="256" height="183" /></a> One of the things I see over-and-over-again when reading about teams that are deciding if they should adopt WPF or not is the fear of the learning curve, and the worry that they will not be productive for a huge period of time. Given that I’ve recently become productive in WPF myself, I thought I would talk about my experience in this area.</p><p><br />
A little background about myself: I would consider myself to be your average mid-30 year old ALT.NET developer. I got my start programming BASIC and 65xx assembly as a kid in the early 80s on a Commodore 64, got my first programming job doing Java in the late 90s, and started using ASP.NET in the late 1.0 beta days. Programming is one of my hobbies, but I am not the type that stays up all hours of the night working on my pet OSS project. I am also not a “computer scientist” or language wonk. However, I am passionately interested in software craftsmanship. <a href="http://en.wikipedia.org/wiki/Solid_(object-oriented_design)" target="_blank">S.O.L.I.D.</a> is prominent in my tool belt.</p><p>My attention was first turned to WPF in the early fall of 2008. My group was facing a large desktop project. The question came up as to if we should go with Winforms or WPF. No one on the team had any practical Winforms experience, so the initial reaction was that we should go with WPF since Microsoft had made it clear that it was the future of Windows desktop development. However, we all had heard rumblings about how difficult WPF was. That being the case, each member of the team created a very small drag-and-drop application to test the waters. The general consensus was that if you ignored the more advanced features of WPF, it was just as easy as Winforms drag-and-drop + code behind development. Mind you, we did not want to do that sort of development, but it became apparent that that style of development would be equally painful using either framework. Note that at this time, I really had no idea how to make a real application using WPF, but I did understand the very basic concept of how XAML markup changed the game from Winforms development.</p><p><strong>Estimated time spent learning WPF during this period: 8 hours</strong>.</p><p>After the initial decision making process, I returned to ASP.NET and WCF development. The WPF project didn’t really get started until spring 2009. I was not slated to work on the project, but I was enlisted to help decide the preliminary architecture. Once I was given that task, I began to look around for application frameworks, or at the very least, some patterns that had momentum behind them. At this time, I learned about the MVVM pattern via the still insightful <a href="http://blog.lab49.com/archives/2650" target="_blank">Jason Dolinger video</a>. It really seemed to click in my mind so I began looking for an application framework to support this pattern. I did not find a mature application framework per say, but I did come across <a href="http://compositewpf.codeplex.com/" target="_blank">PRISM</a>. There were a few other budding frameworks at the time, but PRISM was way ahead of the game. Therefore, we decided to go with PRISM using the MVVM presentation pattern on the client side of the application. Once that decision was made, I was back off the project and doing other things. I did however start following a few WPF blogs at this time, but I did not do any WPF coding.</p><p><strong>Estimated time spent learning WPF during this period: 8 hours. <br />
Total estimated time: 16 hours.</strong></p><p>This July, my schedule freed up and I was put on the project 50% of my time. I was tasked with a reporting interface that had to show a list of available reports and then dynamically show parameter UI elements depending on which report was selected. </p><p>As soon as I was assigned to the project, I got a copy of <a href="http://www.manning.com/feldman2/" target="_blank">WPF in Action with Visual Studio 2008</a>. I read the book half the day during my work week, and then a few hours each night at home. As someone who learned programming through <a href="http://en.wikipedia.org/wiki/Type-in_program" target="_blank">type-in</a> programming, I made sure that I recreated all of the samples myself. Also at this time, I grabbed the latest version of PRISM and took a peek at the examples.</p><p><strong>Estimated time spent learning WPF during this period: 30 hours. <br />
Total estimated time: 46 hours.</strong></p><p>The first week of actual development was pretty brutal. MVVM was not the problem. PRISM was not the problem. XAML and databinding is where I was banging my head against the wall. It kind of worked like HTML, and it kind of didn’t. That first week was pretty aggravating, but pretty much every problem I encountered was just an internet search away.</p><p><strong>Estimated time spent learning WPF during this period: 30 hours. <br />
Total estimated time: 76 hours.</strong></p><p>I became productive after that first week. I’ll be the first to admit that I don’t intimately know how WPF works behind the scenes (like I do with ASP.NET). However, I do think that I became productive within a reasonable amount of time.</p><p>Looking back, I can safely say it took me about <strong>80 hours</strong> to go from expert ASP.NET programmer to productive WPF programmer.  That being said, I do not know how long it would have taken me to go from expert ASP.NET programmer to productive Winforms developer. Something tells me it wouldn’t have been a number that would have made us use Winforms instead of WPF.</p>daugerhttp://www.blogger.com/profile/12756737682194998551noreply@blogger.com0tag:blogger.com,1999:blog-9167981196729784488.post-85041073616541006672010-07-19T21:51:00.001-05:002013-03-10T12:39:42.355-05:00Should .NET Auto Properties Have Unit Tests?<script language="JavaScript">
if (document.URL.indexOf("should-net-auto-properties-have-unit") !== -1)
{
window.location.href = "http://nerditorium.danielauger.com/blog/2010/07/19/should-net-auto-properties-have-unit-tests/";
}
</script><br />
<p><a href="http://lh3.ggpht.com/_q7jyIQc7ftY/TEUPTXjQkaI/AAAAAAAAAJk/msOQhdNwXMw/s1600-h/testing_scaled%5B4%5D.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="testing_scaled" border="0" alt="testing_scaled" align="left" src="http://lh5.ggpht.com/_q7jyIQc7ftY/TEUPToq5lYI/AAAAAAAAAJo/sdyCLhr3Tao/testing_scaled_thumb%5B2%5D.jpg?imgmax=800" width="252" height="204" /></a> </p><p>Should .NET auto properties be unit tested? It is very easy to argue that testing auto properties falls into the “testing the .NET framework” smell and is a waste of time. However, experience has shown me otherwise. This is something that I’ve gone back and forth on many times since auto properties were introduced. For the time being, I think I’ve reached a conclusion. That conclusion is yes. </p><p> </p><p>I typically do two types of testing: 1) Test Driven Design, and 2) Test while/after unit testing. Let’s consider these two scenarios.</p><p>When doing test driven design, there is no question. You should write tests for your auto properties. Test driven design is not about testing; it’s about design. The rule of thumb is that you don’t write any code without a test dictating its need. Case closed (in general).</p><p>Things get trickier when doing test while/after unit testing. This type of testing is more about creating a test harness. When writing tests after the fact, I know that the property is implemented using auto properties. Therefore, if I am taking a white box approach, I know that my implementation of the encapsulated property is simply the .NET framework. Following that line of thought, testing auto properties is testing the .NET framework. However, I tend to view test while/after testing as a test harness of the public contract. This is black box testing. A public property is an encapsulation, and therefore it should be tested. It’s not uncommon for an auto property to be converted into a regular property as an application lives on. I’d have to say that I would want a test there to capture any publicly facing change in that encapsulation.</p>daugerhttp://www.blogger.com/profile/12756737682194998551noreply@blogger.com0tag:blogger.com,1999:blog-9167981196729784488.post-13578298505313955452010-04-26T20:07:00.008-05:002013-03-10T14:42:44.189-05:00Persistence Ignorant Lazy Loading For Your Hand-Rolled DAL In .NET 4.0 Using Lazy<T><script language="JavaScript">
if (document.URL.indexOf("persistent-ignorant-lazy-loading-for") !== -1)
{
window.location.href = "http://nerditorium.danielauger.com/blog/2010/04/26/persistence-ignorant-lazy-loading-for-your-hand-rolled-dal-in-net-4-dot-0-using-lazy/";
}
</script><br />
<div>This post is a brief update to the .NET 3.5 article I posted about <a href="http://mynerditorium.blogspot.com/2010/01/practical-pi-lazy-loading-for-your-hand.html" target="_blank">P.I. lazy loading</a>. The only major change I have made to the code is to use the new <a href="http://msdn.microsoft.com/en-us/library/dd642331.aspx" target="_blank">Lazy<T></a> class that was introduced in .NET 4.0. This considerably cleans up the LazyLoadingList<T> class from the previous post.</div><br />
<div>Here is the new LazyLoadingList<T>: <br />
<pre class="csharp" name="code">public class LazyLoadingList<T> : IList<T>
{
private Lazy<IList<T>> _lazyList;
public LazyLoadingList(Lazy<IList<T>> lazyList)
{
_lazyList = lazyList;
}
#region Implementation of IEnumerable
public IEnumerator<T> GetEnumerator()
{
return _lazyList.Value.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return _lazyList.Value.GetEnumerator();
}
#endregion
#region Implementation of ICollection<T>
public void Add(T item)
{
_lazyList.Value.Add(item);
}
public void Clear()
{
_lazyList.Value.Clear();
}
public bool Contains(T item)
{
return _lazyList.Value.Contains(item);
}
public void CopyTo(T[] array, int arrayIndex)
{
_lazyList.Value.CopyTo(array, arrayIndex);
}
public bool Remove(T item)
{
return _lazyList.Value.Remove(item);
}
public int Count
{
get
{
return _lazyList.Value.Count;
}
}
public bool IsReadOnly
{
get
{
return ((ICollection<T>)_lazyList.Value).IsReadOnly;
}
}
#endregion
#region Implementation of IList<T>
public int IndexOf(T item)
{
return _lazyList.Value.IndexOf(item);
}
public void Insert(int index, T item)
{
_lazyList.Value.Insert(index, item);
}
public void RemoveAt(int index)
{
_lazyList.Value.RemoveAt(index);
}
public T this[int index]
{
get
{
return _lazyList.Value[index];
}
set
{
_lazyList.Value[index] = value;
}
}
#endregion
}
</pre><br />
</div><br />
<div>Here are the changes to the invoking code:<br />
<pre class="csharp" name="code">public class CompanyDAO : ICompanyDAO
{
List<Company> _companiesInDatabase = new List<Company>
{
new Company(){Name = "ACME"},
new Company(){Name = "Hardees"}
};
#region Implementation of ICompanyDAO
public Company GetByName(string name)
{
// Write to console to demonstrate when loading is happening
Console.WriteLine("---Loading Company---");
// Pretend we are calling / mapping from a store procedure
var company = _companiesInDatabase.Where(x => x.Name == name).First();
// Create / add the lazily loaded collection
if (company != null)
{
var lazyLoader = new Lazy<IList<Employee>>(
() =>
{
var employeeDAO = new EmployeeDAO();
return employeeDAO.GetByCompanyName(name).ToList();
}
);
company.Employees = new LazyLoadingList<Employee>(lazyLoader);
}
return company;
}
#endregion
}
</pre><br />
</div><br />
<div>The full source can be found here: <a href="http://github.com/dauger/BlogSamples">http://github.com/dauger/BlogSamples</a></div>daugerhttp://www.blogger.com/profile/12756737682194998551noreply@blogger.com0tag:blogger.com,1999:blog-9167981196729784488.post-8141188326509216462010-04-07T10:09:00.005-05:002010-06-12T10:39:45.939-05:00How to fail at ORM<p><a href="http://www.nhforge.org"><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="NoORM" border="0" alt="NoORM" align="left" src="http://lh6.ggpht.com/_q7jyIQc7ftY/S7ygKmyfOxI/AAAAAAAAAH4/PBz-J0DBaP4/NoORM_thumb%5B5%5D.png?imgmax=800" width="117" height="112" /></a> </p> <p> <br />Let's face it: if trends continue, some form of ORM will be a fact of life at most .net organizations that develop business / enterprise software. Microsoft isn't playing games this time with Entity Framework. They mean for it to succeed. Additionally, at the time of writing this, NHibernate has been downloaded 391,024 times from sourceforge alone (there is more than one place to download it from). This being the case, I’m going to give everyone a few pointers to ensure that their first attempt at ORM fails.</p> <p>Here are my tips to insure ORM adoption failure (in no particular order):</p> <p><strong>Consider the ORM’s SQL engine as a replacement for SQL knowledge.</strong> The whole point behind ORMs is so that I don’t have to write or understand SQL right? WRONG!</p> <p><strong>Consider the ORM’s SQL engine to be a black box. </strong>I got back the correct dataset, so this must be the best SQL the ORM can produce right? WRONG! Most ORMs will create drastically different SQL depending on how the object query is structured.</p> <p><strong>Don’t get more than a skin deep understanding of the ORM. </strong>If you run into a brick wall with a bit of behavior from the ORM, you can follow two paths. You can A) learn about the finer points of the ORM to resolve the issue, or B) rip the ORM out of your application. The latter is the outcome I’ve seen more often than not. A classic example of this is the N+1 select issue where the app calls the database in a loop. ORMs have things such as eager loading, multi-queries, and future queries to avoid extra trips to the database. However, it’s best to ignore the existence of those features if you want to fail at ORM.</p> <p><strong>Use ORM generated schema without manually tweaking it. </strong>Many ORMs will happily create a schema for the developer just how they specified it, and index free. Ideally you shouldn’t use generated schema at all once you are up and running. A DBA should be creating a schema using relational theory. However, if you want to fail, it’s best to just used that generated schema.</p> <p><strong>Use the ORM for 100% of your data access. <br /></strong>Most ORMs allow for dropping into prepared SQL, stored procedures, and even db function calls. However, it’s best to ignore this functionality if you want to fail. </p> <p><strong>Maintain OO purity at all costs. <br /></strong>Does fetching your aggregate root cause an 11 table join? So be it. </p> <p><strong>Cut the DBA out of the development process. <br /></strong>The whole point of ORM is to cut out the DBA right? WRONG! The DBA should be just as active with helping to craft the data access strategy as they would with a hand rolled data access layer. Cutting the DBA of the picture is a recipe for failure.</p> <p><strong>Don’t profile your application. <br /></strong>If you want to fail, it’s best to find out if you have have created a SQL nightmare once you hit production. NHProf, EFProf, L2SProf, and SQL Profiler are your friends. Ignore them to fail.</p> <p>I hope you find these tips helpful. I’d like to hear about any other tips for ORM failure you might have.</p>daugerhttp://www.blogger.com/profile/12756737682194998551noreply@blogger.com11tag:blogger.com,1999:blog-9167981196729784488.post-63565712838019801782010-03-12T15:45:00.012-06:002010-03-30T17:55:48.444-05:00Possibly The Most Important C# Interview Question<p><br /><a href="http://lh6.ggpht.com/_q7jyIQc7ftY/S5q2PBEDi0I/AAAAAAAAAHs/OWsNrkCFNI4/s1600-h/brain_resized%5B3%5D.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="brain_resized" border="0" alt="brain_resized" align="left" src="http://lh3.ggpht.com/_q7jyIQc7ftY/S5q2PRvTf3I/AAAAAAAAAHw/NivJNU9RUBQ/brain_resized_thumb%5B1%5D.jpg?imgmax=800" width="108" height="145" /></a> </p> <h4><br />The Problem</h4> <p>Recently I was reviewing some code at work that was written by a senior developer that had left the organization. I saw something along these lines that set off a huge red flag in my head:</p><pre class="csharp" name="code">Address newAddress = customer.Address;<br />newAddress.LineOne = "122 SongbirdLane"; // more changes etc...<br />customer.Address = newAddress; // RED FLAG!</pre><p>Although the above code technically works, I took it as a warning sign indicating that the developer probably didn’t understand how references work. Sadly, my suspicions were confirmed after I dug through some more code. Even worse, the application was littered with hacks to fix areas where this misunderstanding manifested problems.</p><p>Yes ladies and gentlemen, there are people out there that have been doing C# development since .NET 1.0 that don’t have a functional mental model of how the language works. I wish I could say this was the first time I’ve run into this. Sadly, I’ve run into it several times over the years.</p><h4>The Solution</h4><p>It is very easy to weed these people out during the interview process by asking a very simple interview question. That question is:</p><p>What does the following program output to the command line?</p><pre class="csharp" name="code"><br />public class Person<br />{<br /> public string Name { get; set; }<br />}<br /><br />class Program<br />{<br /> static void Main(string[] args) <br /> {<br /> Person joe = new Person();<br /> joe.Name = "Joe";<br /><br /> Person tim = joe;<br /> tim.Name = "tim";<br /><br /> Console.WriteLine(joe.Name);<br /> Console.WriteLine(tim.Name);<br /><br /> int myNumber = 666;<br /><br /> DoSomething(myNumber);<br /><br /> Console.WriteLine(myNumber);<br /> }<br /><br /> private static void DoSomething(int someNumber)<br /> {<br /> someNumber = 777;<br /> }<br />}</pre><p>The trick is that you have to ask it to every developer, no matter how many years they have under their belt.</p>daugerhttp://www.blogger.com/profile/12756737682194998551noreply@blogger.com0tag:blogger.com,1999:blog-9167981196729784488.post-65534274400518001952010-02-20T19:59:00.001-06:002010-02-20T19:59:20.029-06:00Speeding Up Cassini In Vista And Windows 7<p>I was doing some ASP.NET MVC work this evening on my new supa-fast Windows 7 machine using the built-in Visual Studio Cassini webserver. For some odd reason, it was taking a few seconds for my tiny pages to resolve / render. I was using Chrome, so I decided to try Firefox. Firefox was just as slow. I then tried using IE and it performed with the speediness I was used to on my old XP install. I did some digging, and I came across the solution to the problem in two places:</p> <p><a title="http://www.wagnerdanda.me/2009/12/asp-net-development-server-slow-on-windows-vista7-with-firefox-or-chrome/" href="http://www.wagnerdanda.me/2009/12/asp-net-development-server-slow-on-windows-vista7-with-firefox-or-chrome/">http://www.wagnerdanda.me/2009/12/asp-net-development-server-slow-on-windows-vista7-with-firefox-or-chrome/</a> <br /><a title="http://stackoverflow.com/questions/1416128/my-local-host-goes-so-slow-now-that-i-am-on-windows-7-and-asp-net-mvc" href="http://stackoverflow.com/questions/1416128/my-local-host-goes-so-slow-now-that-i-am-on-windows-7-and-asp-net-mvc">http://stackoverflow.com/questions/1416128/my-local-host-goes-so-slow-now-that-i-am-on-windows-7-and-asp-net-mvc</a></p> <p>It turns this is an issue with ipv6 and resolving localhost on Vista and Windows 7. The fix is very easy – you simply need to uncomment the localhost entry in your  C:\Windows\System32\drivers\etc\hosts file by changing this:</p> <p># localhost name resolution is handled within DNS itself. <br />#    127.0.0.1       localhost <br /> <br />to:</p> <p># localhost name resolution is handled within DNS itself. <br />     127.0.0.1       localhost</p> <p>You may need to run your text editor as administrator in order to save the changes.</p> daugerhttp://www.blogger.com/profile/12756737682194998551noreply@blogger.com0tag:blogger.com,1999:blog-9167981196729784488.post-78137842488263795042010-01-31T22:08:00.022-06:002013-03-10T14:45:09.064-05:00Practical Persistence Ignorant Lazy Loading For Your Hand-rolled DAL<script language="JavaScript">
if (document.URL.indexOf("practical-pi-lazy-loading-for-your-hand") !== -1)
{
window.location.href = "http://nerditorium.danielauger.com/blog/2010/01/31/practical-persistence-ignorant-lazy-loading-for-your-hand-rolled-dal/";
}
</script><br />
<h3>Introduction – A Word Of Warning</h3>First off - I <strong>do not</strong> recommend you write your own hand-rolled data access solution for an OO .NET application. Ayende has a <a href="http://ayende.com/Blog/archive/2006/05/12/25ReasonsNotToWriteYourOwnObjectRelationalMapper.aspx" target="_blank">great post</a> that should convince you to use something like <a href="http://nhforge.org/" target="_blank">NHibernate</a>, <a href="http://www.llblgen.com/" target="_blank">LLBLGen</a>, <a href="http://en.wikipedia.org/wiki/ADO.NET_Entity_Framework" target="_blank">Entity Framework</a>, or <a href="http://en.wikipedia.org/wiki/LINQ_to_SQL#LINQ_to_SQL" target="_blank">Linq2Sql</a>. I strongly agree with him. I’ve worked on several projects which had a hand rolled, stored procedure based DAL. All of the DALs that were of a medium-to-large-size eventually turned into a huge mess, or something with tons of friction and poor performance. That being said, I am not allowed to use an ORM at my current employer, and I know that many others are not as well. That being the case, I think this post may be of use for other people in the same situation.<br />
<br />
Secondly – I specifically used the word “practical” to describe this strategy. Although there are ways to do this sort of thing with code gen and/or reflection, I am going to assume that most places that don’t use ORMs will find those techniques to be too complex.<br />
<br />
Thirdly – This article is focused on the lazy loading aspect of the sample code. The implementation / organization of the data access layer is not to be taken as best practices. It is organized in a way to be easily understood, and so it does not get in the way of the topic at hand. I am also ignoring many other features of a robust data access layer (change tracking, transactions, etc…) as I think they do not need to be understood in order to put this concept in action. However, there is nothing about this implementation that would exclude it from being used with other ORM concepts.<br />
<h3>Terminology</h3>As far as this article is concerned, here are the operational definitions of the core terms:<br />
<br />
<strong>Entity: </strong>An object that is persisted to the database that has business related behaviors.<br />
<br />
<strong>Data Access Object (DAO): </strong>A DAO is a data access layer (DAL) object that has the responsibility of calling the database and mapping the results to entities. The Repository Pattern is a relative of the DAO pattern.<br />
<br />
<strong>Persistence Awareness (PA):</strong> An entity that is persistence aware is one that is responsible for its own persistence.<br />
<br />
Examples: <pre class="csharp" name="code">var myClass = MyClass.LoadByID(id);
myClass.Save();
</pre>A PA entity is either directly or indirectly aware of its data store and is responsible for coordinating the persistence of its children. When the persistence methods are called, it news up the appropriate DAO and gets the results back.<br />
<br />
<strong>Persistence Ignorance (PI): </strong>An entity that is persistence ignorant relies on other classes to handle the responsibility of persisting it.<br />
<br />
Example:<br />
<pre class="csharp" name="code">var myClassDAO = new MyClassDAO();
var myClass = myClassDAO.GetByID(id);
myClassDAO.Save(myClass);
</pre>The coordination of persisting and retrieving child entities is also handled by the external class.<br />
<br />
<strong>Lazy Loading: </strong>Lazy loading is a term that refers to delaying the retrieval of a child collection until it is accessed. This is done to save trips to the database and to reduce application memory consumption. Consider the following code:<br />
<pre class="csharp" name="code">var userDAO = new UserDAO();
var company = userDAO.GetByName("Hardees");
Console.WriteLine(company.Name);
foreach(var employee in Company.Employees)
{
Console.WriteLine(employee.Name);
}
</pre>If we are using lazy loading, the employee collection would not be loaded until we hit the body of the foreach loop. If we were using eager loading, the employee collection would have been loaded when the company was loaded.<br />
<br />
<h3>Why should PI be preferred to PA?</h3>There are two reasons which are a bit related. First off, persistence code tends to be tricky and long winded. Often times there is more persistence code in a PA class than business logic. Secondly, you always want to give your class as few responsibilities / reasons to change as possible. The code in your entities should focus on business behavior rather than infrastructure concerns such as persistence.<br />
<br />
<h3>If PI is preferred, why do most hand rolled data access layers use PA?</h3>In my experience, people usually prefer PA because it makes lazy loading extremely easy. The typical pattern is to hit the database when a property is accessed and its backing field is null. This is a very easy pattern to understand, but unfortunately it sticks our entities with all of the overhead and complexity of persistence concerns.<br />
<br />
<h3>Less Talk, More Rock!</h3>Now that we have all the background out of the way, let’s take a look at an implementation I’ve tried recently that seems to work well and is very easy to understand. It comes down to two classes which are coordinated by the application's DAO classes. These two classes are:<br />
<ul><li><strong>LazyLoadingList<T> </strong>- This is a wrapper around List<T> which triggers a load whenever one of its methods is called.<br />
</li>
<li><strong>LoadDelegate<T> </strong>-<strong> </strong>This is the delegate that is executed when a LazyLoadingList<T>’s load method is triggered. </li>
</ul>Here is the code for the LazyLoadingList<T>:<br />
<pre class="csharp" name="code">public class LazyLoadingList<t> : IList<t>
{
private List<t> _list;
private LoadDelegate<t> _loadDelegate;
public LazyLoadingList(LoadDelegate<t> loadDelegate)
{
_loadDelegate = loadDelegate;
}
public void Load()
{
_list = _loadDelegate().ToList();
Loaded = true;
}
private bool Loaded { get; set; }
private void LoadIfNotLoaded()
{
if (!Loaded)
{
Load();
}
}
#region Implementation of IEnumerable
public IEnumerator<t> GetEnumerator()
{
LoadIfNotLoaded();
return _list.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
LoadIfNotLoaded();
return _list.GetEnumerator();
}
#endregion
#region Implementation of ICollection<t>
public void Add(T item)
{
LoadIfNotLoaded();
_list.Add(item);
}
public void Clear()
{
LoadIfNotLoaded();
_list.Clear();
}
public bool Contains(T item)
{
LoadIfNotLoaded();
return _list.Contains(item);
}
public void CopyTo(T[] array, int arrayIndex)
{
LoadIfNotLoaded();
_list.CopyTo(array, arrayIndex);
}
public bool Remove(T item)
{
LoadIfNotLoaded();
return _list.Remove(item);
}
public int Count
{
get
{
LoadIfNotLoaded();
return _list.Count;
}
}
public bool IsReadOnly
{
get
{
LoadIfNotLoaded();
return ((ICollection<t>)_list).IsReadOnly;
}
}
#endregion
#region Implementation of IList<t>
public int IndexOf(T item)
{
LoadIfNotLoaded();
return _list.IndexOf(item);
}
public void Insert(int index, T item)
{
LoadIfNotLoaded();
_list.Insert(index, item);
}
public void RemoveAt(int index)
{
LoadIfNotLoaded();
_list.RemoveAt(index);
}
public T this[int index]
{
get
{
LoadIfNotLoaded();
return _list[index];
}
set
{
LoadIfNotLoaded();
_list[index] = value;
}
}
#endregion
}
</pre>Here is the code for the LoadDelegate<br />
<br />
<pre class="csharp" name="code">public delegate IEnumerable<t> LoadDelegate<t>();
</pre><br />
<h3>The Demo</h3>I’ve put a <a href="http://github.com/dauger/BlogSamples/tree/master/LazyLoadingCollections/" target="_blank">demo up on Github</a> that ties this altogether. The project is organized as follows:<br />
<br />
<p><a href="http://lh3.ggpht.com/_q7jyIQc7ftY/S2ZgSyylYBI/AAAAAAAAAHY/TRps3_UgVXA/s1600-h/LazyLoadingCollectionsProject%5B6%5D.jpg"><img style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="LazyLoadingCollectionsProject" alt="LazyLoadingCollectionsProject" src="http://lh5.ggpht.com/_q7jyIQc7ftY/S2ZgTfARuEI/AAAAAAAAAHc/qvR2N3cVA2E/LazyLoadingCollectionsProject_thumb%5B4%5D.jpg?imgmax=800" border="0" width="296" height="491" /></a><br />
The Employee load delegate gets wired up in the Company DAO like so:</p><br />
<pre class="csharp" name="code">public class FakeCompanyDAO : ICompanyDAO
{
List<company> _companiesInDatabase = new List<company>
{
new Company(){Name = "ACME"},
new Company(){Name = "Hardees"}
};
#region Implementation of ICompanyDAO
public Company GetByName(string name)
{
// Pretend we are calling / mapping from a store procedure
var company = _companiesInDatabase.Where(x => x.Name == name).First();
if(company != null)
{
company.Employees = new LazyLoadingList<employee>(
() =>
{
var employeeDAL = new FakeEmployeeDAO();
// To demonstrate when loading is happening
Console.WriteLine("Loading Employees");
return employeeDAL.GetByCompanyName(name);
}
);
}
return company;
}
#endregion
}
</pre><br />
The Demo program code:<br />
<br />
<pre class="csharp" name="code">class Program
{
static void Main(string[] args)
{
ICompanyDAO db = new FakeCompanyDAO();
var company = db.GetByName("Hardees");
Console.WriteLine("Company Loaded: " + company.Name);
Console.WriteLine("About to iterate Employees");
foreach(var emp in company.Employees)
{
Console.WriteLine(emp.Name);
}
}
}
</pre><br />
The output:<br />
<br />
<p><a href="http://lh6.ggpht.com/_q7jyIQc7ftY/S2ZgToyhq4I/AAAAAAAAAHg/-cnZM485QoU/s1600-h/Output%5B10%5D.jpg"><img style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="Output" alt="Output" src="http://lh4.ggpht.com/_q7jyIQc7ftY/S2ZgT6jetrI/AAAAAAAAAHk/ma1VCqMxEDE/Output_thumb%5B6%5D.jpg?imgmax=800" border="0" width="432" height="250" /></a><br />
</p><br />
<h3>Possible Improvements </h3>There are many possible improvements to this strategy depending on how far one is willing to go. It would be very easy to auto wire up everything with one generic delegate if DAO semantics were uniform across DAOs etc…<br />
<br />
Source code: <a title="http://github.com/dauger/BlogSamples/tree/master/LazyLoadingCollections/" href="http://github.com/dauger/BlogSamples/tree/master/LazyLoadingCollections/">http://github.com/dauger/BlogSamples/tree/master/LazyLoadingCollections/</a><br />
<br />
<br />
UDPATE: This technique has been reworked for .NET 4.0 <a href="http://mynerditorium.blogspot.com/2010/04/persistent-ignorant-lazy-loading-for.html">here</a>.daugerhttp://www.blogger.com/profile/12756737682194998551noreply@blogger.com0tag:blogger.com,1999:blog-9167981196729784488.post-56693504247308753002010-01-09T21:43:00.001-06:002010-01-09T21:43:56.220-06:00Gnome Evolution’s Missing Feature<p>Here is a screenshot of the Windows Live Email account setup: <br /><a href="http://lh6.ggpht.com/_q7jyIQc7ftY/S0lM9praO_I/AAAAAAAAAHA/yMlttjKgJ3Q/s1600-h/LiveMail%5B8%5D.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="LiveMail" border="0" alt="LiveMail" src="http://lh3.ggpht.com/_q7jyIQc7ftY/S0lM962WcFI/AAAAAAAAAHE/-JnbyW7Qan4/LiveMail_thumb%5B4%5D.jpg?imgmax=800" width="392" height="473" /></a> </p> <p>Here is a screenshot of Thunderbird’s account setup: <br /><a href="http://lh6.ggpht.com/_q7jyIQc7ftY/S0lM-Pk8kQI/AAAAAAAAAHI/Z-ByxWGIAI4/s1600-h/thunderbird%5B5%5D.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="thunderbird" border="0" alt="thunderbird" src="http://lh3.ggpht.com/_q7jyIQc7ftY/S0lM-T7wsrI/AAAAAAAAAHM/aLWG7llHsLo/thunderbird_thumb%5B3%5D.jpg?imgmax=800" width="610" height="572" /></a> </p> <p>Here is a screenshot of Gnome Evolution’s account setup: <br /><a href="http://lh4.ggpht.com/_q7jyIQc7ftY/S0lM-g8oB6I/AAAAAAAAAHQ/UFgCxHSH044/s1600-h/evolution%5B4%5D.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="evolution" border="0" alt="evolution" src="http://lh5.ggpht.com/_q7jyIQc7ftY/S0lM-wDkf7I/AAAAAAAAAHU/5LTn0vxL3Oo/evolution_thumb%5B2%5D.jpg?imgmax=800" width="540" height="509" /></a> </p> <p>Notice anything? Evolution does not give you the option to leave email on the server until you delete it. This will lead to an inbox management nightmare for those of use who multi-boot. Evolution is very nicely integrated into Ubuntu, but sadly I cannot use it because of this missing feature.</p> daugerhttp://www.blogger.com/profile/12756737682194998551noreply@blogger.com0tag:blogger.com,1999:blog-9167981196729784488.post-25218495781468873852009-11-01T00:15:00.001-05:002009-11-01T00:17:48.429-05:00Having Ubuntu 9.10 WIFI Problems?<p>Apparently the new version of Ubuntu broke compatibility with a lot of wifi adaptors, including some relatively new USB adaptors. If you have upgraded to 9.10 but are having problems seeing and/or connecting to your wireless network you may want to try the following:</p> <p>1. Open the update manager<br>2. Click the settings button<br>3. Click the updates tab<br>4. Check the “Unsupported updates (karmic-backports)” checkbox<br>5. Open a terminal and type (and reboot): </p><pre>sudo apt-get install linux-backports-modules-karmic</pre><pre> </pre> daugerhttp://www.blogger.com/profile/12756737682194998551noreply@blogger.com8tag:blogger.com,1999:blog-9167981196729784488.post-69964667153887437342009-10-31T14:37:00.001-05:002009-10-31T14:45:34.548-05:00NHibernate 2.1.1 GA Released!<p>Fabio Maulo has <a href="http://twitter.com/fabiomaulo/status/5320546312">announced</a> the release of NHibernate 2.1.1 GA via Twitter.</p> <p>Get the bits and/or code here: <br /><a title="http://sourceforge.net/projects/nhibernate/" href="http://sourceforge.net/projects/nhibernate/">http://sourceforge.net/projects/nhibernate/</a></p> daugerhttp://www.blogger.com/profile/12756737682194998551noreply@blogger.com0tag:blogger.com,1999:blog-9167981196729784488.post-45014620566869599402009-10-25T22:59:00.001-05:002009-10-31T14:42:13.926-05:00Reactions to the Legacy Programmer Boss<p>There have been a couple blog responses to my “<a href="http://mynerditorium.blogspot.com/2009/10/state-of-spolsky-or-how-i-learned-to.html">Legacy Programmer Boss</a>” post. The first was by <a href="http://www.thoughtclusters.com/2009/10/the-legacy-programmer-boss/">Krishna Kumar</a> and the second was by <a href="http://www.politicsofdesign.com/2009/10/7-helpful-legacy-programmer-boss-tips.html">Mike Marshall</a>. Both bloggers really ran with the idea and came up with some very thoughtful and constructive posts. I’m very happy that neither of them reacted to the term as if I meant it in a pejorative way. Although I was a bit miffed at Joel, I didn’t mean it to be a pejorative. A person’s focus and expertise shift as they advance in their career. That being the case, it’s up to each and everyone of us to use our brain when assimilating advice from our peers and superiors. We are all responsible for thinking critically about any advice we take, no matter who it is from.</p> daugerhttp://www.blogger.com/profile/12756737682194998551noreply@blogger.com0