Listening to data changes in PostgreSQL and C#
To poll or not to poll?Nowadays, fast, responsive UI that reacts to data changes is pretty much a given (well, not always, yes, but often enough to talk about it!). If it is an application with just one user it is not that hard to implement, but what if there are multiple users in a system that affect each other?The answer would be… not to poll if you can, because more often than not there is another, better way. Many databases, both NoSQL and RDBMS offer functionality to push events to the conn ...
Hello World with multiple microservices
A friend of mine was having trouble finding simple but working example of microservices that he could tinker with, finding instead either buzzword-heavy theoretical articles or just samples in weird languages. I decided to prepare a simple project so it can be understood in short amount of time.
The sample project is modeling a “Starbucks-style” coffee ordering process with a cashier, barista and order pick up counter with the following flow:
sequenceDiagram
participant Customer
parti ...
Middleware implementation in ASP.Net Core is weird
This might seem like a clickbait-y article, but… it really looks this way! Allow me to explain.For one of my pet projects, I considered implementing REST endpoints using Nancy, a nice and low ceremony web framework that I like.To my surprise, in order to host it in .Net Core, as evident from the example here, I would need to use Microsoft.AspNetCore.Owin as a “mediator” between Kestrel and Nancy. Seeing this as an excuse to write something in the area I haven’t looked into yet, I looked into imp ...
Understandable errors in ANTLR4
There is more than one way to peel an orange!Once a colleague told me: “you can’t really generate user-friendly error messages with ANTLR. This didn’t seem right - serious parser generators must have ways to generate proper errors…Online searching has shown approaches to error handling mostly revolve around either various implementations of ANTLRErrorStrategy or “fail fast” strategy that involves overriding implementation of DefaultErrorStrategy to throw ParseCancellationException, which would c ...
Hosting Hexo.io in Heroku
When trying to set up my blog to be hosted in Heroku, I set up it so I can push int Github repo, then Heroku will pull the code and deploy it. Locally it seemed to work fine with Hexo’s server, so I was a bit surprised when my blog failed. Heroku logs have shown the following:
123456782019-11-20T22:39:25.000000+00:00 app[api]: Build succeeded2019-11-20T22:39:27.173507+00:00 heroku[web.1]: Stopping all processes with SIGTERM2019-11-20T22:39:27.241329+00:00 heroku[web.1]: Process exited with statu ...
Setting up the blog, a meta-post!
After taking a look at a couple of more “mainstream” blogging systems, I was looking for a way to do some blogging and not deal with over-engineered systems that are bloated with unnecessary features. I didn’t want to spend time in understanding the details required to actually tweak those systems and customize them to my liking.And then I found static website generators like Jekyll and Hexo. After choosing Hexo because it used a more familiar toolset, I found out that I actually understood how ...