Programming Leftovers
-
Ted Unangst ☛ pasted bracket escapes escape bracketed paste
There’s a feature called bracketed paste supported by some “modern” terminals and editors, etc. When text is pasted from the clipboard, the terminal brackets it in special markers so that the receiving program knows it came from the clipboard and not the keyboard, and thus might turn off autoindent, etc.
-
Hillel Wayne ☛ A better explanation of the Liskov Substitution Principle
Later, Robert Martin named the Liskov Substitution Principle:
"Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it."
-
Daniel Lemire ☛ Generating arrays at compile-time in C++ with lambdas
Suppose that you want to check whether a character in C++ belongs to a fixed set, such as ‘\0’, ‘\x09’, ‘\x0a’,’\x0d’, ‘ ‘, ‘#’, ‘/’, ‘:’, ‘<‘, ‘>’, ‘?’, ‘@’, ‘[‘, ‘\\’, ‘]’, ‘^’, ‘|’. A simple way is to generate a 256-byte array of Boolean values and lookup the value. This approach is sometimes called memoization (and not memorization!!!). You might do it as follows: [...]
-
Rlang ☛ Exploring Pharmacokinetic and Pharmacodynamic Drug-Drug Interactions with our Drug Interactions Shiny App
In the field of oncology, in-depth research into and comprehension of drug-drug interactions hold paramount significance. This is especially crucial given the limited margin between the effective and toxic doses of anticancer agents.
-
Rlang ☛ Builld Your First App With Shiny – R Shiny Tutorial For Beginners
Shiny is a wonderful tool for creating web applications using just R – without JavaScript, ASP.NET, Ruby on Rails or other programming languages. And the output is absolutely remarkable – beautiful charts, tables and text that present information in a highly attractive way.
Learning Shiny is not terribly hard, even if you are an absolute beginner. You just need some proper guidance. This is why I have created this tutorial that drives you through the process of creating a simple Shiny application, from A to Z.
-
Buttondown ☛ Some thoughts on software expertise
In other words, the main difference between a beginner and an expert is the expert has "seen it all before". They can quickly solve standard problems and can pattern-match new problems to old ones. But once they've built their mental models, the beginner will be able to do anything the expert can... just a lot slower.
-
Security Week ☛ Federal Push for Secure-by-Design: What It Means for Developers
There are two important elements to this. The concept of secure-by-design is introduced but not defined; and it is implied that this undefined concept will be enforced on the critical infrastructure by regulations that are yet to be established. This is more than a little nebulous but is something that cannot be ignored.
-
The Register UK ☛ Open source work makes me appreciate software testing. It's not an academic exercise
The exception might be unit tests, where code coverage is a quantifiable metric, but even then, my experience is that more value is being put on the ability to measure progress than its actual contribution to producing quality code.
-
Python
-
Paolo Melchiorre ☛ Database generated columns ⁽¹⁾: Django & SQLite
An introduction to database generated columns, using SQLite and the new GeneratedField added in Django 5.0.
-
Nelson Elhage ☛ What's with ML software and pickles?
I have spent many years as an software engineer who was a total outsider to machine-learning, but with some curiosity and occasional peripheral interactions with it. During this time, a recurring theme for me was horror (and, to be honest, disdain) every time I encountered the widespread usage of Python pickle in the Python ML ecosystem.
In addition to their major security issues1, the use of pickle for serialization tends to be very brittle, leading to all kinds of nightmares as you evolve your code and upgrade libraries and Python versions. In my career as a software engineer, I tended to believe that – to a good approximation – there were no valid use cases for the pickle module, and it existed solely as an attractive nuisance; a mistake of a younger, more exuberant, and more naive ecosystem.
For the last few years now, though, I’ve worked professionally in ML, giving me a new perspective on the ecosystem. I’ve developed a hands-on understanding of why ML software looks the way it does, and some of the problems pickle is solving for its users. I still don’t like it, but I have a lot more understanding and empathy for the problem space, and I no longer believe the problem is “trivial” or merely one of ignorance or laziness. This post is an attempt to convey some sense of what I’ve learned, and bridge the gap a bit between these two worlds.
-
Earthly ☛ Create a Python Package using Setup.py
Python has a vibrant open source ecosystem and that has been one of the keys to its popularity. As a Python developer, you can create reusable tools and code and easily share them with others. Packaging and publishing your Python code properly enables other developers to easily install and use your code in their own projects. This allows you to contribute back to the community while also building your reputation.
In this 3-part series, we’ll cover packaging a simple Python script using setuptools and twine, then an alternative method using poetry, then we will extend what we learn to a C module, and finally we will publish it to PyPI.
-
Earthly ☛ Python C Extension pypi Package
In Article 1 of this series, I showed you how to package and distribute pure Python code using setuptools and a setup.py file. Then in Article 2, we looked at how the Poetry tool simplifies this process for pure Python packages. In this final article, we’ll tackle distributing a Python package containing a C extension, which adds some extra complexity.
-
Seth Michael Larson ☛ OSS Security RFI, Guide to become a CNA, and PEP 639
The Python Software Foundation's response to the RFI is about capturing what we believe is important regarding the US governments approach to securing open source software. Whatever gets done by the US government is likely to have huge implications for everyone maintaining and consuming open source software, so it's critical that policy and decisions are made with sustainability in mind.
-
-
Shell/Bash/Zsh/Ksh
-
Fabian Sanglard ☛ The bash book to rule them all
I ♥ to /bin/bash and last week I came around the one bash book to rule them all.
-