A great example of good self-promotion is BalusCBalusC. This user posts immense number of very useful answers, with deep details about JSF. He posts code snippets and fixes to the OP's problems. He also posts links to his blog - for complete code examples or extended lecture.
If you have a blog, you can self-promote it as long as you provide good and complete answers. For example, you post a function with information it was taken from your blog when you can find 10 examples of how to use it. Or to your open-source project, which can be downloaded to test the function in complete real-life example. Or post in comment that if the OP wants to learn more about technology X, he can visit your article etc.
If someone is looking for the solution to some problem, you can promote your software as a method of solving it, but only as long as it is free to use!
Promotion of commercial software is something that should be handled with special care. Some users could be offended by answers recommending using of commercial products, especially if there are free alternatives available. Some don't. I'm more biased toward open source, and avoiding commercial solutions. People form MS environment may have different type of sensitivity. But if you promote a commercial library to GNU-geek, don't be surprised by downvote or even spam-flag.