2014 database - course 1 - www introductionHung-yu Lin
This document provides an introduction to HTML, HTTP protocols, and how to build a basic web server. It begins with an overview of what happens when a browser opens a URL, including DNS lookup and the HTTP request. It then discusses the HTTP protocol and how GET, POST, PUT, and DELETE map to CRUD operations and REST APIs. The document explains how to parse an HTTP request and handle responses in a simple web server. It also introduces CGI as a way to execute scripts or programs on the server side. Finally, it provides recommendations for text editors and references for HTML, CSS, JavaScript, and building websites.
The document discusses Google App Engine (GAE), which is a Platform as a Service (PaaS) that allows developers to build and host web applications in Google's infrastructure. It focuses on providing automatic scaling, security, performance, and supports languages like Python and Java. GAE provides data storage options like the Datastore for NoSQL data and Blobstore for binary objects. The Datastore uses entities with properties to store data, generates unique keys for entities, and supports common data types that can be queried, inserted, updated and deleted.
Redis is a fast, in-memory key-value database that supports data types like strings, lists, sets and hashes. It features publish-subscribe capabilities, transactions, replication, persistence and partitioning. It is open source and offers clients for many programming languages. Major companies like GitHub, Twitter, Pinterest, and others use Redis for caching, pub/sub messaging and more due to its speed and feature set.
The document discusses PHP and how it works with HTML. PHP code is embedded within HTML code using opening and closing PHP tags. Variables and data from PHP can be outputted into the HTML. Forms allow sending data to PHP scripts via GET or POST requests. The PHP script receives the form data in the $_POST or $_GET superglobals. Sessions allow maintaining state across multiple requests by assigning a temporary ID stored in a cookie.
2014 database - course 3 - PHP and MySQLHung-yu Lin
This document discusses connecting to a MySQL database from PHP. It explains how to establish a database connection, perform queries like INSERT, SELECT, UPDATE and DELETE, and handle query results. It emphasizes that using prepared statements prevents SQL injection attacks. It also covers password hashing to securely store passwords in the database by hashing them with a random salt.
2014 database - course 1 - www introductionHung-yu Lin
This document provides an introduction to HTML, HTTP protocols, and how to build a basic web server. It begins with an overview of what happens when a browser opens a URL, including DNS lookup and the HTTP request. It then discusses the HTTP protocol and how GET, POST, PUT, and DELETE map to CRUD operations and REST APIs. The document explains how to parse an HTTP request and handle responses in a simple web server. It also introduces CGI as a way to execute scripts or programs on the server side. Finally, it provides recommendations for text editors and references for HTML, CSS, JavaScript, and building websites.
The document discusses Google App Engine (GAE), which is a Platform as a Service (PaaS) that allows developers to build and host web applications in Google's infrastructure. It focuses on providing automatic scaling, security, performance, and supports languages like Python and Java. GAE provides data storage options like the Datastore for NoSQL data and Blobstore for binary objects. The Datastore uses entities with properties to store data, generates unique keys for entities, and supports common data types that can be queried, inserted, updated and deleted.
Redis is a fast, in-memory key-value database that supports data types like strings, lists, sets and hashes. It features publish-subscribe capabilities, transactions, replication, persistence and partitioning. It is open source and offers clients for many programming languages. Major companies like GitHub, Twitter, Pinterest, and others use Redis for caching, pub/sub messaging and more due to its speed and feature set.
The document discusses PHP and how it works with HTML. PHP code is embedded within HTML code using opening and closing PHP tags. Variables and data from PHP can be outputted into the HTML. Forms allow sending data to PHP scripts via GET or POST requests. The PHP script receives the form data in the $_POST or $_GET superglobals. Sessions allow maintaining state across multiple requests by assigning a temporary ID stored in a cookie.
2014 database - course 3 - PHP and MySQLHung-yu Lin
This document discusses connecting to a MySQL database from PHP. It explains how to establish a database connection, perform queries like INSERT, SELECT, UPDATE and DELETE, and handle query results. It emphasizes that using prepared statements prevents SQL injection attacks. It also covers password hashing to securely store passwords in the database by hashing them with a random salt.
39. OO in PHP - basic
<?php
class SimpleClass
{
// property declaration
public $var = 'a default value';
// method declaration
public function displayVar() {
echo $this->var;
}
}
$instance = new SimpleClass;
$instance->displayVar();
40. OO in PHP – ctor / dtor
<?php
class CtorTestClass
{
function __construct ($msg = ‘’) {
echo “constructed, msg = $msg.”;
}
function __destruct () {
echo ‘destructed.’;
}
}
$instance = new CtorTestClass;
$instance1 = new CtorTestClass(‘haha’);
41. OO in PHP – inheritance
<?php
class Animal {
public $name;
function __construct ($name) {
$this->name = $name;
}
}
class Cat extends animal {
public function meow () {
echo $this->name . ‘: meow’;
}
}
$cat = new Cat(‘useless’);