Nice neat code posts


Closed Thread
Results 1 to 40 of 40

Hybrid View

  1. #1
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107

    Default Nice neat code posts

    How is it that everyone else gets the nice formatted code in their posts?

    I do a cut-and-past from either MCS or NOTEPAD and my postings are virtually unreadable. The formatting is all messed up, and there are lots of extra spaces, etc.

    I swear that the code I write doesn't look so bad to me, but when I post it on the forum, it is a mess.

    What should I do?
    Charles Linquist

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: Nice neat code posts

    Any decent code editor allows you to convert TABs to SPACE, MCS do a decent job at this, MPLAB too.

    However, seems from time to any ANY vBulletin board, and some other may screw things up a little bit.

    Bellow, two piece of useless code, using the same tab indentation,
    in Notepad
    Code:
        VarA    VAR    BYTE
    
    LABEL1:
        IF SOMETHING THEN
            GOSUB LABEL1
            DO USELESS THING
            ENDIF
    In MCSP
    Code:
            VarA    VAR    BYTE
    
    LABEL1:
            IF SOMETHING THEN
                    GOSUB LABEL1
                    DO USELESS THING
                    ENDIF
    MCSP being the one who keep MY personnal indentation. But yeah, from time to time some line WILL be screwed up.
    Last edited by mister_e; - 14th September 2011 at 04:22.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Nice neat code posts

    I always have to go back in and re-edit code that is cut'n'pasted to the forum. Blank lines gets removed, "columns" that "straight" when I copy the code is not in the post and so on. Add to that the preview doesn't properly reflect the way it shows in the actual post makes it very time consuming.

    Like Charles I ask, what am I doing wrong.

    /Henrik.

    EDIT: Then we have posts where the code has been posted as HTML to preserve the color-syntax etc (nice!) that are now messed up. Darrel linked to one of his pieces just the other day.

  4. #4
    Join Date
    Apr 2003
    Location
    Cambridge - UK
    Posts
    1,046


    Did you find this post helpful? Yes | No

    Default Re: Nice neat code posts

    HTML posting is NOT allowed on the PICBASIC Community Forum, not only because of security issues, but also because we cannot prevent people using MS word to create a document and then posting the garbage Word HTML in the forum...which causes a number of issues that may prevent the post or the forum area from displaying correctly.

    Thus if you wish to post formatted text, you may use the editor and some BB code. All of the articles in the WIKI are produced that way and they are not unreadable.

    Using the built in editor and some BB Code does NOT prevent the creation of clean and readable posts.

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Nice neat code posts

    Well, if you say so Lester but that's the first time I've heard it's not allowed. There's even been guides on how to do it, here's a thread where one of the moderators explains how to do it (though I don't think Dave was a moderator at the time) and also the code that at the time looked perfect but not any more. And I belive this is the orignal thread.

    I'm not saying it's not possible to create good looking readable code but simply copy and paste from MCSP to within code tags usually doesn't work that well.

    /Henrik.

  6. #6
    Join Date
    Apr 2003
    Location
    Cambridge - UK
    Posts
    1,046


    Did you find this post helpful? Yes | No

    Default Re: Nice neat code posts

    OK, a few posts went through with HTML in them. BUT as the Moderators are aware and a few forum users are aware. there were one or two posts that had really badly bloated and badly formatted HTML in them, that caused the forum pages NOT to load or Crash when viewing those threads.

    HTML will not solve your problem, but WILL definitely allow users to crash certain pages and damage the smooth running of the forum.

    Sorry, but at present i don't have time to produce a tutorial on how to post code examples, formatted with colour. But if you google it you'll see that its quite faesable, if you really have to.

    For sure, I will not enable HTML posting for users, I don't have the time to sort out the issues that will arise !

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts