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

Ubuntu 21.04 (Hirsute Hippo) Reached End of Life, Upgrade to Ubuntu 21.10 Now

Dubbed by Canonical as the “Hirsute Hippo,” Ubuntu 21.04 was released nine months ago, on April 22nd, 2021. It was the first Ubuntu release to use the next-generation Wayland display server by default for its Ubuntu Desktop flavor, which uses a modified version of the GNOME desktop environment. Ubuntu 21.04 didn’t make the plunge into the GNOME 40 desktop environment series due to its redesigned Activities Overview, but it did ship with support for GNOME 40 apps while being built on top of the older GNOME 3.38 desktop environment series. Read more

today's leftovers

  • Supplino is a variable benchtop power supply that you can build yourself | Arduino Blog

    Working with electronics requires access to stable power in a variety of voltages. Some components require 3.3V and others require 5V. Still others need 9V or 12V — there are many possibilities. You could keep a variety of wall warts on hand, but a variable benchtop power supply is a more convenient option. Supplino is one choice and this guide from Giovanni Bernardo and Paolo Loberto will walk you through how to build one. Supplino can accept anything from 4 to 40 volts and can output anything from 1.25 to 36 volts, with a maximum of 5A. An XH-M401 module with an XL4016E1 DC-DC buck converter handles the voltage regulation. Technically, you could use that alone to power your components. But the addition of an Arduino Nano board (or Nano Every) makes the experience far friendlier. It monitors the power supply output and drives a 1.8″ 128×160 TFT LCD screen, which displays the present voltage, amperage, and wattage.

  • Relocating Fedora's RPM database [LWN.net]

    The deadlines for various kinds of Fedora 36 change proposals have mostly passed at this point, which led to something of a flurry of postings to the distribution's devel mailing list over the last month. One of those, for a seemingly fairly innocuous relocation of the RPM database from /var to /usr, came in right at the buzzer for system-wide changes on December 29. There were, of course, other things going on around that time, holidays, vacations, and so forth, so the discussion was relatively muted until recently. Proponents have a number of reasons why they would like to see the move, but there is resistance, as well, that is due, at least in part, to the longstanding "tradition" of the location for the database.

  • CPU Isolation – A practical example – by SUSE Labs (part 5)
  • How to install Mantis bug tracker on Debian 11?

    Hello friends. In this post, you will learn how to install Mantis Bug Tracker on Debian 11.

Server: MongoDB vs. DynamoDB, Mirantis, and More

  • MongoDB vs. DynamoDB: What you need to know

    NoSQL databases have become more popular because of the need for more flexible backend solutions. These databases run applications that require a more flexible data structure than traditional structured databases can provide. Robust feature-rich NoSQL database platforms famous for NoSQL databases include MongoDB and DynamoDB. This article guide will compare these two databases to help you choose the right one for your project.

  • Mirantis brings secure registries to Kubernetes distros | ZDNet

    Mirantis Secure Registry, formerly Docker Trusted Registry, provides an enterprise-grade container registry solution. You can use this as a foundation to build a secure software supply chain. It does this by providing you with access to a container image registry that has enhanced levels of security beyond that of public registries. This, in turn, gives you more control over this critical part of their software supply chain. The comprehensive, built-in security enables users to verify and trust the automated operations and integration with Continuous Integration/Continuous Delivery (CI/CD) pipelines to speed up application testing and delivery. You can use MSR alongside your other apps in any standard Kubernetes 1.20 and above distribution, via standard Helm techniques. While the new MSR is no longer integrated with Mirantis Kubernetes Engine (MKE) as it was earlier, it still runs as well as ever on MKE as it does with any other supported Kubernetes distribution.

  • How North Dakota Is More Like Windows than UNIX

    If your official name is YATES, you can't (and presumably needn't) file a petition to change it to Yates. "Petitioners have offered no authority or reasoned argument that there is any legal significance to the capitalization of their names."

  • The Success of ‘Open-hearted’ Partnerships in the Cloud | SUSE Communities

    The future is open — and it’s better together. At SUSE, we pride ourselves on our partnerships, and sometimes what we can achieve together surpasses even our greatest hopes. That’s what our award-winning, cloud-based, high-performance computing (HPC) partnership with UberCloud, Dassault Systèmes, and Google Cloud achieved, by enabling 3DT Holdings researchers to create an affordable, real-time heart surgery simulator for physicians to use when it matters most. This is an ongoing relationship with the Living Heart Project that we think is just the beginning of what this ground-breaking research can achieve — and the lives it can save.

Programming Leftovers

  • An outdated Python for openSUSE Leap [LWN.net]

    Enterprise distributions are famous for maintaining the same versions of software throughout their, normally five-year-plus, support windows. But many of the projects those distributions are based on have far shorter support periods; part of what the enterprise distributions sell is patching over those mismatches. But openSUSE Leap is not exactly an enterprise distribution, so some users are chafing under the restrictions that come from Leap being based on SUSE Enterprise Linux (SLE). In particular, shipping Python 3.6, which reached its end of life at the end of 2021, is seen as problematic for the upcoming Leap 15.4 release. [...] OpenSUSE and SLE have generally been aligned over the years. In 2020, Leap and SLE grew even closer together. The build system and repositories between the two were shared starting with Leap 15.2, which corresponded to the second "service pack" (SP) of SLE (i.e. SLE 15-SP2). In 2021, with Leap 15.3 and SLE 15-SP3, the two distributions effectively merged, such that all of the base packages were shared between the two. To a first approximation, Leap is an openSUSE-branded version of SLE, much like what CentOS used to be for Red Hat Enterprise Linux.

  • Make Your Python CLI Tools Pop With Rich | Hackaday

    It seems as though more and more of the simple command-line tools and small scripts that used to be bash or small c programs are slowly turning into python programs. Of course, we will just have to wait and see if this ultimately turns out to be a good idea. But in the meantime, next time you’re revamping or writing a new tool, why not spice it up with Rich?

  • An outdated Python for openSUSE Leap [LWN.net]

    Enterprise distributions are famous for maintaining the same versions of software throughout their, normally five-year-plus, support windows. But many of the projects those distributions are based on have far shorter support periods; part of what the enterprise distributions sell is patching over those mismatches. But openSUSE Leap is not exactly an enterprise distribution, so some users are chafing under the restrictions that come from Leap being based on SUSE Enterprise Linux (SLE). In particular, shipping Python 3.6, which reached its end of life at the end of 2021, is seen as problematic for the upcoming Leap 15.4 release. [...] OpenSUSE and SLE have generally been aligned over the years. In 2020, Leap and SLE grew even closer together. The build system and repositories between the two were shared starting with Leap 15.2, which corresponded to the second "service pack" (SP) of SLE (i.e. SLE 15-SP2). In 2021, with Leap 15.3 and SLE 15-SP3, the two distributions effectively merged, such that all of the base packages were shared between the two. To a first approximation, Leap is an openSUSE-branded version of SLE, much like what CentOS used to be for Red Hat Enterprise Linux.

  • Make Your Python CLI Tools Pop With Rich | Hackaday

    It seems as though more and more of the simple command-line tools and small scripts that used to be bash or small c programs are slowly turning into python programs. Of course, we will just have to wait and see if this ultimately turns out to be a good idea. But in the meantime, next time you’re revamping or writing a new tool, why not spice it up with Rich?