Language Selection

English French German Italian Portuguese Spanish

Programming Leftovers

Filed under
Development
  • with Statement – Linux Hint

    The Python with statement is a very advanced feature that helps to implement the context management protocol. When the programmer starts coding, they are basically using the try/except/finally to maintain the resources. But there is another way to do this automatically, called the ‘with’ statement.
    So, in this article, we will discuss how we can use the ‘with‘ statement.

    We can understand this with a very simple example.

    Whenever we code something to read or write a file, the first thing which we have to do is to open the file, and then we perform the read or write operations on that and, at last, we close the file so that all the resources will not be busy. So it means that we have to release the resource after we complete our work.

  • Assembly of Python External C++ procedure returning the value of string type

    Writing C++ procedure below we get a final answer as C++ string , then via sequence of operations which convert string to the pointer (say c) to "const char" and finally return required value via pointer to PyObject provided by PyUnicode_FromString(c) to Python Runtime module.

  • How to split string in C++ – Linux Hint

    Working with string data is an essential part of any programming language. Sometimes we need to split the string data for programming purposes. The split() function exists in many programming languages to divide the string into multiple parts. There is no built-in split() function in C++ for splitting string but many multiple ways exist in C++ to do the same task, such as using getline() function, strtok() function, using find() and erase() functions, etc. The uses of these functions to split strings in C++ have been explained in this tutorial.

  • Do while in c – Linux Hint

    Loops in C are divided into two parts. One is the loop body, and the other is the control statement. Each loop is unique in its way. Do while loop is alike to a while loop in some aspects. In this loop, firstly, all the statements inside the body are executed. In case the condition is true, then the loop is again executed until the condition becomes false. In this guide, we will shed some light on the examples of do-while loops.

  • C++ class constructors – Linux Hint

    Constructors are like functions. These are used to initialize the values and the objects of the class. These constructors are initiated when the object of a class is created. Constructor directly does not return any value. To get the value of the constructor, we need to describe a separate function as the constructor doesn’t have any return type. Constructor differs from the simple function in different ways. A constructor is created when the object is generated. It is defined in the public segment of the class.

    In this article, we will deliberate on all these types of constructors with examples.

  • Comparing Strings in Java – Linux Hint

    It is easier to understand the comparison of characters before learning the comparison of string literals. A comparison of strings is given below this introduction. With Java, characters are represented in the computer by integers (whole numbers). Comparing characters means comparing their corresponding numbers.

    With Java, uppercase A to uppercase Z are the integers from 65 to 90. A is 65, B is 66, C is 67, until Z, which is 90. Lowercase ‘a’ to lowercase ‘z’ are the integers from 97 to 122. ‘a’ is 97, ‘b’ is 98, ‘c’ is 99, until ‘z,’ which is 122. Decimal digits are the integers, 48 to 57. That is, ‘0’ is 48, ‘1’ is 49, ‘2’ is 50, until 9, which is 57.

    So, in this new order, digits come first before uppercase letters, which come next before lowercase letters. Before the digits, there is the bell, which is a sounding and not a printable character. Its number is 7. There is the tab character of the keyboard, whose number is 9. There is the newline character (pressing the Enter key), whose number is 10. There is the space character (pressing the space-bar key), whose number is 32. There is the exclamation character, whose number is 33. There is the forward-slash character, whose number is 47. ‘(’ has the number, 40 and ‘)’ has the number, 41.

  • How to use HashMap in Java – Linux Hint

    The column on the left has the keys, and the column on the right has the corresponding values. Note that the fruits, kivi, and avocado have the same color, green. Also, the fruits, grapes, and figs have the same color, purple. At the end of the list, three locations are waiting for their own colors. These locations have no corresponding fruits; in other words, these three locations have no corresponding keys.

More in Tux Machines

Software: Matrix, Ktube, and Monero P2Pool

  • Chat Bubbles on Element and Several Matrix Apps

    This simple comparison wants to help everyone adopt alternative messaging technology, Matrix, with suitable user interface to them. We call Matrix Apps to instant messengers like Element, Fluffy, Nheko, Schildi and Spectral as they are created based upon the said technology. We will start by setting up criteria first that includes chat bubbles, then going through these messengers one by one, and you will see their pictures here along with a little comments from me. I hope you can pick up the messenger with UI you love the most from here.

  • Ktube Media Downloader lets you download YouTube videos easily on Linux

    I always like to tell people about how I have been using Linux as my primary operating system for over ten years. I love Linux, I understand it, it’s free and above all, it fits my workflow in a way Microsoft’s Windows (with all its goodness) probably never will. That also means I love and am a command-line ninja but I also know one thing, a lot of people out there fear and hate the command line.

  • Monero P2Pool V1.0 Is Released

    The latest version of P2Pool, a decentralized Monero mining pool has released. This is the first official release, signaling an invitation for more users to try out the new software.

Better Support & Performance For OpenACC Kernels Is Coming To GCC

While the GNU Compiler Collection has supported OpenACC for a few years now as this parallel programming standard popular with GPUs/accelerators, the current implementation has been found to be inadequate for many real-world HPC workloads leveraging OpenACC. Fortunately, Siemens has been working to improve GCC's OpenACC kernels support. GCC's existing OpenACC kernels construct has been found to be "unable to cope with many language constructs found in real HPC codes which generally leads to very bad performance." Fortunately, improvements are on the way and could potentially be mainlined in time for next year's GCC 12 stable release. Read more

Security Leftovers

  • Database containing 106m Thailand travelers' details leaked • The Register

    A database containing personal information on 106 million international travelers to Thailand was exposed to the public internet this year, a Brit biz claimed this week. Bob Diachenko, head of cybersecurity research at product-comparison website Comparitech, said the Elasticsearch data store contained visitors' full names, passport numbers, arrival dates, visa types, residency status, and more. It was indexed by search engine Censys on August 20, and spotted by Diachenko two days later. There were no credentials in the database, which is said to have held records dating back a decade. “There are many people who would prefer their travel history and residency status not be publicized, so for them there are obvious privacy issues,” wrote Comparitech editor Paul Bischoff on the company’s blog.

  • Break out your emergency change process and patch this ransomware-friendly bug ASAP, says VMware

    VMware has disclosed a critical bug in its flagship vSphere and vCenter products and urged users to drop everything and patch it. The virtualization giant also offered a workaround.

  • Reproducible Builds (diffoscope): diffoscope 185 released

    The diffoscope maintainers are pleased to announce the release of diffoscope version 185. This version includes the following changes:

    [ Mattia Rizzolo ]
    * Fix the autopkgtest in order to fix testing migration: the androguard
      Python module is not in the python3-androguard Debian package
    * Ignore a warning in the tests from the h5py package that doesn't concern
      diffoscope.
    
    [ Chris Lamb ]
    * Bump Standards-Version to 4.6.0.
    

GNOME 41 Released. This is What's New.

GNOME team announced the release of GNOME 41 with some exceptional changes and updates. We wrap up the release in this post. Read more