} + closeDir(dirPtr); } Today’s post is slightly unusual - we won’t talk about code, or coding conventions, or about how much more clever Rust is than C++ (which is a lot), today we’re going to talk about Process. And source control. This snippet of code is small, and ultimately not particularly important, but it highlights a not often talked about process in software engineering.
So the codebase I’m working in now has a dependency on a “SDK” provided by one of our vendors.
Continue Reading
So several months ago, I had to write this (C++) function:
std::vector<uint8_t> extract_bitstream(const std::string& original_bitstream) { std::string encoded_bitstream(original_bitstream); // Strip the whitespace encoded_bitstream.erase(std::remove_if(encoded_bitstream.begin(), encoded_bitstream.end(), [](char c) { return std::isspace(c); }), encoded_bitstream.end()); // Decode the result namespace bai = boost::archive::iterators; using base64_dec = bai::transform_width<bai::binary_from_base64<char*>, 8, 6>; std::vector<uint8_t> bitstream(base64_dec(encoded_bitstream.data()), base64_dec(encoded_bitstream.data() + encoded_bitstream.length())); // Remove null bytes that were formed from the padding const size_t pad_count = std::count(encoded_bitstream.begin(), encoded_bitstream.end(), '='); bitstream.erase(bitstream.end() - pad_count, bitstream.
Continue Reading
Many years ago, my flight instructor once described to me the “Swiss cheese model” in crash analysis and risk management. The thinking goes, you can think of each layer of defense against a bad outcome, such as a plane crash, as a slice of Swiss cheese. For a midair collision, maybe one slice is the pilot’s visual scan. A second slice is ATC’s radar screen. A third slice is a traffic display on a moving map.
Continue Reading
Today’s programming for maintainability snippet comes from a (wonderful) Rust library I was using the other day, built, which lets you embed build information into your binaries. Things like the compiler version, git HEAD commit, build time, etc. It’s a wonderful library and if you need that sort of thing I recommend it.
It’s a code generator, which spits out a built.rs file which you with your source. The only problem is, when you compile it, you get errors like:
Continue Reading
Today’s programming for maintainability snippet comes from some code I wrote a few weeks ago. In our codebase we have a (C++) class which looks something like:
template<typename T> class tAttribute { public: tAttribute& operator=(const tAttribute& other) { _coercedValue = other._coercedValue; _getCallbacks = other._getCallbacks; _setCallbacks = other._setCallbacks; _commitCallbacks = other._commitCallbacks; } tAttribute(const tAttribute& other) { *this = other; } ... private: T _coercedValue; std::vector<iCallback> _getCallbacks; std::vector<iCallback> _setCallbacks; std::vector<iCallback> _commitCallbacks; }; This code has been written many years ago, and nobody had touched it until recently.
Continue Reading
When car companies design a car, one of the major things they care about is the ability to maintain the car. The oil stick needs to be accessible and legible, the diagnostic codes need to be within reach of the driver (this is actually a legal thing too), the driver needs to be able to change a tire. Software engineering is not much different: Yes, we need the code we write to compile and not crash, but any professional programmer will tell you they spend at least 5x more time reading code than writing code, whether it be fixing bugs or writing new features in an existing codebase.
Continue Reading
Skeuomorphism: A nonfunctional ornamental design cue in a design that comes from structure that was inherent to the original. (definition courtesy of Wikipedia)
For example, the “floppy” save icon. When I was in grade school, I saved my work on a floppy disk. I don’t do that anymore, I don’t even own a floppy drive, yet the floppy disk is fairly universally used as the “save” symbol. This is skeuomorphism.
Continue Reading
Okay everyone, let’s talk about faces. By now, surely you’ve had some relative or clickbait internet article show you a face supposedly generated entirely by a machine (or if you’re of a certain inclination, you’ve seen one of those deepfake videos).
If you’re unsure what I’m talking about, look at this lovely lady:
At first glance, you think: This is a face. But after you look at it for a little bit, you realize there’s a few things wrong with it - her glasses merge into her face a little bit, her hair interacts with the background in ways which don’t make sense, something weird’s going on with the left side of her head (is that jewlery?
Continue Reading
Warning: What follows is mostly just spoilers for Black Mirror.
Is it just me, or is Black Mirror substantially less dire and less Sci-Fi than it used to be? I just finished watching Season 5, and every episode in the season seems fairly upbeat, and none particularly care about the technology they reference.
In two of the episodes (“Striking Vipers” and “Rachel, Jack, and Ashley Too”), the episode ends without any ill effects for the “good guys”.
Continue Reading
If you’ve managed to reach this page - congratulations! That means you’ve figured out that I’ve finally reorganized my server, something I’ve been threatening to do ever since the summer I left for Europe, which was not last summer but the one before. Summer 2017.
But I’ve finally done it. Somewhat unfortunately for you, my loyal reader, this means that a) a lot of the projects that were being hosted by Pillow are no longer, and b) all of the URLs for my blog have changed.
Continue Reading