Before coming to China I was in Korea and whenever I would see a beggar who actually looked like they were in need (as opposed to conning people for loose change) I would empty whatever small coins I had in my pocket into their cup or bucket.
Be careful, though, about doing this in China because any other beggars in the vicinity, if they see you, will attach themselves to you and follow you for several blocks. Julianne and I have found that they are much more aggressive here than in Korea, and have no problems with poking you, grabbing your arm, etc . . .