Characterizations of Lojasiewicz inequalities and applications