Posts

Showing posts from April, 2025

Sorting of an array in PHP

There are several methods in PHP to sort an array. Array can be sorted either by array’s key or by array’s value. Please refer to PHP documentation to see details of these methods.

Removing an item from an array in PHP

Removing an item from an array in PHP can be done by using unset function. This function accepts which array’s element needs to be removed. If instead of array’s element an entire array is passed to this function then the entire array will be deleted and will no longer be accessible.

Converting array values and keys to a string

It is possible to convert an array’s values to a string by using implode function. Implode function takes two arguments. First one is a character that will separate values in a string, second one is array. It is possible to create a string out of array keys by using arrays_keys function.

Checking if a value is in array

It is possible to use in_array method to check if a value is in array or not. This method will return true if a value is in array and false if it is not.

Checking if a variable is an array

It is possible to check either a variable in PHP is an array or not. This is done by using is_array method. Result of this function will be true, if a variable is an array and false if it is not.

Checking array’s key

It is possible to use array_key_exists function to check if the array’s key present or not. It is also possible to check if the value of the array’s key present by using isset method. To check wether value of the element is empty or not, it is possible to use empty method.

Arrays in PHP

Array is ordered list of elements. Array in PHP can be defined by two different ways. First one is to use keyword array, and second one is to use square brackets. If these don’t contain any data, then it will be an empty array at initialization. However, it is possible to initialize an array with values. In order to do so values of that array needed to be specified.

Pass by reference

First of all passing a variable in PHP by reference means to modify this variable instead of making copy of it. An example of this feature is to change values of an array as it is being iterated over. Passing a variable by reference in PHP is done by prepending ampersand sign in-front of a variable.

Greater than or equal, less than or equal checks

It possible to check if one value is greater than or equal to another one. In this case greater than sign needs to be used along with the equal sign. It is possible to perform this check to another side, in this case instead of greater than sign less then sign needs to be used.

Inequality in PHP

Inequality in PHP is represented by exponential sign this is if two values are not equal to each other. Another type of inequality is if one value is greater than another one. This are represented by less than or greater then signs.

Comparing values

In addition of checking if two values are equal to each other, it is possible to check if one value is greater or smaller than another one. These are represented by > and < singes. It is possible to add equal sign to this check, therefore a check will be made if two values also equal to each other.

Equality and sameness in PHP

Equality in PHP is represented with two equal signs. For example number 7 will be equal to string “7”. Being same is represented in PHP by three equal signs. Even so content of both instances are the same, however different types are being used, therefore result of this operation will be FALSE.

Constants in PHP

Constants in PHP can be defined by two ways: First one is by using const keyword or by using define function. Even so it is possible to code a program without constants, constants make code more understandable and more manageable. For example if a constant name is max_speed , we know it is not max_weight. Constants make code more manageable. For example if max speed was 55 and later it became 65, there no need to look through the code and change all instances of max speed, it can be made only once. PHP Constants: Study Guide Quiz What are the two primary ways to define a constant in PHP according to the source? How can constants improve the readability of your code? What is an example provided in the source to illustrate how constants improve understandability? How do constants contribute to code maintainability? Describe a scenario where changing a constant's value makes code modification easier. Is it possible to write a PHP program without using constants? What is the advantage ...

IF operation in PHP

if operation in PHP defines which route the application needs to take based om the evaluation of a Boolean expression. The code inside of the if statement will be executed only in case when the condition of the expression is true , if it is false the statement inside of the if statement will be skipped. It is possible to specify more if conditions if the first if condition fails. These are specified by elseif keyword and Boolean expression inside of it. There may be more than one elseif section. The code of that section will be executed where the first occurrence of the expression is equal to true, the rest of the conditions may also return true, however they will be skipped over. It is  possible to specify else condition in the if statement. else condition is optional. Code that is inside of else statement will be executed only in case, when the prior cases return false.

Basic assignment in PHP

Basic assignment in PHP is done by an equal sign. A variable goes to the left and the value goes to the right. Value can be a number, a string, another variable or a constant.

Changing order of mathematical operations in PHP by using parentheses

Parentheses in PHP means that operations declared within parentheses needs to be performed first and then mathematical operation needs to be performed on entire result of operations in parentheses.

