how to disable screen blanking and the screensaver in ubuntu

simple, on the fly:

xset -dpms ; xset s off

configure X windows (Xorg) and lightdm:

/usr/share/X11/xorg.conf.d/99-disable-dpms.conf
Section "ServerFlags"
  Option "BlankTime" "0"
  Option "StandbyTime" "0"
  Option "SuspendTime" "0"
  Option "OffTime" "0"
EndSection

also, disable screen stuff in the power manager and display preferences