Jon's Programming Blog

Progressive Enhancement

The idea behind progressive enhancement is that you start with a web page which doesn’t require any JavaScript, and for that matter, CSS, and you enhance the page depending on what the browser allows on the user’s device. This allows older devices to continue to use the web and saves on people’s resources as they no longer need to update their devices in order to keep up with the modern web.

Retrieving Multiple JSON Arrays into Single SQL Table

Now that SQL Server is working better with JSON it is becoming easier to just put plain JSON into columns. It’s nice to be able to query the JSON directly in the database. The other day I was wanted to get a list of values in arrays. Here’s how I did it. First let’s set up the table: DECLARE @JSON TABLE ( JsonID INT PRIMARY KEY IDENTITY(1, 1) , JsonData nvarchar(max) NOT NULL ); Some test data:

Over 5 Years of F#

Originally when I was planning on doing a post for the F# Advent Calendar I was thinking I would do one on a tool I’m building for C# in F# that mimicks some of the functionality of the fantastic library FSharp.Data.SqlClient. But then I was thinking, “I’ve been messing around with F# for a while and have done some production work with it; why not share some of the experiences that I have had with F#?

Desert Code Camp 2017

Desert Code Camp 2017 was yesterday. I was slated to give four presentations yesterday. I ended up giving three. Three of them were on F#. I did Introduction to F# in the morning and had two more ready to go in the evening. But by that time everyone in the morning had already gone home, I’m guessing, and so the evening attendees probably would have enjoyed hearing Introduction to F# again!

Database Programming Yin Yang

There are two different ways people like to write their SQL scripts when calling the database. One way is to write the SQL statements in their application code. Sometimes they will write an ORM to make this process similar to their language constructs. Sometimes they will write the SQL code directly in procedures. Pros and Cons of Developing in the Application Pros Low friction between application and database. Any refactoring in your application is simple since all your code is accessed in the same location.

An Introduction to Functional Programming in JavaScript

This is the talk I gave at the JavaScript meetup in Phoenix. One the othe largest programming meetups in the valley. Here are the slides to the talk. Here’s some books that can help you get ramped up into the functional programming paradigm Introducing functional programming with Underscore.js by Michael Fogus. And for a more in depth look into functional patterns Professor Frisby’s Mostly Adequate Guide to Functional Programming. Some additional resources of people that have come to embrace the functional programming concepts:

The Power of Static Typing

From what I understand static typing makes programmers more productive and gives implicit documentation to the code base although explicit documentation is also very helpful. It also seems to make the tools we use much more powerful. One of the problems of static typing is that your code becomes more verbose. With programming languages like F# the compiler will implicitly type as much of your program as possible. Where it fails, you need to type it yourself.

Authentication and Authorization in ASP.NET Core

One thing that really got me frustrated in WebAPI 2.0 was creating custom authentication. Eventually I found a blog post by Rick Strahl that showed how to roll your own authentication/authorization. I wanted to implement a login (Basic Authentication) with username/password that would return a token for later (Bearer Authorization) use. It was quite simple but really frustrating because there wasn’t a whole lot of documentation on the subject. Now I want to do something similar for ASP.

F# with Web API and Railway-Oriented Programming

I presented at the 2016 Desert Code Camp. The topic was WebAPI with F#. I also did a video series to go along with the talk. The talk and video series basically goes over how to use F# in a functional manner by building out all the pieces from scratch. Here’s the series, hope you enjoy it! F# WebAPI From Start to Finish. Some set up steps and notes that are important to the success of the project:

Validation in F#

The full code for this article is up on GitHub. I like to the keep things as simple as possible and, ideally, reusable. At my previous employment I came up with a method of validation, but I was never entirely happy with the results. Some of the code repeated itself, and it was difficult to extend to arrays and array comparison. So, I went back to the drawing board building on top of the ideas that I created with the first validation library I created.

  1