Archives

Archives / 2011 / June
  • Single Payee Credit Cards for Recurring Payments

    Have you ever set up a recurring payment with a vendor using a credit card?  I have.  It’s very convenient, both for the consumer and the vendor, because neither one needs to be bothered with invoicing and paying bills on a regular basis.  Everything’s great, as long as the consumer really does still want the product or service offered by the vendor, and as long as the vendor is ethical and diligent about allowing the customer to cancel their service.  It’s this last bit where things sometimes break down, and which is why a large number of people choose not to use any kind of automated billpay, whether through their bank or by sharing credit card details.  If the … more

  • Everything You Need to Get Started with SpecFlow and WatiN

    I’m adding SpecFlow to an application I’m working on so that I can add some acceptance tests that actually exercise the user interface.  I’ve only spent a couple of hours on it thus far, but I have it working with a single specification running through the tests via WatiN.  I found the following resources helpful as I was going through this exercise: Getting Started with SpecFlow and ASP.NET BDD with SpecFlow and ASP.NET MVC BDD with SpecFlow BDD with SpecFlow and Watin WatiN – Web App Testing in .NET I’m assuming that you’re just interested in getting up to speed with SpecFlow for acceptance testing and that you don’t want to waste any time on hidden gotchas or … more

  • Dayton .NET User Group Talk on Anti-Patterns and Worst Practices

    Last night I spoke at the Dayton .NET User Group on the topic of Anti-Patterns and Worst Practices.  It was a pretty good-sized group, albeit rather subdued.  You’ll find some of the inspiration for the talk in my Principles, Patterns, and Practices of Mediocre Programming post, and others in the 97 Things Every Programmer Should Know book (or online here).  The slides and demos are available for download.  Thanks to those of you who came to the meeting, and to Joe for inviting me to come down and visit. more

  • Seth Godin The Dip

    I picked up The Dip by Seth Godin a while back and thought I’d post my thoughts on it.  It’s a quick read, at only 80 pages or so.  I’m generally a fan of Seth’s books, and I enjoyed this one.  His style is entertaining to read, and the book was worth the < $10 it cost on Amazon.  The key takeaway from this book is that when you hit the hard part of any activity you’re pursuing, you determine whether it’s worth it to push through to the end goal.  He makes a good point that winners know when it makes sense to quit, and basically choose their battles.  One of the principles of software development that I try to adhere to is to fail fast, which I think is … more

  • Copy a Table with data in SQL Server

    Sometimes when you’re about to do some major surgery on your database, you want the comfort of knowing that you can always rollback if there’s a problem.  And it’s not always the case that you’ll immediately know there was a problem.  Sometimes, you just want a copy of the original data so that you can go back to it, or use it to analyze where you went wrong.  Of course, you can backup the whole database, but restoring the full system is often overkill if you’re only working on a handful of tables, not to mention the fact that backups are rather cumbersome and slow compared to standard SQL statements.  What if you just need a complete copy of the data from one table in … more

  • Regional Differences

    Last week I ran a poll (that maxed out at 400 responses on twtpoll) asking how developers recommend using regions in C# (or not).  You can see the results here:

    About 15% of the respondents chose Other and/or chose to leave a comment.  The comments are useful because they often highlight answer categories that I overlooked when I set up the poll.  In this case, there were a lot of comments, I think because there are a lot of different opinions about regions in general, some of them rather heated.

    Clearly the largest number of respondents simply never use Regions.  A number of comments went on to say things like “Regions aren’t evil I just don’t know … more

  • Using Google Realtime Search to track Trends

    You can use Google’s Realtime search feature to track trending topics on social media networks like Twitter.  To find it, just do a search as usual, then click on the More icon on the left to open up the Realtime option (or just go to http://google.com/realtime). The default view will show you the most recent items for the given term(s).  You’ll also see a timeline showing the frequency with which the term(s) have appeared over a given time period. If you’re hosting an event (like the Stir Trek developer conference in Columbus, Ohio) and have set up a hashtag for the event, this can be very useful to see how things are going on the day of the event: Now, what I haven’t … more

  • How Developers Are Using var in C#

    The var keyword was introduced in C# 3.0, and has since gained quite a bit of popularity.  There is also a fair bit of contention over how it should be used, with posts like this one (with which I happen to agree) being not uncommon.  Over the last week I posted a couple of polls on twitter that asked about specific scenarios in which one might use var, trying to address the two scenarios outlined by the author of that post. Scenario One This was meant to depict the case where the type would appear twice on one line, and so using var makes the code more succinct while no less clear. http://twtpoll.com/r/a3w7j7 75% of respondents agree that this is a scenario in which you … more

  • On the Usefulness of Xml Summary Comments with Poll Results

    Last week I hosted a quick poll on Twitter about how useful a particular XML comment was for a particular class.  The code looked like this: /// <summary>/// Repository for handling Users./// </summary>public class UserRepository : Repository<User> The poll actually got 355 votes, which is pretty impressive.  In hindsight I should have added an option relating to generating documentation, or updated the “necessary evil” option to include documentation as a valid reason for having these, since a large number of comments pointed to documentation as a motivation for this.  Or intellisense.  Personally I don’t see how the above would provide me … more

  • Entity Framework Error - Model compatibility cannot be checked...

    If you’re using Entity Framework Code First and you have everything working with, for instance, a SQL CE database, but then you want to move to a full SQL Server database, you may encounter this message if you don’t do things in the right order.  In my case, what I did was open SQL Management Studio, Create my new database, then popped into Visual Studio, Server Manager, added a connection to it.  Then I grabbed the connection string and stuffed it into my config file.  When I ran my application, I got this error message: Model compatibility cannot be checked because the database does not contain model metadata. Ensure that IncludeMetadataConvention has been added … more