lab00 : Getting started with C++ functions and github's web interface

num ready? description submit.cs link
lab00 true Getting started with C++ functions and github's web interface

Activities to complete prior to coming to the lab

  1. Read the lab introduction (see next section)

  2. Complete step 1 of the lab (create a college of engineering account and a github account if you don’t have one already, and sign up to be added to our github organization)

Introduction

The intended outcomes are:

Before leaving the lab you must get the following things checked off by your mentor:

This lab must be completed INDIVIDUALLY. In the subsequent labs you are encouraged to work with a programming partner.

Step 1: Create an Engineering (CoE) Account, a github account and sign into our class github organization

Create an CoE account if you don’t have one already

To log in to the machines in the Computer Science labs, or to connect remotely, you will need a College of Engineering account.

At this point, please go to THIS LINK and view the important presentation from Engineering Computing Infrastructure on the College of Engineering accounts and computer labs.

You can create an account online at https://accounts.engr.ucsb.edu/create.

If you are enrolled in any Computer Science course this quarter, you can create your account immediately. If you are not, you will need to contact the ECI Help Desk at help@engineering.ucsb.edu.

Create a github account

Sign up for a free account on Github. Use your official ucsb email when signing up. Sign into Github with your github account.

Sign up to be added into our class organization

To join our github organization, follow these easy steps:

  1. click on this link:https://ucsb-cmptgcs1a-f17-signup.herokuapp.com. You should see the following welcome message (with the organization stated as ucsb-cs24-sp17), click on the blue “sign in with Github” button:

welcome

  1. The next screen asks you to authorize our app to add you to our class organization. Click on the green “authorize application” button.

authorize

  1. Enter your github and you should see the following screen that shows you were successfully added to our class organization:

success


Step 2: Open a Terminal and write a simple “Hello World” program

Open a terminal window, which will be the environment you use to write, compile, and run your programs.

If you are working on your laptop, whether Windows, Mac or Linux, the instructions below will tell you how to connect to csil.cs.ucsb.edu. For now its okay to connect to that server, however in the future please connect to one of the following machines:

You’ll get much better performance on those individual machines, because they are much less heavily loaded and have newer hardware, as compared to csil.cs.ucsb.edu.

Step 3: Create cs24 and lab00 directories

Now that your environment is set up, you will need to create a directory that will contain all your work for the course. Then, inside that directory, you will need to create another directory to contain your work for this assignment.

To create your CS24 directory, use the mkdir command. Type the following in the terminal and press enter:

$ mkdir cs24

Change into that directory and create a lab00 directory

$ mkdir lab00
$ cd lab00   

Open an editor of your choice (either vim or emacs)

Useful links related to emacs

Useful information related to vim for UNIX-based OS

cp /cs/faculty/dimirza/cs16-wi17/labs/example_dotvimrc/.vimrc ~/

To refresh you may see some emacs hints and some vim hints.

This assignment only needs you to write a program that prints out two lines on the display, and nothing else. The output should look exactly as follows (no space before or after each line, except the 2 newlines):

Hello, world!
CS24 Spring 2017.

Step 3: Submit your program for grading

Once you are satisfied that your program is correct, then it’s time to submit it.

Please remember that you must submit the program to obtain any credit for the assignment; just completing the program is not enough.

Join the class CS24_s17 on submit.cs.

Submit using the command:

$ ~submit/submit -p 819 hello.cpp


Step 4: Explore github’s web interface and declare a partner

Motivation for using github: When developing large programs, it is very useful to save working versions of your code that you can always revert to. Trying to do this manually often leads to total chaos!! That’s why professional programmers use some kind of version control system (VCS). We will use a popular VCS called Git. With Git all versions of your code will be available to you and your collaborators (in later labs this would be your pair-programming partner) anytime, anywhere! It will also help the course staff view your progress as you work on the assignments.

  1. Before we begin, read this article to get an overview of git: https://ucsb-cs56-pconrad.github.io/topics/git_overview/

  2. You will now create a git repo. The concept of a repo was explained in the article that you just read. New projects always start with this step. Since Github promotes “open source” projects, repos created under your default github account are public. This means that they are visible to everyone on the internet. However, for this class your assignments have to be “closed source”, and not open to your classmates and others on the internet. This requires that you create private repos. These are repos that are only visible to you, your pair-partner and the instructional staff. You can only create private repos within our class organization on github: ucsb-cs24-sp17. So, the next step is to join our class organization.

  3. Read this article on creating a github repo under an organization. Open a browser and navigate to our class organization on github: ucsb-cs24-sp17. Click on the green button that says “New repository”, and follow the steps from the “creating a github repo under an organization” article, to create a PRIVATE repo containing only a README.md and a .gitignore. See screenshot below:

new-repo

Your repo name should be lab00_your-github-username. For example if your github username is jgaucho, you should name your repo as lab00_jgaucho. Make sure you select the PRIVATE option when creating your repo.

  1. Check to see if you have the files: README.txt and .gitignore in your repo. If you don’t see these files, contact an instructor or ask for help on Piazza. To learn more about the .gitignore, read this article: About gitignore

  2. Use github’s web interface to edit the README file. In the README, add your and your partners name and perm number. If you don’t know how to do this yet, wait until I demonstrate it in the next lecture. You may proceed to the next step

  3. Upload your hello.cpp file. To do this step you should be physically present on a lab machine or in CSIL where you have access to a web browser and a local copy of your hello.cpp program. On your web browser, navigate to your repo on github. If your repo name is lab00_jgaucho, the link to the repo is: https://github.com/ucsb-cs24-sp17/lab00_jgaucho. Click on the “Upload files” button as shown below.

git-file-upload

You should see the following screen:

git-upload-hello

  1. Now either drag and drop the “hello.cpp” file from your machine or use the “Choose your files” option to browse through your local directory and upload the file. Then press the green “Commit new files” button. Navigate back to your repo to see that the hello.cpp file is correctly listed along with the other files. Click on it and you should see your code on github’s web interface. Continue to explore the web interface of your github repo. For example, try clicking on the “commits” link in your repo. What does that show you and what do you think it means?

Congratulations on completing your introductory exercise to github. We will continue to explore git in the subsequent assignments.