11.22.07

Basic XML Syntax

Posted in XML Scripts at 11:49 am by admin

XML is a language that was developed for a very specific purpose. The purpose of XML is to provide a compliment to HTML and therefore allow you to store your data outside of the actual HTML document. As you get more advanced in your programming, you will realize that there are times when this can be a very important thing to have. For now however, it is sufficient just to understand that XML is primarily used to separate data from the HTML code.

In order to understand the syntax for XML (which is actually perhaps the simplest set of syntax rules around; certainly many people that have been forced to learn XML on a very quick crash course would agree that they are the simplest), it is best to do so through the use of a note. Since we have been big on the Hello World examples in other coding instructions, we will use the same here.

The following script:

<?xml?>
<note>
<to>World</to>
<from>Me</from>
<heading>Hello World</heading>
<body>Hello World!</body>
</note>

Accomplishes something similar to the typical ‘Hello World’ example.

The XML tag is a tag that is used to let whatever is reading the software know that the following lines of code are xml code. The <note> and </note> tags define that the upcoming document is a note. The <to> and </to> tags define person that this note is being addressed to, while the <from> and </from> tags do the opposite; they let the viewer know who the note is being sent from.

The <heading>, </heading>, <body> and </body> tags define the headings and the body of the actual note. If you were writing this as an e-mail instead of as a note, then the heading would be the subject line and the body would be the actual e-mail; just to give you a suitable frame of comparison.

As you review this script, chances are that it is starting to occur to you why XML is thought of as one of the simplest languages around to learn. Most of the XML language itself is quite self-descriptive and when something is self-descriptive, that can easily lend itself towards being easy to learn. As you continue to expand your knowledge of XML and learn the language, chances are you are going to see this idea of simplicity in self-description echoed again and again. The sooner you understand that this idea applies to all of the XML syntax, the quicker your XML education will go.

Scriptycan is a great software repository featuring both free and commercial XML Scripts and applications for developers and programmers.

11.20.07

A Basic C Script

Posted in C AND C++ Scripts at 2:12 am by admin

‘C’ is perhaps the biggest institution as far as programming languages go. While most of the languages from that period of the world are still in use today, so many different languages were influenced in later eras by the C programming language that it is almost impossible to be a programmer without seeing at least the influence of C in the work that you do on a daily basis. For this reason, C is one of the most revered programming languages around and it is still high on the list of most people to learn when they sit down and decide to become a programmer.

The main problem with C nowadays is that it has become such a mammoth part of the world that it is sometimes difficult to know where to begin. Many of the programmers out there have developed non-standard way of doing C programming and therefore a lot of the programs that you see from them are going to have things that you do not recognize and will have to look up. However, learning the basics of C are easy and learning how to print something on the screen for people to look at is something that is so easy that it is practically instantaneous.

Consider the following C script:

Main()
{
Puts(“Hello World!”);
Return(0);
}

This is perhaps the simplest C script that you are ever going to come across. The main() defines the function main, which is basically a function that uses within it two more functions. The puts function which displays the words Hello World on the screen and then the return function which basically ends the program. That’s all there is to it. Three functions and five lines produce the same Hello World example that you likely have seen from other examinations of basic scripting for different languages.

Another thing that you can see in this example is the influence that C has had over a number of different languages. A lot of the above code will look familiar to you if you are a person that has had some experience in programming with the PHP server scripting language. A lot of the functional elements such as brackets and semi-colons are used in the same way. While this might be second nature to us now, keep in mind that the inventors of C invented this way of doing things and in doing so paved the way for many of the languages we now use today.

Scriptycan is a great software repository featuring both free and commercial C and C++ Scripts and applications for developers and programmers.

11.14.07

The JavaScript Onload Function

Posted in JavaScript at 2:04 am by admin

JavaScript is a very interesting programming language to use simply because it is a language that is so easy to use in conjunction with HTML and other web languages.  JavaScript was initially designed for the web and is made even better for the web whenever it is updated, so it is quite easy to see why people are impressed with the JavaScript language.  There are a number of things that you can do in order to make your website better with the JavaScript functions and therefore it is important for people to realize exactly what those functions happen to be.

For starters, one of those functions is known as the onload function.  This is one of the earliest taught functions for JavaScript because of not only the ease of learning that it brings to the table, but also because it is one of the more basic functions around.  Onloads will be big parts of larger chunks of JavaScript code and this is why it is important that people learn about them early on within their JavaScript training.

