1. XML

Summary:

XML (eXtensible Markup Language) will be the next language in Web programming. With its extra-power and extensibility, it's set to boost the Internet to the next level -- and overshadow HTML.

For many years the World Wide Web community has looked both longingly and fearfully at SGML. Longingly because the Web's HTML is based on SGML, and website developers need more of SGML than HTML can give them. Fearfully because the enormous power and flexibility of full SGML can be daunting to learn and implement. Which is what you might expect of an enterprise information technology that manages mission-critical Web-size document collections for industries and governments throughout the world.

Well, the World Wide Web Consortium has a solution, created during several years of work by an invited group of scores of the world's leading SGML experts. It's called XML, the eXtensible Markup Language and it can satisfy the longing for SGML without fear.

XML is a simplified subset of SGML that has been optimized for use on the World Wide Web. That sounds a lot like what you may have heard said of HTML but there's a very big difference:

And abstract structure is the gateway to the new web of smart data and electronic commerce.

Notes I:

Notes II: Example of an XML file:
<?XML version = "1.0" ?>
<!DOCTYPE DOCUMENT [
<!ELEMENT DOCUMENT (CUSTOMER)*>
<!ELEMENT CUSTOMER (NAME, DATE, ORDERS)>
<!ELEMENT NAME (LASTNAME, FIRSTNAME)>
<!ELEMENT LASTNAME (#PCDATA)>
<!ELEMENT FIRSTNAME (#PCDATA)>
<!ELEMENT DATE (#PCDATA)>
<!ELEMENT ORDERS (ITEM)*>
<!ELEMENT ITEM (PRODUCT, NUMBER, PRICE)>
<!ELEMENT PRODUCT (#PCDATA)>
<!ELEMENT NUMBER (#PCDATA)>
<!ELEMENT PRICE (#PCDATA)>
]>
<DOCUMENT>
  <CUSTOMER> 
    <NAME> 
      <LASTNAME>Edwards</LASTNAME> 
      <FIRSTNAME>Britta</FIRSTNAME> 
    </NAME> 
    <DATE>April 17, 1998</DATE>
    <ORDERS>
      <ITEM>
        <PRODUCT>Celery</PRODUCT> 
        <NUMBER>5</NUMBER> 
        <PRICE>$1.25</PRICE>
      </ITEM>
      <ITEM>
        <PRODUCT>Lettuce</PRODUCT> 
        <NUMBER>2</NUMBER> 
        <PRICE>$.98</PRICE>
      </ITEM>
    </ORDERS>
  </CUSTOMER> 
  <CUSTOMER> 
    <NAME> 
      <LASTNAME>Thompson</LASTNAME> 
      <FIRSTNAME>Frieda</FIRSTNAME> 
    </NAME> 
    <DATE>May 27, 1998</DATE>
    <ORDERS>
      <ITEM>
        <PRODUCT>Strawberry</PRODUCT> 
        <NUMBER>20</NUMBER> 
        <PRICE>$4.60</PRICE>
      </ITEM>
      <ITEM>
        <PRODUCT>Apple</PRODUCT> 
        <NUMBER>6</NUMBER> 
        <PRICE>$2.50</PRICE>
      </ITEM>
    </ORDERS>
  </CUSTOMER> 
</DOCUMENT>

2. Perl Networking

Perl provides native support for sockets and a module called Socket to smooth some of the rough edges associated with the native socket call. It turns out that there are still a large number of options to deal with, and since most applications use a fairly standard set of options we instead use a truly convenient module called IO::Socket, which is built on Socket.

We will build a sending and receiving program.

The following happens on tucotuco.

tucotuco.cs.indiana.edu% ./receiver &    
[1] 28757
tucotuco.cs.indiana.edu% Server started.
 
tucotuco.cs.indiana.edu% ./sender tucotuco.cs.indiana.edu 29805
Msg 1: How are you?
Msg 2: How are you?
tucotuco.cs.indiana.edu% Msg 3: How are you?
Msg 4: How are you?
Msg 5: How are you?
Msg 6: How are you?
Msg 7: How are you?
Msg 8: How are you?
Msg 9: How are you?
Msg 10: How are you?
 
tucotuco.cs.indiana.edu% 
tucotuco.cs.indiana.edu% ps
   PID TTY      TIME CMD
 28757 pts/13   0:01 receiver
 28502 pts/13   0:01 csh
tucotuco.cs.indiana.edu% 
The programs are:
tucotuco.cs.indiana.edu% pwd
/nfs/paca/home/user2/dgerman/perlN
tucotuco.cs.indiana.edu% ls -l
total 4
-rwxr-xr-x   1 dgerman  students     502 Dec  8 11:52 receiver
-rwxr-xr-x   1 dgerman  students     308 Dec  8 12:00 sender
tucotuco.cs.indiana.edu% more *    
::::::::::::::
receiver
::::::::::::::
#!/usr/bin/perl
 
use IO::Socket;
$sock = new IO::Socket::INET(
          LocalHost => 'tucotuco.cs.indiana.edu', # your host here 
          LocalPort => 29805,                     # your port here 
          Proto     => 'tcp', 
          Listen    => 5, 
          Reuse     => 1 
        ); 
die "Socket could not be created. Reason: $!" unless $sock; 
print "Server started.\n";
while ($new_sock = $sock->accept()) {
  while (defined ($buf = <$new_sock>)) {
    print $buf; 
  } 
}
close($sock); 
 
::::::::::::::
sender
::::::::::::::
#!/usr/bin/perl
 
use IO::Socket;
$sock = new IO::Socket::INET(
          PeerAddr => $ARGV[0], 
          PeerPort => $ARGV[1],
          Proto => 'tcp'
        );  
die "Socket could not be created. Reason: $!\n" unless $sock; 
foreach (1..10) {
    print $sock "Msg $_: How are you?\n"; 
}
close($sock); 
 
tucotuco.cs.indiana.edu%
Feel free to experiment with them.

The sender program can (and should) be run from another host, for example school.

3. Apache Access Control Based on Username and Password

Take

/u/dgerman/bin/htpasswd
and put it in your bin.
tucotuco.cs.indiana.edu% htpasswd -c /u/dgerman/httpd/passwd dgerman
Adding password for dgerman.
New password:
Re-type new password:
tucotuco.cs.indiana.edu% htpasswd /u/dgerman/httpd/passwd adrian
Adding user adrian
New password:
Re-type new password:
tucotuco.cs.indiana.edu% ls -l /u/dgerman/httpd/passwd
-rw-r--r--   1 dgerman  students      43 Dec  8 12:59 /u/dgerman/httpd/passwd
tucotuco.cs.indiana.edu% file /u/dgerman/httpd/passwd
/u/dgerman/httpd/passwd:        ascii text
tucotuco.cs.indiana.edu% cat /u/dgerman/httpd/passwd
dgerman:ePFse8ZfrQnf6
adrian:6B.33OYMWMSRU
tucotuco.cs.indiana.edu%
This is how you create and maintain password files.

Part II: Password Protecting Directories.

Change your access.conf file.

 <Directory /u/dgerman/httpd/htdocs/protected>
     AuthName       Protected 
     AuthType       Basic
     AuthUserFile   /u/dgerman/httpd/passwd
     <Limit GET POST>
        require user dgerman 
     </Limit>
 </Directory>
And that's it. Only dgerman has access now.