Sunday, May 12, 2013

Practice questions for final exam

I posted some practice questions for the final exam.  We'll talk about these in lecture on Monday.

As a reminder, the final exam is Wednesday, May 15 at 8am.

Monday, May 6, 2013


Here is a link to the in-class demo today, If you are so inclined, try fixing the add(...) method to work for nonzero indices by making it recursive.

Thursday, May 2, 2013

Homework 9 solution

Here is an example solution to homework 9. You can use it however you like in homework 10 without attribution.

Wednesday, May 1, 2013

Homework 10 posted

Homework 10 is up.  It is due on Monday, May 13.

Solutions to homework 9 will be posted soon.

Monday, April 22, 2013

Homework 9, etc.

Homework 9 is up. It is due Wednesday, May 1.

Homework 8 is graded. Marks are in Subversion as usual. I also posted an example solution.

Monday, April 15, 2013

Homework 8 posted

Homework 8 has been posted.  It strongly resembles the second midterm.  We talked about the first question in lecture today.  We'll talk about the second one in lecture on Wednesday.

Marks for homework 7 and midterm 2 are available in Subversion now.

Saturday, April 13, 2013

Optional exercises on numbers

If you have time, I recommend reading chapter 10 of Head First Java, "Numbers Matter," and doing the exercises.

Tuesday, April 9, 2013

Monday, April 1, 2013

Midterm 2

Midterm 2 will be in class on Wednesday, April 10.  It will cover the material covered in all lectures up to April 1 and homeworks 2 to 7.  The best way to prepare for it is to do homework 7.

Saturday, March 30, 2013

Homework 7, etc.

  • Homework 7 has been posted.  It is due Monday, April 8.
  • Homework 6 has been graded.  Marks are in your Subversion directory.  A solution will be posted Monday.
  • Mid-term estimated grades have been sent to the registrar.  They don't count for anything official; they are a way to let you know how you are doing. If you are considering withdrawing from the class, the CAS deadline is Friday, April 5.
  • The course information is inconsistent on the date of the second midterm.  It will be on April 10, not April 15.

Monday, March 25, 2013


If you want to try out Eclipse, here are CSCI 0101-specifc Eclipse instructions.  General documentation is available in many places on the web.  Use a search engine to find instructions on editing, debugging, etc.  Lars Vogel has a good Eclipse tutorial.

Sunday, March 24, 2013

Limited lab hours

This week and next will have limited lab hours.  They will be:

Monday March 25: 10:00am–1:00pm and 4:00pm–7:00pm
Tuesday March 26: 10:30am–3:30pm
Wednesday March 27: none
Thursday March 28: 11:00am–7:30pm (unchanged)
Friday March 29: 2:00pm–6:00pm (unchanged)

Monday April 1: 10:00am–1:00pm and 4:00pm–7:00pm
Tuesday April 2: 10:30am–3:30pm
Wednesday April 3: 2:15pm–4:30pm (unchanged)
Thursday April 4: 11:00am–7:30pm (unchanged)
Friday April 5: 2:00pm–6:00pm (unchanged)

Thursday, March 14, 2013

Homework 6

Homework 6 has been posted. It is due the Friday after Spring break. I also posted a solution to Homework 5.

Tuesday, March 5, 2013

Midterm 1 solutions

Solutions to the first midterm are now available in solutions/midterm1.

Saturday, March 2, 2013

Homework 5

I uploaded Homework 5. It is not due until a week from Monday because it uses material from class we haven't talked about yet. I'll talk more about the assignment in class Monday. In the meantime, I recommend reading chapters 2 and 3 of Head First Java and doing the exercises in those chapters. Having some practice will make the part of the assignment to be turned in much easier.

Monday, February 25, 2013

Review question solution

I uploaded a possible solution to the second midterm review question,

If you're curious, func() in the first question returns the (k+2)th Fibonacci number or -1 when k is not positive, but you don't need to have seen that to work through the loops and get an answer.

Homework 3 solutions

Homework 3 is graded; type “svn update” and look in readonly/marks.txt for your score. I also uploaded an example

Thursday, February 21, 2013

Midterm practice questions

I posted a few practice questions for Wednesday's midterm in Not Homework 4. As a warm-up, try the exercise in §13.6 of the lecture notes.

Wednesday, February 20, 2013

Subversion down again

As of 11:30PM Wednesday, the server that hosts is down again. I've notified the system administrators. Update: As of 11:21PM Thursday, it is up.

Sunday, February 17, 2013

No class Monday

Monday is Presidents' Day. There will be no class.

Homework 2 solutions

I posted solutions to homework 2 in Subversion at More solutions will be uploaded there as the term goes on.

Saturday, February 16, 2013

Homework 2 marks

I've uploaded the marks for homework 2 to Subversion; type "svn update" to pull them down from the repository.  I didn't withhold any tests this time, so they should match the output of and test.ps1.  If you're having trouble running the test scripts or understanding their output, please let me know and I'll try to help.  (If you do, please follow these guidelines for asking questions over email.)

Thursday, February 14, 2013

Asking questions over email

I'm generally happy to answer questions over email.  If you are going to email me, you should include, at least, the answers to these questions:

  • What goal are you trying to accomplish?
  • What did you do?  If you have a Subversion question, send the command.  If you have a Java question, send the source or a location in Subversion.
  • What happened?  What output or errors did you see?
  • What relevant documentation have you read?
  • Are you using a Mac or Windows?  What editor, if it's relevant?
If you answer these questions, I'm much more likely to be able to help you.

(By the way, if you're having trouble copying and pasting in PowerShell, check out the menu in the top left corner of its window.)

Homework 3

Homework 3 is up.  It's due on Feb. 22.

Teaching assistant lab hours

The teaching assistants are holding lab hours at the ITS lab at 14 Washington Place on the lower level every week at these times:

Monday: 10:00am–1:00pm and 2:30pm–7:00pm
Tuesday: 10:30am–6:00pm
Wednesday: 2:15pm–4:30pm
Thursday: 11:00am–7:30pm
Friday: 2:00pm–6:00pm (except Feb. 22)

Monday, February 11, 2013

"svn checkout" versus "svn update"

Some people are confused about the distinction between "svn checkout" and "svn update."

"svn checkout" creates a working copy based on data from the repository where no working copy previously existed.  You only need to run it once on any given computer.

"svn update" copies changes made by other people (like me) to the repository into your existing working copy.  Its main purpose for you in this class is to download changes that I make after you do the initial checkout, like new test scripts or marks from graded homework.

If you were working in a group, you'd use "svn update" to download changes to the project made by other group members.  You could do this even if you made changes that you hadn't committed.  Subversion is pretty good at merging changes made by multiple people in different parts of the same file, though occasionally you have to help it out.

Saturday, February 9, 2013

Final exam May 15 at 8am

The registrar posted the final exam schedule.  Ours will be 8:00–9:50am on Wednesday, May 15.

Wednesday, February 6, 2013

Homework 2 posted

Homework 2 is up.  It's due a week from Friday.  In addition to work to be turned in, it also contains some suggested readings and exercises.

Another Subversion server outage (Update: back up)

As of 10:39PM on Wednesday, is not reachable.  You may see errors like "Unable to connect to repository."  Other servers at the Courant institute are also affected. I'm not sure how widespread the failures are.

Update: As of 10:09AM Thursday, it is back up.

Monday, February 4, 2013

Fixing a filename with the wrong case in Subversion

Java convention is that classes begin with an uppercase letter.  Suppose you create a file "" and want to rename it to "".  If you look at the Subversion documentation, you might find the "svn move" command and try something like this:

$ svn move
svn: E155007: Path '.../' is not a directory


The problem is that Mac OS X and Windows do not respect case differences in filenames, so it looks like you're asking to rename a file to its own name, which doesn't work.  (What that error message means, I have no idea.)

The solution is to rename it temporarily to something different, commit it, then rename it back to the properly cased name:

$ svn move
$ svn commit -m "temporary rename"

Committed revision 1145.
$ svn move
$ svn commit -m "rename back"

Committed revision 1146.

Subversion Demo #2 error fixed

There was an error in the Subversion Demo #2 section of the notes.  I forgot to include a "svn add" command.  If you followed it and were wondering why did not get committed to the repository when you typed "svn commit", that's why.  Subversion did not know it was supposed to be tracking and needed to be told to.  The notes have been updated.

Code Conventions for Java

Checkstyle complains about all sorts of details in your code.  But, where is it getting all of these rules?  Most of them are from Code Conventions for the Java Programming Language.  The full set of available tests can be found on the Checkstyle web page, but many of them don't apply to this class and have been disabled.

New to Vim?

If you decided to try out Vim/vi and want a good introduction, I recommend Vi For Smarties.  So that Vim works well with Java's indentation style, I recommend putting the following in the ".vimrc" (Mac) or "_vimrc" (Windows) file in your home directory:

set expandtab shiftwidth=4 tabstop=4 autoindent

Editing, propedit, and commit

A few people have gotten confused by this.  When you edit a temporary file as part of "svn propedit" or "svn commit", you have to quit the editor when you're done.  Saving and closing the file isn't enough.

Sunday, February 3, 2013

Bonus office hours this Monday, 9–9:30am

Javac not working?  Confused by Subversion?  If you want to come to office hours Monday but can't because you have class at 11am, I'll be hanging around the lecture hall starting around 9am before class.

Subversion server outage (Update: back up!)

A file server at CIMS that the Subversion server depends on is down.  Connections to on both the web interface and with the command line client are hanging for everyone.

UPDATE: As of 1:40 PM EST 2013–02–03, it's back up.

Friday, February 1, 2013

To-do list for week one

I asked you to do a lot of things this week.  Here they are, collected:
  1. Read the first three chapters of Version Control by Example (VCBE).
  2. Obtain the required textbook and, optionally, the optional textbook.  See the course notes for details.
  3. Set up the JDK and Subversion on your computer.  Add the JDK to your path if you're using Windows.  See sections 2.2–2.4 in the lecture notes for details.
  4. Set up a text editor suitable for editing source code.  Set the EDITOR (Mac) or SVN_EDITOR (Windows) environment variables so that the editor opens automatically when it is necessary.  See sections 2.5–2.7 in the lecture notes for details.
  5. Make sure all of the above worked by completing homework 1.
If you're confused about any of this, and reading the lecture notes, reading the assigned chapters of Version Control by Example, and watching the video of the demo in the first lecture does not help, email me, and I'll try to help.  I also have office hours after lecture on Monday.

Thursday, January 31, 2013

Homework 1

Due 12pm on Friday, Feb. 8.

The task of homework 1 is to get used to the tools we'll be using for the class by replicating Subversion Demo #2 from the Jan. 30 lecture.  You should create a Java program in your area of the Subversion repository in the directory "inclass" named "".  If you type "javac inclass/", then "java inclass.Hello", it should print out "Hello, World!"  You can find a program that does this in section 6.2 of the lecture notes.

You can check that it works as expected by:
  1. Open Terminal (Mac) or PowerShell (Windows).
  2. cd into the top level of your working copy, which has the same name as your netid.
  3. Run "testing/ HelloTest" (Mac) or "testing\test.ps1 HelloTest" (Windows).
You should also check that you committed it to the repository correctly by looking at the version of on the web interface.  It'll have a URL that looks like:

By the way:

If you want Checkstyle to quiet down about tabs in your files and you're using Notepad++, go into the "Settings > Preferences", click on the "Language Menu/Tab Settings" tab, then check "Replace by space" in the bottom right corner.  This won't affect existing files, just new files and changes to old ones.  If you're using XCode, the default tab settings are fine.

Wednesday, January 30, 2013

Subversion Demo #1

For those of you who missed the first lecture, I recorded a video of Subversion Demo #1.  See section 4 of the lecture notes for the text version.

Notes for Jan. 30 class

The Jan. 30 lecture has been added to the course notes.

Saturday, January 26, 2013

Notes for Jan. 28 class

I've posted the first installment of the lecture notes.  It describes how to install the two main software packages we'll be using this term, the Java Development Kit and Subversion.  It also includes a walkthrough of a basic Subversion session.

Welcome to Introduction to Computer Science

Welcome to Introduction to Computer Science, section 6.  I'm the instructor, Madeleine Thompson.  We'll be meeting Mondays and Wednesdays in WWH 109.  Much more information about the class is in the Course Information.  If you have any questions, contact me at