Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

Please fix the "Pretty Print" class in the forums and the article "Contribution Center" Expand / Collapse
Author
Message
Posted Saturday, February 4, 2012 2:29 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 12:23 PM
Points: 35,403, Visits: 31,965
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."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1246935
Posted Sunday, February 5, 2012 3:02 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 12:19 PM
Points: 31,214, Visits: 15,659
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
Post #1247035
Posted Sunday, February 5, 2012 3:15 PM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: 2 days ago @ 5:24 AM
Points: 588, Visits: 2,559

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
Post #1247038
Posted Sunday, February 5, 2012 6:57 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 12:23 PM
Points: 35,403, Visits: 31,965
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.

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."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1247058
Posted Sunday, February 5, 2012 7:04 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 12:23 PM
Points: 35,403, Visits: 31,965
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."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1247059
Posted Monday, February 6, 2012 8:17 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 12:19 PM
Points: 31,214, Visits: 15,659
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
Post #1247412
Posted Monday, February 6, 2012 4:18 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 12:23 PM
Points: 35,403, Visits: 31,965
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."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1247755
Posted Wednesday, February 8, 2012 11:09 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 12:23 PM
Points: 35,403, Visits: 31,965
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."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1249469
Posted Monday, February 13, 2012 10:31 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 12:23 PM
Points: 35,403, Visits: 31,965
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."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1251665
Posted Thursday, May 10, 2012 2:13 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 12:05 PM
Points: 20,753, Visits: 32,568
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?



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)
Post #1298183
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse