Tuesday, February 8, 2011

WEB PROGRAMMING LANGUAGES

CGI (Common Gateway Interface)

A Web daemon executes a CGI program on the server and returns the results to the client (e.g. a query against a database server), rather than simply returning a copy of the referenced file, as it does with an HTML reference. Parameters are passed from the server to the CGI program as environment variables. The program is sometimes written in C, C++, or some other compiled programming language, but more often it is written in a scripting language (e.g. Perl, Tcl, sh). To prevent damage to the server, CGI programs generally are stored in a protected directory under the exclusive control of the webmaster.


HyperTalk

HyperTalk is the English-like scripting language for Apple's HyperCard. It's described by its fans as similar to AppleScript, but simpler and more forgiving. Given the large number of HyperTalk-literate programmers in the Mac world, HyperTalk might very well be preferred by many over AppleScript and UserTalk for many web scripting tasks on the Mac.


Perl

Perl is described as a compiled scripting language. It combines elements of C with some Unix scripting and text manipulation languages (e.g. sh, awk, sed) into a more complete language that subsumes the functionality of all into one consistent whole, and is compilable, and, therefore faster than its forebears. Perl's advocates tout its ease of use when comparing it to Java, especially. One of the motivations in developing Perl was to provide an alternative to C for tasks that were a little too hairy for an existing Unix tool, or where performance was an issue. C was seen as unnecessarily low level, and C development too time consuming. Perl tries to delay the need to program at a a lower level. Its been very successful, especially among system administrators. Since CGI scripts are often built by systems folks, Perl is widely used for this, too.


Tcl

Tcl (tool command language) is a widely used scripting language generally used in conjunction with the Tk GUI library for building quick and easy X windows GUIs on Unix platforms, but also valued for the ease by which C libraries can be imported and referenced from Tcl. Tcl/Tk was developed by John Ousterhout while at UC Berkeley. Development continues at Sun Labs under his leadership. It's interesting to see this going on at Sun, also Java's home. Java is probably Tcl's principle competitor. John Ousterhout addresses this in The Relationship Between Tcl/Tk and Java. His point is that its true that both languages are appropriate to Internet programming, but they are different, have different strengths, and are likely to complement each other. Tcl is higher level, quicker to program, and slower to execute; Java is lower level, harder to program, quicker to execute. Tcl is mainly used to tie together other programs, generally written in C or C++. John expects Java to replace C++ in this role for Internet applications. This role puts Tcl in competition with Javascript.ors. Since CGI scripts are often built by systems folks, Perl is widely used for this, too.

Python

Python is an interpreted, object-oriented language developed as a full-featured, but easy to use, scripting language, by Guido van Rossum at CWI in the Netherlands. Initially developed in a Unix environment, Python is now available on PCs and Macs, and applications are portable across platforms. Python has developed a substantial, although still modest, following, as a scripting language, an application development language, and an embedded extension language. Python's design was most influenced by ABC, a little known language also developed at CWI. Python's syntax evokes C and C++, but doesn't stick too closely to those languages. Python fans tout its clear, intuitive syntax in comparison to C, C++, Java, Perl, shell languages, and most other interpreted languages, the completeness of its type system and its suitability for significant application development in comparison to Tcl , and its extensibility with Python and C/C++ libraries. Like Java, Perl and Tcl, Python offers a portable GUI library, several really. Perl advocates complain about the lack of regular expression matching and output formatting natively in Python. Perl is a little more of a sysadmin's shell language than Python, and Tcl is a little simpler and less capable. Python is more of a regular programming language, but simpler and easier to program than Java. But, all are suited to Internet programming. See Python Compared to Other Languages for a list of comparisons between Python and a variety of other languages. Safe-Python is a design for changes to add safety to Python. Grail is an web browser which supports the download and execution of Python applets in a safe Restricted Execution Mode. Grail uses the Tk GUI library.

(COMPARE)

Python is an excellent language for large or complex programming projects. Integral to programming in any language is making the code easy for the next programmer to read and maintain. It takes great effort to keep Perl and PHP programs readable. Where Perl gets unruly after 20 or 30 lines, Python remains neat and readable, making even the largest projects easy to manage.

For its readability, ease of acquisition, and extensibility, Python was recently chosen by MIT for students learning to program. In addition to readability and extensibility, Python offers much faster application development. For more on Perl vs. Python.


(SOURCE CODE)

*PHYTON


import win32com.client
def Hello():
import win32com.client
w=win32com.client.Dispatch("imacros")
w.iimInit("", 1)
w.iimPlay("SwitchProxy")
if __name__=='__main__':
Hello()


*PERL

use Win32::OLE;

$b = Win32::OLE->new('imacros') or die "iMacros Browser could not be started by Win32:OLE\n";
$b->{Visible} = 1;

#Start the iMacros Browser - Use iimInit("-ie"/"-fx") to start iMacros for IE/Firefox instead.
$b->iimInit();

#Calling an iMacros macro ie;yahoo.iim . Write a Simple iim script to goto www.yahoo.com
my $macro = "yahoo";

# PLEASE NOTE: if you want to pass iMacros a path to a macro, rather than the name of a macro that resides in default folder,
# the path should be passed in this format:
# 'C:\\Documents and Settings\\username\\My Documents\\Client scripts\\Perl\\iim.iim';
# I.e. "\\" should be used as a path delimeter


*TCL

package require tcom

set application [::tcom::ref createobject "imacros"]

No comments:

Post a Comment