What Is a Function?

You can think of a function as an input/output machine. This machine takes the raw
materials you feed it (input) and works with them to produce a product (output). A function
accepts values, processes them, and then performs an action (printing to the browser,
for example), returns a new value, or both.

How do you convert the while statement you created in question 3 into a for statement?

$num = 1;
while ($num <= 49) {
echo $num.”<br />”;
$num += 2;
}

JavaScript Form Validation

 JavaScript Form Validation. JavaScript can be used to validate data in HTML forms


<script type="text/javascript">
function validate_all()
    {
    var frmReg=document.manageadmin;
  
  
  
    if(frmReg.name.value.search(/\S/) == -1)
        {
            alert("Please enter name.");
            frmReg.name.focus();
            return false;
        }
  
  
    if(frmReg.textEmail.value.search(/\S/) == -1)
        {
            alert("Please enter Email.");
            frmReg.textEmail.focus();
            return false;
        }
  

Embedding Content for Plug-Ins

Although never officially a part of any HTML specification, the <<embed>> tag is most often used to include embedded objects for Netscape and Internet Explorer. A Macromedia Flash file might be embedded as follows:
 
 
<<embed id="demo" name="demo"
 src="http://www.javascriptref.com/examples/ch18/flash.swf"
 width="318" height="252" play="true" loop="false"
 pluginspage="http://www.macromedia.com/go/getflashplayer"
 swliveconnect="true">><</embed>>
 
The most important attributes of the <<embed>> tag are src, which gives the URL of the embedded object, and pluginspage, which indicates to the browser where the required plug-in is to be found if it is not installed in the browser. Plug-in vendors typically make available the embedding syntax, so check their site for the value of pluginspage.
Recall that applets embedded with <<object>> tags are passed initial parameters in <<param>> tags. The syntax of <<embed>> is different in that initial parameters are passed using attributes of the element itself. For instance, in the preceding example the play attribute tells the plug-in to immediately begin playing the specified file.
The <<object>> element is the newer, official way to include embedded objects of any kind in your pages. However, <<object>> is not supported in Netscape browsers prior to version 4, and <<embed>> continues to be supported by new browsers. So it is unlikely that <<object>> will completely supplant <<embed>> any time in the near future.
 

Remote JavaScript

The primary reason is that the round trip time required to submit a form and then download the response is often inconvenient. The user experience is much improved if, instead of clicking a Submit button and watching the screen go blank and then be replaced by the response of a server-side program, a user can click a button and have the page be updated without a visible form submission. To the user, the page would behave more like an application than a Web page. 

There are other advantages as well. If communication with a server can be done behind the scenes instead of using form submissions or clicking on links, the developer can carry out more complicated tasks requiring multiple server requests at once. The ability to use remote JavaScript also means that tasks that previously required an ActiveX object or Java applet can be implemented with script. This is a tremendous timesaver for the developer and also reduces the complexity of debugging significantly. 

The abstraction that remote JavaScript brings to life is the remote procedure call. A remote procedure call (RPC) is a function that executes on a remote machine, in this case a Web server. The client, in this case our browser using JavaScript, passes arguments to the “function” it wishes to call via an HTTP request; the server executes the specified function, often implemented as a CGI program or server-side script in PHP or a similar language, and returns the results as the body of the HTTP response. It’s important to remember that while JavaScript is used to make the function call and often to handle the return value, the function itself executes on the server, and therefore can be implemented as a CGI, PHP script, Java servlet, or using any other technology a Web server might have available.

mkdir and rmdir

You can create and remove directories using the mkdir and rmdir system calls.

#include <sys/types.h>
#include <sys/stat.h>
int mkdir(const char *path, mode_t mode);


The mkdir system call is used for creating directories and is the equivalent of the mkdir program. mkdir
makes a new directory with path as its name. The directory permissions are passed in the parameter
mode and are given as in the O_CREAT option of the open system call and, again, subject to umask.

#include <unistd.h>
int rmdir(const char *path);

The rmdir system call removes directories, but only if they are empty. The rmdir program uses this
system call to do its job.

The Shell as a Programming Language

Now that you’ve seen some basic shell operations, it’s time to move on to some actual shell programs. There
are two ways of writing shell programs. You can type a sequence of commands and allow the shell to execute
them interactively, or you can store those commands in a file that you can then invoke as a program.
Interactive Programs
Just typing the shell script on the command line is a quick and easy way of trying out small code fragments,
and is very useful while you are learning or just testing things.

What Is a Shell?

Before jumping in and discussing how to program using a shell, let’s review the shell’s function and the
different shells available for Linux. A shell is a program that acts as the interface between you and the Linux
system, enabling you to enter commands for the operating system to execute. In that respect, it resembles the
Windows command prompt, but as mentioned earlier, Linux shells are much more powerful. For example,
input and output can be redirected using < and >, data piped between simultaneously executing programs
using |, and output from a subprocess grabbed by using $(...). On Linux it’s quite feasible to have multiple
shells installed, with different users able to pick the one they prefer.

You can check the version of bash you have with the following command:
$ /bin/bash --version
GNU bash, version 3.2.9(1)-release (i686-pc-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.

RSVP

Resource Reservation protocol is used to reserve resources across a network. It is used for requesting a specific Quality of Service (QoS) from the network.


RSVP is a signalling protocol for the internet. RSVP stands for bandwidth 
reservation protocol. This protocol allows application to reserve bandwidth for their 
data flows.

What is the use of PEAR in php?

PEAR is known as PHP Extension and Application Repository. It provides structured library to the PHP users and also gives provision for package maintenance.