Archive for the ‘Web-based’ Category

There is no doubt that Java is my favorite programming language. On the client side, I coded a lot of Java Applet program. Nowadays, nobody use Java applets maybe they are slow and are not easy to code.

Java applet was first graphics and powerful client side program which you can embed inside your HTML page. Of course running java byte codes takes a little time but they had some advantages though.

I created some java applet which are developed by Visual Café or Visual Café for Java.

It was an integrated development environment for the Java programming language. It included a GUI builder and was marketed as a series of editions: ”Standard Edition,” “Enterprise Suite,” “Expert Edition,” “Professional Edition,” and “Development Edition.” Visual Café was spun off by Symantec as the flagship of a new company, WebGain.

 

Anyway, here are some my java applets:

 

The perl script language stands for Practical Extraction and Report Language, this is my first server side script language I used to create dynamic HTML page (I think it was 1997).

As you know Perl like PHP is an essential script language which is included in all web servers especially in linux or unix based web servers.

Perl has become popular for programming and developers  for web forms and generally creating dynamic web pages and gateway between systems, databases, and users.

Perl is typically implemented as an interpreted (not compiled) language.

Programs written in Perl are often called Perl scripts, especially in the context of CGI programming, whereas the term the Perl program refers to the system program named perl for executing Perl scripts.

Learning Perl is not difficult for who knows C and Pascal language. In fact, Perl syntax is a combination of  C and Pascal language.

Perl is an excelent language for text/string processing.  I created an Database engine with this amazing language. It works great with array and files.

 

Some of my perl programs (1997-1998):

1) Page counter:

#!/usr/bin/perl

#=======> Counter Program 
#=======>  By
#=======>     Homayoon Najafi

$number_of_digits = "";
$end = ".gif";

$pathtocounter = "counter.txt";
$pathtoimages = "http://www.XXCoveredXX.com/counter/";

open (COUNTER, $pathtocounter) || die "Cannot Open(Homayoon 1):$!";

flock(COUNTER,2);
$count = <COUNTER>;
flock(COUNTER,8);
# chop ($count) if $count =~ /\n$/; ==> HN
close (COUNTER);

$count++ ;
if($count==1){$count=29918;}

open (COUNTER, ">$pathtocounter") || die "Cannot Open(Can't open file....by Homayoon ):$!";
flock(COUNTER,2);
print COUNTER "$count";
flock(COUNTER,8);
close (COUNTER);

@digits = split(//, $count);

@digitimages = split(//, $count);

print ("Content-type: text/html\n\n");

foreach $digitimage (@digitimages)
 {
 $image = "<img src=$pathtoimages" . "$digitimage" . "$end "."ALT=$digitimage>\n";
 print ("$image");
 }
exit;

2) Form input: Getting user email address

#!/usr/local/bin/perl

#====> Getting E-mail Program by Homayoon Najafi (8 April 1998)

$buffer=$ENV{'QUERY_STRING'};

@pairs=split(/&/,$buffer);
foreach $pair (@pairs) 
 {
($name,$value)=split(/=/,$pair);
$value=~tr/+/ /;
$value=~s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
$FORM{$name} = $value;
}

print "Content-type: text/html\n\n";
print "<html><head><title>Thanks for Adding Your Email</title></head><body>\n";
print "<center><p>Thanks for Adding Your Email: $FORM{'email'} </p></center>\n";
print "<HR>\n";
print "<center><p><a href=http://www.XXCoveredXX.com>Back to Iran Export Home Page</a></p></center>\n";
print "</body></html>\n";

open (My,"| /usr/lib/sendmail payam\@www.XXCoveredXX.com") || die "Can't open (sendmail)!!\n" ;
print My "Subject: A New E-mail Address from Home Page\n\n";
print My "=========================================\n";
print My "Remote Host(IP Address): $ENV{'REMOTE_HOST'}\n";
print My "E-mail Address: $FORM{'email'}\n\n";
close My;

3) HS code listing