Combing mathematical operations with an equal sign in PHP

It is possible to combine mathematical operations such as addition, subtraction, multiplication, division and remainder with the equal sign. Remainder is represented by a percentage sign. It is a shortcut of performing this operation and assigning value back to the original variable.

Accessing class methods in PHP

It is possible to access class methods in PHP by two different ways. First one is to use double colons and second option is to use dash with an arrow pointing to the right. What is the difference between two? Arrow pointing to the right will invoke a function of the instantiated object, where double colons will use a class method.

Concatenation of strings in PHP

Concatenation of strings in PHP is done by a . (dot) sign. It is possible to combine dot with equal sign to make both concatenation and assignment operations at once.

Order of mathematical operations in PHP

By default mathematical operations in PHP follow rules of the same priorities as in regular math. It means that PEMDAS principle is in use. PEMDAS stands for parentheses, exponents, multiplication, division, addition, subtraction. It is important to note that multiplication and division is done from left to right, there is no priority of multiplication over division, same principle applies to addition and subtraction.

Combined assignments operations in PHP

There are a few combined assignments operators in PHP. These operations are represented with a type of mathematical function that needs to be performed and the equal sign. It is possible to perform the following operations: addition, subtraction, multiplication, division and modulus or remainder. The last one is represented with a percent sign.

Accessing object and class objects in PHP

It is possible to access class and object’s methods in PHP. In order to do so double colon signs or double colons can be used. Difference between two is that the first one can be used on class without instancing it, second one is used by the instance of a class.

AND and OR operations in PHP

In PHP there are two sets of AND and OR logical operations. First case is represented with word AND and OR, second case is represented with symbols && and ||. There is a difference of the priorities of operations between these two sets of operations. It is safer to use && and || instead of first case.

String operations in PHP

There are tow string operations in PHP. First one is a dot . It concatenates two strings together. If a space needs to be concatenated, then please not forget it. Concatenation of two strings will not add a space. Second one is concatenation and assignment operations. It is represented by dot followed by equal sign.

Inline if operation in PHP

It is possible to perform if operation inline. It is good for simple code only, if complex code uses this operation then the code will be difficult to understand. First a comparison operation needs to happen, if the return value of this operation is true then the code that follows question mark symbol will be executed, if false then code that follows colon sign will be executed. The result of these operations will be assigned to a variable that precedes this conditional statement.

Changing values by one in PHP

It is possible to increment value of a variable by one in PHP by using ++ operation. ++ operation can either precede or follow a variable. Preceding or to following a variable changes the priority of incrementing or decreasing operations. If ++ or — sings precede a variable then operation to this variable will happen first, and then operation with already changed variable will happen. For example, if we have a variable $i which value is 1, then outputting ++$i will result in 2, and the value of this variable will be 2. If ++ signs are behind the variable, then outputting value will output the current value of a variable and increasing operation will happen next. Output of such operation will be 1, however the value of this variable will be 2 after this operation.

Execution operation in PHP

It is possible to store the output of an external command in a PHP variable. This is done using backticks operation. A external command that is within the backticks will be executed and the output of it will be returned back as result of this operation.

Spaceship operator

First of all spaceship operator in PHP is represented by opening bracket, equal sign and closing bracket. It looks like this: <=> The idea behind this operation is to find if first value is less than, equal to, or greater than second value. Of course this functionality can be achieved with regular if conditions, it is designed to simplify things.

Coalesce operation in PHP

Instead of writing IF statement it is possible to do the functionality that goes into IF statement inline. Conditions are represented by two question marks. An operation that needs to be performed follows that. The result of this operation is assigned to a variable that precedes that whole operation. Of course it will not work for complex functionality and it was not designed for it, but simple operations can be simplified even further.

Converting from a Boolean value to an integer in PHP

It is possible to convert a Boolean value to an integer type in PHP. Boolean type has two options of being either true or false. If this conversion is done, then value of True will be converted to 1 and value of False will be converted to 0.

Division of integers in PHP

There is no special division operation that is specific to integers. Division of two integers may result in a floating point number.

Overflowing an integer number in PHP

