Win32 I/O character encoding supplement 2 – setlocale enhancement

This is part of a series of post on using Unicode in Windows command-line applications. Here's the first post. Sometime in 2018, some functions in the Windows 10 C runtime system, and related development SDKs, were enhanced to support UTF-8. This feature is enabled by calling the setlocale function. For reference, Microsoft's current documentation of … Continue reading Win32 I/O character encoding supplement 2 – setlocale enhancement

Making an uncompressed JPEG 2000 file

Challenge: Construct a JPEG 2000 image file that isn't compressed. Also, try to do it without spending any money. Overview The flagship feature of the JPEG 2000 suite of graphics formats is the wavelet-based "JPEG 2000 codestream" compression format. This challenge is not to figure out how to make a degenerate form of that format … Continue reading Making an uncompressed JPEG 2000 file

Yes, pi is wrong. Sorry about that.

Which is the more fundamental constant: π or 2π? As pi day approaches, I think it's important for everyone to state their thoughts on this contentious matter. Here are the main options: π is more fundamental. (the establishment position)2π is more fundamental. (the progressive position)They're about equally fundamental. (the "both sides" position)Any rational multiple of … Continue reading Yes, pi is wrong. Sorry about that.

Encoding Huffman codebooks

This post will assume you have a basic knowledge of the data compression technique known as Huffman coding. Though maybe, since I'm only concerned about decompression, I should call it something like "bit-oriented prefix codes". Huffman coding is really just one of the algorithms that can produce such a code, but it's the term everybody … Continue reading Encoding Huffman codebooks

The Cleveland baseball team

I see that the Cleveland Indians baseball team is finally going to change their nickname. I think that's probably a good thing. For one thing, the word "Indians" is ambiguous, and you wouldn't want to accidentally demean people from South Asia, when you're trying to demean people from North America. They say they haven't chosen … Continue reading The Cleveland baseball team