PowerShell programming puzzle: Convert snake_case to PascalCase in one line
A friend posed this PowerShell programming puzzle (P³), which represents an actual problem he had to solve: Given a string in $t in snake_case or SHOUTY_SNAKE_CASE, return the corresponding PascalCase...
View ArticleTrying to wrangle a site visit to Paul Allen’s superyacht “Octopus”
Microsoft co-founder Paul Allen passed away last year. And up for sale is his superyacht Octopus. I can’t find the Craigslist link, but if you’re interested, I’m sure you can have your people contact...
View ArticleThe sad history of the MFC TRY/CATCH macros
Why does MFC define TRY/CATCH macros? Why can’t it use standard C++ exception handling? This is another case of asking why they didn’t use the Space Shuttle to rescue Apollo 13. MFC was first released...
View ArticleThe Turkish lira’s currency code is an unexpected source of problems with...
The modern Turkish lira was introduced in 2005, replacing the old Turkish lira at an exchange rate of one million old lira to one new lira. The ISO-4217 currency code for the old lira was TRL,...
View ArticleAnother way to sort GUIDs: Java
Some time ago, I surveyed a number of GUID-sorting algorithms. At the time, I noted, “Thankfully, it never occurred to anyone to try to sort GUID components as signed integers!” How wrong I was. For...
View ArticleMy summer vacation: The Eiffel Tower
Part of our family summer vacation was spent in Paris, with excursions to nearby areas. We visited in August, which is the month that everybody goes on vacation. Some businesses close outright for the...
View ArticleHow do I split a file into two while preserving git line history?
Some time ago, I showed how to combine two files into one while preserving line history. Today, we’re going to do the opposite: Split a file into two smaller files, while preserving line history. Let’s...
View ArticleHow to split out pieces of a file while preserving git line history: The hard...
Last time, we looked at how to split a single file into multiple files while preserving line history. A related scenario is where you want to extract some pieces of a file into separate files, but...
View ArticleHow to split out pieces of a file while preserving git line history: The easy...
Last time, we split pieces of a file into separate files while preserving line history. We had to do some git commit-tree magic to get the results we wanted. But there’s a way to do this with an...
View ArticleHow to duplicate a file while preserving git line history
Today, we’re going to duplicate a file while preserving git line history. This could be useful if you want two copies of a component, say, one where you are doing a bunch of disruptive work, and...
View ArticleWhy perform all these complex git machinations when you can just tweak the...
The recent series on splitting out files (and the earlier series on combining files) went through complex git machinations to get the desired effect. Are we just doing things the hard way? Just make a...
View ArticleStop cherry-picking, start merging, Part 11: Chasing the commit by taking a...
Let’s return to the situation from Stop cherry-picking, start merging, Part 9: Chasing the commit. To recap, you have a master branch, a child branch (victim), and a grandchild branch (feature). You...
View ArticleHow did MS-DOS decide that two seconds was the amount of time to keep the...
MS-DOS 2.0 contained a disk read cache, but not a disk write cache. Disk read caches are important because they avoid having to re-read data from the disk. And you can invalidate the read cache when...
View ArticleHow do I create a Windows Runtime method that accepts a lambda?
A customer wanted to create a Windows Runtime method that accepted a lambda. But lambdas aren’t valid Windows Runtime types. // C++/WinRT IDL runtimeclass MyClass { template<typename TLambda>...
View ArticleMy summer vacation: The Louvre Museum
My wife and I spent an afternoon at the Louvre Museum with another family. (We left the kids with a third family.) You should preorder the timed-entry tickets to save yourself a very long wait in line....
View ArticleWhy does std::is_copy_constructible report that a vector of move-only objects...
The std::is_copy_constructible traits class reports whether a type is copy-constructible. But it sometimes reports that a type is copy-constructible even though it isn’t. #include <memory>...
View ArticleMy summer vacation: Versailles
Here are some notes on Versailles. Some are travel tips. Others are just my personal observations. Absolutely get a timed ticket if you want to visit the Palace. With the ticket, you walk straight to...
View ArticleWhy does the compiler refuse to let me export my class? If I don’t export it,...
Consider the following class: class Node { public: Node(); // ... public methods ... private: std::vector<std::unique_ptr<Node>> children; }; This class works great as long as you don’t try...
View ArticleMy summer vacation: Paris public transportation
What ticket to get? There are a large number of options for paying for public transportation in the Paris area. I’ll limit myself to those of interest to tourists: In order to be considered here, the...
View ArticleWhere did DirectX code names come from?
Here are the code names for DirectX as far as I remember them. DirectX 1: Manhattan. DirectX 2: Orion. DirectX 3: Orange. DirectX 4: Mustard. DirectX 5: Diesel.¹ DirectX 6: Kool-Aid. Do you see the...
View Article