Language Selection

English French German Italian Portuguese Spanish

Programming Leftovers

Filed under
Development

Misc.

  • Emmanuele Bassi: Final Types

    Additionally, any derivable type can be marked as abstract; an abstract type cannot be instantiated, but you can create your own derived type which may or may not be “concrete”. Looking at the GType reference documentation, you’ll notice various macros and flags that exist to implement this functionality—including macros that were introduced to cut down the boilerplate necessary to declare and define new types.

    The G_DECLARE_* family of macros, though, introduced a new concept in the type system: a “final” type. Final types are leaf nodes in the type hierarchy: they can be instantiated, but they cannot be derived any further. GTK 4 makes used of this kind of types to nudge developers towards composition, instead of inheritance. The main problem is that the concept of a “final” type is entirely orthogonal to the type system; there’s no way to programmatically know that a type is “final”—unless you have access to the introspection data and start playing with heuristics. This means that language bindings are unable to know without human intervention if a type can actually be inherited from or not.

  • Peter Czanik: Syslog-ng 3.33: the MQTT destination

    Version 3.33 of syslog-ng introduced an MQTT destination. It uses the paho-c client library to send log messages to an MQTT broker. The current implementation supports version 3.1 and 3.1.1 of the protocol over non-encrypted connections, but this is only a first step.

Python

  • Matplotlib Scatter Plot in Python – Linux Hint

    The human can understand the visual more as compared to the text form. That’s why people always suggest drawing the big data graph to understand it in a very easy manner. There are different types of graphs available in the market like bar graphs, histograms, pie charts, etc. These different graphs are used according to the dataset and requirements. For example, if you have a dataset of company performance from the last 10 years, then the bar chart graph will give more information about the company’s growth. So, like that, the graph choice depends upon the dataset and requirements.

    If you are a data scientist, then sometimes you have to handle the big data. In that big data, you are processing the data, analyzing the data, and then generating the report on that. To generate the report on that, you must need some clear image of the data, and here the graphs come in place.

  • String to Hexadecimal in Python – Linux Hint

    Hexadecimal has a base of 16, and we can represent a string in hexadecimal format using the prefix 0x.

  • How to Use Textwrap Module in Python – Linux Hint

    This article will cover a guide on using the “textwrap” module in Python. As the name suggests, this module can be used to “wrap” text so that lines or sentences can be fit within the predefined length constraints. This is usually done by shortening a piece of text and moving the longer parts to the next line so that all lines adhere to the character limits. The usage of the textwrap module can be best understood through examples. Below are some code samples that illustrate the usage of the textwrap module and its methods. These code samples are tested with Python 3.9.5 on Ubuntu 21.04.

C

  • How to Use Pointers in C – Linux Hint

    In C, learning pointers is simple and enjoyable. Certain Programming language activities are easier to complete with pointers, while others, like dynamic memory allocation, seem impossible to complete without them. To be a competent C developer, it is thus beneficial to understand pointers. Within C, a pointer is a variable that holds the location of some other variable. You may do use a pointer to reference some other reference method. A pointer could be increased or decreased, indicating that it points towards the next or prior memory address. A pointer would aim to save storage and speed up processing. Let us start from the beginning. Make sure to use Ubuntu 20.04 Linux system to implement these examples below.

  • For loop in c – Linux Hint

    In the programing language, loops play an important role in conducting the programs efficiently. Manual execution requires a lot of time that causes the operating system to slow down the speed of its tasks to be performed. In this article, we will discuss using one of the commonly used loops that is for-loop.

C++

  • Return Array From Function C++ – Linux Hint

    Arrays are specific containers that have values of the same data type. Functions in C++ perform operations on arrays, and these arrays are then returned to the main function. There are many approaches to describe this phenomenon. In this guide, some common methods are explained:

  • Vector Resize() Function in C++ – Linux Hint

    The vector is a very useful class of C++ for creating the dynamic array. The size of the vector can be changed at any time to solve any programming problem. Many built-in functions exist in C++ for doing the different types of tasks in a vector container. The resize() function is one of them. It is used to change the size of the vector. The vector size can be increased or decreased by using this function. The uses of resize() function in C++ vector have been explained in this tutorial.

  • Vector Erase() Function in C++ – Linux Hint

    The array is used to store multiple data, and the number of elements of the array can’t be changed at the run time. This problem can be solved by using a vector that works like a dynamic array. Different functions exist in the vector class to add and remove an element from the vector. The erase() function is used to remove one or more elements from the vector at the run time that decreases the size of the vector. The uses of this function have been explained in this tutorial.

  • Vector Insert() Function in C++ – Linux Hint

    The vector is a useful container class of C++ to store the sequence of data that works as a dynamic array. The size of the vector object can be increased or decreased by adding or removing an element in the object at the run time. The insert() function is used to add one or more new elements before the specific element of the vector object by mentioning the position of that element. It will increase the size of the vector object dynamically. The different syntax and the uses of this function have been explained in this tutorial.

  • Use of Vector Pop_Back() Function in C++ – Linux Hint

    The size of the vector can be reduced by using different built-in functions of C++. The pop_back() function is one of them. It is used to remove the last element of the vector from the back and reduce the size of the vector by 1. But the last element of the vector is not removed permanently like the erase() function. The different uses of this function have been explained in this tutorial.

  • Vector Push_Back() Function in C++ – Linux Hint

    The dynamic array can be implemented by using a vector in C++. The elements can be added to the vector in different ways. The push_back() function is one of the ways to insert a new element at the end of the vector that increases the size of the vector by 1. This function is useful when one element is required to add to the vector. If the data type of the vector does not support the value passed by the argument of this function, then an exception will be generated, and no data will be inserted. The way to insert data in vector using the push_back() function has shown in this tutorial.

  • Find array size C++ – Linux Hint

    An array is a container having elements of the same data type. If we don’t know the actual size of an array, it can be determined by different methods. When we talk about the size of an array, in actual we are talking about the number of elements present in the array. Sometimes, we define the array size, and sometimes the brackets are left empty. This is an apparent size that only shows the capacity of an array to store value in it.

Shell/Bash

  • Full Guide to Bash Arrays

    In itself, Linux is merely an operating system kernel; the kernel is a crucial component of the operating system, which facilitates I/O devices communicating with the software used by the user. Besides, it manages memory, CPU, and protects hardware and software from malfunctioning. The interface or software part that the user uses to interact with the hardware is called Command Line Interface (CLI) or a Shell.

    Linux shell is a program with an interface that takes commands from the user, interprets them, and sends them to the kernel to perform a specified operation. Command Line Interface (CLI) is the minimalist way to interact with the hardware of the system. There are tons of commands for performing various functionalities, such as making a directory, moving a directory, creating a file, deleting a file, etc.

  • Revisiting a command-line translator

    I don't know who developer Mort Yao is (the "About Me" page on his personal website says nothing), but his command-line translate-shell program has proved to be very useful.

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.