Homework 0 Frequently Asked Questions
- Should I turn the homework in with a partner or individually?
Homework 0 is individual. Partner homeworks will start with Homework 1.
- When I run "server", I get the following message:
could not connect to server: Connection refused Is the server running on host "sphere.cs.berkeley.edu" and accepting TCP/IP connections on port 16XXX"This error is telling you that the rails server cannot connect to Postgres. Check that you started the postgres server on that host (via "pg_ctl start"). Also make sure you properly set up the postgresql.conf and pg_hba.conf files from Step 1, and database.yml file from Step 6.
- Sometimes the instructions refer to controller files in the singular (e.g. "track_controller.rb") and sometimes in the plural (e.g. "tracks_controller.rb"). Shouldn't it be one or the other? Which one?
It should consistently be plural. This also applies to the URLs generated, which should be plural: e.g. "http://rhombus.cs.berkeley.edu:16001/tracks". This has been fixed in the assignment online.
- When I try to do "pg_ctl start" I get an error saying:
LOG: could not bind IPv6 socket: Address already in use HINT: Is another postmaster already running on port 16030?
This usually means you've already started the Postgres server. To be sure, you can try "pg_ctl restart".
- When I type "rake db:migrate" I get errors about relations that already exist. What should I do?
You should be able to delete your pgdata directory and start over. To do that, type
% pg_ctl stop % /bin/rm ~/pgdataSome people have found that deleting the pgdata directory fails due to some strange .nfsxxx files that are being autogenerated by the operating system. If you have this problem, you can always use a different database directory with postgres via the "-D" flag to both initdb and pg_ctl:
% initdb -D ~/pgdata2 % pg_ctl start -D ~/pgdata2
- When I type "rake db:migrate" I get errors that look like:
./db/migrate//001_create_tracks.rb:1: parse error, unexpected '<' <!DOCTYPE html
This occurs because you have HTML in your migration files, rather than plain ruby text. This was easy to do accidentally when the migration files were "attachments" to the assignment. I have changed the assignment so that there are links to pages that contain the contents of the migration files. Copy and paste those files into your migration files, do not download the HTML source!
- I can't seem to run rails or a variety of other commands. I get errors like:
bash-3.00$ rails itunes bash: rails: command not found
If you change your shell from the class default (tcsh) to something else (e.g. bash), you will not get a variety of environment variables that you need, and you'll see this kind of error. These variables are set up by tcsh scripts that the instructional computing staff maintain. Unfortunately this means that you must use tcsh in your course account.
