Posts

  • multi_array and multi_vector Template Aliases With SFINAE

    Let’s face it, the std::array and std::vector containers suck for multi-dimensional data. The situation is so bad it makes me long for the days of T array[N][M]; and T** array. Well, it turns out, to fix our modern C++11 and C++14 array containers, doesn’t take much work.

  • Output Parameters as Return Values

    Recently, I got tired of dealing with output parameters. I am not trying to convince anyone not to use them, but at times it is just nice to have values returned directly from the function. So let’s travel down this road of terrible ideas and loathesome mistakes.

  • The Iterator Iterator

    So I was recently thinking about the code of an iterating for loop and why there is no functionality to retrieve an iterator with a range-based for loop. The range-based for loop was a hugely popular addition to C++, however it is limited to only returning dereferenced iterators. I don’t think I need to convince anyone of why one would need an iterator rather than a dereferenced iterator, there are plenty of use cases to warrant such a loop. The issue here is that to iterate over a range using a classic for loop takes quite a lot of characters, even with the wonderful auto it that C++11 provides.

  • Extending Regex Replace

    Recently I was working with the STL regular expression library, found in <regex>. I was building a simple utility to identify tokens in a string and replace them with pre-defined values. First, I needed all replacements to occur in a single pass. Second, I needed to identify each token with it’s paired replacement value. As an example, let’s say I am using tokens to define specific directory paths. These are the tokens and their matching values:

  • Ubuntu on Azure

    I have decided to move my projects to use Clang on Linux. The primary reason that spurred this decision is to be able to keep pace with the latest C++ features. C++14 refines C++11 and makes the language much more intuitive and concise. This being said, I need a compiler that supports the latest language features and currently Clang is king of feature support. I could whine about Visual Studio but it is a great IDE. I use Visual Studio daily, and will continue to use it in projects when I see fit. However, right now for this blog, Ubuntu, Emacs and Clang is my new platform.

  • Generating a Color Gradient Part 1

    heat map The purpose of data visualization is to put information into a format that is easy to comprehend by the human brain. One way to visualize data is through color. Color is a very effective way to convey changes in data. While a random color palette is good for representing categorical data. Continuous data, such as temperature, time, or population is better represented with a continuous color palette, such as a gradient.

  • Range Mapping and Projecting Values

    Mapping values from one range to another is a common need in certain problem sets. Simply getting a percent of a total is a basic form of range mapping. You have values in a given range, and you need to translate those values into a range from 0 to 1. Let’s see if we can generalize the operation to map any range to any other range.

  • Effective Modern C++ Review

    Let me get this out of the way, I recommend this book. I don’t have a rating system but will go ahead and rate the book eight fruit doves out of nine fruit doves.

  • A Wild Logo Appears

    A huge thanks to Veronica Beley for designing an amazing logo for this site! She took my design requirements and created something super original and amazing!

  • Easy Timing

    Timing in C++ can be tedious. There are so many different ways to accomplish stop-watch functionality, all of which involve C functions. Thankfully, C++11 introduces a brand new header that makes it easy to time things accurately with very little code. C++11 once again saves the world from unclear C-style code, and provides a great specification for handling time in many different ways.

  • Displaying Data (Engineering a Solution)

    Visualizing data is hugely important to the world of algorithms. Throughout my career I have encountered innumerable problems that are incredibly hard to solve until I can view the problem outside of code. Many problems are just easier to understand when drawn. Simple mathematical expressions can become mangled and hard to understand when written as code. And even with the best debugging tools, things like data scope can turn understanding simple data into a practice of jumping between scopes, and dealing with hard to navigate data structures.

  • Hello World!

    Hello world! Rather cliché isn’t it? Is there anything interesting about Hello World? Most would say no, but I am sure we can discover a few interesting bits of information about this mundane code. Let’s analyze the most ubiquitous program ever written.

subscribe via RSS