Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MillsProvosty/dbd290eb5ad5083c3a3fc61ddb680b81 to your computer and use it in GitHub Desktop.
Save MillsProvosty/dbd290eb5ad5083c3a3fc61ddb680b81 to your computer and use it in GitHub Desktop.
Mills' Mod 2 Intermission Work
# B2 Intermission Work
Answer these Check for Understanding questions as you work through the assignments.
## HTML
1. What is HTML?
Hypter Text Markup Language- Standard markup language for creating webpages. This is the content of what you see.
2. What is an HTML element?
Elements are the building blocks of HTML pages. They are represented by a start and end tag pair with content in between.
3. What is an HTML attribute?
Attributes provide additional information about elements. They're specified a start tag, and often come in name/value pairs.
Ex, <start tag> name="value" </end tag>
4. What is the difference between a class and an id?
A class is used to define equal styles for elements with the same class name, whereas id's are used to define unique id's for an HTML element. This makes it possible to select and element with that id, or performa a specific task for an element with that ID value.
When would you use one vs. the other?
So, if you're trying to add one style to multiple elements, you'd use a class, whereas you'd use an ID if you're trying to interact with a specific element.
5. What HTML would you write to create a form for a new dog with a "name" and an "age"?
I think I'd use the <input> form, and use the input type = "text" attribute. Or maybe the name attribute?
6. What are semantic tags? When would you use them over a `div`?
Sementaic tags clearly descibe its meaning with phrases and language. For example, <header> or <table> or <article> as opposed to <div>. (although it doesn't take much to figure out that div just divides the text...) It's an element that describes what it's doing from describing it.
7. Explain what each of the following HTML tags do and when you would use them:
* `<h1>`, `<h2>`, etc.
You're creating a heading and need big font, and then a second heading underneath that with slightly smaller/less bold font. Headings give structure to a document.
* `<p>`
New Paragraph!
* `<body>`
This is the body of the page; everything you want to display is wrapped by these tags.
* `<a>` and the `href` attribute
This indecates an HTML link. Anchor, html link reference.
* `<img>` and the `src` attribute
There is an image being added to the page. Source of the image, the URL.
* `<div>`
A divide in the text.
* `<section>`
Thematic group of content, typically with a heading.
* `<ul>`, `<ol>`, and `<li>`
Unordered list, ordered list and then the actual list elements.
* `<form>`
Defines a form that is used to collect user input.
* `<input>`
The most important form element; can be displayed several ways depending on the type attribute.
## CSS
1. What is CSS?
Cascading Style Sheets Language that describes style of HTML document.
2. What is a CSS selector?
Selectors are patterns used to select the element you want to style. Indecators for HTML elements.
How do you use the ID selector?
Put a # in front of the name of the ID you want to style. For example, id="coffee", then you'd put #coffee and it'd style those elements with id="coffee" in them.
The class selector?
Put a . in front of the name of the class you want to style. For this one, it'd be class="thing", then you'd call .thing.
3. What are the three ways to include CSS in your HTML documents?
External style sheet
Internal style sheet
Inline style
What are the pros and cons of each?
External sheets can change the look of an entire website by changing just one file!
Internal sheets is used if one single page has a unique style, so each page has a unique look. This seems like a lot more front end work.
Inline style may be used to apply a unique style for a single element. This seems like slightly less coding, but also, more details that seem more front-endy.
4. What is the Box Model? Describe each component of the Box Model.
All HTML elements can be considered as boxes. In CSS, the term "box model" is used when talking about design and layout.
The CSS box model is essentially a box that wraps around every HTML element. It consists of:
Content - The content of the box, where text and images appear
Padding - Clears an area around the content. The padding is transparent
Border - A border that goes around the padding and content
Margin - Clears an area outside the border. The margin is transparent
The box model allows us to add a border around elements, and to define space between elements.
## SQL
### Jumpstart Lab Tutorial
1. What is a database?
It is a means of storing, fetching, calculating and sorting data, and is the core of almost every web application.
2. What is SQL?
Structured Queary Language, used to interact with databases.
3. What is SQLite3?
SQLite is a database engine. It is software that allows users to interact with a relational database.
4. What is a Table?
Databases sort its information using tables, which consist of columns and rows.
5. What is a primary key?
Uniquely identifies each row in a table. This means you can select each row in a database by knowing it's primary key. None of the values can be NULL, each value must be unique, and a table can not have more than one primary key column.
6. What is a foreign key?
This is used to link 2 tables together; it's a field (or collection of fields) in one table that refers to the primary key in another table.
7. Explain what each of the following SQL commands do:
* insert- Adds information to a table
* select- returns the table or information defined in the command.
* where- delegates the place or condition a command is to find the informaiton by.
* order by- defines how information should be sorted.
* inner join- joines two tables together via a primary/foreign key. The INNER JOIN keyword selects all rows from both tables as long as there is a match between the columns.
### PG Exercises
1. How can you limit which columns you select from a table?
SELECT (whatever the name of the column is) FROM (table name);
2. How can you limit which rows you select from a table?
SELECT (column name, or all by using *) FROM (table name) WHERE (some caluse that selects data that matched the critera specified);
3. How can you give a selected column a different name in your output?
Use the AS to rename it.
4. How can you sort your output from a SQL statement?
Use a Group By to get all info together, and then, you can order it by using an Order By.
5. What is joining? When do you need to join?
THE WORST, that's what it is. Taking two tables, and bringing matching information together by using the primary and foreign keys (which contain the same information)
6. What is an aggregate function?
An aggregate function performs a calculation on a set of values, and returns a single value.
7. List three aggregate functions and what they do.
SUM: adds up all of the selected values for a larger total of all values
COUNT: returns the number of selected values
AVG: returns the average of selected values
MAX: returns maximum from selected values
MIN: returns minimum from selected values
SQRT: returns the square root of selected values
8. What does the `group` statement do?
Used to group results by a column
9. How does the `group` statement relate to aggregates?
Its usually used in conjunction with an aggregate- you group by the result of the aggregate.
## Rack Tutorial
**Copy and Pase the link to your deployed application here:**
1. What is HTTP?
Hypertext Transfer Protocol
2. What is an HTTP Method (also known as an HTTP Verb)?
Words used to indicate the desired action to be performed for a given resource. EX: Get, Head, Post, Put etc
3. What is an HTTP request?
Whenever you click on a URL or search, you're sending a request.
4. Describe the three parts of the HTTP request line.
Request line: very first line
Headers: Key value pairs that provide additional info to the server
Body: Optional
5. Describe the HTTP request headers.
Headers containing more information about the resource to be fetched or about the client itself.
6. Describe the HTTP request body.
Request body tries to send additional information required by the server to process current request properly.
7. What is an HTTP response?
This is the servers answer to the response, the code that explains how it satisfied the request.
8. Describe the three parts of the HTTP status line.
Status Line: first line in the response.
Headers: key/value pairs providing additional information about the response.
Body: the portion of the response containing the information requested (frequently HTML, CSS, or JavaScript)
9. Describe the HTTP response headers.
Headers with additional information about the response, like its location or about the server itself (name and version etc.).
10. Describe the HTTP response body.
Response Body contains the resource data that was requested by the client.
11. What is a Web Framework?
They are software designed to support the development of web applications. Web frameworks provide a standard way to build and deploy web applications.
12. What is a status code?
This is a a three digit number that tells a client if their request was successful, and if not provides some idea of why.
13. What does it mean to deploy your application?
Put it in a format that is sharable.
## Rails Tutorial: Task Manager
**Copy and Pase the link to your repo here:**
1. Define CRUD.
C: Create
R: Read
U: Update
D: Delete
2. Define MVC.
M: Model
V: View
C: Controller
3. What three files would you need to create/modify for a Rails application to respond to a `GET` request to `/tasks`, assuming you have a `Task` model.
app - This is where our MVC structure lives.
config - Inside this directory, in the routes.rb file is where we will tell our Rails app which HTTP requests to respond to.
db - Where our database structure will be set up.
4. What are params? Where do they come from?
Rails takes parameters that were received in a request and turns them into params objects that can be used and manipulated inside of the application.
5. Check out your routes. Why do we need two routes each for creating a new Task and editing an existing Task?
Because these two tasks do different things, thus require different routes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment