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.