Archive for the ‘programming’ Category

JavaScript: Forwarding to another page after downloading

If you have a link to download a file (e.g. a piece of software), you may want to redirect to another page after the user clicks the link, perhaps to gather download statistics or display a message to the user. Setting the window.location in an onclick event for that link does not work, as the [...]

We have a bug!

The power of printf reveals all. Hmm. It doesn’t crash though. Weird graphical excitations occur instead. Bugs which cause crashes are the *nice* ones. This is far more insidious.

Keeping a running average

I needed to average a lot of large values and was afraid that the normal approach of a+b+c..etc/N would overflow or something. So here’s a C++ class to keep a running average: class InfiniteRunningAverage { double average; double valueCount; public: InfiniteRunningAverage() { average = 0.0; valueCount = 1; } void Add(double value) { average = [...]

An error compiling ODE…

Hmm, I just got this error after running make: process_begin: CreateProcess(NULL, cc -MMD -D_DEBUG -DdSINGLE -DWIN32 -DODE_DLL -DdSINGLE -I../../include -I../../ode/src -I../../ode/src/joints -I../../OPCODE -I../../GIMPACT/include -I../../ou/include -g -o obj/DebugSingleDLL/ode/fastlsol ve.o -c ../../ode/src/fastlsolve.c, …) failed. make (e=2): The system cannot find the file specified. make[1]: *** [obj/DebugSingleDLL/ode/fastlsolve.o] Error 2 make: *** [ode] Error 2 After unsuccessfully searching the [...]