In a case when an integer number goes beyond the upper or lower limit, it will be transferred to a floating number. Floating number has a higher limit than an integer number.

Integer type data sizes

Integers are the whole numbers. Integers can be present as numbers with base 10, or normal numbers that we use. Integers can also be represented as binary numbers, octal numbers or hexadecimal numbers. It is more convenient and efficient for a computer to use base other than 10.

NULL

NULL represents the absence of any value. It is possible to check if a variable to set to NULL or not by using is_null function or to perform a Boolean operation to compare to null value.

Type juggling

PHP will try to determine a type of a variable by the context of the operation. For example if two integers are added to each other, then the result is also will be an integer, however if one integer is divided by another, the result is likely to be a floating number.

Type casting

PHP will try to determine a type which is needed for a specific operation, however if you want to be in control, then it is possible to do it manually. In this case a type of a variable needs to be specified in the parentheses before the variable.

Type juggling

Type juggling in PHP means that PHP will try to determine which type of a variable needs to be used in case when a numeric operation is performed. For example 2 + 2 will result in the integer, therefore integer data type will be used for the result. However, 2.1 + 2.1 will result in a number with a floating point, therefore a numerical type that supports a floating point will be used.

Type casting in PHP

PHP tries to guess which type is in use by a variable. If it is need manually override this functionality and specify which type of data needs to be used then it possible to specify it in the parentheses before a variable.

External resources

External resources are the type of data that can be accessed by a program that is outside the scope of this program. The following external resources are accessible from within a PHP script: file, socket, stream, document or connection.

Comments in PHP

Comments can be used to describe the functionality of specific code, the reason why it is needed. Comments in PHP can either be single line or multiple line comments. Single line comments begins with double slash lines. Multiple line comments are denoted with a slash symbol and a star. This denotes the beginning of a comment. A star and a slash symbol indicates where the multiple line comments ends.

Current file - predefined constants

Current filename can accessed with the help of __FILE__ constant and __DIR__ constant can be used to determine the directory in which the script was executed.

Predefined constraints in PHP

At least two constants had been predefined in PHP, these are: __FUNCTION__ and __METHOD__ First one will return the name of executed function and the second one will return both the name of the class and the name of executed function.

Checking if a constant is defined in PHP

It is possible to use “defined” keyword to check if a constant was defined or not. it would be a bad thing if a code refers to a constant that had not been defined.

Scope of constants

Constants are defined in the main code of a program. Like superglobal variables scope of constraints are everywhere in the program code.

Constants in PHP

Constants in PHP are defined with a keyword CONST. Unlike variables constants don’t take up memory. Constants make code more understandable and more flexible. Let me explain these two things: Let’s use maximum speed as an example. A constant with a name of maximum speed is more descriptive than a number. If maximum speed is to be charged, it is needed to change it only in one place, where the constant is defined and not look through the code to find all of occurrences of maximum speed. It would be a bad thing, if all of occurrences of it got changed, but one did not.

Commutative property of mathematical operations

Commutative property of operation states that it does not matter in which order operation is going to be performed first, but the result is going to be the same. For example addition is commutative. 1 plus 2 is equal to 3, and 2 plus 1 is also equal to 3. Subtraction operation is not commutative. 3 minus 1 is equal to 2, however 1 minus 3 is not equal to 2, however it is equal to -2 instead. Results are two different numbers.

Subtraction

The opposite operation to addition is subtraction. Subtraction is used to find difference between two numbers. for example 7 tomatoes are available and two of tomatoes are used for a salad, how many tomatoes left? It is possible to represent it as mathematical problem: 7 minus 2 is equal 5. Order of operations in subtraction matters. For example 2 minus 7 is not the same as 7 minus 2.

Addition

Addition is represented by a plus sign. For example if there are two apples and there are three more apple we can perform an addition operation to know the total. There will be two apples plus three apples of five apples in total.

Basic counting

Basic counting is from number zero to number nine. Basic counting has ten digits. It makes sense to count by ten. We have ten fingers, therefore it is easy for us to count by ten. If we had eight fingers we would be counting by eight. in some countries count is done by 12 or a dozen. Honestly I don’t know where a dozen comes from, I need to do additional research of it. Our digits are from zero to nine, therefore are also ten digits.