Now, like most pieces of code in JavaScript, it serves no purpose to verbally explain what the onload function does without using an example in order to help that illustration along.  To that end, take a look at the following piece of code:

<html>
<head>
<script type=”text/javascript”>
Function message()
{
Alert(“Hello World”)
}
</script>
</head>

<body onload=”message()”>

</body>
</html>

Have you ever seen a prompt window pop up when you get to a website with a message for you to read and then at least one option button (i.e. the okay button, although sometimes there is more than one option depending on what the message says) for you to click?  Well, if you stuck this little bit of code into your website, anyone that visited it would have a pop-up message that said “Hello World.”

This is done through the use of the message() function, but that is not the part of the code we are predominantly interested in.  We are interested in the onload attribute of the body tag, which happens to execute the function that was defined within the head part of the HTML code.  Attaching the onload attribute to the body tag ensures that the message() function is executed as soon as the site is displayed.  Message() is not the only function that can be onloaded and therefore you can see easily now why the onload attribute is an important one to learn.

Scriptycan is a great software repository featuring both free and commercial JavaScript scripts and applications for developers and programmers.

11.12.07

Running ASP Scripts on your Computer

Posted in ASP Scripts at 7:48 am by admin

ASP is the Microsoft version of PHP and indeed can be a very useful language to use in your coding, especially if you happen to be a big fan of Microsoft FrontPage.  However, you can not just go ahead and use ASP right away without making some medications to your computer, unless you own an external server that you can use.  If you are like most people, an external server is not particularly high on your priority purchase list and therefore you need to use a Personal Web Server (PWS) on your computer in order to take the place of the normal server that other people would use.

The PWS is a product that is made by Microsoft and it is specifically for people that are interested in running ASP scripts on their computer without having to invest in a server in order to do so.  Installing the PWS requires at least Windows 98, Second Edition, if you are truly serious about learning ASP and preferably if you had something even more recent than that such as Windows 2000 then the situation would be much better.  If PWS is not a good choice for you, then you can also look into IIS (Internet Information Services) as an independent choice for you to install on your computer that is capable of running ASP scripts.

Installation of PWS is different depending on the system that you have in place.  PWS is not shipped with any copies of Windows 95, so if you have that operating system then you need to download the Windows NT 4.0 Option Pack in order to get the PWS that you need to install on your computer.  Once you have those downloaded (in all other cases you get the PWS files already shipped), then you can go ahead and follow the installation instructions that come with it in order to get the server set up on your computer.  The same is also true for IIS.

Once you have the server installed, try running the following code in the local directory:

<html>
<body>
<%
Response.write(“Hello World”)
%>
</body>
</html>

If you get the following:

Hello World

On the screen, then it means ASP is working fine.  If you get nothing in the screen, then you have done something wrong within the installation procedure.  Go back and look at what you have done to see if there is a part of the installation procedure that you failed to observe.

Scriptycan is a great software repository featuring both free and commercial ASP scripts and applications for developers and programmers.

11.10.07

A Specific Example of What You Can do with AJAX

Posted in AJAX at 1:43 am by admin

AJAX (Asynchronous JavaScript and XML) is a programming language that was developed to do a number of really cool things. While this example does not contain any AJAX code, at the same time it will show you a real life situation where you can apply the use of the AJAX programming that you are going to learn.

In order to understand this situation in which AJAX can be used, it is important to first understand the code below:

<html>
<body>

<form name=”myForm”>
Name: <input type=”text” name=”username” />
Time: <input type=”text” name=”time” />
</form>

</body>
</html>

Now, this is pretty simplistic code. It is HTML code that creates a standard form with two fields; one for the name and one for the time. However, what is deceptively simple about looking at this code is the fact that you can use AJAX to fill in one of these two fields. The key way to do this is through the use of the XMLHttpRequest object, a JavaScript object that is basically the reason for AJAX’s existence. Through the use of this particular object, you can actually get the server to find out the current time and display that time in the time field using the AJAX XMLHttpRequest.

