SlideShare una empresa de Scribd logo
1 de 66
Descargar para leer sin conexión
WWW Introduction
Ensky / 林宏昱
What happened
when you open a browser?
DNS lookup
dns
what's the ip of facebook.com?
It's 173.252.110.27
HTTP protocol
GET /enskylin HTTP/1.1
Host: www.facebook.com
HTTP/1.1 200 OK
HTML
HTTP Protocol
• Protocol between Browser <-> Web server
• Initially used to transmit documents in HTML format
• We know GET method now, but how about post
something to webserver?
What happened
when you post a form on
website?
Perform a POST in HTTP
POST /register HTTP/1.1
Host: www.facebook.com
HTTP/1.1 200 OK
HTML
save to
database
surname=E&name=ensky&email=…
HTTP usage
• Actually, HTTP is very simple, trivial, and easy to use
in many situations
• When it comes to data-manipulation, there are four
basic method:
Create, Read, Update, Delete(CRUD)
they can be perfectly mapped into HTTP protocol
HTTP protocol -> REST API
• Using HTTP protocol to serve an data-manipulation
API, we call it REST API.
• WIKI: REST
Operation HTTP
Read GET
Create POST
Update PUT
Delete DELETE
Imagine you're writing a game
• you'll have
– character info
• maybe life, age, attack power, skills, location, …
– Monster info
• maybe life, skills, …
– and many data need to be CRUD
REST API
• And it'll be very easy if you use REST API.
– GET /characters/1/life
– PUT /characters/1
life=60&isPoisoned=1
– PUT /characters/1/location
map=1&block=123
What about HTML?
HyperText Markup Language
Insights
HTML is
a markup language
(not a programming language)
defines
defines what elements on the page
(images, links, texts, videos, forms, scripts, etc.)
http://goo.gl/qOu6OF
defines what orders the elements are
1
2
3
4
http://goo.gl/qOu6OF
HTML
• cooperates
–layouts with CSS
–functions with Javascript
CSS, HTML, JS
Structures Layouts Functions
結構 樣式 功能
HTML hello world
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Hello world! Title</title>
</head>
<body>
<p>Hello world!</p>
</body>
</html>
HTML is a nested language
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Hello world! Title</title>
</head>
<body>
<p>Hello world!</p>
</body>
</html>
HTML is a markup language
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>…</title>
</head>
<body>
<p>…</p>
</body>
</html>
• Tag
• Attribute
• Value
• Node
• Parent
• Children
HTML is a markup language
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>…</title>
</head>
<body>
<p>…</p>
</body>
</html>
• Head defines
something for
browser
• Encoding
• Title of the
page
• Resources
• CSS
• Javascript
HTML is a markup language
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>…</title>
</head>
<body>
<p>…</p>
</body>
</html>
• Body defines
something to
render
(the contents)
Common attributes
<p id="unique" class="red-div" title="help text">HIHI</p>
• class
classify elements, usually set for CSS or JS to select some
elements. One element can have multiple classes
• id
same as class, but unique in a document.
One element can only have one id
• style
inline CSS
• title
help text when hover
Debug tools
• Chrome debug tool F12
Debug tools
CSS, HTML, JS
Structures Layouts Functions
結構 樣式 功能
HTTP protocol review
GET /enskylin HTTP/1.1
Host: www.facebook.com
HTTP/1.1 200 OK
HTML
Imagine if you want to
write a web server…
1.Initialize a socket
wait for client's HTTP request
GET /icon.png HTTP/1.1
Host: www.ensky.tw
HTTP/1.1 200 OK
HTML
port 80
2.Parse the HTTP request
find out some useful information
like URL, Hostname, …
GET /icon.png HTTP/1.1
Host: www.ensky.tw
HTTP/1.1 200 OK
HTML
3.Prepare file according to
above information
GET /icon.png HTTP/1.1
Host: www.ensky.tw
HTTP/1.1 200 OK
HTML
get icon.png from
somewhere in your file system
4.Response the document
back to client
GET /icon.png HTTP/1.1
Host: www.ensky.tw
HTTP/1.1 200 OK
HTML
Virtual host
• One web server can host many domains
• It can be determined by "Host: " part in HTTP
protocol
www.facebook.com
GET /enskylin HTTP/1.1
Host: www.facebook.com
Virtual host
• In case of static file mapping, you can simply do
www.facebook.com -> c:Domainswww
image.facebook.com -> c:Domainsimage
so any request to http://www.facebook.com/song.mp3
web server will try to find the file at
c:Domainswwwsong.mp3
However, static files is not rocks
enough!
How about dynamic generated
documents?
The only difference is we get data
from database
rather than disk file
GET /enskylin HTTP/1.1
Host: www.facebook.com
HTTP/1.1 200 OK
HTML
And we need to generate the HTML
GET /enskylin HTTP/1.1
Host: www.facebook.com
HTTP/1.1 200 OK
HTML
And send it back to browser
GET /icon.png HTTP/1.1
Host: www.ensky.tw
HTTP/1.1 200 OK
HTML
If you want to write a web server
1. Initialize a socket to wait for client's HTTP
request
2. Parse the HTTP request and find out some
useful information like URL, Host, …
3. Prepare document according to above
information
4. Response the document back to client
If you want to write a web server
1. Initialize a socket to wait for client's HTTP
request
2. Parse the HTTP request and find out some
useful information like URL, Host, …
3. Prepare document according to above
information
4. Response the document back to client
there is different logic for each page
-> it is hard to write in Web server
GET /enskylin HTTP/1.1
Host: www.facebook.com
HTTP/1.1 200 OK
HTML
If you want to write a web server
1. Initialize a socket to wait for client's
HTTP request
2. Parse the HTTP request and find out
some useful information like URL,
Host, …
3. Prepare document according to above
information
4. Response the document back to client
web
Server
CGI
CGI and Web server
Web server
CGI
HTTP Request
stdin + env
stdout
HTTP
Response
+ BODY
HTTP
request
body
HTTP
request
header
HTTP
response
head + body
CGI Implemention
#include <iostream>
using namespace std;
int main () {
cout << “<!doctype html>”;
cout << “<html>”;
cout << “ <head>”;
// …omitted
}
Any better choice?
We Save Your Time!
Next two weeks
References
IDE
• We highly recommended to use
IDE Note
• You must save in UTF-8, otherwise you'll not be able
to render Chinese correctly
• see: ChineseWorld PTT
Save as UTF-8
• Notepad++
Save as UTF-8
• Sublime
Save as UTF-8
• VIM
• Putty
HTML Tags - Text
p: paragraph
<p>Jlhuang Rocks!</p>
HTML Tags - Text
br: break
<p>Jlhuang <br> Rocks!</p>
HTML Tags - Link
a: anchor
<a href="http://www.google.com">Click me</a>
HTML Tags - Heading
<h1>H1</h1>
<h2>H2</h2>
<h3>H3</h3>
<h4>H4</h4>
<h5>H5</h5>
<h6>H6</h6>
HTML Tags - List
<ul>
<li>Item1</li>
<li>Item2</li>
<li>Item3</li>
<ol>
<li>Item4</li>
</ol>
</ul>
HTML Tags - Table
<table>
<thead>
<tr><td>Name</th><td>Score</td></tr>
</thead>
<tbody>
<tr><th>Ensky</th><td>100</td></tr>
<tr><th>dy93</th><td>80</td></tr>
</tbody>
<tfoot>
<tr><th>Average</th><td>90</td></tr>
</tfoot>
</table>
Name Score
Ensky 100
dy93 80
Average 90
HTML Tags - Images
img: image
<img
src="http://i1.ytimg.com/vi/iYQHkwCfCiw/m
axresdefault.jpg">
More Tags
http://www.w3schools.com/tags/
CSS reference
• https://speakerdeck.com/openwebscho
ol/04-css-openwebschool
Javascript reference
• https://speakerdeck.com/openwebschool/07-javascript-
openwebschool
• https://speakerdeck.com/openwebschool/08-js-frontend-
and-jquery-openwebschool
WWW reference
https://speakerdeck.com/openwebschool

