Functions of hydroxyapatite in fabricating N-doped carbon for excellent catalysts and supercapacitors