Building string with placeholders

Last post I showed a cool way to parse strings into typed objects. In this one, I want to show the opposite. How to build strings using a template and an object. The idea is to use a template like {BirthDate:D} My name is {FirstName} {LastName} and I'm cool. and an object with properties BirthDate, FirstName and LastName to fill in the placeholder values and apply optional formatting. There are several uses for a utility like this but my favorite use is templated email messages....

April 13, 2017 · 1 min · LPains

Parsing text into typed objects using RegEx named groups

A little while ago, I had to build a desktop app that received input from devices which I had no control of. Although each implementation had similar requirements, the devices connected to the app were slightly different and so were the inputs received from them. I’ve looked for other similar implementations and found that some people implemented device specific parsers. Furthermore, they used configuration to select the correct parser. I think there is at least one issue with this approach: any change to the known inputs would require the application to change as well....

April 6, 2017 · 2 min · LPains

Using html5 canvas to build a WYSIWYG label designer

Fact check: market thermal label systems are freaking expensive. Maybe I could build my own label WYSIWYG designer? Should be simple, right? To spice things up, I decided to try building this as a web solution. Thus, I started playing with html5 canvas to draw text, barcodes, rectangles and images. Once the design was created I could save the configuration for the items drawn and create actual printer specific commands....

January 31, 2017 · 2 min · LPains

MVC with Windows Authentication and WIF

Overview In the previous post, I proposed a “better” way to handle authentication and authorization in web applications for Enterprise. What I’m going to demonstrate in this post is something rather common in corporate intranets: How to integrate Windows Authentication for intranet web applications using MVC, Windows Identity Foundation 4.5 (WIF) and Claims based auth. WIF 4.5 From MSDN: Windows Identity Foundation 4.5 is a set of .NET Framework classes for implementing claims-based identity in your applications....

October 20, 2016 · 4 min · LPains

A better approach for auth

Overview For a change, this is going to be mostly a conceptual post. This also sets ground for the subject in the next few security related post. Currently there are several options for user authentication but I feel that app authorization is lagging behind. Most people (devs, analysts and biz) usually just go with the default role-based authorization which is flawed in at least a couple ways. In this post I will expose a better approach....

June 18, 2016 · 3 min · LPains