Language Selection

English French German Italian Portuguese Spanish


Programming Leftovers

Filed under
  • Practical Advice for R in Production – Answering Your Questions

    Earlier this month, Jack Walton and I delivered a webinar with RStudio on the benefits of putting R into production environments, and how to do it successfully. We received tons of questions from participants, ranging from package management, to team organization, and container best practices. Below is a summary of our answers to your questions.

  • Extern in C++

    The word “extern” in C++ is a specifier. Its use in C++ is explained in this article for variables and functions. First, the meanings of declaration and definition in C++ are given.

  • Inline Functions in C++

    When a normal function is called in C++, some are overheard just for calling the function. Actually, calling a function takes time before the function really starts executing. This time between when the function is called and when the function really starts executing is called the switching time. If the normal function is large, meaning it will take a long to execute, then the switching time is relatively small, and the user can ignore it. However, if the normal function is small, as many functions are, then the switching time, roughly the same for large and small functions, should not be ignored. In many situations, the switching time is longer than the time the small function takes to really execute; in some cases, much longer.

    To solve this problem, C++ uses macro and the inline function. A macro is like a small function, but it is usually shorter than a typical small function. The longest macro is still one “statement”. A function body can have more than one statement. A small inline function has advantages over a normal small function.

  • DHT11 Humidity and Temperature Sensor With Raspberry PI Pico and MicroPython

    The DHT11 is a very simple chip (easy to find on common ecommerce stores) which brings to your projects the ability to read Temperature and Humidity. Let’s see how to connect and use DHT11 with Raspberry PI Pico and use it with MicroPython

Programming Leftovers

Filed under
  • Experimenting with Python implementation of Host Identity Protocol | Linux Journal

    Sometimes it is easier to implement prototypes in user space using high-level languages, such as Python or Java. In this document we attempt to describe our implementation effort related to Host Identity Protocol version 2. In the first part, we describe various security solutions, then we discuss some implementation details of the HIP protocol, and finally, in the last part of this work we discuss the performance of the HIP and IPSec protocols implemented using Python language.


    Internet was designed initially so that the Internet Protocol (IP) address is playing dual role: it is the locator, so that the routers can find the recipient of a message, and it is an identifier, so that the upper layer protocols (such as TCP and UDP) can make bindings (for example, transport layer sockets use IP addresses and ports to make a connections). This becomes a problem when a networked device roams from one network to another, and so the IP address changes, leading to failures in upper layer connections. The other problem is establishment of the authenticated channel between the communicating parties. In practice, when making connections, long term identities of the parties are not verified. Of course, there are solutions such as SSL which can readily solve the problem at hand. However, SSL is suitable only for TCP connections and most of the time practical use cases include only secure web surfing and establishment of VPN tunnels. Host Identity Protocol on the other hand is more flexible: it allows peers to create authenticated secure channels on the network layer, and so all upper layer protocols can benefit from such channels.

  • What's the top programming language? It's not JavaScript but Python, says IEEE survey

    Python is the "de facto platform for new technologies," according to research by the IEEE in its Spectrum publication.

    The new survey places Python, Java, C, and C++ as the top four programming languages. JavaScript, which typically tops such surveys, is in fifth place.

    By contrast, StackOverflow reported earlier this month that JavaScript was the most used language by some margin, with 65 per cent followed by Python at 48.2 per cent and Java at 35.35 per cent. Redmonk analysts also placed JavaScript top, as does developer tools company JetBrains in its State of the Developer Ecosystem survey.

  • GitLab 14.2 Introduces Build Cloud For macOS beta

    GitLab has announced the release of its latest iteration, 14.2, which improves CI speed, delivers built-in CI support for Apple devices, and gives dev teams easier and tighter integration with GitPod.

  • GitHub's Copilot may steer you into dangerous waters about 40% of the time – study [Ed: Microsoft also encourages you to commit GPL violations]

    Academics have put GitHub's Copilot to the test on the security front, and said they found that roughly 40 per cent of the time, code generated by the programming assistant is, at best, buggy, and at worst, potentially vulnerable to attack.

    Copilot arrived with several caveats, such as its tendency to generate incorrect code, its proclivity for exposing secrets, and its problems judging software licenses. But the AI programming helper, based on OpenAI's Codex neural network, also has another shortcoming: just like humans, it may produce flimsy code.

  • 6 Rust Commands to Use in Place of Traditional Linux Commands

    Every Linux distribution derives its roots from the Linux kernel, which was released way back in 1991. It was initially written in C, but slowly and steadily, Rust is taking over as a second language to C within the kernel. As the technology continues to evolve, so have the commands you can use to perform the same functions, but at better efficiency.

    While these commands broadly do the job, there is always a touch of modern coding standards worth adding, to make things more seamless. Let's talk about some of the Rust tools in Linux that are worth trying.

