Posts Tagged Python

 

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"

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"

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"

Become a Unix command line wizard
edX MOOC on Unix Tools: Data, Software, and Production Engineering
Debug like a master
Book cover of Effective Debugging
Compute with style
Book cover of The Elements of Computing Style
Syndication
This blog is also available as an RSS feed:

Category Tags
AI (4)
AWS (4)
Android (2)
Apple (11)
C (21)
C++ (17)
Computers (58)
Databases (6)
Debugging (10)
Discussion (6)
Electronics (15)
Environment (1)
FreeBSD (26)
Funny (14)
GSIS (5)
Git (2)
Google (6)
Government (3)
Hacks (26)
Hardware (27)
History (13)
Information systems (1)
Internet (12)
Java (26)
JavaScript (1)
Linux (7)
Management (27)
Microsoft (11)
One Laptop Per Child (3)
Open source (58)
Opinion (30)
Parenting (11)
Perl (13)
Photos (13)
Politics (5)
Programming (110)
Python (3)
R (1)
Raspberry Pi (6)
Risks (7)
Scala (1)
Science (35)
Security (26)
Sights (19)
Smartphones (3)
Software (22)
Software engineering (93)
Standards (7)
System administration (46)
Teaching (9)
Technology (33)
Testing (3)
Tips (43)
Tools of the Trade (52)
Travel (9)
UML (6)
Unix (53)
Web (31)
Windows (17)
Writing (46)
XML (10)
vim (5)
Archive
Complete contents (382)
2024 (3)
2023 (5)
2022 (2)
2021 (3)
2020 (15)
2019 (4)
2018 (5)
2017 (20)
2016 (7)
2015 (6)
2014 (5)
2013 (13)
2012 (17)
2011 (14)
2010 (13)
2009 (40)
2008 (40)
2007 (41)
2006 (48)
2005 (44)
2004 (30)
2003 (7)

Last update: Tuesday, October 15, 2024 2:19 pm

Creative Commons Licence BY NC

Unless otherwise expressly stated, all original material on this page created by Diomidis Spinellis is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.