Thread: Feedback?

  1. #1
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895

    Feedback?

    Is there a feedback board? I don't see one.

    I have an issue with the board. There seems to be an input validator to prevent people from posting code outside code tags. In particular, this code:
    [code]if((theform.message.value.indexOf("}") != -1 || theform.message.value.indexOf("{") != -1) && (theform.message.value.indexOf("[code]") == -1 && theform.message.value.indexOf("
    Code:
    ") == -1 && theform.message.value.indexOf("[PHP]") == -1 && theform.message.value.indexOf("[php]") == -1))
    {
      alert("Please use code tags -- use the "Insert Source Code" button or use 
    Code:
     and
    -- to post code containing indentation ({ and })"); return false; }
    But it is broken. It means for example that I can't write any post that contains the C character literal '}' without having a code tag section too.

    Maybe a better solution can be found?
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > But it is broken. It means for example that I can't write any post that contains the C character literal '}'
    Yeah, that's deliberate.

    You can if you type in } which will show up as } (for anyone who knows their ASCII table and the HTML escapes).

    It was felt at the time that braces outside of code were sufficiently rare in normal prose, and sufficiently common in code to use it as the deciding factor.

    We were getting fed up with noobs posting code without using code tags that we implemented a system to detect code without tags. Yet despite this, occasional creative noobs seem to manage to post code without tags.

    > Maybe a better solution can be found?
    Feel free to suggest a better algorithm which says 'this is code' without generating false hits and misses.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >occasional creative noobs seem to manage to post code without tags.
    And naturally the extra protection still doesn't stop many noobs from posting code with either no formatting, or awful formatting. Perhaps we should require everyone that registers to go through a mandatory tutorial on how to consistently format readable code.

    >It means for example that I can't write any post that contains the C character literal '&#125' without having a code tag section too.
    God forbid you use the proper name for the character when writing plain text instead of the character itself. Sure, it takes more typing, but readers will think "Wow, that person must be smart to know what &#125 is called".
    My best code is written with the delete key.

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    That particular situation warranted me writing the closing brace as if it was a C character literal.

    Salem, thanks for the idea. I tend to forget that entities still work here.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #5
    Registered User axon's Avatar
    Join Date
    Feb 2003
    Posts
    2,572
    Originally posted by Prelude

    And naturally the extra protection still doesn't stop many noobs from posting code with either no formatting, or awful formatting. Perhaps we should require everyone that registers to go through a mandatory tutorial on how to consistently format readable code.
    I agree.....this could be a good thing to teach new members and weed out. I persoanlly know a few people that if there is some extra thing to do they would not join...and we don't want these kind of people on our board

    some entropy with that sink? entropysink.com

    there are two cardinal sins from which all others spring: Impatience and Laziness. - franz kafka

  6. #6
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    echo axon, mods should bring this up with the webmaster
    PHP and XML
    Let's talk about SAX

  7. #7
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >>require everyone that registers to go through a mandatory tutorial<<
    ... to which people would simply hit the "next" button until they got to the end of the lesson. No-one (virtually anyway) will actually read it. That's imho.

    Maybe the validation code should check for the existance of both an opening AND a closing brace. It's not much better, I know.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  8. #8
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    There are ways to do it. You just have to trick the board parser into ignoring the tag. However, this technique can also be used to bypass other filters as well so I'm going to leave it for you to figure out.

  9. #9
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    >>.. to which people would simply hit the "next" button until they got to the end of the lesson. No-one (virtually anyway) will actually read it. That's imho.

    nah, you put a quiz at the end bro
    PHP and XML
    Let's talk about SAX

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Looking for feedback on program segment
    By avron in forum C++ Programming
    Replies: 4
    Last Post: 05-07-2007, 04:38 PM
  2. Feedback wanted - DispHelper
    By anonytmouse in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 12-31-2003, 09:30 AM
  3. Looking for some feedback...
    By dead_cell in forum C++ Programming
    Replies: 7
    Last Post: 08-11-2002, 09:08 AM
  4. Primary game build, feedback welcome
    By Clyde in forum Game Programming
    Replies: 37
    Last Post: 07-10-2002, 05:34 AM