CL1 webserver: <Anantsystems<Ad info>

    AspnetEmail.com   AspNetPro.com

related sites: <FREE Help> <ASP> <Asp.net> <worldwide>  
feedback: <lovethat> <hatethat> <thanks> <credits> <contact us>

Tutorials - Showing Code Table of Contents PrintView CL1
<Previous> Coding Secrets Revealed

The Organization Library <Next>


       

Showing Source Code in our Tutorials

We provide lots of sample code that people can press a button and run. We deliberately did not want to put code in .ZIP files where it could not be proven that they work (typoes might creep in) or cut and paste them into pages and introduce typos.

For authors on aspalliance.com <!--#include virtual="/learn/liblearn.asp"-->
early on your page gives you access to our library.

<%call showASPcode("whataver.asp")
for example, displays source code for whatever.asp.

Tips
  • anything that is prefaced with lib_ will not get a "run-me" button
  • anything suffixed with respond.asp will not get a "run-me" button
  • you can run this against .cls files to pretty print a component.

We pretty print code by opening the file running on our server so you are ensured the code works before pasting it into your application. Seems simple enough... Some complex issues to solve creeped up.

Obstacle #1: Some code (like a library or include file) need to be displayed but don't need run-me buttons.

Obstacle #2: Some code only makes sense if invoked from a form. Displaying it is ok, but makin a run-me button would be useless as a form must be run to "feed it" the inputs.

Obstacle #3: Some code may need to be invoked with a GET, i.e.
whatever.asp?state=md&city=Rockville
or
whatever.asp?state=tx&city=Dallas
or they won't work.

Obstacle #4: If the user is printing the page, the "run-me" buttons do not need to be there. However, line numbers do need to be there. All the pages can at the press of a button, be formatted for printing.

Obstacle #5: CLS files from Visual Basic cannot be printed as-is yet we wanted to list source code for components. CLS files have several lines in the ASCII file that never appear on a VB programmers screen.

We solved these all. How? A lot of ways:

The learnlib.asp (source on the next page) is quite complex and actually includes some code that was submitted by a site reader Paul Rigor to replaced my source printing code that worked ok, but had some really annoying flaws. Paul donated source printing code that replaced my code that worked  (albeit with some annoying glitches of it's own.)

Tutorials - Showing Code Table of Contents PrintView
<Previous> Coding Secrets Revealed

The Organization Library <Next>

CL1 webserver: <Anantsystems<Ad info>

    AspnetEmail.com   AspNetPro.com

related sites: <FREE Help> <ASP> <Asp.net> <worldwide>  
feedback: <lovethat> <hatethat> <thanks> <credits> <contact us>