The one exception to this rule would be Internet Explorer, since Microsoft always has to be different from everyone else! Microsoft, instead of using the XMLHttpRequest, actually uses an ActiveXObject, which basically means that when you are programming in AJAX you need to account for both Internet Explorer possibilities as well as possibilities for other browsers like Firefox, Opera, Safari and many others as well. Internet Explorer, however, is the only browser that does not use XMLHttpRequest, so as long as you have accounted for Explorer you are not going to have to worry about any of the other browsers.

The way to create these contingencies is through the use of what is known as a try and catch statement. You will first set up the XMLHttpRequest and then the ActiveXObject in case the catch is not successful in the first case. Every now and then, it is possible that you will encounter someone with a browser that is years and years out of date. If this is something that you think is likely to happen on your website, you might want to program another catch into the AJAX code that displays something on the blank screen letting the user know that their browser is not compatible with AJAX; however, that is entirely your choice.

Scriptycan is a great software repository featuring both free and commercial Ajax Scripts  and applications for developers and programmers.

11.06.07

JavaScript Variables

Posted in JavaScript at 12:30 pm by admin

In order to truly understand JavaScript you need to understand JavaScript variables.  A variable is a word or a string that is responsible for containing information that you want to store in the JavaScript code.  While the value of a variable can change during the script, you can also refer to the variable by the exact same name throughout the script once it has been initially defined.  There are only two rules for defining variables.

The first rule is that variable names are case sensitive.  This means that if you capitalise any letters in the variable name, it also means that you need to capitalise those letters elsewhere in the code for the computer to understand what you are talking about.

The second rule is that a variable defined in JavaScript must begin with the letter or the underscore character.  If you do not define your variables with either a letter or the underscore character at the start of the variable than the browser will not be able to recognize it as a variable.  As long as you stick to these two simple yet extremely important rules, you should have no problem defining various variables within your JavaScript code.

In order to illustrate these examples more clearly, let us take a look at a few simple variables as defined within the JavaScript code.

var strname = some value

This is an example of a variable that has been created through the use of the var statement.  While this is certainly a correct example of a way to create a variable in JavaScript, at the same time you will find that usually the var statement is not necessary.  In the above example, the same thing can be accomplished with the below piece of code.

Strname = some value

This might seem like splitting hairs to you, but when you are confronted with a complicated set of JavaScript code, you are going to be thankful if the person that programmed the code understood the concept of reducing redundancies in their variable statements.

Depending on where you declare your variables, they are either going to be local variables or global variables.  Local variables are defined within a specific JavaScript function and therefore when that function is over, the variables no longer apply.  Global variables, on the other hand, are defined outside of a function, meaning that all of the JavaScript functions on a single page can use them.  There is currently no easy method to define variables beyond a single page of functions, which is why Global variables are given that name.

Scriptycan is a great software repository featuring both free and commercial JavaScript scripts and applications for developers and programmers.

11.05.07

The World’s Simplest ASP Script

Posted in ASP Scripts at 7:03 am by admin

ASP is a language that is very similar to PHP, the only difference being that PHP is more of an open source deal, while ASP is a proprietary language that is owned by Microsoft. This is why you will find a lot more Microsoft products supporting ASP languages and allowing you to shortcut through ASP languages, because of course the company is simply attempting to protect and even promote its own language. If you already have a working language of PHP, then you are likely to be able to assimilate ASP pretty quickly as well.

In order to help you do that, let us do what we have done for countless other programming languages; create the simplest script imaginable and then use it to explain the basics of the specific language in question. Before we do this though, we have to introduce you to the basic syntax rule when it comes to ASP. ASP files contain a combination of HTML tags, delineated by <> and , but they also contain ASP scripts, which are delineated by <% and %>. These scripts, like PHP scripts, are executed on servers and return results in HTML code based on what the scripts are designed for.

So, without further ado, here it is; the world’s simplest ASP script:

<%
response.write(“Hello World!”)
%>

There you have it; about as simple as anything can get. If you have already dealt with learning other languages, then you are already undoubtedly aware of the significance of the Hello World example. In this simple ASP script, the words Hello World will appear on screen followed by an exclamation point.

The parts of the script are quite simple, yet also quite effective in allowing us to examine the script more closely. The <% and %> lines are for starting and ending the ASP script and indeed are only on different lines in order to accentuate their presence as well as maintain the standard formatting for different lines of code (i.e. having the starting and stopping parts of the code occupy their own lines in simpler coding structures).

