Week 8 jordan jozwiak
Download
1 / 19

CS50 - PowerPoint PPT Presentation


  • 171 Views
  • Uploaded on

Week 8 Jordan Jozwiak. CS50. Announcements. Problem Set 5 has been returned Final Project's Pre-Proposal is due by 11:00am on Mon 11/7, per the  spec 10 minute meetings? Saturday? Doodle. Pset6 Feedback. Char* vs. char [LENGTH + 1] Hash function in relation to hash table size

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' CS50' - inge


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Week 8 jordan jozwiak

Week 8

Jordan Jozwiak

CS50


Announcements
Announcements

  • Problem Set 5 has been returned

  • Final Project's Pre-Proposal is due by 11:00am on Mon 11/7, per the spec

    • 10 minute meetings? Saturday?

    • Doodle


Pset6 feedback
Pset6 Feedback

  • Char* vs. char [LENGTH + 1]

  • Hash function in relation to hash table size

  • Node *hash_table[HASH_SIZE] = {NULL};


This week
This Week

  • HTML

  • Chmod

  • Forms

  • PHP

  • mySQL


HTML

  • HyperText Markup Language

  • Used to format contents of web pages.

  • NOT a programming language


HTML

  • ‘Tags’ enclose regions of page.

    • Most beginning tags have ending tags (exceptions include “image” and “br” tags.

    • In general, close most recently opened first.

  • ‘Tags’ may have ‘attributes’.

    • Attributes are like parameters for a tag.

      <tag attribute="value">

      Stuff.

      </tag>


Chmod
chmod

  • Used to restrict access to files and directories accessible via the internet.

  • Permissions assigned by setting three octal values which correspond to permissions to ‘read’, ‘write’, or ‘execute’.

  • User, Group, and World have distinct permissions.


Chmod1
chmod

  • Can use octal values directly, e.g.:

    • chmod 644 main.c

      sets permissions to read and write for user,

      and read permissions for everyone else

  • Or, you can use the “shorthand”:

    • chmodu+xmain.c

      Gives execute permissions for user. The first character can be also be a “g” (group), “o” (other), or “a” (all); the ‘+’ can be a ‘-’ for taking away permissions, and the final letter can be ‘x’, ‘r’, or ‘w’.


Forms
Forms

  • Allow input of different forms on a web page.

  • ‘Inputs’ include:

    • Checkboxes

    • Radio buttons

    • Text boxes

    • Submit buttons

  • Information from forms may be ‘submitted’ and sent to another page for use.


CSS

  • CSS: Cascading Style Sheets

  • Allows for easier formatting of HTML

  • Specifically formats different types of elements

  • May be included in separate file or in-lined (what are the advantages and disadvantages of each approach?)


CSS

  • ‘style’ attributes allow for formatting of tag contents using CSS.

  • Examples:

    align: center

    font-size: small

    color: blue

    display: block

    <p style="align: center">This is centered</p>


CSS

  • Can also define formatting in an external .css file which is linked in.

    Format

    Selector p

    { {

    declarations;  align: center;

    } }

    Don’t forget the semicolon!


PHP

  • PHP: PHP Hypertext Preprocessor

  • When accessed, dynamically generates a webpage which it then outputs to browser.

  • PHP code is executed by the server, not by the browser (we’ll soon see how Javascript differs)

  • PHP code enclosed in <? ?> tags

  • All PHP variables are prefaced by a $. You do NOT declare variables with a type


PHP

  • Compile with gcc, then run executable.

  • Each variable is declared with a type, and you cannot (without casting) mix and match data types, e.g.:

    int a = 3;

    char *s = "hello";

    s = s + a; // won’t compiled

  • Doesn’t get compiled; whole program is (generally) interpreted line by line

  • Variables don’t have types, and you can do weird mixings of data types, e.g.:

    $a = 3;

    $s = "hello";

    $s = $s . $a; // gives "hello 3"


M ysql
MySQL

  • SQL – Structured Query Language

  • Database software which allows us to store a collection of data as ‘entries’ containing a set of distinct ‘fields’ containing values.

  • Databases contains tables, which contain rows, which contain fields.


M ysql queries
MySQL Queries

  • INSERT

    • Insert a new entry.

  • DELETE

    • Remove an existing entry.

  • SELECT

    • Select one or more entries.

  • UPDATE

    • Update the fields of an existing entry.


Mysql
MySQL

WARNING: It is always important to ‘escape’ the contents of any string passed by the user which is to be included in a database query.

"INSERT INTO students VALUE ('<user string');"

What could possibly go wrong?



Coding time
Coding time!

  • Cloud.cs50.net/~jjozwiak