To flash, you need to get the right firmware files and use XS++.

To unlock, you can either use the Patch Unlock method, or call your carrier to get an unlock code. Getting an unlock code is the best way because you have to re-patch your phone if you ever decide to upgrade firmware.