Más contenido relacionado

La actualidad más candente

WordPress Theme Development
 WordPress Theme Development WordPress Theme Development
WordPress Theme DevelopmentBijay Oli
 
You Got React.js in My PHP
You Got React.js in My PHPYou Got React.js in My PHP
You Got React.js in My PHPTaylor Lovett
 
JSON REST API for WordPress
JSON REST API for WordPressJSON REST API for WordPress
JSON REST API for WordPressTaylor Lovett
 
PHP language presentation
PHP language presentationPHP language presentation
PHP language presentationAnnujj Agrawaal
 
En story of cakephp2.0
En story of cakephp2.0En story of cakephp2.0
En story of cakephp2.0Hiroki Shimizu
 
Using MongoDB and a Relational Database at MongoDB Day
Using MongoDB and a Relational Database at MongoDB DayUsing MongoDB and a Relational Database at MongoDB Day
Using MongoDB and a Relational Database at MongoDB Dayhayesdavis
 
How the Web Works Using HTML
How the Web Works Using HTMLHow the Web Works Using HTML
How the Web Works Using HTMLMarlon Jamera
 
WordPress Theme Development
WordPress Theme DevelopmentWordPress Theme Development
WordPress Theme DevelopmentWisdmLabs
 
Mastering the shortcode api
Mastering the shortcode apiMastering the shortcode api
Mastering the shortcode apiPeter Baylies
 
