The Monsters Weekly - Episode 94 - React with Server Side Rendering

React is a fantastic view engine and one of its best features is that it can be attached to pre existing markup. This allows us to render out HTML on the server side and then hookup React to it once all the JavaScript has been downloaded and started. We can get the best of single page application and the best of full web applications. In this episode we mash on speeding up single page react applications on the server.

 

References

 

React.net Tutorial

Are they isomorophic or universal

Getting Started with RabbitMQ in ASP.NET

In the last post we looked at how to set up RabbitMQ in a Windows container. It was quite the adventure and I’m sure it was woth the time I invested. Probably. Now we have it set up we can get to writing an application using it.

A pretty common use case when building a web application is that we want to do some background processing which takes longer than we’d like to keep a request open for. Doing so would lock up an IIS thread too, which ins’t optimal. In this example we’d like to make our user creation a background process.

Creating a Rabbit MQ Container

I bought a new laptop, a Dell XPS 15 and my oh my is it snazzy. The thing I was most excited about was that I’d get to play with Windows containers again. I have 3 other machines in the house but they’re either unsuitable for containers (OSX running Windows in parallels) or I’ve so toally borked them playing with early betas of containers they need to be formatted and reinstalled - possibly also thrown into the sun.

So when I found myself presented with the question “how can we get into messaging in our apps for free?” I figured I’d crack open the laptop and build something with MassTransit. I found that MassTransit supports running on RabbitMQ. Why that sounds like a perfect opportunity to deploy RabbitMQ to a container. Only problem was that I didn’t really know how to do that.

Including a space in a path name in a Dockerfile

I want so hard to like docker, but docker sure doesn’t make it easy. Consider trying to copy a file in a dockerfile to a destination with a space in it. You’re likely to get an error about how a path doesn’t exist. If you Google this problem you get great adivce which basically adds up to “Don’t put spaces or whitespace in your file paths”. Thanks.

There are two approaches to putting spaces or whitespace in that I’ve found. The first is to use a variable

ENV PATH_WITH_SPACE "c:/program files/"
COPY thisisdumb.txt ${PATH_WITH_SPACE}

The other is to use this insane quasi-json syntax

COPY ["thisisdumb.txt", "c:/program files/"]

Take your pick.

The Monsters Weekly - Episode 93 - React

ReacJS is a very popular front-end view engine for JavaScript. In this episode we'll make the simplest possible React application on the way to doing some fun stuff with it. 

 

References

React - https://facebook.github.io/react/

The Monsters Weekly - Episode 92 - Saving CPU Cycles with Static Resource Hashes

In today's episode, Monster Dave prototypes an approach to generating static resource URLs to potentially improve the performance of an ASP.NET Core application. Borrowing ideas from a recent blog post by the Facebook engineering team.

 

First, we create a tag helper to generate static resource URLs based on a hash of the file's contents. Next, we write some custom middleware to rewrite those new URLs to the actual file and to always return 304 not-modified for all conditional requests.

The Blog Post: https://code.facebook.com/posts/557147474482256

NOTE: This video is intended to explore the concepts outlined in the blog post above and are not be suited for production use.

The Monsters Weekly - Episode 91 - Middleware vs. Filters

Middleware and filters both seem to fill similar needs in the ASP.NET Core MVC space, so what separates them, and when would you choose to build one over the other?

Join Monster James in this episode to find out more about the intent of each feature of ASP.NET and when to elect to create custom middleware or build a filter for your actions. 

The Monsters Weekly - Episode 90 - Formatting Dates

In today's episode, Monster Dave takes is through the magic that happens in MVC when converting strings from an incoming request to DateTime types in a controller. (Spoiler alert, it's not actually magic).

Related Links:

ASP.NET Monsters #77: Internationalization Part 2 - Request Localization

ASP.NET Monsters #77: Internationalization Part 2 - Request Localization

Standard .NET Date Time Formats

The Monsters Weekly - Episode 89 - URL Rewrite Middleware

Learn how to build complex URL Rewrites without messy XML configuration.  In today's episode Monster James gives us a quick tour of the new URL Rewrite middleware in ASP.NET Core.

NuGet Package

The Monsters Weekly - Episode 88 - Inside Compiled Views in the Razor View Engine

Have you ever wondered how scripts are inserted into your layout from a view, or how the debugger knows which line of code you are on when you're using partial views? 

In this episode, Monster James dives into the classes that are generated automatically behind the scenes and ultimately compiled at runtime to give your application the capabilities required to generate HTML for your client.

More reading: