= Week 7, continued :author: Cheng Gong :v: LbDYLUuwnTk [t=0m0s] == Announcements * CS50 Lunch is again this Friday 10/24 at 1:15pm, RSVP at the usual http://cs50.harvard.edu/rsvp. * Jason dressed as a pumpkin one year for his section that happened to land on Halloween 2011 (http://cs50.tv/2011/fall/sections/8/section8.mp4[Section 8] at http://cs50.tv[cs50.tv]), and that year his air pump was working, but by 2012 his costume was deflated. * If you want to join us in pumpkin carving with Daven and Gabe this Friday 10/24, 3pm, RSVP by emailing heads@cs50.harvard.edu. * The final project will be discussed soon, but they can be almost any project of interest to you, with the approval of your teaching fellow. * To help you with that, we will have seminars, optional classes taught by teaching fellows and other staff from across campus, on various topics that are fun and different. This year's lineup: ** 3D Modeling and Manufacture ** Amazing Web Apps with Ruby on Rails ** Android 101 ** Breaking Through The (Google) Glass Ceiling ** Build Tomorrow's Library ** Cloud Computing with Amazon Web Services (AWS) ** CSS: Awesome Style and Design ** Data Analysis in R ** Data Visualization and D3 ** Essential Scale-Out Computing ** Exposing Digital Photography ** How to Build Innovative Technologies ** iOS App Development with Swift ** Learning iOS: Create your own app with Objective-C! ** Light Your World (with Hue Bulbs) ** Meteor: a better way to build apps ** Teach Your Computer to See: Augmented Reality with OpenCV ** Transitioning to Agile Development from Waterfall * If you want to register or see more information about these topics, visit http://cs50.harvard.edu/register. [t=3m14s] == HTTP Review * We began and concluded on Monday with HTTP, Hypertext Transfer Protocol, which is just the way your web browser speaks to a web server, like the way humans extend a hand to each other to make a handshake. * A protocol is just a set of conventions of sending information back and forth, like this familiar picture: + * The most common method used is *GET*, that looks like this: + [source] ---- GET / HTTP/1.1 Host: www.google.com ... ---- * And that request is placed inside a digital envelope with the IP address of the computer it is from, and the IP address of the recipient. But we need one more piece of information, the port number, since the server might be listening for different kinds of communication. Port 80 is the most common as it's the default for web traffic, so we'll see that often, along with 443, used for secure web traffic (HTTPS). * Also remember that the `/` after `GET` means that we want the root of the web server, or the default webpage. * Hopefully the server responds with something like this: + [source] ---- HTTP/1.1 200 OK Content-Type: text/html ... ---- * And the number 200 is a convention saying that everything okay, with the `Content-Type` of the message `text/html`, and the `...` will be the webpage itself. * So now we can pick up by writing HTML, Hypertext Markup Language, that we'll use to write webpages and specify their structure and style. [t=5m50s] == HTML * On Monday we looked at this: + [source, html] ----
` tag to signify *paragraphs*: + [source, html] ---- ...
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam in tincidunt augue. Duis imperdiet, justo ac iaculis rhoncus, erat elit dignissim mi, eu interdum velit sapien nec risus. Praesent ullamcorper nibh at volutpat aliquam. Nam sed aliquam risus. Nulla rutrum nunc augue, in varius lacus commodo in. Ut tincidunt nisi a convallis consequat. Fusce sed pulvinar nulla.
Ut tempus rutrum arcu eget condimentum. Morbi elit ipsum, gravida faucibus sodales quis, varius at mi. Suspendisse id viverra lectus. Etiam dignissim interdum felis quis faucibus. Integer et vestibulum eros, non malesuada felis. Pellentesque porttitor eleifend laoreet. Duis sit amet pellentesque nisi. Aenean ligula mauris, volutpat sed luctus in, consectetur id turpis. Phasellus mattis dui ac metus blandit volutpat. Donec lorem arcu, sollicitudin in risus a, imperdiet condimentum augue. Ut at facilisis mauris. Curabitur sagittis augue in dictum gravida. Integer sed sem sed justo tempus ultrices eu non magna. Phasellus semper eros erat, a posuere nisi auctor et. Praesent dignissim orci aliquam laoreet scelerisque.
Mauris eget erat arcu. Maecenas ac ante vel ipsum bibendum varius. Nunc tristique nulla eget tincidunt molestie. Morbi sed mauris eu lectus vehicula iaculis ac id lacus. Etiam sit amet magna massa. In pulvinar sapien ac mi ultrices, quis consequat nisl hendrerit. Aliquam pharetra nec sem non vehicula. In et risus leo. Ut tristique ornare nisl et lacinia.
... ---- * We keep getting a *403 Forbidden*, so we'll run + [source] ---- jharvard@appliance (~/vhosts/localhost/public): chmod a+r *.html ---- + which will make all the `.html` files in our `public` folder readable. * And now we see our paragraphs: + image::paragraphs.png[alt="paragraphs.html", width=800] * We can also make *tables* with http://cdn.cs50.net/2014/fall/lectures/7/w/src7w/table.html[`table.html`]: + [source, html] ----1 | 2 | 3 |
4 | 5 | 6 |
7 | 8 | 9 |
* | 0 | # |