Lovely Holiday

I had a very nice holiday season this year, and I hope you did as well. My wife and I went down to TX to visit her family, and spend time lounging in a beach house. I didn’t write any blog posts while I was there because I was too busy playing Skyrim, fishing and eating copious amounts of delicious food. However, now that I’ve come crashing back to the realities of life, I’ll start blogging again.

Since it’s 2012 now, I figured it might be fun to reflect on what technologies I found important in 2011.

  • Visual Studio 2010 — it’s still my primary development environment, and nothing changed in 2011 to make me drift away. I do still pull out VS 2008, and XCode, as needed. But nowhere near as often as VS 2010.
  • Lint — this is a tool I’ve really come to love. It’s been around for ages and I’ve used it before, but not to the extent I have this past year. It’s helped me to solve a few gnarly bugs in existing code bases, as well as avoid bugs in new code I’ve been writing.
  • Steam — this was the first year I really used Steam a lot for gaming, and I must admit that I really like this approach. It’s trivial to purchase games, gift games, communicate with friends and overall just have a fun time. I sincerely hope more game manufacturers jump on the Steam bandwagon! This was the first year since I can remember that I didn’t purchase a single hard copy of a game. Everything was downloaded, and the vast majority of that was Steam.
  • Roku — my wife got me one for my birthday, and it definitely gets put through its paces. We use it to watch Netflix, Ted talks, BBC world news, listen to music and all sorts of great things. What I enjoy the most about it is how unobtrusive it is!
  • Windows 7 — Couldn’t live without it. I actually liked Vista, because I could see where it was going and wanted to get there. But Windows 7 is leaps and bounds ahead of Vista in terms of enjoyment to use. Which brings me to…
  • Windows Remote Assist — this feature is awesome. It is so incredibly easy to do screen sharing, remote control, etc. I use this application to perform code reviews with coworkers, help my brother-in-law learn C, fix problems on my mom’s computer, and it’s all painless.

And I can’t list the good without listing the bad as well!

  • MSDN — this was the first time since I can remember when I found myself using the web instead of my offline MSDN viewer. I’m not certain how I feel about this, since I did find myself writing code at airports without wifi a fair amount. But the quality of MSDN online is so much higher than the application, it just “happened” silently.
  • Soundblaster — when I built my new computer this year, I decided to put in a dedicated soundcard. I figured that on-board audio was sufficient, but I wanted to see if I could get a better experience (since I finally threw away my 10 year old speakers and got some 5.1 speakers to replace them). What a terrible idea. I haven’t gone as far as pulling the card out of the box, but I’m close. I get popping and clicking noises because of poor shielding, I get constant “oddities” where sound suddenly stops working because of poor drivers. And Creative has been pretty much useless in solving the problems.
  • — when I got my Roku, I also got a subscription to It lasted less than 24 hours. I wanted to watch Twins games, since the local cable company dropped the channel which would televise them. But it turns out will not allow you to watch games if you are in the viewing area — you must use cable. The only way around this would be to set up Tor or some other proxy (effectively) to mask my true location. Because who wants to watch their hometeam, right? That’s the last time I’ll bother trying MLB, NFL, or NHL’s online services.
  • Card Member Services — it’s this phone semi-scam operation that constantly robodials my work cell phone trying to get me to do some BS with a credit card. I’ve never had a professional dealing with these guys before, so what they’re doing is quite illegal. The FCC agrees, but can’t seem to shut them down. Trying to get off their calling list gets you hung up on, as does asking for supervisors. So I devised a more analog approach to the problem. I always get one of their live humans on the phone, talk to them for a minute, and then blow a gym whistle into my phone until they hang up. I hope someone’s eardrums bleed and they get worker’s comp for it.
  • Gaming consoles — for the first time in ages, I played far more video games on my PC than on any of the consoles I own. I don’t have a real explanation for this, but it’s caught my attention. I always used to dislike PC gaming because I missed the controller, and because I work from home, I liked getting away from the computer. But at some point this year, I stopped playing on my consoles. Perhaps it was because of how easy Steam is?

If you’d like to share your technology hits and misses, feel free! Otherwise, I hope you had a great 2011, and have an even better 2012 (unless the world ends because the Mayans were right :: snorts ::)!

Posted in Uncategorized | 2 Comments

Whining about iterators

In the STL, there are multiple classes of iterators: random access, bidirectional, forward, input, and output. I’d like to discuss the different types of iterators in a bit more detail, so that I can whine about “missing” functionality.
Continue reading

