To Lecture Notes

IT 231 -- 7/18/12

 

Review Questions

  1. What is a Command Prompt Window and why would you want to use it? How do you invoke it?
    Ans: The black window in which you can enter DOS commands and Rails commands to create a Rails project. You invoke it with Start >> All Programs >> Accessories >> Command Prompt. P. S. You can change the background color of the window if you wish.
     
  2. What is the Windows Explorer and why would you want to use it? How do you invoke it?
    Ans: An application that allows you to find files, and delete, rename, and move them. It also allows you to delete, rename, and move folders (also called directories).
     
  3. Why should you set your Windows Explorer to show file extensions?
    Ans: If it does not show file extensions, you cannot change the file extension, or you might think that the file extension is different than it actually is.
     
  4. What is Lorem Ipsum text?
    Ans: It is dummy text, which is randomly generated fake Latin text used for testing out page layouts and styles where you don't want the reader to be distracted by the content.
     
  5. What would you write in your XHTML source code file to get the browser to literally display this tag?
  6. Show HTML source code to literally display the answer to Question 1.
    Ans: <html>
     
  7. How is a non-breaking space different than an ordinary space in HTML?
    Ans: All but one ordinary spaces between are eliminated between words by the browser. Non-breaking spaces are not eliminated by the browser. Words with ordinary spaces between them can be split across lines. Words connected by a non-breaking space cannot be split across lines.
     
  8. List four things that are wrong with this XHTML tag: Ans: (1) IMG should be lower case, (2) SRC should be lower case, (3) myphoto.jpg should be in double quotes, (4) the tag should be a combination start-end tag, ending in / >. The corrected tag is:
  9. What is the difference between an HTML attribute and a CSS property?
    Ans: An attribute is placed within an HTML tag to modify the tag. A property is a CSS style that is applied to an HTML item or class. Each property is seperated from its value with a colon ( : ). The property/value pairs are separated from each other with semicolons (;).
     
  10. What are the delimiters for a comment in these languages?
     

    Ans:
  11. Explain the difference between static and dynamic webpages.
    Ans: A static web page does not change its content after it is displayed. A dynamic Web page can change its content depending on input from the user or other information (such as the time of day clock).
     
  12. What is the difference between a view and a layout in Ruby on Rails?
    Ans: The view is the content of the page that is normally between the body tags. The layout is everything else on the HTML page.
     
  13. What are the Command Prompt DOS commands that do the following? Also give the corresponding Unix commands for Mac.  
    1. Delete a file.
    2. Create a new folder.
    3. List all files in a folder.
    4. Change to the parent folder.
    5. Change to a child folder.
    6. Change to the root folder on the current drive.
    7. Change to a different drive.
    8. Show the contents of a file on the screen.

    Action DOS Mac Unix
    Delete File del rm
    Create Folder mkdir mkdir
    List Files in Folder dir ls
    Move to Parent Folder cd .. cd ..
    Move to Child Folder cd folder-name cd folder-name
    Move to Root Folder cd \ cd /
    Change to Different Drive f: cd /Volumes/f
    Show File Contents on Screen type cat
    Delete File del rm

  14. List some of the folders created for a Rails project.
    Ans: Folders that we have used so far are app/controllers, app/views, app/assets. Here is a list of Rails folders.
     
  15. What are the views? Where are they located?
    Ans: Views are HTML pages that are generated by Rails. A view is created by combining an .erb Rails view with a layout to produce the generated page.
     
  16. Where should images and CSS stylesheets be placed in a Rails project?
    Ans: In app/assets/images and app/assets/stylesheets, respectively.
     
  17. What is the file extension for view and layout files?
    Ans: .html.erb, where erb is Embedded Ruby.
     
  18. What is WEBrick? What is its biggest disadvantage?
    Ans: A localhost server for Rails.
     
  19. List the steps for creating a Rails project.
    Ans: See the Directions for Project 1.
     
  20. Create a Rails project named Library (Example 7). Write a batch file that contains the rails command for generating a controller named Info and views named index, staff, and policies. See the next section entitled "Adding View and Controller Functionality" to help you out.
     
    Note: The version that we created in class on Wednesday, July 18, was the essentially the same as the version created on Monday, July 16, except for these differences:
     

 

Adding View and Controller Functionality

 

The Anatomy of a Rails URL

 

Embedded Ruby and Some Helper Functions

 

Project 1

 

Submitting Projects

 

Alternative Forms for Helper Methods

  1. image_tag method
    Reference: api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html
     
  2. stylesheet_link_tag method
    Reference: api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html
     
  3. link_to method
    Reference: api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html

 

Datatypes used by the Rails Scaffolding

 

Names Created by Rails Scaffold Software

 

Routing

 

Project 2