Tuesday, May 29, 2007

Python note: python eggs

"Eggs to Python are like Jars to Java..."

More information

Thursday, May 24, 2007

C++ note: static variables

C++ is different from Java and csharp in the way classes are defined. The header files in C++ are not actually compiled into the object - they are only an indicator of how the data structures are organized, i.e. the reference to a member is the base address plus how much offside. All variables and functions to appear inside objects must be defined in the cpp files. The methods in header files are treated as inline methods.

Now static variables are those that occur in the heap. They exist from the beginning until the finishing of the running of program. All variables defined in a cpp file are static variables, they are by default external linked. If a variable defined in a cpp file has explicit "static" modifier, it is internal linked and can only be accessed by the module. Static variables can also be defined inside functions and methods, in which case they are still present all through the running of a program; however, they can only be accessed from the name scope in which they are defined. The accessibility is the only difference between static variables. Lastly, constants in header files are also taken as static variables. This is why values can be assigned to them in the header files.

Tuesday, May 22, 2007

g++ note: don't forget -c option

I made a mistake when writing Makefile today, by missing to put -c for the compile-only step. It led to a lot of unresolved external references.

Monday, May 14, 2007

Latex note: generating letter size papers

latex paper
dvips -t letterSize -Ppdf -G0 paper
ps2pdf -sPAPERSIZE=letter paper.ps

If the last step doesn't work, try the following command:
ps2pdf paper.ps

It should work because the ps file already contains size information.