Introduction to mathematics

Mathematic does not depend on a person. Mathematicians is not a surgery that needs to be performed . Two plus two always is equal to four regardless of a person is present or not.

Handle errors in PHP code

It is possible to handle errors in PHP by placing code in try/catch block. Try block will be used to execute piece of code, for example it can be division of one variable by another. If the divisor is equal to zero then it is an invalid operation and will produce a mathematical error. There may be more then one catch block, each catch block will handle specific type of error. If error type is not specified then catch block will handle all of the error types. In order to handle errors then code within catch block will be executed. It is possible to specify one more section in try/catch block. It is denoted by keyword finally. It will be executed regardless if an error occurred or not. It maybe possible to omit catch block and only have finally block.  YouTube video  

var_dump PHP function

var_dump PHP function provides more details about PHP variable. It not only provides its content, but also provides the type of the variable. Second argument is optional, It can be either true or false, 0 or 1. By default it is false, so the content of a variable will be outputted to the screen. If second variable is 1, then the formatted content of a variable will be assigned to a different variable. YouTube video

print_r function in PHP

Sometimes it is useful to output debugging information about a variable. print_r can help with that.  print_r function takes two arguments. First one is the text to be displayed, it is a variable that contains a text to be displayed. And the second argument is either 0 or 1. Second argument indicates that first variable contains preformatted HTML text, if it is so, than the value needs to be set to 1 or true. YouTube video

print vs. echo in PHP

print and echo commands are similar to each other in a sense that both of these will output the value to be printed on the screen. The difference between two is that print will return a value of 1, so it can be used in an expression. YouTube video

SuperGlobal variables in PHP

SuperGlobal variables in PHP are the variables that always available regardless of the context. Example of SuperGlobal variables are: $_REQUEST it holds data submitted by HTML form $_GET it holds data submitted by HTML form via GET method $_POST it holds data submitted by HTML form via POST method $_FILES it holds data about files submitted via POST method $_SERVER this SuperGlobal variable contains information about server $_COOKIE this SuperGlobal variable is used to retrieve cookie information via its name. $_SESSIOON this SuperGlobal variable is used to set and retrieve session value that is stored in the server. YouTube video

$_POST variable in PHP

Post method can transmit more data than GET method. GET method will place values in the URL, where POST method will not do that, but will transmit the data without placing it in the URL. There are two reasons why POST method should be used instead of GET method. 1. Security. GET method will place submitted data in the URL, so it can be visible by others. 2. POST can handle bigger volume of data than GET method. For example, when the file needs to be submitted, than it is preferred to use POST method rather than GET method. YouTube video

Managing browser cookies with PHP

PHP has a way to manage browser's cookies. It is done via setcookie command. setcookie has three parameters. These are cookie name, cookie value and expiration time of the cookie. Some browsers block third party cookies. First-party cookies are cookie files that are coming from the domain a persons visits. Third-party cookies are set by an another domain than a domain which a person visits. Third party cookies are often used for advertisement purposes. YouTube video PHP Cookies Study Guide Quiz What is the primary function of the setcookie command in PHP? Name the three essential parameters that the setcookie function requires. Explain the difference between first-party and third-party cookies. Why might some web browsers choose to block third-party cookies? If a website's domain is example.com, where do first-party cookies from this site originate? What is the role of the expiration time parameter in the setcookie function? Provide a common reason why third-party cookies are f...

Accessing submitted files in PHP

Submitted files via web form are accessible in PHP via associative array $_FILES . Key of the array will be filename associated with the submitted data. For example it can be text.txt Value of the array element will be content of that file. YouTube video

$_GET variable in PHP

$_GET variable contains an array that consists of keys and values passed at the URL. Keys of the array will be parameters at the URL, and values of the array will be values assigned to those variables. For example: http://example.com?make=Mercedes&model=S500 In this example keys of the array will be make and model , and values associated with these keys will be Mercedes and S500. To access it, it is necessary to use $_GET variable. YouTube video

Identical operator in PHP

