Category Archives: Uncategorized


I’ve been eating my own dogfood and it sure is yummy! The xllmath add-in hooks up functions in the C++ standard <cmath> runtime library to Excel. I work very hard to be lazy so I wrote some python code to generate the add-in from the GitHub documentation provided by Microsoft. Thank you Satya!
It is just a first cut but it compiles and runs. Try out my kibbles ‘n bits and let me know what you think.

New xll add-in library

I’ve rewritten my library for creating Excel add-ins for the n-th time: Let me know what you think.

The biggest change is that it now uses UTF-8 so you don’t have to deal with multi-byte (ASCII) character sets vs Unicode (UTF-16, UCS-2) pain. Everything gets converted to whatever makes Excel happy. Hopefully that makes you happy too.

If you have issues please post them to GitHub Issues. It’s not that I prefer the evil, money grubbing, GitHub capitalists to the evil, money grubbing, WordPress capitalists, I just like having things in one spot and I’m on GitHub more regularly.

Disclaimer: This is at the Minimum Viable Product stage so please don’t use it in production unless you need to get fired.


I have been working on a new release of my add-in for doing Monte Carlo simulation (and mucho more!) in Excel. You can help me by trying out xllMonte . I am still shaking down the current release so expect to run into problems. The good news is I have the release procedure mostly automated so I can get you a quick turnaround on anything that comes up.

The install process is still too complicated. You have to download and unzip both the setup.exe and xllmonte.msi files and run setup as administrator. I am using the (free)  Visual Studio Installer Project extension to create the msi file.

I’ve used this in the past and it worked fine for what I needed. Then there was a period when Microsoft wanted you to use InstallShield Lobotomiz^WLimited Edition until you find out it was pretty useless and had to pay for the Actually Useful version.

The next thing I tried was WiX. No, not that WiX, this WiX. It was a bit daunting at first, but the more I looked into it, the more impressed I was by their product. These are top-notch software engineers providing high quality tools to solve complicated problems.

The Windows Installer is a big, complicated machine and I don’t claim any expertise in all of its ins-and-outs, but a msi file is just a database. You can use Orca to see and edit (don’t try this at home kids) the tables. The tables declare what state(s) you want to achieve –  e.g., where files get installed, what registry entries you need – and msiexec reads the database and executes the state machine to make that happen.

As I’ve painfully found out, the Visual Studio Installer Project does not give you full access to the Orca database. It gets worse – in Windows 10 the msiexec program runs with very low privilege. So low that you can’t even modify HKCU registry entries!

I use a Certificate Authority to sign the add-in and installer but still get the nasty warnings about installing “dangerous” software. It turns out there is a new CA in town: Extended Validation Certificates.  Money can’t buy you love, but it can buy you trust. At least from Microsoft.

For now you can run setup.exe as administrator, which then runs xllmonte.msi with appropriate privileges, and then you can get up and running.

I am not worried one iota about AI putting programmers out of work. There are an infinite number of fiddly little details that have to be solved to produce a product human beings want to use. Unless, perhaps, AI can train people to be satisfied with crappy products. We seem to be starting down that road…

Of course I’m probably missing a simpler solution. Maybe Windows Store is the right way to go.


Simpler Unit Test Framework

The C++ Range library always seemed overly complicated to me. I’ve been working on lately. I work hard to be lazy and came up with an easy way to add unit tests: just write a function returning an `int` and call it to initialize a global `int` variable. The driver is just a translation unit having an `int main() { return 0; }`

See for an example.

Unit test frameworks

I’ve never understood why people use GTest, CppUnit, Catch, oh wait, Catch2 now.
Here is my C++ unit test framework:

