Background File Processing with Azure Functions

Processing uploaded files is a pretty common web app feature, especially in business scenarios. You frequently get a request from your users that they want to be able to do some work on some data in Excel, generate a CSV, and upload it into the system through your web application.

If files are small enough, or can be processed quickly, its generally fine to just handle the import within the request. But sometimes you have to do so much processing, or so much database IO that its impractical to run the import as part of the upload process: you need to push that work out to a background job of some sort.

Read More

Migrated to Hexo

Migrated this site to hexo as a static site generator. Its written for node, and performs much better for me than octopress.

Running ruby on windows was annoying to install, slow, and tough to maintain.

I wasn’t writing much because the workflow was so annoying. I had to run ruby in bash for windows, use rake isolate to test a single article at a time, and wait minutes for site re-generation.

Hexo generates the site in under 10 seconds.

I’ll be looking for a new non-default theme, but at least all the articles moved over without getting lost. Nothing important should be 404ing.

There’s probably some display quirks, but I’ve gone through all the posts and things looked mostly right.

Let me know if something is out of place.

IIS Rewrite Rule for Single Page Apps

Most of the time when I’m building a single page app, I want to use real URLS, rather than that hash-based nonsense that is generally the default. Most of the frameworks, (Angular.js, react-router, vue-router) refer to this url mode as “history” or “html5” mode. They use the relatively recent history API to push and pop URLs onto the browser’s navigation stack without incuring a full round trip to the server.

So you get nicer URLs like instead of I don’t like that hash mark.

The downside is that if the user saves a bookmark or sends a link to a friend, the browser will actually request a resource at /users/edit (browsers don’t send anything after # in a URL).

You need to configure the web server to respond to that URL by sending back the html shell that that SPA loads into, otherwise you probably get a 404, and no one likes that.

Read More

Friday Links 0.0.25 - C#-7: Pattern Matching (Lite)

This is based on an email I send my .NET team at work

Happy Friday,

Continuing our tour of new features in C#-7, today we come to Pattern Matching.

Pattern matching is a feature of many programming languages that let you test if the contents of a variable meet a certain shape, or pattern. So you can test if a variable is of a class, or in some languages, if a variable has certain properties.

If you’re familiar with the more robust pattern-matching capabilities of a language like F#, you’d be disappointed with what’s being introduced here, but this feature is only going to get more powerful and expressive over time.

Read More