Language Selection

English French German Italian Portuguese Spanish

today's leftovers

Filed under
Misc

  • Header Guards C++

    A header guard in C++ is a component that proves to be your savior whenever you attempt and make a mistake while writing your code by defining a function more than once with the same name. Every programmer needs to know that it is never considered good practice to include the function definitions in the header files. However, at times, you need to do so. In that case, you must know how to properly use the header guards in C++. Therefore, this article discusses the need to use the header guards in C++, followed by some examples to teach you their usage on the Ubuntu 20.04 system.

    Why Do We Need to Use the Header Guards in C++?

    While writing your code, you define certain header files on your own, depending upon the functionality you require. After creating these header files, you can include them all in your .cpp file that contains your actual code. However, sometimes these header files depend upon each other. So, you have to include one header file into another. In that case, when you include both these header files into your .cpp file, the same functions of one header file might be defined twice. This leads to the generation of a compile-time error since C++ strictly prohibits the definition of the same function twice within the same code. Therefore, we use the header guards to protect your header files from malfunctioning to resolve this dependency issue.

    These header guards can be implemented using the four pre-processor directives: #ifndef, #define, #ifdef, and #endif. For example, whenever you enclose a piece of code within the “#ifndef” directive, the compiler always checks whether the following code has been previously defined or not. If not, then the statements following the “#define” directive are executed. Otherwise, these statements are simply ignored. This, in turn, ensures that your program always compiles successfully and the same functions are not defined more than once within the same code. The “#ifdef” directive works vice-versa. You will be able to understand all this in a better way after going through the following two examples.

  • 2021 in review: 'Right to Repair' campaigners claim iPhone victory

    Manufacturers, including Apple, are still introducing new features that appear intended only to make repairs more difficult, says Kevin Purdy at iFixit, a company that sells spare parts and offers free how-to guides. Components that are glued together or require proprietary tools to remove are common and can often be overcome using third-party kits from such services, but a growing trend is for companies to add software-coded serial numbers to components, which alert the device to any unauthorised repairs.

  • New year, new Opensource.com community manager | Opensource.com

    I am privileged to be here at Opensource.com as the new community manager. I'm looking forward to working with existing correspondents and contributors, and also bringing in new contributors and increasing the diversity of thoughts and ideas shared here on Opensource.com.

  • Best Ubuntu Themes In 2022

    Ubuntu is one of the most popular Linux operating systems right now on the internet. It is often considered as the first choice for people using Linux for the first time.

    In this post, we will be discussing the best Ubuntu themes available on the internet. You can install various Ubuntu themes to make your distro more beautiful.

  • Noodlings 35 | Light for Christmas
  • Happy New Year, Folks — Let's Fill it with Linux, Yeah?! - OMG! Ubuntu!

    This is a short (and yes, rather predictable) post to wish every single person reading this site a very merry—wait, we’ve already had that one—a happy new year.

    Yes, even those of you still sat in your pants (the British kind).

    It may feel like the world now exists in a dark timeline but there are things to be hopeful about, especially where Linux and open source software is concerned.

    After all, despite the environment, 2021 was a particularly buoyant year for Ubuntu on the desktop

    Ubuntu 21.04 and 21.10 both made their way out with new features, new kernels, and in the latter’s case, even a new desktop. Strong foundations laid ahead of April 2022 release of Ubuntu 22.04 LTS.

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.