The response.write aspect of the script is the same as the echo or the _e parts of the PHP script in that they simply return a value that is put into the quotations inside the conventional brackets and in the case of this specific script that value happens to be Hello World! These are the basics of how ASP scripts work.

Scriptycan is a great software repository featuring both free and commercial ASP scripts and applications for developers and programmers.

11.04.07

The AJAX XMLHttpRequest Object

Posted in AJAX at 9:21 am by admin

Before you start programming any actual AJAX code, you need to be aware of the fact that AJAX stands for asynchronous JavaScript and XML. This means that rather than being a new coding method for you to use, AJAX is instead a new way of using old coding commands. This means that if you know JavaScript or XML commands, then chances are that you are going to know exactly what to do in terms of commands to use with your AJAX Scripting.

The main problem with JavaScript and XML commands was that for the most part when they were initially unveiled to the world, they had extraordinary redundancies within them. For example, when you filled out a form online five years ago, you were probably amazed at how fast the computer was able to send that information to the person that managed the website. Now, however, you are probably sickened at how slow the process is. This is because the technology has advanced, but the JavaScript functions such as the ones governing forms are stuck firmly in the old world of scripting. They send a single request each time a button is clicked, causing a lower amount of user-friendliness as well as a slowdown in speed that is usually frustrating to the user.

When you are using AJAX, you have a way around it. It is known as the XMLHttpRequest object. This is an object that allows your JavaScript functions to communicate directly with the server your website is hosted on and therefore eliminates all of the problematic redundancies discussed in the previous paragraph.

Before the use of this script, what would happen when you clicked on a form button was that the form request would get sent with a POST data and the page would reload, usually with a thank you message for submitting your request. While that is certainly fine if you don’t mind waiting the extra few seconds, a faster way to do it would be through the use of the XMLHttpRequest. You can easily work this object into your code and instead of reloading the page, the object communicates directly with the server and therefore is able to return you a result without needing to reload the page.

If you want an everyday example of an XMLHttpRequest, then by all means have a look at Google Suggest. When you type into the search box, suggestions are returned to you through Google Suggest. This is, amazingly, done through a JavaScript code that is implanted through AJAX scripting syntax.

Scriptycan is a great software repository featuring both free and commercial Ajax Scripts and applications for both developers and programmers.  

11.03.07

Introduction to JavaScript

Posted in JavaScript at 5:34 am by admin

JavaScript is the premier scripting language on the Internet. It is the easiest way for programmers to do browser scripting. In order to be any kind of good Webmaster, you need to know how to use JavaScript. This oracle will introduce you to the most basic JavaScript imaginable.

Before we can start explaining how JavaScript works, you should see an example of JavaScript in work. The example below is the most basic JavaScript imaginable.

<Script type =”text/javascript”>
document.write(“Hello World!”)
</script>

Because of the words Hello World located with in the middle of the script, you have probably already guessed what this JavaScript is intended to do. Just in case you have not, this particular piece of JavaScript is intended to say the words Hello World on screen. In order to understand exactly how this piece of script works, it is important first to understand what each individual element of it does. In order to explain the, let us examine each individual line of code separately.

<script type=”text/javascript”>

This first line of script is not actually a JavaScript piece of code. It is a piece of HTML code. The main code being used here is the script code. The script code is responsible for letting the computer know that the upcoming lines of code are going to be JavaScript code.

document.write(“Hello World!”)

The second line of script is the actual JavaScript in this code. It is the line that is responsible for letting the browser know that the words Hello World need to be displayed in the browser, with the exclamation mark at the end. Ultimately, it is this line that represents what is actually happening in the actual coding world.

</script>

The final line closes the JavaScript at the end, letting the browser know that the JavaScript code is done for the moment. In other words, the <script> and </script> tags delineate a specific area within which JavaScript code is used. This code is used in order to let the document.write command be recognized as JavaScript, rather than be recognized as something else. If the <script> and </script> tags were not there, then the most likely resolution would have been that the words “document.write(“Hello World!”)” would actually have appeared in the browser, since it had no way of recognizing them as JavaScript rather than as text to be displayed. In the future, all JavaScript that you choose to include will need to be delineated with <script> and </script> tags.

Scriptycan is a great software repository featuring both free and commercial Java script scripts and applications for developers and programmers.