Pango updates

Filed under

I’ve spent some time on Pango, recently. Here is a little update on the feature work that I’ve done there. All of these changes will appear in Pango 1.50 and GTK 4.6.

Line spacing has historically been a bit painful in GtkTextView. You can set distances before and after paragraphs, and between wrapped lines inside a paragraph. But this does not take font sizes into account—it is a fixed number of pixels.

A while ago, I added a line-spacing factor to Pango, which was meant to help with the font size dependency. You basically tell Pango: I want the baselines of this paragraph spaced apart 1.33 times as wide as they would normally be. The remaining problem is that Pango handles text one paragraph at a time. So as far as it is concerned, there is not previous baseline above the first line in a paragraph, and it does not increase the spacing between paragraphs.

Read more

Programming Leftovers

Filed under
  • DevZone rollout

    First announced in the July community update, the DevZone is a project management system for PINE64 devices. It will allow us to have a better overview of ongoing software development, streamline the product prototyping processes and keep track of suggested hardware changes. It is also a way for us to get an up-to-date survey of our developer-pool, including each developer’s core competences and availability. We believe that the introduction of this system will facilitate cooperation and accelerate the process of bringing new devices to the market.

  • Calculate Geometric Mean in R

    The advantage of the geometric mean is
    It is least affected by extreme values
    It is based on all observations of the set
    It is suitable for further algebraic treatment.

  • PEP 649 revisited

    Back in June, we looked at a change to Python annotations, which provide a way to associate metadata, such as type information, with functions. That change was planned for the upcoming Python 3.10 release, but was deferred due to questions about it and its impact on run-time uses of the feature. The Python steering council felt that more time was needed to consider all of the different aspects of the problem before deciding on the right approach; the feature freeze for Python 3.10 was only around two weeks off when the decision was announced on April 20. But now, there is most of a year before another feature freeze, which gives the council (and the greater Python development community) some time to discuss it at a more leisurely pace.

    To that end, Eric V. Smith raised the issue on the python-dev mailing list on August 9. He did so in the context of PEP 649 ("Deferred Evaluation Of Annotations Using Descriptors"), which was the late-breaking proposal that caused the original plan to be put on hold. That plan was embodied in PEP 563 ("Postponed Evaluation of Annotations"), which was accepted back in 2017 and was set to become the default—and only—behavior for annotations starting in Python 3.10. The council decided to defer the change in the default until Python 3.11 at the earliest and there is the possibility of switching to the behavior described in PEP 649 instead. Smith wanted to see if the issue could be resolved at this point.

Emmanuele Bassi: Publishing your documentation

Filed under

The main function of library-web, the tool that published the API reference of the various GNOME libraries, was to take release archives and put their contents in a location that would be visible to a web server. In 2006, this was the apex of automation, of course. These days? Not so much.

Since library-web is going the way of the Dodo, and we do have better ways to automate the build and publishing of files with GitLab, how do we replace library-web in 2021? The answer is, unsurprisingly: continuous integration pipelines.

I will assume that you’re already building—and testing—your library using GitLab’s CI; if you aren’t, then you have bigger problems than just publishing your API.

Read more

Also: Private Flatpak installations in Builder

Programming Leftovers

