Programming Leftovers
-
Rlang ☛ Multiple Plots to PDF in R
Multiple Plots to PDF in R: A Step-by-Step Guide.
-
Anton Zhiyanov ☛ UUIDv7 in 20 languages
UUIDv7 is a 128-bit unique identifier like it's older siblings, such as the widely used UUIDv4. But unlike v4, UUIDv7 is time-sortable with 1 ms precision. By combining the timestamp and the random parts, UUIDv7 becomes an excellent choice for record identifiers in databases, including distributed ones.
Let's briefly explore the UUIDv7 structure and move on to the zero-dependency implementations in 20 languages (as ranked by the Stack Overflow survey).
-
Rlang ☛ Descriptive Statistics in R
Descriptive statistics are a crucial part of data analysis, as they provide a snapshot of the central tendency and variability of a dataset.
In R, there are two primary functions that can be used to calculate descriptive statistics: summary() and sapply().
In this article, we will explore how to use these functions to gain a deeper understanding of our data.
-
[Old] Steph Ango ☛ Quality software deserves your hard‑earned cash
Quality software from independent makers is like quality food from the farmer’s market. A jar of handmade organic jam is not the same as mass-produced corn syrup-laden jam from the supermarket.
Industrial fruit jam is filled with cheap ingredients and shelf stabilizers. Industrial software is filled with privacy-invasive trackers and proprietary formats.
Google, Apple, and Microsoft make industrial software. Like industrial jam, industrial software has its benefits — it’s cheap, fairly reliable, widely available, and often gets the job done.
-
Games
-
Tom's Hardware ☛ 55-year-old bug found in 'Lunar Landing,' the most popular video game from the 70's
When asked how he achieved this programming feat in his youth and such a technically-limited era by Martin C. Martin, who found the Lunar Landing bug, Storer said, "I was skilled at calculus at the time and familiar with concepts like a Taylor series, but also my recollection is that my father, who was a physicist, helped me in the derivation of the equations [for simplifying the classical rocket equation].
As it turns out, Jim's code was near-perfect but was missing a number 2 inside a square root's denominator, which resulted in a missing "divide by two" instruction. Martin posits he was most likely writing the code on pencil and paper, and so this minor bug results in time being consistently underestimated, though only fairly slightly.
-
Martin C. Martin ☛ How I Found A 55 Year Old Bug In The First Lunar Lander Game
Just months after Neil Armstrong’s historic moonwalk, Jim Storer, a Lexington High School student in Massachusetts, wrote the first Lunar Landing game. By 1973, it had become “by far and away the single most popular computer game.” A simple text game, you pilot a moon lander, aiming for a gentle touch down on the moon. All motion is vertical and you decide every 10 simulated seconds how much fuel to burn.
I recently explored the optimal fuel burn schedule to land as gently as possible and with maximum remaining fuel. Surprisingly, the theoretical best strategy didn’t work. The game falsely thinks the lander doesn’t touch down on the surface when in fact it does. Digging in, I was amazed by the sophisticated physics and numerical computing in the game. Eventually I found a bug: a missing “divide by two” that had seemingly gone unnoticed for nearly 55 years.
-
-
Python
-
Earthly ☛ How to Create a Python Virtual Environment with virtualenv
Managing dependencies for multiple projects is a common challenge for developers, particularly in Python, where all dependencies are installed globally by default. Imagine working on multiple projects, each requiring different versions of the same library or even different versions of Python. If not properly isolated, these dependencies may clash, causing various problems and wasting valuable project time debugging the issues.
Thankfully, virtual environments can help. Virtual environments allow you to create dedicated environments for your projects, ensuring that each project has its own set of isolated dependencies that don’t interfere with other projects.
In this article, you’ll learn about Python virtual environments and why they’re important. You’ll also learn how to create and manage virtual environments using virtualenv.
-