Assignment 0: System Setup
In this assignment, you will set up your computer with Ruby, RubyGems, Ruby on Rails, Sqlite, and Git.
First read; then see at the very end a checklist of what you need to submit.
You must have the following versions:
- Ruby 1.9.1p243
- RubyGems 1.3.5
- Ruby on Rails 2.3.3 only (see http://e168f09.plugh.org/2009/09/04/for-assignment-0-rails-2-3-3-only/ for details)
- Sqlite 3.4.0 or later
- The sqlite3-ruby gem, version 1.2.5
- A Unix-compatible command-line zip command (must be able to handle the -r option)
- A command-line ssh client
- Git (a recent version)
Installation Tips
System setup is actually much improved compared to years past. For guidance regarding Windows, Mac OS/X, and Linux setups, see the screencasts pages. One gap is for OS/X Tiger: I’m hoping that all Mac users are now on Leopard.
Your Submission
Download the assn0-1.0.0.zip from the downloads page.
In that download, you’ll find the file versions.rb
This will report the versions of the required software. We also collect a wee bit of personal information — your time zone and a geo-location of your IP address (because of this, you should be on the Internet when you run this). Once you’re satisfied with the result, run it again, and redirect the output to a file whose name is “versions.txt” — for example:
ruby versions.rb >versions.txt
You will also need to submit a second file. For this one, change your directory into demo/ in the the download, and . . .
ruby demo.rb
This is a little game that uses the “curses” support in Ruby. You should see a star moving in a box. Press the forward slash key (/) to “reflect” the star to a new direction. Press q to quit. John will demo this in the video for the first lecture. NOTE: We want to hear about it if this program doesn’t work, because Assignment 2 will have very similar code. Linux users in particular: See my notes regarding the setup of curses for Ruby 1.9.1.
Then take a look at the log file (called info.log). You should be able to find a line in there with a secret word. Create a second file with the name secret_word.txt. Edit the file, and put the name of the secret word in there.
Zip up the entire project, and make sure that the file name has your name in it. If you use the command “rake package” from the root directory, this will be done for you. As a note to the wise: Open your own ZIP and double-check that everything is there (especially versions.txt and secret_word.txt, with your info).
Then submit both files via iSites.
sorry, if these questions are already answered elswhere, but I am new to harvard distance education.
1) what password should I use on the download page? I tried my DCE Pin and my harvard pin. both not working for this (in the online services they work fine).
2) what is iSites?
If I get different results for Sqlite (3.6.3) and Sqlite via Ruby (3.4.0) what is the likely cause, and do I need to fix it?
My sqlite3 binary is from /Applications/XAMPP/xamppfiles/bin/sqlite3 , but somehow the ruby gem doesn't see this on my PATH. (I had installed XAMPP for CSCI S-75)
@Gabriel Hase
I haven't given out the password for the downloads page.
iSites is Harvard's course management software, which provides "drop boxes" to which you can upload assignments. I haven't posted the URL for our iSites site yet.
The first line of the assignment says:
'NOTE: This assignment is not “official” until the first lecture, and may be revised before then.'
So . . . This is essentially a preview, and will get tweaked until Thursday evening's lecture.
@Ron Newman
Ron, I think that will be ok.
What must be happening is that the sqlite3-ruby gem found the header files for your system Sqlite3 (3.4.0) and used those.
Thanks.
Anyone (like me) who downloaded and installed ruby_switcher.sh more than a week ago should probably fetch an updated copy, and then run this shell command
install_rubygems_from_source "1.3.5"
Should the output go to 'versions.txt' or to 'a file whose name is your last name followed by your initials and “-assn0.txt” ' ? (The assignment says both things in different places)
@Ron Newman
Better?
For system setup, I am using 2 versions of Ruby. 1.8.7 with Rails _2.2.2_ for AWDR examples AND 1.9.1 (Ruby) with _2.3.3_ Rails. Is it acceptable during the running of the script process above to use my default ruby command of >> ruby19 a_ruby_file.rb to produce the results of the text file?
e.g. You reference executing this command: ruby versions.rb >versions.txt; which on my system will pull the Ruby 1.8.7 information. I could run a command: ruby19 versions.rb >versions.txt and get the results that you are looking for.
I actually set up my system before the switcher plug-in you spoke of and was hoping to avoid switching back and forth, since I can easily use both versions depending on if I am going for an AWDR (1.8.7/2.2.2) example or something I am completing for the course assignments/final (1.9.1/2.3.3).
@Jeff Ancel
Jeff, doing ruby19 versions.rb >versions.txt should be fine. When you do that, what version of gem does it report?
Also: Is your patch level at 243? We need to be somewhat fussy about that, because 1.9.1 is still getting bug fixes. It seems quite stable to me, but we want to get on that patchlevel and stay with it for the semester (unless we discover that there's some huge problem).
@john
Ok, here is my initial output. I ran the file and seems to be OK. The only real concern I have would be similar to Ron Newman's. My Ruby and rails read the 3.4.0 version. Here is my dump, let me know if there is anything alarming and I can redo my RoR.(Note: When you see a comma (2.3.3, 2.2.2), this is because of my dual installation, and ruby-openid is a plugin I am playing with)
----- Software version check at 2009-09-03 19:28:31 -0500
Time Zone: CDT
Location: Country: UNITED STATES (US); City: St Louis, MO
Working dir: /Users/jeffancel/RubyProjects/CS168/Project0
Ruby Platform: i386-darwin9.8.0
Ruby Engine: ruby
Ruby Version: 1.9.1
Ruby Patchlevel: 243
RubyGems: 1.3.5
Rails: 2.3.3
sqlite3-ruby: 1.2.5
Sqlite: 3.4.0
Sqlite via Ruby: 3.4.0
zip -r: OK
ssh: OpenSSH_5.1p1, OpenSSL 0.9.7l 28 Sep 2006
git: Exception: No such file or directory - git --version
Gems:
actionmailer (2.3.3, 2.2.2)
actionpack (2.3.3, 2.2.2)
activerecord (2.3.3, 2.2.2)
activeresource (2.3.3, 2.2.2)
activesupport (2.3.3, 2.2.2)
rack (1.0.0)
rails (2.3.3, 2.2.2)
rake (0.8.7)
ruby-openid (2.1.7)
sqlite3-ruby (1.2.5)
Updating the Git issue:
git: git version 1.6.3.3
I think it is notable that after you install git, on Mac, you have to restart your system to get the path to pick it up.
I have a question on the geo-location via IP. Long story short is that I do not have a real IP address at my location (Leesburg, VA, which is a distant suburb of Washington, DC) as such I am not suspired to see that my location is shown as:
Country: (Unknown Country?) (XX); City: (Unknown City?)
Is the lack of success of this element going to cause any heartburn down the line?
It looks like installing git adds /usr/local/git/bin to your default PATH, by adding the file /etc/paths.d/git to your system.
I don't think you need to restart your computer after installing git, but you probably do have to start a new shell (Terminal) window in order to pick up the default PATH change.
"rake package" zips up the entire contents of my directory, including all of the files that I downloaded from assn0-1.0.0.zip . Is that really what it should be doing?
@Ken Vedaa
No problme if the geolocate isn't effective -- it's a "nice to have" so that we can understand the geographical spread of the class. For some reason, Harvard doesn't share that info with me!
@Ron Newman
Yes, we zip the whole thing. It's not very big.
We want to be able to check if you changed anything; plus, it acquaints you with "rake package."
Thanks. Guess I'd better clear out any extraneous files (such as diagnostic-quiz.txt) before I do 'rake package'.
@Ron Newman
I believe the rake task will only collect the files we want . . .
Yup, I can verify that. Raking will get the required files and everything within the demo path (**/*). Make sure that the secret_word.txt file is in the assignment's root folder and not within the demo folder. Rakefile is looking for it at "secret_word.txt" and not "demo/secret_word.txt". I can imagine some of us *cough-me* cding into the demo folder and touching a file there.
Just curious -- does '**' have a special meaning in Ruby or Rake, different from '*' ?
I had created a file called demo/info.log.old and was surprised to see it packaged up along with everything else.
@Ron Newman
Rake leverages the Ruby Dir class -- See Dir.glob:
http://www.ruby-doc.org/core/classes/Dir.html#M002322
Did I somehow miss the explanation for how to "submit both files via iSites"?
@B Ruml
I thought I mentioned it in the lecture, but the link for iSites is on this page:
http://e168f09.plugh.org/notes/note-isites-drop-boxes-for-assignments/
The "login" button is in the upper-right. After logging in, you click on drop-boxes, find the assignment, click into it, and then I think there's an upload button.
Since I'm an instructor, I can't login in as a student and record it.
In any case, one student has submitted already, so it does work.
@Jeff Ancel
Just wondering, how did you download git version 1.6.3.3?
In my cygwin setup, I only have the option to install version 1.6.1.2.
Ben,
That version of git will be fine -- we just require a "recent version" of git.
Do we have a page where we show git version 1.6.3.3? That might be from OS/X or Linux.
John
The 'git' that I 'got' on my Mac (following your instructions to use http://code.google.com/p/git-osx-installer/ ) is 1.6.4.1
Is it ok, if the filename of the zip (name+inital-assn0.zip) does not equal the root folder inside the package (generated by rake, --> my user name on the machine is not my real name, so I had to rename the zip)?
As for the curses demo, everything worked fine for me. I am working on Debian lenny:
uname -r => 2.6.26-2-686
Gabriel: No problem renaming the ZIP archive.
Glad the demo worked!
I went out and downloaded the latest stable release (Last version greatest minor version number), since it was stated that we need not be on the most current version. Here is the page I got it from. http://code.google.com/p/git-osx-installer/downloads/list (about 4 down from the top)
@Jeff Ancel
Thanks, Jeff, but note that Ben is on Windows; the OSX installer won't help.
In any case, any recent version of Git is fine!
@john
Great, thanks for the help guys!
So is my secret word supposed to appear in info.log? I changed it, re-ran the demo but the secret word in the log stayed the same.
The earliest versions of the download included info.log, unfortunately, revealing the secret word without a run.
I fixed that pretty promptly, but you seem to have downloaded it right away.
The demo works fine if I hit '/' but it crashes with the following error message if I hit the arrow keys. Should I be concerned?
dlarochelle@dumbledore ~/ruby_stuff/e168-assignment0-jgn-1.0.000/demo $ ruby demo.rb
/home/dlarochelle/ruby_stuff/e168-assignment0-jgn-1.0.000/demo/lib/screen.rb:32:in `chr': 261 out of char range (RangeError)
from /home/dlarochelle/ruby_stuff/e168-assignment0-jgn-1.0.000/demo/lib/screen.rb:32:in `get_character'
from /home/dlarochelle/ruby_stuff/e168-assignment0-jgn-1.0.000/demo/lib/game.rb:68:in `block in start'
from /home/dlarochelle/ruby_stuff/e168-assignment0-jgn-1.0.000/demo/lib/game.rb:67:in `loop'
from /home/dlarochelle/ruby_stuff/e168-assignment0-jgn-1.0.000/demo/lib/game.rb:67:in `start'
from demo.rb:10:in `'
We don't support the arrow keys - so, no worries!
"Create a second file with the name secret_word.txt. Edit the file, and put the 'name' of the secret word in there." -- I assume just paste the secret word from info.log into the file?
If I run the "rake package", it is creating a zip file of the format: e168-assignment0-{env['USER']}-1.0.000. I have env['USER'] set to my middle name. Does it matter which name I have in the assignment submission file? Or I can edit the rake file to have either my First or Last name.
Rename the resultant ZIP with a file name with your last name in it.
You could, ask you suggest, edit the rake file, but I don't think that's necessary.
When you submit to the drop-box, it goes into a box with your name, so we're somewhat covered.
When I run
ruby demo.rb I am getting this error:
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require': no such file to load -- curses (MissingSourceFile)
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `block in require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
from /home/halavin/cs168/homework/e168-assignment0-jgn-1.0.000/demo/lib/screen.rb:1:in `'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `block in require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
from /home/halavin/cs168/homework/e168-assignment0-jgn-1.0.000/demo/lib/game.rb:3:in `'
from demo.rb:7:in `require'
from demo.rb:7:in `'
I am using Ubuntu linux 8.10. I have already install ncurses lib using
sudo apt-get install libncurses5-dev
But when I run gem install ncurses I get this error message. I don't know if I can submit this assignment without running demo.rb?
gcc -I. -I/usr/local/include/ruby-1.9.1/i686-linux -I/usr/local/include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -DHAVE_UNISTD_H -DHAVE_NCURSES_H -DHAVE_NEWSCR -DHAVE_TABSIZE -DHAVE_ESCDELAY -DHAVE_KEYBOUND -DHAVE_CURSES_VERSION -DHAVE_TIGETSTR -DHAVE_GETWIN -DHAVE_PUTWIN -DHAVE_UNGETMOUSE -DHAVE_MOUSEMASK -DHAVE_WENCLOSE -DHAVE_MOUSEINTERVAL -DHAVE_WMOUSE_TRAFO -DHAVE_MCPRINT -DHAVE_HAS_KEY -DHAVE_DELSCREEN -DHAVE_DEFINE_KEY -DHAVE_KEYOK -DHAVE_RESIZETERM -DHAVE_USE_DEFAULT_COLORS -DHAVE_USE_EXTENDED_NAMES -DHAVE_WRESIZE -DHAVE_ATTR_ON -DHAVE_ATTR_OFF -DHAVE_ATTR_SET -DHAVE_CHGAT -DHAVE_COLOR_SET -DHAVE_FILTER -DHAVE_INTRFLUSH -DHAVE_MVCHGAT -DHAVE_MVHLINE -DHAVE_MVVLINE -DHAVE_MVWCHGAT -DHAVE_MVWHLINE -DHAVE_MVWVLINE -DHAVE_NOQIFLUSH -DHAVE_PUTP -DHAVE_QIFLUSH -DHAVE_SCR_DUMP -DHAVE_SCR_INIT -DHAVE_SCR_RESTORE -DHAVE_SCR_SET -DHAVE_SLK_ATTR -DHAVE_SLK_ATTR_SET -DHAVE_SLK_COLOR -DHAVE_TIGETFLAG -DHAVE_TIGETNUM -DHAVE_USE_ENV -DHAVE_VIDATTR -DHAVE_WATTR_ON -DHAVE_WATTR_OFF -DHAVE_WATTR_SET -DHAVE_WCHGAT -DHAVE_WCOLOR_SET -DHAVE_GETATTRS -DHAVE_ASSUME_DEFAULT_COLORS -DHAVE_ATTR_GET -DHAVE_PANEL_H -DHAVE_FORM_H -D_FILE_OFFSET_BITS=64 -fPIC -O2 -g -Wall -Wno-parentheses -g -o form_wrap.o -c form_wrap.c
form_wrap.c: In function ‘rbncurs_m_new_form’:
form_wrap.c:395: error: ‘struct RArray’ has no member named ‘len’
form_wrap.c: In function ‘rbncurs_c_set_field_type’:
form_wrap.c:619: error: ‘struct RArray’ has no member named ‘len’
form_wrap.c: In function ‘rbncurs_c_set_form_fields’:
form_wrap.c:778: error: ‘struct RArray’ has no member named ‘len’
form_wrap.c: In function ‘make_arg’:
form_wrap.c:1126: error: ‘struct RArray’ has no member named ‘len’
form_wrap.c:1130: warning: format not a string literal and no format arguments
make: *** [form_wrap.o] Error 1
Vinod,
I installed the various applications into a virtual machine running Unbuntu 8.10, and I had to . . .
sudo apt-get install libncurses-ruby1.9 libncurses5-dev libncursesw5-dev
So try that and tell us what you get. After this sudo apt-get install, you may have to reinstall Ruby 1.9.1.
Also: I notice that you're on Rails 2.3.4. We require 2.3.3.
John
Hi ,
I just want to cross check if the versions file I get as output is the correct one...
----- Software version check at 2009-09-09 10:19:51 -0500
Time Zone: Eastern Daylight Time
Location: Country: UNITED STATES (US); City: Cambridge, MA
Working dir: /cygdrive/c/Users/Pankhudi/Acads_PR/Current_Semester _Fall_2009/Ruby/e168-assignment0-jgn-1.0.000
Ruby Platform: i386-mingw32
Ruby Engine: ruby
Ruby Version: 1.9.1
Ruby Patchlevel: 243
RubyGems: 1.3.5
Rails: 2.3.3
sqlite3-ruby: 1.2.5
Sqlite: 3.6.17
Sqlite via Ruby: 3.6.17
zip -r: OK
ssh: OpenSSH_5.1p1, OpenSSL 0.9.8k 25 Mar 2009
git: Exception: No such file or directory - git --version
Gems:
actionmailer (2.3.3)
actionpack (2.3.3)
activerecord (2.3.3)
activeresource (2.3.3)
activesupport (2.3.3)
rack (1.0.0)
rails (2.3.3)
rake (0.8.7)
sqlite3-ruby (1.2.5)
One of the line I get in output is:
git: Exception: No such file or directory - git --version
is it any error.
Thanks,
Priyanka.
Priyanka,
To install git on your system, you need to find the "Cygwin setup" icon, and re-run the Cygwin setup, and find "git" in the list of applications.
I provided a note regarding this near the top of http://e168f09.plugh.org/screencasts/screencast-setting-up-under-windows/
@john
It works now. Thank you !
Does the drop box work yet? I can't figure put how to submit.
Also is there a due date?
David,
The drop boxes work -- did you log in (link in upper right).
The due dates are in the syllabus - http://e168f09.plugh.org/syllabus/
John
When I crosscheck my output with the one on the homepage I have some differences in them::
The output at homepage is like :
*** LOCAL GEMS ***
actionmailer (2.3.3)
actionpack (2.3.3)
activerecord (2.3.3)
activeresource (2.3.3)
activesupport (2.3.3)
cgi_multipart_eof_fix (2.5.0)
daemons (1.0.10)
eventmachine (0.12.8)
fastthread (1.0.7)
gem_plugin (0.2.3)
rack (1.0.0)
rails (2.3.3)
rake (0.8.7)
sqlite3-ruby (1.2.5)
thin (1.2.2)
and the output I get in version.txt file is :
----- Software version check at 2009-09-10 08:45:08 -0500
Time Zone: Eastern Daylight Time
Location: Country: (Unknown Country?) (XX); City: (Unknown City?)
Working dir: /cygdrive/c/Users/Pankhudi/Acads_PR/Current_Semester _Fall_2009/Ruby/e168-assignment0-jgn-1.0.000
Ruby Platform: i386-mingw32
Ruby Engine: ruby
Ruby Version: 1.9.1
Ruby Patchlevel: 243
RubyGems: 1.3.5
Rails: 2.3.3
sqlite3-ruby: 1.2.5
Sqlite: 3.6.17
Sqlite via Ruby: 3.6.17
zip -r: OK
ssh: OpenSSH_5.1p1, OpenSSL 0.9.8k 25 Mar 2009
git: git version 1.6.1.2
Gems:
actionmailer (2.3.3)
actionpack (2.3.3)
activerecord (2.3.3)
activeresource (2.3.3)
activesupport (2.3.3)
rack (1.0.0)
rails (2.3.3)
rake (0.8.7)
sqlite3-ruby (1.2.5)
is it correct or am I missing things again...
@David
After I logged in (top right, log in with what I believe we have been calling HUID) then I notice it says Hi, [Name] in the very top right.
Using the link on the left that says Drop boxes led me to a folder structure that allowed me to submit my project.
There is also some very good information on the site under comments for the iSites note. Now to see if I can actually post a link.
http://e168f09.plugh.org/notes/note-isites-drop-boxes-for-assignments/
@Priyanka : My list is the same as yours (plus the mysql gem which I installed separately on my own). I didn't think we needed any of the other ones listed?
@Priyanka
Priyanka,
You can check the list as easily as I can. From the top of http://e168f09.plugh.org/assignments/assignment-0-system-setup/ --
Ruby 1.9.1p243? YES
RubyGems 1.3.5? YES
Ruby on Rails 2.3.3? YES
Sqlite 3.4.0 or later? YES
The sqlite3-ruby gem, version 1.2.5? YES
A Unix-compatible command-line zip command? YES
A command-line ssh client? YES
Git (a recent version)? YES
Therefore, you are done!
Folks, I'm not going to hand-check another submission -- it should be very obvious from the results of the versions.rb program whether you've satisfied the requirements of the assignment. (Unless I'm missing something.)