21 June 2012

Compiling in Emacs (MacOSX 10.6)

when compiling gtkmm (installed with MacPorts) in emacs, command not found message appeared.
solution:
in ~/.emacs
;;; A quick & ugly PATH solution to Emacs on Mac OSX
(if (string-equal "darwin" (symbol-name system-type))
  (setenv "PATH" (concat "/opt/local/bin:/opt/local/sbin:" (getenv "PATH"))))
restart emacs

source

11 June 2012

pybotwar 0.7

must use pygame 1.9.1
I uses 64 bit install
SDL framework from Xcode build, make sure it's for MacOSX 10.6, uses Standard DMG, and x86_64, copy SDL.framework at build/Release/ to /Library/Frameworks
SDL_* frameworks from http://www.libsdl.org/
smpeg, universal means 32 bit and 64 bit both installed
sudo port install smpeg +universal
source

ld: framework not found SDL
problem is:
/Developer/SDKs/MacOSX10.6.sdk/Library/Frameworks/Frameworks -> /Library/Frameworks
so:
cd /Developer/SDKs/MacOSX10.6.sdk/Library/Frameworks/
ln -s Frameworks/*.framework .

source

06 June 2012

pybotwar

to work in ubuntu karmic 9.10

versions:
pybotwar-0.7
pybox2d-2.0.2b2
python 2.6.4

download http://code.google.com/p/pybox2d/downloads/list
unzip pybox2d-2.0.2b2.zip
cd Box2D-2.0.2b2
sudo python setup.py install

download http://code.google.com/p/pybotwar/downloads/list
change in world.py to work with Box2D-2.0.2b2
self.turretjoint = w.CreateJoint(jointDef)#.getAsType()

run game
cd pybotwar
python main.py

29 May 2012

Making a definition at make command

For emergency use, when an extra define is needed outside source code / Makefile.
When running make command,
make CPPFLAG=-DMYFLAG
which is equal to,
#define MYFLAG
in cpp file.

Warning: this will replace the CPPFLAG defined in the Makefile.

23 May 2012

Inkscape Troubleshooting

Recently installed a pen tablet?
Recently Inkscape become unusable?
Cannot draw / click?
File->Input Devices...->Configuration untick the pen and eraser

source

17 May 2012

Emacs Coloring

For example, when you have a Makefile named other than "Makefile", emacs by default will not color the syntax.
To force the color syntax:
M-x shell-script-mode

Pointer and Const

int n = 5; //normal int variable
int *const nptr = &n; //nptr always point to n, cannot be changed
*nptr = 6; //OK since n is non-const

const int *cnptr = &n; //treats the pointed variable as a const
n = 7; //OK
*cnptr = 8; //NG since n is treated as const

const int cn;
const int *const cnptr = &n; //cannot redirect pointer, cannot change value


source: pointers and const