Validating a Textbox

<html>
<head>
<script type="text/javascript">
document.write("Validating a Text Box<BR>");
function validate_required(field,alerttxt)
{
with (field)
  {
  if (value==null || value=="")
    {
    alert(alerttxt);
    return false;
    }
  else
    {
    return true;
    }  }}
function validate_form(thisform)
{
with (thisform)
  {
  if (validate_required(email,"Email must be filled out!")==false)
  {
  email.focus();
  return false;}
  }
}
</script>
</head>
<body>
<form action="submit.htm" onsubmit="return validate_form(this)" method="post">
Email: <input type="text" name="email" size="30">
<input type="submit" value="Submit">
</form>
</body>
</html>

Advertisements

Detect Browser and its Parameters

<html>
<body>
<script type="text/javascript">
document.write("<p>Browser: ");
document.write(navigator.appName + "</p>");
document.write("<p>Browserversion: ");
document.write(navigator.appVersion + "</p>");
document.write("<p>Code: ");
document.write(navigator.appCodeName + "</p>");
document.write("<p>Platform: ");
document.write(navigator.platform + "</p>");
document.write("<p>Cookies enabled: ");
document.write(navigator.cookieEnabled + "</p>");
document.write("<p>Browser’s user agent header: ");
document.write(navigator.userAgent + "</p>");
</script>
</body>
</html>

Browser Detect in Java Script

<html>
<head>
<script type="text/javascript">
function detectBrowser()
{
var browser=navigator.appName;
var b_version=navigator.appVersion;
var version=parseFloat(b_version);
if ((browser=="Netscape"||browser=="Microsoft Internet Explorer")
  && (version>=4))
  {
  alert("You are having a Recent Browser!");
  }
else
  {
  alert("It’s time to upgrade your browser!");
  }
}
</script>
</head>
<body onload="detectBrowser()">
</body>
</html>

Alert, Confirm and Prompt in Javascript

 

<html>
<script type=text/javascript>
function alertFn()
{
alert("Welcome to my Website");
}
function confirmFn()
{
confirm("Please Select yes or no");
}

function promptFn()
{
prompt("Enter your Name", "Pradeepkumar");
}

</script>
<body onload="alertFn()">
<input type=button Value="Click" onclick="confirmFn()">
<input type=button value="Click Me" onclick="promptFn()">
</body>
</html>

BACKSLASH BACKLASH

Irritating slashes in URLs a mistake, says Tim Berner’s Lee

It has been one of the most enduring mysteries to have intrigued every web user. What is the point of the two forward slashes that sit infront of the “www” in every internet website address? 
    Tim Berners-Lee, the scientist who created the World Wide Web, has admitted his decision to include two forward slashes in internet addresses was a mistake. The // at the front of a web address was pointless and unnecessary, Tim admitted at a recent talk in the US. Tim, now director of the World Wide Web Consortium — which oversees the web’s development — that if he had his time over again he would leave them out of addresses. 
    “Really, if you think about it, it doesn’t need the //. I could have designed it not to have the //,” he said 
last week at the symposium in Washington DC on the future of technology, reports the Telegraph. “Boy, now people on the radio are calling it ‘backslash backslash’. 
    “Look at all the paper and trees that could have been saved if people had not had to write or type out those slashes on paper over the years — not to mention the human labour and time spent typing those two strokes millions of times in browser address boxes,” he added. AGENCIES

Source : Times of India

Introduction to Proc File System

  • The proc file system provides information on the current status of the Linux kernel and running process.
  • It also allows modifications of kernel parameters in simple ways during runtime
  • Each process in the system that is currently running is assigned a directory /proc/pid, where pid is the process identification number of the relevant process
  • There are also files and directories for process independent information such as loaded modules, used bus systems etc.

Disadvantages of Proc

  • There is no interface for the individual files, every user has to find out where and how the information that is required is hidden in the file
  • Another disadvantage is that all information is output as strings, therefore conversion is always necessary for further processing

Structure of File system

struct proc_dir_entry

{

unsigned short low_ino; //inode number

unsigned short namelen; //length of the name

const char *name; //name of the entry

mode_t mode; //mode

uid_t uid; //User ID

gid_t gid; //Group ID

unsigned long size; //size of the file

struct inode_operations *proc_iops; //inode-op

struct file_operations *proc_fops; //file-op

struct proc_dir_entry *next, *parent, *subdir; //connection

….

}

The above structure is as PD entry.

  • The pointer next, parent, subdir are used for linking. Next shows the next entry in the current directory, parent shows the parent directory (root directory), and subdir shows a subdirectory. This can be implemented like the following loop

for(de=de->subdir ; de; de=de->next){

…..

}

  • the file and the directory entries are lying under the /proc/ directory