Search This Blog

Showing posts with label Open Source. Show all posts
Showing posts with label Open Source. Show all posts
Monday, 6 May 2013

Frequently Asked Questions on PHP & Python

0 comments
FAQ on PHP & Python
  1. What is called suite in PYTHON?

    A suite can be one or more semicolon-separated simple statements on the same line as the header, following the header's colon, or it can be one or more indented statements on subsequent lines. Only the latter form of suite can contain nested compound statemetns.

    For instance, the statement
          if x<y<z: print x; print y; print z;
    will print the values of x, y and z respectively if their values are in ascending order.

    The following is an example for a suite that contains nested compound statement:
          if a>b :
               if a>c:
                   print a;
               else:
                    print c;
         else:
               if b>c :
                    print b;
               else:
                    print c;
    This will display the greatest value among three – a, b and c.

  2. List down the various Built-in Data-types in Python.

    Python has many built-in (native) data types.  Here are the important ones among them:
    1. Booleans
    2. Numbers
    3. Strings
    4. Bytes and byte arrays
    5. Lists
    6. Tuples
    7. Sets and 
    8. Dictionaries
       
  3. Give the functionalities of the following Sequence Type Operator?
            i)  seq[ind1:ind2]
         ii)  obj in seq
  
Colon (:) Operator:
      This operator is applied on sequence data types such as List, String or Tuple to extract a list of items from them.  In Python, the colon : allows the square brackets to take as many as two numbers.  For any sequence which only uses numeric indexes, this will return the portion which is between the specified indexes. This is known as 'slicing', and the result of slicing a string is often called a 'substring'.
      The following code written in Python illustrates this:
           'Hello, World!'[3:9]
      will return 'lo, wo'.
           string = 'Hello, World!';
           print string[:5];
      results in the string 'Hello'. And
           print string[-6:-1];
      will return the string 'World'
in Operator:
      The  in operator is used to iterate through all the items in a sequence of items.
  1. List down the built in functions in Python.
Python documentation lists 80 built-in functions at: http://docs.python.org/library/functions.html
Some of the most widely used built-in functions in Python are as follows:
  • Math functions: abs(x), round(x, n)
  • Type conversion functions: bool(x), float(x), int(x), long(x), str(x)
  • Input functions: raw_input(x), input(x)
  • Miscellaneous: len(x), id(x) 
    5.  How do you create a functions in PYTHON? And write a Python program to print Fibonacci Series.  
          The keyword def introduces a function definition. It must be followed by the function name and the parenthesized list of formal parameters. The statements that form the body of the function start at the next line, indented by a tab stop. 
          The first statement of the function body can optionally be a string literal; this string literal is the function's documentation string, or docstring. There are tools which use docstrings to automatically produce printed documentation, or to let the user interactively browse through code; it's good practice to include docstrings in code that you write, so try to make a habit of it.

          The following is a script written using Python for creating a function that writes the Fibonacci series to an arbitrary boundary:
>>> def fib(n):    # write Fibonacci series up to n
...     "Print a Fibonacci series up to n"
...     a, b = 0, 1
...     while b < n:
...         print b,
...         a, b = b, a+b
... 
>>> # Now call the function we just defined:
... fib(2000)
1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597
Big Questions:
1. A) How will you PHP to access data from MySQL? (16)
(OR)
B) Write a python program to create and use an account object with two functions. (16)

2. A) Write notes on the following:
         i)  Create and Assign Lists
        ii)  Access Values in Lists
       iii)  Update Lists
     iv)  Remove List Elements and Lists (16)
(OR)
B-1)Define a procedure histogram() that takes a list of integers and prints a histogram to the screen. For example, the input 4, 9, 7 should print the following:
                 ****
                 *********
                 ******* (8)
B-2) Write a simple program in python for finding the greatest ans smallest of n numbers. (8)

3. A) Write a program in Python to simulate a simple calculator (8)
(OR)
B) With a neat sketch say how the dictionaries are compared in PYTHON? (8)

Continue reading →

Previous Year Question Paper on Open Source Software

0 comments

B.E. / B.Tech. DEGREE EXAMINATION, MAY/JUNE 2012
Sixth Semester
080230027 – OPEN SOURCE SOFTWARE
(Regulation 2008)