// test object constructor calls function
struct test {
    test(const std::function& f)
        try {
        catch (const std::exception& ex) {
            fputs(ex.what(), stderr);

Just write a int main() { return 0; } file and add .cpp files that call your tests.
They look something like this:

test my_function([]()
    assert (my_function_works());

Just make sure my_function_works throws an exception with an informative message. I use ensure for that.
More examples can be found here.
Why make things complicated?


What is a type? You see that word used all the time in computer languages but it never seems to be precisely defined. Here is my definition:

type is a set of bits together with the operations that can be performed on those bits along with the rules the operations satisfy.

This is really just math 101 but the computer science world is finally catching up. Math doesn’t mention the set of bits because everything is a set in math.

An int is a set of bits (usually 32 or 64 these days) that can be added, subtracted, multiplied, divided, complemented, etc. These operations satisfy certain rules. For example, x + y = y + x. They actually satisfy a long list of rules that most people can’t be bothered to learn until something blows up. What about 2’s complement or unsigned ints or overflow? Ain’t nobody got time for that.

As my friend Candy Chiu first pointed out to me, C++ concepts (at the time called Concepts Lite) provide a language mechanism to do precisely this. More precisely, they allow compile time checks on boolean constraints on template parameters. And template parameters are types.

Li’l help?

I’ve been quiet lately, but I’ve been putting in a lot of new work. As some of you know, I teach Computational and Quantitative Finance at Columbia and use this library in that course. I revamped the xll12 library to generate documentation that can be built with Sandcastle Help File Builder and integrated with the Help on this Function link in the Function Wizard.

My students use the library to get a front row seat with traders: if you give a trader an Excel spreadsheet they will look at it. It is nearly impossible to get them to schedule a meeting where you can get their attention for any length of time, but spreadsheets are their world and they will quickly tell you what they like, what you got wrong, and, oh, yeah, BTW can you get it do this too?

One thing I learned from Mark Joshi (of xlw fame) is that you have to make things simple. People give up easily when they run into a problem. It takes a lot of work to make things simple.

I am still working on getting a CA so I can sign add-ins and set up a WebDAV server so people don’t even need to download the add-in/spreadsheet/help file. Just waiting on D&B to update my company in their database to move forward.

What I need help on is expert users to start pounding on the code and maybe even give pull requests. I’ve set up a repository at You can build it with VS 2017.

It is not as simple as it should be yet, but I will help you get going if you find this interesting. Follow your passion.


One thing I never understood about laptops, or products in general, is why there are so many different but similar models of them. It’s confusing, but apparently people find value in things they think are tailored exactly to what (they think at the time) their needs are.

Obviously the most important consideration is your budget. The second most important is what operating system you are comfortable with: OSX, Windows, or Linux, listed in decreasing order of usability of and increasing order of maintenance. The third criterion is what you want to accomplish. Are you an artists or in sales? Mac is what you need. If you need to produce documents and spreadsheets then either OSX or Windows will work for you. If you are a developer who is hooking up to the latest in web technology you must have a Linux machine.

I always get my wife Apple products. They command a premium but they look beautiful and just work. After Steve Jobs’ earthly departure their products seem to be declining in awesomeness and increasing in price, but the MacBook Air seem to be the most popular choice among the students I teach.

I have a softspot in my heart for HP because I bought my first laptop from David and Bill. They went downhill for a while but their Spectre line is looking really good these days. (Unfortunate name choice given the latest Intel debacle.)

My current laptop is a Microsoft Surface Pro 4. I tried the first version of the Surface Book and had to return it to Satya. They are two (or maybe three, checking just now) generations past that now. The touch screen is a little too touchy sometimes, but other than that it is a very solid laptop. I made the mistake of getting in the Windows 10 Insider Program. Don’t do that unless you like a wild ride.

After HP I bought IBM Thinkpad series laptops, aside from a Sony Vaio that died on the last day of their warranty. (Didn’t those guys get hacked?) Lenovo bought out the IBM business and continues to produce high quality products. Their T series are a good value and I’ve never met anyone who bought a X1 Carbon who was disappointed.

I spent many hours getting linux (Slackware) to run on my laptop and desktop machines starting with an Intel 386 desktop that cost me $3000 back in the early 90’s. There are much better options now.

OSX is Unix based, ever since OS9 was abandoned, but it is BSD Unix. Windows 10 has their WSL: Windows Subsystem for Linux. It is a work in progress but you can install the latest version of Ubuntu and are a shell prompt away from using apt get to install gcc-9, llvm, clang, and all the latest linux based technology.

There are new options available now if you believe you can rely on an internet connection: buy the the cheapest, crappiest Chromebook available and use it to log into a virtual machine of your choice. You can pick any operating system you want, how fast and how many cores you want for a CPU, how much RAM and disk space you need.

Your only problem is figuring out what you want to achieve with all the power at your fingertips now.

WordPress Ads

Ads make the world go around these days. I think Google still makes almost all of their income from ads. I was completely creeped out by how many ads WordPress had crawling across this website. Like cockroaches. They should be gone now. Let me know if you see any still popping up.