March 18, 2009 at 9:22 am
Lowell, good point. We should probably limit areas to 40-50 lines tops.
March 18, 2009 at 9:29 am
Since the formatting is active for historical code, you also have interesting effects where the 'code' wasn't t-sql, for example
http://www.sqlservercentral.com/Forums/FindPost661664.aspx
Or where I inserted 'font' tags in the code to produce a color effect, which of course, are now visible.
http://www.sqlservercentral.com/Forums/FindPost669471.aspx
Derek
March 18, 2009 at 9:35 am
How easy would it be to revert the [ code ][ /code ] tags to work as before and add a new set of [ tsql ][ /tsql ] tags?
Hence old usage wouldn't break and people could preview that new [ tsql ] sections were valid.
Derek
March 18, 2009 at 12:45 pm
I shall ask
There should be a [ code2 ] set of tags for XML as well.
March 18, 2009 at 1:07 pm
It doesn't seem to handle tab indents very well. The indents below are all over the place, even though they are all a single tab character.
I think it would be easier to read with a non-proportional font for the display, since that is usually the way we usually see it in a code editor.
select
*
from
Mytable
where
MyColumn1 in (1,2)
order by
MyColumn33
March 18, 2009 at 1:16 pm
Michael Valentine Jones (3/18/2009)
It doesn't seem to handle tab indents very well. The indents below are all over the place, even though they are all a single tab character.I think it would be easier to read with a non-proportional font for the display, since that is usually the way we usually see it in a code editor.
select
*
from
Mytable
where
MyColumn1 in (1,2)
order by
MyColumn33
Wait, does this mean that you haven't been converted to the "set the tab to insert spaces" camp? I just recently converted to the tab to spaces camp, albeit a little reluctantly, but it does tend to work better in these types of situations.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
March 18, 2009 at 2:16 pm
Won't make the difference in a proportionate font, Jack.
If you copy-and-paste the newly formatted code from the forums into an editor, you'll find that the tabs have been replaced with spaces already. Because of that, and because it's a proportional font, it ends up with different leading spacing.
It's been a problem for typesetters ever since computerized typesetting was first created.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
March 19, 2009 at 5:38 am
I presume the code for this is separate from the Simple-Talk Prettifier, since the new formatter seems to be done in JavaScript (I was using Firefox yesterday and it kept complaining that a script (shCore.js?) was running slow).
That actually does a pretty good job of generating IfCodes and can handle T-SQL, VB, C# and Python (though not XML).
Perhaps it might be possible to tie that in and then set up the following:
[ code ] : do things the old way
[ code lang=xxx ] : format as if it was language xxx, where xxx can be TSQL (or just SQL), VB or CS (C#?) (or Python :-)). If xxx is unknown, revert to old format.
I agree with the suggestion that code needs to be in fixed font since that's what SSMS (and Query Analyzer as I recall) uses and the way most people edit it.
Derek
March 19, 2009 at 9:11 am
GSquared (3/18/2009)
Won't make the difference in a proportionate font, Jack.
True, but code should not be formatted in a proportional font, for this very reason.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
March 19, 2009 at 9:16 am
RBarryYoung (3/19/2009)
GSquared (3/18/2009)
Won't make the difference in a proportionate font, Jack.True, but code should not be formatted in a proportional font, for this very reason.
Yep. Exactly.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
March 19, 2009 at 9:34 am
Stuff that I have noticed:
1) It is using graybar striping background. I realize that its trendy on forums right now, but the Pro's say that background noise like this merely distracts, and I agree. A solid very light-gray background would be better (ref: E. Tufte).
2) The font looks proportional and that's not good (apoligies if I am wrong).
3) The font appears to be bolded which "crowds" the letters, IMHO. A little bit less would be more here: an unbolded or lighter weight would be better.
4) It treats all code as SQL: This is a problem because it really whacks other things like VB, and even simple data output.
5) It is trashing lots of old posts: especially the Prettifier stuff.
**: For (4) & (5) I recommend that you leave the old [code_] blocks they way they were and introduce new tags or options. I can see from my client HTML souce dumps that it has scripts for these languages:
- C++
- C#
- CSS
- Java
- Javascript
- PHP
- {plain?}
- SQL
- VB
- XML
My guess is that it cannot tell which to apply now, so it just always applies the SQL Brush. The obvious solution to both of these problems is to have tags to differentiate them. So either different tags for each language: [SQL_], [VB_], [XML_], etc... or an optional attribute on the code tag: [code_="SQL"], etc. In either case, just leave the plain old [code_] tags the way they were, so that all of the old posts are still readable.
6) Performance: This seems to be implemented as a client-side script that post-processes the output. That's OK, however, it seems to have some serious performance issues, especially in the editor were it frequently hangs for many seconds causing FireFox/Task manager to ask me if I want to kill the session because it is unresponsive.
Over all it looks really good though, I think that your 90% of the way there! 🙂
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
March 26, 2009 at 7:48 am
A lot of the issues seem to have been fixed, so thanks for that.
I do still want to mention the Font Weight issue though: From Firebug I can see that the Code Formatter is BOLDing the Keywords. I would like to respectfully (but very earnestly) request that this be changed to normal weight just like all of the other code in the block and just like the SQL Query Windows.
Bolding half the words does not make it easier to read or understand, it actually makes it harder, especially in this case because the Consolas font is a fairly "tight" font.
Consider this example where I have bolded all of the verbs, prepositions, articles and demonstratives (as we technically have no partive articles in English) which could be regarded as essentially the "Keywords" of English:
A lot of the issues seem to have been fixed, so thanks for that.
I do still want to mention the Font Weight issue though: From Firebug I can see that the Code Formatter is BOLDing the Keywords. I would like to respectfully (but very earnestly) request that this be changed to normal weight just like all of the other code in the block and just like the SQL Query Windows.
Bolding half the words does not make it easier to read or understand, it actually makes it harder, especially in this case because the Consolas font is a fairly "tight" font.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
March 26, 2009 at 8:23 am
RBarryYoung (3/26/2009)
A lot of the issues seem to have been fixed, so thanks for that.
I can't see any change.
By the way, the grey/white striping seems like a browser artifact; striping varies and, once in a while, it gets it solid grey -there's more white the faster I scroll the page!
Derek
March 28, 2009 at 10:45 am
Derek Dongray (3/26/2009)
RBarryYoung (3/26/2009)
A lot of the issues seem to have been fixed, so thanks for that.I can't see any change.
Well, for one thing we can post and see XML now.
And for another thing, there is this:
class Program
{
static void Main(string[] args)
{
using (SqlConnection cn = new SqlConnection("Server=(local);Database=Sandbox;Integrated Security=SSPI"))
{
cn.Open();
// The info message handler can be used for PRINT messages from server
cn.InfoMessage += new SqlInfoMessageEventHandler(cn_InfoMessage);
using (SqlCommand cmd = new SqlCommand())
{
cmd.Connection = cn;
cmd.CommandType = CommandType.Text;
// Use PRINT
cmd.CommandText = "PRINT 'Hello world'";
cmd.ExecuteNonQuery();
Console.WriteLine();
Console.WriteLine();
try
{
// Use RAISERROR
cmd.CommandText = "RAISERROR ('Error because of %d flying cows at %s', 11, 1, 2, 'Oktoberfest')";
cmd.ExecuteNonQuery();
}
catch (SqlException ex)
{
Console.WriteLine("####################################################");
Console.WriteLine("# A database error was raised!");
Console.WriteLine("#");
Console.WriteLine("# Please see following lines for further information");
Console.WriteLine("#");
Console.WriteLine("# ------------------------------------");
Console.WriteLine("# .NET EXCEPTION");
Console.WriteLine("#");
Console.WriteLine("# Message: {0}", ex.Message);
Console.WriteLine("# Number: {0}", ex.Number);
Console.WriteLine("# Procedure: {0}", ex.Procedure ?? "<NULL>");
Console.WriteLine("# State: {0}", ex.State);
foreach (SqlError error in ex.Errors)
{
Console.WriteLine("# ---------------------------------");
Console.WriteLine("# SQL ERROR");
Console.WriteLine("#");
Console.WriteLine("# Message: {0}", error.Message);
Console.WriteLine("# Number: {0}", error.Number);
Console.WriteLine("# Procedure: {0}", error.Procedure ?? "<NULL>");
Console.WriteLine("# State: {0}", error.State);
}
Console.WriteLine("#");
Console.WriteLine("####################################################");
//throw;
}
}
cn.InfoMessage -= new SqlInfoMessageEventHandler(cn_InfoMessage);
}
}
static void cn_InfoMessage(object sender, SqlInfoMessageEventArgs e)
{
Console.WriteLine("PRINT message from SQL Server:");
Console.WriteLine(e.Message);
}
}
That is Sweet! :Wow:
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
March 30, 2009 at 2:14 am
RBarryYoung (3/28/2009)
Derek Dongray (3/26/2009)
RBarryYoung (3/26/2009)
A lot of the issues seem to have been fixed, so thanks for that.I can't see any change.
Well, for one thing we can post and see XML now.
And for another thing, there is this:
class Program
{
static void Main(string[] args)
{
using (SqlConnection cn = new SqlConnection("Server=(local);Database=Sandbox;Integrated Security=SSPI"))
{
cn.Open();
//
// ... stuff deleted ...
//
cn.InfoMessage -= new SqlInfoMessageEventHandler(cn_InfoMessage);
}
}
static void cn_InfoMessage(object sender, SqlInfoMessageEventArgs e)
{
Console.WriteLine("PRINT message from SQL Server:");
Console.WriteLine(e.Message);
}
}
That is Sweet! :Wow:
Did I miss an announcement?
Looking at your quoted text I can see you've used '[code="csharp"]' and, obviously, the parser has recognized it; what other options does it have? A quick search didn't come up with anything.
Derek
Viewing 15 posts - 16 through 30 (of 42 total)
You must be logged in to reply to this topic. Login to reply