Answer ALL Questions

PART A (10 X 2 = 20 marks)

  1. List the advantages of open source software. 
    Key Advantages of OSS are listed below: 
    • No cost or a lower cost for licensing "open source" solutions
    • Flexibility: A programmer can take a standard software package and modify it to better suit business needs. 
    • Continuing software enhancements available through the open source community 
    • Reliability and Quality: Mature open source software is generally viewed to be of good quality and reliability.
    • Reduces “Vendor Lock-in”: If we are using proprietary software we may be restricted to using certain vendors. Switching vendors in this case usually involves significant costs. 
    • Availability of External Support: We can usually hire a programmer to add a particular function to open source software. Some vendors offer support contracts and there are service providers that install, configure and maintain an OSS system. Many open source products also have active online community support that may be able to answer your questions through online blogs.
  2. What is the differentce between kernel mode and user mode? 
            In Kernel mode, the executing code has complete and unrestricted access to the underlying hardware. It can execute any CPU instruction and reference any memory address. Kernel mode is generally reserved for the lowest-level, most trusted functions of the operating system. Crashes in kernel mode are catastrophic; they will halt the entire PC.
            In User mode, the executing code has no ability to directly access hardware or reference memory. Code running in user mode must delegate to system APIs to access hardware or memory. Due to the protection afforded by this sort of isolation, crashes in user mode are always recoverable. Most of the code running on your computer will execute in user mode.
  3. How to create a table in MySQL when it does not exist?
            This is the sql syntax for create table. Utilise the IF NOT EXISTS clause to create a table when it does not exist:

            CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name [(create_definition,...)] 
  4. How to create a new user in MySQL database server?  
           The user creation process continues with inserting the new user's values such as host, username and password into the user table in the MySQL database, containing the log-in details of everyone who has any level of access to the database. 
           This is done with the help of CREATE USER command, which is available only in MySQL 5 (5.0.2) and newer releases, and it follows this syntax:
                CREATE USER user [IDENTIFIED BY [PASSWORD] 'password']
           For instance, creating a user 'michael' with a password 'mypassword123' is done by establishing a connection to the MySQL server as root and executing the following query:
              CREATE USER michael IDENTIFIED BY PASSWORD 'mypassword123';
  5. List the different data types supported in PHP.
  6. Using while loop write a php code to display 1 to 5.
  7. List the dictionaries operations in Python.
  8. What is the difference between tuple and list in Python?
  9. Highlight the features of Perl.
  10. What is the use of ARGV in Perl?

PART B (5 X 16 = 80 marks)

11. (a) (i) List any eight file related commands in Linux and explain their features. (8)
          (ii) Discuss the different types of file systems in Linux. (8)
Or
(b) (i) List any eight Linux signals and highlight their features. (8)
    (ii) Explain the scheduling mechanisms in Linux. (8)


12. (a) (i) List any four string related functions in MySQL and explain its syntax. (8)
          (ii) How to use MySQL Left join to select data from multiple tables? Explain. (8)
Or
(b) (i) What is metadata in MySQL? How to obtain it and use it? Explain. (8)
     (ii) Explain the process of sorting the Query results in MySQL. (8)


13. (a) (i) Explain the process of uploading files to the server in PHP. (8)
          (ii) How will you use PHP to access data from MySQL? (8)
Or
(b) (i) Explain the process of sending an e-mail with PHP. (8)
    (ii) Explain debugging and error handling process in PHP. (8)


14. (a) (i) Write a Python program to print Fibonacci series. (8)
          (ii) How to use Python as a Calculator? Explain with any to examples. (8)
Or
(b) (i) Explain the error and exception handling mechanisms in Python. (8)
     (ii) Write Python code to create an account object with two functions. (8)


15. (a) (i) List and explain the control structures in Perl. (8)
          (ii) List and explain the various file operations in Perl. (8)
Or
(b) Explain the data manipulation functionalities provided by Perl. (16)
Continue reading →
Monday, 28 January 2013

Test your knowledge on the Basics of OSS & MySQL

0 comments

FAQ on Open Source Software and MySQL

