none
New forum failures. RRS feed

Answers

  • UPDATE: This has been logged as bug 79798. No ETA.

    Thanks!


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

    • Marked as answer by jrv Friday, September 14, 2012 3:46 AM
    Friday, September 14, 2012 2:49 AM
    Owner
  • UPDATE: An additional bug has been opened that focuses on just the color issues: Bug #80667. No ETA for a fix.

    Thanks!


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

    • Marked as answer by jrv Monday, September 24, 2012 7:53 PM
    Monday, September 24, 2012 7:38 PM
    Owner

All replies

  • Now - without even closing the browser the color is back but the older posts are still colorless.

    I suspect that this and other issues are problems with the distribution servers.


    ¯\_(ツ)_/¯

    Wednesday, September 12, 2012 7:14 PM
  • Here is the failing HTML that was injected when PowerSHell formatting was selected:

    <pre class="prettyprint">&lt;#
     import Autocorrect List into Word 2010.ps1
        
        Defaults to current PowerShell folder and default filename.
        You can create a file using this:
        
        $word.AutoCorrect.Entries|
             select name,value,RichText|
      
             export-csv autocorrect.csv -notype
    #&gt;
    [CmdLetBinding()]
    Param(
        $file='autocorrect.csv',
        $path=$pwd
    )
    $filepath=&quot;$path\$file&quot;
    $filepath
    if(-not (Test-Path $filepath) ){
        Write-Host 'File not found' -ForegroundColor red
        return
    }
    # file contains twio columns - name and value both are stings.
    $csv = Import-Csv -Path $filepath
    Write-Host 'Auto.csv File found. Processing...' -ForegroundColor green
    $word = New-Object -ComObject word.application
    Foreach($entry in $word.AutoCorrect.entries){
        Try{
            if($entry.RichText){
                $word.AutoCorrect.Entries.AddRichText($entry.Name, $entry.Value)
            }else{
                $word.AutoCorrect.Entries.Add($entry.Name, $entry.Value)
            }
        }
        Catch{
            Write-Error ('Failed to add:' &#43; $entry.Name)
        }
    }
    Write-Host 'Autocorrect list entries added'  -ForegroundColor green
    $word.Quit()
    $word = $null
    [gc]::collect()
    [gc]::WaitForPendingFinalizers()</pre>

    Note that even this is not colorized correctly.

    It also has a <pre - "prettyprint" that seems ambiguous.


    ¯\_(ツ)_/¯


    • Edited by jrv Wednesday, September 12, 2012 7:21 PM
    Wednesday, September 12, 2012 7:20 PM
  • I think the HTML is the same as it has been for awhile now, using class prettyprint. Other PowerShell code seems to be colorized as before (when I test in the TechNet Sandbox). I think your example fooled the code completely.


    Richard Mueller - MVP Directory Services

    Wednesday, September 12, 2012 7:51 PM
    Moderator
  • I think the HTML is the same as it has been for awhile now, using class prettyprint. Other PowerShell code seems to be colorized as before (when I test in the TechNet Sandbox). I think your example fooled the code completely.


    Richard Mueller - MVP Directory Services

    The issue is that the OP posted colorized code from another tool.  This appears to have broken the style renderings.  This indicates that the style sheets used to colorize the code are not designed correctly as they should be removing all inheritance before they are applied to the "prettyprint" <pre>

    This happens fairly often along with other things that make it hard to use the code blocks successfully.

    If yu go to the link I posted you will see that all code posted after a point except for the OPs colorized code is without color.  You can use the code block and post some code it it will happen again.

    This fails on both IE8 and IE9.  I have not tested on IE10 or chrome etc.


    ¯\_(ツ)_/¯

    Wednesday, September 12, 2012 10:01 PM
  • Here is the difference.

    When the style breaks we get one <pre setting and when it is good we gat another/

    Here is a good Pre tag:

    <pre class="prettyprint" style="">Option Explicit

    Notice the style=""

    The broken style is missing that.  Whenever that is mising the style is not applied correctly or at all.

    I suspect this is a problem with variations in the distribution servers.


    ¯\_(ツ)_/¯

    Wednesday, September 12, 2012 10:06 PM
  • Can someone else verify that we lose all code color in all brandings?

    Thanks!


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

    Thursday, September 13, 2012 12:03 AM
    Owner
  • This is a test
    <embed>a test</embed>


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

    Thursday, September 13, 2012 12:04 AM
    Owner
  • Test in MSDN:

    <html>test</html>
    <a href=test>Well the first line worked well.</a>
    Yeah that line was good too. </b> 
    <b>Test</b>


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

    Thursday, September 13, 2012 12:06 AM
    Owner
  • UPDATE: I submitted a bug request.

    Thanks!


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

    Thursday, September 13, 2012 12:09 AM
    Owner
  • UPDATE: I submitted a bug request.

    Thanks!


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

    It seems to only happen when someone pastes colorized code from an external tool.

    I posted a link to the thread that does it everytime but the link seems to have disappeared.

    Here is the link again.  All of my posts have no colorizations.  I suspect you can also create a post and paste some POwerSHell code into the code box and see if it still does that.  I have two posts there that both failed.

    http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/d22dba05-27e0-4256-8d7c-e176e8a8b3c3#b712d36b-c8d5-4f99-b11a-4bfc78f71b33

    Here is a new test post here:

    <#
     import Autocorrect List into Word 2010.ps1
        
        Defaults to current PowerShell folder and default filename.
        You can create a file using this:
        
        $word.AutoCorrect.Entries|
             select name,value,RichText|
      
             export-csv autocorrect.csv -notype
    #>
    [CmdLetBinding()]
    Param(
        $file='autocorrect.csv',
        $path=$pwd
    )
    $filepath="$path\$file"
    $filepath
    if(-not (Test-Path $filepath) ){
        Write-Host 'File not found' -ForegroundColor red
        return
    }
    # file contains twio columns - name and value both are stings.
    $csv = Import-Csv -Path $filepath
    Write-Host 'Auto.csv File found. Processing...' -ForegroundColor green
    $word = New-Object -ComObject word.application
    Foreach($entry in $word.AutoCorrect.entries){
        Try{
            if($entry.RichText){
                $word.AutoCorrect.Entries.AddRichText($entry.Name, $entry.Value)
            }else{
                $word.AutoCorrect.Entries.Add($entry.Name, $entry.Value)
            }
        }
        Catch{
            Write-Error ('Failed to add:' + $entry.Name)
        }
    }
    Write-Host 'Autocorrect list entries added'  -ForegroundColor green
    $word.Quit()
    $word = $null
    [gc]::collect()
    [gc]::WaitForPendingFinalizers()


    Hah - I see it:

    This should work:

    [CmdLetBinding()]
    Param(
        $file='autocorrect.csv',
        $path=$pwd
    )
    $filepath="$path\$file"
    $filepath
    if(-not (Test-Path $filepath) ){
        Write-Host 'File not found' -ForegroundColor red
        return
    }
    # file contains twio columns - name and value both are stings.
    $csv = Import-Csv -Path $filepath
    Write-Host 'Auto.csv File found. Processing...' -ForegroundColor green
    $word = New-Object -ComObject word.application
    Foreach($entry in $word.AutoCorrect.entries){
        Try{
            if($entry.RichText){
                $word.AutoCorrect.Entries.AddRichText($entry.Name, $entry.Value)
            }else{
                $word.AutoCorrect.Entries.Add($entry.Name, $entry.Value)
            }
        }
        Catch{
            Write-Error ('Failed to add:' + $entry.Name)
        }
    }
    Write-Host 'Autocorrect list entries added'  -ForegroundColor green
    $word.Quit()
    $word = $null
    [gc]::collect()
    [gc]::WaitForPendingFinalizers()

    The problem is

    <#

    #>

    They are not parsed in the colorizer and once inserted at5 the beginning  of script the whole block fails to colorize.

    Proof:

    #
    #
    #
    <#
     import Autocorrect List into Word 2010.ps1
        
        Defaults to current PowerShell folder and default filename.
        You can create a file using this:
        
        $word.AutoCorrect.Entries|
             select name,value,RichText|
      
             export-csv autocorrect.csv -notype
    #>
    [CmdLetBinding()]
    Param(
        $file='autocorrect.csv',
        $path=$pwd
    )
    $filepath="$path\$file"
    $filepath
    if(-not (Test-Path $filepath) ){
        Write-Host 'File not found' -ForegroundColor red
        return
    }
    # file contains twio columns - name and value both are stings.
    $csv = Import-Csv -Path $filepath
    Write-Host 'Auto.csv File found. Processing...' -ForegroundColor green
    $word = New-Object -ComObject word.application
    Foreach($entry in $word.AutoCorrect.entries){
        Try{
            if($entry.RichText){
                $word.AutoCorrect.Entries.AddRichText($entry.Name, $entry.Value)
            }else{
                $word.AutoCorrect.Entries.Add($entry.Name, $entry.Value)
            }
        }
        Catch{
            Write-Error ('Failed to add:' + $entry.Name)
        }
    }
    Write-Host 'Autocorrect list entries added'  -ForegroundColor green
    $word.Quit()
    $word = $null
    [gc]::collect()
    [gc]::WaitForPendingFinalizers()

    By adding a couple of # before the <# we get it past the colorizer bugs.

    This is part of all of the edit issues with posisiton and insertion including the bold conten deleteion issues.  Thisis due to bad pointer arithmatic.  Remember that mesages in Windows are not guaranteed to be delivered in the same order that they were sent.  If we send a message that adjust a number another message can undo that adjustment.  In a browser we have no way to control this.  That is also why I and others keep getting jscript errors with "pointer out of bounds" messages which I have posted about here many times.

    So start any code block with <# and it will likely fail to colorize correctly.


    ¯\_(ツ)_/¯


    • Edited by jrv Thursday, September 13, 2012 1:54 AM
    Thursday, September 13, 2012 1:51 AM
  • I just confirmed in the TechNet sandbox. PowerShell code (using Insert Code Block) that begins with a multi-line comment (anything between the <# and  #> delimiters) has no colorization at all.


    Richard Mueller - MVP Directory Services

    Thursday, September 13, 2012 2:14 AM
    Moderator
  • I just confirmed in the TechNet sandbox. PowerShell code (using Insert Code Block) that begins with a multi-line comment (anything between the <# and  #> delimiters) has no colorization at all.


    Richard Mueller - MVP Directory Services

    Thanks Richard.  I am pretty sure that always adding one extra comment to the beginning will prevent that. The code block script is looking at the first character as it it is the begining of  tag.  If that character is not the first character the issue doesn't happen.

    . 
    <#
     import Autocorrect List into Word 2010.ps1
        
        Defaults to current PowerShell folder and default filename.
        You can create a file using this:
        
        $word.AutoCorrect.Entries|
             select name,value,RichText|
      
             export-csv autocorrect.csv -notype
    #>
    [CmdLetBinding()]
    Param(
        $file='autocorrect.csv',
        $path=$pwd
    )
    $filepath="$path\$file"
    $filepath
    if(-not (Test-Path $filepath) ){
        Write-Host 'File not found' -ForegroundColor red
        return
    }

    This time I added a dot first and it bypasses teh bug.  A space won't work.  Only a printable character works so the erro happens ater eth HTML conversion pass which is what strips out all of teh foramtting and removes blank lines.  That needs to be fixed too.


    ¯\_(ツ)_/¯

    Thursday, September 13, 2012 2:28 AM
  • Test with Insert Code Block:
    Source Code from here: http://msdn.microsoft.com/en-us/library/ebca9ah3.aspx

    1 Just hit the COPY javascript upper right to copy code and choose the Language C# when use Code Block.

    abstract class ShapesClass
    {
        abstract public int Area();
    }
    class Square : ShapesClass
    {
        int side = 0;
        public Square(int n)
        {
            side = n;
        }
        // Area method is required to avoid 
        // a compile-time error. 
        public override int Area()
        {
            return side * side;
        }
        static void Main() 
        {
            Square sq = new Square(12);
            Console.WriteLine("Area of the square = {0}", sq.Area());
        }
        interface I
        {
            void M();
        }
        abstract class C : I
        {
            public abstract void M();
        }
    }
    // Output: Area of the square = 144

    2 Use Ctrl + C to copy Code then insert with Code Block:

    abstract class ShapesClass
    {
        abstract public int Area();
    }
    class Square : ShapesClass
    {
        int side = 0;
        public Square(int n)
        {
            side = n;
        }
        // Area method is required to avoid 
        // a compile-time error. 
        public override int Area()
        {
            return side * side;
        }
        static void Main() 
        {
            Square sq = new Square(12);
            Console.WriteLine("Area of the square = {0}", sq.Area());
        }
        interface I
        {
            void M();
        }
        abstract class C : I
        {
            public abstract void M();
        }
    }
    // Output: Area of the square = 144


    Pan Zhang Customer Support EPX Service Engineering Support Team


    Then Ed or Irv, can you point out if my repro steps are aligning with yours? Seem it doesn't disappoint me.
    • Edited by Pan Zhang Thursday, September 13, 2012 2:35 AM Confirm the result with OPs
    Thursday, September 13, 2012 2:29 AM
  • Hi Richard and Irv,

    So the problem only happens when you choose the PowerShell in Code Block, other languages don't act as the scenario above?

    Can you confirm? Thanks


    Pan Zhang Customer Support EPX Service Engineering Support Team

    Thursday, September 13, 2012 3:30 AM
  • Hi Richard and Irv,

    So the problem only happens when you choose the PowerShell in Code Block, other languages don't act as the scenario above?

    Can you confirm? Thanks


    Pan Zhang Customer Support EPX Service Engineering Support Team


    <#
    abstract class ShapesClass
    {
        abstract public int Area();
    }
    class Square : ShapesClass
    {
        int side = 0;
        public Square(int n)
        {
            side = n;
        }
        // Area method is required to avoid 
        // a compile-time error. 
        public override int Area()
        {
            return side * side;
        }
        static void Main() 
        {
            Square sq = new Square(12);
            Console.WriteLine("Area of the square = {0}", sq.Area());
        }
        interface I
        {
            void M();
        }
        abstract class C : I
        {
            public abstract void M();
        }
    }

    It will happen with any language as you can see above.

    The good this is that few langauges use that constuct so C# would sue /* instead of <#.

    The issue is that teh counters are including a leading < into teh HTML when it belongs inside the <pre> tags.

    At least 50% of the issues with the forum editors are the bad counters.  A failure to fix those may make any other fixes incalid or more difficult.  Fixiong them after other issues have been addressed may well undo the other fixes. It is hard to tell but this is the kind of bug that should be fixed first.


    ¯\_(ツ)_/¯

    Thursday, September 13, 2012 3:39 AM
  • UPDATE: This has been logged as bug 79798. No ETA.

    Thanks!


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

    • Marked as answer by jrv Friday, September 14, 2012 3:46 AM
    Friday, September 14, 2012 2:49 AM
    Owner
  • UPDATE: This has been logged as bug 79798. No ETA.

    Thanks!


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

    Ed - thanks

    I hope this leads someone to the whole pointer problem.  Patsing code and highlighting or italicizing text is always a disaster.


    ¯\_(ツ)_/¯

    Friday, September 14, 2012 3:46 AM
  • UPDATE: An additional bug has been opened that focuses on just the color issues: Bug #80667. No ETA for a fix.

    Thanks!


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

    • Marked as answer by jrv Monday, September 24, 2012 7:53 PM
    Monday, September 24, 2012 7:38 PM
    Owner
  • Thanks Ed.  I hope they can find an answer to some of these things.  Maybe they will use the editors from the repository.

    Thanks for the update.


    ¯\_(ツ)_/¯

    Monday, September 24, 2012 7:53 PM