Dynamics of earthquakes and fracture