Go Down

Topic: Auto-Detect the need for code tags? (Read 1 time) previous topic - next topic

James C4S

Since many new or first time posters come asking about code-related problems, it would be helpful to show them the code-tag feature.  If a post contains the strings "void setup()" and "void loop()" but not any code tags, would it be possible to display a warning before committing the post?  Maybe something similar to the red-message when someone replies while drafting a 2nd reply.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

smeezekitty

I would think code would be somewhat hard to detect programmatically but it is certainly possible.
Those functions as well as { } or more then a certain amount of ; could also work since those are all relatively rare in normal text.
Avoid throwing electronics out as you or someone else might need them for parts or use.
Solid state rectifiers are the only REAL rectifiers.
Resistors for LEDS!

el_supremo

It also might help if an icon could be designed which looks more like code. To me, the # symbol doesn't mean "code" at all whereas the icon for quoting text does imply quoting something. First time users might be more likely to use it if was more representative of what it does.

Pete

James C4S


To me, the # symbol doesn't mean "code" at all whereas the icon for quoting text does imply quoting something.


Maybe a big button that just says:  "Code Tags" would work?
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

el_supremo

That's a good idea :) Or perhaps the icon could just have "
Code: [Select]
"

Pete

smeezekitty


That's a good idea :) Or perhaps the icon could just have "
Code: [Select]
"

Pete


That didn't work right ;)
Avoid throwing electronics out as you or someone else might need them for parts or use.
Solid state rectifiers are the only REAL rectifiers.
Resistors for LEDS!

el_supremo

Oh Geez! :)
What I meant to say was: Or perhaps the icon could just have "[ code ]"

Pete
(I previewed it this time!)

Nick Gammon


If a post contains the strings "void setup()" and "void loop()" but not any code tags, would it be possible to display a warning before committing the post? 


A lot of people don't actually post code that compiles or have them in it. You could have a "does this look like C?" algorithm. Similar to what Google Translate uses to auto-detect languages.

And I agree about the [code] button. (Special trick to make that appear). I made the (empty) gap after the "[" but before the word "code" to be in bold.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

James C4S


A lot of people don't actually post code that compiles or have them in it. You could have a "does this look like C?" algorithm. Similar to what Google Translate uses to auto-detect languages.

I wasn't suggesting a "catch-all" type of approach.  Just a simple "does the string: 'void setup()' exist and '[code]' does not"?  If true, print a simple message and then allow the next post to go through.  Again, similar to what happens when someone posts while you edit/create a post.


And I agree about the [code] button. (Special trick to make that appear). I made the (empty) gap after the "[" but before the word "code" to be in bold.

Finally!  I could not figure out how you did it.  ;)  Thank you!
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Go Up