Notes From Class
Week 1: January 25 and 27, 2006
-
If you do not have a Glue computer account, please get one.
See the FAQ's for step-by-step instructions.
-
I have put your picture on the meet the class page.
If you have any objections (e.g., the mug shot isn't up to
your usual GQ/Vogue standards), please let me know.
-
If you can't find Austin/Chancogne at the local bookstore,
you can buy it online.
For a list of online bookstores and prices, see
BookHQ.
Week 2: January 30, February 1 and 3, 2006
-
Handouts on getting started with UNIX, HTML and the Web
are now available a the Engineering Copy Center. The cost is $20.00.
-
The Global Reach Organization reports on
Internet Statistics
by language. As of 2004, there are 803 million users on the Internet.
But here's the surprise, only 287 million of them are English speaking.
There are approximately 35 million domain names
and 171 million host computers.
-
Reading
Please read chapters 1 and 2 of Austin/Chancogne. Although some of
the numbers are now five years old, the underlying story remains the same.
Week 3: February 6, 8 and 10, 2006
-
You can test the speed of your internet connection with
http://www.dslreports.com/stest .
-
It you want to download a ssh client to your windows machine,
The office of information technology (OIT) recommends
TeraTerm ,
which is ssh (secure shell) for Windows.
-
OIT has created a new service
SSH Gateway on the Web .
-
Here is a link to the
Putty telnet and ssh client program.
Note. It seems that Putty cannot traverse firewalls.
So you make need to add "Putty" as an exemption to your list of
programs that can bypass the firewall on your computer. On Windows XP,
see the security folder inside the control panel.
-
At home I use TurboFTP to transfer files/directories to/from school.
TurboFTP has a very friendly graphical user interface
that shows both the windows and unix files systems.
You can download a trial version
from http://www.tucows.com .
Week 4: February 13, 15 and 17, 2006
-
If you have downloaded an FTP program to your PC/laptop at home,
you'll may need the IP addresses for wam and
glue to insert into the (ftp program) site manager.
The IP addresses are as follows:
Site IP addresses
--------------------------------------------------
wam.umd.edu 128.8.10.141
128.8.10.142
128.8.10.143
glue.umd.edu 128.8.10.68
128.8.10.71
--------------------------------------------------
-
Here are a few basic UNIX commands:
Unix Commands
--------------------------------------------------------------------------------
1. cd <-- change to home directory
2. cd file1 <-- change to directory file1
3. ls and ls -ls and ls -tl <-- list contents of a directory
4. mkdir file1 <-- make a directory called file1
5. rmdir file1 <-- remove directory file1
6. cp file1 file2 <-- copy file1 to file2
7. mv file1 file2 <-- move file1 to file2
--------------------------------------------------------------------------------
Text editor commands
--------------------------------------------------------------------------------
1. vi filename <-- use vi editor to change contents of filename.
For example, the command sequence:
prompt >> cd ../pub
prompt >> vi Welcome.html
prompt >> vi resume.html
prompt >> vi australia.html
moves your shell to the public directory and then systemantically creates the
HTML files for your home page, resume and trip page. Notice that each file
name has the "html" extension -- web browsers need this information.
The class reader contains a list of basic editor commands.
--------------------------------------------------------------------------------
-
On Friday I will demo the vi editor in class ... we will also begin working
on a simple web page.
-
Reading.
You should read the "Beginners Guide to HTML,"
which is in the class reader.
-
Homework 1 is available.
Due date is 9am, Feb. 24, 2006.
Week 5: February 20, 22 and 24, 2006
-
Click here
to see the small html web page developed in class...
-
Reading.
Please read Chapter 2 of Austin/Chancogne, in particular, the section
on computer programming language concepts.
-
If you want to do your Java Programming on your laptop,
I suggest that you download and install Eclipse.
Instructions may be found on the
Internet Resources page.
Week 6: February 27. March 1 and 3, 2006
-
The goals of html are to present content on the web -- html does
not try to understand the content that is being displayed.
The eXtensible markup language (XML) provides a means to represented
user-defined data on the web and understand its meaning.
What that in mind, here is a link to a tutorial on
to knowledge markup techniques.
-
I will be on travel from mid-day Wednesday till late Thursday evening.
Week 8: March 13, 15 and 17, 2006
-
Midterm 1 (25%): March 15. Closed book.
The midterm will cover Chapters 1 and 2 of the class text,
introduction to object-oriented programming concepts and Java,
and anything that was written on the
board during the first seven weeks of class.
-
Reading
An overview of the Java buzzwords can be found in Chapter 16 of Austin/Chancogne.
Please also read the material in Chapter 17 on object-oriented program design.
Week 9: SPRING BREAK ....
Week 10: March 27, 29 and 31, 2006
-
On Monday we will start working on the Java Language ....
-
Homework 2 is available.
Due date is 9am, April 5, 2006.
-
Reading
On Wednesday we will cover:
(1) Java's primitive data types, and
(2) Procedures for setting up variables in Java.
Please read sections 18.4 and 18.5 of Austin/Chancogne.
Integers and floating point numbers are stored according to
the IEEE 754 Standard for floating point arithmetic.
The storage mechanism for single and double precision floating
point numbers is as described in Section 4.4.
Week 11: April 3, 5 and 7, 2006
-
On Monday we will finish coverage of the basic data types
and start relational and logical expressions and control structures.
-
Reading
Please read Section 18.7 of Austin/Chancogne.
-
On Friday I will hand back the midterm 1 papers.
Week 12: April 10, 12 and 14, 2006
-
Homework 3 is available.
Due date is 9am, April 14, 2006.
Hints
-
Problem 3.11
There are two hurdles in the chessboard problem.
As explained in the problem definition, the first
cell contains 1c, the second 2c, the third, 4c and so forth.
By the time you get to the 64th cell, the quantity of money
is so large it won't fit in an integer.
My suggestion is to just get the program to work for
small chessboards, up to say 4x4, and then just compute
and print the sum of money that would be on an 8x8 board.
I am thinking that a good implementation will contain two loops:
An outer loop will walk along the rows of the chess board.
An inner loop will walk along the columns within each row.
A schematic of code might look something like:
for (i = 1; i <= iSize; i = i + 1)
for (j = 1; j <= iSize; j = j + 1) {
// Compute and print value of money on board.
......
}
}
Here the variables "i" and "j" represent the row and column
number on the chessboard.
-
The quantities on each cell need to be printed in a tidy format.
As explained in class, if you are using Java 1.4 (or an earlier
version) support for fomatting of numbers is poor. To help you
out, I have created two functions:
static String doubleToString( double val, int n, int w) { ....
... grab all of this code ....
}
static String integerToString( int val, int w) {
... grab all of this code ....
}
You can cut and paste the source code from
on the TidyTable.java
java examples web page.
If you are using Java 1.5, then formatted integers and floating
point values can be printed with statements of the type:
System.out.printf("%12d", iValue );
System.out.printf("%12.3f", fSum );
The first line prints integer iValue in a format that is 12 characters wide.
The second line prints floating point number,
fSum, 12 characters wide and to three digits of accuracy.
See pg 315 of Austin/Chancogne for examples of the various
formatting options.
-
Problems 3.14 and 3.17
Someone in class asked a very sensible question -- how do we show the
series approach a given value. For problem 3.14 I would create a
simple table, perhaps something like:
Homework 3.14
No Terms Summation
=======================================
1 0.5
2 0.67
3 .....
.... .....
=======================================
with a sufficient number of terms to show the summation approaches 1.
This approach is impractical for 3.17 because
the series approaches pi/4 much slower.
Hence, I would just summarize the results and explained in the
problem definition.
-
On Wednesday we will cover arrays, which you will need for homework 3.
An overview of arrays in Java can be found in Section 18.10 of Austin/Chancogne.
-
On Friday we will cover the syntax and usage of classes and methods.
We will cover the FoldedBox example in detail (see pg's 210-215 in the yellow reader).
Week 13: April 17, 19 and 21, 2006
-
Midterm 2 (25%): April 21. Open book.
The exam will cover principles of object-oriented software
development and the basics of Java programming.
Week 14: April 24, 26, and 28, 2006
-
Homework 4 is available.
Due date is 9am, May 1, 2006. The second and third questions
build on answers to the first, so don't leave this assignment
till the last minute only to find out you can't do question 1.
-
Now that we know how to create objects,
the next thing to think about is their organization. How, for example, do you
organize large numbers of objects so that things are easy to find and modify?
A collection
is an object that groups multiple elements into a single unit.
Units include:
-
Sets.
A set is a collection that cannot contain duplicate elements.
-
Lists.
An ordered collection (sometimes called a sequence).
Lists can contain duplicate elements.
The user of a List generally has precise control over
where in the list each element is inserted and can
access elements by their integer index (position).
-
Queues.
Queues typically order elements in a FIFO (first-in-first-out) manner.
-
Maps.
An object that maps keys to values.
A Map cannot contain duplicate keys.
Each key can map to at most one value.
-
SortedSet
A Set that maintains its elements in ascending order.
Several additional operations are provided to take
advantage of the ordering.
Sorted sets are used for naturally ordered sets,
such as word lists and membership rolls.
-
SortedMap
A Map that maintains its mappings in ascending key order.
This is the Map analog of SortedSet.
Sorted maps are used for naturally ordered collections of key/value pairs,
such as dictionaries and telephone directories.
Collections are used to store, retrieve, manipulate, and communicate aggregate data.
Typically, they represent data items that form a natural group (e.g., the
group of blocks in our block tower).
-
Here are the essential details of the arraylist covered in class:
/**
* ==============================================================
* ArrayTest3.java: Demo ArrayList Example in Handout...
*
* Written by: Mark Austin April 2006
* ==============================================================
*/
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class ArrayTest3 {
public static void main( String args[] ) {
// Create and print a simple array of strings .....
List stringList = new ArrayList();
stringList.add("A");
stringList.add("Red");
stringList.add("Indian");
stringList.add("Thought");
stringList.add("He");
stringList.add("Might");
stringList.add("Eat");
stringList.add("Toffee");
stringList.add("In");
stringList.add("Church");
System.out.println("Use for loop to walk along list" );
System.out.println("=================================" );
for ( int i = 0; i < stringList.size(); i = i + 1 )
System.out.println("Name = " + stringList.get(i) );
System.out.println("Use Iterator to walk along list" );
System.out.println("=================================" );
Iterator iterator1 = stringList.iterator();
while ( iterator1.hasNext() != false ) {
String s = (String) iterator1.next();
System.out.println("Name = " + s );
}
}
}
Week 15: May 1, 3, and 5, 2006
-
Here is an interesting
traffic simulation.
-
Graph data structures can be used to model and incredibly
wide range of engineering applications (e.g., transportation networks).
Click here
for a nice introduction.
-
Homework 5 is available.
Due date is 9am, May 10, 2006. This is the last day of class ...
so the homework due date is a hard deadline.
Note. This assignment is mainly about gathering code from
various locations and putting it into a new MetroSystem.java file.
Check back in a day or so --- I will add hints on where to look
for the various pieces of code that you'll need.
-
Our metro system is really only a basic implementation. Extensions
include detailed modeling of trains (engine + wagons) and tracks,
train schedules, and control strategies for collision avoidance.
See, for example, the
FreeRails software .
Week 16: May 8, and 10, 2006
-
May 10. Class Review -- I will give you pointers
for studying for the final exam.
Developed in January 2006 by Mark Austin
Copyright © 2006, Department of Civil and Environmental Engineering,
University of Maryland