When to use class vs. typename in a Template Declaration

When declaring a template you can choose either “class” or “typename” for a template parameter. Example:



Rest in Peace, Regen.

This Monday I had to put down my 11 year old Rottweiler. She had just turned 11 this week, in fact. For nearly 1.5 years now we had struggled with her health. She had been a picky eater for most of her life but had gotten much worse about it, so my wife started making her homemade food. She would take a new food for a few days and quickly start refusing it, which made feeding her very difficult.



Project Euler - Problem 1 - Sum All Integers Below 1000 and Divisible By 3 or 5

The first Project Euler problem is to calculate the sum of all integers below 1000 which are divisible by either 3 or 5. My solution is implemented entirely in C++ templates. The value is recursively calculated at compile time. The template specialization struct Problem1<0> stops the recursion and returns 0. To compile this code with gcc you must expand the maximum allowed template recursion depth to at least 1000. ` g++ EulerProblem1.cpp -ftemplate-depth-1000`



Project Euler - Programming Math Problems

Project Euler presents a rather extensive list of problems which require a combination of programming skills and math skills to solve.



Portable Ubuntu for Windows

The Portable Ubuntu for Windows team has made available an Ubuntu distribution that runs fully inside of Windows using the coLinux kernel. The concept is fascinating, but it does fall down in a few places. First of all, on my Acer Aspire One, it takes a very long time to get started, which is probably fair because it is starting up an entire OS inside of the current one. Also, it seems to use a significant amount of RAM. This causes a lot of swapping on this 1G machine. Finally, the recent news about the project is related to some documentation updates, not to a new release. The currently available release is from mid last year and is of Ubuntu 804.



Building Visual Studio Express Projects From the Command Line

If you search around for how to build Visual Studio projects from the command line you will find references to the DevEnv executable. When working with Visual C++ Express, however, that tool does not exist.



Getting the Output of an Application in Windows Script

If you are programming a Windows Script in VBScript and need to retrieve the output of an external command you can use the following simple function:



Good Bye, Dr. Dobb's Journal

Just 3 months ago I lamented the decline of Dr. Dobb’s Journal.



Crate Gallery - Friday Fun

Here’s some Friday fun to waste your day with, and a bit of a poke at this website’s namesake: the empty crate. It seems that crates are used in so many video games that there is a rather disturbingly large collection of screenshots of crates in games.



Getting the List of Default #define's From GCC

Most of the postings I make to this website are for my own personal reference. They are things that I want to make sure I don’t forget, or at least have easy access to. Today is no exception. For some reason, I can never remember the following command and have to track it down every time I’m interested.