open source technology
Upcoming SlideShare
Loading in...5

open source technology






Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds


Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

open source technology open source technology Document Transcript

  • AbstractOpen Source software is perceived as a free alternative to commercial software because no peruser or per computer charges are levied. There is now a wide range of Open Source softwareavailable including operating systems and applications which in some cases can offer similarfunctionality to commercial software with no licensing costs. In Part one this paper covers thebackground and clarifies the terms used in Open Source developments and in Part two, itdocuments current usage and identifies other factors which need to be considered beforeselecting an Open Source solution.When you buy a computer system you are buying the hardware and licensing the software. Thelicensing terms control what actions can and cannot be performed and most software uses alicense designed to ensure that the creators of materials and resources are acknowledged andrewarded for their work. This gives rise to the standard practice of charging a royalty per user orper device using the software. Open Source software uses a different type of License aimed atensuring the software’s development and royalty free distribution.
  • ContentS.NO Name of topic Page no.1. Chapter 1:-Introduction of Open Source 3 Technology2. Chapter 2:-Literature Review 4-53. Chapter 3:-What is An Open Source 6 Technology4. Chapter 4:-Example of open Source 9-43 Technology5. Chapter 4:-Linux 9-216. Chapter 4:-PHP 22-437. Chapter 5:- Open Vs Closed Software 44 Technology8. Chapter 6:- Advantages of open source 45 technology9. Chapter 7:- Practical Examples Of Open 44-47 Source Technology10. Chapter 8:- Conclusion &Feature Scope 4811. Chapter 9:-Reference 49 ii
  • Chapter:-1 IntroductionOpen Source software is perceived as a free alternative to commercial software because no peruser or per computer charges are levied. There is now a wide range of Open Source softwareavailable including operating systems and applications which in some cases can offer similarfunctionality to commercial software with no licensing costs. In Part one this paper covers thebackground and clarifies the terms used in Open Source developments and in Part two, itdocuments current usage and identifies other factors which need to be considered beforeselecting an Open Source solution.When you buy a computer system you are buying the hardware and licensing the software. Thelicensing terms control what actions can and cannot be performed and most software uses alicense designed to ensure that the creators of materials and resources are acknowledged andrewarded for their work. This gives rise to the standard practice of charging a royalty per user orper device using the software. Open Source software uses a different type of license aimed atensuring the software’s development and royalty free distribution. iii
  • Chapter:-2 Literature ReviewAppropriate TechnologyOpen Design-Based Strategies to Enhance Appropriate Technology Development Abstract: The appropriate technology (AT) movement is being driven by inventors and innovators who are interested in designing technologies that are culturally, environmentally, and economically appropriate, and feasible to construct and use for people anywhere in the world. This paper examines how open sharing of designs, specifications, and technical information can enhance effectiveness, widespread use, and innovation of AT. This commons-based open design method has been highly successful for software development (i.e., open source), and has also begun to be used in other fields through unique partnerships and new information-sharing tools on the internet. This paper critically demonstrates key examples of open design successes that can be applied to development of AT. It also identifies potential barriers to open-sourcing AT designs, analyzes business models for open design in the context of AT, and outlines practical solutions with examples currently underway.Overcoming Technical Constraints for Obtaining Sustainable Development with Open SourceAppropriate Technology Abstract: Open source appropriate technology (OSAT) refers to technologies that provide for sustainable development while being designed in the same fashion as free and open source software. Facilitated by advances in information technology software and hardware, new ways to disseminate information such as wikis and Internet-enabled mobile phones, the global development of OSAT has emerged as a reality. This paper shows the sharing of design processes, appropriate tools, and technical information is enables more effective and rapid development of appropriate technologies for both industrialized and non-industrialized regions. This sharing will require the appropriate iv
  • technology community to adopt open standards/licenses, document knowledge, and buildon previous work. This paper offers solutions in the form of both business models andtools to overcome technical constraints of OSAT development in the forms of theplatforms necessary on which to share and build knowledge about appropriatetechnologies. These solutions are open, easily accessible for those in need, have a lowbarrier to entry for both users and information creators, and must be vetted in order toutilized as a trustworthy source on critical information needs. Current progress towardsimplementing these solutions will be reviewed and recommendations will be made tofurther increase the rate of OSAT development. v
  • Chapter:-3 What is Open Source Technology?Open Source technology can be defined as Computer Software for which the human-readablesource code is made available under a copyright License (or arrangement such as the PublicDomain) Open Source is a development methodology which offers practical accessibility to aproducts source (goods and knowledge).This permits users to use, change, and improve the software, and to redistribute it in modified orunmodified form.The distribution terms of open-source software must comply with the following criteria:1.Free Distribution2.Source Code3.Derived Works4.No Discrimination Against Persons or Groups vi
  • Chapter :-4 INTRODUCTION TO LINUX LINUX is an open source / free software. With its advanced server configuration, Red Hatis putting Linux as an operating system at the core of enterprise computing. Today Linux isfound in Web infrastructure, file server, ERP, and point of sale system, increasingly in thesystems running critical applications at large companies. Analysts predict that by the end of thisdecade Linux will be a common element in the enterprise computing landscape. “Over the last year, we’ve seen Linux go from being focused on small and mediumbusiness to being used very deep in the enterprise”, says Paul Cormier, executive vicepresident of engineering at Red Hat, a leading Linux platform provider. vii
  • Salient Features of LINUX1. Linux is the fastest operating system in the world. It runs much faster than Windows 9X/NT. It is about 1.2 to 3 times faster than Windows 9X/NT. In command-line console mode without X-window it runs even faster (console mode is ideal for Database servers, Apache Web servers, Email servers, News servers, File servers, DNS servers, Print servers, Network Computer servers, etc..). Linux is also the most powerful yet most simple and easy to use operating system in the world.2. Linux is the most reliable OS. Windows 9X/NT fails the CRASH_OS_TEST Programs and only Linux passes. Also commercial UNIX’s like IRIX, Solaris, HPUX, AIX, SCO all fail the crash test and Linux is the only OS which passes the crash me test. Very often Windows 95 users will get GPF errors and the system freezes3. Linux is very robust because it is built by millions of people on internet and there are no errors in the kernel. It runs for one full year without any re-boots or any problems non- stop, guaranteed. It is the best designed OS.4. Linux has an excellent scalability - it runs on Uni-processor, Multi-processors, Parallel Processors and even Super-computers. It fully supports SMP (Symmetric Multi- Processing) boxes with more than one CPU. Windows 95 supports only one CPU box. Linux scales much better than NT on SMP.5. Linux is fully 32-bit & 64-bit operating system. And it is very modular and is viii
  • already ported to 64-bit chips like DEC alpha, Sun Microsystems UltraSparc, Intel IA64, Motorola PowerPC, Transmeta Corp Crusoe chip and GNU/GPL Freedom 64-bit CPU. Whereas Windows 95 has a major chunks of 16-bit code in its kernel and MS Windows runs only on one type of chip - "Intel chip".6. Linux is a very secure OS. Windows 95 is not a secure OS, break-ins are easy. Windows 95/2000, NT, MSDOS have computer viruses. But Linux does not have any viruses. Computer viruses cause lot of damages to Windows 95/2000/NT but not to Linux.7. Linux is very mature and is one of the oldest operating system in the world. UNIX (which is another name for Linux) was born in AT&T Bell Labs 27 years ago for Telecom research. Linux (UNIX) is the end-result of 27 years of research and development effort by U.S/European Universities and mega-corporations of Europe / America. It took 27 years to create vast amount of UNIX information, and all that info is now just sitting inside this Linux cdrom on our hand. For example programs like grep had not changed for the past 27 years and they are still used in Linux. Functionality and command line options of grep had not changed for the past 27 years. Linux started the Linux during 1991, but he borrowed lot of concepts, code from UNIX and this means Linux is 27 years old. Today Linux is the OCEAN wherein all other unixes like Solaris, HPUX, and AIX merge into. And in near future all other unixes will be replaced by Linux.8. Linux is less demanding on system resources. Linux runs on 386 PC with as little as 2 MB RAM in command-line console mode. Windows 95/NT cannot because the graphic engine is included in the kernel, which makes Windows 95/NT a resource hog. Graphic engine makes the Windows 95/NT extremely unreliable and unpredictable. Linux can do everything that Windows 95/NT does but Windows 95/NT cannot do everything which Linux does. In Windows 95/NT there is no option for the user to run in command-line console mode without any graphics. Unlike Windows95, X-window can run with very ix
  • minimum resources, it runs on 486 boxes with just 8MB of RAM.Linux uses X-window which is an advanced network-windowing system, whereas Windows95/NT is a standalone single-workstation windowing system. For example, using X-window, users can display output on any workstation-monitor attached anywhere in thenetwork. There is a command called "xhost" in Linux and display environment variable,export display=`hostname`:0.0. Like this there are lots of functionalities in X-window whichare missing in Windows NT/95. X-Window is an industry standard which was developed inMIT and is a very powerful network windowing system. With X-window you can runprograms on super-computers and display on your Linux desktop locally. Even though X-window is network-resource intensive, it is becoming increasingly popular because of theavailability of very low cost, high speed networking like 1 Gig bit Ethernet cards, 100Megabit Ethernet cards, DSL lines, Cable-Modems, Frame-relay and ATM networks.9. Linux has very low total cost of ownership since Linux supports diskless nodes. Cost of maintaining Linux is five times lower than MS Windows.10. Linux supports remote system administration whereas Windows NT/95 does not. We can remote login and do many system administration tasks, for example like adding users, reboot a Linux server from a remote terminal hundreds of miles.11. Linux runs most windows applications (16bit) like MSOffice, MSWord using WABI ($40), WINE (free) and MSDOS applications using DOSemu, FreeDOS, and Dr.DOS. But Windows95/NT will run only few of UNIX and Linux applications.12. Linux supports su (super user) command. Using su command it is possible to switch user without logging off. For example su - root will login as user root. In Windows NT/95 x
  • you must log off completely to switch user. Linux has remote commands like rlogin, telnet, etc. While Windows NT/95 does not have.13. Linux kernel is very small and it can fit on a single floppy. It is less complex but very sophisticated and powerful. Small kernel means it is very reliable. Linux applications are much bigger running on top of the Linux Kernel.14. Linux has many powerful desktops like KDE desktop, GNOME, Triteal CDE, Moti mwm, Open look low, twm, fvwm95, xdm, xsm, Windows Afterstep, Window maker (NeXTstep-lookalike), Qvwm, amiwm (amiga), mlvwm (mac) etc. KDE desktop is much more user friendly than Windows95! You have more freedom and choice in Linux desktops as compared to Windows 9X/NT.15. Linux OS needs only 200 MB of disk space for installation. Linux supports dual boot on the PCs - that is, you can have Windows95/NT on one partition and Linux on other. During system startup user can select to load Linux or Windows 95 and vice versa. Nowadays PCs are shipped with 6 Gigs of disk space.16. Linux runs on many hardware platforms - Intel, Motorola, PowerPC, RISC, DEC Alpha, MIPS, ARM, Transmeta Crusoe, Sparc architectures and GNU Freedom-64-bit CPU. Linux is already ported to 1024 CPUs super computer (Fujistu, Hitachi, Sun, Intel & others). Intel corporation had built the worlds fastest super-computer with 10240 Intel Pentium CPU’s (more than ten thousand CPU’s) which is based on a system similar to Linux.17. Linux is 100% POSIX compliant OS, whereas Windows NT/9X are not. POSIX is IEEE (Institute of Electrical Engg) standard as well as ANSI and international ISO standard spec. U.S. govt generally require full compliance of POSIX on any operating system. Most of the Unixs like Solaris, HPUX, AIX, SCO are 100% POSIX xi
  • 18. We can get the complete source code for Linux OS and all of its applications, whereas Windows 9X/NT is proprietary and we get only the binaries. Having the source code of Linux is vital for companies because they can quickly add advanced features and share it with every other company in the world.19. Linux is free of any cost. Downsides of Windows 9X/ NT is that we need to pay $200 (US dollars) per seat for Windows 95 and $800 (US dollars) per seat for Windows NT. And Microsoft applications like MS Office, C++ compilers and others will cost further $400,000 US dollars. It is better to spend money on hardware and use Linux as the software.20. Linux is trouble free and we will not have any problems with Linux, whereas you will have more headaches with Windows 95/NT (MS is not as reliable as Linux).21. Linux more than 1900 software packages on cdrom and many more are being developed world-wide. All the software packages are in a single Linux cdrom.22. Linux was awarded ―The best Network Operating system 1997/98/99/2000‖, by many computer magazines’ (US InfoWorld, European publications).23. The movie Titanic was created using Linux on Digital Alpha. Linux was used to create computer graphics, animations of all the shots in the movie Titanic.24. Linux was also used for storing data from experiments in the space shuttle. Linux was orbiting the earth in space. xii
  • Advantages of Linux:- Virus proof Advanced OS Crash proof Economical Secured Fully supported Multi-user Multi-tasking Multi-desktop Powerful networking Variety of servers LINUX INSTALLATIONBefore Linux installation, you must really know about what is hard drive partition. For Linuxinstallation we need to insert the installation cd of Red Hat Linux to CDROM and boot. Most ofthe installers give you an option between text and graphical install; you need to select ―text‖ ifyour computer memory is restricted.Linux software comes in packages. No matter what distribution or version of Linux you have,the CD contains packages that make the base operating system a rich selection of networking―clients‖ and ―servers‖ with appropriate configuration and monitoring tools, some end-user textmode application, base X-window system and at least one GUI desktop.The installation program will ask you several things to do like type of boot loader configuration.It is better to select GRUB boot loader configuration. After this you will be asked to select thetype of doing partitions. It is recommended to choose disk druid type. In this you will be asked todo partitions on available free space. In Linux there is all file system concept unlike windows.The minimum required file system for installation of Linux are /, /boot, swap and /usr. Afterdoing these partitions the procedure will ask which packages to install. If you select xiii
  • ―workstation‖ the packages normally found on servers are omitted from your installation. If youselect server installation then the end-user applications will not be installed. You can also choseto install ―everything‖, best option for installation on personal computers at your home for newusers. For expertise users there is an option of selecting individual packages as per yourrequirement. Now installation of Linux all in the form of packages starts and takes timeaccording to the packages selected. After completion the system reboots and Linux will startsuccessfully. Types of installation Method 1.CD-ROM 2.NFS 3.FTP 4.HTTP 5.HARD DISK 6.Through kickstart method Types of Boot loader 1.GRUB 2.LILO Hard Disk Partitioning Method 1.Disk druid 2.fdisk xiv
  • LINUX KERNEL & SHELLKERNELThe core of the Linux system is the kernel-the operating system program. The kernel controls theresources of the computer, allotting them to different users and tasks. It interacts directly with thehardware, thus making the programs easy to write and portable across different platform ofhardware. Since the kernel communicates directly with the hardware, the parts of the kernel mustbe customized to the hardware features of each system. However, the kernel does not dealdirectly with a user. Instead, the login process starts up a separate, interactive program, called theshell, for each user.SHELLLinux has a simple user interface called the shell that has the power to provide the services that auser wants. It protects the user from having to know the intricate hardware details. xv
  • Feature of Shell: Command Execution Redirection Background processing History Aliases Variables File Name Expansion Command completionTypes of Shell in Linux: Bash- ―Bourne Again Shell‖ Pdksh-―Public Domain Korn Shell‖ Tcsh- ―Tom’s C Shell‖ Ash- ―A Shell‖ Zsh- ― Z Shell‖ xvi
  • LINUX NETWORKINGFor networking firstly your hardware must be properly configured. Your network card shouldhave been setup during the Linux installation or after the installation. Under Linux most driversfor network cards are implemented as modules, after the module is inserted, you may want toinspect the file /proc /modules to see if the module is loaded. The module configuration file ismodules. conf in /etc. After setting up the network and connecting the cables, set up the networkby running the command: - net configWhile setting up the network, doesn’t mess up with the ―loop back driver‖ which has the IPaddress It is always there-it is the IP through which the computer talks to itself. IPaddress is allocated either statically or dynamically.For Linux Networking (communication through a network), the two basic Requirements areMedia and Rules:-By media we mean the communication link (cables), hubs and switches. It may be wired orwireless. Hubs are dumb, not an intelligent device. It works at the Physical layer whereasSwitches are intelligent devices and works at Data link layer. To obtain good performance wemake use of Switches. In a Switch, direct routing is possible, the data packet is unicasted and notbroadcasted, the packet doesn’t traverse to all the port but direct connection is made via IPaddress. Thus it has high performance; Switches maintain the IP address table for mappingprocess.By rules we mean the set of protocols used for communication. Rules or the Protocol to be useddepends on the OS on the end systems, if both the end- Systems have MS-Windows then forsmall network we use Net bui protocol & for larger networks use of TCP/IP is made. Endsystems having LINUX as OS Make use of TCP/IP protocol. xvii
  • Some Basic Networking Command 1) Ping – Measures connectivity and network latency between local & remote system. It uses ICMP echo packets. Example: ping Or ping 1) Traceroute – Shows network path between local and remote systems. Useful for pinpointing network congestion. Example: trace route 1) Netstat – Lists network statistics and parameters, including Network Connection, Routing table, Interface statistics. Example: netstat –rn Or netstat –a 1) ifup/ifdown - For each installed network adapter, there is a Corresponding ifcfg-* file in/etc/sysconfig/network- Scripts. You can activate or deactivate that adapter with the ifup and ifdown commands. Either one of the Following commands will activate the eth0 network xviii
  • 1) Ifconfig - The ifconfig command is used to configure and display network devices. Here is some sample output of an ifconfig command: # /sbin/ifconfig eth0 Eth0 Link encap: Ethernet HWaddr 00:50:56:40:1E:6A Inet addr: Bcast: Mask: UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU: 1500 Metric: 1 RX packets: 11253 errors: 0 dropped: 0 overruns: 0 frame: 0 TX packets: 1304 errors: 0 dropped: 0 overruns: 0 carrier: 0 Collisions: 0 txqueuelen: 100 RX bytes: 2092656 (1.9 Mb) TX bytes: 161329 (157.5 Kb) Interrupt: 10 Base addresses: 0x10a0# /sbin/ifconfig eth0 first parameter, eth0, tells us which interface is being configured. The nextArgument,, indicates the new IP address being assigned to this interface. If wewant to make sure our change worked, we issue the ifconfig command again to view its currentsettings.# /sbin/ifconfig eth0Eth0 Link encap: Ethernet HWaddr 00:50:56:40:1E:6AInet addr: Bcast: Mask: xix
  • UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU: 1500 Metric: 1RX packets: 11253 errors: 0 dropped: 0 overruns: 0 frame: 0TX packets: 1304 errors: 0 dropped: 0 overruns: 0 carrier: 0APACHE WEB SERVERApache is Red Hat’s standard web server.Apache is the most widely used web server. More then 60% sites are hosted on apache webserver.Apache provides very stable and scalable web server platform.Apache support virtual hosts in which multiple web sites may share the same web server. Service profile: ApacheType: System V-launched servicePackages: httpdDaemons: httpdScript: httpdPorts: 80/tcp (http), 443/tcp (https)Configuration: /etc/httpd/*, /var/www/* xx
  • Installing the Apache Server1. Mount the Red Hat RPM source files for Apache. They may be located on CD or you may have copied them in a previous chapter to a network source.2. Locate the Apache RPM packages: httpd, httpd-devel, redhat-config-httpd, mod_python, autoconf, automake, libtool, mod_perl, and mod_ssl. If you can’t find some of these packages; you may have to repeat steps 1–3 with a different Red Hat Installation CD.3. Load the Apache RPM packages.4. Use chkconfig to verify that Apache is not configured to start.5. Now, use chkconfig to start Apache for runlevels 3 and 5.6. Start Apache by hand by invoking the Apache management script (httpd) in /etc/rc.d/init.d. Start a Web browser such as Mozilla or Konqueror. Point it at http://localhost.7. You should see the default Apache Web page for Red Hat Linux.8. Close your Web browser. xxi
  • Chapter :-4 2.PHP IntroductioPHP is a powerful tool for making dynamic and interactive Web pages.PHP is the widely-used, free, and efficient alternative to competitors such as Microsofts ASP.In our PHP tutorial you will learn about PHP, and how to execute scripts on your server.PHP was originally created by Rasmus Lerdorf in 1995. The main implementation of PHP isnow produced by The PHP Group and serves as the formal reference to the PHP language.[6]PHP is free software released under the PHP License, which is incompatible with the GNUGeneral Public License (GPL) due to restrictions on the usage of the term PHP.[7]While PHP originally stood for "Personal Home Page", it is now said to stand for "PHP:Hypertext Preprocessor", a recursive acronym.[8]PHP is a server-side scripting language.What You Should Already KnowBefore you continue you should have a basic understanding of the following: HTML/XHTML JavaScript xxii
  • If you want to study these subjects first, find the tutorials on our Home page.What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server PHP supports many databases (MySQL, Informix, Oracle, Sybase, Solid, PostgreSQL, Generic ODBC, etc.) PHP is an open source software PHP is free to download and useWhat is a PHP File? PHP files can contain text, HTML tags and scripts PHP files are returned to the browser as plain HTML PHP files have a file extension of ".php", ".php3", or ".phtml"What is MySQL? MySQL is a database server MySQL is ideal for both small and large applications MySQL supports standard SQL MySQL compiles on a number of platforms MySQL is free to download and usePHP + MySQL xxiii
  • PHP combined with MySQL are cross-platform (you can develop in Windows and serve on a Unix platform)Why PHP? PHP runs on different platforms (Windows, Linux, Unix, etc.) PHP is compatible with almost all servers used today (Apache, IIS, etc.) PHP is FREE to download from the official PHP resource: PHP is easy to learn and runs efficiently on the server sideWhere to Start?To get access to a web server with PHP support, you can: Install Apache (or IIS) on your own server, install PHP, and MySQL Or find a web hosting plan with PHP and MySQL support xxiv
  • PHP InstallationWhat do you Need?If your server supports PHP you dont need to do anything.Just create some .php files in your web directory, and the server will parse them for you. Becauseit is free, most web hosts offer PHP support.However, if your server does not support PHP, you must install PHP.Here is a link to a good tutorial from on how to install PHP5: PHPDownload PHP for free here: MySQL DatabaseDownload MySQL for free here: Apache ServerDownload Apache for free here: xxv
  • PHP SyntaxPHP code is executed on the server, and the plain HTML result is sent to the browser.Basic PHP SyntaxA PHP scripting block always starts with <?php and ends with ?>. A PHP scripting block can beplaced anywhere in the document.On servers with shorthand support enabled you can start a scripting block with <? and end with?>.For maximum compatibility, we recommend that you use the standard form (<?php) rather thanthe shorthand form.<?php?>A PHP file normally contains HTML tags, just like an HTML file, and some PHP scripting code.Below, we have an example of a simple PHP script which sends the text "Hello World" to thebrowser:<html><body> xxvi
  • <?phpecho "Hello World";?></body></html>Each code line in PHP must end with a semicolon. The semicolon is a separator and is used todistinguish one set of instructions from another.There are two basic statements to output text with PHP: echo and print. In the example abovewe have used the echo statement to output the text "Hello World".Note: The file must have a .php extension. If the file has a .html extension, the PHP code willnot be executed. xxvii
  • PHP VariablesA variable is used to store information.Variables in PHPVariables are used for storing values, like text strings, numbers or arrays.When a variable is declared, it can be used over and over again in your script.All variables in PHP start with a $ sign symbol.The correct way of declaring a variable in PHP:$var_name = value;New PHP programmers often forget the $ sign at the beginning of the variable. In that case itwill not work.Lets try creating a variable containing a string, and a variable containing a number:<?php$txt="Hello World!";$x=16;?>PHP is a Loosely Typed LanguageIn PHP, a variable does not need to be declared before adding a value to it. xxviii
  • In the example above, you see that you do not have to tell PHP which data type the variable is.PHP automatically converts the variable to the correct data type, depending on its value.In a strongly typed programming language, you have to declare (define) the type and name of thevariable before using it.In PHP, the variable is declared automatically when you use it.Naming Rules for Variables A variable name must start with a letter or an underscore "_" A variable name can only contain alpha-numeric characters and underscores (a-z, A-Z, 0- 9, and _ ) A variable name should not contain spaces. If a variable name is more than one word, it should be separated with an underscore ($my_string), or with capitalization ($myString) xxix
  • String Variables in PHPString variables are used for values that contain characters.In this chapter we are going to look at the most common functions and operators used tomanipulate strings in PHP.After we create a string we can manipulate it. A string can be used directly in a function or it canbe stored in a variable.Below, the PHP script assigns the text "Hello World" to a string variable called $txt:<?php$txt="Hello World";echo $txt;?>The output of the code above will be:Hello WorldNow, lets try to use some different functions and operators to manipulate the string.The Concatenation OperatorThere is only one string operator in PHP.The concatenate on operator (.) is used to put two string values together.To concatenate two string variables together, use the concatenation operator: xxx
  • <?php$txt1="Hello World!";$txt2="What a nice day!";echo $txt1 . " " . $txt2;?>The output of the code above will be:Hello World! What a nice day!If we look at the code above you see that we used the concatenation operator two times. This isbecause we had to insert a third string (a space character), to separate the two strings.The strlen() functionThe strlen() function is used to return the length of a string.Lets find the length of a string:<?phpecho strlen("Hello world!");?>The output of the code above will be:12The length of a string is often used in loops or other functions, when it is important to knowwhen the string ends. (i.e. in a loop, we would want to stop the loop after the last character in thestring).The strpos() function xxxi
  • The strpos() function is used to search for a character/text within a string.If a match is found, this function will return the character position of the first match. If no matchis found, it will return FALSE.Lets see if we can find the string "world" in our string:<?phpecho strpos("Hello world!","world");?>The output of the code above will be:6The position of the string "world" in the example above is 6. The reason that it is 6 (and not 7), isthat the first character position in the string is 0, and not 1.Complete PHP String ReferenceFor a complete reference of all string functions, go to our complete PHP String Reference.The reference contains a brief description, and examples of use, for each function! xxxii
  • PHP OperatorsOperators are used to operate on values.PHP OperatorsThis section lists the different operators used in PHP.Arithmetic OperatorsOperator Description Example Result+ Addition x=2 4 x+2- Subtraction x=2 3 5-x* Multiplication x=4 20 x*5/ Division 15/5 3 5/2 2.5% Modulus (division remainder) 5%2 1 10%8 2 10%2 0++ Increment x=5 x=6 x++ xxxiii
  • -- Decrement x=5 x=4 x--Assignment OperatorsOperator Example Is The Same As= x=y x=y+= x+=y x=x+y-= x-=y x=x-y*= x*=y x=x*y/= x/=y x=x/y.= x.=y x=x.y%= x%=y x=x%yComparison OperatorsOperator Description Example== is equal to 5==8 returns false!= is not equal 5!=8 returns true<> is not equal 5<>8 returns true> is greater than 5>8 returns false xxxiv
  • < is less than 5<8 returns true>= is greater than or equal to 5>=8 returns false<= is less than or equal to 5<=8 returns trueLogical OperatorsOperator Description Example&& And x=6 y=3 (x < 10 && y > 1) returns true|| Or x=6 y=3 (x==5 || y==5) returns false! Not x=6 y=3 !(x==y) returns true xxxv
  • PHP If...Else StatementsConditional statements are used to perform different actions based on different conditions.Conditional StatementsVery often when you write code, you want to perform different actions for different decisions.You can use conditional statements in your code to do this.In PHP we have the following conditional statements: if statement - use this statement to execute some code only if a specified condition is true if...else statement - use this statement to execute some code if a condition is true and another code if the condition is false if...elseif....else statement - use this statement to select one of several blocks of code to be executed switch statement - use this statement to select one of many blocks of code to be executedThe if StatementUse the if statement to execute some code only if a specified condition is true.Syntaxif (condition) code to be executed if condition is true;The following example will output "Have a nice weekend!" if the current day is Friday:<html><body><?php$d=date("D"); xxxvi
  • if ($d=="Fri") echo "Have a nice weekend!";?></body></html>Notice that there is no ..else.. in this syntax. The code is executed only if the specified conditionis true.The if...else StatementUse the if....else statement to execute some code if a condition is true and another code if acondition is false.Syntaxif (condition) code to be executed if condition is true;else code to be executed if condition is false;ExampleThe following example will output "Have a nice weekend!" if the current day is Friday,otherwise it will output "Have a nice day!":<html><body><?php$d=date("D");if ($d=="Fri") echo "Have a nice weekend!"; xxxvii
  • else echo "Have a nice day!";?></body></html>If more than one line should be executed if a condition is true/false, the lines should be enclosedwithin curly braces:<html><body><?php$d=date("D");if ($d=="Fri") { echo "Hello!<br />"; echo "Have a nice weekend!"; echo "See you on Monday!"; }?></body></html>The if...elseif....else StatementUse the if....elseif...else statement to select one of several blocks of code to be executed. xxxviii
  • Syntaxif (condition) code to be executed if condition is true;elseif (condition) code to be executed if condition is true;else code to be executed if condition is false;ExampleThe following example will output "Have a nice weekend!" if the current day is Friday, and"Have a nice Sunday!" if the current day is Sunday. Otherwise it will output "Have a nice day!":<html><body><?php$d=date("D");if ($d=="Fri") echo "Have a nice weekend!";elseif ($d=="Sun") echo "Have a nice Sunday!";else echo "Have a nice day!";?></body></html> xxxix
  • PHP Switch StatementConditional statements are used to perform different actions based on different conditions.The PHP Switch StatementUse the switch statement to select one of many blocks of code to be executed.Syntaxswitch (n){case label1: code to be executed if n=label1; break;case label2: code to be executed if n=label2; break;default: code to be executed if n is different from both label1 and label2;}This is how it works: First we have a single expression n (most often a variable), that isevaluated once. The value of the expression is then compared with the values for each case in thestructure. If there is a match, the block of code associated with that case is executed. Use breakto prevent the code from running into the next case automatically. The default statement is usedif no match is found.Example<html><body> xl
  • <?phpswitch ($x){case 1: echo "Number 1"; break;case 2: echo "Number 2"; break;case 3: echo "Number 3"; break;default: echo "No number between 1 and 3";}?></body></html> xli
  • Chapter:-5Open Vs Closed Software TechnologyOpen source software is based around the idea that the user can not only view, but change thesource code of an application.Closed source software is hidden to prevent the user either viewing or changing the code.After initial production, open source software is released to the development community andundergoes a secondary phase of evolution. It is scrutinised by thousands of professionaldevelopers across the globe who highlight potential flaws, bugs and security glitches.Closed source software is developed in isolation with a small team of developers. It isnt possibleto build a team of hundreds to check the code because the code is deemed proprietary and secret. xlii
  • Chapter:-6Advantages of open source technology:The "Open Source Model" is not a religion. It is a very practical way of develop software in arapidly changing environment.Lower total cost of ownershipReduced dependence on software vendorsopen source software gives you the power to control your softwares code. You have the right tomodify the code to suit your requirements and control the budgets that you want to spendtowards it.Easier to customizeDISADVANTAGE OF OPEN SOURCE TECHNOLOGYMost open source software applications are not reliableNo guarantee of updates Since you are not paying for the open source software nobody is boundto give you regular updates. You can get stuck with the same old version for years without evergetting an update. xliii
  • Chapter:-7Practical Examples Of Open Source Technology:The Apache Web Server is the most widely used web server on the Internet. The ApacheSoftware Foundation was formed to provide support Apache an related software.In addition, the operating system that we run on our website and almost everywhere else isRedHat Linux.Along with internet address system Internet Protocol, and the internet browser Mozilla Forefox.One of the most successful programs is the Linux operating system, an open source Unix-likeoperating system.Companies Opting For Open Source Technology:Google Chrome source code is available as an open source project called Chromium (BSDlicense). xliv
  • Microsoft Corp. released the first public beta for its Windows Server 2003 Compute ClusterEdition, which is designed to address the high-performance computing needs of its customers,particularly at the departmental and workgroup levels, and forms part of the Windows Serverline of products which is also a open source codeNokia, alogwith hosting company CollabNet, will launch the Web site wheredevelopers can come together to create a wide range of home entertainment software for NokiasOpen Standards Terminal software platform, based on Linux, Xfree and Mozilla.Linux Entirely is made in open source technology. xlv
  • Related work/ Existing systems/concept :Open source software is software whose source code is published and made available to thepublic, enabling anyone to copy, modify and redistribute the source code without payingroyalties or fees. Open source code evolves through community cooperation. These communitiesare composed of individual programmers as well as very large companies. Examples of open-source software products are: xlvi
  • Programming languages:PHP - Scripting language suited for the webPYTHON - Scripting language for window applicationsRUBY - Scripting languageOS:GNU Project — ―a sufficient body of free software‖Linux — operating system kernel based on UnixNetBSD - operating system derived from UnixOpenBSD — operating system derived from UnixFreeBSD — operating system derived from UnixOpenSolaris — Unix Operating System from Sun MicrosystemsSymbian — real-time mobile operating system xlvii
  • Chapter:-8 Conclusion & Feature ScopeThe members of the independent software industry have led us into a time of change not seen bythe world since the industrial revolution. The billions of dollars of investment they havemade inthe development of their technology never would have come about without protection of thefruits of their intellectual labors. At the same time, open source software is well establishedas part of the software ecosystem and affords software developers and users animportantalternative style of software development and distribution. There is a need and apurpose for both.In making decisions about whether to adopt open source software solutions or payforcommercial ones, it is important to consider how the open source solution compares to the Forthe Free Software Foundation’s answers to questions about the GPL and LGPL, see one in terms of not only its technical characteristics, but also in terms of the overallinvestment and total cost of ownership. It is also important to consider whether the use of anopen source solution would meet the user’s needs with respect to operational compatibility withother programs and with respect to the user’s need to transact and interact with third partiesinindustries and markets in which commercial products are the de facto standard.Finally, it is important to be aware that the open source movement is motivated notonlytoprovide benefits to the software developer and user communities through the distributionof ―free‖ software, but also to eliminate the need to use proprietary software. Throughlobbyingand other efforts, the open source movement has persuaded some companies and evensome Governments to adopt a bias toward open source products, and the GNU Project’s GPLand LGPL have raised many serious questions about the proprietary integrity of softwaredeveloped xlviii
  • Chapter:-9ReferencesOperating Systems (ASPLOS) (ACM, Cambridge, MA, 1996) 84.92. Available from Laboratory, CA, UCRL-WEB-148418, from xlix