none
Please use monospace font for unspecified code RRS feed

  • Question

  • Can you please make it so that a monospaced font that preserves spaces is used for code snippets added in an "unspecified" language?  I go through all the effort of trying to format characters correctly and then the code formatter just blows away all my spaces.  Spaces can matter!  Particularly in an "unspecified" code context.  If the context is unspecified, you have no right to assume you can blow away my spaces.
    Thursday, June 3, 2010 7:50 PM

Answers

  • So what's the bug?

    If I paste this in...

    NTAccount                 LastUseDays UserDATDays FolderDays

    ---------                 ----------- ----------- ----------

                                       96          96        283

                                      283         283        283

    WS101\QBDataServiceUser20         143         143        148

    WS101\admin                       147         147        526

    SEC\testuser2                       9           9         18

    SEC\pmazza                          1           1          1

    SEC\jvierra                         0           0         37

    SEC\DTrombitas                      5           5          8

    WS101\NETWORK SERVICE               5           5          5

    WS101\LOCAL SERVICE                 5           5       1080

    WS101\SYSTEM                      547         547        368

    ...Then it looks okay. And if I add it to the code box...

    NTAccount                 LastUseDays UserDATDays FolderDays
    ---------                 ----------- ----------- ----------
                                       96          96        283
                                      283         283        283
    WS101\QBDataServiceUser20         143         143        148
    WS101\admin                       147         147        526
    SEC\testuser2                       9           9         18
    SEC\pmazza                          1           1          1
    SEC\jvierra                         0           0         37
    SEC\DTrombitas                      5           5          8
    WS101\NETWORK SERVICE               5           5          5
    WS101\LOCAL SERVICE                 5           5       1080
    WS101\SYSTEM                      547         547        368

    Then it looks okay. The code box strips the style formatting. This is by design for a lot of reasons. If you'd like exceptions made, then this thread should go into the Forum Suggestions forum.

    Thanks!


    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)

    Friday, July 6, 2012 5:54 PM
    Owner

