How I fixed git-grep macOS UTF-8 support
As a speaker of Greek, I’ve been fixing issues in the handling
of non-ASCII characters for over 40 years, using techniques ranging from
simple lookup tables to dynamic patching of in-memory images.
Here’s how I debugged and fixed the handling of UTF-8 characters
in the git grep
command, which was broken for almost a decade.
Continue reading "How I fixed git-grep macOS UTF-8 support"Last modified: Sunday, October 9, 2022 7:19 pm
Rather than alchemy, methodical troubleshooting
I recently encountered a pesky problem while trying to
build a React Native project under Apple’s Xcode.
The build would fail with an error reporting:
EMFILE: too many open files, watch
.
Frustratingly, all available advice on the web pointed to
different (often inexplicable) directions, none of which worked.
After tormenting myself with these, I decided to troubleshoot
the problem methodically, which allowed me to pinpoint it and
solve it with an uncommon and noteworthy application of the
git bisect command.
Here’s the story.
Continue reading "Rather than alchemy, methodical troubleshooting"Last modified: Saturday, November 27, 2021 8:21 pm
Raspberry Pi vs USB vs Mac Audio
The audio hardware of Raspberry Pi is
known
to produce relatively poor sound quality.
I bought a cheap USB sound card to try as an alternative.
Here is what I found.
Continue reading "Raspberry Pi vs USB vs Mac Audio"Last modified: Sunday, December 13, 2015 12:02 am
How to make a MacBook Kensington Lock Adapter
Apple, in its infinite wisdom, has not included a Kensington lock
slot in the current model of the MacBook Pro computer.
Given the computer's price, desirability, and
the fact that three people I know have had theirs stolen,
I decided to build an improvised adapter that would allow me
attach a Kensington lock to the computer.
I realize, that the security offered by such a contraption is what
my colleague
Vassilis Prevelakis
calls an "advisory lock",
for Kensington locks can be easily picked or pried away.
However, I think it might deter a casual thief who would
snatch the laptop you've left unattended for a couple
of minutes.
Continue reading "How to make a MacBook Kensington Lock Adapter"Last modified: Monday, June 10, 2013 6:41 pm
Applied Code Reading: Debugging FreeBSD Regex
When the code we're trying to
read is inscrutable,
inserting print statements and running various test cases can be
two invaluable tools.
Earlier today I fixed
a tricky problem in the FreeBSD regular expression library.
The code,
originally written by Henry Spencer in the early 1990s,
is by far the most complex I've ever encountered.
It implements sophisticated algorithms with minimal commenting.
Also, to avoid code repetition and increase efficiency,
the 1200 line long main part of the regular expression execution engine is
included in the compiled C code
three times after modifying various macros to adjust the code's behavior:
the first time the code targets small expressions and operates
with bit masks on long integers,
the second time the code handles larger expressions
by storing its data in arrays,
and the third time the code is also adjusted to handle multibyte characters.
Here is how I used test data and print statements to locate and fix the problem.
Continue reading "Applied Code Reading: Debugging FreeBSD Regex"Last modified: Wednesday, September 16, 2009 9:44 am
Madplay on an Intel Mac
Numerous MP3 players around my house pull music from a central file server.
The hardware I'm using is extremely diverse and many devices
can nowadays be politely described as junk:
they include 100MHz Pentiums with 16MB RAM, and an ARM-based prototype
lacking support for floating point operations.
For the sake of simplicity I've standardized the setups around
a web server running on each machine to list static HTML pages
containing the available music files,
and simple shell-based CGI clients that invoke
madplay to
play the music.
When I added an Intel-based Mac to the mix I found that madplay
refused to work, producing only a white noise hiss.
Continue reading "Madplay on an Intel Mac"Last modified: Monday, July 13, 2009 11:46 am
Fixing the Orientation of JPEG Photographs
I used to fix the orientation of my photographs through an application
that would transpose the compressed JPEG blocks.
This had the advantage of avoiding the image degradation of a
decompression and a subsequent compression.
Continue reading "Fixing the Orientation of JPEG Photographs"Last modified: Sunday, June 14, 2009 8:20 pm
Cross Compiling
Cross compiling software on a host platform to run on a different
target used to be an exotic stunt to be performed by
the brave and desperate.
One had first to configure and build the compiler, assembler, archiver,
and linker for the different architecture, then cross-build the other
architecture's libraries, and finally the software.
This week, while preparing a new release of the
CScout refactoring browser
I realized that what was once a feat is nowadays a routine operation.
Continue reading "Cross Compiling"Last modified: Saturday, September 30, 2006 10:32 pm
Everything Old is New Again
In 1984 the new kid on the block was Borland's Sidekick.
A terminate and stay resident (TSR) program for MS-DOS,
it would run in the background, and when it detected
the two shift keys being pressed it would overlay the
(then character) screen with a calculator, a notepad,
a calendar, a dialer or an ASCII table.
Continue reading "Everything Old is New Again"Last modified: Tuesday, August 9, 2005 10:00 am
XML Abstraction at the Wrong Level
Over the last month I've encountered two applications
that use XML at the wrong level of abstraction.
Instead of tailoring the schema to their needs, they
use a very abstract schema, and encode their elements
at a meta level within the XML data.
This approach hinders the verification and manipulation of the corresponding
XML files.
Continue reading "XML Abstraction at the Wrong Level"Last modified: Thursday, June 23, 2005 11:52 am
Apple's Presence in Greece Appears to be a Joke.
Earlier today I tried to buy an Airport Express base station by
visiting what appeared to be an Apple store in Stournari street:
the road in Athens with the largest physical concentration of computer shops.
Continue reading "Apple's Presence in Greece Appears to be a Joke."Last modified: Wednesday, October 6, 2004 11:15 pm