Language Selection

English French German Italian Portuguese Spanish

Programming: C and Python

Filed under
Development

C:

  • How to Reverse a String In C – Linux Hint

    In string coding, string reversal is a crucial topic. There are also several methods for reversing a string, each of which has a different logic. This article will show you how to properly reverse a string to use several distinct approaches and reasoning with and without requiring any preset functions. Whenever the reversal of a string technique is applied in a particular unique input string, the text that a consumer would supply in a specific order will be completely reversed. In the instance beneath, different alternatives of reversing a string with C have been employed.

    When implementing this guide, we have been working on Ubuntu 20.04 Linux system configured on Virtual Box. While working on a Linux system, we used to do most of our installations and queries on the terminal shell. Hence, open the terminal shell by a shortcut “Ctrl+Alt+T” or search it via an application search bar under the Activity area of the Ubuntu desktop. It is necessary to update your system first via the apt update query. It will ask you for the current user password to run the update. Hence, add a password and press Enter button.

  • Using Strings in C with Examples – Linux Hint

    Strings are just a one-dimensional collection of characters with the null character ‘0’ at the end. On the other hand, a null-terminated string includes the characters that make up the string, succeeded by a zero. In this article, you will learn about how to deal with strings in Ubuntu 20.02 Linux system. Make sure you have GCC compiler installed in the system. Now open the terminal via Ctrl+Alt+T to get started.

  • How to Initialize a std::vector in C++ with Examples – Linux Hint

    The full path of a file or folder from the root directory is specified by absolute path. In Python, the Current Working Directory is set to the directory location from where the python script executes. Many modules exist in python to get the Current Working Directory. How to get the Current Working Directory in Python is explained in this article.

  • Arrow -> Operator in C with Examples – Linux Hint

    To understand the working of the Arrow operator, we need to understand what pointer is first. In C++, pointer exists as a mutable, which always refers to the location of some other mutable of almost any data kind, such as an int, char, or float, since we’ve already taught. A pointer to structures could be used likewise, with a pointer mutable pointing to the location of such a structure mutable. Throughout C/C++, the Arrow operator may be used to access items in Unions plus Structures. It can be used in conjunction with such a pointer variable that points to a structure and union. A negative sign precedes the greater than mark to construct the arrow operator. Throughout C or C++, the -> operator assigns the content of the mutable name to the structural or union mutable pointer name.

  • Bitwise operators in C with Examples – Linux Hint

    The bitwise operators have been used to manipulate data only at the bit level. Bit-level computing would be done when you execute bitwise operations. It comprises two numbers, one of which is 0 and the other one is 1. It’s mainly used to speed up mathematical calculations. Inside the C language, we use several sorts of bitwise operators as below. Let’s discuss each one of them one by one. At the time of implementing this guide article, we have been working on Ubuntu 20.04 Linux system. We have successfully logged in from the system and installed the GCC compiler to compile C language code. Without a compiler, we are unable to execute our C script. After that, we have used the Ctrl+Alt+T key shortcut to open the terminal shell, as we have been doing every implementation and execution on a shell.

Python

  • How to Read YAML File in Python – Linux Hint

    The full form of YAML is Yet Another Mark-up Language. This file format is very popular now to store serialized data that is human-readable. It is mainly used for configuration files, but it can be used for other purposes also. Different types of scalar data such as number, string, etc., and compound data such as list, the dictionary can be the content of this file. The extension of this fie is ‘.yaml’. Multiple modules exist in Python to read the YAML file. The use of the PyYAML module to read the YAML file in Python has shown in this tutorial.

  • How to Read Binary Files in Python – Linux Hint

    The file that contains the binary data is called a binary file. Any formatted or unformatted binary data is stored in a binary file, and this file is not human-readable and is used by the computer directly. When a binary file is required to read or transfer from one location to another location, the file’s content is converted or encoded into a human-readable format. The extension of the binary file is .bin. The content of the binary file can be read by using a built-in function or module. Different ways to read binary files in Python have been shown in this tutorial.

  • How to Read from stdin in Python – Linux Hint

    Take input from the user is an important part of any programming language. The output of the many programs depends on the standard input. The way of taking input from the user is different for different programming languages. Many ways exist in python to read from the standard input. The input() function is the most common way is to read from the standard input, which is a built-in function. The sys.stdin is another way is to read from the standard input the calls input() function internally. Python has another module named fileinput for reading the standard input. The input() function of this module can be used to read standard input or read content from one or more files. Different ways to read from the standard input in Python have been explained in this tutorial.

  • How to Get Current Working Directory in Python – Linux Hint

    The file or folder name can be used with the full path or just mentioning the file or folder name only to use it in the script. The full path of a file or folder from the root directory is specified by absolute path. When the file name is used without the pathname in the script, then the Current Working Directory is assumed as the file’s pathname and is called the relative path. In Python, the Current Working Directory is set to the directory location from where the python script executes. Many modules exist in python to get the Current Working Directory. The ways to retrieve the Current Working Directory by using different modules in Python have shown in this tutorial.

  • Sort () V/s Sorted () – Linux Hint

    Sorting is a technique to rearrange the elements or data either in ascending order or descending order. In Python programming, we can do sorting very easily with the help of the methods sort () and sorted ().

    The sorted () and sort () methods arrange the elements either in ascending or descending order. Even both perform the same operations, but still, they are different.

    For these tutorials, users must have some basic ideas about the list, tuples, and sets. We will be using some basic operations of these data structures to show a clear picture of sort () and sorted () built-in methods. And for this, I am using Python3, so if you are using Python2, then there might be some output difference.

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.