In the body of your question, start by expanding on the summary you put in the title.
Explain how you encountered the problem you're trying to solve, and any difficulties that have prevented you from solving it yourself.
The first paragraph in your question is the second thing most readers will see, so make it as engaging and informative as possible.
Help others reproduce the problem
Not all questions benefit from including code. But if your problem is with code you've written, you should include some. But don't just copy in your entire program! Not only is this likely to get you in trouble if you're posting your employer's code, it likely includes a lot of irrelevant details that readers will need to ignore when trying to reproduce the problem. Here are some guidelines:
- Include just enough code to allow others to reproduce the problem. For help with this, read How to create a Minimal, Complete, and Verifiable example.
- If it is possible to create a live example of the problem that you can link to (for example, on http://sqlfiddle.com/ or http://jsbin.com/) then do so - but also copy the code into the question itself. Not everyone can access external sites, and the links may break over time. Use Stack Snippets to make a live demo of inline JavaScript / HTML / CSS.
- *DO NOT post images of code*, data, error messages, etc. - copy or type the text into the question. Please reserve the use of images for diagrams or demonstrating rendering bugs, things that are impossible to describe accurately via text. For more information please see the Meta FAQ entry Why not upload images of code/errors when asking a question?
<h2id="_how_do_i_ask_a_good_question">6. How do I ask a good question?</h2>
<divclass="sectionbody">
<divclass="admonitionblock tip">
<table>
<tr>
<tdclass="icon">
<iclass="fa icon-tip"title="Tip"></i>
</td>
<tdclass="content">
<divclass="ulist">
<ul>
<li>
<p>Introduce the problem before you post any code</p>
<divclass="literalblock">
<divclass="content">
<pre>In the body of your question, start by expanding on the summary you put in the title.</pre>
</div>
</div>
<divclass="literalblock">
<divclass="content">
<pre>Explain how you encountered the problem you're trying to solve, and any difficulties that have prevented you from solving it yourself.</pre>
</div>
</div>
<divclass="literalblock">
<divclass="content">
<pre> The first paragraph in your question is the second thing most readers will see, so make it as engaging and informative as possible.
Help others reproduce the problem</pre>
</div>
</div>
</li>
</ul>
</div>
<divclass="paragraph">
<p>Not all questions benefit from including code. But if your problem is with code you’ve written, you should include some. But don’t just copy in your entire program! Not only is this likely to get you in trouble if you’re posting your employer’s code, it likely includes a lot of irrelevant details that readers will need to ignore when trying to reproduce the problem. Here are some guidelines:</p>
</div>
<divclass="ulist">
<ul>
<li>
<p>Include just enough code to allow others to reproduce the problem. For help with this, read How to create a Minimal, Complete, and Verifiable example.</p>
</li>
<li>
<p>If it is possible to create a live example of the problem that you can link to (for example, on <ahref="http://sqlfiddle.com/"class="bare">http://sqlfiddle.com/</a> or <ahref="http://jsbin.com/"class="bare">http://jsbin.com/</a>) then do so - but also copy the code into the question itself. Not everyone can access external sites, and the links may break over time. Use Stack Snippets to make a live demo of inline JavaScript / HTML / CSS.</p>
</li>
<li>
<p><strong>DO NOT post images of code</strong>, data, error messages, etc. - copy or type the text into the question. Please reserve the use of images for diagrams or demonstrating rendering bugs, things that are impossible to describe accurately via text. For more information please see the Meta FAQ entry Why not upload images of code/errors when asking a question?</p>