What information to include in a post and how to use code tags
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
What information to include in a post and how to use code tags
As threads in the Programming forum differ from threads in other forums, here are some tips on what to include in a post.
1) Make sure to include in the title and/or post what programming language(s) you are dealing with.
2) Include a clearly worded description of the problem with some details, NOT just "it doesn't work".
3) Include an attempt at solving the problem, in code tags.
4) Include examples of desired input and output, also in code tags.
5) Include errors that you are getting, also in code tags.
Code tags are part of the BBcode markup language. They start with [code] and end with [/code]. They will look like:
Code:
tabs and spaces are preserved here
and your code will be much easier to read.
So again:
[code]
your code goes here
[/code]
An example:
Code:
#include <stdio.h>
int main (void)
{
printf ("Hello World\n");
return 0;
}
Here's without the tags:
#include <stdio.h>
int main (void)
{
printf ("Hello World\n");
return 0;
}
Which is easier to read ?
In Python, where indentation matters, nobody can run your code if it is not in code tags.
You can also access code tags by clicking the '#' button right above the text input box when you are typing a post (not yet available in Quick Reply mode, but the tags work).
6) Do NOT expect members here to do your homework for you. Do NOT just post the problem (#2), leave, and expect someone to post the solution by the time you return. Members here are discouraged from doing this, as it doesn't help anyone, and may even harm by preventing you from learning what you are supposed to learn. However, posting all of the above information (#1 through #5) will get you some help if you are having trouble.
Last edited by H_TeXMeX_H; 06-03-2013 at 12:09 PM.
H_TeXMeX_H, thank's for posting this long overdue sticky
Quote:
Originally Posted by H_TeXMeX_H
2) Include a clearly worded description of the problem.
I would like to add that 'clearly worded' almost never includes the phrase "doesn't work". We all assume it doesn't work, otherwise why would you be asking? Details about the nature of the fault are required.
--- rod.
I am not quite sure if we should encourage the usage of php-tags for code, it may be difficult or even impossible to read that code for color-blind people.
I am not quite sure if we should encourage the usage of php-tags for code, it may be difficult or even impossible to read that code for color-blind people.
That's not true. Color-blind people have difficulty distinguishing between colors. It's not that certain colors are invisible to them, they just don't look the same. http://en.wikipedia.org/wiki/Color_blind
If there were any concern, it would be about the background color, which could hide the letters in some people. And that varies from post to post, so it's more complicated.
A more pertinent concern would be that sometimes the php code causes formatting errors and the post may expand off the screen.
Last edited by H_TeXMeX_H; 06-03-2013 at 11:07 AM.
I do know how color-blindness works. My point was not that for color-blind people certain colors are invisible, but that those color possibly are not differentiable from the background, making them effectively invisible in the code. So possibly monochrome code-boxes are easier to read for them. Since I am not color-blind it is impossible for me to determine that, that is why I said: I am not quite sure.
Do you mind long posts with much info to go through?
It depends on the info, but in general, the shortest description necessary to describe your specific problem, the better. Asking members to review and understand a large code base to answer a question is not an acceptable use. Try to keep your question specific to a single issue and avoid broad generalities.
Remember that everyone here volunteers their time, so you help yourself by keeping your posts clear and brief and easily understood by those willing to help. When confronted with a confusing wall of text, many members will simply move on to another question.
Please review the Site FAQ for guidance on acceptable forum use, an in particular read the linked article, How To Ask Questions The Smart Way for guidance forming your questions.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.