Sharing project properties in Visual C++

Everyone who has ever created and managed a C++ project in Visual Studio knows that there are hundreds of compiler switches and options to choose from. While setting the desired values for one project may be ok, it’s quite time-consuming and error-prone to do this for multiple projects. I’m currently working with a solution containing about 30 or so projects that share most of their project settings. I always wished there was a way to sync or share these common settings among the projects in the solution. Fortunately, there is: property sheets. They’re a bit hidden though, so I’ll explain how to use them in this article.

Note: This only applies to C++ and C++/CLI projects. .NET projects (C# and Visual Basic) don’t have that many options to be tweaked and (therefore?) can’t have shared settings.

Note 2: This article describes property sheets as they appear in Visual Studio 2010. They may work slightly different in other versions of Visual Studio.

Read more →

IDisposable, Finalizer, and SuppressFinalize in C# and C++/CLI

The .NET framework features an interface called IDisposable. It basically exists to allow freeing unmanaged resources (think: C++ pointers). In most cases, you won’t need IDisposable when writing C# code. There are some exceptions though, and it becomes more important when writing C++/CLI code.

The help page for IDisposable provides the code for IDisposable‘s default implementation pattern in C#. This article will explain each part of it step by step and also provide the equivalent C++/CLI code in each step.

Read more →

C++ references and inheritance

The last few days I’ve been hunting a bug in a C++ project I’ve been working on. This hunt again showed me how easily you can break C++ programs by accident (something that isn’t possibly in Java or C#). You need to completely understand the inner workings of C++ to avoid such pitfalls.

The whole problem was a result of me thinking that C++ references (&) are just pointers (*) that have some restrictions (e.g. they can’t be NULL). Wrong! What’s even worse: They’re sometimes just pointers with some restriction. This makes them work in some cases but fail in others.

Let me take you on my journey and you’ll hopefully avoid this (very subtle) mistake in your work.

Read more →

Intelligente Titelüberblendung mit iTunes

iTunes unterstützt seit jeher das Ãœberblenden von Titel (engl. “cross-fade”). Während ein solches Feature bei einer zufälligen Wiedergabeliste sicherlich sinnvoll ist, gibt es bestimmte CDs (meistens Live-Aufnahmen), bei denen eine solche Ãœberblendung nicht so toll ist.

"Titel überblenden" aktiviert in den iTunes Einstellung

Heute bin ich nun über einen Tipp gestoßen, dass die Titelüberblendung in iTunes tatsächlich ziemlich “intelligent” ist. Denn sie beachtet die Option Unterbrechungsfreies Album, die für jeden Titel angegeben werden kann.

Unterbrechungsfreies Album für einen Titel aktiviert
Zufällige Wiedergabe ist aktiviert

Ist Titel überblenden in den Optionen von iTunes aktiviert und wird nun ein Titel abgespielt, bei dem Unterbrechungsfreies Album auf Ja gesetzt ist, dann verzichtet iTunes bei diesem Titel auf die Titelüberblendung – es sei denn, die Option Zufällige Wiedergabe ist aktiviert. In diesem Fall werden auch Titel “übergeblendet”, die Teil eines unterbrechungsfreien Albums sind.

Zusammenfassung (bei aktivierter Titelüberblendung):

  • Titel wird übergeblendet:

    • Bei Titeln mit Unterbrechungsfreies Album auf Nein gesetzt
    • Wenn Zufällige Wiedergabe aktiviert ist
  • Titel wird nicht übergeblendet:

    • Bei Titeln mit Unterbrechungsfreies Album auf Ja gesetzt und wenn gleichzeitig Zufällige Wiedergabe nicht aktiv ist

(via Mac OS X Hints)

Sent Items in Outlook 2011 with Exchange and POP3

Today I needed to resend an email I sent a day before – using Outlook 2011 for Mac. It took a while to compose this email so I got quite scared when I looked at my “Sent Items” folder and the mail wasn’t there.

My situation: I’m using an Exchange mailbox is primary mailbox and have a POP3 account for my university email address. The latter I only use to send emails (as the actual university email address is just a forwarding). If you have a similar setup and problem, read on.

On Outlook for Windows, sending an email through this email address/account, moves the sent email to the main “Sent Items” folder – which at the same time is the “Sent Items” folder for my Exchange mailbox.

Not so on Outlook for Mac. Here we have a separate “Sent Items” folder for POP3 accounts (called “On my computer”). I had this folder disabled since (I thought) I only use my Exchange mailbox. The option hide/show this folder is in the preferences under “General”. (I only have the German version of Outlook, so screenshots are in German only; sorry for that.)

Option to show or hide the "On my computer" folder(s).
Option to show or hide the "On my computer" folder(s).

Now the “On my computer” folder showed up in my “Sent Items” folder and there my mails were.

Sent items on my computer folder
Sent items on my computer folder

Now, the quest at hand was: How do I get my sent mails into my “Sent Items” Exchange folder. The solution: Create a rule for this.

So, I went to “Settings” –> “Rules” and created a new rule in the “Outgoing” rules section.

Creating a local rule
Creating a local rule

Here you create a rule with:

  • Condition: Account is YourPop3Account
  • Execute: Move message to “Sent Items (Exchange)”

Leave the rest as it is and hit “OK”. Now try to send an email from your POP3 account and, voilà, the email you just sent should appear in your Exchange’s “Sent Items” folder.