JSON format is very widespread now. Many Web APIs return their results in this format. Also, many APIs accept incoming requests in the same format. Structure of incoming JSON request can be very complex. It is not uncommon to make a typo in such a document. In this article I'd like to discuss, how can we detect these typos and inform users about them in a friendly form.
Wednesday, December 27, 2017
Saturday, November 18, 2017
Simple parallelizable algorithm for approximate pattern matching
In this article, I'd like to show a simple algorithm for approximate pattern matching. This term generally means that you want to find all places in a big string (text) where a short string (pattern) resides in it. In this form, it defines exact pattern matching. But in our case, we will allow some "errors" (places where the symbol in the text is not equal to the symbol in the pattern). We just want to limit the number of such errors. This is why it is called approximate pattern matching.
Friday, September 15, 2017
Complex deserialization of objects from JSON
Sometimes we need to deserialize JSON into an object model. Here, I'll explain deserialization of objects belonging to a class hierarchy with a support of different formats using Newtonsoft Json.Net library.
Thursday, September 7, 2017
Deferred sorting of collections
Recently I faced a problem of storing sorting information for later use. Sorting is easy if you already have a collection to sort. Just use LINQ extension methods. But what if you don't have the collection yet? What if you'll get the collection later, but you need to store sorting rules now? Here I'll tell you, how it can be done.
Tuesday, August 22, 2017
Using keyword 'new' in class member definitions
Do you know, that keyword 'new' can be used in a definition of class members? I knew about it, but have never used it for many years I work in the software industry. But recently I have found a couple of scenarios, where this opportunity is very useful. Here I want to share my findings.
Wednesday, August 16, 2017
Verification of complex objects in automated tests
Sometimes in automation tests we need to validate work of methods, returning very complex objects as a result. We want to be sure, that these objects have correct structure. Common assertion libraries allow us to check our expectation about simple objects (strings, numbers), and collections of objects of primitive types. But it can happen, that we need more.
Friday, March 10, 2017
How to use mocking framework in tests
Let's consider cases, when you may, and when you should not use mocking
framework. Also here I'll show some patterns, you may want to use with
mocking framework.
Thursday, February 16, 2017
Modifiable read-only interface
Read-only interface is a simple thing. It does not allow user to change its state. But sometimes you may want to "change" it. I'm not talking about actual modification of state of object. I'm talking about creation of NEW object which state is almost the same as the old one.
Wednesday, January 11, 2017
Standard HTML elements (tags) does not have fixed visual presentation
I knew that some HTML elements (tags) like <div> or <span> does not have fixed visual presentation. They were designed to allow user to specify their view using CSS. But now I figured out that presentation of any HTML may be completely changed, even for such elements as <table>, <tr> and <td>. Here I'll demonstrate how you can completely change how your table looks like on small devices using just CSS.
Friday, January 6, 2017
How to create and publish NuGet package from .NET project using AppVeyor
It is not an uncommon task to create a NuGet package from your code and publish it on some NuGet feed. Here I'll explain how to automate this task using AppVeyor.
Subscribe to:
Posts (Atom)