Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Please fix the "Pretty Print" class in the forums and the article "Contribution Center"


Please fix the "Pretty Print" class in the forums and the article "Contribution Center"

Author
Message
Jeff Moden
Jeff Moden
SSC-Forever
SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)

Group: General Forum Members
Points: 45147 Visits: 39923
One of the things I like the most about SQLServerCentral.com is how easy is usually is to post formatted code. It's come a long way but there are still some problems with the "Pretty Print" class code block both in the forums and the article "Contribution Center". I don't know if it's possible but it would be a wonderful thing if some of these minor problems could be repaired in the near future.

1. Neither preserves the color of comments when an apostrophe is present in the comment. Instead, it reads the apostrophe as a single quote and colors everything after that Red. For example…


WITH
cteSomeCTE AS
(--==== This is Jeff's 1st test comment
SELECT yadayada
FROM sometable
)--==== This Jeff's 2nd test comment
SELECT *
FROM cteSomeCTE
;



2. Observing the same example above, neither preserves comments when the comment is a trailing comment immediately after either a left or right parenthesis. The work around, of course, is to insert a space between the parenthesis and the first dash of the comment but most folks don't expect this.

3. Both use light gray coloring for some symbology which, at best, is difficult to read. See the NULL, parenthesis, and the mathematical operatior in the following.

 SELECT ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) + 1;



Further, some of the functions also appear in light gray (Left and Right below).

ABS()
SUBSTRING()
LEFT()
RIGHT()
CHARINDEX()
PATINDEX()
SIGN()
SUM()



4. In the "Contribution Center", by default, if a line is long enough to trigger the scroll bars, it also makes the code block window much too long. This can be (apparently) manually adjusted in the contribution center but only if the width of the window is small enough (it usually is) so that you're actually aware of the problem. This problem no longer appears on the forums.

5. During copy and paste operations from such a rendered code block, the code appears as a single line when pasted into SSMS. There was a time when this all worked perfectly and wonder if it can be brought back.

6. Occasionally, characters such as "<", ">", etc show up as their entitized value instead of being displayed correctly. (or course, it works correctly for me now... go figure).

 SELECT *
FROM sometable
WHERE A < B



As a sidebar, most of these problems where repaired in previous editions of the code blocks and the latest "upgrade" has resurrected these problems.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Wink

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Steve Jones
Steve Jones
SSC-Dedicated
SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)

Group: Administrators
Points: 36162 Visits: 18751
Noted, and passed to the publishing team.

1. I'm not sure how easy the first item is to fix, but we'll see. Definitely an issue.
2. Again, not sure, and not sure how many people do this. I know I drop comments on separate lines, but we'll note it.
3. agree. Gray is hard on these old eyes as well
4. Hadn't noticed, but I'll check
5. No idea here, but something to look at. Note that in Firefox 4, this isn't an issue.
6. Needs to be fixed for sure.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Phil Factor
Phil Factor
Right there with Babe
Right there with Babe (747 reputation)Right there with Babe (747 reputation)Right there with Babe (747 reputation)Right there with Babe (747 reputation)Right there with Babe (747 reputation)Right there with Babe (747 reputation)Right there with Babe (747 reputation)Right there with Babe (747 reputation)

Group: General Forum Members
Points: 747 Visits: 2937

WITH
cteSomeCTE AS
(--==== This is Jeff's 1st test comment
SELECT yadayada
  
FROM sometable
)--==== This Jeff's 2nd test comment
SELECT *
  
FROM cteSomeCTE


Well the poor old prettifier works with Jeff's code anyway!


Best wishes,

Phil Factor
Simple Talk
Jeff Moden
Jeff Moden
SSC-Forever
SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)

Group: General Forum Members
Points: 45147 Visits: 39923
Phil Factor (2/5/2012)

WITH
cteSomeCTE AS
(--==== This is Jeff's 1st test comment
SELECT yadayada
  
FROM sometable
)--==== This Jeff's 2nd test comment
SELECT *
  
