LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 05-31-2013, 02:28 PM   #1
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
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 01:09 PM.
 
Old 05-31-2013, 09:23 PM   #2
Habitual
Senior Member
 
Registered: Jan 2011
Distribution: Undecided
Posts: 3,624
Blog Entries: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by H_TeXMeX_H View Post
For a bit of syntax highlighting consider the [ php] [ /php] tags.
PHP Code:
Very Clever
 
Old 06-02-2013, 08:58 AM   #3
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,539

Rep: Reputation: 149Reputation: 149
I think that this thread is very useful on this forum, so it a sticky one now.
 
Old 06-03-2013, 11:04 AM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
H_TeXMeX_H, thank's for posting this long overdue sticky

Quote:
Originally Posted by H_TeXMeX_H View Post
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.
 
Old 06-03-2013, 11:25 AM   #5
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Original Poster
Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
Alright, I added that.
 
Old 06-03-2013, 11:32 AM   #6
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,653
Blog Entries: 2

Rep: Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095
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.
 
Old 06-03-2013, 12:05 PM   #7
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Original Poster
Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
Quote:
Originally Posted by TobiSGD View Post
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 12:07 PM.
 
Old 06-03-2013, 12:14 PM   #8
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,653
Blog Entries: 2

Rep: Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095
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.
 
Old 06-03-2013, 01:08 PM   #9
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Original Poster
Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
Alright, fine, I'll take the PHP out.
 
Old 06-03-2013, 01:52 PM   #10
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,653
Blog Entries: 2

Rep: Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095
Thanks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Submitting using curl - include html tags wulfram Programming 3 06-24-2011 03:56 PM
tags for inline code fonts jlinkels LQ Suggestions & Feedback 0 02-04-2011 10:27 AM
LXer: MP3 And FLAC Metadata Information (ID3 Tags) In Nautilus List View LXer Syndicated Linux News 0 01-27-2010 12:50 AM
What are code tags? southsibling LQ Suggestions & Feedback 14 11-25-2008 10:08 AM
Allow newer users to post links so long as they're within code tags? Xert LQ Suggestions & Feedback 4 09-27-2008 02:37 PM


All times are GMT -5. The time now is 01:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration