đŸ’Ÿ Archived View for news.tuxmachines.org â€ș n â€ș 2023 â€ș 01 â€ș 28 â€ș Programming_Leftovers.gmi captured on 2023-01-29 at 15:29:21. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

Tux Machines

Programming Leftovers

Posted by Roy Schestowitz on Jan 28, 2023

Web Browser Stories

Microsoft and Proprietary Software

Natural language is the lazy user interface

=> https://austinhenley.com/blog/naturallanguageui.html â†ș Natural language is the lazy user interface

Expecting users to primarily interact with software in natural language is lazy.
It puts all the burden on the user to articulate good questions. What to ask, when to ask it, how to ask it, to make sense of the response, and then to repeat that many times.

All you need is higher kinded types

=> https://las.rs/blog/all-you-need-is-hkt-s.html â†ș All you need is higher kinded types

Core theorem: (Roughly) any valid Haskell term (or of a similar language) typed with type families and GADTs, can be reformulated as a semantically equivalent term that can be typed without type families and GADTs.
What do I mean with semantically equivalent? When erasing types, the new term has the same structure, modulo technically unnecessary wrappings using constructors that ought to be newtype constructors. (You could in fact aleviate this by adding more language features, but that would ruin the point, unless there is a way of doing it in a minimal way.)

Unicode operators for semantically correct programming

=> https://shkspr.mobi/blog/2023/01/unicode-operators-for-semantically-correct-programming/ â†ș Unicode operators for semantically correct programming

Are there any modern programming languages which allow the use of semantically correct Unicode symbols as operators?
As far as I can tell, there's only one!

Why comment your code as little (and as well) as possible

=> https://www.r-bloggers.com/2023/01/why-comment-your-code-as-little-and-as-well-as-possible/ â†ș Why comment your code as little (and as well) as possible

When I first started programming, I clearly remember feeling I had to add comments, that would repeat exactly what the code below was doing, as if it were the script for some sort of voice over. I want you to know like I now do that it’s not the way to comment one’s code. 😅
An important goal of good code is to be readable so that future contributors can build with and upon it as needed. Good commenting is part of the toolset for reaching that goal. In this post we shall first present principles of code commenting, and then a few tips.

Tonight's rabbit hole: time math and 32 bit longs

=> https://rachelbythebay.com/w/2023/01/26/shadow/ â†ș Tonight's rabbit hole: time math and 32 bit longs

I find some funny rabbit holes sometimes. Tonight, it went like this. Ubiquiti released a new version of the software for their USG devices because they had this thing where their dhcpv6-pd implementation could be exploited to run arbitrary commands by someone sitting in the right spot on the network (i.e., out your "WAN" port).

Do Not Taunt Happy Fun Branch Predictor

=> https://www.mattkeeter.com/blog/2023-01-25-branch/ â†ș Do Not Taunt Happy Fun Branch Predictor

I've been writing a lot of AArch64 assembly, for reasons.
I recently came up with a "clever" idea to eliminate one jump from an inner loop, and was surprised to find that it slowed things down. Allow me to explain my terrible error, so that you don't fall victim in the future.

Distinguishing an Interpreter from a Compiler

=> https://tratt.net/laurie/blog/2023/distinguishing_an_interpreter_from_a_compiler.html â†ș Distinguishing an Interpreter from a Compiler

In Compiled and Interpreted Languages: Two Ways of Saying Tomato, I showed how any language can be implemented as an interpreter or a compiler. However, I was deliberately vague when defining how one might distinguish an "interpreter" from a "compiler", in no small part because I couldn't think of a crisp definition of the two terms. Although I wasn't quite as vague as "I know it when I see it", I was uncomfortably close.
It was thus with great interest that I read a comment on the post from a good friend, and language implementation veteran, Mario Wolczko. In a sense, Mario gave two ways of distinguishing compilers from interpreters, but I'm going to quote the one that made my jaw drop: [...]

Three Customers In A Bank

=> https://two-wrongs.com/three-customers-in-a-bank â†ș Three Customers In A Bank

Here’s the setup to an interesting puzzle: assume the time it takes to serve customers at a bank is exponentially distributed with mean service time 15 minutes. When you come in to the bank, both bank employees are busy serving customers. There are no other customers in the bank, except you and the two customers already being serviced.
What is the probability you will be the last customer to leave the bank among the three of you?

Building and Deploying a Python App with Bazel

=> https://earthly.dev/blog/build-and-deploy-pyapp-with-bazel/ â†ș Building and Deploying a Python App with Bazel

Bazel is an open source software tool released by Google to automate software build processes and testing. It’s a scalable and reliable tool that allows developers to quickly build and test software applications. Because Bazel supports multiple programming languages, it’s ideal for projects with multilanguage dependencies.
In this article you’ll learn about Bazel, what it’s used for, and what features make this build tool so special. You’ll also learn how to develop and run a basic application using Python with Bazel.

float64 to float32: Saving memory without losing precision

=> https://pythonspeed.com/articles/float64-float32-precision/ â†ș float64 to float32: Saving memory without losing precision

Libraries like NumPy and Pandas let you switch data types, which allows you to reduce memory usage. Switching from numpy.float64 (“double-precision” or 64-bit floats) to numpy.float32 (“single-precision” or 32-bit floats) cuts memory usage in half. But it does so at a cost: float32 can only store a much smaller range of numbers, with less precision.
So if you want to save memory, how do you use float32 without distorting your results? Let’s find out!

gemini.tuxmachines.org