Pattern Recognition Using Spiking Neurons and Firing Rates