This is discussed in this post (and in that post I posted a link to another post about the same subject). You should be able to figure out how to do it, and why it is not always as trivial as one might think, somewhere in those to posts):
This is discussed in this post (and in that post I posted a link to another post about the same subject). You should be able to figure out how to do it, and why it is not always as trivial as one might think, somewhere in those to posts):