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.

Sitecore admin script pages

Sometimes you need a little sitecore script to get something done real quick. If you’ve got it installed, you could reach for Sitecore powershell, and just use that, but I find the syntax obtuse and the lack of intellisense support to be limiting.

Usually what I do is just toss what I call a script page into the admin section, and use it.

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 http://example.com/users/edit instead of https://example.com/#/users/edit. 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.

Friday Links 0.0.26 - C#-7: Literals, Async, and Throw Expressions

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

Happy Friday,

It appears to have been almost 2 months since I last sent one of these. My apologies for the laziness. I’m sure you wait every Friday with bated breath for a happy little notification in your email client.

Lets talk briefly about a few more new features in C#-7, which you can use today in VS2017.

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.

Friday Links 0.0.23 - Thinking About Feature Folders

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

Happy Friday,

I’ve been thinking about trying feature folders on a future .NET MVC project to see how I like it. A feature folder architecture bundles the source code files together by business domain feature, instead of by what type of file it is.