Archive for December, 2006

Using Qt with Microsoft VC++ Express

Qt is a happy little framework that runs on pretty much anything from Windows to embedded Linux. Most of my experience with it has been on unix variants or on Mac OS X.

I thought I’d try it out under Windows, and to make things interesting, I would use Visual C++ Express Edition as the C++ compiler. Trolltech’s website states that it is possible, but not details as to how (at least not that I found). My aim is not install cygwin or the full Visual Studio package.

Warning: This is a strange configuration. If you want to use Qt for open source development on Windows, just download the .exe from here and you’ll get g++ included as part of MinGW. If you want to use Qt for commercial development, then the full Visual Studio integration is highly recommended.

Qt (commercial) is integrated into Visual Studio, however the Express version of VC++ is limited so that it won’t play nicely with normal plugins. The main reason to use VC++ Express is for its command line tools.

Step 1 - Install Qt.

I installed the Qt commercial version built for VS2005. This seems to work just fine with VC++ Express.

This version Qt is available under license from Trolltech and is also available for a trial period. See here for more details.

Step 2 - Install Visual C++, Express Edition.

VC++ Express can be downloaded from here.

Run the installer and say yes to everything.

At this point you can use C++ to make .NET applications. To be able to create native applications you need the Platform SDK.

Step 3 - Install Platform SDK.

This MSDN article explains how to get the Platform SDK to work with VC++ Express.

Basically, download the SDK from here and install.

Step 4 - Mess with the environment.

Edit the qtvars.bat file (in C:\Qt\4.2.2\bin) so that the call to vsvars32.bat is outside an if statement.

The if statements check for the normal Visual Studio install, but miss the Express version.

It is useful if you add C:\Qt\4.2.2\bin to your path, as then you can call the qtvars.bat script from the command line.

Add the following variable to your environment:


QTDIR=C:\Qt\4.2.2\bin

Step 5 - Try it out.

Make a new directory and create a file called hello.pro with the following:


TEMPLATE = app
SOURCES = main.cpp

Create a file called main.cpp with the following:


#include 

int main( int argc, char *argv[] ) {
    QApplication app( argc, argv );
    QLabel *helloLabel = new QLabel( "Hello World" );
    helloLabel->show();

    return app.exec();
}

From the command line run the following commands:


c:\hello>qtvars
...
c:\hello>qmake
...
c:\hello>nmake
...
c:\hello>release\hello.exe

You should now see a very simple application that consists of a single label saying “Hello World”. Additionally, you also have a full Qt development environment that is substantially more useful than hello.exe.

The Vegetarian Experiment

Boxing Day 2005 — a point of inflection in my life, the day I started my vegetarian experiment. I’ve been asked recently as to if I’ll continue, so I thought the topic deserved a few words.

I stopped eating meat as an experiment. There was no moral imperative, no huge desire to save the world. It was a personal choice, partially motivated by a focus on personal growth.

I’m happy to try new things, thanks in part to Steve’s 30 day trial idea. Admittedly, I originally set my goal for 12 months with being vegetarian. Ambitious for someone who had declared themselves a carnivore when younger and who would have been happy to avoid vegetables and fruit.

I was expecting it to be more difficult than it was. I added in an escape clause to my commitment so it would be okay to eat meat while overseas if no other options were available. In reality, there are always other options. It is more a case of whenever practical.

There were very few incidents. I ate salmon at an important client dinner, as there weren’t suitable options in Oslo. I ate a bit of chicken in Beijing in a restaurant where there was no English menus, again dining with work colleagues.

The theory behind a non-meat diet is that there are health benefits. I didn’t calibrate my experiment very well, as I also started doing a lot more exercise around the same time. The best assertion I can make is that I’m no worse off. I suspect that I’m better off. I feel like I’m more alert and productive, and I’ve had an action packed year.

There are some down sides. Lack of choice at restaurants. Topics of discussion often centering on my diet. Nothing noteworthy really.

Now, 12 months on, I don’t miss meat. I have no desire to visit the butcher. And so, the experiment results in a change. I’ll revisit the idea again next Christmas to see if it continues.

References

For Steve Pavlina’s version of how he ended up vegan, see this article.

Travel

I’m heading down south for the holiday season, in a bid to catch up with family and friends.

The approximate dates are included below. If you happen to be in a similar place at a similar time, drop me a line - it will be great to catch up.

  • 19 - 20 Dec: On the road to Melbourne, via Parkes.
  • 21 - 26 Dec: In Melbourne or near by.
  • 27 Dec - 6 Jan: Camp Cooinda, Gippsland Lakes.
  • 7 Jan: Driving to Sydney.
  • 7 - 8 Jan: Visiting friends in Sydney.
  • 9 Jan: Long day of driving to almost Brisbane.
  • 10 - 12 Jan: Trolltech internal summit.
  • 13 Jan: Home!

I should have some level of mobile and email contact along the way.

My Path to Economical Discovery

I’ll be the first to admit, for the longest time, I couldn’t tell the difference between economics, accounting or anything else even vaguely related to finances.

Several events led me to greater understanding. Firstly, was my day job. Newspapers move around lots money as a side effect of the sale of advertising. This needs to be accounted for, and so I ended up with my head buried in concepts like Account Receivable and Invoicing.

The second event was a chance purchase of Joseph Stiglitz’s Globalization.

I grabbed the book on a whim at Hong Kong airport and started reading it while waiting for the plane. Continued reading it on the plane, succumbed to sleep and then finished it when I got home.

The content of the book in itself was interesting. Stiglitz is very passionate about the potential for good in the interaction between the IMF, the World Bank, WTO, and the countries they were designed to help. It is an interesting introduction, from an insider, to these institutions and their role in recent events.

More important to me, however, was the language and the science behind his arguments. As an economist, his logic was founded in the concepts of economics. For the first time, I saw economics as a science — a science that attempted to explain the world in which we live.

I’ve spent lots of time learning about physics to try develop an understanding of the world, and it came up somewhat short for me - although I did enjoy the maths. Economics attempts to explain human interaction across two realms: microeconomics and macroeconomics.

Microeconomics attempts to explain the day to day activities of consumers and markets. Macroeconomics attempts to explain the interactions of countries and governments, of interest rates and unemployment.

With a taste of this body of knowledge, I was hooked. I wanted more.

Fortunately, a close friend of mine had majored in economics at university, so I borrowed some of his text books. Very slow going, but the language and theories of basic economics are slowly coming into focus. The only downside is that basic economics isn’t satisfying my thirst for knowledge. The mathematics is simplistic and the assumptions so broad that I question the rationale of the conclusions.

Definitely a reason to look deeper.