Archives

Archives / 2010 / October
  • Time Spent Green

    I’ve been a fan of continuous integration for what seems like forever.  It’s an amazing way to boost the quality of your code and ensure that what gets checked into your repository is working code.  It also does a great job of eliminating the “it works on my machine” syndrome that is so common without such a tool.  If nothing else, having a separate machine run your build directly from what’s in source control, even without any testing involved, will tell you if what you’ve checked in actually sufficient. Of course, once you have a build, the goal is to keep it green.  You should follow the check-in dance to minimize the chance of build breakage.  When the build … more

  • The Message Is The Message Received

    I recall early on in my military career, in an ROTC class, learning about communication.  Communication is very important in the military, and at least as important in civilian life.  Especially today, when there are so many ways to communicate, and so many ways to communicate poorly. In a recent twitter conversation, I was reminded of one of the lessons from this class, which was summed up as “The Message Is The Message Received.”  The twitter conversation went like this:   I did a quick search to see if I could find a reference that uses the nugget of knowledge that I recall from the course, and was unsuccessful.  Here’s a super-brief communications 101 … more

  • Use Interfaces for Metadata and Comments

    If you’re using XML Comments for intellisense purposes, or are making heavy use of attribute-based metadata in your classes, you’ve likely found that these have a tendency to bloat your code and make it more difficult to follow.  For example, consider this simple configuration section handler: 1: public class DemoSettings : ConfigurationSection, IDemoSettings 2: { 3: private static readonly DemoSettings settings = 4: ConfigurationManager.GetSection("DemoSettings") as DemoSettings; 5:  6: public static DemoSettings Settings 7: { 8: get { return settings; } 9: } … more

  • When To Comment Your Code

    My opinions on comments in software code have evolved with my experience.  When I was a teenager first learning to program for real, I rarely used comments unless the code was for an assignment, in which case it was a forced exercise every bit as much as teachers’ requests to “show your work” added verbosity to my math and science problems’ solutions.  Of course, the programs themselves were quite simple, and the languages used (BASIC, Pascal) didn’t really support OOP (not that I knew what that was).  And it was important, then, to be able to express the intent of the code in English, if only so the instructor knew what was being attempted.  … more

  • DevReach 2010

    This past week I had the good fortune of traveling to Sofia, Bulgaria to speak at DevReach for the second time (the first was 2 years ago in 2008).  This is a great conference and was held for the second year in a row at a movie theater, which worked very well (similar to StirTrek in Ohio each year).  The event included a great list of speakers, including Scott Stanfield, Beth Massie, Andrew Brust, Donald Belcham, Stephen Forte, Lino Tadros, Miguel Castro, and Sahil Malik.  Michelle was able to join me again this year, which worked out well since Telerik is one of her/NimblePros’ clients. The Venue The conference was held at the Arena Kino (cinema), which you can see here … more

  • SQL Table Cleanup Job

    It’s pretty straightforward to create a job in SQL Server that will clean up a table.  For instance, for AspAlliance.com I use ELMAH to record errors, and it’s set up to go to a database table (called ELMAH_Error – see image at right).  While doing some maintenance, I noticed that this table had several months’ worth of data in it and over 400k records (many of which were simply 404s).  This was needlessly bloating the size of the database, so I did a quick delete to take care of it.  Personally, I’m interested mainly in 500 errors, but I don’t mind seeing the odd 404 error in the log as sort of a sanity check to make sure I haven’t done something stupid.  So the … more

  • The CHECK_POLICY and CHECK_EXPIRATION options cannot be turned OFF when MUST_CHANGE is ON

    In addition to the dreaded SQL Server Error: User Group or Role Already Exists in the Current Database error, you may also get this error when creating new logins after a database move: Alter failed for login ‘somelogin’. An exception occurred while executing a Transact-SQL statement or batch. The CHECK_POLICY and CHECK_EXPIRATION options cannot be turned OFF when MUST_CHANGE is ON. (Microsoft SQL Server, Error: 15128) The fix for this is to change the password.  You can do this via script like so: USE Master GO ALTER LOGIN [somelogin] WITH PASSWORD = ‘samepassword’ GO ALTER LOGIN [somelogin] WITH       CHECK_POLICY = OFF, … more

  • LINQ Range Variable Problem

    Ran into this issue last night and just figured it out.  I have this code for a demo: using System;using System.Data.Objects;using System.Transactions;using ExtractTransformLoad.Domain;using Northwind.Entities;//using System.Linq;namespace ExtractTransformLoad{ public class SqlFreightByShipperRepository : IFreightByShipperRepository { public void DeleteAndInsert(DateTime runDate, FreightByShipper freightByShipper) { using (var context = new NorthwindEntities()) using (var scope = new TransactionScope()) { var summaryToDelete = (from freightSummary in context.FreightSummaries … more