Precise directed assembly of nanoparticles for electronic, optical and biomedical applications