Filed under
  • Milonga in Flathub! | Juan Pablo's Blog

    Cambalache is a new RAD tool that enables the creation of user interfaces for Gtk and the GNOME desktop environment. It’s main target is Gtk 4 but it has been designed from the ground up to support other versions. It is released under LGPL v2.1 license and you can get the source code and file issues here


    Even tough the workflow is similar to Glade, there are some key differences like multiple UI files support in the same project, which means new concepts like import and export where introduced. Since I do not like writing documentation, who does? I made an interactive tutorial to show up the work flow.

  • GitLab 14.2 brings macOS 'build cloud' closed beta and improved Gitpod support among nearly 50 new features

    GitLab has updated its code repository and DevOps platform to version 14.2, including a private beta of a macOS "build cloud" for compiling applications for Apple's operating system.

    "Today, Apple ecosystem developers on GitLab SaaS need to install, manage and operate GitLab Runner on their own macOS systems to execute CI/CD workflows," said the company.

  • Scanf in C

    The scanf function is one of the most famous and useful C functions. It allows a C program to accept input from the standard input stream, mainly the keyboard. Once scanf reads data from the standard input, it stores the value according to the specified parameter format.

    This tutorial will give you the basics of how to use the scanf function in the C programs.

  • Sprintf in C

    In this guide, we will discuss how to use the sprintf function in C programs. The sprintf function is used to write a formatted string to a character string buffer.

    Let us discuss how to use this function and illustrate with various examples.

  • Strcat in C

    Strings are one of the fundamental building blocks in C and other major programming languages.

    This quick guide will walk you through using one useful string function: strcat.

    The strcat function allows you to concatenate or join two strings to form a single string value.

  • Strcpy() Function in C

    In this guide, we will discuss how to use the strcpy() function in C language. The strcpy() function is a part of the C standard library and is used to perform string copy operations. It is included in the string.h header file and needs to be imported before using the function.

  • Strncpy Function in C

    In this tutorial, we will discuss how to use the strncpy() function in the C programming language. The strncpy function in C is used to copy specified bytes of characters from a source to a specified destination. It is defined in the string.h header file which need to be included before using the function.

  • Structures in C

    In C, a structure is a user-defined variable used to store a collection of variables under a single entity. Let us use a simple analogy to explain structures implementation and usefulness in C.

    Suppose we want to store information about users using a specific service. Such information can include the username, email, address, service mode, and such. To store such information, we can go about creating each attribute as a standalone variable. However, when we have ten plus users, the code can spiral out of control and become very difficult and tiresome to read.

    To solve this, we can create a structure. Inside the structure, we can store all the attributes shared by all the users and then add unique variables for each user.

    Let us take a look at various examples to see how to implement this.

  • strstr Function in C

    The strstr() function in C is used to parse and locate the occurrence of a substring in a string. It is defined in the string.h header file.

    This short tutorial will show you how to use C’s strstr() function to locate a set substring.

  • Perror Function in C

    This guide will discuss the perror function in C, how it works, and how we can use it.

    The perror function prints error messages to the stderr stream based on the error state in the errno.

  • Where Clause MySQL

    This article will show you how to use the MySQL WHERE clause to filter rows for a specific condition. Using the where clause, we can specify a search condition for rows that return true for the condition and perform actions on them.

  • MySQL BIGINT Number Ranges

    This article focuses on the MySQL BIGINT data type and looks into how we can use it to store integer values. We will also learn its range, storage size, and various attributes, including signed, unsigned, and zero fill.

  • MySQL Create Temp Table

    A MySQL temporary table is a unique type of table that allows you to store data temporarily within a single user session. MySQL temporary table is not that different from a normal MySQL table, except that it is volatile.
    Once a table has initialized in a specific user session, only that user can view, edit, or delete the table. Other logged-in users have no access to it. Once a session dies, MySQL automatically drops the table and the data stored in it.

    In this tutorial, we will quickly discuss how you can create and use the MySQL temporary table.

  • New Release: KD Reports 2.0.0 - KDAB - KDAB on Qt

    Version 2.0.0 of KD Reports has just been released!

    KD Reports creates all kinds of reports from within Qt applications. These reports are printable and exportable from code and XML descriptions. KD Reports is a developer tool used in source code, but it allows the use of templates that are created by design staff. Reports may contain text paragraphs, tables, headlines, charts, headers and footers and more. Read more about KD Reports here.

  • Using Gyroscope and Accelerometer with MPU6050, Raspberry PI Pico and MicroPython

    Gyroscopes and Accelerometers are basic features of modern smartphones. But they are vital for such projects as drones and self-balancing cars. These two kinds of sensor can be achieved with a single chip: the MPU6050. As it can communicate with a I2C interface, you can use it with Raspberry PI Pico

    In this tutorial, I’m going to show you how to connect and use an MPU6050 with Raspberry PI Pico and MicroPython.

    The MPU6050 is a Micro-Electro-Mechanical System (MEMS), which are small form factor devices able to convert mechanical movements into electrical signals. The MPU6050 specific case includes a 3-axis accelerometer and a 3-axis Gyroscope (built inside the accelerometer). The accelerometer will measure the acceleration given from a movement (values will be different from zero while it will change its moving speed), while the gyroscope will measure the speed of movement (values will be different from zero while it will move). From this, derives that MPU6050 can measure movement but it will not fit perfectly the aim to define an absolute position. For this purpose, you will need to add a magnetometer as a slave device to MPU6050, by using its auxiliary pins (not explained in this tutorial).

  • Using NumPy’s Meshgrid

    This post will show what a meshgrid is and how it can be created and used in python.

    A meshgrid is a rectangular grid of values made out of coordinate vectors. It is also that the values in the meshgrid are a function of the coordinate vectors.

    Let’s say you want to create a meshgrid out of the coordinate vectors x and y. The naive way to do it is create a new rectangular grid and assign the values of the grid by evaluating the function at each point of the meshgrid. The following code illustrated the naive way:

  • What is the cursor execute in Python?

    A cursor is an object which helps to execute the query and fetch the records from the database. The cursor plays a very important role in executing the query. This article will learn some deep information about the execute methods and how to use those methods in python.

  • How to Use the Decimal Module in Python

    This article will cover a guide on using the “Decimal” module in Python. It can be used to run various mathematical operations on floating point numbers or numbers containing decimals points. All code samples in this article are tested with Python 3.9.5 on Ubuntu 21.04.

  • What is the “Does Not Equal” Sign in Bash? How To Use It

    The not equal “-ne” controller inside the Linux Bash programming language compares two possible values when they’re not equivalent. The not equal function in Ubuntu bash is denoted by the symbol “-ne,” which would be the initial character of “not equal.” Also included is the “!=” operator that is used to indicate the not equal condition. The exclamation point, i.e., “!=” is also commonly used in certain computer languages to indicate that something is not equal. In addition, for the not equal expression to operate, it must be enclosed by brackets [[…]]. The not equal operation yields a boolean result of True or False. The not equal expression is often used in conjunction only with if or elif expressions to check for equality and run instructions.

  • What is $@ in a Bash Script?

    Most of us use Bash scripts for maintenance and certain other tasks. However, we aren’t always acquainted with the various Bash options. Whenever a user is a novice to the Bash shell and Linux, the user tends to seek a pre-written Bash script. This is due to some users finding the unique Bash characters such as $@, $_, and $1 confusing. Beginning with the $@ Bash parameter, it is being used to extend into the positional arguments. Each parameter extends into something like a distinct word whenever expanding happens within double-quotes. Separate parameters should be enclosed in quotations and distinguished by a space if $@ is used. Remember that $@ should be quoted to function properly. Nonetheless, it behaves similarly to arguments as distinct strings.

    We will be looking at several examples to elaborate on the functionality of $@ in the Bash Script while using Ubuntu 20.04 system:

