Welcome to EEB C177 - Practical Computing for Evolutionary Biologists and Ecologists

Contact Information

Shawn Schwartz

Graduate Student UCLA Ecology and Evolutionary Biology

  • Email: shawnschwartz@ucla.edu
  • Office Hours: Tuesdays, 11am-1pm (after lecture)
  • Location: Terasaki 2154

Course Etiquette

Community agreements:

  • We aim to cultivate cooperative and constructive conversations
  • Please be respectful
  • Take turns speaking and do not talk over other students

Lab Attendance Policy

  • Lab attendance is mandatory to receive full credit towards your grade
  • Please be on time!
  • This time is critical to ask questions and to actively work on solving problems
  • No absences will be excused unless adequate documentation is provided
  • So please plan appointments, interviews, etc. accordingly and not during our scheduled lab time

Sharing of Course Materials

Very important for this class!

Please remember that you are not allowed to upload or share any class content not created by you onto third-party sites and/or with anyone not enrolled in the course. The unauthorized redistribution which includes, but is not limited to, providing course materials such as the course syllabus, homework, examinations, course Power Points, and course notes, to online websites, commercial entities, and test banks without the consent of the course instructor may be considered a violation of Section 102.23/102:23a of the UCLA Student Conduct Code, and may result in disciplinary action, including but not limited to, suspension from the University.

What is a programming language?

https://blog.malwarebytes.com/security-world/2012/09/so-you-want-to-be-a-malware-analyst/ https://blog.malwarebytes.com/security-world/2012/09/so-you-want-to-be-a-malware-analyst/

Debunking myths about coding

The Mindset of a Programmer

Virtual Machines

https://www.bmc.com/blogs/containers-vs-virtual-machines/ https://www.bmc.com/blogs/containers-vs-virtual-machines/

Getting Started: Virtual Machines

  • Step 1: Google search “VirtualBox” and download the version for your device (Mac or Windows)
  • Step 2: Install VirtualBox
  • Step 3: Take the file you downloaded that I shared with you via email yesterday and follow along – (The file that you downloaded was a virtual image of Ubuntu that we will be using for this course) – I have prepared this image by installing all of the necessary software for you – This is important so that we are all using the same versions and distributions of software for compatibility and reusable code (this is not the only way to ensure this, but is helpful in a small setting such as our class)!

Logging in to the course Virtual Machine

username: eebc177student

password: bruin1919

Version Control

What is version control?

  • the task of keeping a software system consisting of many versions and configurations well organized
  • Why do you think version control would be important?

Open Source

What does open source mean?

  • denoting software for which the original source code is made freely available and may be redistributed and modified

Git and GitHub

Git is a distributed version-control system for tracking changes in source code during software development. It is designed for coordinating work among programmers, but it can be used to track changes in any set of files. (-Wikipedia)

Git and GitHub

Github is a web-based hosting service for version control using Git. It is mostly used for computer code. It offers all of the distributed version control and source code management (SCM) functionality of Git as well as adding its own features. It provides access control and several collaboration features such as bug tracking, feature requests, task management, and wikis for every project. (—Wikipedia)

Getting Started: Version Control with GitHub

You will all make a GitHub account to store your Git repositories (repos) for this course!

  • Step 1: Go to https://github.com and make a profile (choose an identifiable username, perhabs firstlast)
  • Step 2: Go to my GitHub profile @ShawnTylerSchwartz
  • Step 3: Follow me and star the “eeb-c177-w20” repo (this will help me keep track of you and all of your assignments)

Class Website

Questions and Issues with Code

  • When you have a question or run into an issue with your code, DO NOT EMAIL ME
  • Instead, using the discussion forum (the “Issues” tab of the course website repo on GitHub)
  • I have added a shortcut link on the menu bar of our course website if you have trouble finding it on GitHub
  • I will check the “Issues” tab once per day to answer questions on it
  • Should I somehow forget or miss your issue 24 hours after you have posted it, feel free to send me an email to remind me! :)
  • I want everyone to learn from each other, which is why it is better to post all questions and issues there.
  • Important: Please be descriptive when posting and include as much reference code as possible to help me debug and answer your issues.

Making your first GitHub Repo

