This post reuses a Transcoder and Codecs to encode and decode resources into documents for database persistence.
Part 5/5 – Content Negotiation Series
Let’s reuse the Codecs and the Transcoder for an HTTP client to leverage our investment for good return on our investment.
Part 4/5 – Content Negotiation Series
This post introduces Codecs and the Transcoder. These extract and decouple the encoding / decoding from of the ASP.NET pipeline, making them reusable and testable. Our goal is to overcome the challenges noted in part 2 of this series.
Part 3/5 – Content Negotiation Series
In this post, we’ll explore how ASP.NET implements content negotiation. I’ll show how to customize the behavior and get full control. The associated example code shows how to use what ASP.NET Core provides, but please stick around for part 3-5, where we make things much better.
Part 2/5 – Content Negotiation Series
Content Negotiation is a powerful and core part of HTTP, but vastly under-utilized in ASP.NET Web APIs.
This post covers what it is and why you should use it. We also shop for donuts.
Part 1/5 – Content Negotiation Series
Twisten has been broken for a bit because Twitter moved their APIs to require TLS 1.2 for HTTPS connections. The app has been updated to use TLS 1.2, and is functional again.
.NET’s Parallel.For() will not play nice if you pass it a Task or an async lambda…
Please pardon my dust, while I move the blog into the new home on WordPress…
Twisten Updated! Twisten is my little app that reads your Twitter feed to you via text-to-speech, letting you keep your eyes on your work. Fixed: Authorizing and connecting to Twitter API. Prior version used an older library that only supported HTTP. Need to use HTTPS. Enhancements: Read tweets from a List. Just enter the list name and click play. The list must be one of your own lists. The app will attempt to remember the last position in each of the different lists that you listen to. To listen to your home timeline, leave the list name empty. Show… Continue Reading →
Visual Studio has code coverage built in, but only if you run VS Premium or better. Sometimes this isn’t available, which is what sent me looking for a free alternative. OpenCover fits this goal perfectly. The output isn’t as pretty as VS, but no worries. ReportGenerator has integrations with the OpenCover output and creates some really nice reports. Below is the output and the simple steps that worked for me. Summary page, with clickable links to details for each class. Class level summary, including cyclomatic complexity and per-method details. Source code lines with highlighting for quick visual inspection. Getting the… Continue Reading →
Q: “SQL run using a SqlTransaction is part of a SQL Server Transaction and can be rolled back.” A) TrueB) False The answer is of course “A”, right? That’s what I thought too. Basic SqlTransaction Usage Most of us assume that we can write this: This is plain and simple SqlTransaction based logic. Exec the command. If it completes without error, call Commit(). If it has an issue, then call Rollback(); But … What Does This Do? I challenge you to predict the behavior of the following “Retry” scenario. The code may seem a bit odd… Why would you execute… Continue Reading →
Today I released an updated version of the Monitored Undo Framework. Changes include: A new parameter on the DefaultChangeFactory’s methods for specifying the “description of the change”. This can be helpful in cases where the UI shows a list of the undo / redo changes. A new WPF sample that shows, in a simpler codebase, how to use the framework. Updated build script that compiles all solutions, run the tests, and package the NuGet package. These changes are also available via NuGet. Cheers!
There’s a first time for everything. Today, I got to use the attribute that prevents a method from being inlined. There’s a good post, including a bit of a warning, on the MSDN forums regarding the issue and solution. In my case, I was looking at the call stack to get the current method, so that I could pull some metadata attributes off of the method. Worked well until it hit the build server. Then the unit tests started failing. Adding the [MethodImpl(MethodImplOptions.NoInlining)] attribute did the trick. If you’re going to try this, I’d recommend the article, since it discusses… Continue Reading →
In some cases, I need to be able to build a query that has a variable set of OR conditions. This is not simple with the default language constructs and extension methods. It’s simple to dynamically build an expression that includes AND parameters, because that is what the WHERE() extension method does. Not so easy for OR’ing together a bunch of conditions. Enter LinqKit. This is a great library. It provides some easy to use (but powerful) extension methods that let you “Or()” some conditions together. A common case is where you get a list of values that you need to… Continue Reading →
If you haven’t used Fiddler, you should check it out. It shows you the HTTP traffic that is flowing over the wire. This can be a huge help when diagnosing issues. One small challenge is using Fiddler to view traffic that stays on the local machine. By default, fiddler cannot see data sent to http://localhost/ or http://127.0.0.1/. This is because the OS doesn’t push this data through the normal networking pipeline. One workaround is to use the name of your machine in the URL. So, if you have a machine named “Machine1”, you could use a URL of http://machine1/. The… Continue Reading →
One of the “Desert Island” picks from a recent “This Week on Channel9” episode mentioned a pretty cool utility that lets you share a keyboard and mouse between two computers without using a KVM switch. It’s a software based solution that you run on the primary and any other computers that you’re sharing. You can share many many computers if you want. In my case, I have a laptop and a desktop. I wanted to have a single keyboard, but not have to worry about a kvm switch. The software is called Synergy. You can get it at http://sourceforge.net/projects/synergy2/. It’s… Continue Reading →
This past weekend was my son’s cub scout pinewood derby race. I was point person on the committee that organized the event. My main task happened to be running the score board which was written in Excel. I found it quite interesting to be in a position where I was very dependent on the computer and the excel based “application” that we used to run the scores. The thing that surprised me was how nervous I was about the score board working right. The race was a points race with a specially organized set of pairings that rotated the races… Continue Reading →