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.
My time working with Episerver CMS has come to an end. I'm moving on. I wanted to write a final part about this makeshift API. I did do more work on it since the last post, spurred on by requirements at work. This is it from me about epi.
In part 1, I briefly explained how I came to work on writing an API for an Episerver CMS by exploiting the front-end framework on the web interface. As a developer, with a finite life-span, I jumped straight to the part that I needed for the job. I had intended to go back to the beginning and map all the functionality. Unfortunately I haven't had very much time to spend on this. Together with an amount of uncertainty of my future with Episerver, I'm shelving this. My day job is with Episerver and it's always possible that this API will get reignited by some requirements later.
I hope this has been helpful to someone.
At the end of last year (between Christmas and New Years), I had the task of auditing all the pages in an installation of Episerver. The problem was that the Service API wasn't installed and the possibility of deploying code to the server was pretty slim. This got me thinking about the feasible solutions.
Do you need to take screenshots of numerous web pages? Yes? Then this article is for you. You can take screenshots of web pages programmatically using the WebBrowser class (System.Windows.Forms). Let's get straight to the code.
In this article I'm going to show the usage of the HttpWebRequest and HttpWebResponse classes and how you can use it to interact with websites. I'm going to be focusing on retrieving text responses (or the source code of a web pages) and not binary files. I'm also not going to be mentioning WebClient or HttpClient, they may be an article for another time. At the end of the article I'm sharing a helper class.
I use a variety of web browsers at work but I prefer to use Vivaldi and Chrome whenever I can. Recently, I found myself with three new computers to personalise for work and the home. This seemed like an excellent opportunity to review all of my existing Chrome extensions and find replacements.
This is my updated list of essential everyday Chrome (and Vivaldi) Extensions.
In early 2014, I was introduced to Boostrap (front-end framework); 10 minutes later I was a true believer.
As I've been using Bootstrap for a while, there are a few customisations to controls and behaviours that I've implemented. In this series of articles (at least one) I'm going to share a few of these customisation. I won't be modifying any Boostrap files. As always, these are my customisations they may not be to your liking.
Welcome to my first blog post. Hi, I'm Ray (psst! that's the name of this website).
This is an easy exercise that I occasionally come across, parsing comma separated values (CSV). I've seen a lot of code purporting to do this on the Web but a lot of it doesn't work in practice. This is my take on parsing CSV's.