Identical operator in PHP is represented with three equal signs. Not identical operator in PHP is represented with explanation point and two equal signs. Example of identical values is 5 is identical to 5, however 5 is not identical to 5.0. These are the same numerical values, however these are different data types. Identical operator is not the same as comparison equal operator in PHP. YouTube video

Evaluation of variables to True or False in PHP

Variables other than Boolean type can be evaluated to truth or false in PHP. Strings of non-zero length are evaluated to True. Non-zero integers are evaluated to True, zero integers are evaluated to False. This principle applies to whole numbers as well as numbers with floating point. null is evaluated to False. YouTube video

User defined variables in PHP

A user may define a new variable in a PHP script. What is the scope of that variable? If a variable was defined in the scope of main code, than this variable has global scope by default. Variables that had been defined within a function, have local scope. Meaning access to them is available within this function only. To overcome this, a variable can be declared with global keyword in front of it. YouTube video

Default value of a variable in PHP

Default value of a variable in PHP that had not been assigned a value is NULL or absence of any value. If it is a Boolean variable then its default value is FALSE. YouTube video

Super global variables in PHP

Super global variables in PHP are available everywhere and there is no need to define them. Super global variables have $_ in the beginning. Example of super global variables are: $_SERVER $_GET $_POST $_FILES $_COOKIE $_SESSION $_REQUEST $_ENV Super global variables hold vital information about the environment. YouTube video

Truthfulness and identical operator in PHP

First I need to define what these terms are. Truthfulness is checking values of variables, if values are equal to each other then returning value is True, otherwise it is False.  Identical is checking not only values, but also data types. In PHP truthfulness is represented with two equal signs, and identical is represented with three equal signs. Example of equality. Integer value of 5 will be equal to a floating number 5.0, however these are different data types and therefore identical operation will return false.  YouTube video

Scope of a variable in PHP

Variable scope can be of tree types: variable can be local, global or super global. When a variable is defined in PHP then its scope is local, meaning that it is accessible within a section of a code it is in, this variable is not accessible from a different function. Global variables are accessible everywhere. There are also super global variables, these are predefined. Example of super global variables are $_SESSION, $_POST, $_GET, $_ENV. I just list a few of them, for full list of super global PHP variables consult documentation. YouTube video

PHP data types

There are several data types in PHP. I will list these: Null - represent absence of a value. Boolean - it is true or false. Integer - upper limit, depends on the computer architecture. Float - a number with a digits after a floating point. Array - a collection of data types. Numbering of elements in array starts with 0. An array may contain data of various types. String - this variable contain a list of characters, this is same as having an array of characters. Object. The methods and variables of an object can be accessed with an arrow pointing to the right. Resource variables hold handles to open objects, these can be files, databases, images, etc. YouTube video

Executing PHP code for development purposes

It is possible to execute PHP code from the command line for development purposes. This is done with -t tag. Each time a request is made to PHP development server a log entry is made to a command line. Development environment is not meant for a production use. YouTube video

Introduction to PHP code

PHP code is executed by a web server, unlike JavaScript that is executed by the browser. PHP code is denoted by <?php opening tag and ?> closing tag. PHP code can be as a standalone code, or it can be included within HTML code. YouTube video

Tests automation

Application often changes, it is a bad idea to have outdated tests when the application changes. Tests must be updated too. It is a good idea to run tests automatically when the new change is submitted. It is a good idea of not only run tests to know if the application passes or failing these tests, but to make release of a new version of application depending on tests results.

Adjusting tests when application changes

It is not sufficient to write tests once and to say that tests exist. It is necessary to update tests as application changes. An application may introduce new functionality and new tests must be created. An application may also change, in that case tests may need to be updated. I say may need to be updated, because input and output of the functions may not change.

Tests coverage

It is not only enough to write tests, but it is necessary to ensure that tests have good coverage. It would be an embarrassing moment to learn that a customer have an issue because tests have poor coverage and they did not test that possibility.

Tests automation

Application changes based on the feedback of the users or the requirements from the team or higher-ups. Tests will find deficiencies in the code. It is a good idea to automate these and make the application successful compilation depending on these.

Acceptance tests

Acceptance tests have even greater scope than integration tests. They test an entire functionality of an application from the user’s viewpoint.

Integration tests

