A step by step tutorial teaching you how to create your own chat client and chat server easily in C#, for local networks or the Internet.
A C# tutorial showing you how to make use of WMI to extract information on disk drives, such as model, capacity, sectors and serial number.
This tutorial will teach you how to calculate the shipping cost based on the weight, height, length and depth of the box, the distance and the UPS service type.
On Sunday, March 7th 2004 at 05:38 PM
By Andrew Pociu (View Profile)
(Rated 4.5 with 25 votes)
It all started with Java. Java, developed by Sun Microsystems was intended to be used only in consumer electronics, but now it’s used as an advanced programming language for the Internet. First browser to implement Java was HotJava, developed by Sun Microsystems for testing purposes. Netscape integrated it in its browser, Navigator, and after this Java gained interest.
Webpages visually enhanced, functionality increased, CGI scripts used more rarely, and all that with a programming language that is a lot easier to learn and makes programming simple things a lot easier.
Java is a high-level programming language used by advanced programmers, developed by Sun. Java code must be compiled before it can be used.
Things to know about JS
After significant modifications were added by Microsoft and Netscape to their Java scripting language version, new versions are developed, and handed to ECMA Organization that makes one standard scripting language out of them, called ECMAScript.
JS is Client-Side
There are two types of programming languages on the Internet, Server-side and Client-side.
Server-side languages are exclusive for servers, and use server resources; the result is being displayed on the client computer (the computer that’s accessing the webpage). A server-side language often used is PHP.
Basically, there are two types of programming languages:
Compiled languages require that after you write the code, to transform it in machine language (pure code that it’s very easy and fast to understand by the computer). Machine code is usually binary code. Every time you run the code (for testing), you must compile it with a compiler. After your application is finished, you can do a full compile and it will result an executable file (exe for example). There are advantages and disadvantages. Compiled languages run faster than interpreted language, are more stable, offer more control, the code is easier to protect… the only disadvantage is that when you develop your application and test it, you must compile it to run it, but it’s not a big problem, usually this doesn’t take more than a matter of seconds. All executable applications that you use, like MS Word, Outlook Express, Macromedia Dreamweaver… are compiled.
Object-Oriented based language
Source code not protected
Because it’s not a compiled language, and it runs on client-side, your JS code is available to see by all your visitors, and steal it. The only way you can make it harder to be copied is to write your code in a separate file. Doing so doesn’t fully protect your code, and if the visitor really wants to see your code, he will. But more about this in the next chapters.
JS extends HTML
Event-driven languages are those that need an event to trigger an action. For example, in a dialog box, to continue, or to stop, you must click OK or Cancel, respectively. If you click OK, the program will start and continue its work. If you click Cancel, it will exit. To start working or to exit are actions driven by the button you choose. If you don’t click anything, the program will do nothing. This is how an event-driven language acts.
What is it good for?
Text validation was inconvenient with good old CGI, and it’s still the same with PHP and other server-side languages. Let’s think at a form… just like the ones you see every day on the internet where they ask you to register or to login somewhere. If you misspell something, you don’t enter you ZIP Code in the correct format for example, the form will be sent to the server, you wait while the page loads (if the server is busy, you will wait…). Then the server processes the form, it sees that you didn’t complete it correctly, and sends you a page where you find out what misspell you have done, and that you must go back to correct it.
You can put current time on different places on earth if you have a news site or an advanced calculator if you have a science site, or one that works based on a formula.
If you know that your webpage doesn’t work well with a specific browser, you can make a script that will detect the browser and warn the user that the webpage isn’t designed for that browser, or for that screen resolution, or color depth. You can also find this kind of information about your visitors, including their IP address and who referred them to your webpage.
You can store cookies on the client’s computer, and when they visit the site again the script will know it’s the same visitor. This helps you a lot. It’s especially used at login systems. If the visitor is registered on the site, the next time he will visit the site, it will be logged in.
Compatibility is an important thing, which a webmaster and programmer should pay attention to, though nowadays browsers tend to keep up with the newest versions, and compatibility doesn’t represent such a big problem no more.
JS and the browsers
This information is useful because you will probably want that your script to work with older browsers, that are still used. Of course, you won’t do scripts that work with Netscape Navigator 2, because probably no one is using this browser anymore. But you will try to make your scripts compatible with Internet Explorer 5.5, because there may be some users who use this older version of Internet Explorer, though there are no extreme differences between version 1.4 and 1.5 of JS, and definitely you won’t use the new function implemented in version 1.5 in all your scripts.
Site’s target visitors matters
You can make your scripts compatible depending on your target visitors. For example if you make a site for webdesigners, it shouldn’t be such important to make your script compatible with Internet Explorer 5 or Netscape 4, because you site’s target are webdevelopers, who work with this kind of web technologies, and they probably use the latest versions of the browsers.
On the other hand, if you make a script for a banner-exchange system, you never know on what site the script ends-up, maybe on a culinary site, where the user probably doesn’t have big knowledge about computers, so he doesn’t keep his computer updated.
A browser can interpret a piece of JS code different from another, but this is the happy case, when it doesn’t give an error. Some browsers actually don’t do anything when they can handle a piece of code; others throw an unpleasant error, or display something strange. It’s better to test your script with the most used browsers, to see if your script works fine with them.
|Digg It! Del.icio.us Reddit StumbleIt Newsvine Furl BlinkList|
Rate this tutorial
There are no related tutorials.
Related Source Code
There is no related source code.