WordCamp Detroit 2010 Wordpress Theme Hacks
WordCamp Detroit 2010 Wordpress Theme HacksWordCamp Detroit 2010 Wordpress Theme Hacks
WordCamp Detroit 2010 Wordpress Theme HacksJohn Pratt
 
Web technology P B Jadhav
Web technology  P B JadhavWeb technology  P B Jadhav
Web technology P B JadhavPRASHANT JADHAV
 

La actualidad más candente (20)

HTML5 CSS3 Basics
HTML5 CSS3 Basics HTML5 CSS3 Basics
HTML5 CSS3 Basics
 
Chapter2
Chapter2Chapter2
Chapter2
 
Xhtml 2010
Xhtml 2010Xhtml 2010
Xhtml 2010
 
WordPress Theme Development
 WordPress Theme Development WordPress Theme Development
WordPress Theme Development
 
HTML5
HTML5 HTML5
HTML5
 
HTML/CSS Lecture 1
HTML/CSS Lecture 1HTML/CSS Lecture 1
HTML/CSS Lecture 1
 
You Got React.js in My PHP
You Got React.js in My PHPYou Got React.js in My PHP
You Got React.js in My PHP
 
JSON REST API for WordPress
JSON REST API for WordPressJSON REST API for WordPress
JSON REST API for WordPress
 
PHP language presentation
PHP language presentationPHP language presentation
PHP language presentation
 
En story of cakephp2.0
En story of cakephp2.0En story of cakephp2.0
En story of cakephp2.0
 
Rails 101
Rails 101Rails 101
Rails 101
 
Using MongoDB and a Relational Database at MongoDB Day
Using MongoDB and a Relational Database at MongoDB DayUsing MongoDB and a Relational Database at MongoDB Day
Using MongoDB and a Relational Database at MongoDB Day
 
html
htmlhtml
html
 
How the Web Works Using HTML
How the Web Works Using HTMLHow the Web Works Using HTML
How the Web Works Using HTML
 
Html5
Html5Html5
Html5
 
WordPress Theme Development
WordPress Theme DevelopmentWordPress Theme Development
WordPress Theme Development
 
Mastering the shortcode api
Mastering the shortcode apiMastering the shortcode api
Mastering the shortcode api
 
php 1
php 1php 1
php 1
 
WordCamp Detroit 2010 Wordpress Theme Hacks
WordCamp Detroit 2010 Wordpress Theme HacksWordCamp Detroit 2010 Wordpress Theme Hacks
WordCamp Detroit 2010 Wordpress Theme Hacks
 
Web technology P B Jadhav
Web technology  P B JadhavWeb technology  P B Jadhav
Web technology P B Jadhav
 

Destacado

OpenWebSchool - 03 - PHP Part II
OpenWebSchool - 03 - PHP Part IIOpenWebSchool - 03 - PHP Part II
OpenWebSchool - 03 - PHP Part IIHung-yu Lin
 
OpenWebSchool - 01 - WWW Intro
OpenWebSchool - 01 - WWW IntroOpenWebSchool - 01 - WWW Intro
OpenWebSchool - 01 - WWW IntroHung-yu Lin
 
Google App Engine
Google App EngineGoogle App Engine
Google App EngineHung-yu Lin
 
2014 database - course 2 - php
2014 database - course 2 - php2014 database - course 2 - php
2014 database - course 2 - phpHung-yu Lin
 
OpenWebSchool - 11 - CodeIgniter
OpenWebSchool - 11 - CodeIgniterOpenWebSchool - 11 - CodeIgniter
OpenWebSchool - 11 - CodeIgniterHung-yu Lin
 