Integration tests have much greater scope than unit tests. The scope of integration tests may include several classes or an entire application.

Unit tests

Unit tests have limited scope. Unit tests purpose is to test a single function or procedure to validate that it works as expected. YouTube video

Document root file of a web application

Default document file of a web application is a default file that will be presented to a user, if no file is specified. There could be more then one default document file. Typical file names are index.html, index,php, defaul.asp. Default document file will depend on programming language used to build a web application. YouTube video

MVC - Model View Controller

Model View Controller or short abbreviation of it is known as MVC is a development technique that is accepted by many. M or model is an internal representation of data. V or view is a way to present or accept information to and from user. C or controller is software that links two.

Different types of exceptions in PHP

There could be several types of exceptions in PHP. For example A can be divided by B, but what if B is equal to zero? It is an invalid operation to divide by zero, in this case an exception will be raised. It is possible to catch exceptions of different types and perform different operations depending on the kind of exception that was raised.

Finally block in PHP

Finally block will be executed in a case where try or catch block is executed. Finally block will be executed always.

Handle errors in PHP

It is possible to handle errors in PHP by placing code in try/catch block. Try block will be used to execute piece of code, for example it can be division of one variable by another. If the divisor is equal to zero then it is an invalid operation and will produce a mathematical error. There may be more then one catch block, each catch block will handle specific type of error. If error type is not specified then catch block will handle all of the error types. In order to handle errors then code within catch block will be executed. It is possible to specify one more section in try/catch block. It is denoted by keyword finally. It will be executed regardless if an error occurred or not. It maybe possible to omit catch block and only have finally block.  YouTube video

Introduction to HTML

We use HTML when we open web pages. HTML stands for Hyper Text Markup Language. HTML version 1.0 was invented in 1991 by Tim Berners-Lee. HTML standard went through several iterations. We are currently using HTML 5.0 Initial version of HTML was used at CERN by researchers to organize documents and share information. Currently we use HTML to learn new information, shop online or for entertainment purposes. YouTube video

PHP variables

A PHP variable starts with $ sign. PHP variables can contain alpha characters, numbers and underscore character. Underscore character is often used instead of space symbol to indicate that a variable contains multiple words. For example $speed_of_a_car. Class variables in PHP often starts with underscore to indicate that such variables needs to be used in this class only. YouTube video

echo PHP tag

Whenever something needs to be outputted on a screen an echo command can be used. echo command can be split between multiple lines of code to generate a paragraph needs to multiple lines. Alternatively \n can be used to indicate a new line. There are a number of special characters that can be displayed using back slash symbol.

Denote ending of PHP code

Ending of PHP code must be denoted by a semicolon symbol.

PHP CLI

PHP code can also be executed as a command line code. Personally I don’t what is the reason for doing it, because there is so much choice for command line code, probably it is done so that front-end code and back-end code will use the same technologies, therefore it will simplify the development.

PHP server

In order to execute PHP code a special PHP server needs to be installed to interpret PHP code. PHP server is free of charge and it is available from https://www.php.net/. Number of popular operating systems is supported by PHP.

PHP libraries

There are number of PHP libraries developed in PHP, among them are known to me are Composer and Symfony. Development libraries provide functionality that already had been developed and is ready to be included in the project that is being developed. Using libraries can speed up development of the web applications.

Declaring PHP code

PHP can either be standalone code, or PHP code can be included within HTML page to make it dynamic. PHP code is denoted with <?PHP as a starting tag for the PHP code, and ?> as an ending tag.

What is PHP?

First of all PHP stands for PHP Hyper Processor. First P in the word PHP is recursive. Originally PHP had a meaning of Personal Home Pages, but later on the meaning of this term had been replaced. PHP execution is done at the server level, an opposite of it is client code execution. An example of client code execution is JavaScript. PHP programming is easy at the same time very complex web applications can be developed using PHP. For example Facebook, Wikipedia, Yahoo web sites had been developed using PHP.

Grouping HTML objects

It is possible to group HTML objects together using span and div tags. The difference between two is that div tag will add a new line after that content, and span tag will not.

HTML meta tag