Two Marks:                                                 (2 x 5 = 10)
1.  What does a free software refer to?
2.  List the advantages of OSS.
3.  What is MySQL?  Why do so many organizations use MySQL?
4.  How to create a new user in MySQL database server?
5. How do you sort a MySQL query result?


Big Question:                                                   (1 x 10 = 10)
1.  Explain SELECT statement by proving examples for the following:
a)  Retrieving individual column
b)  Retrieving multiple columns
c)  Retrieving ALL columns
d)  Retrieving distinct rows
Continue reading →
Wednesday, 28 December 2011

Application of Free and Open Source Software

16 comments
APPLICATION OF FOSS!

FOSS is software that has made its source code open to the public. Software is written using a programming language and the resulting text is called the source code. The source code determines what a program can do. But to be actually used on a computer, the source code has to be translated into object or binary code: one or several files containing a set of ones and zeros that the computer can run. Proprietary, non-free software is distributed only in binary files; the source code is a closely guarded secret and considered valuable intellectual property. FOSS users get both – the binary file to run, and the source code to inspect, modify and recompile into new object code.

FOSS is very common. In fact, most people use it, at least indirectly, every day without realizing. It is a dominant force on the Internet. Indeed, more than half of Internet servers — computers that store websites and make them accessible — run on a FOSS operating system such as GNU/Linux. To “hand out” web pages, 60 per cent of Internet servers use the Apache program. Ninety per cent of the domain name system that enables browsers to find a website by calling its domain name (e.g. www.unctad.org) runs on a FOSS program called BIND. FOSS programs address similar needs and provide functionalities — such as word processing, e-mail or web browsing — similar to those of public domain, freeware, shareware or proprietary programs.

The most accessible example of open source code is the World Wide Web. A web page is displayed in a browser when it reads and interprets the html code for that page. This code is usually contained in an html file received from the computer server hosting the web page. Anyone can inspect the source code of a website by clicking “View > (Page) Source” on the browser menu. This “bare all” nature of web pages enabled the fast adoption and broadest use of the World Wide Web.

Free and Open License:

The Open Source Initiative provides a three-point criterion called the Open Source
Definition:
  1. Source code must be distributed with the software or otherwise made available for no more than the cost of distribution;
  2. Anyone may redistribute the software for free, without owing royalties or licensing fees to the author;
  3. Anyone may modify the software or derive other software from it and then distribute the modified software under the same terms.
FOSS programs are distributed with specific licenses that permit, or even motivate users to inspect, modify and redistribute the source code under the same or similar conditions. Free and Open licenses are designed to prevent or discourage the transformation of FOSS into proprietary software. The reasoning is that if developers choose to distribute a program as free/open source, they may have an interest in keeping it, and any derivations and improvements, free and open as well.

FOSS, just like proprietary software, comes with user licenses and relies on IP (Intellectual Property) regulation for protection and legal remedy. Without IP regulation, FOSS enters the public domain and loses its value, thus rendering development and commercial exploitation difficult, if not impossible. While FOSS generally allows free access, copying and distribution, its licenses restrict or discourage bringing these activities under a proprietary license.

FOSS and Commercial Applications

FOSS has often been misrepresented as non-commercial software created for and by hackers, and therefore it may not have many relevant applications for commercial and business use. In fact, many established Internet business and websites, such as Google.com, Yahoo.com and Amazon.com, use FOSS operating systems or web server software.

The Open Source Initiative was established in order to promote the use of free software in commercial environments.  It chose to employ the term “Open Source Software” instead of “Free Software” in order to avoid the ambiguities of using the term “free” in a commercial or business context.  It argues that the open source development process produces better and more reliable software with obvious advantages in terms of open standards, security, support, bug fixing and future development – all important business considerations.

Selected Examples of FOSS:

FOSS is often used in mission-critical environments. Many industry standard applications are in fact open-source programs. Selected notable open-source programs are discussed below. More complete listings of FOSS software can be found at the UNESCO and UNDP websites.

