A novel approach for preparing nitrogen-doped porous nanocomposites for supercapacitors