You upvote any answer that address the question and you find helpful enough that they attract your vote. If both are that helpful, both get your upvote.
For acceptance, you accept whichever one you fancy. Some people will say it is better to accept the one that is more generally applicable. This often makes a lot more sense with a general question that houses a specific example that the author is more concerned about, to which the general answer can apply. But if the general solution won't help in your specific situation, then obviously one should accept the specific answer that helps your specific need.