none
Code blocks, what's the point? RRS feed

  • Question

  • There is a feature to insert code blocks in the web UI, but I completely fail to see the point with it, the way it's working right now.

    First of all, the feature is by no means easy to find. There is an obscure icon with two arrows that could mean anything. What's wrong with a button that says CODE?

    Next when you open it, you are presented with a window with a fixed font. Here you can insert your code, and adjust it so that it's nicely aligned. But when press Insert, you find that the text appears with a proportional font, and your alignment work is fruitless. Yes, there is a Preview window that shows how the inserted code will look like, but do you seriously suggest that users should use fixed-font window to make it look nice in the preview window.

    Overall, the concept of a special window to add code seems strange, and the Preview thing seems really useless. Why not insert the code with a fixed font? Makes things easier for everyone. From a usability perpsective, it seems that the easiest would be if could just select a piece of text and then slap CODE onto it without a need for a separate window.

    Personally, I rarely use the web UI, but instead I stick to the NNTP bridge from which I use a plain-text reader. In the NNTP bridge you can use tags like [code], [sql] to mark code blocks. Interesting enough, such code blocks appears with a fixed font in the web UI. Something somewhere adds too many spaces, so indentations comes out really bad, and the feature is useless.

    Examples of all these problems can be seen in this thread:
    http://social.Msdn.microsoft.com/Forums/en-US/msdnsandbox/thread/85d7f2e3-0ae0-4845-9e42-a5564e259945#85d7f2e3-0ae0-4845-9e42-a5564e259945

    I know that there was an update recently. It does not really seemed to have improved things. What I do know is that some year ago, using code blocks from the NTTP Bridge worked very well.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
    Sunday, March 18, 2012 1:30 PM

Answers

