Language Selection

English French German Italian Portuguese Spanish

Programming Leftovers

Filed under
  • 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

Videos/Shows: Red Hat Enterprise Linux 9, The Linux Link Tech Show, Bad Voltage, and BSD Now

today's howtos

  • GNU Linux (distro independent) – how to set fixed ip (brute force overwrite) – temporarily (also possible for DNS)

    this is a quick bash hack, to set an additional fixed ip to the user’s interface, this will (brute force) OVERWRITE all mess done by network managers of various origins: (there should be only one config file to config network settings and it is: /etc/network/interfaces, instead of 10x entities inventing it’s own standard, confusing the heck out of users, just keep the standard that is already there?)

  • How to Enable More Multi-Touch Gestures in Ubuntu 22.04 GNOME 42 | UbuntuHandbook

    This simple tutorial shows how to enable 3-finger & 4-finger multi-touch gestures in Ubuntu 22.04, Fedora 36 and other Linux with GNOME 40+, while the desktop by default supports only few gestures.

  • How to Install Open Source osTicket on Ubuntu 20.04

    A server can contain many important business applications. These applications can help us to deploy even a support ticket system to better manage the technical service of a company. Today, you will learn how to install osTicket on Ubuntu 20.04.

  • How to Install and Use Bitwarden on Linux

    A password manager is an application that lets you generate new passwords and store existing ones securely. It eliminates the need to create and remember strong and complex passwords yourself for all your accounts. Depending on the device and operating system you're using, you can find all kinds of password managers. Bitwarden is a free-to-use password manager that comes with all the essential password management features. Follow along to learn how to install and set up Bitwarden on Linux.

  • How to install Borgmatic for easy Linux server backups | TechRepublic

    Do you have a reliable backup solution running on your Linux servers? If not, what’s your plan for disaster recovery? The word “disaster” alone should be enough to help you realize backups are an absolutely crucial part of your organization. If you’re in the market for a new Linux backup solution, there’s a lesser-known solution that does an outstanding job, and it’s fairly easy to install and configure. That solution is Borgmatic. This simple, configuration-driven backup solution protects your files (and even databases) with client-side encryption and even offers third-party integration for things like monitoring. I want to walk you through the process of installing Borgmatic on Ubuntu Server 22.04. When complete, you should feel confident your important data is regularly being backed up.

  • How to install the Caddy web server on Ubuntu Server 22.04 | TechRepublic

    Caddy is a powerful open-source web server, written in Go, that can be used to host web applications in a production environment. Caddy features built-in automated TLS certificate renewals, OSCP stapling, static file serving, reverse proxy, Kubernetes ingress and much more. Caddy can be run as a stand-alone web server, an app server or even within containers. In this tutorial, I’m going to walk you through the steps of installing Caddy on Ubuntu Server 22.04 and then how to create a simple, static site.

Jive Search is your private self-hosted search engine

Ever wanted your own search engine that you can host, control and make sure your searches are not leaked or recorded?. Then it is time to check Jive Search. Jive Search is a free, open-source search self-hosted search engine that you can run on your machine or server. The app is written using the Go programming language for better performance. Read more Also: MinIO is an open-source multi-cloud object storage for Amazon S3 for enterprise


  • iotop partly broken in Easy Dunfell and Bookworm

    Running iotop (from "System" menu), there is a message: CONFIG_TASK_DELAY_ACCT not enabled in kernel, cannot determine SWAPIN and IO This problem arrived with the 5.15 kernel. It is configured with CONFIG_TASK_DELAY_ACCT, but is not activated. It has to be activated with a kernel commandline parameter. Apparently, this change was made because this feature imposes a very slight performance overhead on I/O.

  • Zram with lz4 compression in kernel

    Oh man, I recompiled the kernel yet again! Having very recently become enamoured of lz4, I saw that zram only has lzo and lzo-rle compression enabled. So, have also enabled lz4.

  • Simpler labels for desktop icons
  • Using EasyOS with Ventoy

    If you want to put EasyOS into Ventoy, it used to work -- only just -- now doesn't. The Ventoy website has a tick alongside EasyOS, meaning it works. However, there is this problem... When Easy is on its own on a USB-stick, at first bootup, the ext4 working-partition is expanded to fill the drive, then it is populated. That population includes 'vmlinuz', 'initrd' and 'easy.sfs' copied from the boot-partition to the working-partition.