Programming Leftovers

Filed under
  • zbarimg and blurry QR codes

    This is a tinkering post about zbarimg (from the zbar suite of barcode tools) and its ability to read QR code images. Because there are so many possible ways to produce an image of a QR code, I decided to start with a readable image and progressively degrade it, to see what happened.

  • gfldex: Dynamic declaration

    Shortly after my last blog post, Stashes raised a question. Coincidence? Conspiracy? You decide! Anyway, the EVAL caught my eye, because with it we can dynamically create compile time constructs such as a package.

  • Rewriting My Website In Org Mode - Invidious

    In the last few days, I spent some time rewriting my website. I wanted to move over to a completely Emacs/Org-based website where I write everything in Org mode and then use Org Publish to convert everything to HTML. This is fantastic since I write everything in Org. All of my past show notes that I wrote in Org can now be easily added to my website.

Programming Leftovers

Filed under
  • If Conditions in Ruby

    Decision-making is a base factor in programming and human life. They allow us to perform certain actions when a condition fits a specific scope.

    In this tutorial, we will focus on how to implement condition statements in Ruby programming language. Using Ruby conditionals, we can check for a specific condition and take a specified action based on the result.

    The simplest way to make a single decision in Ruby is to implement an if statement.

  • Let's write a compiler, part 7: Arrays

    Arrays are an important feature for our language and compiler. Not defined in the original PL/0 specification but later added in its successor language, Oberon-0, arrays allow us to carve out pre-defined regions of memory of any arbitrary size to be used as we see fit. Because the original PL/0 language has no concept of arrays, we are free to define our own syntax for them.

    These are our challenges for today: choosing a syntax for arrays, implementing that syntax, and allowing array identifiers to be used just the same as the TOK_VAR identifiers we already have.

  • How to Use Frozenset Objects in Python

    This article will cover a guide on using the “frozenset” function in Python that returns a new frozenset type Python object. These objects are similar to set objects available in Python with some key differences. All code samples in this article are tested with Python 3.9.5 on Ubuntu 21.04.

  • How to Use the Tokenize Module in Python

    This article will cover a guide on using the “Tokenize” module in Python. The tokenize module can be used to segment or divide the text into small pieces in various ways. You can use these segments in Python applications that use machine learning, natural language processing, and artificial intelligence algorithms. All the code samples in this article are tested with Python 3.9.5 on Ubuntu 21.04.

  • How to Use Boolean Value in Bash

    The boolean value can contain two types of data. These are True or 1 and False or 0. Bash does not support Boolean values, but any bash variable can contain 0 or “true” and 1 or “false“. The logical boolean operators are supported by bash. The boolean value is required to use when the script needs to generate the output based on the True or False value of a variable. The way to declare and use boolean values in the bash script has shown in this tutorial.

  • PostgreSQL Union All Query

    This tutorial will show you how to use PostgreSQL Union and Union All queries to combine results from select statements.

  • PostgreSQL Limit Clause

    Let’s discuss the ins and outs of using the PostgreSQL LIMIT clause to limit the output to a specified value.

    Although the LIMIT clause is an optional statement, it is very handy when you do not want a query to return thousands and thousands of records.

  • PostgreSQL Grant Privileges

    In PostgreSQL, a user must have the LOGIN privilege to log into the database. However, explicit permissions must be assigned to perform database operations, including selecting tables, columns, and records.

    The PostgreSQL GRANT query allows you to modify privileges for users on database objects such as tables, columns, views, functions, schemas, and more.

    This tutorial will walk you through using the PostgreSQL GRANT command to modify privileges for various database objects.

  • PostgreSQL Functions

    PostgreSQL is a powerful and easy-to-use database management system that provides secure, fast, and very intuitive features, allowing you to focus on the data and not the query syntax.

    One way PostgreSQL makes its usage very easy is the functionality of pre-defined functions. These functions allow you to call them and pass the required arguments to get an output.

    In this post, we will give you a cheat sheet of the most common PostgreSQL functions and even show you how to define custom ones if needed.

  • PostgreSQL Count Function

    In most cases, when working with databases, our interest is the actual records stored in the database. However, an instance may occur where we need to determine the number of records in a specific column or entire table.

    To achieve this, we can define a custom function or use the built-in count function. In this guide, we will discuss the count function and various examples of how to use it.

  • MySQL IN Clause

    This tutorial will discuss using the MySQL IN query to check if a specific value is within a set of values, which is useful in replacing a set of OR operators.

