Rossipedia

Code, music, and other junk

Elmah, Emails, and ServiceStack

As you can probably tell, I love ServiceStack. I also love Elmah, especially the the email notifications that it provides.

However, the two don’t really talk to each other out of the box. Sure, ServiceStack offers a ElmahLogFactory for handling errors and the like, and that works fine. But that only writes to the configured log. Emails are nowhere to be found. At least not in my project.

Integration Testing With ServiceStack

I’m doing a lot of ServiceStack development these days, and loving every minute of it.

One of the things I wanted with my integration tests was a controlled environment. I wanted to be able to set the connection string for the test database, and run full-stack tests on my services using NUnit via ReSharper’s test runner. However, I also wanted to be able to step through (F11) seamlessly from a given test case to the service code without missing a beat. Since my services were configured to run under ASP.NET/IIS, that last part required some thought.

Habit Driven Development

I am constantly amazed at the difficulties that we have to deal with day in and day out as a software developer due to somebody failing to just stop and think about what it is they’re developing.

I’m working on a project right now where the models (if you can call them that) are field-for-field equivalent to the database tables.

Now, that in and of itself is fine, if those models were strictly used as DTOs (data transfer objects).

But no. Those models are used throughout the entire system.

I’ve run into this before, quite a bit. This idea that “SQL Server is GOD!!!! The most important thing we need to do is get the DB structure right. Everything else is secondary”. Whenever I hear an idea like that I just want to punch that person in the face.

The more I work on it, the more I run into this idea that it’s being done a certain way, because that’s “how it’s done”.

There’s no drive to figure out a better way. Things are just done a certain way because that’s how they’ve always been done.

Habit driven development.

Somebody shoot me.

IR_Black for MinTTY

Wanted to get an IR_Black color scheme for .mintty to match vim, so I whipped up the following:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Black             = 78,78,78
Blue              = 150,203,254
Cyan              = 198,197,254
Green             = 168,255,96
Magenta           = 255,115,253
Red               = 255,108,96
White             = 238,238,238
Yellow            = 255,255,182
BoldBlack         = 124,124,124
BoldBlue          = 181,220,254
BoldCyan          = 223,223,254
BoldGreen         = 206,255,171
BoldMagenta       = 255,156,254
BoldRed           = 255,182,176
BoldWhite         = 255,255,255
BoldYellow        = 255,255,203

Just add this to your ~/.minttyrc file, and you’re good to go.

The Art of Forgetting

I’ve found that one of the most useful skills I have is knowing what to forget. Let me ask a question to demonstrate my point.

Which of the following pieces of data is more useful?

  1. Knowing the entire API of `System.Collections.Generic.List<>’
  2. Knowing how to search the MSDN docs for the API to List<>

I forget orders of magnitude more things about programming in an average day than what I remember. But what I do remember are the important pieces of information that I can use to find what I need.

The Tweet Rule

I ran across this lovely little interface method today:

1
2
3
4
5
6
7
8
9
10
11
public interface IOrderProcessor
{
  TransactionResponse CreateOrder(
      Cart cart,
      string email,
      Payment payment,
      Address billingAddress,
      Address shippingAddress,
      string notes,
      int orderId);
}

ReSharper.VirtualQuickFix Plugin

This is a simple plugin based on Hadi Hariri’s blog post on creating plugins for ReSharper. I actually had a need for this in one of my projects, so I figured I’d try my hand at the plugin. Unfortunately, it was written for an older version of ReSharper and didn’t translate exactly. So this is an updated version of the plugin for ReSharper Version 7.x

Aaaaaaaand It’s Gone

Aaaaaaaaaand here we are, up on Github pages and using Octopress. Weeee!

This was actually kind of fun. I think I might actually get some blogging done!

Blog Moving

Like so many others, I will be migrating my blog over to Github Pages, using Octopress. I’m a programmer at heart, and I feel more at home on the Terminal/Command prompt than anywhere else, so we’ll see if I actually post more often as a result.