week 8 jordan jozwiak
Download
Skip this Video
Download Presentation
CS50

Loading in 2 Seconds...

play fullscreen
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
slide5
HTML
  • HyperText Markup Language
  • Used to format contents of web pages.
  • NOT a programming language
slide6
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.
slide10
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?)
slide11
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>

slide12
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!

slide13
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
slide14
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