Sat 15 Feb 2020

Library Evolution in Swift

Swift 5.1 shipped with two new features related to binary stability that enables binary frameworks that can be distributed and shared with others:

  • Module stability allows Swift modules built with different compiler versions to be used together in one app.

  • Library evolution support allows developers of binary frameworks to make additive changes to the API of their framework while remaining binary compatible with previous versions.

Source: Library Evolution in Swift, an article by Slava Pestov.

Reducing Colors In An Image ⇢ Dithering

What if you did not have millions of colors at your disposal? Think about older devices, printers (both 2D and 3D), or printing presses making giant posters of your favorite movie. You may also want to reduce your color palette to reduce the memory usage.

What you need is some sort of mapping, that maps the pixel with 16 million possible colors, to say 8 possible colors. Intuitively, the best approach would be to figure out which of the 8 colors is most similar to the pixel's color and use this similarity for mapping.

Source: Reducing Colors In An Image ⇢ Dithering, an article by Preet Shihn.

An introduction to GDB scripting in Python

Sometimes it's not humanly possible to inspect or modify data structures manually in a debugger because they are too large or complex to navigate. Think of a linked list with hundreds of elements, one of which you need to locate. Finding the needle in the haystack is only possible by scripting the debugger to automate repetitive steps.

Source: An introduction to GDB scripting in Python, an article by Stefan Hajnoczi.