Ubuntu Unleashed 2019 Edition: Covering 18.04, 18.10, 19.04

(singke) #1

needed. Put the script somewhere and run it from the command line, like this:
php yourscriptname.php.


This book has a digital-only chapter on the PHP language, available at
http://www.informit.com/title/9780134985466.


Python


Python is one of the easiest languages to read. It has been developed with the
idea that there should be one obvious “right” way to do things. As a result,
most people who use it believe that Python requires very few comments in the
code because the code is easy to read and understand. For the most part, they
are right. Python is also a powerful, fast, easy-to-use and easy-to-learn
language that is worth learning, even if just a little.


Python is installed by default and already in use on your system. To use
Python on Ubuntu, you write programs in your favorite text editor. Nothing
special is needed. Put the script somewhere and run it from the command line,
like this: python yourscriptname.py.


This book has a digital-only chapter on the Python language, available at
http://www.informit.com/title/9780134985466.


Ruby


In Ruby, everything is an object. Every object can be given its own properties
and methods. You can use closures (called blocks in Ruby). You do not need
to declare variables, and only single inheritance exists. Ruby includes garbage
collection and exception handling, and it can be extended by writing
extensions in C. Ruby was heavily influenced in different ways by Lisp, Perl,
Python, and Smalltalk and was originally designed for system administration–
type scripting.


Most Ruby programmers seem to prefer using Ruby in combination with a
web application framework called Rails, making what is known as Ruby on
Rails. This framework is strongly tied to the DRY philosophy: “Don’t repeat
yourself.” Every piece of information is stored in a single, unambiguous
place. Ruby on Rails runs on top of a web server like Apache or Nginx and is
extensible using RubyGems (see https://rubygems.org/).


To use Ruby on Ubuntu, you write programs in your favorite text editor. To
run them, you can install the interpreter package ruby1.8 from the Ubuntu
repositories. Because Ruby changes often, the official Ruby documentation

Free download pdf