Wasting time and effort over something in a way that makes you look foolish, particularly if your efforts were to improve something or show off to friends/family/colleagues.
It can also mean that you've wasted time trying to improve something, while you're instead making more of a mess than was there beforehand.
"We thought we were being clever by activating this new function in the program, but instead we were just pooing against the tree"