15. December 2011

How to define C++ macro with string content and pass it to MSbuild

Imagine that we have C++ project e.g. for Visual Studio 2008. It is possible to build this project just by msbuild command:

msbuild MyProject.vcproj /p:Configuration="Release"

Let say that we want to use #define in the source code. It is necessary to define it in Configuration Properties > C++ > Command Line:

/DSIMPLE_DEFINE

This just pass SIMPLE_DEFINE as flag.

How to deal with string define which should behave like string? E.g.:

#define URL "http://georgik.rocks"

The trick is in escaping quotes. We can add following define to Command Line:

/DURL=\"http://georgik.rocks\"

It will transform into .vcproj file:

AdditionalOptions="/DURL=\"http://georgik.rocks\""

Let’s make one more step.

How to acquire such a define from environment variable? E.g. with following build.bat file:

set URL="http://georgik.rocks"
msbuild MyProject.vcproj /p:Configuration="Release"

It requires only small modification of .vcproj file:

AdditionalOptions="/DURL=\"$(URL)\""

­čśë

Small recap of flow: set env variable – pass it to XML – pass it compiler – pass it to code

18. March 2011

Collajader 0.3 – web preview of Collada format

Update: Collajader 0.2 was released. Check videos below.

Update 2: Collajader 0.3 was released. Added support for orbit camera.

There are several 3D libraries for Flash which are able to display 3D model in RIA application.

Tools like Blender and CAD/CAM software are able to generate Collada format (.dae). Alternativa3D support this format. You can load Collada file directly into application with Alternativa3D.

The only problem of exported model is that it contains a lot of other information that you do not need for rendering.

I created simple tool Collajader which is able to display content defined in Collada format in the web browser. You don’t need to start any 3D software and you can still finetune some details of the model.

Here is small screencast which shows how it works.

Update for version 0.2

You can access application here: Collajader 0.3.

Please, let me know if you find this application interesting.

10. January 2011

PyXML is dead project – warning: PyXML does not work with Python2.6

PyXML project has been dead for several years. Last version was released in 2004.

When you try to install PyXML with Python 2.6 you’ll get following error:

Failed to load application: invalid syntax (ParsedAbbreviatedRelativeLocationPath.py, line 31)

When you try to start PyXML with Python 2.5 you could see nice compiler warning:

python2.5 xml/xpath/ParsedAbbreviatedAbsoluteLocationPath.py

xml/xpath/ParsedAbbreviatedAbsoluteLocationPath.py:27:

Warning: ‘as’ will become a reserved keyword in Python 2.6

Problem is caused by following line:

´╗┐as = ParsedAxisSpecifier.ParsedAxisSpecifier('descendant-or-self')

PyXML is dead project. It does not accept patches. Some Linux distros already excluded it from repositories and Windows version for new Python does not exist as well.

Try to avoid using PyXML and replace it e.g. by xml.dom.minidom or elemettree.