Follow along with me as we create our “eeb-c177-homework” repo on the GitHub website.

  • These Git repos will serve as a backup of all your code and projects.
  • You will make commits which are timestamped snapshots of your code at a period of time.
  • All commits are timestamped and tracked with descriptions.

Interfacing with Git via the command line (Terminal)

  • We will go over the different types of command line interfaces and Unix later on in the course
  • Yet, with us all using a Unix-based terminal, the commands will work similarly to that of Mac (sorry Windows)
  • This is one reason we are using a Virtual Machine for coursework!

Configuring Git to your GitHub profile

  • Open your Terminal in your Virtual Machine.
    git config --global user.name "YOUR NAME"
    git config --global user.email "YOUR EMAIL ADDRESS"
    

Interfacing with Git via the command line (Terminal)

  • Opening your terminal should default into your “home” or “user” directory
  • You should make a directory (folder) to save all of your Git repos in
  • Let’s make a “repos” directory inside of a “Developer” directory

Your first shell commands

  • mkdir -> make new directory (equivalent to right-click, “New Folder”)
  • cd -> change directory
  • pwd -> print working directory

In your home-user directory

mkdir Developer
cd Developer
mkdir repos
cd repos

Cloning a repository

You are now inside of your “repos” directory at ~/Developer/repos/

~> Now we will clone (essentially copy the repo to our computer):

  • git clone https://github.com/username/eeb-c177-homework.git

Cloning a repository

You will now see that a directory exists in your current directory (in our example, the developer directory) entitled “eeb-c177-homework”.

In order to see the list of files in a directory that you’re in from the terminal, type ls, which will list the contents of the current directory.

  • cd eeb-c177-homework
  • ls
  • What do you see inside of the directory?

Working inside of a repository

  • Git uses a tree structure for organization, and branches can serve to separate elements of a large project, especially when collaborating with others in a repository
  • The tip of the tree is the “master” branch, which is where your final code should end up
  • We aren’t going to work with branches yet, so we’ll be working right within the master branch to start off with
  • If you would like to learn more about how to use branches this week, come to my office hours tomorrow and I will demonstrate it

Working inside of a repository

  • First, let’s check the status of our repo: git status
  • What does it say?
  • Now let’s add an empty file: touch test_file.txt
  • Now let’s add some content to that file: nano test_file.txt (write some random stuff)
  • type “control+O” on your keboard to write out (i.e., save) the file
  • type “control+X” to exit editing this file (i.e., quit)

Working inside of a repository

  • Now, let’s take a snapshot of this repo and upload to GitHub
  • The following is a standard procedure used to “commit” and “push” changes to a remote repository (i.e., GitHub)
  • git add -A (will add all untracked files for a commit)
  • git commit -m "Your message here" (-m is a flag to tie this commit with your message)
  • git push origin master (origin is automatically set to the GitHub repo, and master is the branch we want to push to)
  • now check GitHub to see if these changes went through
  • git log will show you a brief history of your git repo and commits

All together, the process looks as follows in your Terminal:

 git add -A
 git commit -m "Your message here"
 git push origin master

More Git Configurations

  • Git will require you to enter your GitHub password each time you push
  • We can “cache” your password in memory to avoid typing it many times
git config --global credential.helper cache #(set Git to use credential memory cache)
git config --global credential.helper 'cache --timeout=3600' #(cache timeout after 1 hour (in secs))

Now let’s make some changes

  • let’s delete the test file with rm test_file.txt
  • then make a directory for labs with mkdir lab-exercises
  • then, cd lab-exercises, and mkdir week-one and cd week-one
  • nano food-log.txt

First Lab Homework Assignment

  • You will keep a food log/journal for the next 5 days (starting this afternoon) using this file
  • You must make 10 commits separated by at least 6 hours (i.e., 2 commits per day) M-F this week
  • Each time you update the food log, make a add, commit, and push changes to GitHub
  • Each commit is worth 10% of your grade for lab homework this week
  • I will be checking each of your GitHub repository’s commit logs to grade you (remember, they are all timestamped), so I should see a total of 10 commits over the next 5 days (two per day) starting today
  • Update the food-log.txt file using the vim commands we practiced
  • Let’s work on our first one now for practice