avatar

Andres Jaimes

Creating a simple static library

This article describes how to create a simple static library using C++. A static library is a collection of object files that are linked with and copied into a target application at compile time. The resulting executable contains all the object code from the static library, so it can be executed independently of the library. Static library Let’s start by creating a simple square class: // src/square.h #ifndef SQUARE_H #define SQUARE_H class square { private: double length; public: square(double length); double area(); }; #endif and its corresponding implementation:

C++20 Modules

In this article, we’ll see how to create and use C++20 modules. We’ll use clang-16 to compile our code. Prerequisites OSX comes with clang-14 by default (2023). We can check its version with the following command: clang --version Apple clang version 14.0.3 (clang-1403.0.22.14.1) Target: arm64-apple-darwin22.5.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin The latest version as of the time of this writing is clang-16. Use the following command to install it with homebrew:

Notes on C++

All the examples use C++17 Sort vector by property in class In this example, we defined a class called open_order that has a long long open_time field, and a constructor. To sort the vector of open_order objects based on the open_time field, we define a comparison function compare_by_open_time that compares two open_order objects based on their open_time values. The function returns true if the open_time of the first object is less than the open_time of the second object, which results in sorting the vector in ascending order of open_time.

Creating a simple dynamic library

This article describes how to create a simple shared library using C++. A shared library is a collection of object files that are linked with and loaded into a target application at runtime. The resulting executable contains only the object code that is needed to load the shared library, for this reason, the library has to be distributed with the executable. Shared library Let’s start by creating a simple sum.c program using C.

Online diff tool

This free online diff tool will help you compare two texts and highlight the differences between them. The whole process is done in your browser, so your texts are not sent to any server. Paste the text you want to compare in the boxes below and click the Compare button. ins { background: #E6FFE6; } del { background: #FFE6E6; } #diff { box-shadow: 0 0 20px rgba(0, 0, 0, 0.

Create a bootable FreeBSD or Ubuntu USB flash drive on Mac/OS-X

This article provides step-by-step instructions on how to create a bootable USB flash drive for either FreeBSD or Ubuntu operating systems. The post includes the necessary commands to download and transfer the installation files onto the USB drive using the terminal on a macOS system. The author also includes a reference link for creating a FreeBSD installation memstick on macOS. Download the files Start by downloading the installation file for the operating system you want to install.

Common git commands

Imagine you’re a developer working on a project that’s stored in a remote Git repository. Your first step is to clone the repository using the command git clone git@github.com:some-account/some-project.git. Once you’ve cloned the repository, you can start working on a new feature by creating a new branch using the git checkout command with the -b flag and a branch name, like this: git checkout -b my-feature. This creates a new branch called my-feature and switches to it.

Installing git and connecting to GitHub on FreeBSD

Git is a popular version control system that allows developers to manage their code repositories efficiently. If you are a developer using FreeBSD, you will need to set up Git and an authentication method to start collaborating on projects with other developers. In this post, we will walk you through the process of installing Git, creating SSH keys, and cloning a project from GitHub on FreeBSD. Does this work in Linux or Mac?

How to install Java and Maven on FreeBSD

FreeBSD is a powerful and reliable operating system that is widely used by developers and system administrators. If you are a Java developer, you will need to install both Java and Maven on your FreeBSD system to build and run your Java applications. In this post, we will walk you through the steps to install Java and Maven on FreeBSD. Java We will start by switching to the root account, and installing java.

How to install postgres on FreeBSD

PostgreSQL, also known as Postgres, is a popular open-source relational database management system (RDBMS) that is widely used by developers and organizations around the world. FreeBSD, a free and open-source operating system, is well-known for its reliability, performance, and security features. In this blog post, we will guide you through the process of installing PostgreSQL in FreeBSD. Whether you’re a developer or a system administrator, this step-by-step tutorial will help you get started with it.