Language Selection

English French German Italian Portuguese Spanish

Programming Leftovers

Filed under
Development
  • abs function in C

    Why is it necessary for programmers to use the abs() function? It’s accessible in almost every programming language; But how much good is a function that just turns negative values into positive ones? You may find yourself wanting positive numbers occasionally, and the abs() function ensures that you will get them. The abs function is an abbreviation for “Absolute Value” inside the C programming language, and it specifies the distance of a number just on a number line beginning from 0 without taking the direction into account. The abs value of a number, or its absolute value, has always been positive, implying that a distance could never be negative.
    The abs () method returns the absolute appropriate value integers and is specified in the stdlib.h header file. To return the absolute value of a particular number, we must include the stdlib.h header file in our C application. Only positive values are returned by the abs() function.

    Consider the following scenario: If we have an integer number -2 and wish to find the absolute value, we may use the abs() method to have the positive number 2. In addition, when we have an integer number 2 and want to determine the absolute value, we can use the abs() method to return the very same value as 2. It gives the very same number if we provide it with any positive number.

  • Printf-style debugging using GDB, Part 2

    The first article in this series introduced the GNU debugger, GDB, and in particular its dprintf command, which displays variables from programs in a fashion similar to C-language printf statements. This article expands on the rich capabilities of printf-style debugging by showing how to save commands for reuse and how to save the output from the program and GDB for later examination.

  • Python Wrapper to find all primes from a given interval via sieve of Eratosthenes released as C++ procedure
  • Intel Contributes AVX-512 Optimizations To Numpy, Yields Massive Speedups - Phoronix

    Intel has contributed AVX-512 optimizations to upstream Numpy. For those using Numpy as this leading Python library for numerical computing, newer Intel CPUs with AVX-512 capabilities can enjoy major speed-ups in the range of 14~32x faster.

    This summer Intel volleyed their initial AVX-512 code for Numpy and finally this week the code was merged upstream. This open-source AVX-512 code originates from the Intel Short Vector Math Library (SVML) that they open-sourced the code from. Intel has also been working on allowing Numpy to be built against SVML as a separate improvement.

  • TSV to CSV on the CLI (if you really have to)

    Regular visitors to this blog will know that I don't like the CSV format. It's awful. In my humble opinion, data workers should aim to use invisible tabs (TSV) or visible pipes (PSV) as field separators in delimited text tables. Sometimes, though, data workers are required to convert a perfectly good TSV or PSV to a CSV. What to do?

    I don't recommend opening the TSV or PSV in spreadsheet software and saving the result as a CSV, unless there are no leading or trailing quotes in the data items, or umatched quotes generally. The original quotes might well disappear in the saved CSV.

    There are a number of TSV-to-CSV programs for the command line. One is in Haskell, for example, and there also routines to do the job in Perl and Python. But if the individual fields in the TSV don't contain commas or quotes, the TSV-to-CSV conversion is simple — use tr:

  • Useful Bash Commands You May Not Know About

    Bash is a fairly powerful language to program in, and is also quite easy to start off with.

    After all, it's almost universally the shell you're going to see when you open up your terminal. That makes it extremely useful to get accustomed to.

    There's some powerful commands in Bash that you may not be aware of though, even if you're fairly seasoned with using the language. All of these commands can serve quite useful purposes though, and can make the shell scripts you write cleaner, more maintainable, and just outright more powerful than they could've been before.

More in Tux Machines

Android Leftovers

