ASP.NET Core project targeting .NET 4.5.1 running on Raspberry Pi

 October 14, 2016

 ASP.NET Core  Raspberry Pi  Mono

I have been coding a personal project for the past couple weeks. It is a little too soon to unveil, but will say it involves lights, sounds, door switches, and motion sensors. Part of my testing involves running on the intended hardware–Raspberry Pi. However, coding the project in .NET Core left me with a couple stumbling blocks…

Read more

Submitting large number of form-values in ASP.NET Core 1.0

 September 21, 2016

 ASP.NET Core  Forms  Quick-tip

Backstory

Prior to submitting my entry in this year's 10k apart competition, I played-around with the overall board-size to see how well browsers could handle tens of thousands of DOM-elements. The result: not too well. There are just too many styling rules within the grid and performance noticably suffers. For example, a 32x32 grid contains a minimum of 6,144 child-elements (six-elements per "pixel"). The grid is wrapped with a form-tag and when submitted, results in 1,024 values being submitted…

Read more

Compression and static files in ASP.NET Core 1.0 using Kestrel

 September 19, 2016

 ASP.NET Core  Compression  Middleware  Kestrel

Lately, I have been using the Web Markup Minifier package to reduce asset-size as part of my entry in this year's 10k apart competition. Since this is a piece of middleware, I wanted to use it for any asset–not just MVC-things. When the browser queried CSS-files or images, though, no content was returned. The status code was 200, however. So, I began to investigate…

Read more

Identifying an odd Safari styling bug

 September 8, 2016

 Mac  iOS  Safari  CSS

While testing a site on an iPhone, I came across unexpected behavior related to some simple markup and styling. My initial assumption was 'this was a problem due to running an older version of iOS–7, I think'. But, the same behavior was later confirmed running Safari on El Capitain. Chrome, Firefox, and IE do not exhibit this behavior on any platform. Below, I explain the scenario and how I "fixed" the Safari bug.

Read more

Using ASP.NET Core's middleware to modify response body

Hey, where's my content?

 August 25, 2016

 ASP.NET Core 1.0  middleware  bug

Note: the issue referenced in this post has been fixed and will get released with ASP.NET Core 1.1.0.

While creating a small piece of middleware to modify the response body's content, I had trouble getting anything to appear in my browser. I would get a 200 response-code, but no content (i.e. Content-Length: 0). Here is an example that creates a similar setup:

Read more

Creating a GPS configuration provider for ASP.NET Core 1.0

Turning GPS-points into a progress bar

 August 20, 2016

 ASP.NET Core 1.0  GPS  Configuration

In a previous post, I demonstrated creating a Twitter configuration provider for ASP.NET Monster's #SummerOfConfig contest. This post is a follow-up demonstrating how to create a provider leveraging GPS coordinates to create a unique type of progress bar. Source code available on GitHub.

Read more

Creating a Twitter configuration provider for ASP.NET Core 1.0

Taking tweets to the next level!

 July 24, 2016

 ASP.NET Core 1.0  Twitter  Configuration

This is the first in an eventual series of posts related to ASP.NET Monster's #SummerOfConfig contest. The general idea is to implement zany configuration providers (i.e. not the kind you would expect to use in a production environment 😁 ). For my first entry, Twitter has been enlisted to provide "on-the-fly" configuration values. Imagine having the ability to change aspects of your site just by Tweeting! Read on to see how this jazz comes together.

Read more

Updates to hybrid model binding in ASP.NET Core 1.0

New behavior, implementation, and... name change?

 July 9, 2016

 ASP.Net Core 1.0  Model Binding  Hybrid

Between the time I initially wrote about hybrid model binding, later about its updated behavior, and now, a series of changes were made to make the binding behavior safer and less verbose to implement.

Read more

Disqus discussion links

Local testing and how to update existing discussion links

 July 1, 2016

 Disqus  JavaScript  Razor  ASP.NET Core 1.0

