Programming Leftovers
-
WooCommerce Administrator with R
Over the years, I have faced several challenges in managing e-shops and I have finally decided to overcome them. After putting in a lot of effort, I have written over 90 functions in R (6.400+ lines of code) and utilized the WooCommerce API to develop a highly robust solution for these problems.
The central concept is to create a duplicate of the essential features of the e-shop such as categories, tags, attributes, products, customers, and orders inside R-Studio, utilize custom functions to perform filtering and CRUD operations through the REST API.
-
Failing to build a useful pre Go 1.21 static Go toolchain on Linux
Recently I wrote about how Go 1.21 will have a static toolchain on Linux, where the 'go' program will be statically linked so you can freely copy even a locally built version from Linux distribution to Linux distribution. If you're an innocent person, like I was before I started my journal, you might think that achieving this yourself in Go 1.20 and earlier isn't hard. In fact, it turns out that I failed, although my failure was disguised by the situation in Go 1.21, where you get a fully working static 'go' binary regardless of what you do and whether or not it had any actual effect on the build process.
-
Two types of software engineers
Here's the kicker though: it's the opposite! It's not cynicism, type 2 engineering is embracing the fact that we build with and for people and taking on an even bigger challenge of doing work despite the chaos this produces.
-
Announcing GoReleaser v1.17 — the late Easter release
The Easter release is here!
-
On Linux, you can't usefully statically link programs using NSS
In Linux (and other operating systems), NSS (Name Service Switch) is a mechanism that lets the system implement name resolution for various sorts of name lookups through a system of dynamically loaded shared objects, configured through /etc/nsswitch.conf. Also in Linux, in theory, you can statically link programs through the '-static' argument to various programs like GCC and the Go toolchain. Statically linking program executables because this can avoid situations where you can't run an executable on an older Linux version than it was built one.
-
AI & The Science of Creativity
As you likely know, ChatGPT works by guessing at the next word. Here’s Stephen:
when ChatGPT does something like write an essay what it’s essentially doing is just asking over and over again “given the text so far, what should the next word be?”—and each time adding a word
-
Feature flags and authorization abstract the same concept
When I think of feature flags and authorization, I usually think about very different things. They are used for different purposes. But ultimately, they are abstractions of the same thing. They might even be the same thing except for how they are used and the consequences for bypassing them.
-
The Performance Golden Rule Revisited
Way back in 2006, Tenni Theurer first wrote about the 80 / 20 rule as it applied web performance. The Yahoo! team did some digging on 8 popular sites (remember MySpace?) to see what percentage of the time it took for a page to load was comprised of backend work (Time to First Byte) versus frontend work (pretty much everything else).
-
Scala Pitfall: Parameterless Function Calls and Misplaced vals
I’ve been using Scala for the better part of a year, and it’s mostly been an enjoyable experience. Scala fits in a comfortable position in the programming latent space somewhere in between Java, Python, JavaScript, and Rust. However, Scala is definitely a a “big” language – it has lots of language features, supports many programming paradigms, and has a large enough surface area that the likelihood of encountering one (of many) footguns is high.
-
2023.15 Testing Patterns
Geoffrey Broadwell is trying to better understand the state of cross-platform terminal Unicode support. And would like people to install their Terminal::Tests module, run a script from that distribution and make a screen shot of the result. [...]
-
New Tool: myjson-transform.py
This tool takes JSON output from tools like oledump, zipdump, base64dump, … via stdin and transforms the data produced by these tools.
The transformation function (name Transform) has to be defined in a Python script provided via option -s.
-
What Are Python Data Classes?
In Python, classes let you group data and behavior together by defining attributes and methods, respectively. Typically, a class contains both attributes and a set of methods that add functionality. But what if you have a class that stores a lot of attributes with almost no functionality? Do you still need to use regular classes, or is there a better alternative?
-
Effective Spaced Repetition
You won’t get smarter by drilling IQ tests or playing the violin. Dual n-back probably won’t improve your working memory. But you can remember anything you choose to with spaced repetition.
Spaced repetition is, by far, the most effective cognitive hack I’ve used. It used to be that I’d read a book and afterwards remember almost nothing. Sometimes I’d take Kindle highlights, or notes, but never review them. And I hoped that though I could not necessarily name what I recalled (because whose memory has an index?) that somehow the important information was woven into my knowledge, tacitly. This is mostly a cope.
I love learning, and spaced repetition has helped me become extremely good at it. But it took a long time to become effective at it. There’s a lot of advice on the Internet on how to do it effectively, most of which is phrased in terms of very general principles, but very few concrete examples. But what people struggle with is: how do I turn this specific, concrete piece of information into a set of flashcards?
This post describes the rules I use to write effective flashcards, with as many examples as I could reasonably find.
-
Getting the ^D
What does Ctrl-D do when typed into a terminal? The typical and unsatisfying answer is it sends end-of-file (EOF) to the terminal. But what is EOF exactly? What does this trigger? Where in the immense stack of code involved is the behaviour found?
This article is in several parts. Each part answers the question, with later parts going into more detail and being more pedantic. We start with just what it does from the perspective of the user, move on to a more detailed explanation, and finally dig into the source code of the Linux kernel.
-
Greg Lehey on interoperability
I checked the page source, and “loading your website experience” meant a stub page with a few million lines of JavaScript. No fallbacks, no graceful degradation, no text, nothing.
For shiggs and gittles, I opened the site in a text browser, and didn’t even get the customary “you need JavaScript enabled to view the completely static text on this page”. It was completely empty; devoid of all meaning and existence. I know what that feels like.