Twelve Days of .NET: Day 2: Dependency Injection / IoC

This post is part of my 12 Days of .NET series. This is a (not terribly ambitious) series of posts on .NET topics that came up while I was working on a recent C# Web API project.

One of the first things I wanted to figure out on this project was how to make use of Dependency Injection / Inversion of Control. I’d read about it before, but never really quite figured it out. The original source for the DI/IoC concept is from a Martin Fowler blog post from 2004.

I evaluated a few options for my project, and settled on using Autofac, which is a well-documented IoC container that works well with Web API. This video from Channel 9 helped me figure out how to get started with Autofac and DI in general.

I also considered Ninject and StructureMap. I don’t have much to say about those, since I didn’t wind up using them.

The end result of all this is that I think I finally have a decent working understanding of DI/IoC.

Twelve Days of .NET: Day 1: Web API

This post is part of my 12 Days of .NET series. This is a (not terribly ambitious) series of posts on .NET topics that came up while I was working on a recent C# Web API project.

For the .NET project that I’ve been working on recently, I’ve had to play a bit of “catch-up,” since I haven’t been doing too much .NET/C# development recently. My part of the project was to create a middleware API (for lack of a better term) that would provide a simplified internal interface to a more complicated external REST API. I decided to make my API a REST API also, since that’s pretty much the standard at this point. I’d done a lot of work with SOAP APIs in the past. And I’d created a REST API in .NET at least once before, using WCF. Back then, I probably started out by reading something like this article from 2008.

The way to do this stuff now is Web API. The most up-to-date way would be to do this in .NET Core. I couldn’t do that, for reasons that are kind of complicated and not worth going into. (Actually, at some point, I figured out that I probably could do it with .NET Core, but by that point I was too far along to go back.)

I used a few resources to get started. I watched a couple of video courses on Pluralsight: Jon Flanders’ Intro to ASP.NET Web API and Shawn Wildermuth’s Implementing an API in ASP.NET Web API. I also read the book ASP.NET MVC 4 In Action. This was somewhat out of date (last revised in 2012), but was still useful.

So let’s call that my day one post: I started a Web API project, using VS 2017, and the standard .NET Framework.

Twelve Days of .NET

Back around Thanksgiving, I got interested in stuff like the F# Advent Calendar, the C# Advent Calendar, and Advent of Code. I’ve been working on a pretty cool .NET project at work recently, and I got the idea that maybe I’d do a series of blog posts about various tools and techniques that I’d come across while working on this project. I haven’t written a lot of programming-related blog posts lately, so I though this would be a fun way to get some programming content back on the blog.

I originally thought I’d try to follow the Advent Calendar model, and do one post a day for 25 days, starting on 12/1. Then, when I didn’t get around to starting that, I thought maybe I’d do a Twelve Days of Christmas thing, and do twelve posts from 12/13-24. Now that it’s past Christmas, I’ve decided to just do twelve posts and skip the whole Advent/Christmas connection. I’ll just call it “12 Days of .NET”.

I’m not going to be too ambitious about this. Most of the posts will probably be short, and I’m not going to post a lot of code. Mostly just links to stuff that I found useful. I’ve got most of the posts written already (at least in rough form), so I’m going to set them up in advance to auto-post every day for the next twelve days.

Shin Godzilla

I finally got around to watching Shin Godzilla today. It’s a weird film, but it’s definitely worth watching. I started hearing interesting stuff about it last year, including good reviews from RogerEbert.com and Ars Technica.

It’s not a movie that I think mainstream American audiences would ever enjoy or understand. There are a lot of scenes of politicians and/or scientists sitting around conference room tables, talking. These scenes are well-done, and not at all boring, if you can keep up with the subtitles. (They’re talking really fast, so you do have to pay attention to keep up.)

The CGI effects are good, but not quite up to typical modern “Hollywood blockbuster” standards. Godzilla’s initial form is pretty weird-looking, but the creature evolves into something more closely resembling the typical Godzilla fairly quickly. Overall, I found the “Godzilla destroying Japan” scenes to be well-done and engaging (though occasionally funnier than they were probably supposed to be).

There’s a lot of stuff in the movie related to Japanese politics, particularly post-Fukushima. A lot of the political stuff reminds me of a manga I read years ago, the name of which I can’t remember right now. At any rate, it’s a lot more ambitious thematically than a typical monster movie.

I bought the movie on Blu-ray; I could really have gotten away with just renting it though. I may watch it again at some point, but really seeing it once was enough for me.

Eighties Nostalgia and weird Christmas stuff

