Programming Leftovers


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.
-

- Login or register to post comments
Printer-friendly version- 2608 reads
PDF version
More in Tux Machines
- Highlights
- Front Page
- Latest Headlines
- Archive
- Recent comments
- All-Time Popular Stories
- Hot Topics
- New Members
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.
|
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.
|
today's howtos
|








.svg_.png)
Content (where original) is available under CC-BY-SA, copyrighted by original author/s.

Recent comments
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago