Skip to content

Instantly share code, notes, and snippets.

@JustinD85
Last active April 28, 2019 23:22
Show Gist options
  • Save JustinD85/0c310bddcf49ea3e15e889b41909c6c7 to your computer and use it in GitHub Desktop.
Save JustinD85/0c310bddcf49ea3e15e889b41909c6c7 to your computer and use it in GitHub Desktop.
Intermission Work BE2

B2 Intermission Work

Answer these Check for Understanding questions as you work through the assignments.

HTML

  1. What is HTML? Hyper Text Markup Language
  2. What is an HTML element? Everything between a the start and end tags.
  3. What is an HTML attribute? provides additional information about an HTML element, they are specified in the start tag
  4. What is the difference between a class and an id? When would you use one vs. the other? class is used to group like elements while and id is meant to identify one element
  5. What HTML would you write to create a form for a new dog with a "name" and an "age"?
<form>
  <label>
    name:<input/>
  </label>
  <label>
    age:<input/>
  </label>
  <input type="submit"/>
</form>
  1. What are semantic tags? When would you use them over a div? They are tags that appropriately identify parts of your webpage. Use them whenever you can.
  2. Explain what each of the following HTML tags do and when you would use them:
  • <h1>, <h2>, etc. These are used for titles, with h1 being more unique in that it should be only one.
  • <p> These identify bodies of text.
  • <body> This identifies where content goes that should be displayed on a page.
  • <a> and the href attribute a is the anchor tag for linking to other resources. The href is the location.
  • <img> and the src attribute img is for displaying images and src is the location.
  • <div> div is for dividing up your webpage when a more semantic element is not appropriate.
  • <section> These divide your webpage into sections, also there should be a header element inside.
  • <ul>, <ol>, and <li> These are used to list items, unordered, ordered, and the actual items are surrounded by the li tag
  • <form> This is used to send information the user has entered to other resources/webaddresses
  • <input> These are used to accept text from the user.

CSS

  1. What is CSS?
  • Cascading style sheet, used for controlling the style of a webpage
  1. What is a CSS selector? How do you use the ID selector? The class selector?
  • It is used to identify elements to be styled.
  • ID: document.querySelector('#id')
  • CLASS: document.querySelector('.class')
  1. What are the three ways to include CSS in your HTML documents? What are the pros and cons of each?
  • Inline: applying a style attribute directly to an element.
    • pro: quick
    • con: hard to debug/change
  • Internal: writing css between a set of style tags in the head element
    • pro: all code in one file
    • con: all code in one file
  • External: linking css files in the head
    • pro: increased file organization
    • con: more files
  1. What is the Box Model? Describe each component of the Box Model.

The box model is a literal(figurative) box that is wrapped around every element. It has layers that are from outside to inside: Margin, Border, padding, and finally the content in the middle. The purpose of the layers is to increase ease of styling. Margin creates space between border and other elements. Border creates space between margin and padding. Padding creates space between border and content. Content is content.

SQL

Jumpstart Lab Tutorial

  1. What is a database? It's a means of storing information for retreival at a later time.
  2. What is SQL? Is a language for interacting with compatible databases.
  3. What is SQLite3? A basic version of a database engine that stores information in plain text.
  4. What is a Table? A table represents a grouping of like data.
  5. What is a primary key? a unique identifier for each row in a table
  6. What is a foreign key? a unique identifier to a row in an external table.
  7. Explain what each of the following SQL commands do:
  • insert: Adds a row to a table
  • select: determines what will be the total scope of the find
  • where: determines the attributes for matching items
  • order by: orders items either ASC or DESC
  • inner join: returns a table that is a combination of other tables that match a given where clause

PG Exercises

  1. How can you limit which columns you select from a table? after the select keyword specify the columns name you want to target
  2. How can you limit which rows you select from a table? after the where keyword specify which rows should be targeted
  3. How can you give a selected column a different name in your output? using the 'as' keyword after the name of the column
  4. How can you sort your output from a SQL statement? use sort by at the end of your SQL statement
  5. What is joining? When do you need to join? joining is combining two or more tables togeher. You should join whenever you need aggregate date to select from
  6. What is an aggregate function? they are functions that take in values and returns a single value
  7. List three aggregate functions and what they do. sum: returns the sum of all values given to it count: returns the count of occurrences of items in a group
  8. What does the group statement do? it combines matchings sets of data together
  9. How does the group statement relate to aggregates? you can combine group-by with an aggregate such as sum to produce a a single row with a total number column

Rack Tutorial

Copy and Pase the link to your deployed application here: https://morning-refuge-78687.herokuapp.com/

  1. What is HTTP? Its a common protocol for sending information over the internet. Its a way differing computers can talk to each other, its a common language.
  2. What is an HTTP Method (also known as an HTTP Verb)? Ex. 'GET' used to identify the type of request that is being sent to a server from a client.
  3. What is an HTTP request? its send from a client to a server requesting an action take place on the server.
  4. Describe the three parts of the HTTP request line. The request line that includes the verb, headers which are used to identify additional configuration options(such as tokens can be placed here), and body which is used to send resources to the server.
  5. Describe the HTTP request headers. Headers are used to send additional info, such as tokens, identifying how the server should read the request. they are key/value pairs
  6. Describe the HTTP request body. the body is used to send the main part of a messeage, ie a picture or json
  7. What is an HTTP response? a response is send to the client from the server after the server has attempted to process the request. this happens whether the request was fulfilled or not.
  8. Describe the three parts of the HTTP status line. the first like is the verb so the server knows how it should process ther request the second line is the route so the server know where the client would like the process to happen the third line identifies the protocol version the server should use when translate the request
  9. Describe the HTTP response headers. it also contains key/value pair that are additional information to be used by the client
  10. Describe the HTTP response body. it is the main portion of a response containing normally html or js(such as a webpage) or json.
  11. What is a Web Framework? its a set of tools that automate a lot of tasks to put our apps on the web
  12. What is a status code? status codes are used by the client to determine if the server did the request successfuly or not. there are many codes that mean different things such as 404 meaning the resource isn't on the server
  13. What does it mean to deploy your application? it means to make your application accessible to other computers on the internet

Rails Tutorial: Task Manager

Copy and Pase the link to your repo here: https://github.com/JustinD85/task_manager

  1. Define CRUD. Create, Read, Update, and delete. These are all verbs for how a resource should be treated.
  2. Define MVC. it allows for separation of concerns. M is the model typically resembles the database V is for view and houses all code that has to do with presentation, and C is controller is like a traffic cop. It directs traffic to different resources.
  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. route, html, controller files
  4. What are params? Where do they come from? params are used to pass information to the server, they come from the url in our browser
  5. Check out your routes. Why do we need two routes each for creating a new Task and editing an existing Task? I am not sure what this question means.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment