I can see visible wearing on my keys in the phrase "Please use code tags when you post code" (just kidding...). Is there a way to try to auto-detect when this happens and remind the user to do so? In c++ it shouldn't be too hard, look for a few #'s and {}'s. I bet there are similar cues in other langues.

Thoughts?

David

Recommended Answers

All 15 Replies

This topic has been debated a lot in the past and the conclusion is that there is always a possibility of false positives i.e. a positive conclusion that user has posted code but not used code tags when that isn't really the case. This is a risk Dani isn't ready to take plus the implementation of the added functionality which would be required for vbulletin supporting this increases the effort required.

A couple of forums out there do this (I guess Cprogramming is one of them) but unfortunately this is a no-no for Daniweb. But given that it has been quite some while this topic was discussed and as you have anyways resurrected it, let's see... :-)

Another issue I have with it is that it has been my experience that the majority of the problem is that people don't understand what code tags are or how/why to use them. An additional notification stating to use code tags is a moot point, and an alert prohibiting the posting process is just going to be more frustrating than anything else, really.

Correct me if I'm wrong, but I'm pretty sure that Davey has the same experience as I do, with the constant PMs asking, "What are code tags and why do I need them?"

I think that if we did implement this solution, there would be an increase in the percentage of people posting with code tags. But there would also be an even more significant decrease in the percentage of new posts. Essentially, all the people who post without code tags would instead get frustrated and/or confused and simply not post at all.

I am hesitant to follow in the footsteps of sites such as CProgramming, as that site has been around MUCH longer than DaniWeb, and hasn't seen anywhere at all close to the growth or traffic that we have. Perhaps this is one of the reasons why.

Member Avatar for diafol

How about a compromise? A popup that detects 'tell-tale' symbols/tags and gives a short explanation and the option to proceed to post or cancel to edit? Just a thought. Have to be honest, I don't see too much of this in the php forum. Some grumpy old so-and-so enlightens the noobs regarding their erroneous ways.

One problem I envisage is the basic editor being the default option. The ICODE option is only seen in the advanced editor or you can hard-code it of course. If it's a trivial thing like "Remember to use the <p> tag in the <div>", I tend to just use a simple formatting like BOLD or colour. I KNOW this is wrong, but it's just a pain in the neck fussing with 'Use Advanced Editor' or typing the BBCodes by hand.

I think the "Do you want to automatically add code tags so your code is more readable on the forum?" is a great idea. This stops the problem mentioned before of people going away because they don't know how to add code tags, as well as prevents the false positive problem.

That idea was debated to death awhile ago, and determined that it just isn't feasable for the system to automate adding code tags.

Member Avatar for diafol

Sorry to labour the point - what about the 'option' popup? Is the feasibility problem down to not being able to detect unenclosed code?

Agreed. A message box that says something like
"Are you posting code without using CODE tags? YES NO

NO dismisses the box and they can add the CODE tags if they need and know how.
YES opens a complete description of how to use them.

The only question is how to detect that there's code.

>> YES opens a complete description of how to use them.

The problem is there IS no complete description/pinned post saying "How to post correctly using code tags" explaining what code tags are, how to use them correctly, why it's important, etc. There has been endless debate on how to force people who aren't willing to spend any time learning how to post correctly, but there is no link for someone who IS willing to put that effort in to read. Right now there's an easy to miss "bbcode tags" link which leads to a blank page. The last one had a date of 2004. Scores of hours have been spent in individual threads explaining how to use code tags, but the time would have been better spent fixing the "official" thread, now non-existent.

A well documented, maintained, pinned thread on how to do it correctly would serve two purposes:

  1. Those who want to do it right can learn how/why to quickly. They know whether to use "CPP", "C++", "cplusplus", or whatever.
  2. When a mod or anyone else sees someone who doesn't use them, he/she can simply post the link. No explanation necessary. Any member who still doesn't use code tags after that can be safely ignored as someone not willing to put in the effort. I'd feel much more comfortable giving such a person a scarlet negative rep letter if they ignore it. Right now with no thread to link, that's too harsh.
commented: Agreed, 100% +0
commented: Yes +0

(In addition to most of the above...)
... I don't know if this was considered before, but how about a 10 second tutorial during registration? You could throw in how to mark the thread as solved, too.

The SEO/marketing people might complain that they don't use code tags, but how many of us have sat through safety meetings for equipment that we might never use.

Essentially, all the people who post without code tags would instead get frustrated and/or confused and simply not post at all.

It's this focus on quantity over quality that drives clueful people away from Daniweb and attracts the dregs of the geek community.

I am hesitant to follow in the footsteps of sites such as CProgramming, as that site has been around MUCH longer than DaniWeb, and hasn't seen anywhere at all close to the growth or traffic that we have. Perhaps this is one of the reasons why.

