Showing posts fromc by-example

C++ Wrapper for Socket

The last two articles examined the "C Socket" interface provided by the OS. In this article, I wrap this functionality in a simple C++ class to provide guaranteed closing and apply a consistent except

Read More

Memory Resizing

So I never really considered why the resize of vector used a constant expansion of 1.5 or 2 (in some popular implementations). That was until I did my previous article series ["Vector"]({{config.site

Read More

Mug: A C++ server with hot-reloadable plugins

I like Python’s Bottle/Flask development loop: change code, hit refresh, keep moving. In C++ we traditionally pay for “real builds” with server restarts, cold state, and the mental overhead of wirin

Read More

Nisse - Origins of a Server Library

# [Nisse](https://github.com/Loki-Astari/Nisse) [Nisse](https://github.com/Loki-Astari/Nisse) is a C++ library that simplifies the creation of [C++ web-based applications](https://github.com/Loki-As

Read More

A Web Server

# [Nisse](https://github.com/Loki-Astari/Nisse) Describing all aspects of Nisse in a single article would be complex and overwhelming. I want to start with a beginner's perspective and address a rea

Read More

C++ Sockets

# [Nisse](https://github.com/Loki-Astari/Nisse) In the previous article "A Web Server," I created the simplest web server possible. This article covers the next stage by addressing the issues relat

Read More

SSL Certificates

# [Nisse](https://github.com/Loki-Astari/Nisse) In the previous article, "C++ Sockets," I mentioned that Thors-mongo had built-in support for SLL connections but glossed over the details. In this ar

Read More

Multi Threading

# [Nisse](https://github.com/Loki-Astari/Nisse) In the first three articles, we created a very basic Web Server. A significant issue with this simplistic server is that it can only handle connection

Read More

SlackActions: Slack Bot handling Slash commands

## Overview Slash commands let users trigger your Bot by typing a command like `/todo` or `/deploy` directly into the Slack message box. Unlike message handlers that passively listen for text, slash

Read More

SlackHandlers: Slack Bot handling events

## Overview In the previous article I walked through creating a Slack Bot and registering it with Slack. That article simply verified that events coming from Slack were correctly received by the Bot

Read More

SlackMug: A Mug plugin for a Slack bot

## Overview This article will walk through the steps of creating a Mug plugin that implements a Slack Bot. It utilizes NisseBolt, a C++ library designed to be similar to the [Slack Bolt](https://doc

Read More

SlackView: Slack Bot opening Modals

## Overview Modals are popup dialogs that collect structured input from users. They appear as an overlay on top of Slack's interface and can contain text inputs, date pickers, checkboxes, radio butt

Read More

Smart-Pointer - Constructors

This article examines constructors that are often overlooked. It examines their use cases and explains why the added functionality is meaningful in relation to smart pointers. ## Default Constructor

Read More

Smart-Pointer - Shared Pointer

So in [the previous article](https://lokiastari.com/posts/Smart-Pointer-UniquePointer), I covered a basic `unique` pointer where the smart pointer retained sole ownership of the pointer. The `shared`

Read More

Smart-Pointer - Unique Pointer

On [codereview.stackexchange.com](https://codereview.stackexchange.com) in the C++ tag, it seems like a write of passage to implement your own version of a smart pointer. A quick search brings up the

Read More

Socket Programming in C

Building a simple client/server application is the standard first internet-based application developers attempt. These applications are built on top of the socket communication library, but socket pr

Read More

Socket Protocols

In the previous articles, I used a very simplistic protocol. In real-world situations, this protocol is not sufficient. A communications protocol is required to provide a more robust connection betwe

Read More

Socket Read/Write

## Checking read/write success The `read()` and `write()` commands can fail in several ways but can also succeed without reading/writing all the data. A common mistake is not checking the amount of

Read More

Vector - Resize

Because resizing a vector is expensive, the `std::vector` class uses exponential growth to minimize the number of times that the vector is resized: a technique we replicate in this version. But every

Read More

Vector - Resource Management Allocation

Many new developers of C++ attempt to build a `Vector` like container as a learning process. Getting a simple version of this working for POD types (like int) is not that complicated. The next step i

Read More

Vector - Resource Management Copy Swap

In the previous article, I went over basic allocation for a `Vector` like class. In this article, I want to put some detail around the copy assignment operator and resizing the underlying `Vector`. U

Read More

Vector - Simple Optimizations

Now that we have used `std::is_nothrow_move_constructible,` we can also examine a couple of other types available in the template utility library. # Optimized Destruction Since we have to manually

Read More

Vector - The Other Stuff

So, the C++ standard specifies a set of requirements for containers. Very few requirements are specified in terms of containers, so adhering to these strictly is not required (unless you want to be c

Read More