Thursday, September 20, 2012

Things to avoid

Magic numbers, especially if they appear in more than one place. They really want to be named constants, but they also have to be named in a way that is not dependent on the actual value. For example, worldPopulation = 6,973,738,433.

Thursday, September 13, 2012

The five (5) principles

... and here they are:

  • Single responsibility!
  • Open-closed! (but watch out for: single responsibility)
  • Liskov substitution!
  • Interface segregation! (see also: single responsibility)
  • Dependency inversion!

Sunday, January 01, 2012

No ParkHelper for you


../../../gcc-4.6.2/libjava/include/jvm.h:795:3: error: `ParkHelper' does not name a type

Saturday, December 31, 2011

Compilers with C++11 support ...


Stdcxx wiki - C++0xCompilerSupport

C++0x/C++11 Support in GCC

Status of Experimental C++11 Support in GCC 4.7

Prerequisites for GCC

The GNU Multiple Precision Arithmetic Library (GMP)

The GNU MPFR Library (multiple-precision floating-point computations with correct rounding)

MPC (arithmetic of complex numbers with arbitrarily high precision and correct rounding)

configure: error: Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify their locations. Source code for these libraries can be found at their respective hosting sites as well as at See also for additional info. If you obtained GMP, MPFR and/or MPC from a vendor distribution package, make sure that you have installed both the libraries and the header files. They may be located in separate packages.

GNU M4 (needed by gmp/configure: checking for suitable m4)

MPFR depends on GMP. The MPFR configure script may need help to find the GMP library and header files, e.g.

configure --with-gmp=/usr/local
(see INSTALL file).

MPC depends on MPFR and GMP. The MPC configure script can be informed about the whereabouts of gmp and mpfr, e.g.

configure --with-gmp=/usr/local --with-mpfr=/usr/local
(see INSTALL file).

Wednesday, January 26, 2011

The 0-1 principle, continued. The proof relies on using a monotonic mapping f which maps a pair of values a ≤ b onto a pair of values f(a) ≤ f(b). The idea is to choose f such that f(x) is either 0 or 1.
The o-1 principle: proof.

Sunday, October 10, 2010

Posted by Picasa
Posted by Picasa

Wednesday, January 20, 2010


1,168,107 (51.9%) vs 1,058,682 (47.1%) for a difference of 109,425 = 4.9% of a total of 2,249,026.