Language Selection

English French German Italian Portuguese Spanish

Programming Leftovers

Filed under
Development
  • p6steve: raku at Monterey Docks (part II)
  • Convert a String to JSON Python

    In Python, strings are a series of elements or items. The strings are unchangeable objects. We cannot change the string after their declaration. “JavaScript Object Notation” is the full form of JSON. In Python, the ‘JSON files contain information that is readable for humans. The elements appear in the form of pairs.

    In web APIs, the information we send and receive is usually in the form of a dictionary string. To utilize this information, we extract consequential data. For this, we have to convert this information to dictionary format for more operations. JSON provides several techniques for serializing and deserializing “JSON”. The process of changing the string to “JSON” is called serializing. And the process of converting the JSON to a string is known as deserializing. Serialization is the opposite of deserialization. Several methods are used to convert strings to JSON.

  • How Do You Repeat a String n Times in Python?

    In Python, we utilize the asterisk operator to repeat a string. This operator is indicated by a “*” sign. This operator iterates the string n (number) of times. The “n” is an integer value. After repetition, a new string is created. The operation requires two arguments: a string and an integer value. We multiplied the string by a specific number for the repetition of string n times. Repeating the string merges the copy into an identical string. The asterisk operator repeats the string up to a definite length.

  • How Do I Check If a String Is Empty in Python?

    The strings are unchangeable. We cannot modify the string after defining it. Different operations are performed on strings. If we have a string that contains only whitespaces in it, that string is not considered empty. It contains the size of the non-zero value. So, if len() method and “not” operator is applied on this type of string, it considers whitespace as an element of the string. Sometimes in Python, we want to check whether the specified string is blank or not. To check the emptiness of the given string, use the “not” operator to utilize the variable of string instead of a condition, or utilize the equal operator to match an empty string. Now, we are going to explain numerous methods...

  • Static Method C++

    A method in C++ is also known as a function, and using methods in C++ promotes the concept of modular programming and code reusability. It means the methods that are once written can be called repetitively for as many times as needed without having the necessity of writing them every time.

  • C++ Unsigned Integers

    The integer data type in C++ is further divided into many sub-types. One such sub-type is the unsigned integers. The unsigned integers are capable of storing only the positive whole numbers. The unsigned integers in C++ are preferred while manipulating bits in operating systems since you have limited storage space. Moreover, they can also be used for array indexing since the index of an array can never be negative. This article is devoted to the discussion of the unsigned integers in C++ in Ubuntu 20.04.

  • C++ Getline function

    Getline() is used to get the input string from the user in one or more lines until a special character comes (delimiter). It is a predefined function and uses a library in the program, as its definition is present inside the library’s header file.

  • C++ Pointer Arithmetic

    Within mathematics, we have always used the term raise to the power for calculating a number having some power exponent on it. This can be said as (base number) raise to the power (exponent). How an exponent can be used for raising a number to a certain power in C++ is discussed in this article.

  • Exponents in C++ to Raise a Number in Power

    Within mathematics, we have always used the term raise to the power for calculating a number having some power exponent on it. This can be said as (base number) raise to the power (exponent). So, within today’s article, we will see how an exponent can be used for raising a number to a certain power in C++. Make sure to have a G++ compiler already installed and configured on your Linux operating system. Let’s start implementing today’s article by opening the shell terminal using the shortcut “Ctrl+Alt+T”. As the terminal is opened now, we can start implementing our examples.

  • Bit masking in C++

    Bit masking is a process that is used to access a specific bit in the bytes of data. This phenomenon is used when you are performing the process of iteration. A bitmask is said to be a mask of a sequence of N –bits that are used to encode a part of our collection.

    These elements of the mask can be set or cannot be. There are bitwise operators to create or toggle the bits. These operators are used to turn on the off bit or vice-versa.
    To use the C++ programs in executing them on Linux, you need to have the Ubuntu file configured and in running state. Moreover, the user must have some knowledge of the C++ language. C++ source codes are written in the text editor. Whereas for the execution process, use the Ubuntu terminal.

    A bitmask is also said to be a simple mask that is a sequence of n bits. It encodes the subset of the collection. The element ‘I’ is present in the subset of the ‘ith’ bit is set in the mask. For the set of elements having nth bytes, there are chances of having a 2N mask corresponding to a subset.

  • Deep Copy C++

    The copy means the same to the same replica of an original object. Within programming, there are different methods to create copies of objects. The copy of objects, variables can be done with a copy constructor or using the default assignment operator “=”. Two types of copies can be made within the C++ code, i.e., shallow and deep copy. You can use one to copy any variable or object in the code. When our object has variables that are dynamically allocated throughout the program, we need to create a Deep copy of such type of object. This article will see how a Deep copy can be created in C++.

  • An Introduction to MATLAB: Structure and Application

    Programming is the core of a modern computer. You can not even think of an alive computer without programming. There are several languages to do computer programming, and each of them has its special field. Some are known for scientific computation, and some are specialized for making the building blocks of an operating system. MATLAB is also a very popular programming language. Today we are going to get an absolute introduction to MATLAB and its wide application in today’s world.

    Although there is a wide variety of programming languages available there in the virtual world, we have chosen MATLAB for several important reasons. It is a compact language for heavy-duty works. We are going to discover each and every detail of MATLAB in this journey. Stay with us to learn. The more you know, the more you grow.

GCC and Loongson

  • Loongson Posts Patch Series For Bringing Up LoongArch In GCC Compiler - Phoronix

    China's Loongson continues bringing up LoongArch processor support for Linux with this MIPS64-based ISA now seeing the complete patch series for review to enable the GNU Compiler Collection (GCC).

    For months Loongson has been working on LoongArch support for the Linux kernel to varying extents from the new CPU ISA functionality to copying a lot of existing MIPS64 code and adding in new IDs. That Linux kernel support is still in the works.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

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.