Cotton,
If you know all this then apologise, as long as you are in the stock long before the Ex entitlement date then you will receive the dividend, if short then the dividend is deducted.
Now if your question was more regarding how do you know when a stock is going ex it depends on what you are after.
I regularly get an up to date list of stocks going ex the coming week, this is not free but is exceedingly useful.
If you want specific stocks, then one way is to look at the company websites and that usually has all the info requierd.
Let me know if you want anyfurther info, good bit of dividend scalping never did any harm.