Skip to content

Instantly share code, notes, and snippets.

@kylecornelissen
Created April 29, 2019 14:38
Show Gist options
  • Save kylecornelissen/9509a99d69e3065e826f53221171d2d0 to your computer and use it in GitHub Desktop.
Save kylecornelissen/9509a99d69e3065e826f53221171d2d0 to your computer and use it in GitHub Desktop.
Intermission Pre Work for Mod2

B2 Intermission Work

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

HTML

  1. What is HTML?
    HTML stands for Hyper Text Markup Language and it is the language used to create webpages
  2. What is an HTML element?
    An HTML element is a building block of an HTML webpage represented by tags such as "heading", "paragraph", or "table". The element consists of everything inside the start and end tags.
    Example: <p>paragraph</p>
  3. What is an HTML attribute?
    An HTML attribute provides additional info about HTML elements and are specified in the start tag.
    href Example: <a href="https://www.w3schools.com">This is a link</a>
    src Example: <img src="https://i.imgur.com/iz1EIhE.jpg" width="500" height="600">
  4. What is the difference between a class and an id? When would you use one vs. the other?
    The class attribute defines equal elements with the same class name and can be defined on any HTML elements while the id attribute specifies a unique id and can be used on a single HTML element
  5. What HTML would you write to create a form for a new dog with a "name" and an "age"?
    I would use the input element to create a form where someone can input a new dog with a "name" text input type and an "age" number input type
  6. What are semantic tags? When would you use them over a div?
    Semantic tags are used to describes their intent to developers and the browser. You would use them over div because that's a non-semantic tag that does not clearly define its content.
  7. Explain what each of the following HTML tags do and when you would use them:
  • <h1>, <h2>, etc. - these tags create headers. h1 would be bigger than h2 and so on.
  • <p> - this tag creates a paragraph and you would use it to separate paragraphs
  • <body> - this tag defines the body of the document and can include paragraphs and headers
  • <a> and the href attribute - a contains HTML links and the href specifies the address
  • <img> and the src attribute - img contains HTML images and the src specifies the filename
  • <div> - block element used as a container for other HTML elements and used with CSS
  • <section> - defines sections in an html document such as headers, chapters, footers, or any other section
  • <ul>, <ol>, and <li> - unordered list(bullets), ordered list(numbers), and the tag that defines the listed item
  • <form> - defines a form that is used to collect user input with form elements inside
  • <input> - allows the user to input info while using input types to define the input field

CSS

  1. What is CSS?
    CSS stands for Cascading Style Sheets and describes how HTML elements are displayed. It saves a lot of work in external .css files and can control the layout of multiple web pages at once.
  2. What is a CSS selector? How do you use the ID selector? The class selector?
    The selector points to the HTML element (ex: h1) that you want to style. It can be based off element name, id, class, attribute, or more. The ID selector selects the unique id on a web page to change that style specifically and will not affect other elements without the id. The class selector does the same as id but for those specific class attributes.
  3. What are the three ways to include CSS in your HTML documents? What are the pros and cons of each?
    External style sheet - Can change the look of an entire website. Cannot change specific elements on its own.
    Internal style sheet - Can change the look of a single webpage. Cannot use Internal on multiple documents.
    Inline style - Can be used to apply a unique style to a single element. Loses advantage of a style sheet due to mixing content with presentation. Can easily override another style unintenionally.
  4. What is the Box Model? Describe each component of the Box Model.
    The term "box model" is used when talking about design and layout. It's layers of margin, border, padding, and the actual content that wrap around every HTML element.
  • Content - where text and images appear
  • Padding - transparent layer wrapped around the content
  • Border - border that goes around the padding and content
  • Margin - transparent layer wrapped around all the other elements above

SQL

Jumpstart Lab Tutorial

  1. What is a database?
    A database in SQL holds information that we can use to relate to other databases but storing, fetching, calculating, or sorting tabled information.
  2. What is SQL?
    A language used to interact with databases to create, modify, or delete files. You can find existing data, add new data, or change data. The language also allows you to use modifiers to match certain criteria in searches.
  3. What is SQLite3?
    SQLite3 is a version of SQLite that allows you to create databases locally and built-in to programs. It should only be used to experiment and not for full implementation.
  4. What is a Table?
    An SQL table holds data information in rows and columns. Each row should have a unique identifier.
  5. What is a primary key? Primary keys hold unique information for each row in a table. For example: An ID or a name
  6. What is a foreign key? Foreign keys allow you to connect two different tables using similar primary keys
  7. Explain what each of the following SQL commands do:
  • insert - use INSERT INTO command to add new data into an SQL database
  • select - the basic starting block for queries that reads info out of an SQL database
  • where - the where clause allows us to filter info for rows that we're interested in
  • order by - allows us to order results by a column or columns
  • inner join - joins two tables using matching values (like an id) from each table

PG Exercises

  1. How can you limit which columns you select from a table?
    Use a FROM statement
  2. How can you limit which rows you select from a table?
    A WHERE clause allows us to select from rows we're interested in using conditions
  3. How can you give a selected column a different name in your output?
    Using the AS clause will give your column a different name in the output
  4. How can you sort your output from a SQL statement?
    ORDER BY statement will order your output by a column or multiple columns
  5. What is joining? When do you need to join?
    Joining allows you to combine related info from multiple tables to answer a question.
  6. What is an aggregate function?
    An aggregate function allows you to do mathematical calculations using AVG, SUM, COUNT, MAX, MIN, etc.
  7. List three aggregate functions and what they do.
    AVG - averages values in selected columns
    SUM - gets total of all values in selected columns
    MAX - finds the highest value in selected columns
  8. What does the group statement do?
    The GROUP statement groups batches of data together by similar info. For example, in basketball positions, you could group player info by Guard, Forward, and Center
  9. How does the group statement relate to aggregates?
    The group statement allows you to use aggregate functions in separate groups. Using the example above, you could count how many players play at each position.

Rack Tutorial

Copy and Pase the link to your deployed application here:

  1. What is HTTP?
    HTTP stands for Hypertext Transfer Protocol and is used to transfer information over the internet. It formats and sends information requests from browser to server and receives information responses from server back to the browser.
  2. What is an HTTP Method (also known as an HTTP Verb)?
    An HTTP method are presets of methods used by developers to route client requests.
  3. What is an HTTP request?
    An HTTP request is when the browser sends info to the server. For example, a hyperlink clicked on a webpage would create a request to get info from the server to load that page.
  4. Describe the three parts of the HTTP request line.
    The HTTP request line starts with a method like GET and then gives a URL for the specific web page and finally ends with the HTTP version
  5. Describe the HTTP request headers.
    HTTP request headers give information about the browser to the server
  6. Describe the HTTP request body.
    The HTTP request body is optional but can include a message in text to be included along with the HTTP request
  7. What is an HTTP response?
    An HTTP response is similar to the HTTP request except it is when the server sends a response back to the browser.
  8. Describe the three parts of the HTTP status line.
    Similar to the request line, but unlike the request line, the status line starts off with the HTTP version, then gives a status code (ex: 404), and finally ends with a reason for the status code (ex: page not found).
  9. Describe the HTTP response headers.
    The response header gives information about the server data that is unrelated to the message.
  10. Describe the HTTP response body.
    The response body includes the information data requested (HTML, CSS, JavaScript)
  11. What is a Web Framework?
    Web Framework is software used to develop applications for the Web. In our case, we use a program like Ruby on Rails to use Ruby to serve applications on the Web.
  12. What is a status code?
    A status code is in the status line of an HTTP response and indicates the status of the HTTP request whether it is completed or an inidication of why it was not.
  13. What does it mean to deploy your application?
    To deploy an application is to send it out to the web or whatever domain it belongs in.

Rails Tutorial: Task Manager

Copy and Pase the link to your repo here:

  1. Define CRUD.
    (Create-Read-Update-Delete) CRUD is the acronym for functionality and is the basic outline for storing objects.
  2. Define MVC.
    (Model-View-Controller) MVC separates the application into model(handles data), view(handles graphical user interface and presentation), and controller(handles user interface and application)
  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.
    The three files you would need would be an MVC application, routes.rb, and a database file.
  4. What are params? Where do they come from?
    Params come from the user's HTTP request. They are a set of key-value pairs that are most often found in URLs after the .com. For example: www.yahoo.com/?dog=sparky dog is the key and sparky is the value.
  5. Check out your routes. Why do we need two routes each for creating a new Task and editing an existing Task?
    You need two routes so that one can create a task and the other can edit the task. Each created route performs a different task from my understanding.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment