Error handling under Unix and Windows
One thing that struck me when I first encountered the 4.3BSD Unix system call documentation in the 1980s, was that each call was followed by an exhaustive list of the errors associated with it. Ten years later, when I was going through the Windows API, I was disappointed to see that very few functions documented their error conditions. This is a big deal.
Continue reading "Error handling under Unix and Windows"
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"
Of BOOL and stdbool
The C99 standard has added to the C programming language a Boolean type,
Continue reading "Of BOOL and stdbool"
_Bool and the
bool alias for it. How well does this type interoperate with the Windows SDK
BOOL type? The answer is, not at all well, and here's the complete story.
Using the HP 4470c Scanner Under Windows 7
Hewlett Packard nor
Microsoft Windows 7
offer native support for my HP 4470c scanner.
Throwing a working scanner away to buy a new one only because some
software was missing seemed like a waste,
so I looked for an alternative solution.
This is how I made it work using SANE,
an open source framework for scanners.
Continue reading "Using the HP 4470c Scanner Under Windows 7"
Batch Files as Shell Scripts Revisited
Four years ago I wrote
about a method that could be used to have the Unix Bourne shell interpret
Windows batch files.
I'm using this trick a lot, because programming using the Windows/DOS
batch files facilities is decidedly painful, whereas the Bourne
shell remains a classy programming environment.
There are still many cases where the style of Unix shell programming
outshines and outperforms even modern scripting languages.
Continue reading "Batch Files as Shell Scripts Revisited"
Useful Polyglot Code
Four years ago I blogged about an
incantation that would allow the Windows command interpreter (cmd) to execute
Unix shell scripts written inside plain batch files.
Time for an update.
Continue reading "Useful Polyglot Code"
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"
Suspend Windows from the Command Line
I used to leave my computer up all night, but I've come to realize that this
is ecologically unsound.
Now I suspend it before going to sleep, but this missed running
a daily job that used to run at 03:00 am.
The job marks my students' exercises and send me email with the next day's
I thus decided to schedule the task to wakeup my computer at 3:00 am,
run the job, and then suspend it again.
The Windows scheduler allows you to specify a wakeup option,
but not a subsequent suspend.
Furthermore, it seems that Windows lacks a way to suspend from the
command line (while maintaining the ability to hibernate), and the
only free tools on the web are distributed in executable form,
so I ended writing a small tool myself.
Continue reading "Suspend Windows from the Command Line"
Unzipping Files in Order
Over the past couple of years I've enjoyed listening to the
audio edition of the
The material is superb
(although I occasionally get the feeling of listening to the
Voice of America),
the articles are read in a clear voice,
the data's encoding is plain MP3,
unencumbered by digital rights (restrictions) management silliness,
and the audio format is convenient to listen on the metro or while jogging.
Unfortunately, the articles in the audio edition's zip file are
haphazardly ordered, which, until today, marred the enjoyment of my listening.
Continue reading "Unzipping Files in Order"
Open and Closed Source Kernels Go Head to Head
Earlier today I presented at the
30th International Conference on Software Engineering a
research paper comparing the
code quality of Linux, Windows (its
research kernel distribution),
For the comparison I parsed multiple configurations of these systems (more than ten million lines), and stored the results in four databases, where I could run SQL queries on them. This amounted to 8GB of data, 160 million records.
(Iíve made the databases and the SQL queries available
The areas I examined were file organization, code structure, code style, preprocessing, and data organization.
To my surprise there was no clear winner or looser, but there were interesting differences in specific areas.
Continue reading "Open and Closed Source Kernels Go Head to Head"
Many Ways to Skin a Window
Every couple of years,
users of a Microsoft Windows application I wrote a long time ago
start complaining that the application crashes when they exit from it.
Every time it turns out that the reason is a Windows message that tells
the application's main window to close
in a way that was not originally foreseen.
Continue reading "Many Ways to Skin a Window"
The Double-Edged Sword of Proprietary Platforms
Slashdot article comment
wondered how Windows Vista managed to break existing applications,
despite Microsoft having complete control over the platform.
Continue reading "The Double-Edged Sword of Proprietary Platforms"
Internet Explorer's Cleaner Look
Today the Microsoft update on my Windows machine asked me to upgrade
the Internet Explorer to version 7.0.
My bank refuses to work with any browser other than IE,
so, although I'm using SeaMonkey
as my everyday browser, I'm also forced to keep a current copy of IE.
The installation's banner reinforced some of the fears I have
regarding Microsoft's technical prowess.
Continue reading "Internet Explorer's Cleaner Look"
SeaMonkey vs Internet Explorer Revisited
In an older blog entry
I compared the complexity of Mozilla with that of Internet Explorer
by looking at the components each linked to.
Recently, comments to a Slashdot posting I made, noted
that I was comparing the two products on different platforms and
source with binary dependencies.
I therefore set out to compare the binary dependencies of the two
Continue reading "SeaMonkey vs Internet Explorer Revisited"
Batch Files as Shell Scripts
Although the Unix Bourne shell offers a superb environment for combining
existing commands into sophisticated programs, using a Unix shell
as an interactive command environment under Windows can be painful.
Continue reading "Batch Files as Shell Scripts"
Software Complexity: Open Source vs Microsoft
In a readable and interesting paper titled
CyberInsecurity: the cost of a monopoly
seven notable security experts argue that the Microsoft's near monopoly
in the desktop operating system and office productivity markets is creating
a dangerous monoculture that exacerbates the effect of security vulnerabilities.
Continue reading "Software Complexity: Open Source vs Microsoft"