Shop OBEX P1 Docs P2 Docs Learn Events
The Defective Code Box — Parallax Forums

The Defective Code Box

HumanoidoHumanoido Posts: 5,770
edited 2010-10-17 14:30 in General Discussion
In the old Forum, we could easily archive our own selected posts containing code.

In the new Forum, the code box appears and anything not visible in the box does not get copied, printed, or saved.

Can we eliminate the code box entirely?

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-10-15 00:41
    Why would you want to eliminate the code box? It's the only way to display programs while keeping the whitespace formatting intact.
    Humanoido wrote:
    In the new Forum, the code box appears and anything not visible in the box does not get copied, printed, or saved.
    ??? I'm not sure what the problem is. You can select the entire contents of a code box for copying to the clipboard.

    -Phil
  • HumanoidoHumanoido Posts: 5,770
    edited 2010-10-15 07:50
    Why would you want to eliminate the code box? It's the only way to display programs while keeping the whitespace formatting intact. ??? I'm not sure what the problem is. You can select the entire contents of a code box for copying to the clipboard. -Phil
    There was never any problems formatting white space in my project posts on the old forum. What are you talking about?

    If you archive a page from the new forum that has a short program in the code box that does not require scrolling, there is no problem. If it's long code that requires scrolling, it gets cut off when archiving. Try it.

    I am currently archiving by printing to PDF file, then saving the file. Any program code that is not visible in the code box without scrolling is cut off. So archives become worthless. It is a waste of inefficient time and effort to make two archives, one a cut and paste of code, and another of the text post itself.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-10-15 08:52
    Humanoido wrote:
    There was never any problems formatting white space in my project posts on the old forum. What are you talking about?
    If you try to post code without using a code box, the indents and extra embedded spaces become lost. For PBASIC code this just makes it look ugly; for Spin code, it actually changes the semantics.

    If you want to archive your posts in all their glory, why not archive the HTML source? That contains everything, including formatting information and the entire contents of the code boxes. Plus, you can view the archived file in your browser, just as if you were viewing the forum. There are also numerous HTML-to-PDF converters available. Just Google html2pdf.

    -Phil
  • HumanoidoHumanoido Posts: 5,770
    edited 2010-10-17 07:41
    If you try to post code without using a code box, the indents and extra embedded spaces become lost. For PBASIC code this just makes it look ugly; for Spin code, it actually changes the semantics. If you want to archive your posts in all their glory, why not archive the HTML source? That contains everything, including formatting information and the entire contents of the code boxes. Plus, you can view the archived file in your browser, just as if you were viewing the forum. There are also numerous HTML-to-PDF converters available. Just Google html2pdf.

    -Phil
    Hi Phil, I understand what you're saying but even if you archive in HTML and try to print it, the long programs get cut off in the code box. The same happens when converting HTML to PDF using a converter. How about making the code box equal in length to the code listing by default?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-10-17 12:13
    Once you've acquired the raw HTML, it can be edited to eliminate scrolling in the code box. Here's an example of the HTML that can be changed:
    <pre class="alt2" dir="ltr" style="
      margin: 0px;
      padding: 6px;
      border: 1px inset;
      width: 750px;
      height: 498px;
      text-align: left;
      overflow: auto">
    

    By deleting the lines containing width: and height:, you eliminate the scrollbars, and all of your code will be displayed.

    BTW, most people have no interest in archiving their posts, so I would not advocate that code displays in the forum itself be modified to eliminate scrollbars. I think keeping code boxes within fixed size limits is a Good Thing, since it keeps the physical size of a thread manageable for an effective presentation. Code boxes are designed more to illustrate short snippets of code for discussion. Entire programs are better uploaded as attachments.

    -Phil
  • SapiehaSapieha Posts: 2,964
    edited 2010-10-17 12:30
    Hi Phil Pilgrim (PhiPi)

    BUT many people post only that snippets in CODE BOX.
    And NOT in attachments I many times archived that pages to On old forum.
    That is now impossible.
    Once you've acquired the raw HTML, it can be edited to eliminate scrolling in the code box. Here's an example of the HTML that can be changed:
    <pre class="alt2" dir="ltr" style="
      margin: 0px;
      padding: 6px;
      border: 1px inset;
      width: 750px;
      height: 498px;
      text-align: left;
      overflow: auto">
    
    By deleting the lines containing width: and height:, you eliminate the scrollbars, and all of your code will be displayed.

    BTW, most people have no interest in archiving their posts, so I would not advocate that code displays in the forum itself be modified to eliminate scrollbars. I think keeping code boxes within fixed size limits is a Good Thing, since it keeps the physical size of a thread manageable for an effective presentation. Code boxes are designed more to illustrate short snippets of code for discussion. Entire programs are better uploaded as attachments.

    -Phil
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-10-17 12:48
    Any configuration is going to be a compromise, and not everyone will be happy with any particular choice. So I think it's necessary to balance the needs of the few with those of the many; and, frankly, very few people archive their posts. So the overriding issue becomes one of presentation quality, which a scrolling code box satisfies more than one which expands without limit to accommodate the text it contains.

    -Phil
  • John R.John R. Posts: 1,376
    edited 2010-10-17 14:30
    Humanoido wrote: »
    Hi Phil, I understand what you're saying but even if you archive in HTML and try to print it, the long programs get cut off in the code box.

    Print it? Besides being ecologically questionable, why, and more significantly, why on earth would we worry about formatting something in the forums so that it prints nice?

    I'm not a "new generation", I'm definitely "old school", and can appreciate paper, but why print program code? For a few months worth of paper and printer consumables, you can get a second monitor!

    Sorry, I just don't get it.


    John R.
Sign In or Register to comment.