Step1
Consider what's making your dog yap. Does he need yard access? Is a cat taunting him through the window? Does he newly like the sound of his bark?
Step2
Check your pet's deep-seated needs: hunger, thirst or elimination. Your pup might be trying to relate you something.
Step3
Remove your dog's motivation for barking. For example, make a dog door for easy outdoor access or close the shades.
Step4
Invest within a citronella no-bark collar, which is effective and not cruel; if your dog barks, the collar sprays a small amount of citronella, which dogs dislike.
Step5
Use positive reinforcement to train your dog to yelp on command; this will help him learn how to be quieted on command as well.
Step6
Say "Good" at the exact instant your pet exhibits right behavior, followed by a reward and plenty of praise.
Step7
Consult a board-certified veterinary behaviorist or a pet behaviorist for additional suggestions if adjectives else fails.

Answers: Get a can of condensed air (usually used to blow dust off of keyboard) and blow it at him whenever he bark saying "No!" sharp, loud, and fast. It does not hurt him in besides, just distracts him from whatever he's barking at. Be certain that when he doesn't bark at something he used to, to offer lots of praise and hugs.
Hope it works!

I wouldn't propose using the air can, because the chemicals that are in there are not angelic for people (or dogs) to inhale.

What I did to stop my dog (a beagle/aussie shepherd mix) barking was I trained her from a impressively young age not to bark. When she did bark at something, I'd pocket her by the collar and give her a stern "No." right at that moment.

Later, when she was a bit elder, she got a bark collar. This gives the dog for a moment zap of electricity when they bark a lot. Not enough to hurt, merely enough to startle them.
Try a bark collar! best way everytime unless you own the time to properly train him with out one

In most cases, the more confident and content the dog, the less likely he is to yap. Keep your dog mentally and physically stimulated; socialize him to as many different people, places, and animals as possible; and ensure that he gets the attention from you that he requests and deserves. Providing plenty of opportunities for him to choose an appropriate behavior is key to a mutually happy relationship.