Monday, May 2, 2016

WDP - PHP


PHP

  • Explain PHP?

PHP (recursive acronym for PHP: Hypertext Preprocessor), PHP is known as a server-sided language, is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.

  • Explain WAMP

Acronym for Windows/Apache/MySQL/PHP, Python, (and/or) PERL.
It is a package used by PHP developers to develop their web projects on their local windows system.
It comes with Apache server , MySQL database , PHPMyAdmin and PHP creating a suitable environment to development.

  • Explain the difference between procedural and object-oriented programming in PHP.

Procedural programming uses a list of instructions to tell the computer what to do step-by-step. Procedural programming relies on - you guessed it - procedures, also known as routines or subroutines. A procedure contains a series of computational steps to be carried out. Procedural programming is also referred to as imperative programming. Procedural programming languages are also known as top-down languages.
Procedural programming is intuitive in the sense that it is very similar to how you would expect a program to work. If you want a computer to do something, you should provide step-by-step instructions on how to do it. It is, therefore, no surprise that most of the early programming languages are all procedural. Examples of procedural languages include Fortran, COBOL and C, which have been around since the 1960s and 70s.

Object-oriented programming, or OOP, is an approach to problem-solving where all computations are carried out using objects. An object is a component of a program that knows how to perform certain actions and how to interact with other elements of the program. Objects are the basic units of object-oriented programming. A simple example of an object would be a person. Logically, you would expect a person to have a name. This would be considered a property of the person. You would also expect a person to be able to do something, such as walking. This would be considered a method of the person.
A method in object-oriented programming is like a procedure in procedural programming. The key difference here is that the method is part of an object. In object-oriented programming, you organize your code by creating objects, and then you can give those objects properties and you can make them do certain things.
A key aspect of object-oriented programming is the use of classes. A class is a blueprint of an object. You can think of a class as a concept, and the object as the embodiment of that concept. So let's say you want to use a person in your program. You want to be able to describe the person and have the person do something. A class called 'person' would provide a blueprint for what a person looks like and what a person can do. Examples of object-oriented languages include C#, Java, Perl and Python.

  • Identify the rules in naming variables in PHP.

A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume).
Rules for PHP variables:
  • A variable starts with the $ sign, followed by the name of the variable
  • A variable name must start with a letter or the underscore character
  • A variable name cannot start with a number
  • A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
  • Variable names are case-sensitive ($age and $AGE are two different variables)


Reference:
  • http://www.homeandlearn.co.uk/php/php1p1.html
  • http://php.net/manual/en/intro-whatis.php
  • https://www.quora.com/What-is-WAMP-used-for
  • http://www.webopedia.com/TERM/W/WAMP.html
  • http://www.w3schools.com/php/php_variables.asp
  • http://study.com/academy/lesson/object-oriented-programming-vs-procedural-programming.html

CN - IP Subnetting - Class C Exercise

Computer Network

Exercise 1 : You are given an IP Address of 192.168.10.0/26. Calculate how many subnets and host per subnet are available in this network. Create the table for this network:

N =22 = 4 Network
H = 26 = 64 – 2 = 62 Host
Network Address
Valid Host Range
Broadcast Address
Subnet Mask
193.168.10.0
192.168.10.1 – 192.168.10.62
192.168.10.63
255.255.255.192
192.168.10.64
192.168.10.65 - 192.168.10.126
192.168.10.127
255.255.255.192
192.168.10.128
192.168.10.129 - 192.168.10.190
192.168.10.191
255.255.255.192
192.168.10.192
192.168.10.193 - 192.168.10.254
192.168.10.255
255.255.255.192


Exercise 2 : You are given an IP Address of 223.14.3.0/26. Calculate how many subnets and host per subnet are available in this network. Create the table for this network:

N =24 = 16 Network
H = 24 = 16 – 2 = 14 Host
Network Address
Valid Host Range
Broadcast Address
Subnet Mask
223.14.3.0
223.14.3.1 - 223.14.3.14
223.14.3.15
255.255.255.240
223.14.3.16
223.14.3.17 - 223.14.3.30
223.14.3.31
255.255.255.240
223.14.3.32
223.14.3.33 - 223.14.3.46
223.14.3.47
255.255.255.240
223.14.3.48
223.14.3.49 - 223.14.3.62
223.14.3.63
255.255.255.240
223.14.3.64
223.14.3.65 - 223.14.3.78
223.14.3.79
255.255.255.240
223.14.3.80
223.14.3.81 - 223.14.3.94
223.14.3.95
255.255.255.240
223.14.3.96
223.14.3.97 - 223.14.3.110
223.14.3.111
255.255.255.240
223.14.3.112
223.14.3.113 - 223.14.3.126
223.14.3.127
255.255.255.240
223.14.3.128
223.14.3.129 - 223.14.3.142
223.14.3.143
255.255.255.240
223.14.3.144
223.14.3.145 - 223.14.3.158
223.14.3.159
255.255.255.240
223.14.3.160
223.14.3.161 - 223.14.3.174
223.14.3.175
255.255.255.240
223.14.3.176
223.14.3.177 - 223.14.3.190
223.14.3.191
255.255.255.240
223.14.3.192
223.14.3.193 - 223.14.3.206
223.14.3.207
255.255.255.240
223.14.3.208
223.14.3.209 - 223.14.3.222
223.14.3.223
255.255.255.240
223.14.3.224
223.14.3.225 - 223.14.3.238
223.14.3.239
255.255.255.240
223.14.3.240
223.14.3.241 - 223.14.3.254
223.14.3.255
255.255.255.240

Further example and exercise here