Resources


Linux Resources:
Mac Resources:
  • Mac OSX is built off of a linux style base system (BSD Unix), which makes compiling and running source for linux programs easier on the mac without having to install Ubuntu. Note that there are some differences between the OSX system libraries and the linux ones. Usually, the OSX compiler is less forgiving the the Ubuntu one. 
  • Apple Developer Tools (Xcode)
    • If you have OSX version 10.6 or later, you should be able to use the Mac App Store to find "Xcode" and install it for free.
    • If you have an earlier version of the Mac OS, or have difficulty with the App Store, you can download an older (but fully functional) version of the developer tools here (for OS 10.6 - Snow Leopard) or here (for OS 10.5 - Leopard)
    • You may need to sign up for an apple developer account to use the link above, it's free and you can do so here: http://developer.apple.com/programs/register/
    • You will need to install the command line tools after Xcode installs, this is easy, just open a terminal and enter:
      • $ xcode-select --install
        This will start the installation process
  • Download x11, the linux style windowing environment
    • This used to be included in the macos, before you install check to see if your computer has a program called x11
    • If it doesn't, download and install x11 from here: http://xquartz.macosforge.org/landing/
  • Download Homebrew: http://brew.sh
    • Homebrew allows you to install linux style applications via the Mac OS terminal application, it is not necessary, but can be very useful. You must have the Apple Developer Tools installed in order to use Homebrew.
    • If you want to install emacs from homebrew (which is highly recommended), you'll want to install it with the windowed version, to do so, include the --with-x11 flag:
      • $ brew install emacs --with-x11
    • MacPorts  (http://www.macports.org/) and Fink (http://www.finkproject.org/) do the same thing as homebrew, but homebrew is probably more current and there are other pluses to it over the other two. That being said, there are times when a package you want may only be available from one of these options. You don't need to install these unless you want to play around with things, it may cause issues with homebrew.
 
Windows resources:

Github Submodule Setup
  • If you need a refresher on using git in general, see "The Basics" section below.
Think of a submodule as a github repo inside another github repo (I know, woah).  Here's how things will generally be set up:
  1. Each class will have a repo for assignments.
  2. Each student/group will create a totally separate repo for their work
    • This should not live in the main work repo
  3. Each student/group will clone the main work repo, and then link their own repo as a submodule
  4. Each student/group will get rid of their local copy of the main repo
  5. Each student/group will work on their assignment in the repo created in step 2
Ok, but what about more instructions with examples you say?

2. Create & clone your own repo
Do all your work in this repo.
$ git clone https://github.com/jonalf/work-test.git
Cloning into 'work-test'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
Checking connectivity... done.

3. Clone the main repo
$ git clone https://github.com/stuy-softdev/workshop.git
Cloning into 'workshop'...
remote: Counting objects: 14, done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 14 (delta 5), reused 9 (delta 3), pack-reused 0
Unpacking objects: 100% (14/14), done.
Checking connectivity... done.

Change into the correct directory and add your repo as a submodule
$ cd workshop/
socrates: workshop dw$ cd randomizer/6/
socrates: workshop/randomizer/6 dw$ git submodule add https://github.com/jonalf/work-test.git jonalf_dw
Cloning into 'randomizer/6/jonalf_dw'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
Checking connectivity... done.

Commit and push changes
$ git pull
Already up-to-date.
socrates:~/Desktop/git_demo/workshop/randomizer/6 dw$ git commit -a -m "added dw submodule"
[master f25eeda] added dw submodule
 2 files changed, 4 insertions(+)
 create mode 100644 .gitmodules
 create mode 160000 randomizer/6/jonalf_dw
socrates:~/Desktop/git_demo/workshop/randomizer/6 dw$ git push
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 626 bytes | 0 bytes/s, done.
Total 5 (delta 0), reused 0 (delta 0)
To https://github.com/stuy-softdev/workshop.git
   11dc0c6..f25eeda  master -> master
You do not have to pull first, but it is a good idea in case anyone has pushed before you have a chance to.

Remove the main repo and go about your business
$ cd ../../../
$ rm -rf workshop/

Using Git/Github: The basics

Cloning an existing project:
  For every assignment, you will need to clone the project repository You should only do this once per repository per computer. After you clone, the project directory will be downloaded onto your computer and all future git changes must be made inside that directory.

    use the following command to checkout:
$ git clone https://github.com/mks65-dw/<assignment name>.git
Cloning into 'hw1'...
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 4 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (4/4), done.

    for example, to checkout an assignment called hw1 I would do the following:
$ git clone https://github.com/mks65-dw/hw1.git
Cloning into 'hw1'...
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 4 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (4/4), done.

This will create a folder on your computer called (in this case) hw1. You must go into that folder to add your own directory.

Creating your own directory within a project:
    Once you have cloned the assignment, create a directory for yourself. Change into the assignment folder and make a new directory with the name: Firstname_Lastname. So mine would be JonAlf_Dyrland-Weaver. After you create the directory add it to the main repository and commit (see the instructions for adding and committing below)
    So to make my own repository to the project called hw1 from above:
$ cd hw1
$ mkdir JonAlf_Dyrland-Weaver
$ cd JonAlf_Dyrland-Weaver
    Once you make, add and commit the directory do all your work within the directory

Adding files:
    When you create a new file, it is not automatically tracked by git. You must tell git which files it should track. (This is useful because you don't want to add .o, ~ and executable files that may get created while working on your project, you may also look at .gitignore for more ways to keep out unwanted files). You only need to do this once per file. After it has been added git will track it. You cannot add an empty folder. Make sure you put something in a folder in order to add the whole thing
$ git add file.txt 
    You will not see any response after adding a file
Removing files:
$ git rm file.txt
rm 'JonAlf_Dyrland-Weaver/file.txt'
    Running git rm will also remove the file from your directory immediately

Committing your changes:
    When you add files, the changes are not automatically saved but git, you must commit these changes. You must always use the -m option followed by a string containing a commit message. You should commit anytime you have changes that are worth saving!
$ git commit -a -m "adding an initial file"
[master 5524096] adding an initial file
 0 files changed
 create mode 100644 JonAlf_Dyrland-Weaver/file.txt
    The -a option will automatically commit any changes to files that you have already added. You should always include -a (unless you know what you're in for)

Pushing your changes to gihub
    Committing is a local operation, it will not change the status of your work on gihub. You do this with the push command. When pushing, git may ask you for your username and password, (use your github account information) depending on how you have git set up.
$ git push
Username for 'https://github.com': jonalf
Password for 'https://jonalf@github.com': 
To https://github.com/mks65-dw/hw1.git
   8bd554d..5524096  master -> master

Updating your project to the latest version:
    When you start working in a new location (i.e. you worked in school, pushed your changes and now want to work at home with the latest version), pull any changes from github. This will make all of your files match with those on github.
$ git pull

REMEMBER, AFTER YOU CREATE YOUR OWN GITHUB FOLDER, DO ALL YOUR WORK AND GIT COMMANDS WITHIN THAT FOLDER!






Using SVN

To get rid of the dreaded GNOME Keyring error:
Remove the following file: ~/.gnome2/keyring/login.keyring

Checking out an existing project:
    For every assignment, you will need to checkout the project repository You should only do this once per repository per computer. After you run checkout, the project directory will be downloaded onto your computer and all future svn changes must be made inside that directory

    
Use the following syntax to checkout:  
$ svn checkout https://ml5-dw.googlecode.com/svn/trunk/<projectname>/<period>/ <projectname> --username <your google username>
    For example, to checkout a project called test for period 4 I would do the following:
$ svn checkout https://ml5-dw.googlecode.com/svn/trunk/test/4/ test --username dw@stuycs.org
Checked out revision 1.
    Note that the revision number will change

Creating your own directory within a project:
    Once you have checked out the project, create a directory for yourself. Change into the svn directory and make a new directory with the name: Firstname_Lastname. So mine would be JonAlf_Dyrland-Weaver. After you create the directory add it to the main repository and commit (see the instructions for adding and committing below)
    So to add my own repository to the project called test from above:
$ cd test
$ mkdir JonAlf_Dyrland-Weaver
$ cd JonAlf_Dyrland-Weaver
    Once you make, add and commit the directory do all your work within the directory

Adding files:
    When you create a new file, it is not automatically tracked by svn. You must tell svn which files it should track. (This is useful because you don't want to add .o, ~ and executable files that may get created while working on your project). You only need to do this once per file. After it has been added svn will track it.
$ svn add file.txt 
A         file.txt

Removing files:
$ svn remove file.txt
D         file.txt

Committing your changes:
    When you add files, they are not automatically uploaded, only by committing will your files be uploaded. You can always double check which files are being tracked and have been uploaded by going to the svn webpage for your directory. You can commit as often as you'd like. Always include a comment using the -m option and your own google id using the --username option. 
You may be asked for a password to commit, if you are go to https://code.google.com/hosting/settings and retrieve your personal password from google.

$ svn commit -m "added file.txt" --username dw@stuycs.org
Adding         file.txt
Transmitting file data .
Committed revision 4.

Updating your project to the latest version:
    When you start working in a new location (i.e. you worked in school, committed your changes and now want to work at home with the latest version), update. This will make all of your files match with those on the stuy svn server. Only run update when you begin to work in a new location.
$ svn update
At revision 4.


Comments