CVS and Groups Workshop

Practicing with UNIX Group Commands

(Note: if you are familiar with the Unix group commands, you may skip this part)

  1. In the lab, sit in close proximity to your group members
  2. Log onto gaul and type the command groups
  3. Write down what groups you are in: _______________________
  4. Make sure that your groups members and you are all in the same cs2212 group.
  5. In UNIX create a directory called cs2212stuff
  6. Go into that new directory and create a file as indicated below
  7. Type pico junkYourUserID.txt and hit enter
  8. Type one or two sentences into this file, then type <ctrl> x, then type "Y"at  the prompt to save the file and save and close the file.
  9. Type ls -lg to see the default group for that file
  10. Type chgrp yourgroupname junkYourUserID.txt
  11. Try to look at someone else in your groups file. NOTE: you should not be able to yet because you have not change the group permission AND you have not changed the permissions on the directory.
  12. Change the group permission with the chmod g+rwx junkYourUserID.txt
  13. Do ls -lg to check that it worked
  14. Go up one directory and change the permission on the directory and change the permission on the directory (chmod g+rwx cs2212stuff) and the group (chgrp groupname cs2212stuff)
  15. Go back into that directory and type the command pwd
  16. Try to change the text in your groups members directory of the same name (using the pwd command from above, figure out where your groupmates files are to change them)
  17. Create one more file in that directory called MoreStuff.txt, put some text in it. Try to change this file in your group members directories.
  18. You might not be able to because the group always defaults to the default group unless, you set the permissions on the directory as follows: chgrp -R groupname cs2212stuff  AND  chmod -R g+rwxs cs2212stuff

 

USING CVS:

