Simple concurrency tester

You probably know how hard it is to purposefully cause a concurrency issue so you can test your code in these edge scenarios. I ran into this issue not too long ago and found that my favorite web service tester Postman doesn’t support sending multiple messages concurrently. I’m sure there are plenty of tools out there that do a great job, but for the simplest possible way you can use a combination of cURL and scripting....

September 6, 2019 · 1 min · LPains

FreshMVVM master/detail page lazy loaded

Out of the box, FreshMVVM offers a Master/Detail page navigation container that works nicely. However, it does not support lazy loading the pages as you navigate to them. Below, I demonstrate how I’ve done it. We need to replace the FreshMVVM original implementation of FreshMasterDetailNavigationContainer. Note that the implementation below is mostly a copy with the following changes: The list view is grouped Each item in the list can have an icon In the AddPage methods, we no longer create an instance of the pages added, we just add a light reference to a collection The menu page is a xaml file instead of fully created in code Only when the menu item is tapped we instantiate and display the Page and ViewModel LazyLoadedPage class:...

July 29, 2018 · 1 min · LPains

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