introduction to programming - class 8

3
Introduction to Programming – Class 8 Images, Internet Paul Brebner Note: This class changed topics for a while and was mainly done on the whiteboard due to IT issues. Also included a human simulation of the internet and DNS using students, a ball of string, and post it notes with IP addresses written on and some students acting as DNS. Revision of image formats Pixel based formats JPEG lossy compression - loose information the smaller the file, lots of colours, good for photographs and things with dots, not so good for lines, loose information with more load/change/saves GIF lossless compression - only 256 colours, simple animation, good for drawings and shapes, and small images PNG - better GIF, lossless compression, allows transparency, PNG-24 has lots of colours Line/shape formats – SVG, scale up and down infinitely. Internet overview What happens if the internet is turned off? Trick – can’t. Internet has been around since 1960s’ but needed custom programs everywhere to do anything useful (like find and get a file). Small number of defence computers networked, 1960s. 1970s/80s universities. Late 1980’s-1990’s commercial networking, ISPs 1993, 1994 Mosaic and Netscape Browsers – graphical WWW was born. WWW uses: TCP/IP – internet protocol from 1960s HTML – hypertext markup language – text/images + meta-data to tell browser how to display and interact with it and find other pages etc HTTP – hypertext transfer protocol, runs on TCP/IP Web server – talks HTTP Browser – talks HTTP and acts as GUI URLs – user friendly internet addresses DNS – lookup names -> IP addresses URL -> DNS - hierarchy, get IP address back. Like phone book. E.g. lookup www.me.com.au i.e. just like a country, city and name (sort of) E.g. Australia, Canberra, Paul Brebner -> Phone +61-2-62636207

Upload: paul-brebner

Post on 15-Apr-2017

65 views

Category:

Education


1 download

TRANSCRIPT

Page 1: Introduction to programming - class 8

Introduction to Programming – Class 8 Images, Internet

Paul Brebner Note: This class changed topics for a while and was mainly done on the whiteboard due to IT issues. Also included a human simulation of the internet and DNS using students, a ball of string, and post it notes with IP addresses written on and some students acting as DNS. Revision of image formats Pixel based formats JPEG lossy compression - loose information the smaller the file, lots of colours, good for photographs and things with dots, not so good for lines, loose information with more load/change/saves GIF lossless compression - only 256 colours, simple animation, good for drawings and shapes, and small images PNG - better GIF, lossless compression, allows transparency, PNG-24 has lots of colours Line/shape formats – SVG, scale up and down infinitely. Internet overview What happens if the internet is turned off? Trick – can’t. Internet has been around since 1960s’ but needed custom programs everywhere to do anything useful (like find and get a file). Small number of defence computers networked, 1960s. 1970s/80s universities. Late 1980’s-1990’s commercial networking, ISPs 1993, 1994 Mosaic and Netscape Browsers – graphical WWW was born. WWW uses:

TCP/IP – internet protocol from 1960s

HTML – hypertext markup language – text/images + meta-data to tell browser how to display and interact with it and find other pages etc

HTTP – hypertext transfer protocol, runs on TCP/IP

Web server – talks HTTP

Browser – talks HTTP and acts as GUI

URLs – user friendly internet addresses

DNS – lookup names -> IP addresses URL -> DNS - hierarchy, get IP address back. Like phone book. E.g. lookup www.me.com.au i.e. just like a country, city and name (sort of) E.g. Australia, Canberra, Paul Brebner -> Phone +61-2-62636207

Page 2: Introduction to programming - class 8

= IP address Top level DNS server has phone book of "country phone books" (NZ, Australia, USA, etc) Country phone book DNS server has list of area phone book. Area phone books have list of names and numbers. Get the number back. But how do you call this number? Olden days had to ring operator, who would place a call to overseas operator, who would call foreign country operator, who would call local operator, who would call the person you're trying to ring. Same with TCP/IP routing. Message is passed to IP address by routing. Routers only know approx. how to get nearer to destination. IP address = originally network.host Now net1.subnet.subnet.host nslookup URL -> finds IP address Does it always have to go to DNS server to look up URL? No, there's a dns cache kept on local computer. tracert shows route taken - may change! How does HTTP work? Browser, web server, html! Web pages = html Links = other web pages Browser displays content web addresses are URLs/pagename.html i.e. web server resolves the final /pagename and returns the page (or error) URLs are: protocol://domain/page http is standard protocol for web pages Allows browser to communicate with web server with HTTP GET E.g. GET /index.html HTTP/1.1 Host: www.thing.com Responds with a header and body - body contains html tags which are displayed in your browser.

HTTP/1.1 200 OK

Date: Mon, 23 May 2005 22:38:34 GMT

Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux)

Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT

ETag: "3f80f-1b6-3e1cb03b"

Content-Type: text/html; charset=UTF-8

Content-Length: 131

Accept-Ranges: bytes

Connection: close

Page 3: Introduction to programming - class 8

<html>

<head>

<title>An example</title>

</head>

<body>

Hello World, this is a very simple HTML document.

</body>

</html>

hyperlinks href Hyperlinks take you somewhere else - like hyperspace! Even the same page! E.g.

<A href="localfile.html">A local file</A>

<A href="http://somwhereelse.com/notalocalfile.html">Not a local file</A>

<a href="#bottomOfPage">Click to go to the bottom of the page</a> blah blah blah blah ... <a id="bottomOfPage"></a> What’s missing? How do you find new web sites? Specific pages? Need Search engines. Lots initially, now only Google=search. Early on (1993?) there were Robots that crawled the web (to find all the pages – start somewhere and visit all the pages linked to by that page and so on), indexed them by what was in them, and allowed searching. Problem was as number of pages grew search returned too many – needed a way of ranking them – Google solved this by ranking pages by number of other pages that linked to them – i.e. highly linked pages came out on top (or if you paid them more $$$).