All replies

  • Still an issue?

    Thanks!


    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)

    Sunday, May 27, 2012 11:03 PM
    Owner
  • I can't repro. Please reply if you can repro.

    Thanks!


    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)

    Thursday, May 31, 2012 8:06 AM
    Owner
  • The spaces get eaten if they are really tabs.  The formatter does not handle tabs well.  It also eats blank lines.

    TAB TEST:

    NOTAB TAB1 TAB2 TAB3

    The above works on this site but not on ITSG site/forum

    Lines below had two then three blank line but now they are gone.

    line after two line feed after three


    ¯\_(ツ)_/¯

    Thursday, May 31, 2012 9:01 PM
  • I'm assuming you have to paste in the tabs?

    Can you link to the ITSG site? Is it in the MSDN branding?

    Thanks!


    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)

    Tuesday, June 5, 2012 9:57 PM
    Owner
  • I'm assuming you have to paste in the tabs?

    Can you link to the ITSG site? Is it in the MSDN branding?

    Thanks!


    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)

    The ITCG site does the same thing. 

    If I paste in code with blank lines for readability it removes them all no matter what code style is chosen.  I now put comment characters at the beginning of all blank lines before pasting.


    ¯\_(ツ)_/¯

    Wednesday, June 6, 2012 2:02 AM
  • What would the bug write up be?

    Step 1...?

    Thanks!


    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)

    Thursday, June 21, 2012 2:01 AM
    Owner
  • Here is a recent example:

    The table is fixed width columns.

    NTAccount                 LastUseDays UserDATDays FolderDays
    ---------                 ----------- ----------- ----------
                                       96          96        283
                                      283         283        283
    WS101\QBDataServiceUser20         143         143        148
    WS101\admin                       147         147        526
    SEC\testuser2                       9           9         18
    SEC\pmazza                          1           1          1
    SEC\jvierra                         0           0         37
    SEC\DTrombitas                      5           5          8
    WS101\NETWORK SERVICE               5           5          5
    WS101\LOCAL SERVICE                 5           5       1080
    WS101\SYSTEM                      547         547        368

    Using the unspecified or any other style.  Note that the clumsy are all collapsed do to the use of proportional spaced font (TrueType or other Justifiable font).

    Here is what it looks like using a fixed font:

    NTAccount                 LastUseDays UserDATDays FolderDays

    ---------                 ----------- ----------- ----------

                                       96          96        283

                                      283         283        283

    WS101\QBDataServiceUser20         143         143        148

    WS101\admin                       147         147        526

    SEC\testuser2                       9           9         18

    SEC\pmazza                          1           1          1

    SEC\jvierra                         0           0         37

    SEC\DTrombitas                      5           5          8

    WS101\NETWORK SERVICE               5           5          5

    WS101\LOCAL SERVICE                 5           5       1080

    WS101\SYSTEM                      547         547        368

    Now the columns line up but the structure uses <p> tags and is reformatted by the current style.

    In most cases we would like a fixed column text display to display tables and things that don't collapse.

    Now I can force this to work by hand editing the HTML but that completely breaks the edit box so I can only post a picture of what it should look like.

    Note that editing the HTML is very frustrating - try it on more than a few lines.  The edit box just jumps ll over the place.

    All-in-all this web portal is a very bad advertisement for Microsoft but it does not have to be that way.  I have worked with IIS since before ASP and IE.  IIS is awesome especially with ASP.NET.  There is no excuse for this behavior.

    Wow! Inserting that image took me 15 minutes because tis site just fights everything. I could;upload so I had to link.

    I worked with two off-shore companies from India.  They both ran this Little scam on out web project.  They made everything work exactly as the spec said an no more.  Every time I ruined around functionality would disappear.  If we said we need out edit box to accept (also) a European phone number then it would but only a European phone number.  I would write a code templates to show what was required.  They would argue that they couldn't be implemented.  On every go-around we would get a new and bigger bill.  We eventually fired both companies.

    I have worked with Indian adChineesesoftware developers for many years. Most are veer competent, In fact most are awesome in their capabilities.  Many are just scam operations.

    I hope that sis not the case with this web portal but it does not seem to be improving in any significant way.  Perhaps someone needs to review the complaints and adjust priorities.

    I don't post this because I feel any lost value but I do think that a Microsoft site should do much better. This is a valuable resource for Microsoft admins.  I support numerous admins and I would like to feel very proud of sending them to the MS Forums.  I currently don't feel that this is the best advertisement for Microsoft Web technologies.

    Please fix and update this forum portal.  It should be a showcase and not an aggravation.

    So Ed, if you can do anythig about this then great.  If not I guess we wil just muddle through.

    P.S.> I like the new look of your blog site.


    ¯\_(ツ)_/¯




    • Edited by jrv Saturday, June 30, 2012 1:08 AM
    Saturday, June 30, 2012 12:29 AM
  • So what's the bug?

    If I paste this in...

    NTAccount                 LastUseDays UserDATDays FolderDays

    ---------                 ----------- ----------- ----------

                                       96          96        283

                                      283         283        283

    WS101\QBDataServiceUser20         143         143        148

    WS101\admin                       147         147        526

    SEC\testuser2                       9           9         18

    SEC\pmazza                          1           1          1

    SEC\jvierra                         0           0         37

    SEC\DTrombitas                      5           5          8

    WS101\NETWORK SERVICE               5           5          5

    WS101\LOCAL SERVICE                 5           5       1080

    WS101\SYSTEM                      547         547        368

    ...Then it looks okay. And if I add it to the code box...

    NTAccount                 LastUseDays UserDATDays FolderDays
    ---------                 ----------- ----------- ----------
                                       96          96        283
                                      283         283        283
    WS101\QBDataServiceUser20         143         143        148
    WS101\admin                       147         147        526
    SEC\testuser2                       9           9         18
    SEC\pmazza                          1           1          1
    SEC\jvierra                         0           0         37
    SEC\DTrombitas                      5           5          8
    WS101\NETWORK SERVICE               5           5          5
    WS101\LOCAL SERVICE                 5           5       1080
    WS101\SYSTEM                      547         547        368

    Then it looks okay. The code box strips the style formatting. This is by design for a lot of reasons. If you'd like exceptions made, then this thread should go into the Forum Suggestions forum.

    Thanks!


    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)

    Friday, July 6, 2012 5:54 PM
    Owner
  • Ed - I guess I was not real clear.  The one that worked wsa plain text pasted into Outloo HTML edit bos and then had fixed fnt applied.  If I paste from notepad with a table layout with all correct spacing the text is collapsed in teh forum editor under all circumstances becuse the forum has no way of specifying a fixed font.  In most forum the is a way to paste a table and not have th it collapsed.  In teh code control it would be easy to make one setting as a fixed font text display with no colorizing.

    Sorry if my example of what it could look like seemed as though I was showing yu what it did llok like.  Getting it to paste in a fixed font was very hard to do.  The first three methods got glommed by teh forum style.  Mpre> <textarea> and a <div> with a fixed font.  The HTML reformatter just converts all of those into <p> or oher funcky decoration like <oobla>  or <gadget>

    It is a  very interesting HTML generator.  Not sure what it is trying to do although I know it needs to keep the HTML flat so it will work across browsers.  I  think someone needs to go back to HTML school or stop drinking so much Pepsi.

    Sample 1 - dir listing pasted:

     Volume in drive C has no label.
     Volume Serial Number is 0CC7-B200

     Directory of C:\Program Files\Windows Resource Kits\Tools

    [.]                              [..]                             acctinfo.dll
    adlb.exe                         admx.msi                         atmarp.exe
    atmlane.exe                      autoexnt.exe                     cdburn.exe
    cepsetup.exe                     checkrepl.vbs                    chklnks.exe
    chknic.exe                       clean.vbs                        cleanspl.exe
    clearmem.exe                     clone.vbs                        clusdiag.msi
    clusfileport.dll                 clusfileport.inf                 clusfileport_win2000.inf
    clusterrecovery.chm              clusterrecovery.exe              cmdhere.inf

    Sample 2 - paste to OUtlook and apply fixed font:

    Volume in drive C has no label.

     Volume Serial Number is 0CC7-B200

     Directory of C:\Program Files\Windows Resource Kits\Tools

    [.]                              [..]                             acctinfo.dll

    adlb.exe                         admx.msi                         atmarp.exe

    atmlane.exe                      autoexnt.exe                     cdburn.exe

    cepsetup.exe                     checkrepl.vbs                    chklnks.exe

    chknic.exe                       clean.vbs                        cleanspl.exe

    clearmem.exe                     clone.vbs                        clusdiag.msi

    clusfileport.dll                 clusfileport.inf                 clusfileport_win2000.inf

    clusterrecovery.chm              clusterrecovery.exe              cmdhere.inf

    cmgetcer.dll                     cmgetcer.txt                     comctl32.ocx

    Notice how blank space is added because the style is overwritten and each line has become wraped in a <p>

    Example 3 PRE ( hand built in HTML editor using 'terminal' font)

    Volume in drive C has no label.
     Volume Serial Number is 0CC7-B200
    
     Directory of C:\Program Files\Windows Resource Kits\Tools
    
    [.]                              [..]                             acctinfo.dll
    adlb.exe                         admx.msi                         atmarp.exe
    atmlane.exe                      autoexnt.exe                     cdburn.exe
    cepsetup.exe                     checkrepl.vbs                    chklnks.exe
    chknic.exe                       clean.vbs                        cleanspl.exe
    clearmem.exe                     clone.vbs                        clusdiag.msi
    clusfileport.dll                 clusfileport.inf                 clusfileport_win2000.inf
    clusterrecovery.chm              clusterrecovery.exe              cmdhere.inf
    cmgetcer.dll                     cmgetcer.txt                     comctl32.ocx 
    

    ¯\_(ツ)_/¯


    • Edited by jrv Friday, July 6, 2012 7:43 PM
    Friday, July 6, 2012 7:32 PM
  • Then it looks okay. The code box strips the style formatting. This is by design for a lot of reasons.

    And more exactly would those reasons be? It is very difficult to understand why I should use a separate window to post code and where I see it monospaced - and then it is not monospace when the final post is made.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
    Friday, July 6, 2012 9:48 PM
  • The issue is not really 'monospaced' font. Code should always be displayed in a fixed font.  The web defines at least one universal fixed font 'Terminal'.  This is defined to allow for static text representations.  This plus 'PRE' should give us flat text output.

    Editing in this forum is a chanllenge because every one of the editors are "almost" useful but only "almost".

    I claim this is not a good advertisement for Microsoft technologies.  As a web support technician and occasional developer/project leader I know it can be done much more easily. I have found this kind of unreliable behavior in other projects where web developers rely heavily on third party controls that are not really designed for the target system.

    In this forum the code syntax colorizer is a public domain item that is not ready for prime time.  That, coupled with an Infragistics control that is not really a good web editor without a lot of external help makes the experience less that wonderful.


    ¯\_(ツ)_/¯

    Friday, July 6, 2012 10:07 PM
  • Then it looks okay. The code box strips the style formatting. This is by design for a lot of reasons.

    And more exactly would those reasons be? It is very difficult to understand why I should use a separate window to post code and where I see it monospaced - and then it is not monospace when the final post is made.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

    Erland - absolutely!

    We need to get others to join in here.  Its the 4th.  We need to revolt against this HTML tyranny!.

    Seriously - it is very aggravating.


    ¯\_(ツ)_/¯

    Friday, July 6, 2012 10:09 PM
  • So what's the bug?

    If I paste this in...

    NTAccount                 LastUseDays UserDATDays FolderDays

    ---------                 ----------- ----------- ----------

                                       96          96        283

                                      283         283        283

    WS101\QBDataServiceUser20         143         143        148

    WS101\admin                       147         147        526

    SEC\testuser2                       9           9         18

    SEC\pmazza                          1           1          1

    SEC\jvierra                         0           0         37

    SEC\DTrombitas                      5           5          8

    WS101\NETWORK SERVICE               5           5          5

    WS101\LOCAL SERVICE                 5           5       1080

    WS101\SYSTEM                      547         547        368

    ...Then it looks okay. And if I add it to the code box...

    NTAccount                 LastUseDays UserDATDays FolderDays
    ---------                 ----------- ----------- ----------
                                       96          96        283
                                      283         283        283
    WS101\QBDataServiceUser20         143         143        148
    WS101\admin                       147         147        526
    SEC\testuser2                       9           9         18
    SEC\pmazza                          1           1          1
    SEC\jvierra                         0           0         37
    SEC\DTrombitas                      5           5          8
    WS101\NETWORK SERVICE               5           5          5
    WS101\LOCAL SERVICE                 5           5       1080
    WS101\SYSTEM                      547         547        368

    Then it looks okay. The code box strips the style formatting. This is by design for a lot of reasons. If you'd like exceptions made, then this thread should go into the Forum Suggestions forum.

    Thanks!


    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)

    Unfortunately the direct pasted text adds numerous extra bits of white space and will wrap when the lines are too long.  What is needed is a true text display.  Tabs do not get expanded with the default page. 

    Look at the HTML.  every line is wrapped with a <p> tag.

    The text you pasted was a copy of text I modified to use a fixed font.  That is why it worked.

    Here is a bit of text in notepad.  No html

    A1 B1 C1 D1
    01 02 03 04
    COLUMN1 COLUMN2 COLUMN3 Column4

    See how it collapses.  The original columns were wide.

    A1      B1      C1      D1
    01      02      03      04
    COLUMN1 COLUMN2 COLUMN3 Column4

    Same columns with fixed spaces instead of tabs.

    <textarea cols="40" rpws="5">A1 B1 C1 D1 01 02 03 04 COLUMN1 COLUMN2 COLUMN3 Column4 </textarea>

    Using a <textarea> allows the spaces to be rendered in a fixed font which is the default for this control.

    To do this manually is a big pain.


    ¯\_(ツ)_/¯


    • Edited by jrv Monday, July 16, 2012 6:55 PM
    Monday, July 16, 2012 6:48 PM
  • The text you pasted was a copy of text I modified to use a fixed font.  That is why it worked.

    Here is a bit of text in notepad.  No html

    A1 B1 C1 D1
    01 02 03 04
    COLUMN1 COLUMN2 COLUMN3 Column4

    See how it collapses.  The original columns were wide.

    A1      B1      C1      D1
    01      02      03      04
    COLUMN1 COLUMN2 COLUMN3 Column4

    Same columns with fixed spaces instead of tabs.

    <textarea cols="40" rpws="5">A1 B1 C1 D1 01 02 03 04 COLUMN1 COLUMN2 COLUMN3 Column4 </textarea>

    Using a <textarea> allows the spaces to be rendered in a fixed font which is the default for this control.

    To do this manually is a big pain.


    ¯\_(ツ)_/¯


    Can you try pasting it into a Code Block and show if the results are any different? The Code Block feature was created to address HTML translation concerns (and to track use of code snippets).

    Thanks!


    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)

    Monday, July 16, 2012 8:09 PM
    Owner
  • Ed - think about it.  Pasting it into HTML will just display HTML.  It will not specisically address issues of tabs and spaces.

    As you can see.  The 'textarea' disaply once ofr twice then the web HTML rewriter removes it?

    <textarea cols="40" rows="5">
    A1       B1      C1      D1 
    01       02      03      04 
    COLUMN1  COLUMN2 COLUMN3 Column4
    </textarea>

    Like that.

    Or

    <textarea cols="40" rows="5">A1 B1 C1 D1 01 02 03 04 COLUMN1 COLUMN2 COLUMN3 Column4 </textarea>

    The above now looks like fixed width in a texatarea with scrollbars.  It will cese to tb ethat if I leave the page and come back.

    I am back on and edit and teh formatting is gone.  What you see is the HTML dispaly wher ethe textbox was.  This is because teh HTML re-writer cannot handle a textarea control as is is not correctly supported across all browsers.  The page just grabs the HTML and prints it as is.

    Text, that need formatting, like code, needs a control to render it correctly.

    I could attempt to render this and demonstrate waht is happening but it would be a futile battle.  The page cannot and will not display formatted fixed wifth font text correctly.  It is a fundamental issue of HTML. HTML5 now has more facilities to assist with this but befero 5 we need to give the text help.


    ¯\_(ツ)_/¯,


    • Edited by jrv Monday, July 16, 2012 8:33 PM
    Monday, July 16, 2012 8:29 PM
  • Can you try pasting it into a Code Block and show if the results are any different? The Code Block feature was created to address HTML translation concerns (and to track use of code snippets).

    But code blocks are displayed in a proportional font, which is very difficult to understand.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
    Monday, July 16, 2012 10:09 PM
  • Testing this...

    Volume in drive C has no label.

     Volume Serial Number is 0CC7-B200

     Directory of C:\Program Files\Windows Resource Kits\Tools

    [.]                              [..]                             acctinfo.dll

    adlb.exe                         admx.msi                         atmarp.exe

    atmlane.exe                      autoexnt.exe                     cdburn.exe

    cepsetup.exe                     checkrepl.vbs                    chklnks.exe

    chknic.exe                       clean.vbs                        cleanspl.exe

    clearmem.exe                     clone.vbs                        clusdiag.msi

    clusfileport.dll                 clusfileport.inf                 clusfileport_win2000.inf

    clusterrecovery.chm              clusterrecovery.exe              cmdhere.inf

    cmgetcer.dll                     cmgetcer.txt                     comctl32.ocx

    In a code block...

    Volume in drive C has no label.
     Volume Serial Number is 0CC7-B200
     Directory of C:\Program Files\Windows Resource Kits\Tools
    [.]                              [..]                             acctinfo.dll
    adlb.exe                         admx.msi                         atmarp.exe
    atmlane.exe                      autoexnt.exe                     cdburn.exe
    cepsetup.exe                     checkrepl.vbs                    chklnks.exe
    chknic.exe                       clean.vbs                        cleanspl.exe
    clearmem.exe                     clone.vbs                        clusdiag.msi
    clusfileport.dll                 clusfileport.inf                 clusfileport_win2000.inf
    clusterrecovery.chm              clusterrecovery.exe              cmdhere.inf
    cmgetcer.dll                     cmgetcer.txt                     comctl32.ocx


    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)

    Tuesday, July 17, 2012 1:05 AM
    Owner
  • Ed - both copies are badly broken when I view them.  How they look depends very much on which browser you use.  I suspect that under HTML 5 they look great.  That would be Focfire, IE10 on Windows 8, OPera nad a few others.

    On IE8 both look terrible.


    ¯\_(ツ)_/¯

    Tuesday, July 17, 2012 2:06 AM
  • In Firefox 13, the first suffers from extra line breaks, and the code block suffers from a proportional font.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
    Tuesday, July 17, 2012 9:12 AM
  • I will not use the "Insert Code Block" feature as long as it uses a proportional font. I consider this a major flaw. It makes some code hard to read and can cause errors. Fortunately, I have my own solution using the "Insert HTML" feature where I format and colorize my own code, but this is unreasonable for others. I estimate that 46% of my answers are "answers with code", so it was worth it for me to find another solution.

    I should also note, when you use the "Insert Code Block" feature the code looks fine (with a fixed width font but no color) until you click "Submit" to post the reply. The code gets messed up after you "Submit".


    Richard Mueller - MVP Directory Services


    Wednesday, July 18, 2012 4:52 PM
    Moderator