Skip to content

Instantly share code, notes, and snippets.

@nlj77
Last active July 2, 2022 21:43
Show Gist options
  • Save nlj77/2bdffbad22158e469298a123858ef04f to your computer and use it in GitHub Desktop.
Save nlj77/2bdffbad22158e469298a123858ef04f to your computer and use it in GitHub Desktop.
Nick JonesB2 Intermission Work

B2 Intermission Work

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

HTML

  1. What is HTML?

HTML (Hypertext Markup Language) is a system for displaying documents in a webbrowser. It includes the ability to control fonts, colors, graphics, and hyperlink effects.

  1. What is an HTML element?

The HTML element is everything from the start tag to the end tag. It can be a title, a heading, subtitle, paragraph of text, etc.

  1. What is an HTML attribute?

HTML attributes provide additional information about elements. for example href specifies a url of the page the link goes to, and the src attribute refers to a path ofan image being displayed. The style attribute can be used to modify color, size, and font of a element.

  1. What is the difference between a class and an id? When would you use one vs. the other?

Classes are used when one or more elements need to have a particular style or set of attributes applied to it. ID is only used on one unique element. Say for example if you want to have multiple elements about cities then you'd use a class attribute for city, so you can use CSS stylings and javascript on all elements with the city class attribute. If you only wanted to target a specific city, you could apply Paris for example, with a unique ID.

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

" <fieldset>" "<legend>New Dog:</legend>" "<label for="fname" name:</label><br>" "<input type="text" id="name" name="name" value="Sparky"><br>" "<label for="lname">Age:</label><br>" "<input type="number" step="1" pattern="\d+" id="age" name="age" value= 7 ><br><br>" "<input type="submit" value="Submit">" "</fieldset>"

  1. What are semantic tags? When would you use them over a div?

Semantic tags inform the browser and developer about their content; Examples of semantic elements: <form>, <table>, and <article>. Using semantic elements instead of a 'div' helps machine learning tools understand the content of a website.

  1. Explain what each of the following HTML tags do and when you would use them:
  • <h1>, <h2>, etc. These represent the main sections of a webdocument. There should usually only be one <h1> but <h2> is pretty common for each 'point' of the page of the document. Helps with dividing up a document.

  • <p> Represents the start of a paragraph of text, closed with </p>.

  • <body>The <body> element contains all the contents of an HTML document, such as headings, paragraphs, images, hyperlinks, tables, lists, etc.

  • <a> and the href attribute <a> represents a hyperlink and the href attribute indicates the link's destination.

  • <img> and the src attribute <img> represents an image and the src attribute represents the file path/source.

  • <div> A non semantic division or section in an HTML document that can be styled with CSS.

  • <section> A semantic division or section in an HTML document.

  • <ul>, <ol>, and <li> <ul> is an unordered list, usually bulleted. <ol> is a numbered list. <li> is an item in a list and it must be contained in an unordered list or a numbered list.

  • <form> Used to collect user input. Can contain text fields, checkboxes, and buttons.

  • <input> Used to create an interactive control to accept data from the user. Types of <input> include buttons, text, checkboxes, date, and files.

CSS

  1. What is CSS?

Cascading Style Sheets is a style sheet language used for describing the presentation of a document written in a markup language such as HTML or XML.

  1. What is a CSS selector? How do you use the ID selector? The class selector?

CSS selectors are used to "find" (or select) the HTML elements you want to style. To select an element with a specific id, write a hash (#) character, followed by the id of the element. To select elements with a specific class, write a period (.) character, followed by the class name.

  1. What are the three ways to include CSS in your HTML documents? What are the pros and cons of each?

    Inline - by using the style attribute inside HTML elements

    Internal - by using a <style> element in the <head> section

    External - by using a <link> element to link to an external CSS file

    Inline is simple to deploy but only applies it's styling to a single HTML element.

    Internal lets you define the style for an entire page, but it's only the one page.

    External allows you to define the style sheet for many pages but you need to provide an link to a made style sheet.

  2. What is the Box Model? Describe each component of the Box Model.

Margin - Clears an area outside the border. The margin is transparent > Border - A border that goes around the padding and content > Padding - Clears an area around the content. The padding is transparent > Content - The content of the box, where text and images appear.

SQL

Jumpstart Lab Tutorial

  1. What is a database?

    Databases are at the core of almost every web application. They are our means of storing, fetching, calculating, and sorting data.

  2. What is SQL?

Structured Query Language is how we interact with most databases; We can create, modify, and delete tables, find data inside tables, insert new data, or change what data is there. We can change our queries to speciify certain criteria.

  1. What is SQLite3?

    SQLite stores its data in a plain-text file. This makes it incredibly easy to move, rename, delete, or transfer the database.

  2. What is a Table?

    database objects that contain all the data in a database.

  3. What is a primary key?

    The PRIMARY KEY constraint uniquely identifies each record in a table. Primary keys must contain UNIQUE values, and cannot contain NULL values. A table can have only ONE primary key; and in the table, this primary key can consist of single or multiple columns (fields).

  4. What is a foreign key?

The FOREIGN KEY constraint is used to prevent actions that would destroy links between tables. A FOREIGN KEY is a field (or collection of fields) in one table, that refers to the PRIMARY KEY in another table. The table with the foreign key is called the child table, and the table with the primary key is called the referenced or parent table.

  1. Explain what each of the following SQL commands do:
  • INSERT INTO - inserts new data into a database

  • select extracts data from a database.

  • where The WHERE clause is used to limit the number of rows returned.

  • order by ORDER BY gives us a way to sort the result set by one or more of the items in the SELECT section.

  • inner join JOIN, also called Inner Join, selects records that have matching values in two tables.

PG Exercises

  1. How can you limit which columns you select from a table? select column_a, column_b from table_a
  2. How can you limit which rows you select from a table? select * from table_a where column_a_value > 0;
  3. How can you give a selected column a different name in your output? postgres=# SELECT ename enm, empno AS eid FROM employees;
  4. How can you sort your output from a SQL statement? SELECT * FROM table_name ORDER BY column_name ASC|DESC
  5. What is joining? When do you need to join? Joining is used when you want to compare data from two or more tables. A JOIN clause is used to combine rows from two or more tables, based on a related column between them.
  6. What is an aggregate function? Aggragate functions extract information from whole rows.
  7. List three aggregate functions and what they do. Max() finds the largest value in a column of numerical data. AVG() finds the average value of a set of numerical values in a column. SUM adds together all the values in a particular column.
  8. What does the group statement do? The GROUP BY statement groups rows that have the same values into summary rows, like "find the number of customers in each country".
  9. How does the group statement relate to aggregates? The GROUP BY statement is often used with aggregate functions (COUNT(), MAX(), MIN(), SUM(), AVG()) to group the result-set by one or more columns.

Rails Tutorial: Task Manager

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

  1. Define CRUD. Create Read Update Delete.

  2. Define MVC. Model-View-Controller, (MVC) is an architectural pattern that separates an application into three main logical components: the model, the view, and the controller. Each of these components are built to handle specific development aspects of an 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. A controller, an index in that controller, and an html file with that index.

  4. What are params? Where do they come from? params refers to the parameters being passed to the controller via a GET or POST request.

  5. Check out your routes. Why do we need two routes each for creating a new Task and editing an existing Task? Because creating a new task and editing an existing tasks are different actions, and one extra route is required to fetch down the existing task.

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