Programming Leftovers

Filed under

GitUI 0.17 Adds The Ability To Compare Commits, New Options Popup (Terminal UI For Git Written In Rust)

Filed under

GitUI, a fast terminal user interface for Git written in Rust, available for Linux, macOS and Windows, had a new release yesterday which adds new features like the ability to compare commits, new options popup, and more.

GitUI allows viewing Git repositories and performing actions on it from your terminal. It features a scalable terminal UI layout, which you control using intuitive keyboard shortcuts. There's no need to memorize the hot keys, as GitUI shows a context-based help which makes it easy to use.

Read more

Syndicate content

More in Tux Machines

Type Title Author Replies Last Postsort icon
Story Standards/Consortia Milestones Roy Schestowitz 24/09/2021 - 1:46pm
Story Proprietary Software amd Security Lefovers Roy Schestowitz 24/09/2021 - 1:45pm
Story Sailfish OS ‑ Command Line Interface & Customisation Roy Schestowitz 24/09/2021 - 1:29pm
Story Today in Techrights Roy Schestowitz 24/09/2021 - 11:14am
Story Android Leftovers Rianne Schestowitz 24/09/2021 - 11:08am
Story i.MX8M Nano based mini-PC features Wirepas mesh networking Rianne Schestowitz 1 24/09/2021 - 11:03am
Story An open source alternative to Microsoft Exchange Rianne Schestowitz 24/09/2021 - 10:55am
Story Komikku – manga reader for GNOME Rianne Schestowitz 24/09/2021 - 10:53am
Story Solus Team Plans to Exit GTK and Adopt Enlightenment Desktop (EFL) arindam1989 24/09/2021 - 7:19am
Story AMD's Older Radeon GPUs Get Ray Tracing Support on Linux Roy Schestowitz 1 24/09/2021 - 6:57am