Electronic structure, transport properties and doping of wide-band gap semiconducting oxides NixMg1-xO and BaSnO3