AJAX allows web pages to be updated asynchronously by exchanging data with a web server behind the scenes. It enables web pages to update just part of a page without disrupting what the user is doing. JSON is commonly used as a data format for AJAX requests, as it allows JavaScript objects to be converted to and from text that can be sent over the network. The XMLHttpRequest object is used to send and receive data from a web server asynchronously.
This note describes the core language constructs of JavaScript.
- JS variable declarations and hoisting
- JS function declarations and hoisting
- JS objects
- JS strings, arrays, numbers
- JS control flow and loop statements
This note describes the core language constructs of JavaScript.
- JS variable declarations and hoisting
- JS function declarations and hoisting
- JS objects
- JS strings, arrays, numbers
- JS control flow and loop statements
All variables in PHP start with a $ (dollar) sign followed by the name of the variable.
A valid variable name starts with a letter (A-Z, a-z) or underscore (_), followed by any number of letters, numbers, or underscores.
If a variable name is more than one word, it can be separated with underscore (for example $employee_code instead of $employeecode).
'$' is a special variable that can not be assigned.
Just because Flask is a micro-framework doesn’t mean we still don’t want to have great AAA (authentication, authorization, and accounting), email services, simplified database access/migrations and form handling. Lets look at some of the most common libraries used to build the powerful simplicity of Flask into a full featured web application without having to reinvent the wheel each time.
Slides from my talk at the GTA-PHP Meetup Group about getting mixed HTML / PHP code into objects using SOLID principles.
Meetup page: http://www.meetup.com/GTA-PHP-User-Group-Toronto/events/230656470/
Code is on github: https://github.com/zymsys/solid
Correctly understanding the eight data types in PHP is essential to a solid foundation in development. Come refresh your knowledge of the scalar types, compound types, and special data types used in PHP, and learn about proper usage of each. Review type juggling, learn some common data type traps to avoid, and how to code defensively to prevent having the data type of a variable change unexpectedly. Finally learn how unit tests can help verify that code is handling data types correctly.
All variables in PHP start with a $ (dollar) sign followed by the name of the variable.
A valid variable name starts with a letter (A-Z, a-z) or underscore (_), followed by any number of letters, numbers, or underscores.
If a variable name is more than one word, it can be separated with underscore (for example $employee_code instead of $employeecode).
'$' is a special variable that can not be assigned.
Just because Flask is a micro-framework doesn’t mean we still don’t want to have great AAA (authentication, authorization, and accounting), email services, simplified database access/migrations and form handling. Lets look at some of the most common libraries used to build the powerful simplicity of Flask into a full featured web application without having to reinvent the wheel each time.
Slides from my talk at the GTA-PHP Meetup Group about getting mixed HTML / PHP code into objects using SOLID principles.
Meetup page: http://www.meetup.com/GTA-PHP-User-Group-Toronto/events/230656470/
Code is on github: https://github.com/zymsys/solid
Correctly understanding the eight data types in PHP is essential to a solid foundation in development. Come refresh your knowledge of the scalar types, compound types, and special data types used in PHP, and learn about proper usage of each. Review type juggling, learn some common data type traps to avoid, and how to code defensively to prevent having the data type of a variable change unexpectedly. Finally learn how unit tests can help verify that code is handling data types correctly.
AJAX is an acronym standing for Asynchronous JavaScript and XML and this technology helps us to load data from the server without a browser page refresh.
If you are new with AJAX, I would recommend you go through our Ajax Tutorial before proceeding further.
JQuery is a great tool which provides a rich set of AJAX methods to develop next generation web application.
The first of its kind Web Technology Conference on Open Source Technology, WebOSS '07 was organised in Kolkata on Sat, 13th Oct 07 and I spoke at the event as one of the participants on "Building Applications using AJAX". Here I will share my presentation.
[WSO2 Integration Summit Madrid 2019] Integration + BallerinaWSO2
Increasingly, developers and architects are disaggregating their architectures to create more scalable and agile applications. As this happens, everything is becoming a programmable endpoint. Ballerina is a new programming language designed around this problem. This deck introduces the challenges and background of why Ballerina has been created, as well as demonstrate the core features of the language.
Sample JavaScript Code Laurence Svekis
JavaScript Closure
A closure in JavaScript is a function that has access to the variables in its parent scope, even after the parent function has completed execution. This allows for data to be “closed over” or remembered by the inner function, even after the outer function has returned.
Here, the makeCounter function returns an inner function that has access to the count variable declared in its parent scope, and can “remember” the current count value even after the makeCounter function has completed execution. Each time the inner function is called, it returns the current value of count and increments it by 1.
JavaScript Closure Advanced
In this example, the makeAdder function takes in a single argument x and returns an inner function that takes in a second argument y. The inner function has access to the x variable declared in the parent scope and uses it to add x and y together and return the result.
We can see here that the outer function makeAdder has been executed twice and it returns two different inner functions which are assigned to different variables add5 and add10 and these inner functions are able to remember their respective parent scope values of x.
This slide explains the conversion procedure from ER Diagram to Relational Schema.
1. Entity set to Relation
2. Relationship set to Relation
3. Attributes to Columns, Primary key, Foreign Keys
1. What is Entity Relationship Model
2. Entity and Entity Set
3. Relationship and Relationship Set
4. Attributes and it's kinds
5. Participation Constraints and Mapping Cardinality
6. Aggregation, Specialization, and Generalization
7. Some Sample ERD models
This note includes the followings:
- Database Create, Drop Operations
- Database Table Create, Drop Operations
- Database Table Alter Operation
- Data insertion
- Data deletion
- Existing data update
- Searching data from data table (showing all record, specific columns, specific rows, column aliasing, sorting data, limiting data, distinct data)
- Aggregate functions
- Group by clause
- Having clause
- Types of table joins
- Table aliasing, Inner Join, Left/Right Join, Self Join
- Subquery operation (scalar subquery, column subquery, row subquery, correlated subquery, derived table)
This note contains some sample MySQL query practices based on the HR Schema database. The practice sections are from the following categories:
- DDL statements
- Basic Select statements
- Aggregate operations
- Join operations
This lecture slide contains:
- Difference between FA, PDA and TM
- Formal definition of TM
- TM transition function and configuration
- Designing TM for different languages
- Simulating TM for different strings
This slide contains,
1) Some terminologies like yields, derives, word, derivation
2) Leftmost and Rightmost derivation
3) Ambiguity checking
4) Parse tree generation and ambiguity checking
This is a presentation by Dada Robert in a Your Skill Boost masterclass organised by the Excellence Foundation for South Sudan (EFSS) on Saturday, the 25th and Sunday, the 26th of May 2024.
He discussed the concept of quality improvement, emphasizing its applicability to various aspects of life, including personal, project, and program improvements. He defined quality as doing the right thing at the right time in the right way to achieve the best possible results and discussed the concept of the "gap" between what we know and what we do, and how this gap represents the areas we need to improve. He explained the scientific approach to quality improvement, which involves systematic performance analysis, testing and learning, and implementing change ideas. He also highlighted the importance of client focus and a team approach to quality improvement.
The Indian economy is classified into different sectors to simplify the analysis and understanding of economic activities. For Class 10, it's essential to grasp the sectors of the Indian economy, understand their characteristics, and recognize their importance. This guide will provide detailed notes on the Sectors of the Indian Economy Class 10, using specific long-tail keywords to enhance comprehension.
For more information, visit-www.vavaclasses.com
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxEduSkills OECD
Andreas Schleicher presents at the OECD webinar ‘Digital devices in schools: detrimental distraction or secret to success?’ on 27 May 2024. The presentation was based on findings from PISA 2022 results and the webinar helped launch the PISA in Focus ‘Managing screen time: How to protect and equip students against distraction’ https://www.oecd-ilibrary.org/education/managing-screen-time_7c225af4-en and the OECD Education Policy Perspective ‘Students, digital devices and success’ can be found here - https://oe.cd/il/5yV
The Art Pastor's Guide to Sabbath | Steve ThomasonSteve Thomason
What is the purpose of the Sabbath Law in the Torah. It is interesting to compare how the context of the law shifts from Exodus to Deuteronomy. Who gets to rest, and why?
How to Split Bills in the Odoo 17 POS ModuleCeline George
Bills have a main role in point of sale procedure. It will help to track sales, handling payments and giving receipts to customers. Bill splitting also has an important role in POS. For example, If some friends come together for dinner and if they want to divide the bill then it is possible by POS bill splitting. This slide will show how to split bills in odoo 17 POS.
The Roman Empire A Historical Colossus.pdfkaushalkr1407
The Roman Empire, a vast and enduring power, stands as one of history's most remarkable civilizations, leaving an indelible imprint on the world. It emerged from the Roman Republic, transitioning into an imperial powerhouse under the leadership of Augustus Caesar in 27 BCE. This transformation marked the beginning of an era defined by unprecedented territorial expansion, architectural marvels, and profound cultural influence.
The empire's roots lie in the city of Rome, founded, according to legend, by Romulus in 753 BCE. Over centuries, Rome evolved from a small settlement to a formidable republic, characterized by a complex political system with elected officials and checks on power. However, internal strife, class conflicts, and military ambitions paved the way for the end of the Republic. Julius Caesar’s dictatorship and subsequent assassination in 44 BCE created a power vacuum, leading to a civil war. Octavian, later Augustus, emerged victorious, heralding the Roman Empire’s birth.
Under Augustus, the empire experienced the Pax Romana, a 200-year period of relative peace and stability. Augustus reformed the military, established efficient administrative systems, and initiated grand construction projects. The empire's borders expanded, encompassing territories from Britain to Egypt and from Spain to the Euphrates. Roman legions, renowned for their discipline and engineering prowess, secured and maintained these vast territories, building roads, fortifications, and cities that facilitated control and integration.
The Roman Empire’s society was hierarchical, with a rigid class system. At the top were the patricians, wealthy elites who held significant political power. Below them were the plebeians, free citizens with limited political influence, and the vast numbers of slaves who formed the backbone of the economy. The family unit was central, governed by the paterfamilias, the male head who held absolute authority.
Culturally, the Romans were eclectic, absorbing and adapting elements from the civilizations they encountered, particularly the Greeks. Roman art, literature, and philosophy reflected this synthesis, creating a rich cultural tapestry. Latin, the Roman language, became the lingua franca of the Western world, influencing numerous modern languages.
Roman architecture and engineering achievements were monumental. They perfected the arch, vault, and dome, constructing enduring structures like the Colosseum, Pantheon, and aqueducts. These engineering marvels not only showcased Roman ingenuity but also served practical purposes, from public entertainment to water supply.
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
1. Mohammad Imam Hossain, Lecturer, dept. of CSE, UIU. Email: imambuet11@gmail.com
AJAX (Asynchronous Javascript And XML)
AJAX is the use of the XMLHttpRequest object to communicate with servers.
It can send and receive information in various formats, including JSON, XML, HTML and text files.
The two major features of AJAX allow you to do the following:
o make requests to the server without reloading the page
o receive and work with data from the server
It enables a Web page to update just part of a page without disrupting what the user is doing.
XMLHttpRequest class:
Properties Methods
readyState
-- returns the state of the request
0 -> UNSENT [open() not called yet]
1 -> OPENED [open() has been called]
2 -> HEADERS_RECEIVED [send() has been called]
3 -> LOADING [responseText holds partial data]
4 -> DONE [the Operation is complete]
setRequestHeader(header, value)
--sets the value of an HTTP request header, must
call it after open() but before send() methods
getResponseHeader(header)
--returns the string containing the text of a
particular header’s value
onreadystatechange
-- an eventhandler that is called whenever the readyState
attribute changes
open(method, url)
--initializes a request
status
--returns the numerical HTTP status code of the
XMLHttpRequest’s response
send(req_body) – req_body is optional
--sends the request to the server
responseType
--the type of the data contained in the response
“” -> text (default)
json -> json object
document -> HTML document
blob -> blob object containing the binary data
abort()
--aborts the request if it has already been sent
responseText
--contains response to the request as text or null if the
request was unsuccessful
Events:
abort, error, load,
loadend, loadstart, progress, timeout
response
--returns the reponse’s body content as a document, text,
JSON, blob depending on the value of the request’s
reponseType property.
Sending GET Request:
<button id="ajaxButton" type="button">Make a request</button>
<script>
(function() {
var httpRequest;
document.getElementById("ajaxButton").addEventListener('click', makeRequest);
function makeRequest() {
httpRequest = new XMLHttpRequest();
if (!httpRequest) {
alert('Giving up :( Cannot create an XMLHTTP instance');
2. Mohammad Imam Hossain, Lecturer, dept. of CSE, UIU. Email: imambuet11@gmail.com
return false;
}
httpRequest.onreadystatechange = alertContents;
httpRequest.open('GET', 'test.html');
httpRequest.send();
}
function alertContents() {
try {
if (httpRequest.readyState === XMLHttpRequest.DONE) {
if (httpRequest.status === 200) {
alert(httpRequest.responseText);
} else {
alert('There was a problem with the request.');
}
}
}
catch( e ) {
alert('Caught Exception: ' + e.description);
}
}
})();
</script>
Sending POST request:
<script>
function makeRequest(url, userName) {
… … …
httpRequest.onreadystatechange = alertContents;
httpRequest.open('POST', url);
httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
httpRequest.send('userName=' + encodeURIComponent(userName));
}
</script>
3. Mohammad Imam Hossain, Lecturer, dept. of CSE, UIU. Email: imambuet11@gmail.com
JSON (Javascript Object Notation)
When exchanging data between a browser and a server, the data can only be text. JSON is text that is used to transmit
structured data over network connection.
Format:
1. JSON objects are surrounded by curly braces {}
2. JSON objects are written in key/value pairs
3. Keys must be double quoted strings
4. Values can be null, true, false, JSONNumber, JSONString, JSONObject, JOSNArray
5. Keys and values are separated by a colon
6. Each key/value pair is separated by a comma
For example,
var myobj = {
“name” : ”John”,
“age” : “30”,
“cars” : [
{
“name” : ”Ford”,
“models”: [“fiesta”,”focus”,”mustang”]
},
{
“name”:”BMW”,
“models”:[“320”,”x3”,”x5”]
},
{
“name”:”Fiat”,
“models”:[“500”,”Panda”]
}
]
};
JSON Methods:
Javascript PHP
JSON.stringify() converts a JavaScript object or value to a
JSON string.
console.log(JSON.stringify({ x: 5, y: 6 }));
// expected output: ‘{"x":5,"y":6}’
json_encode() — Returns the JSON representation of a
value
<?php
$arr=array('a'=>1,'b'=>2,'c'=>3,'d'=>4,
'e'=>5);
echo json_encode($arr);
?>
JSON.parse() parses a JSON string, constructs the
JavaScript value or object described by the string.
var json = '{"result":true, "count":42}';
obj = JSON.parse(json);
console.log(obj.count);
// expected output: 42
json_decode() -- takes a JSON encoded string and
converts it into a PHP variable.
<?php
$json = '{"a":1,"b":2,"c":3,"d":4,"e":5
}';
4. Mohammad Imam Hossain, Lecturer, dept. of CSE, UIU. Email: imambuet11@gmail.com
var_dump(json_decode($json, true));
//assoc array
?>
encodeURIComponent(str) -- encodes a Uniform Resource
Identifier (URI) component.
<script>
var set1 = ";,/?:@&=+$#"; // Reserved
Characters
var set2 = "-_.!~*'()"; // Unreserved
Marks
var set3 = "ABC abc 123"; // Alphanumeric
Characters + Space
console.log(encodeURIComponent(set1)); //
%3B%2C%2F%3F%3A%40%26%3D%2B%24%23
console.log(encodeURIComponent(set2)); // -
_.!~*'()
console.log(encodeURIComponent(set3)); //
ABC%20abc%20123 (the space gets encoded as
%20)
</script>
decodeURIComponent(encodedString) – decodes the
encoded URI.
PHP Network Functions:
Method Sample Code
header ($headerstring) – send a raw HTTP header
The header() must be called before any actual output is
sent either by normal HTML tags, blank lines in a file or
from PHP.
header_remove($name) – removes a previously set
header.
<html>
<?php
/* This will give an error. Note the output
* above, which is before the header() call
*/
header('Location: http://www.example.com/');
/* Make sure that code below does not get
* executed when we redirect
*/
exit;
?>
http_response_code()
http_response_code(codenumber)
— Gets or Sets the HTTP response code
<?php
// Get the current default response code
var_dump(http_response_code());
// Set a response code
var_dump(http_response_code(201));
// Get the new response code
var_dump(http_response_code());
?>