Language Selection

English French German Italian Portuguese Spanish

Programming Leftovers

Filed under
Development

  • This Week in Rust 392
  • Bash Arrays In-Depth – Linux Hint

    In Bash, an array can be an indexed array or an associative array. An indexed array is a list whose items are numbered beginning from zero. An associative array is a list where strings have replaced the numbers. Assume a pen, an exercise book, a textbook, a ruler, $42, and a pencil on a study table.

  • A bunch of releases from the Pallets projects

    May 11 marked a new major release for the Python-based Flask web microframework project, but Flask 2.0 was only part of the story. While the framework may be the most visible piece, it is one of a small handful of cooperating libraries that provide solutions for various web-development tasks; all are incorporated into the Pallets projects organization. For the first time, all six libraries that make up Pallets were released at the same time and each had a new major version number. In part, that new major version indicated that Python 2 support was being left behind, but there is plenty more that went into the coordinated release.

    [...]

    While Flask is pretty well-known and has even been written about here before, the Pallets umbrella organization has flown a bit under the radar, at least for me. The Jinja2 template engine, a Pallets component that is used by Flask, is also fairly high-profile, but the other pieces of the puzzle are less so. The only other Pallets library I had heard of was the Werkzeug library for supporting Web Server Gateway Interface (WSGI) applications. It is used to connect Flask applications to web servers.

    There are three more libraries on the pallet, but those are smaller and more specialized: MarkupSafe, which provides a text object that escapes characters interpreted by HTML, ItsDangerous, which provides helpers to cryptographically sign data that will be moved between trusted and untrusted environments, and the Command Line Interface Creation Kit, or Click, which is used for "creating beautiful command line interfaces in a composable way with as little code as necessary". The coordinated release was announced on the Pallets blog; it is based on two years of work, though there have been other fairly substantial releases in that time span (e.g. Flask 1.1 in July 2019, Jinja 2.11 in January 2020, Werkzeug 1.0 in February 2020).

  • Processing modular and dynamic configuration files in shell

    While working on a continuous integration/continuous development (CI/CD) solution for a customer, one of my first tasks was to automate the bootstrapping of a CI/CD Jenkins server in OpenShift. Following DevOps best practices, I quickly created a configuration file that drove a script to complete the job. That quickly became two configuration files when I realized I needed a separate Jenkins server for production. After that came the request that the customer needed more than one pair of engineering and production CI/CD servers for different groups, and each server had similar but slightly different configurations.

    When the inevitable changes had to be made to the values common to two or more of the servers, it was very difficult and error-prone to propagate the changes across two or four files. As CI/CD environments were added for more complex testing and deployments, the number of shared and specific values for each group and environment grew.

    As the changes became more frequent and the data more complex, making changes within the configuration files became more and more unmanageable. I needed a better solution to solve this age-old problem and manage changes faster and more reliably. More importantly, I needed a solution that would allow my clients to do the same after turning my completed work over to them.

  • Literals in C – Linux Hint

    You must have heard about the constant variables, whose value cannot be changed. The constant values allocated towards the relentless variables are known as Literals. The literals could be a set of values that could not be changed. It still has memories. However, it has no links in the form of variables. As an illustration, Const int =10; of a constant variable statement where 10 is an int literal. C literals are mostly cast-off to simplify code to get around situations by declaring a variable is not a preference. There are different kinds of literals used in the C programming language. We will discuss each one of them separately.

  • Static Variables in C – Linux Hint

    Static variables do have the ability to maintain their meaning even though they’ve been removed from their scope! As a result, static variables keep their former value in the setting mentioned above and do not need to be initialized once in the new environment. Static variables are always set up once. The compiler holds the variable until the completion of the code. Within and outside of the method, static variables may be specified. Static variables have a standard fixed value of 0. The static variables remain active until the code is over. Ordinary variables are restricted to the range in which they are specified, whereas static variables have a scope that extends within the code.

  • Unions in C – Linux Hint

    A union is a very interesting user-defined data type in the C programming language. It is very much similar to structures in the C programming language. However, there are some differences due to which structures and unions are considered as the independent data types in the C programming language. In a straightforward way, you can consider a union as a conjunction or union of the different data types within one container. It means that a union can hold variables belonging to different data types within the very same container.

    All this discussion will start to make more sense once we go through some relevant examples based on the usage of unions in the C programming language in Linux. However, before sharing those examples with you, we would like to discuss the working of unions and structures so that you can differentiate between these two data types before taking a look at the associated examples. So, let’s take a look at the affixed portion of our article.

  • “malloc” in C – Linux Hint

    Whenever we declare a variable in the C programming language, a chunk in the memory is reserved for holding that variable whose size depends on that variable’s data type. This is referred to as automatic memory management, and it happens at the compilation time. However, at times, you do not want to allocate memory automatically because, in some situations, the exact memory size is subject to change. In such situations, you need a mechanism for allocating memory dynamically.

    In the C programming language, the following four functions are used whenever we talk about dynamic memory management: malloc(), calloc(), realloc(), and free(). However, the scope of today’s article is limited to the malloc() function in C, which stands for “memory allocation.” We will take a look at its usage and try to justify why we need this function in the first place. Finally, we will conclude our article after walking you through an example of using the malloc() function in the C programming language.