The code tag test is a relatively new addition to cprog, and hasn't affected activity at all. Further, the quality of first posts has increased drastically since that measure was introduced. You know how I feel about Daniweb, but I won't hesitate to say that cprog is a much better community in terms of quality. Daniweb used to be better, and has gone down the tubes in recent years such that now all you'll find on the first page are necros, cheaters, leeches, and morons.

Now, I'm not advocating code detection because I think it's less valuable with the high volume and variance in language options. My personal opinion is that addressing the source of the issue would be more effective than treating the symptoms.

People don't use code tags for one of two reasons: laziness or ignorance. A solid tutorial on code tags (Daniweb has a rather more robust and obscure system than most forums) that's easy to find would alleviate ignorance. Not catering to the lazy would alleviate laziness.

I agree with the above post pointing out that there's a lack of accessible explanations - the new user doesn't necessarily know what you mean when you say "please use code tags". If I were able to provide a link to the "what are code tags" page, I'd use it half a dozen times a day. Perhaps a button to include such a link should be a default feature on your editor once you reach some pre-set status (>100 posts, or 500, or whatever. Come to that, I could also use a "read the sticky thread at the top of the forum which answers your question" button... :)
It's not a hard problem to detect stuff that looks like code and prompt the user to a brief explanation of bbcode/code tags, but without that explanation the prompt wouldn't be very pointful. Allowing inline code tags in the quick response would be a handy step, but again the lack of a centralized and maintained explanation of bbcode and code tags specifically is the larger problem.

Would a statement like

When posting programming code, encase it in [code], [code=syntax], where 'syntax' is any language found within our Code Snippets section, or [icode], for inline code...

be what you're looking for? This is at the top of the C and C++ forums at least.


How about

Use code tags!

There are two ways to wrap code in code tags. The easiest way to do this is to select all of your code and then click the # button on the message editor. This will automatically wrap the selected text in code tags. Without code tags, all leading whitespace will be removed from the code, so nicely formatted code ends up having no indentation. This makes the code very hard to read and many members will refuse to help you because they can't read your code.

This is in the sticky post Read This Before Posting. Yes, it needs to be edited to reflect [CODE] instead of #, but this has been available also for a long time.


The Member Rules (link at the top of every page) state

Keep it Clear
* Do wrap your programming code blocks within [code] ...
[/code] tags

On the background of the text box where the questions asked are typed in is:

Please wrap code in [code] and [icode] tags
Here is php code: [code=php]echo ":Hello World";
[/code]
Here is c code: [code=c]printf("Foo\n");
[/code]
Here is [icode]echo ""code";
[/icode] within text

Is "I agree with the above post pointing out that there's a lack of accessible explanations" actually true? Or is there just a lack of in-your-face "this MUST be read before you make 1 single post" sign-offs during registration -- which would be just another thing for them to ignore?

  1. The [noparse][code=syntax] ... [/code][/noparse] syntax is no longer necessary. If you post in the PHP forum, syntax highlighting for PHP will be default, new members should not bee bothered with this extra information.
  1. Yes, it needs to be edited to reflect [noparse][CODE][/noparse] instead of #, but this has been available also for a long time.

I've mentioned this glitch over a year ago. It won't get fixed and thus causes extra confusion.

  1. or [icode], for inline code...

New members won't know what "inline code" is. IMO the entire explanation for [ICODE] tags should be removed in the read me's, to keep it nice and simple for newbies.

  1. There is not one place on DW where codetags are explained a short in simple way with their current functionality. Every example you gave is either unclear, incomplete or just plain wrong.

I would personally like it when all the examples mentioned by Walt were deleted and be replaced by one standard "how-to-use-code-tags"; which we can then link to/copy-paste

commented: That's true. +0

New members won't know what "inline code" is. IMO the entire explanation for [ICODE] tags should be removed in the read me's, to keep it nice and simple for newbies.

Also, I don't know how many times I've seen people frame code as [code] [/icode], which makes an unformatted mess, so I agree it's confusing as it is.

4. There is not one place on DW where codetags are explained a short in simple way with their current functionality. Every example you gave is either unclear, incomplete or just plain wrong.

I would personally like it when all the examples mentioned by Walt were deleted and be replaced by one standard "how-to-use-code-tags"; which we can then link to/copy-paste

That's what I'm talking about.

I'm a tech writer, internal documentation is what I mostly do, and this sort of stuff is what I usually find when I walk into a job- a scattering of static documents, unmaintained and mostly unmaintainable, largely unread. Centralizing this sort of information and giving responsibility for maintenance to one individual - even if that maintenance is just looking at it every six months and saying "yep, it's still there" - tends to help a lot.

Putting the information in half a dozen places - or more, if it's in the sticky threads for each community - guarantees that it'll be inconsistent, unevenly written, and out of date in short order.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.