Hopefully this post will save someone else a bit of time just like it did for me… I stumbled across a trick for commenting out various blocks of code (typically used for debugging). By using a combination of the multi-line and single line comments, you can quickly comment/uncomment code.
/*
alert('error');
//*/
By setting up your comments like this, you can then add another forward slash to the first line to quickly uncomment the alert.
//*
alert('error');
//*/
In SQL, just replace the // on line three with — and the first two characters on line one should be –. Basically, it should look like this.
--/*
select * from table
--*/
Update (11 May 2010)
I figured out a way to use this trick for CSS even though there is no such thing as a single line comment in CSS. You just need to place an asterisk at the end of the top part of the comment, like below:
/* Comment trick for CSS *
body { background: #000; }
/**/
And then to “activate” the commented code out, just finish closing the upper comment:
/* Comment trick for CSS */
body { background: #000; }
/**/
Neat Little Comment Trick
Hopefully this post will save someone else a bit of time just like it did for me… I stumbled across a trick for commenting out various blocks of code (typically used for debugging). By using a combination of the multi-line and single line comments, you can quickly comment/uncomment code.
By setting up your comments like this, you can then add another forward slash to the first line to quickly uncomment the alert.
In SQL, just replace the // on line three with — and the first two characters on line one should be –. Basically, it should look like this.
Update (11 May 2010)
I figured out a way to use this trick for CSS even though there is no such thing as a single line comment in CSS. You just need to place an asterisk at the end of the top part of the comment, like below:
And then to “activate” the commented code out, just finish closing the upper comment: