To Lecture Notes
IT 231 -- 7/16/12
Are You in the Right Class?
- You are underqualified for IT 231 if
you have no knowledge of HTML, XHTML, or CSS.
you have never programmed before, even in JavaScript.
you have not created HTML pages from scratch.
- You are overqualified for IT 231 if
you have extensive knowledge of a server-side programming
language, such as PHP, ASP, ASP.Net or JSP.
you have taken ECT 353, 310 or 330.
- IT 130 is the official prerequisite of IT 231.
Course Documents
- Announcements, Table of Contents, Professor Information, Syllabus,
Lecture Notes, Documents, Exam Info, Projects, Submit Homework
Course Overview
Review Questions from IT130
- What does the acronymn HTML stand for?
Ans: Hypertext markup language.
- List all the HTML tags that you know.
Ans:
<html>
<head>
<meta>
<title>
<style>
<script>
<link>
<body>
<h1>
<h2>
<h3>
<p>
<span>
<br />
<ol>
<ul>
<li>
<table>
<tr>
<td>
<th>
<a>
<img>
<form>
<input>
- What does XHTML stand for?
Ans: Extensible hypertext markup language. XHTML files are XML complient,
where XML means extensible markup language.
- How does XHTML differ from HTML?
Ans:
- Every start tag requires an end tag.
- Tags must be properly nested.
- Combination start-end tags are allowed, for example <br />
- Tag and attribute names are written in lower case
- Text cannot be placed directly in the body section of the page.
It must be placed within
<p>,
<ol>,
<ul>, or
<table> tags.
- Attribute values are delimited with double quotes.
- Depreciated HTML tags like
<b> and
<i>
are not allowed.
- CSS properties must always have a value, for example
<input type="checkbox" checked="checked" />,
not
<input type="checkbox" checked />.
- A title is always required in the head section.
- Use HTML named colors or hex color codes.
- The following header is used at the top of the document:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- What does CSS mean?
Ans: Cascading style sheets.
- List all the CSS properties that you know.
Ans:
font-family
font-size
font-weight
font-style
color
background-color
text-indent
text-decoration
text-align
vertical-align
border
margin
padding
- Explain the difference between these types of CSS styles:
inline document-level external
Ans:
- An inline style is placed directly in an HTML tag, for example
<p style="text-indent:1cm">
- A document-level style is placed in style tags in the head section of
the document. This style applies to the entire page.
- An external style is placed in a separate .css file. A page can use
this style by referencing it with a link tag.
- List the HTML special symbols that you know. Here is an
HTML Special Symbol Reference Table.
Ans: Some of the most common special symbols are
<
>
&
"
This is the source code for the
Special Symbols Example that we looked at
in class, including the word niña in a huge font.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Special Symbols Example</title>
</head>
<body>
<h2>Special Symbols Example</h2>
<table>
<tr>
<th>HTML Special Symbol</th>
<th>Symbol Displayed in Browser</th>
</tr>
<tr>
<td>&nbsp;</td>
<td> </td>
</tr>
<tr>
<td>&lt;</td>
<td></td>
</tr>
<tr>
<td>&gt;</td>
<td>></td>
</tr>
<tr>
<td>&amp;</td>
<td>&</td>
</tr>
<tr>
<td>&quot;</td>
<td>"</td>
</tr>
</table>
<p style="font-size:1800%; font-weight:bold">
niñ
</p>
</body>
</html>
- What is the difference between server-side processing and
client-side processing.
Ans: Client-side processing means that the browser does all of the
processing. Some client-side scripting languages are JavaScript or
VBScript. AJAX is a client-side technology. Server-side
processing means that the processing is done
on the server and the results sent to the client, or that information
is sent to the server from the client, which is processed, for example,
information is looked up in a database. Some server-side languages are
Ruby on Rails, C# in ASP.Net, Visual Basic in ASP.Net, PHP.
HTML5 Header
<!DOCTYPE html>
Most current browsers do not fully support HTML5, so some sources do
not recommend using this header.
Applying CSS Styles to Web Pages
More about the html Tag
xmlns means XML namespace.
However, all current browsers will render an XHTML file properly
even if its html tag looks like this:
<html>
To define a new namespace named "math", use
xmlns:math="http://www.depaul.edu/~sjost/math"
in the html tag. Then you can use a new tag
<math:div>, which means math division instead
of the normal meaning of div.
The XHTML namespace defined by
xmlns="http://www.w3.org/1999/xhtml"
is the default namespace for the page.
The xml:lang="en" and
lang="en" attributes set the language as
english in both the XML and XHTML namespaces, respectively.
XHTML and XML namespaces are only important if XHTML and other XML
applications are mixed together in the same application.
What are Ruby and Rails?
- Ruby is a general purpose programming language.
- Other popular general purpose programming languages are
Java, C++, C#, Python, and Perl.
- Ruby on Rails (Rails for short) is a server-side web framework for
creating websites.
- The Rails framework contains tools for automatic code generation.
- Other popular server-side web frameworks are
PHP, ASP.Net, Java, ColdFusion, Python/Django.
- Rails server software: WEBrick, Mongrel, Phusion Passenger, mod_ruby.
- We will not post our Rails projects on the internet; we will
view them on localhost (URL = http://localhost:3000).
- To actually post a Rails projects on the internet, we would
move the project to a machine running a server such as Apache (Unix or
Linux) or IIS (Windows).
What You Need to Create Rails Projects
- A Text Editor Some popular text editors are
NotePad TextPad PSPad JEdit
- We will use JEdit for class demonstrations. You can download it for
free from
- Ruby on Rails Software
The textbook has directions for installing Rails software.
See page 16 for Windows, page 14 for Mac. Directions for installing
Rails are also posted on the
Documents Page.
Command Prompt Windows and DOS Commands
Some useful
DOS commands.
The Windows Explorer
Set Windows Explorer to show file extensions. See the
last announcement on the
Announcements Page.
Introduction to Rails
More about Ruby on Rails
- Use the delimiters
<% ... %> or
<%= ... %>
to enclose Ruby statements within an XHTML file.
- When Ruby statements are embedded within an XHTML file
they are called ERB (embedded ruby) statements.
Use
<%= ... %> to enclose an ERB statement
when you want its return value to be placed into the XHTML file.
Use
<% ... %> to enclose an ERB control statement
that does not produce output to the XHTML file.
- Use the Ruby statement
image_tag to embed an image on a web page.
Place the image in the public/images folder.
- Use the statement
stylesheet_link_tag to apply a CSS stylesheet
to a web page.
Place the stylesheet in the public/stylesheets folder.
- Use the statement
link_to to define a hyperlink that jumps to
another web page.
Two Rails Principles
- DRY means Don't Repeat Yourself
- Here are some of the ways that Rails developers can be DRY:
Put CSS styles shared by several views in an external style sheet.
Put HTML code shared by several views in a layout file.
Put forms shared by several views in a separate _form file.
Put Ruby methods that are shared by several controller methods in either
the folder app/models or app/helpers.
- CoC means Convention over Configuration.
- Rails has a sensible default for almost every aspect of the project.
This means that Rails programmers spend very little time on configuration
unless something unusual is needed.
- For example, if a rails project is managing Transaction items,
the database that contans these items is called "transactions".
Project Proj1
Submitting Projects
- To submit a Rails project:
Create a zip file by right clicking on the Rails folder
>> Send To >> Compressed (zipped folder)
- Some sources recommend using the 7-zip for compressing files
instead of Windows Compressed Folders.
- Submit your zipped project on the D2L website
d2l.depaul.edu.