Skip to content

Instantly share code, notes, and snippets.

@CoryBethune
Forked from mikedao/b2_intermission_work.md
Last active March 19, 2022 22:17
Show Gist options
  • Select an option

  • Save CoryBethune/987b63b7f30bad8ea516a9bf37e3dd8a to your computer and use it in GitHub Desktop.

Select an option

Save CoryBethune/987b63b7f30bad8ea516a9bf37e3dd8a to your computer and use it in GitHub Desktop.
B2 Intermission Work Submission

B2 Intermission Work

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

HTML

  1. What is HTML? HyperText Markup Language - allows users to create and structure sections, paragraphs, and links using elements, tags, and attributes.

  2. What is an HTML element? The HTML element is everything from the start tag to the end tag and the content inbetween them.

  3. What is an HTML attribute? Attributes have information about an HTML element and they come in name/value pairs.

  4. What is the difference between a class and an id? When would you use one vs. the other? IDs are used to identify only a single element for styling, whereas a class can identify multiple elements at the same time.

  5. What HTML would you write to create a form for a new dog with a "name" and an "age"?

  <form>
    <label for="name">Name:</label><br>
    <input type="text" id="name" name="name"><br><br>
    <label for="age">Age:</label><br>
    <input type="text" id="age" name="age">
  </form>
  1. What are semantic tags? When would you use them over a div? These are tags that describe what their content should contain. Non semantic tags like div are used generally, semantic tags are used to be more specific. Semantic tags have their own attributes for their structure whereas non semantic tags will need to utilize classes for this structure.

  2. Explain what each of the following HTML tags do and when you would use them:

  • <h1>, <h2>, etc. These are heading tags and are used to identify headers in an HTML document. Should be applied to things like titles or any kind of heading in the document.

  • <p> Paragraphy tag. Used when you want to create a block of text in an HTML document.

  • <body> Body tag. Denotes the portion of the HTML document that will be shown to the user. The visible part.

  • <a> and the href attribute The hyperlink tag. Used to create a link to another webpage. Href is an attribute that indicates the location for the hyperlink.

  • <img> and the src attribute Image tag. Used to denote the space that will be filled with an image. The src attribute specifies the path to the image file to be used.

  • <div> The division tag. Used to define a section of the document. Is a block level element.

  • <section> Used to define a section of the HTML document. Should be used when all the content in the section have logically connected content.

  • <ul>, <ol>, and <li> Unordered list, ordered list, and the line tags respectively. Use ul for a list with bullets, ol for a list with numbers, and li is used in both elements to indicate a new line of the list.

  • <form> Used to create a form in the HTML document that will gather input from the user. Form acts like a container for many different input elements.

  • <input> An element used between form tags. Used to display different outputs to the user for them to interact with.

CSS

  1. What is CSS? Cascading Style Sheets. Used to describe how HTML elements are to be displayed to the user.

  2. What is a CSS selector? How do you use the ID selector? The class selector? Selectors are used in CSS to identify HTML elements that will then have CSS styling applied to it. To use the id selector you would use this syntax '#idnamehere {css styling in here}'. To use the class selector you would use this syntax '.classnamehere {css styling in here}'.

  3. What are the three ways to include CSS in your HTML documents? What are the pros and cons of each? Internal, external, and incline CSS. External css is applied to the entire document. Internal css is applied to only one page of the entire HTML document. Inline css is a unique style for a single element and will supersede the stylings of all other CSS. The styling of external and internal can both be applied to the same page, but the styling of whichever is read last will take precedence over whichever type was read first.

  4. What is the Box Model? Describe each component of the Box Model. The box model describes how around each HTML element there is a 'box' defined by height and length values and contains margins, borders, padding, and the actual content. The content is a box of text or maybe an image that the padding, boarder, and margins form around respectivly.

SQL

Jumpstart Lab Tutorial

  1. What is a database? A repository for data. Typically much larger then the hard drive of a personal computer. Databases store, fetch, calculate, and sort data.

  2. What is SQL? A programming language to help programmers efficiently interface with databases. Can be used to search existing tables, add data, and modify data.

  3. What is SQLite3? A database engine that is in wide use today. Used to create lightweight databases on your computer that does not require a seperate server process and allows access to the database. Good for websites that have a small to medium amount of daily volume.

  4. What is a Table? A collection of data that is sectioned into columns and rows with headers and line IDs. Rows represent a unique record and columns are fields specific for the record.

  5. What is a primary key? It is a constraint that identifies each unique record of the database and ascribes an ID to each record. No ID can repeat.

  6. What is a foreign key? A contraint that allows for a forced connection between tables.

  7. Explain what each of the following SQL commands do:

  • insert Allows for adding data to a table.

  • select Allows for retrevial of data from a table.

  • where Acts as a limiter to your search querie. Returns the rows that evaluate as true to the conditional implemented by the where command.

  • order by A clause used to determine the read order of the table. Can order data alphabetically for example.

  • inner join A clause used to combine columns of data from different tables that have correlating data.

PG Exercises

  1. How can you limit which columns you select from a table? SELECT column_name_here, column_name_here, etc FROM table_name_here;

  2. How can you limit which rows you select from a table? Use the WHERE limiter in conjunction with your SELECT query.

  3. How can you give a selected column a different name in your output? Utilize an AS statement.

  4. How can you sort your output from a SQL statement? Call DISTINCT to remove duplicates and you use ORDER BY to sort a column in ascending order.

  5. What is joining? When do you need to join? Joining allows us to temporarily combine rows from multiple tables based on related columns between the tables. Use when you need to cross reference data across multiple tables.

  6. What is an aggregate function? A function that preforms a calculation on multiple values and returns a single value.

  7. List three aggregate functions and what they do. max() retrieves the highest value from the column of data. count() adds up the amount of rows in a table or column. avg() averages the values in a group.

  8. What does the group statement do? Arranges identical data into groups.

  9. How does the group statement relate to aggregates? Group is used before an aggregate is called to group data together.

Rails Tutorial: Task Manager

Copy and Paste the link to your Task Manager repo here: https://github.com/CoryBethune/task_manager_rails Copy and Paste the link to your Static Challenge here: https://github.com/CoryBethune/static_challenges

  1. Define CRUD. Create Read Update Delete

  2. Define MVC. The model view controller is an architectural framework commonly used in the development of applications.

  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. Modify the routes.rb file in config. Create a controller file in the controllers directory that defines a class with inheretance and an index method. Create an index file in a sub directory of the views directory that is named after our controller file. Our index file will need to have some html inside.

  4. What are params? Where do they come from? I think we create the params in the html.erb file and they are populated with the input from the form we created. I think. They are objects we can use and they store data in a hash. They process inputs and outputs.

  5. Check out your routes. Why do we need two routes each for creating a new Task and editing an existing Task? I think it's because HTML forms only allow get and post requests. If we want to update/edit and existing task we need to create a route for the editing to occur.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment