Refactoring C Code: Choosing the Next Direction

Initially, I thought that my next step would be to write the code to handle more than a single connection at a time, but I decided that this isn’t the natural next step. It would be better to build the API and abstractions that are required to use this network protocol before committing to an actual implementation. I took a peek at what is available, and it looks like we have the following options:

Thread per connection – obviously out.
select() /pool() – allow to have a single thread manage multiple connections, but require a lot of state management.
libuv – or similar, that handle all of those details for me.

Regardless of what I’ll end up in the end, I think that the externally facing API is always going to be the same, so I’m going to focus on that. Right now we have:


Publishing a Blazor Component to the NuGet Gallery

In this article, we will learn how to publish a reusable Blazor component to the NuGet gallery. We will use Visual Studio 2017 to build and create the NuGet package.

Install the .NET Core 2.1 or above SDK from here.
Install Visual Studio 2017 v15.7 or above from here.
Install ASP.NET Core Blazor Language Services extension from here.
Create a NuGet account. Create your free account on here.

Please refer to my previous article BlazorGrid – A Reusable Grid Component For Blazor to create the BlazorGrid  component, which we will publish in this tutorial.


Type Safe State Machines in TypeScript

State machines are everywhere but I don’t think they get enough air time. To remedy the situation I’m going to present an implementation in TypeScript and use it to model a very simple elevator.
I could point you to the definition of what a state machine is on Wikipedia but the name gives it away. State machines consist of states and a description of how to go from one state to the next. So let’s start spelling things out.


Adding an RSS Feed to Your Blog With Laravel

Hello again!
In another article, I decribed how I rebuilt my site with Laravel in a day. Though the website took shape within a day’s work, I still had many essential features to include, such as RSS feeds, blog post comments, and structured data, to name a few. I wanted to explain my solution for implementing an RSS feed. This may be a simple solution but the point is that it works like a charm. So let’s get started building an RSS feed for your site.


Introducing Crafter CMS JavaScript SDK

Introducing Crafter CMS Javascript SDK

Crafter CMS is a headless CMS that provides all of it’s services and capabilities to consumers via RESTful APIs. This enables developers to easily build content support (externalized management of content, strings, media, etc) into any application written in any programming language.
Crafter CMS also supports language-specific (e.g. Java, Groovy, Javascript, .NET, etc.) and framework-specific (Angular, React, Vue, etc.) bindings. These bindings make the programming model not just simple but native to the language or framework. Using RESTful APIs is easy but native bindings further reduce programming time and complexity by simplifying and reducing the code required to get the job done.


Refactoring C: Error Handling Is Hard, Error Reporting Is Harder

As part of my usual routine, I’m trying out writing some code in C, to get a feeling for a different environment. I wanted to build something that is both small enough to complete in a reasonable amount of time and complex enough that it would allow me to really explore how to use things. I decided to use C (not C++) because it is both familiar and drastically different from what I usually do. The project in question? Implementing the network protocol I wrote about here.  Another part of the challenge that I set out for myself was to make this code as production quality as I could, which means paying all the usual taxes you would expect.
The first thing that I had to do was to figure out how to actually perform networking and work with SLL in C. Something that would take me 5 minutes in C# took me a several hours of exploring and figuring things out. Eventually, I settled down on the obvious choice for SSL with OpenSSL. It is portable, reasonably well documented, and seems fairly easy to get started with.


Quickly Understand JavaScript’s .forEach() vs. jQuery’s .each()

Do you remember this famous scene from the Matrix? Well, this tutorial is similar to the same situation where Neo has to make a choice. But, now, instead of Neo, it is you who havs to make the choice, between two methods: .forEach()and jQuery’s .each().
There are two functions to deal with an array on the client-side – JavaScript’s .forEach() and jQuery’s .each(). Here, I will teach you how to use both of these methods with some sample code.


UTF-8 in HTTP Headers

HTTP 1.1 is a well-known hypertext protocol for data transfer. HTTP messages are encoded with ISO-8859-1 (which can be nominally considered as an enhanced ASCII version, containing umlauts, diacritic and other characters of West European languages). At the same time, the message body can use another encoding assigned in “Content-Type" header. But what shall we do if we need to assign non-ASCII characters not in the message bodies, but in the header? Probably the most well-known case is setting a filename in the "Content-Disposition" header. It seems like a common task, but its implementation isn’t obviou

TL;DR: Use the encoding described in RFC 6266 for "Content-Disposition" and transliterate it to Latin in other cases.


Developing a PWA Using Angular 7

For quite a while we have been noticing a huge interest in Progressive Web Applications (PWAs) in the front-end world.
More and more companies develop applications using the concept. Users creat catalogs (PWA Stats), where we may find the information about use cases and positives (improving conversion, increasing the number of subpages visited during the session or time spent on the page). Market giants, such as Microsoft also promote the technology by allowing developers to add PWA applications to the Windows Store.


Abstract Classes and OOP Extras in PHP

Last chapter of this series. If you have followed along with these blog posts you are now fully capable of creating projects using the Object Oriented paradigm.
In this part, we will learn how to use abstract classes and several other less common features of PHP such as reflection APIs and the singleton design pattern.