Electrical Detection Of Mechanical Resonance In Nanotubes And Semiconducting Nanowires