April 20, 2019 at 10:30 am
Now, I realise this is really a user problem; people are just pasting their code into the code box and not caring that is an unreadable mess (which, for me just puts me off answering the question in all honesty), however, when these users are pasting, it seems that the Forum Software is also breaking the code. Take the following statement below:
SELECT *
FROM MyTable
WHERE ID = 1
AND Name = 'Thom'
AND Status != '';
And now I'll paste it into the window instead:
SELECT *
FROM MyTable
WHERE ID = 1
AND Name = 'Thom'
AND Status != '';
Now, when editting (which I am now), it looks fine, but in the display 'Thom'
is now ‘Thom’
, so the quote characters are incorrect. As for Status != ''
it is now Status != ”
; it's turned the 2 single quotes into a single double quote. It's also inserted an extra line break between each line of code.
Like I said, I realise that this is a user problem not making use of the tools they have; but the forum software shouldn't be invalidating the code. If, somehow, we can stop users pasting code straight into the question that would be great, but if not can we try to make it so that at least it's useable? It's very hard help users, when the code they've supplied has been broken by the forum software (due to the user's own fault however).
If we copy and paste the code from the display of the reply, we can this query, which needs fixing before anyone can run it:
SELECT *
FROM MyTable
WHERE ID = 1
AND Name = ‘Thom’
AND Status != ”;
Unfortunately, you can't see the double line breaks, which you would if you pasted into something like SSIS/ADS/etc.
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
April 20, 2019 at 4:25 pm
I'd suggest that each forum have a "sticky" topic on it for how to post various types of code along with mention of how to post question either for coded answers or performance issues. Of course (and I've not checked today) the forums seem to be having problems with attachments, especially on older posts.
Regardless of the instructions, I agree that the forum code should do things like automatic smart-quotes, etc, etc.
The instructions would help either way but shouldn't be used as a reason to not fix the paste problems.
--Jeff Moden
Change is inevitable... Change for the better is not.
April 22, 2019 at 3:18 pm
Styling and pasting are still being worked on. There are lots of interactions between the "rules" of how to interpret pasting and then the precedence of those.
Smart quotes and left/right ticks are a common thing in language, but not in code. We should disable those because left/right ticks serve no purpose here.
April 22, 2019 at 4:11 pm
I've noticed the "translation" issue of the single quote (char(39)) where it's converted into opening-closing single quotes, in my mind, a definite no-no when it comes to SQL scripts!
😎
Same thing sometimes happens when - is converted to a MS Word style hyphen, guess Steve and the crew has some work to do 😉
April 22, 2019 at 8:54 pm
Smart quotes are only good for testing find and replace functionality.
Sue
April 22, 2019 at 9:30 pm
This may be an unpopular opinion, but I feel that this is more of a user training issue than a forum software issue.
If the end user uses the tool the way it was designed (ie clicking on the "insert/edit code sample" button), this is not a problem.
To me this feels more like how some forums have a sticky set of rules you need to abide by before posting; I don't think there is a need to tweak the tool in this case.
That being said, I know I get frustrated with tools that try to format my writing for me. If I put a single quote in or 2 dashes, maybe I actually meant to put in a single quote or 2 dashes.
The formatting of text in this new form to me feels a lot like MS Word's formatting. Enter puts in a large gap between paragraphs, shift+enter does not. 2 dashes becomes 1 wider dash, apostrophes when a closing one is found become "smart" quotes. For those who are familiar with MS Word, this new forum software is pretty easy to figure out.
Not sure it is possible, but having a "plain text" mode vs "smart" mode for the text editor may make things nicer for everyone?
I think knowing the hotkey or symbol which triggers the editor to tell me that it is a "code sample" vs wall of text would be helpful. I think having the tool automatically guess what is and isn't code will result in a bunch of garbled up posts.
The above is all just my opinion on what you should do.
As with all advice you find on a random internet forum - you shouldn't blindly follow it. Always test on a test server to see if there is negative side effects before making changes to live!
I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.
April 23, 2019 at 5:09 pm
This may be an unpopular opinion, but I feel that this is more of a user training issue than a forum software issue. If the end user uses the tool the way it was designed (ie clicking on the "insert/edit code sample" button), this is not a problem.
I do agree that really this is a user issue, and if the software was used correctly this wouldn't be a problem. Many of us, however, are more than aware how difficult it is to get our own users in our companies to use an application they are "trained" on correctly, so I honestly believe we have no chance of educating strangers on the internet.
Plus the fact that more inventive validation makes for more inventive idiots, means that no matter how much the Redgate team may try to stop users pasting code as raw text they'll never stop them. 😉
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
May 2, 2019 at 9:35 pm
A quote test:
SELECT *
FROM MyTable
WHERE ID = 1
AND Name = 'Thom'
AND Status !='';
Fingers crossed
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply