Blog

Welcome to Steve Smith's blog!

  • Reviewing Scrumban the Book

    I’ve been reading a bunch of kanban and lean books recently as I work on my Pluralsight course on Introducing Kanban (not published yet – will link to it when it is).  The most recent one I’ve finished is Scrumban, Essays on Kanban Systems for Lean Software Development, by Corey Ladas (I’m doing the reviews in LIFO order).  I made a bunch of notes while reading this book, and it has a great deal of useful information.  I read David Anderson’s Kanban book first, followed by Benson and Barry’s Personal Kanban.  I think reading Scrumban last was definitely the right choice, though if I were recommending these books today I would most likely suggest someone start with … more

  • Updating Blog to Orchard and Switching Domains

    So, yesterday I posted a review of the new Asus Ultrabook and, as has become rather predictable lately, the virtual web server hosting my Graffiti-powered blog started having 100% CPU for quite a while after the post went live.  Now, I don’t get *that* much traffic, but apparently something with my configuration of Graffiti, the server, and the traffic that I do get is enough for it to bring that server to its knees.  And Graffiti, great though it was years ago, just had to go. I opted to go with Orchard for several reasons.  I’d been on the fence between Orchard and WordPress, but after using WordPress for some other one-off projects over the last 18 months, I’ve grown … more

  • Asus Zen Ultrabook First Impressions

    Last week a received a new Asus UX31E Zenbook Ultrabook laptop computer, which I’ve been putting through the paces.  I’d like to write up my thoughts on the unboxing and my initial impression of the machine, and I’ll write more in a few weeks once I’ve had some more time to use it.  Overall, I really like it so far.  It’s thin, light, shiny, and feels solidly put together.  It’s also extremely fast to start up and has a very reasonable active use battery life and a better sleep/standby battery life than any laptop I’ve ever owned. Unboxing I got my Asus Zenbook Ultrabook on Amazon, so of course it came in an Amazon box.  Inside the Amazon box was the Asus box: … more

  • Run Your Unit Tests in Parallel to Maximize Performance

    If you’re at all serious about testing, at some point you’re going to have a rather large suite of tests that need to run, and you’ll find that your builds are taking longer than you would like because of how long the tests run.  For example, consider this suite of 24 tests, each one of which looks like this one: If you run 24 of these, it’s going to take about 24 seconds, by default: Now of course it’s important to keep your unit tests and integration tests separate and to know which is which, but even once you’ve done that, anything you can do to speed up your test execution times is going to be a big help to your productivity.  Slow builds due to slow tests kill … more

  • Unit Test or Integration Test and Why You Should Care

    There remains a fair bit of confusion about what constitutes which kind of test.  Many developers are fairly new to testing, and tend to call any tests of their code “unit tests” even when they’re dealing with something substantially larger than a unit.  The tools don’t really help much here, since the various test runner frameworks all call themselves unit test frameworks, and the various test runners themselves almost universally refer to the tests they run as “unit tests” whether they are or not.  For instance, Visual Studio 2010 starts every new Test Project with a class called UnitTest1 and lets you add a new Unit Test, but nowhere does it mention Integration Tests, … more

  • CodeMash 2012 Sessions

    Last week I presented two half-day workshops at CodeMash’s PreCompiler on Wednesday (with Brendan Enrick), and a session on ASP.NET MVC 4 on Thursday.  CodeMash 2012 was an amazing conference and I’d like to personally thank the organizers as well as the attendees of my own events for making it such a great event.  I’ll post a separate write-up with my experiences shortly – for now I just need to get my slides and demos posted for folks who want them. Beginning Software Craftsmanship The morning PreCompiler was on Beginning Software Craftsmanship, and included some presentations on software craftsmanship, deliberate practice, testing, and pairing.  We had about 25 people in … more

  • Silverlight 5

    “The reports of my death have been greatly exaggerated.” – Mark Twain Today, Silverlight 5 is released and available for download!  The Release Candidate has been around for some time, and many of us were expecting the release in November.  Well, here it is, November 39th, and it’s here!  Here are some of the things that are New or Improved in Silverlight 5: Binding Improvements, including ICustomTypeProvider, Binding in Style Setters, DataContextChanged Event, and Custom Markup Extensions Support for the XNA 3D API for 3D graphics 3D Render Targets 3D surface composition settings 3D multi-sample anti-aliasing Other improvements to the … more

  • Handy EnumerableExtensions

    There’s a great site for finding extension methods, ExtensionMethod.net.  I don’t believe either of these came from there, and I’ve not (yet) submitted them there, but here are a couple of extensions on IEnumerable<T> that I’ve found useful recently. ForEach<T> The first one is simply a method that allows you to easily iterate over a sequence and perform an action on it.  This is a pretty commonly useful extension method, so much so that it’s now included in .NET 4.0 out of the box.  But if you’re using an older version of the framework, this is one you can roll yourself. public static void ForEach<T>(this IEnumerable<T> items, … more

  • View HTML Source of Email in GMail and Google Apps

    If you’re working on creating a pleasant-looking HTML email template for your site’s newsletter, you’ll want to test it out on the major email clients, including Outlook and GMail.  For instance, if you get The Code Project’s Insider Daily News in your GMail inbox, it will look something like this: Now, if you view the source for this page, you’ll get something that’s less than useful.  The whole thing looks like a giant <script> block and has no relation to the HTML that was in your email template.  Of course, the interface uses frames (iframes), and depending on your browser you can also view the frame source: Which will yield this: How useful! If you … more

  • Inner Fields and Lazy Initialization in C#

    Using lazy initialization in C#, a class’s state is set up such that each property’s get method performs a check to see if the underlying field is null.  If it is, then it calculates or populates the field before returning it.  This is a very simple and common approach, but it requires that the class follows a convention of only accessing the field via the property.  Unfortunately, there are no language features that can enforce this, so it’s possible for errors to creep in.  Here’s an example of this approach working correctly: public class Order { // other properties   private Customer _customer; public Customer … more

  • RazorEngine Performance and Template Caching

    I’ve been using RazorEngine on a project and have been impressed with its simplicity and ease-of-use.  However, the performance of the application isn’t quite where I need it to be, and I was pretty sure the issue was with how I was using RazorEngine, especially since I could anecdotally see that the processor consumption on the machine running the app was quite high, and looking at the running tasks it was clear that most of that was a result of csc.exe (C# compiler) activity. A bit of searching found this discussion thread on codeplex regarding the re-compiling of existing templates.  The issue is a known one with version 2.1, which is the current release and what I’m … more

  • Install Application as Service on Windows Server 2008

    You can use the sc.exe command to install an EXE as a service on Windows Server 2008.  There’s a good article on creating an application that can easily run as either a console app or as a service here.  From an administrator command prompt, the syntax is something like this: sc \\servername create MyService.ServiceName binpath= d:\services\Foo\Foo.exe displayname= MyService.ServiceName Note that for this particular utility, the command line options include the “=” sign in them, so you must have no space before the “=” and you must have a space after the “=”.   Also the server name must be preceded by \\ to work. Assuming it works, you should see something like this: … more

  • Using If This Then That to Automate Your Life

    I’ve just started getting into If This Then That (ifttt.com) and have set up a simple task that will update my Steve Smith Facebook Page whenever I post something here to my blog.  Getting this set up was extremely simple to do, and so far although I’ve only been using it for about an hour I’m quite impressed and enamored with ifttt.com.  Here’s how easy it is to set up something like this: 1. Register with ifttt.com This took 30 seconds. 2. Create a task If this (the trigger): Then (the action to take – create a new Link Post on my Facebook Page): End Result: This is actually the first post I’m making since adding this task, so if this post shows up on my … more

  • Working with Lazy Loading in Entity Framework Code First

    Entity Framework 4 has Lazy Loading built-in and enabled by default.  Here’s a quick bit of code to show you how to work with this feature.  To get started with this, simply create a new Console Application and in nuget (Package Manager Console), run this command: install-package EntityFramework.Sample This will install a simple blog post example.  Copy and paste the following into your Program.cs file (replace everything): using System; using System.Collections.Generic; using System.Linq; using System.Text; using EFExample.Models;   namespace EFExample { class Program { static void … more

  • 3 Tips to Improve Your Connection Strings

    Due to some database moves, I’ve recently been touching a lot of connection strings, which has me thinking about the topic.  In fact, I put together a short survey on twitter, and invited a bunch of developers and DBAs to share their thoughts, both on twitter and in the survey, on some issues relating to connection strings.  Here are three tips you should know about that, if you’re not already using, should improve your use of connection strings.   Use Windows Authentication (if you can) By far the biggest tip I can offer is that you should be using Windows Authentication.  You can find this guidance directly from Microsoft, when they discuss Choosing an … more

  • Speaking at DevReach 2011

    I’m very pleased to be speaking again at DevReach in Sofia, Bulgaria next month.  As usual, the conference has an amazing list of speakers (which I’m still somewhat amazed includes me), with Scott Hanselman making the trip out this year to give several sessions.  If you have the opportunity to attend, I highly recommend it.  There’s certainly no other conference in Eastern Europe that comes close. This year, I’ll be presenting on three topics.  The first is something new for me.  I’ll be co-presenting with Richard Campbell of DotNetRocks on Performance Tuning ASP.NET – Stories from the Trenches.  For this session, Richard and I are each going to share some of … more

  • Cleveland 2011 Software Engineering 101

    Next Friday, 7 October 2011, Microsoft in Cleveland is hosting a free one-day event focused on the basics of Software Engineering.  There are a handful of seats left before the event sells out.  You can learn more and RSVP for Software Engineering 101 here (until tickets run out).  The event is being held at the Microsoft office here: Microsoft Corporation 6050 Oak Tree Blvd Independence, OH 44131 Last year, the event sold out (well, “sold” is misleading, since it’s free), and it’s on track to do so this year as well.  Here’s some more information, from the event’s home page: This is a one-day, FREE event designed to improve your software development … more

  • Wiring up an AutoCompleteBox to a JSON Service in Silverlight

    I’m currently building an internal application for The Code Project that needs to be able to transfer the contents of some potentially very large files over the wire.  After considering various ways to get the data from point A to point B, we decided the easiest thing would be to process the text file on the client, and send batches of rows up to the server for processing.  Initially we looked at building a WPF client for this, but then switched over to Silverlight 4 since the rest of the application is web-based and we didn’t want staff to have to worry about a separate standalone application. Basically the files get translated into simple lists on the server, so the UI simply … more

  • Set JsonRequestBehavior to AllowGet

    If you’re working with ASP.NET MVC and JsonResult, you may encounter this error: This request has been blocked because sensitive information could be disclosed to third party web sites when this is used in a GET request. To allow GET requests, set JsonRequestBehavior to AllowGet.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: This request has been blocked because sensitive information could be disclosed to third party web sites when this is used in a GET request. To allow GET requests, set … more

  • Bidirectional Entity Foreign Key Names in EF Code First

    Ran into a small problem today, where I had two classes referring to one another using EF 4.1 Code First.  Let’s say I had a class Item and another class ItemHistory.  ItemHistory has a property of type Item that refers to the Item class.  Item, in turn, has an ICollection<ItemHistory> Histories property:  public class Item { public int Id { get; set; } public virtual ICollection<ItemHistory> Histories { get; set; } }   public class ItemHistory { public int Id { get; set; } public virtual Item Item { get; set; } } In my DbContext OnModelCreating() I have some code like this … more