Structural and electronic properties of one dimensional inorganic and organic structures on surfaces