More in Tux Machines

digiKam 7.7.0 is released

After three months of active maintenance and another bug triage, the digiKam team is proud to present version 7.7.0 of its open source digital photo manager. See below the list of most important features coming with this release. Read more

Dilution and Misuse of the "Linux" Brand

Samsung, Red Hat to Work on Linux Drivers for Future Tech

The metaverse is expected to uproot system design as we know it, and Samsung is one of many hardware vendors re-imagining data center infrastructure in preparation for a parallel 3D world. Samsung is working on new memory technologies that provide faster bandwidth inside hardware for data to travel between CPUs, storage and other computing resources. The company also announced it was partnering with Red Hat to ensure these technologies have Linux compatibility. Read more

today's howtos

  • How to install go1.19beta on Ubuntu 22.04 – NextGenTips

    In this tutorial, we are going to explore how to install go on Ubuntu 22.04 Golang is an open-source programming language that is easy to learn and use. It is built-in concurrency and has a robust standard library. It is reliable, builds fast, and efficient software that scales fast. Its concurrency mechanisms make it easy to write programs that get the most out of multicore and networked machines, while its novel-type systems enable flexible and modular program constructions. Go compiles quickly to machine code and has the convenience of garbage collection and the power of run-time reflection. In this guide, we are going to learn how to install golang 1.19beta on Ubuntu 22.04. Go 1.19beta1 is not yet released. There is so much work in progress with all the documentation.

  • molecule test: failed to connect to bus in systemd container - openQA bites

    Ansible Molecule is a project to help you test your ansible roles. I’m using molecule for automatically testing the ansible roles of geekoops.

  • How To Install MongoDB on AlmaLinux 9 - idroot

    In this tutorial, we will show you how to install MongoDB on AlmaLinux 9. For those of you who didn’t know, MongoDB is a high-performance, highly scalable document-oriented NoSQL database. Unlike in SQL databases where data is stored in rows and columns inside tables, in MongoDB, data is structured in JSON-like format inside records which are referred to as documents. The open-source attribute of MongoDB as a database software makes it an ideal candidate for almost any database-related project. This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the MongoDB NoSQL database on AlmaLinux 9. You can follow the same instructions for CentOS and Rocky Linux.

  • An introduction (and how-to) to Plugin Loader for the Steam Deck. - Invidious
  • Self-host a Ghost Blog With Traefik

    Ghost is a very popular open-source content management system. Started as an alternative to WordPress and it went on to become an alternative to Substack by focusing on membership and newsletter. The creators of Ghost offer managed Pro hosting but it may not fit everyone's budget. Alternatively, you can self-host it on your own cloud servers. On Linux handbook, we already have a guide on deploying Ghost with Docker in a reverse proxy setup. Instead of Ngnix reverse proxy, you can also use another software called Traefik with Docker. It is a popular open-source cloud-native application proxy, API Gateway, Edge-router, and more. I use Traefik to secure my websites using an SSL certificate obtained from Let's Encrypt. Once deployed, Traefik can automatically manage your certificates and their renewals. In this tutorial, I'll share the necessary steps for deploying a Ghost blog with Docker and Traefik.