2014 database - course 3 - PHP and MySQL
2014 database - course 3 - PHP and MySQL2014 database - course 3 - PHP and MySQL
2014 database - course 3 - PHP and MySQLHung-yu Lin
 

Destacado (7)

OpenWebSchool - 03 - PHP Part II
OpenWebSchool - 03 - PHP Part IIOpenWebSchool - 03 - PHP Part II
OpenWebSchool - 03 - PHP Part II
 
OpenWebSchool - 01 - WWW Intro
OpenWebSchool - 01 - WWW IntroOpenWebSchool - 01 - WWW Intro
OpenWebSchool - 01 - WWW Intro
 
Google App Engine
Google App EngineGoogle App Engine
Google App Engine
 
Redis
RedisRedis
Redis
 
2014 database - course 2 - php
2014 database - course 2 - php2014 database - course 2 - php
2014 database - course 2 - php
 
OpenWebSchool - 11 - CodeIgniter
OpenWebSchool - 11 - CodeIgniterOpenWebSchool - 11 - CodeIgniter
OpenWebSchool - 11 - CodeIgniter
 
2014 database - course 3 - PHP and MySQL
2014 database - course 3 - PHP and MySQL2014 database - course 3 - PHP and MySQL
2014 database - course 3 - PHP and MySQL
 

Similar a 2014 database - course 1 - www introduction

Web Services PHP Tutorial
Web Services PHP TutorialWeb Services PHP Tutorial
Web Services PHP TutorialLorna Mitchell
 
Resource-Oriented Web Services
Resource-Oriented Web ServicesResource-Oriented Web Services
Resource-Oriented Web ServicesBradley Holt
 
Webapp security testing
Webapp security testingWebapp security testing
Webapp security testingTomas Doran
 
Webapp security testing
Webapp security testingWebapp security testing
Webapp security testingTomas Doran
 
HTTP fundamentals for developers
HTTP fundamentals for developersHTTP fundamentals for developers
HTTP fundamentals for developersMario Cardinal
 
KMUTNB - Internet Programming 2/7
KMUTNB - Internet Programming 2/7KMUTNB - Internet Programming 2/7
KMUTNB - Internet Programming 2/7phuphax
 
PHP Training: Module 1
PHP Training: Module 1PHP Training: Module 1
PHP Training: Module 1hussulinux
 
application of http.pptx
application of http.pptxapplication of http.pptx
application of http.pptxssuseraf60311
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web ServicesGreg Hines
 
Web-01-HTTP.pptx
Web-01-HTTP.pptxWeb-01-HTTP.pptx
Web-01-HTTP.pptxAliZaib71
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 1
Girl Develop It Cincinnati: Intro to HTML/CSS Class 1Girl Develop It Cincinnati: Intro to HTML/CSS Class 1
Girl Develop It Cincinnati: Intro to HTML/CSS Class 1Erin M. Kidwell
 
Class 1 - World Wide Web Introduction
Class 1 - World Wide Web IntroductionClass 1 - World Wide Web Introduction
Class 1 - World Wide Web IntroductionAhmed Swilam
 

Similar a 2014 database - course 1 - www introduction (20)

Web services tutorial
Web services tutorialWeb services tutorial
Web services tutorial
 
Web Services Tutorial
Web Services TutorialWeb Services Tutorial
Web Services Tutorial
 
Web Services PHP Tutorial
Web Services PHP TutorialWeb Services PHP Tutorial
Web Services PHP Tutorial
 
Resource-Oriented Web Services
Resource-Oriented Web ServicesResource-Oriented Web Services
Resource-Oriented Web Services
 
Webapp security testing
Webapp security testingWebapp security testing
Webapp security testing
 
Webapp security testing
Webapp security testingWebapp security testing
Webapp security testing
 
HTTP fundamentals for developers
HTTP fundamentals for developersHTTP fundamentals for developers
HTTP fundamentals for developers
 
WWW and HTTP
WWW and HTTPWWW and HTTP
WWW and HTTP
 
KMUTNB - Internet Programming 2/7
KMUTNB - Internet Programming 2/7KMUTNB - Internet Programming 2/7
KMUTNB - Internet Programming 2/7
 
PHP Training: Module 1
PHP Training: Module 1PHP Training: Module 1
PHP Training: Module 1
 
application of http.pptx
application of http.pptxapplication of http.pptx
application of http.pptx
 
Web Scraping with PHP
Web Scraping with PHPWeb Scraping with PHP
Web Scraping with PHP
 