Posted in C/C++ | Tagged , | Leave a comment

Stupid Compiler Tricks

A coworker approached me today with an interesting problem and I figured I’d talk about the crazy acrobatics that solved it.

He wanted to fill out a list of operations to perform that could be registered easily “at compile time”, so that the list could be traversed later to perform these operations. Basically, he wanted his code to look something like this:

typedef std::map< const char *, void (*)( void ) > WorkItemList;
static WorkItemList sWork;

void some_function( void ) {
  // Do some work
REGISTER( "operation 1", some_function );
REGISTER( "operation 2", some_function );

void some_other_function( void ) {
  // Do some work
REGISTER( "operation 3", some_other_function );
REGISTER( "operation 4", some_other_function );
REGISTER( "operation 5", some_other_function );

// Later
void DoWork( const char *workItem ) {
  WorkItemList::iterator iter = sWork.find( workItem );
  if (iter != sWork.end())

So how do you make this work?
Continue reading

Posted in C/C++ | Tagged , , | 7 Comments

String Resources

On Windows, when you need to access a string resource, you turn to the LoadString API. It takes care of finding the string for you, loading it, and copying it into the buffer you supply. However, there are times when LoadString simply falls short. For instance, for my day job, I found myself needing to access localized resources regardless of the user’s current UI locale. The only way to do this is to use the FindResourceEx function and pass in the specific language you’re after. This works fine for most resources, but strings would always come back as not found! I want to cover this particular case in more depth today.
Continue reading

Posted in Win32 | Tagged , | 2 Comments

The Amazing Visitor Pattern

I’m a big proponent of using design patterns whenever they are the proper tool for the job. One of the design patterns I find myself pulling out of the toolbox fairly frequently these days is the visitor design pattern. However, it’s not one of the more common patterns you see many people blogging about. So I’d like to cover it with some real-world examples of how I put it to use.
Continue reading

Posted in C/C++ | Tagged , | 1 Comment

A simple introduction to type traits

Type traits are a slightly more advanced topic in C++ because it they are heavily used in template metaprogramming. However, it is not an impenetrable concept, and it comes with some great benefits if you like to write generic, reusable code. I’d like to give you a simple introduction to the concept of type traits, and show some of the more beneficial use cases for them.
Continue reading

Posted in C/C++ | Tagged , , | 11 Comments

An Almost Useful Language Extension

While fiddling around a bit with clang, I came across an interesting C++ language extension from Microsoft. If you’ve done library development on Windows, you’ve likely come across the __declspec keyword for things like importing and exporting symbols from a framework. You use __declspec( dllexport ) or __declspec( dllimport ), respectively. The __declspec keyword is basically Microsoft’s version of attributes, though it predates the concept (in C++) by many years. The __declspec that caught my eye was __declspec( property ). It’s way to have automatically generated getter and setter behavior for C++ class member variables. At first, I thought this was a great feature! Then I looked into it a bit more.
Continue reading

Posted in C/C++, Win32 | Tagged , , | 4 Comments


Destructors are one of those inescapable concepts in C++. We’ve all used them, many times without even really thinking about it. But how do destructors work? What can and can’t you do with destructors? There’s a lot more complexity to this seemingly simple concept than meets the eye.
Continue reading

Posted in C/C++ | Tagged , | 7 Comments

Switching on Expressions

The switch statement is a powerful construct in C that allows you to clearly express complex if/else if/else blocks as a single statement. By providing this construct, you can write code that’s easier to understand and maintain. The downside to this is that you must use constant values for the case statements, and these constants must sensibly compare using the == operator. So, for instance, it is possible to have integers in your case statements, but not possible to have strings. Attempting to compare strings with == will not work reliably due to pointer comparisons. However, there is a solution that has the power and clarity of a switch statement in C++, and thanks to lambda functions in C++11, it can be elegant as well.
Continue reading

Posted in C/C++ | Tagged , , | 1 Comment

The Plan and Random Points

For about six months, I managed to stick to a bi-weekly update schedule of Mondays and Fridays. However, I’ve exhausted my entire backlog of topics, as well as my todo list for things to write about. Instead of trying to force myself to write about something random purely due to an arbitrary schedule, I’m scaling back. Now I’m going to post whenever I have something of value to contribute to the world.
Continue reading

Posted in Uncategorized | Tagged , , | 1 Comment