All replies

  • Most of my replies include code, but I seldom use the Insert Code Block feature because of the issues you raise. I almost always use the Insert HTML feature instead. I use scripts that convert my code in a text file into properly formatted HTML. Extra steps, but easier than trying to doctor things in the code editor. I want a fixed width font, and I want all spacing and indenting preserved, and this is the only way I can ensure I get what I want.


    Richard Mueller - MVP Directory Services

    Sunday, March 18, 2012 3:36 PM
  • It's gone a couple of days, but there has been no response to this thread. However, there has been three additional posts to by Sandbox thread, including one from Brent Serbus.

    I would really like answer, because here is something which is working very poorly, and reduces the experience of using the forums.

    I realise that the NNTP bridge may not be top priority. On the other hand, quite a few of us who answer questions uses the bridge.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
    Thursday, March 22, 2012 10:58 PM
  • What kind of answer are you looking for? The truth is that it's a helpful way to quickly drop in code that's formatted.

    I think it works well, but it doesn't meet the requirements of several people. They refuse to use it.

    There's a good chance that this is more of a Discussion than a Question. If it is a Discussion, can you change the thread type, please?

    Thanks!


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


    Thursday, March 29, 2012 5:35 AM
  • What kind of answer are you looking for? The truth is that it's a helpful way to quickly drop in code that's formatted.

    Seriously?

    The easiest way to drop code, is just to press CTRL-V in the posting window. Which many users in the T-SQL forum does. Unfortunately, for whatever reason the web UI mangles the code, so that spaces between words disappear, there are extra blank lines, and code is generally not easy to read. Or to run.

    To know about the code blocks, you have to find the secret button which opens a second window, and if you make the effort to have your code nicely aligned, you have nothing for it. And whatever, you cannot call bringing up a second window for a quick way.

    If you wanted to helpful, you could do a lot beter.

    So obviously that's why the codeblock feature exists, and it certainly works. It doesn't meet the requirements of several people. They refuse to use it.

    Or they don't know about it.

    What I care about is that my posts looks well, so that readers I understand my answers. I used to put code blocks between [sql] and [/sql], but as I noted this is broken now and the result is awful. The truth is, right now I can't really post code that complies with my standards at all.

    There's a good chance that this is more of a Discussion than a Question. If it is a Discussion, can you change the thread type, please?

    Huh? I'm sorry, but I don't understand what you mean with "changing
    thread type". There is no such function in my newsreader.

    But obviously I do have a question: the code blocks are not working well, and I'm asking what Microsoft are planning do to do adress this. I was starting to ask myself whether the deafing silence meant "Yes, it's so bad that we don't want to talk about it".

    I appreciate that I finally got a reply, but I will have to say that you managed to come across as quite arrogant.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
    Thursday, March 29, 2012 9:40 PM
  • You might find this helpful: Forums Code Addin Alternative to Insert Code Block, although I don't use it myself.

    Incidentally, many web forums have a "secret button" for inserting code blocks, for example on stackoverflow it's { }. I agree it's too cryptic: I find that I have to inform people about the button to use to insert a code block here.

    --
    Andrew

    Sunday, April 1, 2012 6:05 PM
  • Well, it's difficult to use a Visual Studio addin for an SQL guy who is posting from the NNTP bridge!

    Yes, I often tell people to use that button. Which now have become even more difficult to describe.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
    Sunday, April 1, 2012 9:39 PM
  • Hi Erland,

    I can't try this at the moment, but have you tried wrapping code in [pre][/pre] from the NNTP bridge?


    Ed Ferrero
    www.edferrero.com

    Monday, April 2, 2012 3:16 AM
  • I can't try this at the moment, but have you tried wrapping code in [pre][/pre] from the NNTP bridge?

    Result can be seen here:

    http://social.msdn.microsoft.com/Forums/en-US/msdnsandbox/thread/6adaf847-c16c-4e0e-8bc4-368d4ab74e78#6adaf847-c16c-4e0e-8bc4-368d4ab74e78

    The NNTP Bridge does not seem to recognize that as special. (I don't have
    the time to check closer tonight.)


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
    Monday, April 2, 2012 9:47 PM
  • Perhaps they coded the Code Block into MSDN Forums for the benefit of people who are using the Forums via a web browser?

    I personally use Code Blocks frequently and I find them helpful. I do also use the HTML editing feature.

    I do agree however that there are some issues with the user-interface-refinement/ ergonomics of this feature... The online WYSIWIG editor doesn't always behave well around quotations and code blocks either.


    Matthew Slyman M.A. (Camb.)

    Monday, April 2, 2012 10:09 PM
  • I personally use Code Blocks frequently and I find them helpful. I do also use the HTML editing feature.

    You mean like this? I click HTML and wrap everything in a <pre> tag?

    This is text in in a <pre> tag

    As long as I have not pressed Submit it is displayed in a fixed font, but is that what you see?


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

    Monday, April 9, 2012 9:01 AM
  • But obviously I do have a question: the code blocks are not working well, and I'm asking what Microsoft are planning do to do adress this. I was starting to ask myself whether the deafing silence meant "Yes, it's so bad that we don't want to talk about it".

    I appreciate that I finally got a reply, but I will have to say that you managed to come across as quite arrogant.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

    Many bug fixing efforts are in progress, and many fixes have been made.

    Please explain how you think I come across as quite arrogant.

    Thanks!


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

    Monday, April 9, 2012 5:08 PM
  • You might find this helpful: Forums Code Addin Alternative to Insert Code Block, although I don't use it myself.

    Incidentally, many web forums have a "secret button" for inserting code blocks, for example on stackoverflow it's { }. I agree it's too cryptic: I find that I have to inform people about the button to use to insert a code block here.

    --
    Andrew

    Is the ask here to change the "Insert Code Block" icon?

    Any suggestions?

    Thanks!


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

    Monday, April 9, 2012 5:09 PM
  • Is the ask here to change the "Insert Code Block" icon?

    Yes.

    Any suggestions?

    The button could say "CODE". Plain and simple.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
    Monday, April 9, 2012 7:23 PM
  • Many bug fixing efforts are in progress, and many fixes have been made.

    Please observe my latest observation: if I use HTML and use the <pre> tag, the <pre> tag is replaced somewhere in the process.

    Please explain how you think I come across as quite arrogant.

    So I was told that the feature is useful for many. I was told to change the thread type. Basically you appeared to question what I doing here in the first place.

    I realise that the issue with issue that are specific to the NNTP bridge is not your top priority, but I've also focused on the behaviour in the web UI. (When posts come from the NNTP bridge, <PRE> is respected, but the HTML formatting adds way too many blanks.)

    Then again, I like to believe that the few of us that come in from the NNTP bridge adds some value to the forums by helping people.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
    Monday, April 9, 2012 7:28 PM
  • The button could say "CODE". Plain and simple.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

    Here's another popular icon for "Insert Code Block":

    { }

    Is that any clearer than the current icon?

    Thanks! I'm checking to make sure there's a bug on this.


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


    Monday, April 9, 2012 10:29 PM
  • So I was told that the feature is useful for many. I was told to change the thread type. Basically you appeared to question what I doing here in the first place.

    I realise that the issue with issue that are specific to the NNTP bridge is not your top priority, but I've also focused on the behaviour in the web UI. (When posts come from the NNTP bridge, <PRE> is respected, but the HTML formatting adds way too many blanks.)

    Then again, I like to believe that the few of us that come in from the NNTP bridge adds some value to the forums by helping people.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

    Well I think the NNTP bridge is very important. It's difficult to make mutliple tools communicate together, but it doesn't mean we shouldn't refine the experience.

    You think I told you to change the thread type? I was actually trying to say that this thread might be more of a Discussion than a Question. And then if it does turn out to be a Discussion, I asked if you could please change the thread type. Sorry if I miscommunicated that to you.


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

    Monday, April 9, 2012 10:42 PM
  • So I was told that the feature is useful for many. I was told to change the thread type. Basically you appeared to question what I doing here in the first place.

    I realise that the issue with issue that are specific to the NNTP bridge is not your top priority, but I've also focused on the behaviour in the web UI. (When posts come from the NNTP bridge, <PRE> is respected, but the HTML formatting adds way too many blanks.)

    Then again, I like to believe that the few of us that come in from the NNTP bridge adds some value to the forums by helping people.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

    Well I think the NNTP bridge is very important. It's difficult to make mutliple tools communicate together, but it doesn't mean we shouldn't refine the experience.

    You think I told you to change the thread type? I was actually trying to say that this thread might be more of a Discussion than a Question. And then if it does turn out to be a Discussion, I asked if you could please change the thread type. Sorry if I miscommunicated that to you.


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


    I think he understood that changing the thread type was only a suggestion. What part of "There is no such function in my newsreader" did you not understand?

    Al Dunbar

    Tuesday, April 10, 2012 12:11 AM
  • I think he understood that changing the thread type was only a suggestion. What part of "There is no such function in my newsreader" did you not understand?


    Al Dunbar

    Well that's not a problem. I can do that for him. I just needed to see if that's what he wants, first.

    Thanks!


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

    Tuesday, April 10, 2012 12:16 AM
  • Here's another popular icon for "Insert Code Block":

    { }

    Is that any clearer than the current icon?

    No. Possibly it is easier to describe.

    I understand that a button says "CODE" is just about as unsexy it can get. But this is a technical forum. It's not Facebook.

    As for the "thread type"; I don't even know what a thread type is. And, honestly, I don't care. For me, a thread is a thread is a thread.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
    Tuesday, April 10, 2012 8:21 PM
  • No. Possibly it is easier to describe.

    I understand that a button says "CODE" is just about as unsexy it can get. But this is a technical forum. It's not Facebook.

    As for the "thread type"; I don't even know what a thread type is. And, honestly, I don't care. For me, a thread is a thread is a thread.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

    Interesting. That symbol is actually what Stack Overflow uses.

    UPDATE: We've got a bug on it. Thanks!


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


    Tuesday, April 10, 2012 10:00 PM
  • Interesting. That symbol is actually what Stack Overflow uses.

    I've never posted on Stack Overflow. And overall I find that site even more confusing than the MSDN forums,

    UPDATE: We've got a bug on it. Thanks!

    Thanks Ed!


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
    Wednesday, April 11, 2012 9:33 PM