Archive for April, 2011

More productive programming


(inspired by 10 best tricks of fooling myself to work and Create more productive environment at your desk)

  1. Drink a good tea constantly.
    it helps to concentrate. I recommend Pu-erh or Oolong)
  2. Drink a your tea with no sugar.
    not only it tastes much better (this is the only reasonable way to drink a tea), but also when it is accidentally  spilled on a keyboard, the keyboard is recoverable, and the keys do not stick. Thus you will be significantly more productive than somebody who drinks tea/coffee  with sugar (or Pepsi or whatever)
  3. Keep your browser closed; get updates using RSS readers.
    I personally had been spending  a lot of time  checking news sites/ /. / HN /Merriam-Webster’s Word of the Day/German word of the day/ Wikipedia watch list  etc.  each time “the code is compiling”, and then continue to surf. Now RSS saves me a lot of time.
  4. Ask a co-worker for help, if you are stuck on a problem more than 30 minutes.
    usually, you will find the solution even before you finish explaining him the issue. If not, you give him a chance to solve your problem and fill genius.
  5. Use Ginkgo biloba, if you still feel dumb.
    I don’t know whether it’ effect is fully Psychosomatic or not, but it helps.

HLSL trick #2


Saving some expensive instruction in shader model 2…
(Trick #1 is described here)

Instead of, e. g.,

float getTotalDiffuse()
 float l1 = getDiffuse(g_light1);
 float l2 = getDiffuse(g_light2);
 float l3 = getDiffuse(g_light3);
 float l4 = getDiffuse(g_light4);
 return l1+l2+l3+l4;


float getTotalDiffuse()
 float4 l = {getDiffuse(g_light1),
 return dot (l, float4(1,1,1,1));

The trick is that sometimes if you want to sum some floats (or vectors), it may be cheaper to use dot product with vector (1, … , 1)