Language Selection

English French German Italian Portuguese Spanish

Programming Leftovers

Filed under
Development

  • How to use C++ Unordered Map

    A map, also known as an associative array is a list of elements, where each element is a key/value pair. So, each key corresponds to a value. Different keys can have the same value, for ordinary work. For example, the keys can be a list of fruits and the corresponding values, the colors of the fruits. In C++, the map is implemented as a data structure with member functions and operators. An ordered map is one where the element pairs have been ordered by keys. An unordered map is one where there is no order. This article explains how to use C++ unordered map, written as unordered_map. You need knowledge in C++ pointers to understand this article. unordered_map is part of the C++ standard library.

  • How to use memcpy function in C language?

    In the C language memcpy() function is used to copy a block of memory from one location to another. In this article, we are going to discuss in detail how the memcpy() function is used. So, let’s get started.

  • How teachers train in Computing with our free online courses
  • Python String Formatting

    String formatting is a significant feature of any programming language. By using string formatting, you can properly arrange your string. String formatting helps users understand the output in a well-defined, coherent way. In Python, string formatting can be performed in various ways, i.e., by using the ‘%’ operator and the ‘format ()’ function.

    This article explains string formatting in Python using the ‘%’ operator and the ‘format ()’ function. The Spyder3 editor is used to write and run the Python scripts shown in this article.

  • Python Variables

    A Python variable is a location in memory to store the values. The variables are reserved memory locations. A variable is a bag or container that stores the value. We store our data in a Python variable which is subsequently used for multiple purposes i.e. processing, value printing, etc. Every value that is assigned to a variable has a data type.

  • Python Functions

    A function is a block or group of similar statements that perform a specific task. A function is written to perform the task. In Python, a function takes the input, performs the task, and returns the output. A function also makes the code reusable; instead of writing the same code again and again for performing a similar task, we can make a function and call it.

    Python has various built-in functions, including print (), type (), and more. But, we can also define or write our functions. We call these functions “user-defined” functions. In this article, you will learn how to define a function with multiple examples. The Spyder3 editor is used for creating and writing the Python scripts shown in this article.

  • What is a Bash Script?

    Many times while working with the different flavors of the Linux operating system, we come across the terms of shell scripting or bash scripting. Most of the naïve users often wonder what these terms really refer to. Shell is a command-line interpreter used with Linux which has multiple different flavors. In this article, we are interested in exploring its variation named Bash. We will throw light on the concept of Bash scripts and we will try to understand them with the help of a few very basic examples. So, let us try and dig deeper into Bash and Bash scripting.

    [...]

    Whenever you launch the terminal in Linux operating system, the default program that runs inside it is Shell or Bash. This default program is responsible for interpreting all the commands that you run on the Linux operating system. We can also say that Bash is responsible for running the other programs in the Linux operating system. On the other hand, the Linux terminal acts as a bridge between Bash and the user and enables a smooth interaction between them.

    Since Bash is responsible for executing the commands that you run in the Linux terminal, therefore, many of the important tasks can be associated with it as its responsibilities. It can be used to configure different programs or even run them via terminal. It can manipulate the files stored on your Linux operating system. It is also capable of interacting with databases. Apart from this, Bash is also a full-fledged scripting language and we will try to find out how is it possible in the next section of this article.

  • Using the “awk” Command to Print the Last Column from a File

    “awk” is a very powerful Linux command that can be used with other commands as well as with other variables. This command is essentially used to read the content of a file. The process of file reading has never been this much easier as it is with this efficient command. File reading and writing are very repeatedly used especially if you are a programmer. The read file can then be used to process its content, to modify it, or even to simply print it.
    However, there are situations in which you do not intend to read the entire content of that file rather you are only concerned with a specific portion of that file. In such a situation, it is highly not recommended to read the entire file since it will occupy extra space and will also take a longer time for processing rather you should directly hit that particular portion of that file. In this article, we aim to walk you through the different methods of using the “awk” command to print the last column from a file.

  • Daniel Stenberg: rust in curl with hyper

    curl and its data transfer core, libcurl, is all written in C. The language C is known and infamous for not being memory safe and for being easy to mess up and as a result accidentally cause security problems.

    At the same time, C compilers are very widely used and available and you can compile C programs for virtually every operating system and CPU out there. A C program can be made far more portable than code written in just about any other programming language.

    curl is a piece of “insecure” C code installed in some ten billion installations world-wide. I’m saying insecure within quotes because I don’t think curl is insecure. We have our share of security vulnerabilities of course, even if I think the rate of them getting found has been drastically reduced over the last few years, but we have never had a critical one and with the help of busloads of tools and humans we find and fix most issues in the code before they ever land in the hands of users. (And “memory safety” is not the single explanation for getting security issues.)

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.