hi, i’m paul kearney

a .net developer/architect, technologist, and all around good guy

Metacrawler.com, Now in the Cloud

- -

Not much to really see (it all looks the same), but a few weeks ago we migrated [MetaCrawler](http://metacrawler.com) to Amazon Web Services. All systems are go and working smoothly. We also moved several InfoSpace API partners into our AWS infrastructure, and we’ve been adding more and more every week. We’re quite pleased with the performance so far, both from a compute as well as network latency perspective. One of the great things we did in this project was to rethink the metrics we gather from our application. We’re collecting some great data that is providing rich insight into our application’s behavior. It’s great to see something happen, formulate a theory on why, and then use data to confirm (or reject) the theory. For our metrics gathering, we are using [StatsD](https://github.com/etsy/statsd) and [Graphite](https://github.com/graphite-project). These are great tools that let us add custom metrics to our applications and instances without a lot of fanfare. We’ve also built some custom tooling around metrics alerting and dashboards, but we’re continuing to investigate some third-party apps to compliment our work in this space.

Moving From dasBlog to Octopress/Jekyll

- -

I’ve decided to move this blog away from dasBlog and over to another platform, Jekyll. Jekyll is a static site generator - you create your posts as markdown files, run a command, and it generates all of the files for your blog as static html files.

Why move away from something more robust? Well, I’m not convinced it was more robust, and it added a lot of complexity to hosting it. Here’s my reasoning:

  • dasBlog requires a Windows server. I could host it somewhere pretty cheap, but with as much as I’ve written on this blog (more on that later), I really can’t justify spending money on hosting if I could do it for free.
  • Jekyll requires no databases, no write permissions to the server, no logins… It’s just a static site. Content is written on my laptop, static files are generated and then pushed to the server.
  • Jekyll is the engine behind GitHub Pages. That’s pretty cool. And you can host your Jekyll blog on GitHub pages for free.
  • I considered other blogging platforms, like WordPress, Movable Type, BlogEngine.Net, etc. They all have a host of great features. But in the end I don’t really need them. Minimal Viable Blog.

Another key reason for me personally is it allows me to learn some new technology that I’m unfamiliar with. Getting to look under the covers at the Ruby code driving Jekyll and making modificaitons is a fun learning experience.

Powershell AuthorizationManager Check Failed

- -

While debugging some Powershell scripts today, I started getting an error:

1
2
3
4
5
AuthorizationManager check failed.
At C:\Users\pkearne\setupPLT.ps1:6 char:14
+ ./logging.ps1 <<<<
    + CategoryInfo      : NotSpecified: (:) [], PSSecurityException
    + FullyQualifiedErrorId : RuntimeException

Waze

- -

A few days back on a DL I frequent, someone asked for a better traffic mobile app. The thread piqued my interest, but I really thought it would be a rehash of all the known apps out there.

You see, I commute 25.6 miles to work. Each way. And it’s right through the middle of Seattle traffic. In 2010 Seattle ranked #10 in the nation for the worst congestion. On a good day during commute hours it will take me about 1:15 to get to work. On a bad day it can be more like 1:45. As you can see, I spend a lot of time in the car. (I’ve also experimented with the Connector, Microsoft’s employee bus service, carpooling, and the Metro bus. There’s a few reasons I choose to still drive, but that’s not important right now).

There were a few replies to the thread suggesting traffic apps: Google Maps, the Washington DOT app, bla bla bla. The problem is they are all terrible. Horrible. They show you traffic, but they don’t help you make any intelligent decisions about which route to take (I have three routes I can take). And they never seem to be accurate enough. There’s plenty of times I’ve been stopped in traffic while Google maps happily shows the road I am on as yellow (meaning slow, but not stopped).

One app was mentioned that I had not heard of before: Waze. The idea behind it is pretty brilliant – crowd sourced traffic. They are not the first to do it, but they’ve built a pretty cool app around the concept.

Remember, Controller Classes Need to Be Public

- -

File this one under Duh! I was troubleshooting a routing issue I was having with a portable area in ASP.Net MVC. For some reason I kept getting a 404. The solution was pretty big, so I created two new projects to try and isolate the problem.

I created a new web project and a class library for the portable area. Added my routes to the area, created a new class, renamed the class MyController, wired it all up, and got the same thing.

I installed Glimpse to see what routes were being hit. But Glimpse only works if ASP.Net handles the request, and since it was a 404, I couldn’t see the Glimpse data.

VerificationException: Operation Could Destabilize the Runtime

- -

I came across this exception this morning while playing with RavenDB. A quick search shows several people have seen this exception but not a lot of solutions.

I’m not sure why, but this exception in my case was related to IntelliTrace. I turned IntelliTrace off and the exception went away. Weird.

BTW - this isn’t related to RavenDB. According to this post, the issue is a bug in IntelliTrace.

VB6 and .Net Interop Fun

- -

A friend of a friend asked me to help with a project. He is a VB6 developer. Still. But he needed to incorporate a .Net component into the VB6 application in an easy way. So I’ve been helping him out, building up a .Net control using the Microsoft Interop Toolkit. It’s a free add-in to Visual Studio that takes away a lot of the complexities in building COM interop components in .Net.

I learned something painfully recently while helping out:

If your .Net control throws an exception, VB6 will report that to you as an “out of memory” error. That’s it - no details, call stack, or anything else about the actual exception. Misleading and frustrating. Not that I would expect VB6 to give me the call stack from .Net, but “out of memory” is not only unhelpful but it is disinformation.

I should have remebered this one. We were getting the “out of memory” error in VB6 in design mode and couldn’t figure out what the problem was. The error popped up immediately when opening the form designer in VB6. After much trouble trying to get VB6 to actually tell us what the problem is (we never got any information out of it, even after enhanced interrogation using WinDbg), it was real simple - we had a bug in a property setter. When the control was instantiated, VB6 was calling the setter, getting the exception, and then barfing with the incredibly unhelpful error message.

My friends will inevitably laugh and make fun of me for playing with VB6 still. That’s fine. I’ve found the experience has led me to develop additional skills and learn more about .Net development along the way.

Principles vs. Methods in Software Development

- -

I just posted on our Development@msnbc blog some thoughts on Ralph Waldo Emerson’s quote and it’s applicability to software development.

As to methods there may be a million and then some, but principles are few. The man who grasps principles can successfully select his own methods. The man who tries methods, ignoring principles, is sure to have trouble.

- Ralph Waldo Emerson (1803-1882)

Give it a read at here and let me know what you think!

DasBlog: Fixing 404’s for Mapped Urls

- -

Two things have been bugging me since I migrated this blog over to dasBlog: I started getting a bunch of 404 errors for urls that are mapped to dasBlog handlers, and getting a better html editor wasn’t working.

404’s for things like deleteitem.aspx, blogger.aspx, etc.

This fix was simple. I am running this site on Windows Server 2008 R2, and the application pool was in Integrated Mode. Switching to Classic Mode got all of the handler mappings working. I’ll need to dig around in the web.config to get the handlers migrated to IIS7.5 syntax so I can go back to Integrated Mode. This fix also got comments working.

Setting TinyMCE as the editor

I had downloaded the TinyMCE editor adapter from John Forsythe, but it never worked. There seemed to be people with similar issues, but no resolution. This was even worse for me, because since I was getting 404’s for blogger.aspx, I couldn’t use Windows Live Writer either. I resorted to handcrafting my html. Yuck. This one was simple to fix, but I didn’t figure it out until I installed the wonderful ELMAH. Looking at the Elmah logs showed this error:

1
tinymce\jscripts\tiny_mce\tiny_mce_gzip.aspx(5): error CS0246: The type or namespace name 'ICSharpCode' could not be found (are you missing a using directive or an assembly reference?)

In the installation instructions, it said that you don’t need to install the ICSharpCode.SharpZipLib.dll, because it’s the same one installed with dasBlog. But the version of dasBlog I was running didn’t have that assembly. A quick search and download, and voilla – TinyMCE is working!

Entity Framework: Use Properties for Your Entities

- -

I’ve been banging my head against what seemed to be a very simple problem. Using the new Entity Framework 4.1, I created a simple entity class:

1
2
3
4
5
6
7
public class ElectricityMeasurement
{
    public int Id;
    public float Kwh;
    public float Volts;
    public long Ticks;
}

I kept getting an error complaining about no key being set for the entity:

1
2
3
4
5
6
7
8
System.Data.Entity.ModelConfiguration.ModelValidationException :
One or more validation errors were detected during model generation:

System.Data.Edm.EdmEntityType: : EntityType 'ElectricityMeasurement'
has no key defined. Define the key for this EntityType.

System.Data.Edm.EdmEntitySet: EntityType: The EntitySet ElectricityMeasurements
is based on type ElectricityMeasurement that has no keys defined.

But Entity Framework has conventions that should pick up the Id as the key? I even added a [Key] attribute to that property with no luck. Then it hit me: Entity Framework works with properties, not variables:

1
2
3
4
5
6
7
public class ElectricityMeasurement
{
    public int Id { get; set; }
    public float Kwh { get; set; }
    public float Volts { get; set; }
    public long Ticks { get; set; }
}

And all is well.