This commit is contained in:
gferg 2001-12-13 14:31:16 +00:00
parent e5d3833e55
commit 3fe13a526b
4 changed files with 535 additions and 108 deletions

View File

@ -42,7 +42,7 @@ C++ Programming HOW-TO
<author>Al Dev (Alavoor Vasudevan)
<htmlurl url="mailto:alavoor@yahoo.com"
name="alavoor@yahoo.com">
<date>v40.4, 19 Sep 2001
<date>v40.5, 12 Dec 2001
<abstract>
This document provides a comprehensive list of C++ URL
pointers, links to C++ online textbooks, and programming tips on C++.
@ -106,8 +106,8 @@ a textbook on C++ for reference from online bookstores like
<p>
C++ is one of the most powerful language and will be used for a long time in the future
inspite of emergence of Java. C++ runs <bf>extremely fast</bf> and is
in fact <bf> 10 to 20 times FASTER than </bf> Java. Java runs very slow
because it is a byte-code-interpreted language running on top of "virtual machine".
in fact <bf> 10 to 20 times FASTER than </bf> Java.
Java byte-code is slower when running in a VM than the equivalent natively compiled code.
Java runs faster with JIT (Just-In-Time) compiler, but it is still slower than C++. And optimized
C++ program is about <bf>3 to 4 times faster</bf> than Java (with JIT compiler).
Then, why do people use Java? Because it is pure object oriented and is
@ -128,23 +128,19 @@ and tips to reduce the debugging time.
-->
<sect1>Which one Ada95, "C", "C++" or Java ??
<sect1>Which one Ada95, "C", "C++", Java or PHP ??
<p>
Language choice is very difficult. There are too many parameters - people, people skills,
cost, tools, politics (even national politics) and influence
of businessmen/commercial companies.
The best language based on technical
merits does not get selected simply due to political decisions!
The best language based on technical merits does not get selected simply
due to political decisions!
Java is much closer to Ada95 than C++. Java is derived from Ada95.
Ada95 gets the maximum points as per David Wheeler's
See the language comparison chart of David Wheeler at
<url name="Ada comparison chart" url="http://www.adahome.com/History/Steelman/steeltab.htm">.
Ada got 93%, Java 72%, C++ 68% and C got 53%. C++ and Java
are closer in points(only 4% difference), hence Java <bf>is not</bf> a very big revolution
as compared to C++. On other hand, Ada is a very big revolution and improvement over C++.
The scores are like 4 students taking exams
and student with highest score is Ada (93%). Who knows? Perhaps in
future Ada95 will replace Java!!
are closer in points (only 4% difference), hence Java <bf>is not</bf> a very big revolution
as compared to C++.
Development costs of Ada is half of C++ as per
<url name="Stephen F. Zeigler" url="http://sw-eng.falls-church.va.us/AdaIC/docs/reports/cada/cada_art.html">.
Ada95 is available at -
@ -153,10 +149,7 @@ Ada95 is available at -
<item> Google <url name="Ada index" url="http://directory.google.com/Top/Computers/Programming/Languages/Ada">
</itemize>
Since C++ programmers are abundant, it is recommended you do programming
in object-oriented "C++" for all your
application programming or general purpose programming. You can take full
advantage of object oriented facilities of C++. The C++ compiler is lot
The C++ compiler is lot
more complex than "C" compiler and C++ programs may run bit slower than "C"
programs. But speed difference between "C" and "C++" is very minute - it
could be few milli-seconds which may have little impact
@ -165,8 +158,7 @@ Since computer hardware is becoming cheaper and faster and memory
'RAM' is getting faster and cheaper, it is worth doing code in C++ rather than
"C" as time saved in clarity and re-usability of C++ code
offsets the slow speed.
Compiler optimizer options like -O or -O3 can speed up C++/C
which is not available in Java.
Use compiler optimizer options like -O or -O3 to speed up C++ or C programs.
Nowadays, "C" language is primarily used for "systems programming" to develop
operating systems, device drivers etc..
@ -176,28 +168,30 @@ given in this howto, you can code in C++ which "exactly" looks like Java.
This document tries to close the gap between C++ and Java, by imitating Java
classes in C++</it></bf>
If you want to bypass edit-compile-debug-compile cycle of C++ then
see scripting languages like PHP which can be used for general purpose programming.
Scripting languages like PHP, PERL enable rapid application development. PHP has some
features of object-oriented programming.
PHP is at <url url="http://www.linuxdoc.org/HOWTO/PHP-HOWTO.html">.
Java is platform independent language more suitable for developing GUI running
inside web-browsers (Java applets) but runs very slow. Prefer to
use web-server-side programming "Fast-CGI" with C++ and HTML, DHTML,
inside web-browsers (Java applets) but it runs very slow.
You should prefer to
use web-server-side programming with PHP, HTML, DHTML,
XML to get better performance. Hence, the golden rule is <it>"Web-server side programming
use C++ and web-client side (browser) programming use Java applets"</it>.
use PHP and web-client side (browser) programming use Java applets"</it>.
The reason is - the server-side OS (Linux) is under your control
and never changes, but you
will never know what the client side web-browser OS is. It can be Internet appliance device (embedded linux+netscape) or computers running Windows 95/98/NT/2000
will never know what the client side web-browser OS is. It can be
Internet appliance device (embedded linux+netscape) or computers running Windows 95/98/NT/2000
or Linux, Apple Mac, OS/2, Netware, Solaris etc..
The advantage of Java language is that you can
create "Applets (GUI)" which can run on any client OS platform.
Java was created to replace the Microsoft Windows 95/NT GUI APIs like
MS Visual Basic or MS Visual C++.
In other words - "Java is the cross-platform Windows-GUI
API language of next century".
Many web-browsers like Netscape supports Java applets and web-browser like
Hot Java is written in java itself.
But the price you pay for cross-platform
portability is the performance, applications written in Java run very slow.
Hence, Java runs on "client" and C++ runs on servers.
Hence, Java runs on "client" and PHP/C++ runs on servers.
<!--
*******************************************
************ End of Section ***************
@ -379,7 +373,7 @@ string class by simply inheriting from these string classes -
<item> String class given in this document
<ref id="Appendix A" name="Appendix A String.h">
<p>
<item> GNU string class
<item> Standard C++ Library String class (GNU string class implementation)
<itemize>
<item> GNU C++ Library - Univ of Tech, Sydney
<url url="http://www.socs.uts.edu.au/doc/gnuinfo/libg++/libg++_18.html"> and
@ -395,11 +389,13 @@ string class by simply inheriting from these string classes -
<url name="user's guide" url="http://www.math.utah.edu/docs/info/libg++_toc.html">
</itemize>
<p>
<item> Qt String class at <url url="http://doc.trolltech.com/qstring.html">
<item> ANSI string class (ISO string class) at <url url="http://www.msoe.edu/eecs/cese/resources/stl/string.htm">
<p>
<item> If you are using Qt external library then see Qt String class at <url url="http://doc.trolltech.com/qstring.html">
mirror at
<url url="http://www.cs.berkeley.edu/~dmartin/qt/qstring.html">
<p>
<item> If none of these alternatives are suitable, you can build
<item> If none of these are suitable, you can build
your own string class. You can start with one or more of the
pre-built classes listed above (by using single or multiple inheritance.)
</itemize>
@ -416,7 +412,8 @@ pre-built classes listed above (by using single or multiple inheritance.)
As mentioned above, you can build your own custom string class from the
pre-built classes by single or multiple inheritance. In this section
we will build a sample custom string class by using multiple inheritance,
inheriting from the GNU string class and the string class presented in Appendix H.
inheriting from the GNU string class (Standard C++ Library) and
the string class presented in Appendix H.
Start by downloading the sample file 'string_multi.h' from
<ref id="Appendix A">
@ -1253,7 +1250,7 @@ in all the files where you do include String.h, insert these lines:
#include "ConflictingString.h" // This also has String class...
// All your code goes here...
main()
int main()
{
String_somethingelse_which_I_want aa;
String bb; // This string class from conflicting string class
@ -1713,13 +1710,14 @@ mirror <url name="JavaNotes" url="http://matrix.mvhs.fuhsd.org/~deruiter/javanot
<chapt> C++ Coding Standards
<chapt> C++ Coding Conventions
-->
<sect> C++ Coding Standards
<sect> C++ Coding Conventions
<p>
Coding standard is very essential for readability and maitainence of programs. And
it also greatly inproves the productivity of the programmer. The GNU
C++ compiler <bf>must enforce</bf> coding discipline. The following is suggested -
Coding convention is very essential for readability and maintenance of programs. And
it also greatly inproves the productivity of the programmer.
Coding convention is required for good coding discipline.
The following is suggested -
inside class definition:
<itemize>
<item> All public variables must begin with <bf>m</bf> like <bf>mFooVar</bf>.
@ -1738,10 +1736,7 @@ uppercase after <bf>m</bf> like F in <bf>mFooVar</bf>.
<item>Private variables <bf>mvpFooVar</bf> and methods with v like vFooNum()
</itemize>
</itemize>
The compiler should generate error if the code does not follow above standard.
The C++ compiler can provide a flag option to bypass strict coding standard to compile
old source code, and for all new code being developed will follow the
uniform world-wide coding standard.
Uniform world-wide coding convention for C++ language will help better programming.
In the sample code given below <bf>t</bf> stands for <bf>protected</bf>,
<bf>v</bf> stands for <bf>private</bf>,
@ -2407,9 +2402,9 @@ says how many elements there are in the vector. What will be printed out by the
<code>
<vector-size.cc>=
#include <iostream.h>
#include <vector.h>
#include <vector> // vector.h
void main()
int main()
{
vector<int> v1;
vector<int> v2(10);
@ -2428,9 +2423,9 @@ and false prints as 0)?
<code>
<vector-empty.cc>=
#include <iostream.h>
#include <vector.h>
#include <vector> // vector.h
void main()
int main()
{
vector<int> v1;
vector<int> v2(10);
@ -2499,10 +2494,10 @@ Here is a simple example of the use of [].
<code>
<vector-access.cc>=
#include <vector.h>
#include <vector> // vector.h
#include <iostream.h>
void main()
int main()
{
vector<int> v1(5);
int x;
@ -2538,9 +2533,9 @@ structure for which they are more efficient.
<code>
<vector-mod.cc>=
#include <iostream.h>
#include <vector.h>
#include <vector> // vector.h
void main()
int main()
{
vector<int> v;
@ -2634,9 +2629,9 @@ Here is an illustration of how to use iterators with vectors.
<code>
<vector-iterator.cc>=
#include <iostream.h>
#include <vector.h>
#include <vector> // vector.h
void main()
int main()
{
vector<int> v(10);
first is ``less'' than the second
@ -2693,10 +2688,10 @@ The following code illustrates the third example above.
<code>
<vector-comp.cc>=
#include <vector.h>
#include <vector> // vector.h
#include <iostream.h>
void main()
int main()
{
vector<int> v1;
vector<int> v2;
@ -2788,7 +2783,7 @@ note that the set's contents are printed out in ascending order even though they
#include <iostream.h>
#include <set.h>
void main()
int main()
{
set<int, less<int> > s;
set<int, less<int> >::iterator i;
@ -2833,7 +2828,7 @@ public:
};
// This can be used with any T for which * is defined.
void main()
int main()
{
// Create some function objects.
square<double> f1;
@ -2911,7 +2906,7 @@ public:
{ return (c1.field2() < c2.field2()); }
};
void main()
int main()
{
set<myClass, less<myClass> > s1;
set<myClass, less<myClass> >::iterator i;
@ -3006,7 +3001,7 @@ arguments, empty() returns true or false and size() returns an integer.
#include <set.h>
#include printset.h
void main()
int main()
{
set<int, less<int> > s;
@ -3047,7 +3042,7 @@ Two sets may be checked for equality by using ==. This equality test works by te
#include <set.h>
#include printset.h
void main()
int main()
{
set<int, less<int> > s1, s2 ,s3;
@ -3102,7 +3097,7 @@ The following example illustrates these various forms.
#include <set.h>
#include printset.h
void main()
int main()
{
set<int, less<int> > s1;
@ -3198,7 +3193,7 @@ Which might be used as follows.
#include printset.h
#include setmember.h
void main()
int main()
{
set<int, less<int> > s;
for (int i= 0; i<10; i++) s.insert(i);
@ -3278,7 +3273,7 @@ Here is an example illustrating all these operations.
#include <iterator.h>
#include printset.h
void main()
int main()
{
typedef set<int, less<int> > intSet;

View File

@ -42,7 +42,7 @@ C-C++ Beautifier HOW-TO
<author>Al Dev (Alavoor Vasudevan)
<htmlurl url="mailto:alavoor@yahoo.com"
name="alavoor@yahoo.com">
<date>v15.2, 12 Oct 2001
<date>v15.3, 10 Dec 2001
<abstract>
This document will help you to format (beautify) the C/C++ programs so
that it is more readable and confirms to your site C/C++ coding standards.
@ -106,6 +106,9 @@ and site at <url url="http://users.erols.com/astronaut/vim/#vimlinks_src">
<item> GC! GreatCode! is a powerful C/C++ source code beautifier
Windows 95/98/NT/2000 <url url="http://perso.club-internet.fr/cbeaudet">
<item> CbVan for C, C++ and Java at <url url="http://www.geocities.com/~starkville/main.html">
<item> Artistic Style beautifier for C, C++, Java at
<url url="http://sourceforge.net/projects/astyle">
<url url="http://astyle.sourceforge.net">.
</itemize>
I used BCPP to format the C++ programs and it worked fine for me. You
may want to check other tools and use the one which you may like the most.
@ -229,6 +232,7 @@ HTML, SQL, Java, Perl, Fortran.
<item> Java beautify <url name="percolator" url="http://www2.blaze.ca/~jspeton/percolator">
<item> Java list <url url="http://www.java.about.com/compute/java/library/weekly/aa102499.htm">
<item> Java html present <url name="VasJava2HTML" url="http://www.chez.com/vasile/java2/VasJava2HTML.html">
<item> Java code colorifier and beautifier <url url="http://www.mycgiserver.com/~lisali/jccb">
<p>
<item> Perl : <url url="http://www.consultix-inc.com/www.consultix-inc.com/talk.htm">
<item> Perl : <url url="http://www.consultix-inc.com/www.consultix-inc.com/perl_beautifier.html">

View File

@ -52,7 +52,7 @@ DISKLESS NODES HOW-TO for Linux
<htmlurl url="mailto:gero@gkminix.han.de"
name="gero@gkminix.han.de">
<date>v22.3, 08 Nov 2001
<date>v22.4, 12 Dec 2001
<abstract>
This document describes how to set up a diskless Linux box.
As technology is advancing rapidly, network-cards are becoming cheaper and much
@ -118,7 +118,7 @@ done! For details see the "Live Linux CDROM" chapter in this document.
The other option is using a EPROM, but this will
take extra work to be done on the client and the server box.
If you want to go for EPROM method, I recommend you to
simply buy Diskless Linux computers from the manufacturers as given later.
simply buy Diskless Linux computers from the manufacturers as given in the following chapters.
<!--
*******************************************
************ End of Section ***************
@ -136,8 +136,8 @@ be the product of this century and in the next century.
The diskless linux computers will be very successful because of the
availability of very high-speed network cards at
very low prices. Today 100 Megabit
per second (12.5 MB per sec transfer rate) network cards are
common and in about 1 to 2 years 1000 MBit (125 MB per sec transfer rate)
per second (11.92 Megabytes per sec transfer rate) network cards are
common and in about 1 to 2 years 1000 MBit (119.2 Megabytes per sec transfer rate)
network cards will become very cheap and will be the standard.
In near future, Monitor manufacturers will place
@ -148,6 +148,15 @@ have outlet for mouse, keyboard, network RJ45 and power supply.
The following are benefits of using diskless computers -
<itemize>
<item> Sharing of central server RAM memory by many diskless computer users.
For example, if many users are using a web browser then in the server RAM there will
be only one copy of web browser in the RAM. In case Windows 95 PCs, many
users need to have individual copy of web browser
in local RAM and hence there is wastage of RAM space.
Since the RAM in server is "shared" by hundreds of diskless clients, this will be a
huge savings in the cost of memory.
You can pool the RAM memory by shifting memory from clients to server.
<p>
<item> Diskless Linux computers can run BOTH MS Windows 95/NT and linux programs.
<p>
<item> Total cost of ownership is very low in case of Diskless computers.
@ -184,12 +193,6 @@ Fault tolerance of hard disk failure is possible by using RAID on main server.
<item> Server can have 64 bit CPU SMP box having many CPUs or even
linux super-computers. CPU power can be shared by many diskless computer users
<p>
<item> Sharing of central server RAM memory by many diskless computer users.
For example, if many users are using a web browser then in the server RAM there will
be only one copy of web browser in the RAM. In case Windows 95 PCs, many
users need to have individual copy of web browser
in local RAM and hence there is wastage of RAM space.
<p>
<item> Diskless computers are extremely fast because program loading time is
completely eliminated. For example, if the server loads the StarOffice suite
into memory due to request from one diskless user then if another diskless user wants to
@ -217,7 +220,8 @@ parallel ports, serial ports etc..
RAM and low-cost CPU. The server has lots of memory and many powerful CPUs.
<p>
<item> Can operate in places like factory floor where a hard disk might be too fragile.
<p>
<item> Diskless nodes work even on wide area network.
</itemize>
<!--
*******************************************
@ -292,6 +296,35 @@ drives from different vendors. The top speed CDROM drive is from Kenwood at
************ End of Section ***************
*******************************************
Problem: Swap over NFS may not work (as per man swapon)???
<sect1> Low Memory on Diskless Node
<p>
If your diskless node has very low memory, say less than 16 MB then boot the
Live Linux in command line console mode and setup the NFS and mount the hard disk
partition of the main Linux server. After mounting remote hard disk with NFS,
setup a swap file on the NFS mount point.
To setup a swap file, it is necessary to create that file before initializing it
with mkswap.
Note that a swap file must not contain any holes (so, using cp to create the
file is not acceptable).
<code>
bash$ su - root
bash# man mkswap
Assuming that remotelinux hard disk is mounted on /mnt/remotelinux
bash# cd /mnt/remotelinux
bash# dd if=/dev/zero of=swapfile bs=1024 count=65536
bash# man swapon
bash# swapon
</code>
-->
<!--
*******************************************
************ End of Section ***************
*******************************************
-->
<sect1> Build a Live Linux CDROM
<p>
@ -491,8 +524,6 @@ Assuming that you've got cdrecord installed and configured for your cd-writer ty
Boot the cd and test it
Well the title of this paragraph says it all;)
<!--
*******************************************
************ End of Section ***************
@ -546,6 +577,77 @@ interested in reading this entire document.
<chapt> Internet Cafe and Financial Banking with "Diskless Linux" <label id="internetcafe">
-->
<sect> Internet Cafe and Financial Banking with "Diskless Linux" <label id="internetcafe">
<p>
You can set up Internet Cafe with diskless Linux.
Internet cafes are immensely popular in developing countries like India, Thailand, China.
In India Internet cafes are also serving as financial banking centers where people
go to pay bills, trade stocks, transfer money and do online banking.
<!--
*******************************************
************ End of Section ***************
*******************************************
-->
<sect1> Setup IP Masquerading, IP Netfilter and Squid
<p>
To connect the diskless nodes to the Internet, you should setup the IP Masquerading
on the main Linux server which is connected to the Internet. The main Linux server
will act like a proxy server for the diskless nodes.
<bf>Configure Firewall and IP Masquerading : </bf>
For Linux kernel version 2.4 and above, the firewall and IP Masquerading is
implemented by NetFilter package. Hence in kernel config you should enable
Netfilter and run the Firewall/IPMasq script. Download the scripts from
<url name="Firewall-IPMasq scripts" url="http://www.BoingWorld.com/workshops/linux/iptables-tutorial">
, main page of Netfilter is at
<url url="http://netfilter.samba.org">.
Related materials at <url name="firewalling-matures" url="http://www.linuxsecurity.com/feature_stories/kernel-netfilter.html">
and <url name="Netfilter-FAQ" url="http://netfilter.filewatcher.org/netfilter-faq.html">.
For kernel version below 2.4 you should install the firewall rpms from
<url name="rpmfind.net" url="http://rpmfind.net/linux/rpm2html/search.php?query=firewall">
or <url name="firewall.src.rpm" url="http://rpmfind.net/linux/RPM/contrib/noarch//SRPMS//firewall-2.2-3.src.html">.
See also
<url url="http://www.linuxdoc.org/HOWTO/Kernel-HOWTO.html">.
<bf>Setup Squid : </bf>
You should install Squid on the main Linux server which can act as a
proxy for the diskless nodes.
Squid is a high-performance proxy caching server for Web clients,
supporting FTP, gopher, and HTTP data objects. Unlike traditional
caching software, Squid handles all requests in a single,
non-blocking, I/O-driven process. Squid keeps meta data and especially
hot objects cached in RAM, caches DNS lookups, supports non-blocking
DNS lookups, and implements negative caching of failed requests.
Squid consists of a main server program squid, a Domain Name System
lookup program (dnsserver), a program for retrieving FTP data
(ftpget), and some management and client tools.
Install the Squid from the Linux cdrom -
<code>
bash# rpm -i /mnt/cdrom/RPMS/squid*.rpm
</code>
You can see the port number where Squid runs by viewing the file
/etc/services and search for word "squid".
Says something like 'squid 3128/tcp # squid web proxy'
On the diskless nodes bring up the web browser and pick Configure
and check the "use proxy". Put the hostname of main Linux server and
port number as 3128. Now the diskless node can surf the internet web pages!
<!--
*******************************************
************ End of Section ***************
*******************************************
<chapt> Diskless Computer for Microsoft Windows 95/NT !!
-->
<sect> Diskless Computer for Microsoft Windows 95/NT !!

View File

@ -45,7 +45,7 @@ PHP HOW-TO
" name="
alavoor@yahoo.com
">
<date>v25.6, 04 Oct 2001
<date>v25.8, 12 Dec 2001
<abstract>
This document tells you howto develop PHP programs and also to migrate all the
Windows 95 GUI applications to powerful PHP + HTML + DHTML + XML + Java applets + Javascript.
@ -75,17 +75,39 @@ and mainframe operating systems and on all operating systems where "C" compiler
<p>
<it><bf>Definition:</bf> PHP is a simple, object-oriented,
interpreted, robust, secure, very high-performance, architecture neutral, portable,
dynamic scripting language. Everything inside "class"
keyword in PHP will be identical to Java language (in near future). And PHP is
designed such that it is 10 times faster than Java, since there is no virtual machine.
PHP is the international standard general purpose object oriented scripting language.
dynamic scripting language. PHP has "class" keyword similar to Java's "class" keyword.
And PHP is designed such that it is 5 times faster than Java, since there is no virtual machine.
PHP is very fast becoming a standard, general purpose, object oriented scripting language.
PHP is not only meant for web applications but also can be used
for developing general applications.
</it>
PHP is a very powerful scripting language.
PHP stands for 'Hypertext Pre-Processor' and is a server
side HTML scripting/programming language.
PHP is C-like Web scripting language runs on Apache, Netscape/iPlanet, and Microsoft IIS Web
servers.
PHP is a tool that lets you create dynamic web pages. PHP-enabled web pages
are treated just like regular HTML pages and you can create and edit them
the same way you normally create regular HTML pages.
PHP lets you write simple scripts right in your HTML files much like
JavaScript does, except, unlike JavaScript PHP is not
browser-dependant. JavaScript is a client-side html-embedded
language while PHP is a server-side language.
PHP is similar in concept to Netscape's LiveWire Pro product and Microsoft's ASP and
Sun Microsystem's JSP.
PHP is not only used for creating web applications, but also for creating general standalone
applications.
PHP's strength are :
<itemize>
<item> Open source
<item> Easily learned syntax
<item> Broad database connectivity
<item> Massive library of contributed extensions
<item> General purpose scripting language much superior to PERL, VB script, ASP, JSP.
</itemize>
PHP was kept the <bf>"top secret and strictly confidential"</bf>
computer language by many companies in the world, but now had become
@ -97,12 +119,12 @@ highly confidential matter not disclosing to outsiders (competitors).
PHP will storm the entire world and will take the IT industry by surprise!!
The power of PHP is that it is <bf>cross-platform and runs everywhere!!</bf>
It runs on Linux, Windows 95/98/NT, Windows 2000, Solaris, HPUX and all
flavors of unix. PHP is write once and deploy anywhere and everywhere.
flavors of UNIX. PHP is write once and deploy anywhere and everywhere.
It runs on many web-servers like Apache, Microsoft IIS, etc..
PHP runs 5 to 20 times faster than Java!! In actual benchmarks, PHP was
PHP runs 5 to 20 times faster than Java!! In actual benchmarks, PHP was about
3.7 times faster than JSP (see <ref id="benchmarks">). PHP is extremely easy to use
and you can develop very complex web/e-commerce applications
and you can develop very complex web/e-commerce/general-standalone applications
very rapidly in a very short period of time.
(In future PHP language will imitate most features of Java language and
Java programmers will <bf>love</bf> PHP. And PHP will have java keywords
@ -115,17 +137,22 @@ best features from Java, C++, PERL and C.
PHP is the <bf>real gem</bf> of all the scripting/programming languges
and will soon become the "MECCA" for programmers world-wide!!
PHP has a huge user base and a large
developer base as it runs on both Window95/NT/2000 and all flavors of unixes.
developer base as it runs on both Window95/NT/2000/XP and all flavors of UNIX'es.
A big surprise is waiting for us - <bf>Most probably PHP will be the
computer language/scripting language of the 21st century!!</bf>
PHP can be compiled and optimized to make it run even faster by using the
Zend Optimizer. Zend optimizer is integrated with PHP in PHP version 4.0.
First, you will write your application in PHP scripting language
during development, testing and debugging. Once the project is ready for
deployment you will use the Zend compiler to
compile the PHP to create executable which will run very fast.
You would normally use a combination of
PHP (70% code) + HTML/DHTML/XML (25% code) + Javascript (5% code client side validations)
for your e-commerce projects.
<!--
*******************************************
************ End of Section ***************
@ -138,7 +165,7 @@ for your e-commerce projects.
-->
<sect> PHP runs on Microsoft Windows!!<label id = "mswin">
<p>
PHP initially started on unix platform, but it is very portable and
PHP initially started on UNIX platform, but it is very portable and
runs on MS Windows and MS IIS webserver.
Today PHP has a large user base on MS Windows 2000/NT/95/98,
You will find a huge collection of tools for PHP under MS Windows platform.
@ -146,12 +173,12 @@ You will find a huge collection of tools for PHP under MS Windows platform.
Many PHP programmers develop code on MS Windows and deploy on large linux servers
like IBM mainframe running linux, Compaq DEC Alpha and Sun sparc.
A great advantage is that since PHP also runs on Unix/Linux, developers on
unix platform "cash on" the user base of PHP under MS windows as the PHP code developed
under MS Windows can be used on unix/linux without any code change!!
A great advantage is that since PHP also runs on UNIX/Linux, developers on
UNIX platform "cash on" the user base of PHP under MS windows as the PHP code developed
under MS Windows can be used on UNIX/linux without any code change!!
PHP itself is written in 100% "C" langauge, and hence it runs on a very wide variety of
platforms like BeOS, Unix, MS Windows, Apple Macintosh, IBM OS/2 and on many more operating
platforms like BeOS, UNIX, MS Windows, Apple Macintosh, IBM OS/2 and on many more operating
systems.
<it><bf>PHP is very fast and is much faster than Java. For web development, forget
@ -173,7 +200,20 @@ object oriented scripting language</bf></it>
<item> PHP main site <url url="http://www.php.net">
<item> PHP resources <url url="http://ils.unc.edu/web-db/php/links.html">
<item> PHP Code Exchange - <url url="http://px.sklar.com">
<item> Vex Net <url url="http://www.vex.net/php">
</itemize>
Mirror sites are in many countries like www.COUNTRYCODE.php.net, where
COUNTRYCODE is like us, fe, sk etc.
<itemize>
<item> <url url="http://www.fe.de.php.net">
<item> <url url="http://www.sk.php.net">
<item> <url url="http://php.iquest.net/">
<item> Questions e-mail to :
<htmlurl url="mailto:rasmus@lerdorf.on.ca"
name="rasmus@lerdorf.on.ca">
</itemize>
<!--
*******************************************
************ End of Section ***************
@ -190,9 +230,9 @@ PHP runs lot faster than ASP on MS Windows and has more features and functionali
than Microsoft ASP.
PHP is much more robust, reliable and powerful than ASP.
And the user base of PHP is extremely large because PHP runs on MS Windows,
Linux, Mac OS and all unixes.
Linux, Mac OS and all UNIX'es.
Greatest advantage of
PHP is that you can develop on MS Windows and deploy on Linux or Unix and vice versa!!
PHP is that you can develop on MS Windows and deploy on Linux or UNIX and vice versa!!
There are more PHP users under MS Windows98/NT/2000 than on any other operating system!!
Because there is so much demand for PHP on MS Windows 98/NT/2000, a ready to
@ -246,9 +286,13 @@ and at console mode startup the
<url name="PostgreSQL" url="http://www.geocities.com/alavoor/HOWTO/pgsql/PostgreSQL-HOWTO.html">
server.
<url name="PostgreSQL" url="http://www.geocities.com/alavoor/HOWTO/pgsql/PostgreSQL-HOWTO.html">
is <bf>3 times </bf>
is about <bf>3 times </bf>
faster than Oracle or MS SQL server.
The PostgreSQL support code for PHP was written by Adam Sussman
<htmlurl url="mailto: asussman@vidya.com"
name="asussman@vidya.com">
You can also order ready-to-go cheap Linux boxes from -
<itemize>
<item> Egghead <url name="Egghead" url="http://www.egghead.com">,
@ -288,7 +332,7 @@ howto at
*******************************************
-->
<sect1> PHP Installation on unixes and others<label id = "PHP Installation">
<sect1> PHP Installation on UNIX'es and others<label id = "PHP Installation">
<p>
See the installation guide and instructions at
PHP main site <url url="http://www.php.net"> or INSTALL file
@ -348,6 +392,222 @@ See also
<chapt> PHP Features <label id = "phpfeatures">
-->
<sect> Major Features of PHP <label id = "phpfeatures">
<p>
<itemize>
<item>Standard CGI, FastCGI and Apache module support -
As a standard CGI program, PHP can be installed on any
UNIX machine running any UNIX web server. With support for
the new FastCGI standard, PHP can take advantage of the
speed improvements gained through this mechanism. As an
Apache module, PHP becomes an extremely powerful and
<bf>lightning fast</bf> alternative to CGI programmimg.
<item> Access Logging -
With the access logging capabilities of PHP, users can
maintain their own hit counting and logging. It does not use
the system's central access log files in any way, and it
provides real-time access monitoring. The Log Viewer Script
provides a quick summary of the accesses to a set of pages
owned by an individual user. In addition to that, the package
can be configured to generate a footer on every page which
shows access information. See the bottom of this page for an
example of this.
<item> Access Control -
A built-in web-based configuration screen handles access
control configuration. It is possible to create rules for all
or some web pages owned by a certain person which place
various restrictions on who can view these pages and how they
will be viewed. Pages can be password protected, completely
restricted, logging disabled and more based on the client's
domain, browser, e-mail address or even the referring
document.
<item> PostgresSQL Support -
Postgres is an advanced free RDBMS. PHP supports embedding
PostgreSQL "SQL queries" directly in .html files.
<item> RFC-1867 File Upload Support -
File Upload is a new feature in Netscape 2.0. It lets users
upload files to a web server. PHP provides the actual Mime
decoding to make this work and also provides the additional
framework to do something useful with the uploaded file once
it has been received.
<item> HTTP-based authentication control -
PHP can be used to create customized HTTP-based
authentication mechanisms for the Apache web server.
<item> Variables, Arrays, Associative Arrays -
PHP supports typed variables, arrays and even Perl-like
associative arrays. These can all be passed from one web page
to another using either GET or POST method forms.
<item> Conditionals, While Loops -
PHP supports a full-featured C-like scripting language.
You can have if/then/elseif/else/endif conditions as well as
while loops and switch/case statements to guide the logical
flow of how the html page should be displayed.
<item> Extended Regular Expressions -
Regular expressions are heavily used for pattern matching,
pattern substitutions and general string manipulation. PHP
supports all common regular expression operations.
<item> Raw HTTP Header Control -
The ability to have web pages send customized raw HTTP
headers based on some condition is essential for high-level
web site design. A frequent use is to send a Location: URL
header to redirect the calling client to some other URL. It
can also be used to turn off cacheing or manipulate the last
update header of pages.
<item> On-the-fly GIF image creation -
PHP has support for Thomas Boutell's GD image library
which makes it possible to generate GIF images on the fly.
<item> ISP "Safe Mode" support -
PHP supports an unique "Safe Mode" which makes it safe to
have multiple users run PHP scripts on the same server.
<item> Many more new features are being added in newer releases of PHP.
Visit the main web site at <url url="http://www.php.net">
<item> It's Free! -
One final essential feature. The package is completely free.
It is licensed under the GNU/GPL which allows you to use the
software for any purpose, commercial or otherwise.
</itemize>
<!--
*******************************************
************ End of Section ***************
*******************************************
<chapt>Brief History of PHP
-->
<sect>Brief History of PHP
<p>
PHP began life as a simple little cgi wrapper written in Perl.
The name of this first package was Personal Home Page Tools, which
later became Personal Home Page Construction Kit.
Old name is Professional Home Pages (PHP) and new name is PHP Hypertext Pre-Processor.
A tool was written to easily embed SQL queries into web pages. It
was basically another CGI wrapper that parsed SQL queries and
made it easy to create forms and tables
based on these queries. This tool was named FI (Form Interpreter).
PHP/FI version 2.0 is a complete rewrite of these two packages combined
into a single program.
It evolved to a simple programming language embedded inside HTML files.
PHP eliminates the need for numerous small Perl cgi programs
by allowing you to place simple scripts directly in your HTML files. This
speeds up the overall performance of your web pages since the overhead of
forking Perl several times has been eliminated.
It also makes it easier to manage large web sites by placing
all components of a web page in a single html file.
By including support for various databases, it also makes it
trivial to develop database enabled web pages. Many people find the
embedded nature much easier to deal with than trying to create separate
HTML and CGI files.
Now PHP/FI is renamed as PHP.
<!--
*******************************************
************ End of Section ***************
*******************************************
<chapt>A Simple Example
-->
<sect>A Simple Example
<p>
Suppose you have a form:
<tscreen><verb>
<FORM ACTION="/cgi-bin/php.cgi/~userid/display.html" METHOD=POST>
<INPUT TYPE="text" name="name">
<INPUT TYPE="text" name="age">
<INPUT TYPE="submit">
<FORM>
</verb></tscreen>
Your display.html file could then contain something like:
<tscreen><verb>
&lt ?echo "Hi &dollar name, you are &dollar age years old!<p>" &gt
</verb></tscreen>
It's that simple! PHP automatically creates a variable for each form
input field in your form. You can then use these variables in the ACTION
URL file.
The next step once you have figured out how to use variables is to start
playing with some logical flow tags in your pages. For example, if you
wanted to display different messages based on something the user inputs,
you would use if/else logic. In our above example, we can display different
things based on the age the user entered by changing our display.html to:
<tscreen><verb>
<?
if($age>50);
echo "Hi $name, you are ancient!<p>";
elseif($age>30);
echo "Hi $name, you are very old!<p>";
else;
echo "Hi $name.";
endif;
>
</verb></tscreen>
PHP provides a very powerful scripting language which will do much more
than what the above simple example demonstrates. See the section on the
PHP Script Language for more information.
You can also use PHP to configure who is allowed to access your pages.
This is done using a built-in configuration screen. With this you could for
example specify that only people from certain domains would be allowed to
see your pages, or you could create a rule which would password protect
certain pages. See the Access Control section for more details.
PHP is also capable of receiving file uploads from any RFC-1867
compliant web browser. This feature lets people upload both text and binary
files. With PHP's access control and logical functions, you have full
control over who is allowed to upload and what is to be done with the file
once it has been uploaded. See the File Upload section for more details.
PHP has support for the PostgreSQL database package. It supports
embedded SQL queries in your .HTML files.
PHP also has support for the mysql database package. It supports
embedded SQL queries in your .HTML files.
<!--
*******************************************
************ End of Section ***************
*******************************************
<chapt> PHP Libraries <label id = "phplibs">
-->
<sect> SOAPX4 and PhpXMLP <label id = "soap">
<p>
SOAP is an XML-based protocol for messaging and RPC-style communication between two processes.
The World Wide Web Consortium's XML Protocol (XP) Working Group is working on a SOAP
standard, which will be called XP.
The SOAPX4 (Simple Object Access Protocol) implementation for PHP is at
<url url="http://dietrich.ganx4.com/soapx4">.
Alternate SOAP implementation is at <url url="http://sourceforge.net/projects/phpxmlp">.
<!--
*******************************************
************ End of Section ***************
*******************************************
<chapt> PHP Libraries <label id = "phplibs">
-->
<sect> PHP Libraries <label id = "phplibs">
@ -464,6 +724,27 @@ for the book, "A Guide to Databases under Linux" (Syngress Media) but
is available under the GNU Public License.
<url url="http://sourceforge.net/projects/phpshopcart">
</itemize>
<!--
*******************************************
************ End of Section ***************
*******************************************
<chapt> PHPGem package
-->
<sect> PHPGem package
<p>
PHPGem is a PHP-script which accelerates the creation of PHP-scripts
for working with tables. It works with different SQL-servers such as
PostgreSQL, MySQL, mSQL, ODBC, and Adabas. You input a description of
and parameters for your tables' fields (field name, on/off searching
in the field, etc.), and PHPGem outputs another PHP-script which will
work with the tables (view/add/edit/delete/duplicate entries and
search). PHPGem works with multi-level nested tables. PHPGem allows
you to specify a level of access for each table and for each field for
each user. PHPGem also support images.
PHPGem is at <url url="http://sptl.org/phpgem">
<!--
*******************************************
************ End of Section ***************
@ -615,7 +896,7 @@ without needing to reprogram other parts
<item> Group IT Engine
<url url="http://groupit.org">
is a turnkey group collaboration and content management engine. It
presently runs on Unix machines using PHP and Apache. Using GroupIT you
presently runs on UNIX machines using PHP and Apache. Using GroupIT you
can "Categorize your content", "Organize your contents into sections",
"Control access to your content" and many more
<url name="additional features" url="http://groupit.org/channel/features">.
@ -797,8 +1078,8 @@ PHP runs lot faster than ASP on MS Windows and has more features and functionali
than Microsoft ASP.
PHP is much more robust, reliable and powerful than ASP.
There are more PHP users under MS Windows98/NT/2000 than on any other operating system!!
PHP initially started on Linux/unix environment but today there are more
PHP developers on MS Windows platform as compared to unix.
PHP initially started on Linux/UNIX environment but today there are more
PHP developers on MS Windows platform as compared to UNIX.
<!--
*******************************************
************ End of Section ***************
@ -880,7 +1161,7 @@ with PHP code explorer <url url="http://www.tashcom.com/codex"> (rating 4.5 star
<p>
PHP IDE/editor for bot MS Windows and Linux platforms are :
<itemize>
<item> PHP editor (for both windows and linux/unixes) <url url="http://www.coffeecup.com/select/editor.html"> (rating 5 stars).
<item> PHP editor (for both windows and linux/UNIX) <url url="http://www.coffeecup.com/select/editor.html"> (rating 5 stars).
<item> HTML/PHP editors Amaya <url url="http://www.w3.org/Amaya" >
<item> Folding text editor (Win and linux) <url url="http://fte.sourceforge.net">
<item> PHP Editor (Win and linux) <url url="http://www.scintilla.org">
@ -918,10 +1199,25 @@ and see also <ref id="ptags" name="ptags of PHP">
-->
<sect1>PHP Utilities <label id = "phputil">
<p>
Zend is a server-side caching software speeds up Web site performance, maximizes hardware
resources, and improves the online experience of customers, providing a good return
on investment. Zend accelerator caches PHP scripts, helping to reduce processing time
and Web server load while enabling administrators to monitor site performance in real time.
Cost is $980 and supports Linux, Solaris and FreeBSD.
Zends provides:
<itemize>
<item> Enables IT to serve more Web site visitors with existing hardware
<item> Speeds up Web site response time
<item> Provides real-time performance monitoring
</itemize>
<itemize>
<item> Zend Optimizers <url url="http://www.zend.com">
<item> Zend Compilers <url url="http://www.zend.com" >
<p>
<item> APC "Alternative PHP Cache" is an open-source alternative to Zend's commercial
accelerator which is at <url url="http://apc.communityconnect.com">.
<p>
<item> Lots of info on PHP on MS Windows platform <url url="http://php.weblogs.com">
<p>
<item> PHP GroupWare Apps <url url="http://www.phpgroupware.org">
@ -953,7 +1249,7 @@ Tags are extremely valuable and are used for navigation of source code inside th
editors like vi, emacs, CRiSP, NEdit etc... If you had
programmed a lot in C, C++ or Java you
might have used the <bf>ctags</bf> program to create tags.
To see the online manual page, type 'man ctags' at linux/unix bash prompt.
To see the online manual page, type 'man ctags' at linux/UNIX bash prompt.
The latest version of <bf>ctags</bf> supports PHP language and is
available from <url url="http://ctags.sourceforge.net">.
@ -1148,6 +1444,24 @@ PHP Debugger is available at <url url="http://www.phpdebug.com">
************ End of Section ***************
*******************************************
-->
<sect1> PHP Debuggers
<p>
List of PHP debuggers :
<itemize>
<item> <url url="http://download.php.net/manual/en/debugger.php">.
<item> <url url="http://dd.cron.ru/dbg">
<item> Zend-IDE has PHP debugger <url url="http://www.zend.com/store/products/zend-ide.php">
<item> Soysal editor has PHP debugger <url url="http://www.soysal.com/PHPEd">
<item> PHP symbolic debugger <url url="http://members.ozemail.com.au/~djf01/body.html">
and at <url url="http://freshmeat.net/projects/body-phpdebugger">
<item>
</itemize>
<!--
*******************************************
************ End of Section ***************
*******************************************
-->
<sect1> Debug with FILE and LINE
<p>
@ -1263,7 +1577,7 @@ or use the 'yank to buffer' feature of Vi editor and paste.
When you are done development and testing and when you are ready to
deploy on the production server, filter out the debug2_ calls from
your source code. At unix prompt -
your source code. At UNIX prompt -
<code>
bash$ mkdir production
bash$ grep -v debug2_ filea.php3 > production/filea.php3
@ -1290,16 +1604,27 @@ And now copy the files from production to the deployment area.
<sect> General purpose programming with PHP <label id = "genphp">
<p>
PHP is very powerful and is designed such that it can replace awk, sed,
unix shell, perl, "C", C++ and Java.
UNIX shell, perl, "C", C++ and Java.
The object oriented features of PHP is developing very rapidly and in near future
will surpass the object oriented features of Java language. All the object oriented
features are implemented in PHP via <bf>class</bf> keyword just like in Java.
If you build the CGI version of PHP, you can use it from the command
line simply typing: <tt>php filename</tt> where filename is the file you want to
parse. You can also create standalone PHP scripts by making the first
line of your script look something like:
<tscreen><verb>
#!/usr/local/bin/php -q
</verb></tscreen>
The "-q" suppresses the printing of the HTTP headers. You can leave off
this option if you like.
If you want to use PHP as a stand-alone program, just like a shell script,
"C" or perl program, then use this technique:
<code>
bash$ php filename.php
bash$ php -q filename.php
bash$ php -h
bash$ php -?
bash$ /usr/bin/php -?
@ -1312,7 +1637,7 @@ bash commmandline instead of from the web-browser.
On Microsoft Windows platform you will bringup a MSDOS prompt from Start->Run->cmd
and put C:\Program Files\php\bin in your path environment and
<code>
C:\> php filename.php
C:\> php -q filename.php
C:\> php -h
C:\> php -?
or
@ -1333,7 +1658,7 @@ GUI applications. And developing applications with PHP is extremely fast
as it is a scripting language and it's runtime performance is also excellent
as compared with other scripting languages like Perl, Visual Basic and Python.
PHP can also be used for developing standalone GUI applications for Linux/Unixes.
PHP can also be used for developing standalone GUI applications for Linux/UNIX'es.
<!--
*******************************************
************ End of Section ***************
@ -1431,7 +1756,7 @@ not know that the HTML page is generated by PHP !!
<item> PHP has C++, Perl, Javascript like syntax features and has programs like
'ptags/ctags' to navigate the source code
<item> PHP has Zend optimizer which speeds up the performance
<item> PHP runs on all unixes, linux, Windows 95/NT/2000 and is more
<item> PHP runs on all UNIX'es, linux, Windows 95/NT/2000 and is more
powerful than ASP, JSP and others.
<item> PHP has a very large user base and developer base.
</enum>
@ -1473,6 +1798,7 @@ and <url name="CGI-Resources" url="http://cgi-resources.com">
<item> Dev Shed <url url="http://www.devshed.com/Server_Side/PHP/Introduction">
<item> PHP TidBits <url url="http://www.htmlwizard.net/resources/tutorials">
<item> PHP Builder <url url="http://www.phpbuilder.com/getit">
<item> PHP tutorials at <url url="http://www.cgi-network.net">
</itemize>
In this tutorial we assume that your server has support for PHP activated
@ -1848,7 +2174,7 @@ Mirror sites are at -
<p>
This document is published in 14 different formats namely - DVI, Postscript,
Latex, Adobe Acrobat PDF,
LyX, GNU-info, HTML, RTF(Rich Text Format), Plain-text, Unix man pages, single
LyX, GNU-info, HTML, RTF(Rich Text Format), Plain-text, UNIX man pages, single
HTML file, SGML (Linuxdoc format), SGML (Docbook format), MS WinHelp format.
This howto document is located at -