Martti Ylioja

Now on GitHub

Big-Time Screensaver

A screensaver with elegant time display

screenshot

I needed a simple screensaver with digital hours and minutes display.

A quick Google search found lots of hits, but most of them looked slightly unsafe, otherwise dubious, or overcomplicated. Unfortunately, screensavers are one of the easiest ways of distributing malicious code to unsuspecting Windows users.

The logical solution: Write one myself!
A good decision, as the project turned out to be a nice refresher in the ancient art of Win32 API programming, and a pleasant stroll down the memory lane.

Amazingly, in the art of screensaver design, almost nothing has changed since the times of Windows 95. The details are quite clearly explained in the current Microsoft documentation.

The results are in here...

My screensaver uses a font that has elegant, original, and visually interesting digits: The "Abril Fatface Regular" by Veronika Burian and José Scaglione, Licensed under the SIL Open Font License, Version 1.1

You can enjoy the font, and experiment with different color combinations using this Big-Time Color Picker.

Deflate decompressor in pure C++

Pure C++ implementation of the decompression side of the DEFLATE compression method.

As you may have guessed, this is yet another subproject of my Optical Character Reader (OCR) project.

I usually use the zlib by Jean-loup Gailly and Mark Adler for all my compression and decompression needs. It's reliable, fast, and has an API that makes it easy to use for all possible scenarios. The only drawback is that under Windows, one has to go to some extra trouble to make the library available. The zlib headers or the library itself aren't part of the default package of libraries available under the Windows environment.

My implementation is a single C++ class completely contained in two files:

  • The header file deflate_decompressor.h and
  • the implementation file deflate_decompressor.cpp
It doesn't rely on any external non-standard libraries, so it can easily be included in any C++ project.

It's intended for a use-case where both the compressed input, and the uncompressed output are small enough to comfortably fit in memory at the same time.

More info, and the code, is here...

Cleaning up invisible whitespace

My new tool to normalize whitespaces and line endings in source files.

I like my sources to have:

  • Only 7-bit ASCII characters
  • Only Unix style '\n' line endings, never '\r' or "\r\n"
  • No tabs '\t'
  • Only good old spaces ' ' for spacing
  • No trailing spaces at the ends of lines
  • A line feed '\n' as the last character of the file

So, as any decent software would do, I started writing a small tool to detect and optionally fix these issues.

The project didn't stay so simple for long.

It started as a very simple program, but then got the bright idea to use this as an opportunity to experiment with some techniques I have lately wanted to try.

Here's a list of the additions so far:

More info, and the code, is here...

Levenshtein distance

A fast and simple Levenshtein distance function in C++

I needed a fast and simple Levenshtein distance function for a private optical character reader (OCR) based invoice handling project. The intended use-case was to compare the similarity between spellings of Finnish words.

My implementation is based on the classic Wagner–Fischer algorithm, but it completely avoids dynamic memory allocation, and uses only a modest amount of stack space.

The full post in here...

To the code repository