Using Disqus is an easy way to get a comment-system on your site. Part of its initialization requires passing a unique Id per page so it knows what comments to retrieve. However, if you like to test your sites locally before deploying to production and use the same identifier for both environments, then you will find your production Disqus links reference your local-URI. When someone wants to share a page using Disqus, the link will point to your local site (which probably won't should not work for anyone but you 😉 ). However, there are several ways to keep the links up-to-date.

Read more

Updated hybrid model binding in ASP.NET Core 1.0 RC2

Why being greedy by default was the wrong approach.

 June 19, 2016

 asp.net core  model binding  hybrid  rc2

In my previous introductory post on hybrid model binding, I demonstrated how a binder could be used with both body and URI content. After receiving feedback (thanks @buhakmeh), it became apparent being greedy by default was not the best option and would most-likely hinder adoption of the binder by the community.

Read more

Hybrid model binding in ASP.NET Core 1.0 RC2

For those who want the utmost flexibility in model binding.

 June 12, 2016

 asp.net core  model binding  hybrid  rc2

Current state of model binding

Imagine you have a REST-ish API and your code follows the OMIOMO/Thunderdome principle. GET-endpoints are easy to bind–just decorate the action-parameter with [FromRoute] or [FromQuery]. But, what to do about POST or PUT? Now, there is content coming from the body of the request in addition to properies we want to bind from the URI. The oft-repeated answer is to have two or more parameters:

Read more

How to fix a lawnmower starter cord

Get up and running in under thirty-minutes (depending on your skill-level, of course)

 June 7, 2016

 Beginner  How-to  Lawnmower  Starter  Repair

Introduction

Here is the scenario for those of us who still use a pull-start mower:

you pull on the starter cord and instead of the usual feeling of the recoil spring being fully unwound, the cord keeps coming towards you. This is the end-result:

Read more

Environment name in ASP.NET Core 1.0 RC2

Why is it `Production` and how can I change it?

 May 29, 2016

 ASP.NET Core 1.0  RC2  Code  Deep-dive(80%)

So, your new web app. is ready for QA and you have all your app. settings neatly separated using appsettings files. But, when you launch the app. on your brand new server, you know something is wrong and quickly realize the app. just loaded production settings. How do you correct this problem? There are several ways and they all involve setting the hosting environment's environment-name.

Read more

Setting host URI in ASP.NET Core 1.0 RC2

You will need this if you want to host multiple apps. on the same machine.

 May 26, 2016

 asp.net core  server  hosting  rc2

It's an RC1 world!

Back in the RC1 days, you could just pass an argument on the command-line to set the host URI. It went like this:

> dnx web myapp --server.urls="http://localhost:10000/"
Read more

Partial obscurity is partial security

Revealing data through image stacking

 April 29, 2016

 security  image editing  image stacking  Azure  GIMP  tutorial

I recently read an article about integrating Azure Active Directory into an application. This allows the former to host login duties for the latter. The article contained several screenshots showing where to find information to complete the integration. The author obscured sensitive information by using Microsoft's Paint app. and its airbrush effect. One screenshot, in particular, contained a shot of the endpoints needed to handle logins of various technologies (i.e. WS-Federation, SAML-P, OAuth 2.0). However, this shot contained repeating information–a GUID that is part of a URI. Because the author manually obscured this data, the pattern of the airbrush effect varied between each row of URIs. Individually, the GUID could not be recovered. However, by stacking cropped frames of each row (seven in total), I was able to retrieve eighty-nine percent of the GUID (thirty-two out of thirty-six characters). What follows is a brief tutorial of how this was achieved. In this particular case, knowing the endpoint is not a crucial security leak, but the point that should be remembered is: repeating data intended to be obscured must be fully obscured. A better approach is to just not include the sensitive data in a screenshot–delete the particular section.

Read more

Namespace changes with Entity Framework migrations

 April 15, 2016

 EF  Entity Framework  .NET  migrations

Note: this is only applicable for EF versions less than or equal to six. Version seven (part of .NET Core) has a completely different migration strategy.

Read more

Calculate height of objects

Knowing whether a tree has the potential to crash into your house

 March 31, 2016

 Math  Trees  Trigonometry  Clinometer

Here is a classic scenario: Local would-be lumberjack decides to cut-down tall tree right beside house. Tree falls towards house. Disaster ensues. Others have a laugh at the homeowner's expense. This post will not help if you find yourself in a similar situation. Instead, this post will allow you to make an informed decision when that tree has a little bit of distance between itself and the house and its height makes the outcome a little blurry.

Read more

Running ASP.NET Core 1.0 rc1 behind a reverse proxy

Why are my requests taking forever?

 March 21, 2016

 ASP.NET Core 1.0  rc1  nginx  Reverse Proxy

Update: this problem has been fixed and is confirmed working as-expected with the release of ASP.NET Core 1.0.

Read more

Expressing relationship between two-numbers as a percentage based on their quotient

Or, numbers are fun and here is a way to wow someone

 March 18, 2016

 Math(90%)  Graphing(2%)  Algebra  Family(5%)

I love finding relationships in number-sets. A favorite memory from high school deals with a game we would play in Algebra class. The teacher would give us a set of numbers and one target number. The goal was to use the set of numbers and arithmetic operations to get to the target. Here is an example:

Read more

Comparison between quantity and cost of fries

Is ordering the larger size worth the extra cost?

 March 16, 2016

 Humor(10%)  Food(30%)  Math(60%)

Took a short drive with the family to get lunch today. Among other items, we ordered small and medium-sized portions of fries. Everything tasted great, but I thought the amount of fries received between the two-sized boxes looked really similar. I began to think whether getting a medium was really worth the extra fourty-cents. So, I kept one of each and took some measurements to see whether ordering the larger size had any benefit. Ultimately, my interest is quantity per dollar. Keep in mind my method and results have some degree of error, but I will leave what percentage up to you.

Read more

Starting from scratch

Breaking down my own mental barriers

 March 14, 2016

First off, Happy Pi Day! I have been putting off owning and running a personal website for a long time. It seems weird, too, since I work predominantly with software (see About me). There are many options for hosting and storing content. But, I have had a tendency to over-think solutions to problems (i.e. Analysis paralysis). Over the course of several years, I built up this collection of ideas and never held myself responsible for making deposits into my idea bank (see Idea Debt). While the ideas are varied, most have a writing-part where I want to share the knowledge gained from completing the idea. And in this case, one idea was to create the engine which drove the display of my writings.

Read more