The new Netflix series The Toys That Made Us looks like it should be fun. It looks like it’s concentrating mostly on toys from the 80s. I’m old enough that I was pretty much done with toys by 1980, but I did (of course) have some Star Wars toys. (Though maybe those were my younger brother’s toys, technically. Either way, they were pretty cool.)

My old friend Mike Pajaro is a guest on a recent episode of an 80s-themed podcast called Stuck in the 80s. The two regular hosts and Mike each pick a Christmas special from the 80s to talk about. Mike, of course, talks about the Alf Christmas Special. I was never a big fan of Alf, and have never seen this special, but it sounds like it’s a doozy. (If you’d rather read an amusing text summary of the special, rather than listen to my friend Mike describe it, read this.) The podcast is pretty funny. The other two Christmas specials they talk about are the Pee-Wee Herman special and the He-Man special.

Which reminds me that I added the Pee-Wee special to my Netflix queue when they added it a few years ago, but never watched it. I may have seen it when it originally aired, but I’m not sure. Either way, I should watch it this year. I haven’t really been in the mood for Christmas stuff this year, but I think I’d enjoy the Pee-Wee special.

And speaking of oddball Christmas stuff, I could really use a new Christmas-themed Radio Rashy episode, but I guess they stopped doing Radio Rashy, since there haven’t been any new episodes since 2015 or so. Maybe I’ll go back and listen to the Santa Claus is a Bitch episode, one of the last ones they did. (I’d love to grab one of their old Christmas Jukebox episodes, but I don’t think any of those are still available. I should have saved those mp3s.)

The Last Jedi and the tired old nerd

I really want to see Last Jedi this weekend, but I’m kind of sick, so I don’t want to sit through a loud, two and a half hour movie. (Also, it’s snowing out and very cold.) I checked Amazon to see if they had the novelization, thinking that maybe reading that would be a good substitute, but it’s not coming out until March 2018! That seems kind of crazy to me. I know most movies don’t even get novelizations anymore, but if you’re going to do one, it should come out at the same time as the movie.

When I was a kid, I didn’t get out to see a lot of movies, so my first exposure to many popular movies of my youth was through either the novelization, the comic book adaptation, or the Mad magazine parody. You don’t see a lot of novelizations or comic book movie adaptations anymore. (And Mad is only published bimonthly now.) I also remember that my first exposure to the plot of the original Star Wars movie was through an article in Famous Monsters magazine. I remember it being just basically a plot summary, with a bunch of stills from the movie. (They apparently published a Star Wars Spectacular in 1977, which may have been what I read, but I’m not sure.)

Anyway, I feel like I need an illustrated plot summary or a comic book version or something for the new Star Wars movie. The reviews have all been very good, including the NY Times review. (Though I haven’t read it all the way through yet.)

I also noticed that a graphic novel adaptation of the last Star Wars movie, Rogue One, came out just this week. It looks kind of weird. I think it’s supposed to be a “YA” version or something? I guess if I decide that I really need to read a Star Wars comic this weekend, I could buy that one.

SDCC Open Registration

Today is the day for open registration for San Diego Comic-Con. It’s a good day for it: it’s snowing outside, I have a cold, and there was a derailment on the Raritan Valley tracks yesterday. So going into NYC would have been difficult even if it wasn’t snowing and I didn’t have a cold.

I turned on my desktop computer early this morning and made sure it was current with Windows updates, Firefox updates, and any other updates I could think of, so hopefully nothing will get in the way of working through the registration process. I also am all stocked up on ramen noodles, herbal tea, and cough medicine.

I’ve completely failed to get tickets for the last few years, and I’ll probably fail again this year, but hey, I have to try!

New SSL certificate

This blog should now have a new, slightly less fancy, SSL certificate. I had been using a $49/year certificate from 1&1, my hosting provider. It was issued via GeoTrust, and worked fine. A while back, 1&1 switched me to a slightly more expensive plan that included a free SSL cert. But of course they didn’t automatically move the paid one over. And there wasn’t an obvious way to do it from the control panel. I meant to call them about it, and didn’t get around to it before the cert renewed in June. So I had planned on doing that at some point next year before it renewed again. But I got an email this week telling me that it would renew this month. I do have an invoice from them saying that I renewed it through June 2018, so I’m not sure why they think it’s expiring now. But that finally motivated me to call them and get the cert moved over to the free one. The call was pretty simple and easy: only a short hold time, and the rep I got spoke English well, fixed things quickly, and didn’t try to sell me on any new services. Looking at the cert in Firefox now, It looks like a perfectly good DigiCert certificate, good through December 2018. Now let’s see if they really canceled the old one, or if they try to bill me for the renewal next month.