HTML’s <meta> tag has an information what are the keywords and description for HTML page. I don’t know if meta tag is in use today. If content of HTML page is not clear of what it is, then how meta tag is going to help? Another option for meta tag is to ignore this page from being indexed by search engines. I don’t know if meta tag is in use today. If page is not clear about which content it has, then it must be updated.

Submitting data with a FORM element in HTML

It is possible to submit data in HTML page using <form> element. Form element has an option of how the data will be transmitted. It is done using form’s action parameter. There are two ways of how form’s data can be submitted. It can be submitted using GET or POST request. GET request will put form’s data in the URL. POST request will not. GET requests have limit of about 2048 characters to be submitted, POST requests don’t have such limits, requests of any size can be submitted using POST.

HTML links

Link are displayed on a HTML page by using <a> tag. href option will indicate which document needs to be opened when a link is clicked. href tag has an optional target parameter. If target is equal _blank, then a new window will be opened, default behavior is that a page will be opened in the same window.

Displaying another HTML page using frame tag

It is possible to include another HTML page in the HTML page that is being created by utilizing <iframe> tag.

Displaying multimedia objects in HTML page using source tag

HTML has <source> tag which will indicate a browser to represent a video, audio, or a picture in a browser. This tag is not used frequently, because there are other way to achieve the same functionality.

Displaying images on HTML page

Images can be displayed on an HTML page with the use of <img> tag. Img tag has an option which image needs to be displayed. It is possible to align an image with other HTML objects using CSS. If a browser does not display images, then it is possible to use alt tag to indicate what type of image needs to be displayed. HTML Image Tag Study Guide Quiz What HTML tag is used to display images on a webpage? How do you specify which image file should be displayed using the <img> tag? Which technology is mentioned for aligning images with other HTML objects? What is the purpose of the alt attribute in the <img> tag? When is the text specified by the alt attribute typically displayed? Can images be aligned on a webpage using only the <img> tag itself, according to the source? Is the source material focused on the <img> tag or CSS for displaying images? Does the source mention any other image formats besides the one implied by the use of the term "image"? ...

HTTP request (introduction)

There are two parties involved in HTTP conversation. First one is a client that makes request and another one is a server. Server is a computer that holds resources. It can be educational material, news, or entertainment. HTTP is a protocol, which means it has a solid requirements for computers to exchange information. What happens when server is unreachable? HTML page times out, and nothing is displayed on it. You can see 404 error, if the resource which you trying to access is absent on the server. There could be multiple reasons for broken communication. First one is a broken connection between your computer and a server. Second one is an operator error, hopefully you did not forget to turn on Wi-Fi, or plug the ethernet cable. If you are using Chrome browser, you can play dinosaur game :) YouTube video

Allowed special characters in URLs

These are allowed characters that can be used in a file name that will end up on a web page. @, =, &, %, #, /, :. ; YouTube video

Prohibited characters in a URL

