Skip to content

Instantly share code, notes, and snippets.

@nikkyrojas
Last active July 2, 2022 06:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikkyrojas/6118640ef0ad8511953b81e26e007a0b to your computer and use it in GitHub Desktop.
Save nikkyrojas/6118640ef0ad8511953b81e26e007a0b to your computer and use it in GitHub Desktop.
Mod 2 intermission work Nikky R

MOD2 Intermission Work

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

HTML

  1. What is HTML?
  • HTML is hypertext markeup language. Html is a text file that contains instructions for computer/server to display contents in a specific format/structure. You can click on link on a webpage that will be displayed in a specific format.
  1. What is an HTML element?
  • An element is the HTML tag and the content that is inside(inbetween the openings and closing tag) if it has a closing tag.
  1. What is an HTML attribute?
  • An attribute describes how an element should be displayed. for ex. src attribute provides a path to retrieve contents to be displayed like a photo. Class is also an attribute which allows you to use that element multiple times.
  1. What is the difference between a class and an id? When would you use one vs. the other?
  • An id is used when you have a single element that would be used once. For example a title on a web page will only be used once because there is only one title. A class would be used when you want to use multiple ekements that do the same thing/are apart of the same group. For ex. if you wanted to create 3 boxes on the web page this would be a class since it would be 3 elements but all are the same group which is a box.
  1. What HTML would you write to create a form for a new dog with a "name" and an "age"?
  • Im not sure what the question is asking. HTML 5? I would create doctype html with a form asking for Dog name and Dog age input and probably a button to submit. Use div to space the input boxes.
  1. What are semantic tags? When would you use them over a div? -Semantic elements clearly define their purpose. For ex <table> would obviously be a table it clearly point out what the contents of this tag will be which div does not. Semantic elements can make it easier to interpret.

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

  • <h1>, <h2>, etc. -These are heading tags you wouuld use these for headings. If you want sub heading or smaller heading you will increase the numerical value. H1 would be larger than h2. H2 would be larger than h3.

  • <p> -This is a paragraph tag. You would use this to write information. For example after the heading you could use the

    tag to write information regarding what was specified in the corresponding heading.

  • <body> -What ever is inserted in this body tag is what will be displayed on the web page. For example you heading tag and paragraph tag would be in the body tag.

  • <a> and the href attribute -the tag is used to define a hyperlink. the href attribute defines the location of the link.

  • <img> and the src attribute -this tag is used for image while the src attribute is where you will place the url to retrieve that image

  • <div> -this tag is used to divide code into sections/ group things togeather. For example a section with links.

  • <section> -this tag is similar to div but mores specific. it allows you to group togeather content into sections but everything in the section is relevant. For example if you had a headers then an image or body of text that describes that header a section tag would be used as oppose to div you can group togeather.

  • <ul>, <ol>, and <li> -for an ordered list you will use <ol> tag. The child tag to this is <li>. For a list that is not ordered for example just bullets you will use <ul> tag and the child tag to this would also be <li>.

  • <form> -a form tag is used to wrap around input from a user. a form can give information to servers

  • <input> -allows you to retrieve input from a user for example a username (text), password, date, or file.

CSS

  1. What is CSS? -CSS is casscading style sheet. It determines colors fonts and positions of elements.(animations)
  2. What is a CSS selector? How do you use the ID selector? The class selector? -A CSS selector is used to identify/select elements on your web page. For a class (which can be multiple elements on your page) you would use a . for example .body. For a ID (which is an element used only once) you would use a #. For example #header. This will only change that one specific element.
  3. What are the three ways to include CSS in your HTML documents? What are the pros and cons of each? -External CSS is one way to insert CSS into HTML documemts. This method requires each page to have a refrence to the externel style sheet. This will change the entire look of the website. Pro is that it changes the entire websit. Con is that it does not set specifics styling to different pages. -Internal CSS is another way to insert CSS into HTML specfically if you want to change a single HTML page. Again this only changes one pgae and not the whole website. Con could be that you would have to set up this internal CSS for each html page. -The last way to insert CSS into HTML doc is Inline CSS which is how you would add styling to a specfic element. Con it is more detail CSS for specfics elements.
  4. What is the Box Model? Describe each component of the Box Model. -The box model is a box that is wraped around each element. The box model contains a content which is usually text/images. Padding which creates an area around the content (readability/user friendly). A border that is wraped around the padding space and then a mrgin that is an area outside the boarder. Each component can be modify (color/size etc).

SQL

Jumpstart Lab Tutorial

  1. What is a database? -database are used to store a variety of data they work in conjusction with a database management system like SQL.
  2. What is SQL? -SQL is structure query language and is used to communicate/ pull /edit/add data (tables) from databases.
  3. What is SQLite3 -sqlite3 stores data in a text file which makes that data easy to move/change/delete. sqllite is used more for local projects
  4. What is a Table?
  • A table is an organized collection of data (databases have tables that SQL pulls data/combines/etc)
  1. What is a primary key?
  • A primary key is a field that is unqiue in a table. For example a table with Id, first name, last name, the primary key would be th id since it is unique and it is possible to have the same first names or same last names.
  1. What is a foreign key? -a foreign key is key that orignated from another table and this key could be the primary key from the other table
  2. Explain what each of the following SQL commands do:
  • insert -the insert command allows you to insert data into a table (one row or multiple rows at a time)
  • select -select command allows you to retrieve data from one table or mulitiple tables(join technique) in a database that in compromised of many tables.
  • where -where command limits the amount of rows that returned based on specfied attributes that match
  • order by -order by command will make sure that the data will be ouputed how you want it to be for example by what was added first (order number) or possibly type of product/product name in alphabetical order.
  • inner join
  • inner join command allows you to combine multiple tables

PG Exercises

  1. How can you limit which columns you select from a table? -select (name of columns seperated by commas) from (clause)

  2. How can you limit which rows you select from a table? -select * from (clause) where (rows with apllicable parameter such as greater than 2 or >2)

  3. How can you give a selected column a different name in your output? -rename column (column name) TO (new name)

  4. How can you sort your output from a SQL statement?

  5. What is joining? When do you need to join? -joing in combing data from two table using a key they have in common.

  6. What is an aggregate function? -aggregare functions performs a calculation on values and returns only one value.

  7. List three aggregate functions and what they do. -count() function will count the amount of items in which ever column specfied. -sum() is similar to count but it sums togeather the numerical values of which ever column/category specified -avg() avergae is similar to the other two how ever it does what both count and sum does and actual perform the calulation of getting the average.

  8. What does the group statement do? . How does the group statement relate to aggregates? -The group by statement groups togeather rows that have the same values. The group by statment is used in conjunction with aggregares like counts and avg to group the results.

Rails Tutorial: Task Manager

** https://github.com/nikkyrojas/Task_Manager **

** https://github.com/nikkyrojas/static_challenges **

  1. Define CRUD. -Create Read update and Delete
  2. Define MVC. -Model view controller. A structure that web applications are build on.
  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. -We would need to update the route file, create a controller file that creates and modifies, and also update the view so that it is displayed properly. The route.rb file, controller file, and views(html)file, and
  4. What are params? Where do they come from? -params is short for parameters this information is displayed as a hash. The data that is recieved is similar to a hash and can be called on by using a symbol. This data was created when we gave user input.
  5. Check out your routes. Why do we need two routes each for creating a new Task and editing an existing Task? -We need two routes each for creating and editing a class because when we create a task we want a route that first takes us to the create action in our task controller and then also a route that will now display the tasks created in the show action also in task controller. Similarly for editing we need a route that performs the diting action and a route that will also update the edited task.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment