A few weeks ago I replaced my venerable Samsung Galaxy S2 Classic smartwatch with the newer Galaxy Watch Active. Frankly, I didn't consider any of the offerings in-between to be a worthy successor. However, just as I had given up hope, the Active blew me away.
Last week I was developing a Windows Forms (WinForms) application that required a particular kind of user interface. The application was a step-by-step wizard that had navigation buttons: "back" and "next". Think multiple steps of a setup installer. Each page occupied the same position and contains other controls.
I wanted a more elegant solution other than hiding/showing and moving panels around the form.
Every programming textbook and wiki is going to have a definition for polymorphism, so you don't need me to explain the concept. In my mind, polymorphism is the OOP technique of defining one interface that allows different entities to do the work. In this post I'm going to provide a practical example of subtype polymorphism or subtyping.
This time I'm going to show multi-threading using Tasks, also known as async/await. The two patterns are practically identical and I've kept the structure of the code the same to highlight the comparison.
I find it's a pretty common requirement to store settings for an application, such as: "recently opened files", "last opened path" or other user preferences. I've seen this done using INI configuration files, XML and JSON text files. A few years ago I heard about SQLite; how the likes of Google Chrome were using it for storing configurations. So, I built my own helper to handle reading and writing of settings.
Today let's talk about a common problem, you have code running and the application becomes unresponsive. If you're running something that's outputting to a textbox or using a control, the application takes considerably more time to run and locks up the form. How are you supposed to use the progress bar if the form just turns grey all the time?
I feel like at some point in every project you find yourself needing to serialise an object. My immediate go-to is JSON: whether it's being send to another system or saved to disk, the magicians at Newtonsoft have made it super-easy with JSON. However, when I had a requirement to use XML, the results looked somewhat messier than I expected. Here's what I discovered when serialising an object to XML, in three flavours.
This is a follow up to a post I wrote last year, Generating MS Word documents programmatically using placeholders in a template.
This was about generating MS Word (docx) documents by using find-and-replaceable tokens in an existing (template) document. In the previous post I shared some code and explained my thinking on the subject. However, at the time, the code made use of a temporary directory and wasn't precisely read to use. In this update, I've reworked the code into a class and done away with writing data to a temporary file and all that business.