URL stands for Uniform Resource Locator. There are certain characters that are not allowed in a URL. These characters are tab, space, double quote sign, less then and greater then signs, square brackets, curly braces, and the following characters - \, *, `, |, ~. So don't put these characters in a file name, if that file later on will ended up on a web site. Space character is not allowed in an URL either, it can be faked by using an underscore symbol or a dash symbol. URLs are case sensitive. It is a best practice to use only lower case characters for web content file and folder names. YouTube video

Learning HTML - part 1

HTML stands for Hyper Text Markup Language, HTML has tags. <a> is an example of such tag. There is opening and closing HTML tags. / character denotes closing of HTML tag. For example </a> will indicate closing of <a> tag. HTML tags may include attributes. For example <a> tag may include href attribute, which will indicate which page to open when this is link is clicked. Attributes indicate additional information for the HTML tags. HTML element is a text that is in between opening and closing HTML tags. HTML document contains forms, images, tables and links to other documents. HTML document has parent - child structure. Where the top element is known as a parent of an element that is contained in it. For example <body> tag is a parent of <h1> and <h2> elements. HTML elements that exist on the same level are siblings. If HTML is responsible for location of the elements, then CSS is responsible for how these elements will look like. CSS stands for...

Segmentation in Memory Management

Segmentation is a memory management scheme that divides a process into different segments, each representing a logical unit of the program, such as the code, data, or stack. Unlike paging, which divides memory into fixed-size blocks, segmentation uses variable-sized segments based on the logical structure of the program. 1. Key Features of Segmentation Logical Partitioning: Divides memory according to program structure (e.g., code, data, stack). Variable Segment Sizes: Each segment can have a different size depending on the program's requirements. Segment Table: The OS maintains a segment table that stores base addresses and limits for each segment. 2. Components of Segmentation A process is typically divided into these segments: Code Segment: Contains the program's executable instructions. Data Segment: Stores global and static variables. Stack Segment: Holds function calls, local variables, and control information. Heap Segment: Used for dynamic memory allocation. 3. Address ...

Random Access Memory (RAM): A Computer’s High-Speed Memory

Random Access Memory (RAM) is a type of volatile memory that temporarily stores data and instructions for active programs. It allows the CPU to quickly access information, significantly improving system speed and performance. 1. Key Features of RAM Volatile Storage: Data is lost when the system powers off. High-Speed Access: Faster than traditional storage devices like HDDs and SSDs. Temporary Data Holding: Stores active programs and processes for quick retrieval. 2. Types of RAM 1. Dynamic RAM (DRAM) Continuously refreshes data to maintain storage. Common in system memory (e.g., DDR4, DDR5). More affordable but slower than SRAM. 2. Static RAM (SRAM) Retains data without constant refreshing. Used in CPU caches (L1, L2, L3). Faster but more expensive than DRAM. 3. RAM Form Factors DIMM (Dual In-Line Memory Module): Found in desktops. SO-DIMM (Small Outline DIMM): Used in laptops and compact systems. 4. Factors Affecting RAM Performance Capacity (GB): More RAM allows for better multitask...

CPU Scheduling

CPU scheduling is the method by which an operating system determines which process gets CPU time when multiple processes are waiting to execute. Efficient scheduling enhances performance, reduces waiting time, and improves overall system responsiveness. 1. Objectives of CPU Scheduling Maximize CPU Utilization: Ensure the CPU remains active as much as possible. Minimize Waiting Time: Reduce the time processes spend in the ready queue. Minimize Response Time: Improve system responsiveness, especially for interactive applications. Increase Throughput: Maximize the number of completed processes per unit time. 2. Key Scheduling Criteria CPU Utilization: Ensuring the CPU is always executing tasks. Throughput: Number of completed processes per time unit. Turnaround Time: Total time from process submission to completion. Waiting Time: Time spent in the ready queue before execution. Response Time: Time between a request and the system’s first response. 3. Types of CPU Scheduling Scheduling can ...

Understanding Computer Threads

A thread is the smallest unit of execution within a process. Multiple threads can run within a single process, sharing resources such as memory and files while operating independently. This enables efficient multitasking and parallel execution within applications. 1. Key Features of a Thread Each thread consists of: Thread ID: A unique identifier for tracking. Program Counter: Keeps track of the current instruction. Registers: Stores execution states. Stack: Manages function calls, local variables, and return addresses. Unlike processes, threads within the same process share memory and system resources, making them faster and more efficient for multitasking. 2. Types of Threads User Threads: Managed at the application level without direct OS involvement. Kernel Threads: Controlled by the operating system, allowing better system-wide management. 3. Single-Threading vs. Multi-Threading Single-threaded execution runs one task at a time. Multi-threaded execution enables multiple tasks to r...

Computer Processes

A computer process is an active execution of a program, managed by the operating system (OS). It consists of program code, data, and system resources needed for execution. 1. Key Components of a Process Each process includes: Code Segment: The program’s executable instructions. Program Counter: Tracks the current instruction being executed. Stack: Holds function parameters, return addresses, and local variables. Heap: Allocates memory dynamically as needed. Data Section: Stores global and static variables. 2. Process States A process transitions through different states during execution: New: The process is being created. Ready: Awaiting CPU allocation. Running: Currently executing on the CPU. Waiting (Blocked): Paused, waiting for an external event (e.g., I/O operation). Terminated: Completed execution and removed from memory. 3. Process Control Block (PCB) The OS tracks process details using a Process Control Block (PCB), which includes: Process ID (PID) Current process state Program...