Answered by:
Are we experiencing a new meltdown of the forums?.

Question
-
Today and since last night code colorization in POwerSHell and VBScript has taken another downturn. After the first single or double quote character the colorization becomes random. It is colorful but random.
This is reminicent of the issues a few months ago but even more obvious now.
See....
$watcher = New-Object System.IO.FileSystemWatcher $watcher.Path="e:\" $watcher.IncludeSubdirectories = $true $watcher.EnableRaisingEvents = $true $sb={write-host "Created: $($eventArgs.FullPath)" -fore green -back white} $created=Register-ObjectEvent $watcher 'Created' -Action $sb
So lets us (? good wording me mates ? - Arghh!)
$watcher = New-Object System.IO.FileSystemWatcher $watcher.Path=e:\ $watcher.IncludeSubdirectories = $true $watcher.EnableRaisingEvents = $true $sb={write-host "Created: $($eventArgs.FullPath)" -fore green -back white} $created=Register-ObjectEvent $watcher 'Created' -Action $sb
See - if we remove the quotes then it works pretty good.
I suggest we ask the PowerShell Team to remove quotes from PowerShell. This might make the forum much easier to fix.
After all it took the PowerShell Team a long 6+ months to create PowerShell. It has only taken a much larger team of consultants and noobs a year to completely trash the forums. Keep up the good work guys. Microsoft is proud of you
Seriously. What is happening that you cannot fix this. I remember one offshore team I workied with. It turned out that they couldnot fix as per request becuse they didi not understand the exact definition of a half dozen words having to do with web forms design. They had not been updated on those definitions.
I am just poking at you builders. It has been over a year that these things have been broken from IE8/9 and XP/08/7. I just don't understand. Does this work for anybody on any browser? Is microsft using Chrome to build the forums. Maybe I will switch to Chrome and see if it works better.
Everybody have a great weekend. Come back from your holidays with a new view of how to fix this amazing disaster.
¯\_(ツ)_/¯
- Edited by jrv Friday, July 13, 2012 11:50 PM
Answers
-
Ed - right - sorry
This thread was about a new meltdown but maybe it should just be about colorization. The corrupted thread issue is ongoing but happens less compared to 6 months ago.
The colorization and display of text would be worth rattling cages over. We - many - have been pointing this out for nearly a year. I would think that someone would up the priority. It is a pain and does create irritation for many. I generally work around it but would really like to not have to do that.
I think you need two bugs:
1. colorization errors when mixed single and double quotes in same script.
2. Need for non-proportional font to disaplay tables. (can be added to colorizer easily).If the corrupt thread persists I will open a new thread or, hopefully, someone else will.
¯\_(ツ)_/¯
- Proposed as answer by Ed Price - MSFTMicrosoft employee Tuesday, July 17, 2012 8:34 PM
- Marked as answer by Ed Price - MSFTMicrosoft employee Tuesday, July 24, 2012 5:39 PM
All replies
-
And again here is teh trashed dispaly of the code and data from a PowerSHell display. No fixed width font. The propertional fonts used lake readin the sample very hard.
http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/d93cb9a9-32ac-4494-ae47-9269092a10d2/
This is a live link. It is a thread that I just posted to - copy and paste from PowerShell CLI.
¯\_(ツ)_/¯
-
$watcher = New-Object System.IO.FileSystemWatcher $watcher.Path='e:\' $watcher.IncludeSubdirectories = $true $watcher.EnableRaisingEvents = $true $sb={write-host "Created: $($eventArgs.FullPath)" -fore green -back white} $created=Register-ObjectEvent $watcher 'Created' -Action $sb
testing - switched to single quotes on the second line...Al Dunbar
-
$watcher = New-Object System.IO.FileSystemWatcher $watcher.Path='e:\' $watcher.IncludeSubdirectories = $true $watcher.EnableRaisingEvents = $true $sb={write-host "Created: $($eventArgs.FullPath)" -fore green -back white} $created=Register-ObjectEvent $watcher 'Created' -Action $sb
testing - switched to single quotes on the second line...
Al Dunbar
Fail, but I begin to see a pattern - it now flips out of green when it encounters another single quoted string, but still out of phase. I wonder if the problem is with the quote being followed immediately by a new line:
$watcher = New-Object System.IO.FileSystemWatcher $watcher.Path="e:\" # fixed? $watcher.IncludeSubdirectories = $true $watcher.EnableRaisingEvents = $true $sb={write-host "Created: $($eventArgs.FullPath)" -fore green -back white} $created=Register-ObjectEvent $watcher 'Created' -Action $sb
Al Dunbar
-
-
Al - I have looked at this for a long time.
Two things hqppen that are, I believe, mutually interrelated:
1. Quotes fail under many odd circumstances.
2. Formatting fails for text that is not recognized as code and is subsequently treated as normal 'page' text. (By that I mean that a page style is applied which is a propertional font.)In the past when I have worked with highlighters they were driven by syntax maps, this seems to work almost flawlessly. The public domain colorizer used here seems to make it up as it goes along and it fails to often.
Perhaps we should switch to a commercial colorizer.
Just my simple view.
¯\_(ツ)_/¯
-
Here is another thread that just became corrupted. There is a post that I created that is broken and cannot be edited or deleted. After creation there was a page error and the post did not show. After re-entering the post the old post is displayed but is inaccessible.
¯\_(ツ)_/¯
-
So many topics! Which one is this thread about? For example, I can file a ticket to try to get that corrupt thread fixed... which answers this question, right?
Regarding the colorization in code issue... the team is aware and has made regular passes on improving the code box. I believe a vendor owns the feature and regularly improves it.
Thanks!
Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)
- Proposed as answer by Ed Price - MSFTMicrosoft employee Tuesday, July 17, 2012 8:16 PM
- Unproposed as answer by Ed Price - MSFTMicrosoft employee Tuesday, July 17, 2012 8:36 PM
-
Ed - right - sorry
This thread was about a new meltdown but maybe it should just be about colorization. The corrupted thread issue is ongoing but happens less compared to 6 months ago.
The colorization and display of text would be worth rattling cages over. We - many - have been pointing this out for nearly a year. I would think that someone would up the priority. It is a pain and does create irritation for many. I generally work around it but would really like to not have to do that.
I think you need two bugs:
1. colorization errors when mixed single and double quotes in same script.
2. Need for non-proportional font to disaplay tables. (can be added to colorizer easily).If the corrupt thread persists I will open a new thread or, hopefully, someone else will.
¯\_(ツ)_/¯
- Proposed as answer by Ed Price - MSFTMicrosoft employee Tuesday, July 17, 2012 8:34 PM
- Marked as answer by Ed Price - MSFTMicrosoft employee Tuesday, July 24, 2012 5:39 PM
-
Your response is actually an answer to at least one of the issues, so I'm proposing it.
I'm following up on the corruption now. New thread or same thread. But either way less piggybacking would make it easier to track (like bugs). So I appreciate it.
Colorization... Years? I swear the update from earlier this year was a huge improvement for me (Feb timeframe). I mean, I was going from zero colors in a lot of scenarios to almost always getting some color. I'll follow up with the team and see if there are any future updates planned for the code block feature.
Oh and thanks for the civil response. I know it's easy to get caught up in frustration when something is difficult to use. But the truth is that it's not as simple as some builders not doing their job. The forum team licensed a feature from a vendor (code block, after looking around) which fits into a larger application (the Editor), which then fits into a larger platform (the Forum platform), which then communicates with Live ID, many other tools/platforms, and somehow through it all, the Code block feature has to somehow faithfully translate pasted code from thousands of different sources. It's impressive to me that it works as well as it does. For example, the feature (Code Block) and app (Editor) might even lose features and not work according to spec once placed in the platform (Forum). So there are many levels of translation and compatibility going on. And the "builders" are completely different since the feature, app, and platform are run by different companies.
Thanks!
Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)
- Edited by Ed Price - MSFTMicrosoft employee Tuesday, July 17, 2012 8:54 PM
-
Ed - I agree - colorization is much better. It is liveable.
Fprmating of text has many, many issues. The corrupt threads need to be looked at and not jsut fixed.
The HTML re-write seems to spit junk into the HTML periodically which either trashes the session of corrupts the thread.
If I look at teh HTML when the cursor gets stuck it has lost the endinf <p></p> pair and the cursor will not move beyond the end of the last line typed.
That is just a sample of what happens. It can get much uglier.
I don't want to add this here except that you mentioned addressing the corrupt thread issue. I really don't think fixing it is important. What is important is to use it to get clues as to why this keeps happening.
As above I will drop it now but will open a new question if it keeps happening. I only posted that one because I hoped someone would want to look at it.
¯\_(ツ)_/¯
-
Corrupt threads... We've been looking at it heavily. A feature was added to make it faster for admins to fix it. I'm digging deeper into what that means, since our PM running forums (Brent) moved on. I'm currently working with our vendor support group on this.
The core issue is always when someone pastes in some formatted text from some source. The Editor cannot faithfully translate it. We're digging deeper to identify the what (what content corrupts it) and why.
Thanks!
Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)
-
UPDATE: I sent the request (to our vendor support team) to fix the thread (http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/6ea3bad0-e84f-49a7-8e34-64c09a765e54#a6bb0eec-572c-45f1-b96e-682cc7710e87). Thanks!
Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)
- Edited by Ed Price - MSFTMicrosoft employee Tuesday, July 17, 2012 9:00 PM
-
-
From what I have seen the pasting of anything and in aprticular formatted HTML or code will trigger a corruption. I do not thisnk the corruption is caused by what is pasted.
Here is what I see repeatedly. If I try and bold some text on a line like I just did it may work but it may just clobebr the line. Whenever it clobbers the line there is a high chance that the lower left hand side of my IE 'status bar' will say 'Error' with its little yello flag. The error is always index out of range and a number the billions. This can eventually lead toe teh thread bring unsavable and rarely corrupted whaen saved.
I found that by opeing up the HTML editor and hitting update that this would be fixed about half of the time. I have also been able to fix it by adding <p> to the end of the HTML and then doing an update.
The other thing that becomes obvious is that teh page can get corrupted just sitting with no activity. If I start a post and get a call or an alert to an issue I may leave the screen for 15 minutes. On returning I notice that the 'error' light is on. Other times I can start an edit then stop to get some coffe - one minute - and return jsut intime to see the error appear. It appears that the page has some ajax or soem add call home code that casues the page to change. WHen this happns the page can become corrupt. If I refresh the page - after copying my reply - the page will go back to normal. If I am able to sabe the page ti may end up corrupted or the text saved may not be what was last displayed.
I am certian somethihng is disrupting the page. The editor has to be a local JavaScript library so it canot be responsible for all things I see.
I have had issues with editors that we built in the past. The rogue inex or position counter issue is an old and very commom problem. It is also a proble in a multithreaded system when one bit of code resets a poitner and anpother assumes it is set. This can slo be just an arithmetic mistake in one subroutine.
Nearly every first time I use the 'Bold' function the the text become broken. Ctl-Z retruns back to the original and hitting [B] again correctly bolds the selected text. This is clearly a pointer issue. I cannot verify if it happns on all version of IE. It has on IE8 and IE9 but I have seemn it most on IE8 as that is my most used system. (I mostly remote so I haven't upgraded this old beast).
Maybe this will be helpful and maybe not. I throw it out in case someone might recognize some part of the symptom.
Maybe I will load up Firefox and see if that has similar issues.
¯\_(ツ)_/¯
- Edited by jrv Tuesday, July 17, 2012 9:44 PM
-
I don't use the "Insert Code Block" feature because it displays code in a proportional font. This makes some code difficult to read. However, I notice that the colorization rules seemed to have changed. In the past I thought comments were in green and quoted strings red (PowerShell and VB), but now this is reversed.
Richard Mueller - MVP Directory Services
-
Actually I agree more with Ed. The colorization works very well with a couple of relly bad exceptions.
1. Extra line breaks are removed.
2. Use of single quotes breaks the colorizer.Both of these issues are, in my opinion, bugs.
#some PosH code with tnree blank lines Get-Process Get-Service # end of code
'VBSCript too Dim x ' three blank lines x=1 ' two blank lines x=2
Notice that all of the blank lines are now gone
The colorizer is more subtle and seems to depend on text above on the page. I could not force a mistake here.
¯\_(ツ)_/¯
- Edited by jrv Wednesday, July 18, 2012 5:25 PM
-
-
The comments are supposed to be green, not red. It's a bit annoying.
For every expert, there is an equal and opposite expert. - Becker's Law
My blogBut Naomi - the comments are green here:
$watcher = New-Object System.IO.FileSystemWatcher $watcher.Path="e:\" # fixed? $watcher.IncludeSubdirectories = $true $watcher.EnableRaisingEvents = $true $sb={write-host "Created: $($eventArgs.FullPath)" -fore green -back white} $created=Register-ObjectEvent $watcher 'Created' -Action $sb
.... and so is everything else after the first quote. An I am now stuck on thise single line and cannot use enter to start a new line. The bottom of teh page says "Error on page"
I had to copy then refresh the page and paste the copied response. The error is gone. It will likely come back if I attempt to add a new code block.
¯\_(ツ)_/¯
-
This looks like a mess. Is is Powershell script? I am not too good with it.
We have similar problems with T-SQL scripts although a bit less, my minor point was that in most of the code samples here (for majority of the programming languages) the colors for the comments and strings are reversed.
For every expert, there is an equal and opposite expert. - Becker's Law
My blog -
Naomi - that is my point. Except when they break the strings are usually the correct color.
watcher = New-Object System.IO.FileSystemWatcher $watcher.IncludeSubdirectories = $true $watcher.EnableRaisingEvents = $true $sb={write-host "Created: $x" -fore green -back white} $created=Register-ObjectEvent $watcher 'Created' -Action $sb
Note that after a minor edit the comments and strings are no green. They were always greeen but so was the code. This is a parsing issue. Parsers that parse against formal syntax maps almost never have this issue.
INSERT INTO table1(Col1,Col2) Values('val11','val2') SELECT a,b,c,d,e,f FROM [TABLE ONE] WHERE a = 'ok' AND b = 'ok'
¯\_(ツ)_/¯
- Edited by jrv Wednesday, July 18, 2012 8:29 PM
-
-
I believe this PowerShell script has the wrong colors (at least compared to a year ago):
$Users = Get-ADUser -Filter * -Properties memberOf | Select sAMAccountName, memberOf ForEach ($User In $Users) { # Process each user. $Line = $($User.sAMAccountName) ForEach ($GroupDN In $User.memberOf) { # Process each group. $Group = $(Get-ADGroup $GroupDN | Select sAMAccountName).sAMAccountName $Line = "$Line,$Group" } # Output for user. $Line }
The same is true for VBScript (VB.NET). For example:
' Bind to group in domain A. Set objGroupA = GetObject("LDAP://cn=GroupA,ou=West,dc=DomainA,dc=com") ' Bind to group in domain B. Set objGroupB = GetObject("LDAP://cn=GroupB,ou=East,dc=DomainB,dc=com") ' Enumerate members of group in domain A. For Each objMember In objGroupA.Members ' Check if already a member of group in domain B. If (objGroupB.IsMember(objMember.ADsPath) = False) Then ' Add member to group in domain B. objGroupB.Add(objMember.ADsPath) End If Next
As usual, you don't see the problems until after you click "Submit" to submit your reply.
Richard Mueller - MVP Directory Services
-
I should have posted the same code the way I normally do, with the colorization I thought was standard a year ago. Notice also that my versions (using the "Insert HTML" feature) use a fixed width font. Here is the same PowerShell script as above, posted using "Insert HTML":
$Users = Get-ADUser -Filter * -Properties memberOf | Select sAMAccountName, memberOf
ForEach ($User In $Users)
{
# Process each user.
$Line = $($User.sAMAccountName)
ForEach ($GroupDN In $User.memberOf)
{
# Process each group.
$Group = $(Get-ADGroup $GroupDN | Select sAMAccountName).sAMAccountName
$Line = "$Line,$Group"
}
# Output for user.
$Line
}
-----
And here is the same VBScript code as above, posted using "Insert HTML":
' Bind to group in domain A.
Set objGroupA = GetObject("LDAP://cn=GroupA,ou=West,dc=DomainA,dc=com")
' Bind to group in domain B.
Set objGroupB = GetObject("LDAP://cn=GroupB,ou=East,dc=DomainB,dc=com")
' Enumerate members of group in domain A.
For Each objMember In objGroupA.Members
' Check if already a member of group in domain B.
If (objGroupB.IsMember(objMember.ADsPath) = False) Then
' Add member to group in domain B.
objGroupB.Add(objMember.ADsPath)
End If
Next
-----
Richard Mueller - MVP Directory Services
-
I am not saying the colors are pretty or what yo expect. They are consistenst and have been that way for most of a year now.
THE BELOW IS AN IMAGE (JPG)
The above is green text. in all languages the strings are green. Comments are in green which is fairly normal.
I really don't care that much about the colors. I would just like to see them work consistently so code would look readable.
The image is OK with me if it would not break when I add a comment of have more that 6 or 7 lines with strings.
Richard. What you pasted I can do too. I have three or four colorizer libraries that I have used over time. All work well and allow me to copy the HTML and style sheets.
Its too much trouble.
¯\_(ツ)_/¯
- Edited by jrv Wednesday, July 18, 2012 8:50 PM
-
Naomi - here is what it looks like in my editor:
It is different but I do not care. Consistency is all that matters to the eye.
Most editors use red for strings. The forum used red and many complained that it was backwards. Nonsense! It is whatever works. In all of my editors I can change the colors to be anything I want. I tens to leave them as tehy are.
By the way. Teh font that is used by most editors works better but is not available in all browsers. I have not seen a good web font for code yet.
¯\_(ツ)_/¯
-
If your colorization script or Richard's colorization script works good and for most of the languages and you're willing to share it, why not share it and let the developers of this site utilize them? I know that we can change colors of the strings and comments in the editor, but I always leave the defaults and I want to see comments green and strings red, not vs. versa. And no problems like you showed in your samples.
May be Ed can coordinate this and you offer your script and see what comes out of this idea.
For every expert, there is an equal and opposite expert. - Becker's Law
My blog -
-
I posted my scripts on my web site here:
http://www.rlmueller.net/ConvertCodeToHTML.htm
However, they are VBScript programs. Also, while they work great for me, they assume that keywords and operators are space delimited, but this is not required in PowerShell. The PsToHtml.vbs program may not colorize other people's code as they expect (although I cannot find an example now).
Richard Mueller - MVP Directory Services