636Python 3.1 and TextMate

http://stackoverflow.com/questions/1775954/using-python-3-1-with-textmate

Variable can be set in TextMate either on a global or on a per project basis. It seems some of the internals are coded using Python 2.x, therefore a global switch to the backwards-incompatible 3.x is not recommended.

Project based variable can be set by opening a project, deselecting any text files, and clicking on the little i-icon in the project window. My path for Python 3.1 is:

TM_PYTHON
/Library/Frameworks/Python.framework/
Versions/3.1/bin/python3

Your milage might vary.

632Inline Functions in C

The keyword inline, when applied to functions, tells the compiler to optimize calls to the functions. Usually used for short functions and for the sake of clarity.

inline int max(int a, int b) {
	return a + b;
}
 
int main(void) {
	int x = 2;
	int y = 6;
	printf("result: %d", add(x,y));
}
 
// ok, the example is stupid, but i hope it illustrates the idea

Looks exactly the same as calling a function, but actually the function is not called, no function-calling overheads are created. Instead the inline function is expanded in place, where it is called. Obviously this only makes sense with rather short functions.

624Compiling VTK from Source on OSX

Getting the VTK (“Visualization Tool Kit”) on Mac OSX running does not seems to be for the faint-of-heart.

I will follow the “Installing VTK on Mac OS X” from macresearch.org, as it was written in 2007, I’ll highlight the differences to a current (August 2010, OSX 10.6) Installation.

CMake
CMake can be installed with the following command
macports sudo port install cmake

VTK – 1st Try
Wondering if you can install VTK also with MacPorts? Wonder not longer, you can’t.

VTK – 2nd Try
Ok, sometimes following a tutorial is good. Obviously replace
export MACOSX_DEPLOYMENT_TARGET=10.4u
with your current OSX version (mine is now: 10.6)