An exception handling revelation
I’ve been working with exceptions offered by languages,
such as Java and Python,
for more than 20 years, invariably as their consumer:
catching them when raised by an API and then doing my thing.
For the systems I worked on, exception handling mostly involved
either quitting the program with an error or re-prompting the user
to fix some input.
Consequently, my view of them was as a fancy error handling mechanism:
syntactic sugar and static enforcement for checking a function’s
successful completion.
Recently,
I refactored
the error handling in
Alexandria3k,
a library and a command-line tool providing efficient relational
query access to diverse publication open data sets.
Through this the full power of exceptions clicked for me.
I suspect that others may share my previously limited appreciation
of exception handling,
so here is a brief description of the refactoring.
Continue reading "An exception handling revelation"Last modified: Monday, February 5, 2024 5:48 pm
Auto-correct text entered with the wrong keyboard layout
To enter text in some languages you press a special key
combination (e.g. Alt-Shift) to toggle the keyboard layout.
The keyboard layout context is typically kept separately for each window.
This is generally good, but forces you to remember (or check) the
current layout every time you switch to another window.
If you forget to do that, the text you type will come out as gibberish.
To me this happens often enough that I automated the fixing of such
text.
Continue reading "Auto-correct text entered with the wrong keyboard layout"Last modified: Tuesday, July 21, 2020 3:16 pm
Installing PyTorch on a Raspberry Pi-3B+ redux
This is an update to articles for installing the
PyTorch machine learning library
on a Raspberry Pi that have been published by
Amrit Das in 2018
and
Saparna Nair in 2019.
It builds on them by updating the required settings and introducing a fix
and a few tweaks to make the process run considerably faster.
Although there are Python wheels floating around that offer PyTorch
as a Raspberry Pi Python package,
downloading them from unverified sources is a security risk.
Here’s how to install PyTorch from source.
Continue reading "Installing PyTorch on a Raspberry Pi-3B+ redux"Last modified: Tuesday, March 17, 2020 5:19 pm