FROM cteSomeCTE


Well the poor old prettifier works with Jeff's code anyway!


Heh... I just knew that would come up. :-D

If you look at my original code, there is a single leading space before each SELECT. The prettifier includes that space (as you can see if you quote your own post) but we all know what happens to leading spaces in HTML. They disappear. They need to be entitized as hard spaces as they have been everywhere else leading spaces occur. Not sure why this usually only happens with SELECT but it's been that way ever since I starting using that fine bit of code.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Wink

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Jeff Moden
Jeff Moden
SSC-Forever
SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)

Group: General Forum Members
Points: 45147 Visits: 39923
Steve Jones - SSC Editor (2/5/2012)
Noted, and passed to the publishing team.

1. I'm not sure how easy the first item is to fix, but we'll see. Definitely an issue.
2. Again, not sure, and not sure how many people do this. I know I drop comments on separate lines, but we'll note it.
3. agree. Gray is hard on these old eyes as well
4. Hadn't noticed, but I'll check
5. No idea here, but something to look at. Note that in Firefox 4, this isn't an issue.
6. Needs to be fixed for sure.


Thanks, Steve. On #5 for me (and maybe half the rest of the world), Firefox just isn't an option.

On #2, it probably only affects me because 80% of the people posting don't even use comments and the 20% that do almost never (there are a couple of exceptions) format their code the way I do. Since I'm aware of it and can work around it simply by lodging a space in right after the parenthesis, I'd rather see folks put their effort into #5 and #6.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Wink

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Steve Jones
Steve Jones
SSC-Dedicated
SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)

Group: Administrators
Points: 36162 Visits: 18751
OK, #5 seems to be fixed. Posting from IE8, and copy/paste to SSMS 2008R2 preserves line breaks for me.

In terms of #s 1 and 2, we have some ideas, and we'll test.

#3, SSMS uses the same color, so despite the fact I think it's hard to read, I don't think we want to change.

In terms of #4, this isn't clear to our staff. Can you elaborate?

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Jeff Moden
Jeff Moden
SSC-Forever
SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)

Group: General Forum Members
Points: 45147 Visits: 39923
Steve Jones - SSC Editor (2/6/2012)
OK, #5 seems to be fixed. Posting from IE8, and copy/paste to SSMS 2008R2 preserves line breaks for me.

In terms of #s 1 and 2, we have some ideas, and we'll test.

#3, SSMS uses the same color, so despite the fact I think it's hard to read, I don't think we want to change.

In terms of #4, this isn't clear to our staff. Can you elaborate?


Dang!!! the developers are Johnny on the spot! I'll test #5 and post a clarification on #4 tonight. Thanks Steve.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Wink

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Jeff Moden
Jeff Moden
SSC-Forever
SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)

Group: General Forum Members
Points: 45147 Visits: 39923
Tests for #5 are absolutely spot on for the fix. Great job! That makes life a whole lot easier on this side of the house! I can live with the rest. I still owe you some "pictures" on the problem of #4 and I apologize for not having it by now.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Wink

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Jeff Moden
Jeff Moden
SSC-Forever
SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)

Group: General Forum Members
Points: 45147 Visits: 39923
Man! I've got to say it again! Hat's off to the SSC Dev Team for fixing the code window length problem and the code window copy problem! It's made posting the joy that it once was! :-)

Now if you could just pin the "Forum Ettiquete" article to the "General" and "T-SQL" forums, maybe we could get the OPs to finally make our life easier to respond. ;-)

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Wink

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Lynn Pettis
Lynn Pettis
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24215 Visits: 37978
Jeff Moden (2/13/2012)
Man! I've got to say it again! Hat's off to the SSC Dev Team for fixing the code window length problem and the code window copy problem! It's made posting the joy that it once was! :-)

Now if you could just pin the "Forum Ettiquete" article to the "General" and "T-SQL" forums, maybe we could get the OPs to finally make our life easier to respond. ;-)


I Know this is late, but did you just see a rabbit go by? ;-)

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search