today's howtos

  • Adventures with the Linux Command Line, First Internet Edition

    I've just released the first Internet edition of my new book, Adventures with the Linux Command Line. This 250+ page volume is a sequel/supplement to The Linux Command Line (TLCL). With 14 action-packed chapters, it covers a variety of skill-enhancing topics intended for makers, students, and anyone who wants to take their knowledge of the command line and shell scripting to the next level.

  • LFCS – User Account Management | Linux.org

    With any Linux system, you may need to add users. Additional Users may be needed when adding Services such as Samba. Being able to manage user accounts is a very important task, especially if working on multiple systems in a business environment.

  • How To Install Nagios on Debian 11 - idroot

    In this tutorial, we will show you how to install Nagios on Debian 11. For those of you who didn’t know, Nagios is an open-source tool that provides an enterprise-class central monitoring engine for IT monitoring, network monitoring, server, and applications monitoring. It monitors your entire IT infrastructure to ensure systems, applications, services, and business processes are functioning properly. In the event of a failure, Nagios can alert the technical staff of the problem, allowing them to begin remediation processes before outages affect business processes, end-users, or customers. 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 through the step-by-step installation of the Nagios monitoring tool on a Debian 11 (Bullseye).

  • How to Install Debian 11 (Bullseye) Server Using Net Install

    In this guide, we will walk you through the installation of a Debian 11 (Bullseye) Minimal Server, using the netinstall CD ISO image. This installation you will carry out is appropriate for building a future customizable server platform, without a GUI (Graphical User Interface).

  • How to Install LAMP Stack on Debian 11/10/9

    On (August 14, 2021), the Debian project announced the availability of the new stable version (Debian 11) codenamed Bullseye. With this release, the well-known and widely-used Debian 10 Buster gained old-stable status, which designates the previous stable repository. As it always happens with the release of a new stable version, Bullseye includes hundreds of new packages and updates to thousands of others. Since Debian powers a large percentage of web servers all over the world, in this article we will explain how to install the LAMP stack in Debian 11 and also works on older Debian 10 and Debian 9 releases.

  • How to Install LFTP to Download and Upload Files in Linux

    When it comes to the availability of ftp (file transfer protocol) client solutions, the Linux operating system, and its numerous distributions never disappoint. In this area, there is plenty of fish in the ocean. The Linux-based ftp clients are a mixture of GUI and non-GUI solutions. Ftp client solutions not only give you access to remote machines and servers but also enable you to easily upload/download files to/from your remote machines/servers.

  • How to Install Pip on Kali Linux - Linux Nightly

    pip is the package installer for Python. On Linux, pip allows for easy installation of Python programs and dependencies. For Python developers, pip is an essential tool. In the context of Kali Linux, pip is mostly used for hacking scripts or to download dependencies that hacking scripts rely on. Even if you don’t write Python scripts yourself, you may still find it necessary to install pip. In this guide, you’ll see how to install pip on Kali Linux.

  • How to install GUI on CentOS 8 / RHEL 8 Minimal Linux server - Unixcop

    Have you installed CentOS 8 minimal installation and need to change the command line to Graphical user insterface GUI ? So if you are new to the command line, it will be a great idea to start with a Graphical user interface to learn and become a master of Linux. Also sometimes, Advanced users need a Graphical desktop environment to handle various services easily. So this guide will help you to change your command-line CentOS linux server to GUI. or You can install the GUI to your server.

  • How to install VirtualBox from A to Z and learn to use it | ArcoLinux

    We recommend this option as it is the easiest way to get VirtualBox on your computer.

  • How to setup an RDS MySql (Relation Database MySql) instance on AWS

    RDS(Relational Database Service) comes under “Database” services of AWS(Amazon Web Services) Cloud. RDS service provides a scalable and cost-efficient relational database capacity. It automates time-consuming administration tasks such as hardware provisioning, setup, backups, etc. It helps us to focus on our applications instead of database administration and maintenance tasks. RDS provides us with 6 database engines, Amazon Aurora, MySQL, MariaDB, Oracle, Microsoft SQL Server, and PostgreSQL. RDS handles routine database tasks such as provisioning, patching, backup, recovery, failure detection, and repair.

Android Leftovers

LibreOffice extension to remove blank cells – Help to improve it!

Rafael Lima from the Brazilian LibreOffice community is working on an extension to remove blank cells in LibreOffice Calc. It has four modes (single column, single row, blank rows and blank columns). Here’s a quick animation of it in action... So far, the main functionality is there, but Rafael would like to improve it. We asked him for some more info… Read more