HTML Intro
HTML IntroHTML Intro
HTML Intro
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
 
Spider Course Day 1
Spider Course Day 1Spider Course Day 1
Spider Course Day 1
 
IP UNIT 1.pptx
IP UNIT 1.pptxIP UNIT 1.pptx
IP UNIT 1.pptx
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
 
Web-01-HTTP.pptx
Web-01-HTTP.pptxWeb-01-HTTP.pptx
Web-01-HTTP.pptx
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 1
Girl Develop It Cincinnati: Intro to HTML/CSS Class 1Girl Develop It Cincinnati: Intro to HTML/CSS Class 1
Girl Develop It Cincinnati: Intro to HTML/CSS Class 1
 
Class 1 - World Wide Web Introduction
Class 1 - World Wide Web IntroductionClass 1 - World Wide Web Introduction
Class 1 - World Wide Web Introduction
 

Último

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 

Último (20)

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

2014 database - course 1 - www introduction

  • 2. What happened when you open a browser?
  • 3. DNS lookup dns what's the ip of facebook.com? It's 173.252.110.27
  • 4. HTTP protocol GET /enskylin HTTP/1.1 Host: www.facebook.com HTTP/1.1 200 OK HTML
  • 5. HTTP Protocol • Protocol between Browser <-> Web server • Initially used to transmit documents in HTML format • We know GET method now, but how about post something to webserver?
  • 6. What happened when you post a form on website?
  • 7. Perform a POST in HTTP POST /register HTTP/1.1 Host: www.facebook.com HTTP/1.1 200 OK HTML save to database surname=E&name=ensky&email=…
  • 8. HTTP usage • Actually, HTTP is very simple, trivial, and easy to use in many situations • When it comes to data-manipulation, there are four basic method: Create, Read, Update, Delete(CRUD) they can be perfectly mapped into HTTP protocol
  • 9. HTTP protocol -> REST API • Using HTTP protocol to serve an data-manipulation API, we call it REST API. • WIKI: REST Operation HTTP Read GET Create POST Update PUT Delete DELETE
  • 10. Imagine you're writing a game • you'll have – character info • maybe life, age, attack power, skills, location, … – Monster info • maybe life, skills, … – and many data need to be CRUD
  • 11. REST API • And it'll be very easy if you use REST API. – GET /characters/1/life – PUT /characters/1 life=60&isPoisoned=1 – PUT /characters/1/location map=1&block=123
  • 14. HTML is a markup language (not a programming language)
  • 15. defines defines what elements on the page (images, links, texts, videos, forms, scripts, etc.) http://goo.gl/qOu6OF
  • 16. defines what orders the elements are 1 2 3 4 http://goo.gl/qOu6OF
  • 17. HTML • cooperates –layouts with CSS –functions with Javascript
  • 18. CSS, HTML, JS Structures Layouts Functions 結構 樣式 功能
  • 19. HTML hello world <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Hello world! Title</title> </head> <body> <p>Hello world!</p> </body> </html>
  • 20. HTML is a nested language <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Hello world! Title</title> </head> <body> <p>Hello world!</p> </body> </html>
  • 21. HTML is a markup language <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>…</title> </head> <body> <p>…</p> </body> </html> • Tag • Attribute • Value • Node • Parent • Children
  • 22. HTML is a markup language <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>…</title> </head> <body> <p>…</p> </body> </html> • Head defines something for browser • Encoding • Title of the page • Resources • CSS • Javascript
  • 23. HTML is a markup language <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>…</title> </head> <body> <p>…</p> </body> </html> • Body defines something to render (the contents)
  • 24. Common attributes <p id="unique" class="red-div" title="help text">HIHI</p> • class classify elements, usually set for CSS or JS to select some elements. One element can have multiple classes • id same as class, but unique in a document. One element can only have one id • style inline CSS • title help text when hover
  • 25. Debug tools • Chrome debug tool F12
  • 27. CSS, HTML, JS Structures Layouts Functions 結構 樣式 功能
  • 28. HTTP protocol review GET /enskylin HTTP/1.1 Host: www.facebook.com HTTP/1.1 200 OK HTML
  • 29. Imagine if you want to write a web server…
  • 30. 1.Initialize a socket wait for client's HTTP request GET /icon.png HTTP/1.1 Host: www.ensky.tw HTTP/1.1 200 OK HTML port 80
  • 31. 2.Parse the HTTP request find out some useful information like URL, Hostname, … GET /icon.png HTTP/1.1 Host: www.ensky.tw HTTP/1.1 200 OK HTML
  • 32. 3.Prepare file according to above information GET /icon.png HTTP/1.1 Host: www.ensky.tw HTTP/1.1 200 OK HTML get icon.png from somewhere in your file system
  • 33. 4.Response the document back to client GET /icon.png HTTP/1.1 Host: www.ensky.tw HTTP/1.1 200 OK HTML
  • 34. Virtual host • One web server can host many domains • It can be determined by "Host: " part in HTTP protocol www.facebook.com GET /enskylin HTTP/1.1 Host: www.facebook.com
  • 35. Virtual host • In case of static file mapping, you can simply do www.facebook.com -> c:Domainswww image.facebook.com -> c:Domainsimage so any request to http://www.facebook.com/song.mp3 web server will try to find the file at c:Domainswwwsong.mp3
  • 36. However, static files is not rocks enough!
  • 37. How about dynamic generated documents?
  • 38. The only difference is we get data from database rather than disk file GET /enskylin HTTP/1.1 Host: www.facebook.com HTTP/1.1 200 OK HTML
  • 39. And we need to generate the HTML GET /enskylin HTTP/1.1 Host: www.facebook.com HTTP/1.1 200 OK HTML
  • 40. And send it back to browser GET /icon.png HTTP/1.1 Host: www.ensky.tw HTTP/1.1 200 OK HTML
  • 41. If you want to write a web server 1. Initialize a socket to wait for client's HTTP request 2. Parse the HTTP request and find out some useful information like URL, Host, … 3. Prepare document according to above information 4. Response the document back to client
  • 42. If you want to write a web server 1. Initialize a socket to wait for client's HTTP request 2. Parse the HTTP request and find out some useful information like URL, Host, … 3. Prepare document according to above information 4. Response the document back to client
  • 43. there is different logic for each page -> it is hard to write in Web server GET /enskylin HTTP/1.1 Host: www.facebook.com HTTP/1.1 200 OK HTML
  • 44. If you want to write a web server 1. Initialize a socket to wait for client's HTTP request 2. Parse the HTTP request and find out some useful information like URL, Host, … 3. Prepare document according to above information 4. Response the document back to client web Server CGI
  • 45. CGI and Web server Web server CGI HTTP Request stdin + env stdout HTTP Response + BODY HTTP request body HTTP request header HTTP response head + body
  • 46. CGI Implemention #include <iostream> using namespace std; int main () { cout << “<!doctype html>”; cout << “<html>”; cout << “ <head>”; // …omitted }
  • 48. We Save Your Time!
  • 51. IDE • We highly recommended to use
  • 52. IDE Note • You must save in UTF-8, otherwise you'll not be able to render Chinese correctly • see: ChineseWorld PTT
  • 53. Save as UTF-8 • Notepad++
  • 54. Save as UTF-8 • Sublime
  • 55. Save as UTF-8 • VIM • Putty
  • 56. HTML Tags - Text p: paragraph <p>Jlhuang Rocks!</p>
  • 57. HTML Tags - Text br: break <p>Jlhuang <br> Rocks!</p>
  • 58. HTML Tags - Link a: anchor <a href="http://www.google.com">Click me</a>
  • 59. HTML Tags - Heading <h1>H1</h1> <h2>H2</h2> <h3>H3</h3> <h4>H4</h4> <h5>H5</h5> <h6>H6</h6>
  • 60. HTML Tags - List <ul> <li>Item1</li> <li>Item2</li> <li>Item3</li> <ol> <li>Item4</li> </ol> </ul>
  • 61. HTML Tags - Table <table> <thead> <tr><td>Name</th><td>Score</td></tr> </thead> <tbody> <tr><th>Ensky</th><td>100</td></tr> <tr><th>dy93</th><td>80</td></tr> </tbody> <tfoot> <tr><th>Average</th><td>90</td></tr> </tfoot> </table> Name Score Ensky 100 dy93 80 Average 90
  • 62. HTML Tags - Images img: image <img src="http://i1.ytimg.com/vi/iYQHkwCfCiw/m axresdefault.jpg">
  • 65. Javascript reference • https://speakerdeck.com/openwebschool/07-javascript- openwebschool • https://speakerdeck.com/openwebschool/08-js-frontend- and-jquery-openwebschool