HAVE ONE MEMBER OF YOUR GROUP DO STEPS 1 TO 16, THEN HAVE THE OTHER MEMBERS JOIN IN. WHILE THE OTHER MEMBERS ARE WAITING, THEY CAN CLICK ON AND WORK ON THIS ECLIPSE DEBUGGING EXERCISE

  1. Have one member of your group (MemberA) type the commands:
        cd home
        chmod g+rx   .
        (make sure you type the period)
  2. Have MemberA create a directory in Unix on Gaul called Repo (for Repository)
  3. Have MemberA change the group to be your cs2212 group for the directory:
        chgrp –R cs2212-10? Repo
  4. Have MemberA set the permissions as follows:
         chmod -R g+rxs Repo
  5. cd to Repo and type pwd and copy the absolute path: ______________________
  6. HAVE YOUR GROUP MEMBERS WRITE DOWN YOUR ABSOLUTE PATH ALSO, THEY WILL NEED IT TOO!
  7. Have MemberA set up the initial repository by running the following command:
        cvs -d   /gaul/...pathnamefromabove.../youruserid/Repo init
  8. Run eclipse, have MemberA set up java project in eclipse: (NOTE: if you have problems running Eclipse from the start menu, go to c:\program files\eclipse and run it from there and then pick a place OTHER than the C: drive for your workspace).
        From main menu: File> New>Project>Java Project. (Menus might be:File> New>Other>Java Project) Call it GroupCVSTest
  9. Have MemberA go to the website: www.csd.uwo.ca/~lreid/cs2212/code and download the files NewSimple3.java and Group.java. Add these java classes into this new project. Have MemberA run NewSimple3 to make sure that it works.
  10. Save both files.
  11. Have memberA go back onto Gaul and once more have MemberA change the group to be your cs2212 group for the directory (chgrp –R cs2212-10? Repo)
  12. Have MemberA create a connection to the repository by going to the Repository view in Eclipse:
          Window>Open Perspective>Other>CVS Repository.
    Right click inside the repository area (usually on the left side of the window) and select:
          New>Repository Location
    Have MemberA complete the wizard like this:
  13. Have MemberA open the navigator view:
             Window>Show View>Navigator (might be called Project Explorer now instead of Navigator)The window will likely be on the right bottom of the screen, it should look like this:
    Share Project
    Click on your project GroupCVSTest, then right click on it and share the project:
              Team>Share Project
    Follow the wizard, just hit next for each option, you may be asked to enter a comment, you don't have to
  14. Commit all the files if prompted, if not prompted, right click on GroupCVSTest project again, then choose Team>Commit
  15. Right click on the project and sync the project Team>Syncronize with Repository, it should say no changes found.
  16. Have MemberA change the file Group.java so that the first name in the constructor is MemberA's name not Peter Griffin, instead it is MemberAs real name, then save the file
  17. Syncronize with Repository again. Should indicate that Group.java changed. If MemberA, while in Synchronize view(, clicks on the button Incoming/Outgoing mode,incoming tnen expand the GroupCVSTest till you see Group.java. You should double click on Group.java and see what the line originally looked like (and still looks like on Gaul in the Repo directory because the changes have not been committed yet (The Remote File) VS the new file with the changes made (The Local File).
  18. Right click on Group.java and Commit the change you made to the name in Group.java. NOW THE CHANGES  MADE ABOVE WILL BE ON GAUL IN THE REPO FILE (this area is where the master versions of all classes/files are kept)
    (about 20 minutes to get to this point)
    NOW HAVE THE OTHER MEMBERS JOIN IN!

  19. Now have the other members go into eclipse. The other members should:
    1. Get the Repository view:
           Window>Open Perspective>Other>CVS Repository
    2. Right click inside the CVS Repositories Tab area (usually big area in top left corner of the window) and select New>Repository Location
    3. Complete the wizard like this:
      1. In Host put: gaul.csd.uwo.ca
      2. In Repository path put the path where MemberA created Repo, for example: /gaul/s1/student/2004/lreid99/Repo
      3. In User put YOUR GAUL USER ID
      4. In Password put YOUR GAUL PASSWORD
      5. In Connection type, drop down and select: extssh
      6. Select Finish from the wizard (this may take a minute or two)
      7. You should ONLY have to do the above steps ONCE for your project, once the connection is set up, if you always use the same machine (like say your home desk top), the connection should remain.
    4. Expand the Repository view (:extssh:...) for the new connection, then expand HEAD
    5. Under HEAD you should see GroupCVSTest/src project that MemberA created, and if you expand that you will see the files/classes MemberAadded to the repository on MemberAs directory on gaul.
    6. Select the project (GroupCVSTest) right click and choose Checkout as Project
    7. Select the Navigator/Project Explorer view (From Main Menu, Window>Show View>Navigator (it might be called Project Explorer now)), it should now include GroupCVSTest as a project
    8. Each new member should right click on the file NewSimple3.java and select Run As>Java Application, then click on Button 2 and play with the slider to see what the code does.
    9. Have each new member (not memberA) open(right click on Group.java and pick open) the file Group.java and change the file Group.java. All new members should change Group.java so that MemberA has whoever is typings name (thus if I am Laura Reid, then I would set the code in the constructor for Group.java so that it says memberA="Doug Vancise";  but if I am Mike Bauer, then i would change the exact same code so that it says memberA="Mike Bauer";  NOTE: make sure you double click on the Group.java file FROM the Navigator Perspective NOT the Repository Window because you might not be able to change the file from that window.
    10. Run the program again and click on Button 2 to make sure the change worked
    11. In the Navigator Window, select the project, right click and select Team>Syncronize with Repository
    12. In the Synchronize View, double click down until you see Group.java and then double click on the file Group.java, you should see the original way you received the file and the new changes
    13. Then commit the changes (right click, Team>Commit) NOTE: Whoever got to commit first, his/her changes WILL take place, the remaining members should get an error
  20. The members who received an error, should right click on the Group.java file and then click on Team>Update, then the changes should be displayed that the first member to click in did (i.e. what is in the repository)
  21. Each member, even MemberA should try doing the whole process again the correct way:
    1. Every member should always check out the files he/she needs by: from the Main menu, select Window>Open Perspective>Other>CVS, then right click on GroupCVSTest and select Check Out
    2. Make sure a Project Explorer Window is open, (Window>Show View>Project Explorer)
    3. Double click on the file Group.java
    4. Make your changes again (this time put your favourite T.V. show character in the constructor for memberA)
    5. Have one member commit his/her changes first, then have the other members do syncronize with repository to see the changes. You can play around with the buttons that will let you move in the lines that were in the repository into your changed code, then have the members do the commits one at a time.
  22. NOTE: most of the time you will not be working on the same files/classes at the same time but CVS should help you not screw up each others work!
  23. If you want to see changes that are coming in, make sure you are in incoming mode (press the Incoming Mode button on the Synchronize Tool Bar), then click update, this will cause your workbench to be updated with the repository copy of the file you are working with
  24. If you are suspicious of the change you made and want to find more info, you need to figure out who did previous changes and why. You can see this in eclipse by choosing Team>Show History from the right click menu of the Project Explorer view. NOTE: you must right click on a FILE not on the project!
  25. If you want to replace with an earlier version of a file (because say you realized your updates were wrong but you had already committed your changes) then you would:
    1. In Project Explorer view, select the file
    2. Right click on the file and select Replace With > History
    3. In the replace with revisions compare editor that opens, choose the original (bottom most) and you will see the original file, you can copy the contents from that file.
  26. To version your project:
    1. Select the project
    2. In Project Explorer view, select Team > Tag as Version
    3. When the Tag Resources dialog opens enter the version name A1 and click OK
    4. Select the CVS Repository View
    5. Expand Versions and the project name. Notice now the project has a version number.
  27. You can add other files to the repository than just .java files. For example, you could add your class diagrams and use case diagrams to the repository. IT IS A GOOD IDEA TO ADD ALL YOUR DATA FOR THE ASSIGMENTS, SUCH AS YOUR CLASS DIAGRAMS (visio files) and your Gantt charts and your group reports TO YOUR GROUPS REPOSITORY. Have member A add the following four files to the repository and have the other members check them out and look at them. The files are: SampleClassDiagram.pdf, SampleClassDiagram.vsd, SampleUseCaseDiagram.pdf, SampleUseCaseDiagram.vsd Add these files as follows, have MemberA do the following:
    1. On your desktop, create a folder called DocumentationFiles
    2. Copy the four files above (the .vsd files and the .pdf files) into the folder DocumentationFiles
    3. Get back into Eclipse and into Project Explorer window (Window>Show View>Project Explorer) and right click on the project GroupCVSTest. Then select Import. Then select General>File System>Next
    4. In the area called From Directory, browse to the folder called DocumentationFiles on your desktop
    5. Check off all 4 files and hit Finish.
    6. THIS JUST ADDS THE FILES TO MEMBERA's PROJECT, NOW MEMBERA MUST COMMIT THEM TO THE REPOSITORY:
      1. In the Project Explorer window, right click on GroupCVSTest, select Team>Commit
      2. Put the comment: Add some documentation visio files and hit Finish
    7. NOW THE OTHER GROUP MEMBERS SHOULD BE ABLE TO CHECK OUT THOSE FILES! Have the other members right click on the GroupCVSTest in the Project Explorer Window and do Team>Update You might want to do this with ALL your group assignment files for cs2212!
  28. We just created a sample repository. Now lets create the real one to use for the rest of the term for your group. Pick one member to have the projects repository. Now have that person do the following:
    1. Log onto gaul and go to his/her root directory
    2. Create a directory on gaul called cs2212project
    3. Change the group to be your cs2212 group for the directory:
          chgrp –R cs2212-10? cs2212project
    4. Sset the permissions as follows:
           chmod -R g+rxs cs2212project
    5. cd to cs2212project and type pwd and copy the absolute path: ______________________
    6. HAVE ALL OTHER TEAM MEMBERS WRITE DOWN THE ABOVE ABSOLUTE PATH
    7. Have the one member set up the initial repository by running the following command:
          cvs -d   /gaul/...pathnamefromabove.../youruserid/cs2212project init
    8. Go into eclipse and have all the other members try to access the new repository
  29. FINAL HELPFUL NOTE: Employees like to see that computer science students have had experience with code repositories, so make sure you include that you have used CVS on your resume :-)

about 30-40 minutes to get to this point



 

Using the Debugger in Eclipse

  1. Go into eclipse and start a new java project (From main menu select --> File, New, Project, call the project DebuggingTests)
  2. Create a new class called MyMain (from main menu select --> File, New, Class)
  3. Go to this website: http://www.csd.uwo.ca/~lreid/cs2212/debugger/MyMain.java  and paste the code into MyMain
  4. Create a new class called AnotherClass
  5. Go to this website: http://www.csd.uwo.ca/~lreid/cs2212/debugger/AnotherClass.java   and paste the code into AnotherClass
  6. Save and run (right click on MyMain.java in the Package Explorer Window, then select Run As, then select either Run OR Java Application) the program MyMain once, just to see what it does (look at the code, it is fairly simple)
  7. Change from the Java Perspective to the Debug Perspective (Window, Show Perspective, Other, Debug)
  8. Set a breakpoint on the line-->  y = junk(100); (the fifth line in the main method). The way you set a breakpoint is you double click on the area in the left, before you set the breakpoint you will see:
    a
    after you set the breakpoint you will see:
    d
  9. Run the program as normal with the Run option (you should see no change)
  10. Now run the program using the Debug Run (click on this:  g,the icon looks like a little bug) The program will now stop at the breakpoint line. Hover your mouse over the variable x in the line above--> x=junk(50); you should be able to tell what value is in the variable x right now.
  11. Click on the Step Over button on the debug tool bar and watch what happensd. Click on it again and hove over the variable x as you do it each time. Watch the x change values. Continue clicking on the Step Over button till you reach the second System.out.println, then click on the Resume button:d The Resume button will continue the program on till the end of the program (or a prompt or the next breakpoint)
  12. Run the program again in debug mode, this time, when you hit the breakpoint, use the Step Into button (not the Step Over button) Keep clicking on the Step Into button and notice the difference between it and the Step Over button
  13.  Now put a breakpoint somewhere in the constructor of AnotherClass and watch what happens when you run in debug mode. Watch what happens when you click Resume (it should stop at your next breakpoint). Also notice in the debug window, you can tell which class and which method you are in. Now Terminate/stop (the red square) the programd
  14. Put a breakpoint on the line--> x=17; Run the program again in debug mode, when you get to the breakpoint, right click in the Variables window and add a watch by clicking on the Watch option. The Expressions window will show up, right click and select Add Watch Expression, type z in the box that appears, then add another watch for y. Then click on the Step Into button until you get to the line--> x=x+10; Double click on the + next to the z in the Expressions window. See if you can change the value of the z.zz variable while it is still running (hint: right click on the zz variable in the expressions window).
  15. There are lots of other things the eclipse debugger will let you do, but this should at least get you started!