Tip of the month -
INVISIBLE COMMENTS - Now you see'em, Now you don't
If you've read any of my articles or downloaded any of my code you will quickly discover that I love using
This is great for my colleagues at work. This stuff's hard enough to understand without good commenting.
comments. If they wanted to figure the code out; make them work for it.
This was simple enough to do; so I
thought. I simply wrapped my comments in ASP script tags <%..comments..%> and put a ' in front of each
line to make the ASP interpreter think it was an ASP comment. The results were great, competitors could no
longer see my comments. An added advantage of this was that the comments no longer needed to be sent
to the clients browser! Check it out, smaller HTTP packets! This can make a big difference if you comment like I do!
Unfortunately, when I did this my color scheme in InterDev was thrown completely out of whack. You see I like to make all
my comments appear as white text on a green background. I thought to myself, what am I going to do? I can't
program without green comments!
Determined as I am, I finally found my solution. Wrap the ASP tags in a
need to work to figure out my code, and my boss is happy. Note: not all three layers are necessary to achieve my
with your real ASP comments.
While we're talking about comments, I just want to throw in something about Microsoft's new C# language.
If you've ever looked at any C# code, you may have seen comments done in XML format. We all like XML right?
This really hit me as a great idea. So....Why not implement this in your current ASP or VB code. There's no
reason why you can't. A comment is a comment. A XML comment is still a comment, but is there anything to
be gained by doing this? Well, it would make it really easy to write an VB add-in to document your code.
How about using XPATH to search all your code for certain functions or subroutines? What about shareware sites
where you have people searching for code to solve a particular problem. No more keeping a separate database with
keyword indexes. The source code has everything you need. Just for thoughts....
'//<CALLED BY> get_books(),vcr(),allbooks_onclick(),movebook(),Ddelete_onclick(),Spaste_onclick()
'//<INPUT>whichone - 1=saved book list 0=queried book list
'//tmpbookIndex - the books position in the list
'//<PURPOSE> Select the current book from the dom containing all books
'//query the book object and get the info to populate the form controls
'//update the listbox containing the IDs of all books in the dom
'//<OUTPUT> Xbooknumber - the current books position in the list
'//objXbook - an object containing all info on the current selected book
'//<DATE> Feb 18, 2000 </DATE>
if (tmpbookIndex<1) return;
if (whichone==1) //Saved book list
Dbooknumber = tmpbookIndex;
//the position of a book in the DOM is always Dbooknumber - 1
var DbookName= objDbook.selectSingleNode("FIELD[@gcolumnname='title']").text.toUpperCase();
/*<% '//display the book name%>*/
/*<% '//display type of book%>*/
/*<% '//display when the book was published%>*/
/*<% '//display the book price%>*/
/*<% '//display the books year to date sales%>*/
/*<% '//display the book id%>*/
/*<% '//display book xx of xx %>*/
document.all.Dbookid.innerText="[ "+Dbooknumber+" of "+Dnumberofbooks+" ]";
/*<% '//set the length of the list box to the number of books%> */
/*<%'//get the notes about the book%> */
var Denglish = objDbook.selectSingleNode("FIELD[@gcolumnname='notes']").text;
/*<%'//display the books notes%>*/
/*<%'//fill in the available books list box with the current books from the xml doc%>*/