#!/usr/bin/perl

 #====> Record Manager Program <========#

#====>          HS-Code Program for Home Page
#====>   Program file : hs-show.pl
#====> Created by Homayoon Najafi (Start 20 Aug 1998 )

#=====> Form Variable:
#=====> Code: %28rt23%2434%29 ===> (rt23$34) 

#===> Set Variables 

$CompaniesFileName='a_com.txt';   #====> Main Group of Companies
$Other_ComFileName='b_com.txt';   #====> Other Group of Companies
$HSGroupFileName='hs-group.txt';  #====> HS-Group Table

$BaseAdd='http://www.XXCoveredXX.com/exporter/company/';
$TotalRecords;
$TotalOtherRecords;
$TotalFound;

$HSID;

@Companies;
@Other_Com;
@HSGroup;
@HSFields;

@ListGroupA; #===> Array of Result for Compnay's A Group
@ListGroupB; #===> Array of Result for Compnay's B Group 

$HSID=$ENV{'QUERY_STRING'};     #====> For get method...

#===> Reading Data Files

#=====> Reading Data from Company file

 open (DATA,$CompaniesFileName);
 @Companies=<DATA>; 
 $TotalRecords=@Companies; #=====> TotalRecords....
 close DATA;

 open (DATA,$Other_ComFileName);
 @Other_Com=<DATA>;
 $TotalOtherRecords=@Other_Com;
 close DATA;

#=====> Reading Data from HS-Group file

open (DATA,$HSGroupFileName);
@HSGroup=<DATA>;
close DATA;

#====================> End of Reading Files

#===> Getting List of A Companies from Hs-group File..
@HSFields=split(/#/,$HSGroup[$HSID-1]); 
if($HSFields[3] != '')
{
@ListGroupA=split(/,/,$HSFields[3]);
}

#===> Getting List of B Companies from Other_ComFileName File..

$i=0;
foreach $Record (@Other_Com) 
 {
 if($i>99) {last;}
 @Fields=split(/#/,$Record);
 @ListHS=split(/,/,$Fields[1]);
 foreach $key (@ListHS) 
 {
 if ($key eq $HSID)
 {
 $ListGroupB[$i]=$Fields[0];$i++;
 }
 }
 }

$TotalRecords=@ListGroupA;
$TotalOtherRecords=@ListGroupB;
$TotalFound=$TotalRecords+$TotalOtherRecords;
exit;
#==============> Showing Results of Search <============#

#~~~~~~~~~~~~~~~~~~~~~~> HTML Routines ~~~~~~~~~~~~~~~~~~~~~~~~#

#=============> Show Body of HTML File (Results of Search...)

 #=========> End of Query Program <============#

Lets start with sample code to learn how to start coding:

<?php

echo “Hello world!”;

?>

 

An web based application is like computer program but web server runs it and browser is an interface between user and program.

 

JavaScript is one of my favorite script (over 10 years).  Javascript is client-side language in web applications world.

Actually is not a version of Java, but the syntax is very similar to Java language. In fact, Java and JavaScript are two completely different languages in both concept and design!

JavaScript was invented by Brendan Eich at Netscape (Navigator 2.0), and has appeared in all browsers since 1996.

Note: Client Browsers run JavaScript code.

 

JavaScript, also known as ECMAScript, is a prototype-based, object-oriented scripting language that is dynamic, weakly typed and has first-class functions. (see http://en.wikipedia.org/wiki/JavaScript)

Good resource for learning JavaScript: w3schools

ASP or Active Server Pages is a server side script MS technology, We call it ASP classic. here are some briefly information:

 

  • ASP is a script or program that runs inside ms web server or IIS ( Internet Information Services )
  • ASP programs have .asp extension
  • In ASP, an interpreter like JavaScript  is used to execute the server-side code
  • ASP is different from ASP.NET
  • ASP is running under the inetinfo.exe (IIS) process space

Ajax an acronym for Asynchronous JavaScript and XML ….

scripts

programming