There are many websites that host FOSS development or catalogue FOSS programs. Among the more popular are sourceforge.net and freshmeat.net.  The open-source web server software Apache (http://www.apache.org /), which sends web pages to the computer of someone accessing a website, has dominated its market segment since 1996 and now has at least twice the market share of its nearest competitor.

GNU/Linux (http://www.gnu.org/ ) has long been popular as an operating system running computers that perform as web servers.  Recent surveys show that GNU/Linux runs 29.6 per cent of web servers. In the last few years it has increasingly penetrated both the high and the low ends of the enterprise market for server operating systems. GNU/Linux runs on Intel/AMD type PCs, while versions for other hardware have been developed as well. To install GNU/Linux, one must have a "distribution". One can buy a CD, download or make a distribution. Linux Online is but just one website with comprehensive information, FAQs and links. However, there are many professional and amateur online resources for GNU/Linux that may be explored and used.

The BSDOS/FreeBSD/NetBSD/OpenBSD (http://www.bsd.org/ ) family of operating systems are UNIX-based, free/open-source operating systems similar to GNU/Linux. Developed at the University of California-Berkeley in the 1970s, BSD is considered one of the most secure and stable operating systems and runs a large percentage of Internet servers. The core of Apple’s Macintosh operating system, Darwin, is based on FreeBSD and has remained in the open- source realm.

GNU was the predecessor of GNU/Linux (http://www.fsf.org/). It is a free version of UNIX tools created by Richard Stallman in 1984. GNU stands for “GNU is Not UNIX”.

Sendmail (http://www.sendmail.org/ ) is a free/open-source programme used for routing approximately 40 per cent of the email that travels over the Internet.

Perl (Practical Extraction and Report Language) is a scripting language freely available for UNIX, MS/DOS, Macintosh, OS/2 and GNU/Linux, among others (http://www.perl.com/ ; http://www.perl.org/ ; http://www.perlfoundation.org/ ). It has powerful text- manipulation functions and is used extensively for programming Web electronic forms, and generally for generating interfaces between systems, databases and users exchanging data on the Internet.

BIND (Berkeley Internet Name Domain) is a free/open-source programme that allows Internet domain names to be entered as text-based names instead of as IP addresses, or series of numbers, thus making it easier for users to reach sites on the Internet. (http://www.isc.org/products/BIND/ )

The Beowulf Project (http://www.beowulf.org/ ) is a method of connecting computers to form a high-performance computer (Beowulf cluster) that approaches "super-computer" performance. Since a Beowulf cluster can be developed from common, off-the-shelf computers utilizing FOSS, a Beowulf cluster "super-computer" can be built at a fraction of the cost of other systems with similar computing capacity.

OpenOffice.org (http://www.openoffice.org/ )is a software suite that provides basic office and administrative automation. An offshoot of Sun Microsystems’ StarOffice, OpenOffice runs on all major operating systems, including MS Windows, as its cross-platform functionality is based on open XML standard file formats.

GNOME and KDE (http://www.gnome.org/ ; http://www.kde.org/ ) are desktop graphic user-interfaces that run on top of GNU/Linux and UNIX, providing user-friendly computing to the non-programmer open-source community.

MySOL and Postgres are database servers. (http://www.mysql.com/ ; http://www.postgresql.org/ )

The Gimp (http://www.gimp.org/ ) is a graphics programme widely distributed with GNU/Linux. A version for the Windows operating system also exists. It is sometimes called "free photoshop".
Continue reading →
Thursday, 15 December 2011

Introduction to Open Source Software

0 comments
OPEN SOURCE SOFTWARE! 
Open Source System is a subset of large class of systems called “Open Systems”. The term “Open System” refers to any system that can be extended or modified by the user during its life time.
In a Closed System, there is a clear distinction between the time of design and the time of use. The scope of the closed system at the time of use is limited to the decisions made at the time of design.
Open Source System:
Open Source System can be defined as “Software that is made available along with the source code”.  Such software can be developed in an environment, where the source code is available for inspection, analysis and programming enhancements through a communal effort.  Therefore, Open Source System development is considered as a process of development in which developers voluntarily collaborate to develop software that they or their organizations need.
Open Source System refers to a stack of software solutions, which are available for free to use and re-distribution.  Products such as Apache software for Servers, the Linux OS, and various file sharing/communication software platforms are some of the more successful Open Source projects to date.
Free Software:
Free Software is a kind of software which is freely exchanged with source code among a community of users.  The word “Free" in the Free Software refers to the freedom or liberty which any one have in accessing the Source code of the product, and NOT price.  Free software ensures the following:
  1. Freedom to run the program
  2. Freedom to study how the program works and adapt it to specific needs as the source code is accessible
  3. Freedom to redistribute copies to help other users needing the software
  4. Freedom to improve the program and release the improvements to the public so that the entire community benefits.

Open Source Software:

Free Software is also called as Open Source Software (OSS), because the ownership of the Free Software is obtained by obtaining the source code along with the product.  Accessibility of source code is the pre-requisite for Free Software.
The user of Free Software can redistribute its copies either with or without modifications either at no cost or charging fee for distribution to anyone.  The user need not ask permission or pay for getting the license to do modification or redistribution of Free Software.

The distribution terms of Open Source Software must comply with the following criteria:
  • The re-distribution must be free.  It doesn’t require additional license for redistribution.
  • Distribution must include both the source code and the compiled form of the product.  Parts of the product not distributed with source code must have clear methods of getting the source code of the parts for no more than a reasonable reproduction cost.
  • Derived works from the original software must be re-distributed under the original license.
  • The license may restrict source code from being distributed in modified form only if the license allows the distribution of “path files” with the source code for the purpose of modifying the program at build time.
Thus Open Source is a strategy to support the Free Software Movement.

Here is a video presentation on the Basics of Open Source Software:
Proprietary Software:
Proprietary software is a software product, which is developed or owned by one party.   Proprietary software is the legal property of only one party.  The terms of use by other parties are defined by contracts or licensing agreements. These terms may include various privileges to share, alter, dissemble, and use the software and its code.
Generally, with proprietary software, the source code of the software is not available, or the licensor doesn’t grant the freedom to use, modify, and distribute the source code of the product.  Well known examples of proprietary software include Microsoft Windows, RealPlayer, iTunes, Adobe Photoshop, Mac OS X, WinZip and some versions of UNIX.
Some proprietary software comes along with source code or provides offers to the source code.   Users are free to use and even study and modify the software in these cases, but are restricted by either licenses or non-disclosure agreements from redistributing modifications or sharing the software.  Examples include Pine, the Microsoft shared source license program and certain implementations of SSN.
Shareware, Freeware and Abandonware:
Shareware and Freeware are proprietary software, which are distributed without their source code. A freeware is a kind of proprietary software, which is available for free but without the source code.  It may or may not provide all the features available in the original copy of it.

        Shareware, like freeware, is proprietary software available at zero price, but differs in that it is gratis only for a trial period, after which some restrictions is imposed or it is completely disabled.  Proprietary software, which is no longer marketed by its owner and is used without permission by users is abandonware and may include source code.

Open Source Projects:

          Linux is considered open source. Its source code is included in all its distributions and is feely available on the Internet. Many major software development efforts are also open source projects such as the KDE and Gnome desktops along with most of their applications.

          The Netscape Communicator Web browser package has also become open source, with all its source code freely available. The StarOffice office suite supported by Sun is now an open source project. Recently, open source applications that run on Linux have located their Web sites at Source Forge (sourceforge.net).

          Source Forge is a hosting site designed specifically to support open source projects. We can find more information about the open source movement and recent developments at both Linuxcare (http://www.linuxcare.com/) and at http://www.opensource.org/.


Continue reading →
Tuesday, 4 October 2011

More about Open Source Software

0 comments

NEED FOR OPEN SOURCE SOFTWARE!
 The following are the factors that lead to the development of Open Source Software:
  1. Diminishing the high monopoly value of the Proprietary Software
  2. Avoiding discrimination among persons like developers of the product and users of the product
  3. Enabling the user finding and fixing the bugs themselves
  4. Allowing customers to have control over the products they use and to redistribute the same with or without modifications.
1. Diminish the monopoly value:
The user doesn’t have one vendor to depend upon in OSS development approach. This is in contrary to the traditional approach used for developing Proprietary Software, which has a high monopoly value for its produc.
The process of developing OSS is done through rapid evolutionary delivery of source codes. The source code is accessed and adapted to fix defects and improve the product. With a sufficient base of co-developers all over the globe the pace is much faster than the traditional methodology of development.
The co-developers are connected by the internet. The developers can access, read and distribute the software. If the developers are spread across the globe then the development would happen all round the clock.
The OSS is subjected to regular peer reviews thus minimizing the defects and dramatically improving the quality of the code. There are several successful OSS products that are developed in this methodology of development, namely Linux, KDE, and Mozilla web browser.
2. No discrimination among Users and Developers:
Proprietary Software makes clear discrimination between the Developer of the system and the User of the system. Proprietary software is generally developed by a group of people belonging to a company and is marketed to its customers by the company for a price. Moreover, the software is available only in the compiled form, with out the source code.
By not providing the source code along with the product, the proprietary software makes a distinction between the time of design and the time of use of a product.  Thus, the scope of the proprietary software at the time of use is limited to the decisions made at the time of design. This discrimination is overcome in OSS by providing the source code freely along with the binary form of the software.
3. Bug Fixing done by the User:
Proprietary software has many “dark corners” in which bugs and other quirks can hide. For e.g., “hanging the system due to malfunctioning of hardware or software” - was a bug in older versions of Windows OS. Such bugs can’t be rectified by the user in proprietary software due to unavailability of its source code.
The source code is crucial for understanding how a product works and fixing the bugs that may arise during its execution. Open Source Software makes the source code available to its customers, which is essential for finding and fixing security holes and other undesired behavior.

4. Gives control over the Product:  

In large software companies, few employees have access to source code, and the employees who have access are rarely available directly to customers. When the developer of the product doesn’t provide their services for maintenance and modification of the software, the user can’t have any control over the software.
On the other hand, Open Source Software gives customers a much greater ability to customize software to fit their business needs. The users of the system can make modifications and extensions at any time in a system’s life cycle using the source code of the system. They can choose to maintain the software themselves either directly of by hiring a third party.

Advantages of OSS:
 The main advantages of Open Source Software lies in its development process, which include the following:
  1. Low development cost
  2. High development speed and
  3. Good software quality that is proven world wide.
  4. User doesn’t have to depend on one vendor.
The other key advantages are:
Stability: As every modification is equally open (not necessarily free) OSS is more stable than commercially distributed software.
Adaptability: It is easy to adapt the OSS to your requirements and OSS has a high degree of interpretability.
Quality: More new features, less bugs, and peer review are significant to the quality of a product. Currently this is the best in OSS.
Performance: OSS has proven to be a tough competitor to other commercial software on the aspect of performance.
Scalability: OSS has been much better than commercial products in terms of user scalability, i.e., increasing number of users per copy. It is also scalable on multiple hardware / processor.
Zero-price tag: The near zero cost of OSS saves lots of money for the organization in terms of license free. Moreover, mature OSS provides very high reliability.

Licensing for OSS: 
         
          Open source software is protected by Public Licenses. These prevent commercial companies from taking control of open source software by adding a few modifications of their own, copyrighting those changes, and selling the software as their own product. The most popular Public License is the GNU Public License provided by the Free Software Foundation. This is the license under which Linux is distributed.

          The GNU Public License retains copyrights, freely licensing the software with the requirement that the software and any modifications made to it are always freely available. Other public licenses have also been created to support the demands of different kinds of open source projects. For instance, the Lesser GNU Public License (LGPL) lets commercial applications use GNU licensed software libraries. Netscape made its Netscape Communicator software available under a Netscape Public License (NPL), which covers modifications made directly to the Netscape source code.

          Linux is currently copyrighted under a GNU Public License provided by the Free Software Foundation, and is often referred to as GNU software. GNU software is distributed free, provided it is freely distributed to others. GNU software has proven both reliable and effective. Many of the popular Linux utilities, such as C compilers, and editors, are all GNU software applications.

          Under the terms of the GNU General Public License, the original author retains the copyright, although anyone can modify the software and redistribute it, provided the source code is included. Also, no restrictions exist on selling the software or giving it away free. One distributor could charge for the software, while another one could provide it free of charge.

          Major software companies are also developing Linux versions of their most popular applications. A Linux version of Sun’s Java Development Kit (JDK) is also available through ftp://ftp.blackdown.org/. Corel has developed a Linux version of WordPerfect, while Oracle provides a Linux version of its Oracle database.
Continue reading →