Archive for the Category ◊ Programming tricks ◊

A very impressive quine
Friday, October 30th, 2009 | Author: ovidiu

To quote wikipedia, “a quine is a computer program which produces a copy of its own source code as its only output.”

I’ve seen a couple of interesting quines in my life, but this one definitely deserves the crown.

Kudos!

Pre-calculating values
Saturday, July 25th, 2009 | Author: ovidiu

Pre-calculation is a very useful and neat programming trick that will allow you to “squeeze” more processing power out of your hardware.

In its simplest form, it involves only three easy steps :

  • Step 1: do often-used and/or complex computations only once per run (for example, during application start-up)
  • Step 2: keep the results of the computations in memory
  • Step 3: from that point on, wherever needed, use these results instead of re-doing the computations

In this tutorial I will show you how to effectively use pre-calculation to considerably speed up your code.

more…