Around the Web in Eighty Kilobytes

Home Old Issues Examples

PreviousIssues : 19 - August 11
Welcome to Nathsite's weekly 'Around the Web in Eighty Kilobytes', a 20-part free guide to building a website of your own, and using the web well.
To stop getting ATWI80KB's, send an empty email to atwi80kb@homepage.com with 'NO MORE THINGIES' as the subject. To look at examples and previous ATWI80KB's, go to http://atwi80kb.homepage.com



AROUND THE WEB IN EIGHTY KILOBYTES 1.37 - 1.38
   ATWI80KB 19

August 11, 2000

1) Java vs. Javascript
2) CGI and ASP



1) JAVA VS. JAVASCRIPT
   The tutorial is pretty much over. But before I finish, there are a couple of ideas that need to be explained.

   A lot of people believe that Java, Javascript and JScript are the same thing. This is like saying that cough syrup and coffee are the same thing. Forget JScript for now - it is a different programming language supported only by Internet Explorer (I think), and has nothing to do with Java and Javascript. Most of the confusion is between Java and Javascript.

   Java is a complete programming language. You can make anything with it - a word processor, a paint program, a browser... It is also used to make webpages interactive. Sometimes, while exploring the web, you find slow-loading often gray objects in pages which do strange things. These are Java Applets, little programs that are put on webpages. They can be a game, a fancy navigation menu or anything.

   Javascript is a also language created to make pages a bit interactive. It isn't meant to be a complete replacement for Java, just a simple language with similar name and syntax.

   To make a java applet, you have to write the code and save it as '.java' and compile it into '.class' files with a program named 'javac.exe' which is a part of the Java Development Kit, which can be downloaded from Sun's website. Then you put the '.class' file into your webpage with the <applet> tag. Although you can make external Javascript files if you want, it is always much simpler to add Javascript to your pages, as ATWI80KB 17 and 18 showed you.

   Java and Javascript syntax is similar but different. The loops you learnt last week are the same ones you're going to use for most programming languages, and are used in Java too. The main difference is that, in Javascript, it's much easier for you to input and output. Java can do more things and is way more powerful.



2) CGI AND ASP
Enough Java-eey stuff.

   CGI (Common Gateway Interface) is an idea you should know the basics of. Although its name conveys less information about its use than a blind squirrel skiing down a one-way road, CGI is actually quite useful. It's what's used to process form data and a few other things, for example it can change an HTML document based on user input!

   CGI is not a language. It's just a way to use languages. The most common language used for CGI is Perl. Perl is not a toothpaste, though its name sounds like one, it's a language whose files are stored with a '.pl' extension. Like Java, Javascript and many other languages, it evolved partly from C, so its syntax is sort of like the other languages I've mentioned (Darwin's theory makes a lot of sense when you talk about computer languages. You can even study extinct languages like Livescript, which are the links between the languages then and the languages now. C is a sort of living fossil).

   If you get a perl script from a script gallery or something, this is the most common way to use it:
   <form name="whatever" method=post action="url of CGI program, usually in perl">    .....
Most script galleries will give you reasonable instructions.

Usually, CGI's are put in 'cgi-bin' or 'cgi-local' directories. Free homepage providers sometimes do this so that you can't write programs to modify their HTML files. Not many free homepage providers support CGI, so if you want to use CGI remember to check..

   ASP (Active Server Pages) likes to think of itself as a replacement for CGI. I don't think it's as well supported, and it's probably less useful.

You can tell that a page uses ASP in two ways:
  1. It has a '.asp' extension.
  2. It has a line sort of like this:
        <% language="VBScript" >
A few good websites use ASP anyway. If you want to do any HTML page changing etc., I still recommend CGI, not ASP.



See you in a week!
Aniruddh Nath



Email questions to
atwi80kb@homepage.com - I'll reply if I have time. I might write stuff from your email in later ATWI80KB's.
NOTE: I'm not responsible for any damage done to your computer because of this tutorial.