Cse 3100 Lab 0
Cse 3100 Lab 0
Lab #0
Welcome to Lab 0! At the start of each lab, you will receive a document like this via HuskyCT detailing the task
you are to complete. Read it carefully. It should be possible to finish most labs during the lab period. However, labs
are not due after each lab period. Normally, lab assignments are due in 24 hours after the lab session starts. Lab
0, however, is due on Thur, 9/6/2018, at midnight.
This lab is intended to be interactive. Feel free to discuss the assignment with your neighbors. However, please recall
that all of your code should be your own! If you’re having trouble, feel free to raise your hand and ask your TA for
guidance!
After lab 0, you should be able to access your VM, use basic commands in shell (e.g. to copy/remove/rename
files), use git, edit text files like C source files, and compile and run simple C code.
For Windows and other OSs, instructions can be found on the UITS help page and the SoE help page. The domain
name of your VM is yournetid.3100.cse.uconn.edu (for example: abc11001.3100.cse.uconn.edu). Your user
name on the VM is your NetID. The password is your NetID password (the same one you use for HuskyCT). You
can only log into your own VM.
You can only access your VM from UConn network. If you would like to access it off campus, you can log into
ssh.uconn.edu first (and then ssh into your VM on ssh.uconn.edu), or use UConn VPN. See UITS help page on
VPN. You can also find other ways on UITS help pages for remote access.
The Shell
In the shell (most likely bash), try the following commands (and explore a bit!):
1
Git
This course will make heavy use of Git for managing assignments. You will receive your assignments via Git, and
you will submit all of your assignments via Git. You will receive feedback via Git as well. The full reference manual
can be found on the Git official site.
Initial git repository setup on the virtual machine. Start by telling git who you are by running
git config --global user.email "<yourname>@uconn.edu"
git config --global user.name "<Your Name>"
Then clone, i.e. get a copy of, the git repository we’ve set up for you by running the following command in the
home directory of your virtual machine:
git clone [email protected]:cse3100f18.<yournetid>
Git will dutifully create a directory called cse3100f18.<yournetid> that over the course of the semester will ac-
cumulate your labs and assignments in subdirectories like lab0, lab1, hw1, etc. You only need to perform these
initialization steps once.
Checking out assignments. Once you have cloned the repository, at the start of each lab or homework you will
need to checkout the provided template code. To do that you need to log into the virtual machine, change the
working directory to the git repository with:
cd cse3100f18.<yournetid>
then issue
git pull
This command “pulls” from the git server any updates that are pending for you. As soon as the command terminates
you should see new directories or files when you run the ls command. For instance, if you are about to start working
on assignment #1, running the pull command will create a new directory called “hw1” with all the files we share
with you. The updates will also include TA’s feedback on previous labs and assignments. You should run git pull
every time you log in to the VM. This will help prevent merge conflicts between commits. If you have any issues,
please notify your TA immediately!
Doing your work. After pulling the assignment you need to go to the corresponding directory using cd commands
and modify existing files and/or create new files (.c files, .h files, readme’s, make files, etc.) as required. Once done
you will need to 1) tell git about your changes; 2) commit the changes; and 3) push the changes to the master git
repository.
1) Staging the changes. If you’ve changed some files, created new ones, or deleted some files, you have to first add, or
stage, these changes for a commit. You can add single files by running
git add file_changed_or_created_or_deleted
You can include all modified files in a directory by using the following command in that directory
git add --all
You can check what files have been changed (and maybe should be committed) by doing
git status
2
2) Committing the changes. To commit the staged changes run a command like
git commit -m "I made some changes lab0!"
Make the message after -m as informative as possible. You can view all previous commits by doing
git log
3) Pushing the changes. Once you’ve committed some changes, you must run
git push
to have the changes ‘submitted’ to the server maintaining the master copy of your repository so we can access them.
If you do not add, commit, and push your work from the VM, we cannot grade it!
int main()
{
printf("Hello world!\n");
}
This is your first C program! Before your C code can be run, it must first be compiled. You can do so by running
cc myprogram.c
This will compile C code in a file called myprogram.c and will create an executable called a.out. You can optionally
specify the name of the executable
cc -o myexe myprogram.c
To run your program, do
./myexe
Please add, commit, and push your changes to myprogram.c so that we can see that you’ve successfully completed
this step!
Enjoy!
Please remember to add, commit, and push your changes! If you need assistance, ask your neighbor or your TA. If
myprogram.c or myname.c is listed when you do git status, or you see any commits waiting to be pushed, we don’t
have your code!