Language Selection

English French German Italian Portuguese Spanish

Programming Leftovers

Filed under
Development
  • abs function in C

    Why is it necessary for programmers to use the abs() function? It’s accessible in almost every programming language; But how much good is a function that just turns negative values into positive ones? You may find yourself wanting positive numbers occasionally, and the abs() function ensures that you will get them. The abs function is an abbreviation for “Absolute Value” inside the C programming language, and it specifies the distance of a number just on a number line beginning from 0 without taking the direction into account. The abs value of a number, or its absolute value, has always been positive, implying that a distance could never be negative.
    The abs () method returns the absolute appropriate value integers and is specified in the stdlib.h header file. To return the absolute value of a particular number, we must include the stdlib.h header file in our C application. Only positive values are returned by the abs() function.

    Consider the following scenario: If we have an integer number -2 and wish to find the absolute value, we may use the abs() method to have the positive number 2. In addition, when we have an integer number 2 and want to determine the absolute value, we can use the abs() method to return the very same value as 2. It gives the very same number if we provide it with any positive number.

  • Printf-style debugging using GDB, Part 2

    The first article in this series introduced the GNU debugger, GDB, and in particular its dprintf command, which displays variables from programs in a fashion similar to C-language printf statements. This article expands on the rich capabilities of printf-style debugging by showing how to save commands for reuse and how to save the output from the program and GDB for later examination.

  • Python Wrapper to find all primes from a given interval via sieve of Eratosthenes released as C++ procedure
  • Intel Contributes AVX-512 Optimizations To Numpy, Yields Massive Speedups - Phoronix

    Intel has contributed AVX-512 optimizations to upstream Numpy. For those using Numpy as this leading Python library for numerical computing, newer Intel CPUs with AVX-512 capabilities can enjoy major speed-ups in the range of 14~32x faster.

    This summer Intel volleyed their initial AVX-512 code for Numpy and finally this week the code was merged upstream. This open-source AVX-512 code originates from the Intel Short Vector Math Library (SVML) that they open-sourced the code from. Intel has also been working on allowing Numpy to be built against SVML as a separate improvement.

  • TSV to CSV on the CLI (if you really have to)

    Regular visitors to this blog will know that I don't like the CSV format. It's awful. In my humble opinion, data workers should aim to use invisible tabs (TSV) or visible pipes (PSV) as field separators in delimited text tables. Sometimes, though, data workers are required to convert a perfectly good TSV or PSV to a CSV. What to do?

    I don't recommend opening the TSV or PSV in spreadsheet software and saving the result as a CSV, unless there are no leading or trailing quotes in the data items, or umatched quotes generally. The original quotes might well disappear in the saved CSV.

    There are a number of TSV-to-CSV programs for the command line. One is in Haskell, for example, and there also routines to do the job in Perl and Python. But if the individual fields in the TSV don't contain commas or quotes, the TSV-to-CSV conversion is simple — use tr:

  • Useful Bash Commands You May Not Know About

    Bash is a fairly powerful language to program in, and is also quite easy to start off with.

    After all, it's almost universally the shell you're going to see when you open up your terminal. That makes it extremely useful to get accustomed to.

    There's some powerful commands in Bash that you may not be aware of though, even if you're fairly seasoned with using the language. All of these commands can serve quite useful purposes though, and can make the shell scripts you write cleaner, more maintainable, and just outright more powerful than they could've been before.

More in Tux Machines

Mozilla Leftovers: Thunderbird, Firefox, Tor Browser, and More

  • Thunderbird – Hotkeys Shortcuts Cheatsheet
  • Another Step in Automating the Pageload Recordings

    In a previous article, Kimberly Sereduck told us about Updates to Warm Page Load Tests and how we are continuously working to make our tests more representative of real user behavior. Besides that, we are working on automating the process of recording the website’s page load.

  • Practicing lean data is a journey that can start anywhere - Open Policy & Advocacy

    “It’s not about the destination, but about the journey.” I’m sure data and privacy are the furthest from your mind when you hear this popular saying. However, after a year of virtually sharing Mozilla’s Lean Data Practices (LDP), I’ve realized this quote perfectly describes privacy, LDP, and the process that stakeholders work through as they apply the principles to their projects, products, and policies. [...] There is an appetite to understand how we as consumers can hold companies accountable. One of the biggest surprises for me came when I would field questions at the end of a presentation, and people would ask about their rights as consumers and how they can hold companies accountable. For example, people wanted to understand their rights and recourse options if companies contacted them without permission, didn’t honor their unsubscribe requests, or did something else frustrating. I teach LDP for individuals to apply it in a business context, but we are all also consumers and customers. LDP can help us better understand how our own data should be handled and improve our understanding of what organizations are doing. We can then remember how we feel about certain situations and then ensure we are doing things in a more consumer-friendly way within our organizations. Lean Data Practices is a journey. For many there won’t be an ultimate destination because it is an iterative process. If you try to apply all the principles across your entire organization at once, you will find yourself overwhelmed and likely unsuccessful. To maximize your chance of success, my advice — which is the same advice we give when we present — is to just start somewhere. Choose one aspect of your business and focus on that, one pillar at a time. Once you’ve successfully applied the principles, go to a different business unit and do the same. Remember to review and adapt as products and business needs (or data!) change as well. You may likely never reach your destination, but you will see your company improve in its practices along the way.

  • Tor vs. VPN: Is One Better than the Other?

    Tor and VPN have unique ways to ensure user privacy on the Internet. They’re fundamentally very different yet have many similar aims. Due to the overlap in features, you may be weighing the pros and cons of using one over the other. Or maybe they can be treated equally but with separate purposes. This guide digs into everything you need to know about which software should be used for more Internet anonymity.

  • New Alpha Release: Tor Browser 11.5a2 (Windows, macOS, Linux)

    Tor Browser 11.5a2 is now available from the Tor Browser download page and also from our distribution directory.

    This version includes important security updates to Firefox.

Intel Core i9 12900K P-State Governor Performance On Linux Review

Since Intel's Alder Lake launch one of the test requests to come in a few times has been about the Intel P-State CPU frequency scaling driver and how its performance differs with the various governor choices available for altering the CPU frequency scaling behavior. Now that Linux 5.16 stable is out and running in good shape on Alder Lake, here are some Core i9 12900K benchmarks looking at various CPU frequency scaling choices and their impact on raw performance as well as CPU thermals and power consumption. With Alder Lake having seen fixes in Linux 5.16 as well as ADL-S graphics being enabled by default on this new kernel, it's a good target for carrying out the P-State testing. The main reader inquiry has obviously been about how how well these new Intel hybrid processors perform if moving from P-State "powersave" as is often the default governor on most distributions to instead using the "performance" governor that tends to keep the CPU in its higher performance states more aggressively than powersave. Read more

Stable Kernels: 5.16.3, 5.15.17, 5.10.94, 5.4.174, 4.19.226, 4.14.263, 4.9.298, and 4.4.300

I'm announcing the release of the 5.16.3 kernel.

All users of the 5.16 kernel series must upgrade.

The updated 5.16.y git tree can be found at:
	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-5.16.y
and can be browsed at the normal kernel.org git web browser:
	https://git.kernel.org/?p=linux/kernel/git/stable/linux-s...

thanks,

greg k-h
Read more Also: Linux 5.15.17 Linux 5.10.94 Linux 5.4.174 Linux 4.19.226 Linux 4.14.263 Linux 4.9.298 Linux 4.4.300

Android Leftovers