Design and fabrication of nanostructures for light manipulation in solar cells and microelectromechanical systems