Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. Site Bugs / Suggestions
  4. QA: Preview HTML: Unexpected Error / Pasting Acts Odd

QA: Preview HTML: Unexpected Error / Pasting Acts Odd

Scheduled Pinned Locked Moved Site Bugs / Suggestions
helpquestionc++htmlcss
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AspDotNetDev
    wrote on last edited by
    #1

    While improving a QA question, I saw this message in the preview area:

    Unexpected error when attempting to retrieve preview HTML.

    Here's a snapshot of the HTML I was working with:

    Question
    write a program to convert given year into roman ewquivalent of decimal

    Decimal 1 5 10 50 100 500 1000
    Roman i v x l c d m

    example
    Roman equivalent of 1988 is mdccclxxxviii
    roman equivalent of 1525 is mdxxv

    my program

    <pre lang="C++"> #include<stdio.h>
    #include<conio.h>
    int main(){
    clrscr();
    int yr,i,j=0;
    char roman[20];
    printf("Enter Year : ");
    scanf("%d",&yr);
    if(yr/1000>=0)
    {
    for(i=0;i<(yr/1000);i++)
    {
    roman[j]='m';
    j++;
    }
    yr = yr - (i+1)*1000;
    }
    if(yr/500>=0)
    {
    for(i=0;i<(yr/500);i++)
    {
    roman[j]='d';
    j++;
    }
    yr = yr - (i+1)*500;
    }
    if(yr/100>=0)
    {
    for(i=0;i<(yr/100);i++)
    {
    roman[j]='c';
    j++;
    }
    yr = yr - (i+1)*100;
    }
    if(yr/50>=0)
    {
    for(i=0;i<(yr/50);i++)
    {
    roman[j]='l';
    j++;
    }
    yr = yr - (i+1)*50;
    }
    if(yr/10>=0)
    {
    for(i=0;i<(yr/10);i++)
    {
    roman[j]='x';
    j++;
    }
    yr = yr - (i+1)*10;
    }
    if(yr/5>=0)
    {
    for(i=0;i<(yr/5);i++)
    {
    roman[j]='v';
    j++;
    }
    yr = yr - (i+1)*5;
    }
    if(yr/1>=0)
    {
    for(i=0;i<(yr/1);i++)
    {
    roman[j]='i';
    j++;
    }
    }
    printf("year in roman : ");
    for(i=0;i<=j;i++)
    printf("%c",roman[i]);
    getch();
    }</pre>

    But it only prints "m"

    can anyone help me to sort this problem?

    Also, when I select "allow HTML" and paste, less than and greater than signs get HTML encoded anyway. When I select "escape HTML", the text I paste gets wrapped in a PRE block. It might depend on if "Ignore HTML in text (good for code snippets)" is also selected or if I try to paste inside a PRE block that I've already typed out... not sure.

    [Forum Guidelines]

    A T 2 Replies Last reply
    0
    • A AspDotNetDev

      While improving a QA question, I saw this message in the preview area:

      Unexpected error when attempting to retrieve preview HTML.

      Here's a snapshot of the HTML I was working with:

      Question
      write a program to convert given year into roman ewquivalent of decimal

      Decimal 1 5 10 50 100 500 1000
      Roman i v x l c d m

      example
      Roman equivalent of 1988 is mdccclxxxviii
      roman equivalent of 1525 is mdxxv

      my program

      <pre lang="C++"> #include<stdio.h>
      #include<conio.h>
      int main(){
      clrscr();
      int yr,i,j=0;
      char roman[20];
      printf("Enter Year : ");
      scanf("%d",&yr);
      if(yr/1000>=0)
      {
      for(i=0;i<(yr/1000);i++)
      {
      roman[j]='m';
      j++;
      }
      yr = yr - (i+1)*1000;
      }
      if(yr/500>=0)
      {
      for(i=0;i<(yr/500);i++)
      {
      roman[j]='d';
      j++;
      }
      yr = yr - (i+1)*500;
      }
      if(yr/100>=0)
      {
      for(i=0;i<(yr/100);i++)
      {
      roman[j]='c';
      j++;
      }
      yr = yr - (i+1)*100;
      }
      if(yr/50>=0)
      {
      for(i=0;i<(yr/50);i++)
      {
      roman[j]='l';
      j++;
      }
      yr = yr - (i+1)*50;
      }
      if(yr/10>=0)
      {
      for(i=0;i<(yr/10);i++)
      {
      roman[j]='x';
      j++;
      }
      yr = yr - (i+1)*10;
      }
      if(yr/5>=0)
      {
      for(i=0;i<(yr/5);i++)
      {
      roman[j]='v';
      j++;
      }
      yr = yr - (i+1)*5;
      }
      if(yr/1>=0)
      {
      for(i=0;i<(yr/1);i++)
      {
      roman[j]='i';
      j++;
      }
      }
      printf("year in roman : ");
      for(i=0;i<=j;i++)
      printf("%c",roman[i]);
      getch();
      }</pre>

      But it only prints "m"

      can anyone help me to sort this problem?

      Also, when I select "allow HTML" and paste, less than and greater than signs get HTML encoded anyway. When I select "escape HTML", the text I paste gets wrapped in a PRE block. It might depend on if "Ignore HTML in text (good for code snippets)" is also selected or if I try to paste inside a PRE block that I've already typed out... not sure.

      [Forum Guidelines]

      A Offline
      A Offline
      AspDotNetDev
      wrote on last edited by
      #2

      Also, here was the question in... uh... question.

      [Forum Guidelines]

      1 Reply Last reply
      0
      • A AspDotNetDev

        While improving a QA question, I saw this message in the preview area:

        Unexpected error when attempting to retrieve preview HTML.

        Here's a snapshot of the HTML I was working with:

        Question
        write a program to convert given year into roman ewquivalent of decimal

        Decimal 1 5 10 50 100 500 1000
        Roman i v x l c d m

        example
        Roman equivalent of 1988 is mdccclxxxviii
        roman equivalent of 1525 is mdxxv

        my program

        <pre lang="C++"> #include<stdio.h>
        #include<conio.h>
        int main(){
        clrscr();
        int yr,i,j=0;
        char roman[20];
        printf("Enter Year : ");
        scanf("%d",&yr);
        if(yr/1000>=0)
        {
        for(i=0;i<(yr/1000);i++)
        {
        roman[j]='m';
        j++;
        }
        yr = yr - (i+1)*1000;
        }
        if(yr/500>=0)
        {
        for(i=0;i<(yr/500);i++)
        {
        roman[j]='d';
        j++;
        }
        yr = yr - (i+1)*500;
        }
        if(yr/100>=0)
        {
        for(i=0;i<(yr/100);i++)
        {
        roman[j]='c';
        j++;
        }
        yr = yr - (i+1)*100;
        }
        if(yr/50>=0)
        {
        for(i=0;i<(yr/50);i++)
        {
        roman[j]='l';
        j++;
        }
        yr = yr - (i+1)*50;
        }
        if(yr/10>=0)
        {
        for(i=0;i<(yr/10);i++)
        {
        roman[j]='x';
        j++;
        }
        yr = yr - (i+1)*10;
        }
        if(yr/5>=0)
        {
        for(i=0;i<(yr/5);i++)
        {
        roman[j]='v';
        j++;
        }
        yr = yr - (i+1)*5;
        }
        if(yr/1>=0)
        {
        for(i=0;i<(yr/1);i++)
        {
        roman[j]='i';
        j++;
        }
        }
        printf("year in roman : ");
        for(i=0;i<=j;i++)
        printf("%c",roman[i]);
        getch();
        }</pre>

        But it only prints "m"

        can anyone help me to sort this problem?

        Also, when I select "allow HTML" and paste, less than and greater than signs get HTML encoded anyway. When I select "escape HTML", the text I paste gets wrapped in a PRE block. It might depend on if "Ignore HTML in text (good for code snippets)" is also selected or if I try to paste inside a PRE block that I've already typed out... not sure.

        [Forum Guidelines]

        T Offline
        T Offline
        Thiru Thirunavukarasu
        wrote on last edited by
        #3

        Seems to work fine here. Tested in Chrome, Firefox, IE7/8. Are you able to reproduce the problem?

        A 1 Reply Last reply
        0
        • T Thiru Thirunavukarasu

          Seems to work fine here. Tested in Chrome, Firefox, IE7/8. Are you able to reproduce the problem?

          A Offline
          A Offline
          AspDotNetDev
          wrote on last edited by
          #4

          Nope, can't reproduce either. Hamsters must have been off somewhere storing food in their cheeks or something. They appear to be on their well-oiled wheels again.

          [Forum Guidelines]

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups