CSCI 4152/6509 Natural Language Processing. Lab 1: FCS Computing Environment

Similar documents
9 and 11-Jan CSCI 4152/6509 Natural Language Processing Lab 1: FCS Computing Environment, SVN Tutorial. FCS Computing Environment, SVN Tutorial

CSCI 2132: Software Development. Norbert Zeh. Faculty of Computer Science Dalhousie University. Subversion (and Git) Winter 2019

CSCI 2132 Software Development. Lecture 5: File Permissions

Department of Computer Science College of Engineering Boise State University

Computer Labs: Version Control with Subversion

27-Sep CSCI 2132 Software Development Lab 4: Exploring bash and C Compilation. Faculty of Computer Science, Dalhousie University

CS2720 Practical Software Development

30-Jan CSCI 4152/6509 Natural Language Processing Lab 4: Perl Tutorial 3. Perl Tutorial 3. Faculty of Computer Science, Dalhousie University

CSCI 2132 Software Development. Lecture 3: Unix Shells and Other Basic Concepts

Using Subversion with LeMANS and MONACO

Lecture 01 - Working with Linux Servers and Git

Computer Labs: Version Control with Subversion

Warmup. A programmer s wife tells him, Would you mind going to the store and picking up a loaf of bread? Also, if they have eggs, get a dozen.

We first learn one useful option of gcc. Copy the following C source file to your

Using CVS to Manage Source RTL

Managing your code: version control

Introduction: What is Unix?

Subversion. CS 490MT/5555, Fall 2015, Yongjie Zheng

Version Control System. -- base on Subversion 1.4

CSCI 4152/6509 Natural Language Processing Lecture 6: Regular Expressions; Text Processing in Perl

Chapter 3. Revision Control

Working with GIT. Florido Paganelli Lund University MNXB Florido Paganelli MNXB Working with git 1/47

Versioning. Jurriaan Hage homepage: Slides stolen from Eelco Dolstra.

Yinghui Wang

Dalhousie University CSCI 2132 Software Development Winter 2018 Lab 8, March 22

Introduction to the UNIX command line

CSC111 Computer Science II

Apache Subversion Tutorial

CSE 374 Programming Concepts & Tools. Hal Perkins Winter 2012 Lecture 16 Version control and svn

Contact No office hours, but is checked multiple times daily. - Specific questions/issues, particularly conceptual

SECTION 2: CODE REASONING + PROGRAMMING TOOLS. slides borrowed and adapted from Alex Mariakis and CSE 390a

Intermediate Programming, Spring Misha Kazhdan

Section 2: Developer tools and you. Alex Mariakakis (staff-wide)

Exercise 1: Basic Tools

CSCI 2132 Software Development. Lecture 4: Files and Directories

Computational Physics Compiling a C++ program

And check out a copy of your group's source tree, where N is your one-digit group number and user is your rss username

CSCI 4152/6509 Natural Language Processing. Lab 3: Perl Tutorial 2

CS 261 Recitation 1 Compiling C on UNIX

Lab 1 Introduction to UNIX and C

LAB 0: LINUX COMMAND LINE AND SVN

Submitting your Work using GIT

CSE 160: Introduction to Parallel Computation

MNXB Working with SVN. Florido Paganelli Lund University Tutorial 2b

TDDC88 Lab 4 Software Configuration Management

Introduction to the Linux Command Line

Agenda. - Final Project Info. - All things Git. - Make sure to come to lab for Python next week

Subversion FOUR. 4.1 What is Version Control? 4.2 What is Subversion? Types of Version Control SESSION

Version Control Systems

Oregon State University School of Electrical Engineering and Computer Science. CS 261 Recitation 1. Spring 2011

Lab 1 Introduction to UNIX and C

CS CS Tutorial 2 2 Winter 2018

Systems Programming Advanced Software Development

18-Sep CSCI 2132 Software Development Lecture 6: Links and Inodes. Faculty of Computer Science, Dalhousie University. Lecture 6 p.

Git Guide. Meher Krishna Patel. Created on : Octorber, 2017 Last updated : October, More documents are freely available at PythonDSP

Version Control with Git

2 Initialize a git repository on your machine, add a README file, commit and push

Linux hep.wisc.edu

2/9/2013 LAB OUTLINE INTRODUCTION TO VCS WHY VERSION CONTROL SYSTEM(VCS)? II SENG 371 SOFTWARE EVOLUTION VERSION CONTROL SYSTEMS

Version Control Systems (VCS)

Software Project (Lecture 4): Git & Github

Version Control. Second level Third level Fourth level Fifth level. - Software Development Project. January 17, 2018

CPS109 Lab 1. i. To become familiar with the Ryerson Computer Science laboratory environment.

CS Operating Systems, Fall 2018 Project #0 Description

Files and Directories

Using WestGrid from the desktop Oct on Access Grid

User Guide Version 2.0

Using Subversion for Source Code Control

Source Control: Perforce

Apache Subversion (SVN)

Source Control. Comp-206 : Introduction to Software Systems Lecture 21. Alexandre Denault Computer Science McGill University Fall 2006

Saint Louis University. Intro to Linux and C. CSCI 2400/ ECE 3217: Computer Architecture. Instructors: David Ferry

Revision Control. An Introduction Using Git 1/15

Part I Part 1 Version Control Systems (VCSs)

Managing Source Code With Subversion

What is version control? (discuss) Who has used version control? Favorite VCS? Uses of version control (read)

Part I Part 1 Version Control Systems (VCSs)

Part I Part 1 Version Control Systems (VCSs)

Part I Part 1 Version Control Systems (VCSs)

Apache Subversion (SVN)

1/20/13 Git tutorial. Git tutorial. Mike Nolta. file:///users/nolta/github/reveal.js/git.html?print-paper#/ 1/31

Part I Part 1 Version Control Systems (VCSs)

CS Fundamentals of Programming II Fall Very Basic UNIX

A Short Introduction to Subversion

[Software Development] Development Tools. Davide Balzarotti. Eurecom Sophia Antipolis, France

Getting Started with UNIX

Introduction to Revision Control

Version Control Systems. Copyright 2017 by Robert M. Dondero, Ph.D. Princeton University

Version Control. CSC207 Fall 2014

Common Configuration Management Tasks: How to Do Them with Subversion

Revision Control. Software Engineering SS 2007

An Introduction to Subversion

CS480. Compilers Eclipse, SVN, Makefile examples

Lab 3a Using the vi editor

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University

Portions adapted from A Visual Guide to Version Control. Introduction to CVS

Version Control Systems

Parallel Programming Pre-Assignment. Setting up the Software Environment

CS 246 Winter Tutorial 1

CMSC 201 Spring 2017 Lab 01 Hello World

Transcription:

CSCI 4152/6509 Natural Language Processing Lab 1: FCS Computing Environment http://web.cs.dal.ca/ vlado/csci6509 Lab Instructor: Dijana Kosmajac, Dhivya Jayaraman Slides copyright: Mike McAllister, Vlado Keselj, Magdalena Jankowska Faculty of Computer Science Dalhousie University 12-Jan-2018 (1) CSCI 4152/6509 1

Lab Overview An objective: Make sure that all students are familiar with their CSID and how to login to the bluenose server Refresh your memory about Linux Command-Line Interface Introduction to Perl (just hello world for now) Introduction to your SVN repository for the course Note 1: Replace csuserid with your FCS CS user id (a.k.a., CSID) Note 2: If you do not know your CSID, lookup at: https://www.cs.dal.ca/csid 12-Jan-2018 (1) CSCI 4152/6509 2

Step 1: Logging in to server bluenose You can choose Windows, Mac or Linux environment in some labs Windows: you will use PuTTY program On Mac: open a Terminal and type: ssh csuserid@bluenose.cs.dal.ca (instead of csuserid use your CS userid ) On Linux: similarly to Mac, you open the terminal and type the same command: ssh csuserid@bluenose.cs.dal.ca 12-Jan-2018 (1) CSCI 4152/6509 3

Running PuTTY If you use Windows, then one option is to use PuTTY to login to the bluenose server Double-click the PuTTY icon, and the following window should appear: 12-Jan-2018 (1) CSCI 4152/6509 4

12-Jan-2018 (1) CSCI 4152/6509 5

Review of Some Linux Commands Step 2: pwd Step 3: mkdir csci4152 or mkdir csci6509 ls chmod go-rx csci6509 or chmod go-rx csci4152 Step 4: cd csci6509 or cd csci4152 Make directory lab1 and change your current directory to it. 12-Jan-2018 (1) CSCI 4152/6509 6

Step 5: Using emacs prepare hello.pl Use an editor: emacs or some other (e.g., vi, pico... ) #!/usr/bin/perl print "Hello world!\n"; Step 6: Running a Perl program perl hello.pl Another way to run the program: chmod u+x hello.pl./hello.pl 12-Jan-2018 (1) CSCI 4152/6509 7

Source Control with SVN In this tutorial, you will learn or refresh your knowledge about SVN. Performing these steps will be graded as a part of an assignment SVN will be used for assignment submission It is possible that not all students have the course SVN repository. In that case, let the instructor know. You will be able to finish the tutorial next week. This tutorial is slightly modified version of the SVN tutorial Source Control with SVN prepared by Michael McAllister for CSCI 3171. 12-Jan-2018 (1) CSCI 4152/6509 8

Source Control with SVN Subversion (or SVN) source control system SVN can be accessed using command line interface on bluenose (Linux system); similarly on Mac GUI interfaces exist (including Windows) Development companies use some form of source control SVN is relatively popular, open-source system git is another newer open-source system (e.g., used for Linux kernel) Some commercial software: Perforce and ClearCase Predecessors: SCCS, RCS, CVS 12-Jan-2018 (1) CSCI 4152/6509 9

1. checkout projects in SVN Objectives 2. add a subproject (subdirectory) to SVN 3. add, delete files in SVN; and commit your changes 4. change files in SVN, and merge changes from different copies 5. resolve conflicts that may result from parallel changes 6. revert changes and retrieve older versions of the files 12-Jan-2018 (1) CSCI 4152/6509 10

Repository and Working Copy SVN uses remote directory system called repository to store files and history of their changes You can review changes and retrieve older versions Files can be shared among users and SVN can be used for collaborative work SVN uses notion of working copy of the files We send (or commit) files to the repository when we are happy with their state For example, we generally do not commit program unless they can be compiled 12-Jan-2018 (1) CSCI 4152/6509 11

A Couple Notes Replace csuserid with your CS user id (a.k.a., CSID) Important Security Note: Each time that you enter an SVN command in this lab, you will be asked for your bluenose password. Enter it. When asked if you want to store the password, answer no each time, since the password is not stored safely currently. If you are sure that you know what you are doing, you may temporarily say yes to make SVN use easier, but then make sure that only you have access permissions to the the directory./subversion, and it is a good idea to delete the whole directory after each session. 12-Jan-2018 (1) CSCI 4152/6509 12

Step 1: Set-up Before SVN Tutorial Log into bluenose in two different windows (use putty twice (windows) or ssh from two terminals (mac os)). Call one window your primary window and the other window your secondary window. In your course directory in subdirectory lab1, create two subdirectories, one called primary and another called secondary. In your primary window, make primary the working directory. In your secondary window, make secondary the working directory. 12-Jan-2018 (1) CSCI 4152/6509 13

Step 2: Checkout and Adding a Directory We use checkout command to retrieve a working copy In your primary window run (in one line): svn checkout https://svn.cs.dal.ca/nlp-course/csuserid You will be asked to enter the password Change directory using: cd csuserid List directory using: ls -a Notice.svn directory Create directory: mkdir svnlab Add it to the repository: svn add svnlab You should see output: A svnlab 12-Jan-2018 (1) CSCI 4152/6509 14

Step 3: Commit Command The svnlab directory is not in the repository yet We must execute commit to send it to the repository (all in one line): svn commit -m "Creating a project for my SVN lab" You should see the output: Adding svnlab Committed revision 2. Check the following URL using your browser: https://svn.cs.dal.ca/nlp-course/csuserid/svnlab 12-Jan-2018 (1) CSCI 4152/6509 15

SVN Log Messages -m "xx" part adds a message to the repository All commit commands require a log message 12-Jan-2018 (1) CSCI 4152/6509 16

Step 4.a: Adding Files: Preparing Files Create a file name hello.pl with the following content: #!/usr/bin/perl print "Hello world!\n"; Create two copies of this file: cp hello.pl hello2.pl cp hello.pl tmp.pl 12-Jan-2018 (1) CSCI 4152/6509 17

Step 4.b: Adding Files Add two files: svn add hello.pl hello2.pl We see the output: A A hello.pl hello2.pl Run command: svn status Output: A hello.pl A hello2.pl? tmp.pl 12-Jan-2018 (1) CSCI 4152/6509 18

Step 4.c: Adding Files: Commit Commit files (one line): svn commit -m "Adding the first version of my sample files." Enter: svn status Output:? tmp.pl 12-Jan-2018 (1) CSCI 4152/6509 19

Step 5: Deleting Files (5.a) Delete a file: svn delete hello2.pl Output: D hello2.pl Enter: svn status Output:? tmp.pl D hello2.pl 12-Jan-2018 (1) CSCI 4152/6509 20

Step 5.b: Deleting a File (2) Enter in one line: svn commit -m "File hello2.pl was added by mistake earlier. It was just a backup copy of hello.pl" The file is deleted, but it can be retrieved from the repository 12-Jan-2018 (1) CSCI 4152/6509 21

Step 6: Checking out Second Copy Go the secondary window and make sure you are in the directory:... /lab1/secondary/ You can check this using command: pwd In secondary window get the second working copy: svn checkout https://svn.cs.dal.ca/ nlp-course/csuserid/svnlab Change directory: cd svnlab List the contents: ls -la 12-Jan-2018 (1) CSCI 4152/6509 22

Step 7: Changing Files (7.a) In your primary window edit hello.pl to become the following file: #!/usr/bin/perl for my $i (1..10) { print "Hello world!\n"; } Run: svn commit In the secondary window run: svn update Verify that the file has been updated 12-Jan-2018 (1) CSCI 4152/6509 23

7.b: Modifying a File In your primary window: edit your copy of hello.pl and change the for loop to iterate 15 times rather than 10 tiems, and save the file. Run: svn status You should get the following output: M hello.pl? tmp.pl M indicates that the file has some modifications which are not in the repository 12-Jan-2018 (1) CSCI 4152/6509 24

Step 7.c: svn diff command Run: svn diff hello.pl Output will show differences between working version and repository version Commit the change: svn commit -m "Use a longer loop iteration" Try again svn diff hello.pl No output. Why? In the secondary window look at hello.pl 12-Jan-2018 (1) CSCI 4152/6509 25

Step 7.d: Update In the secondary window run: svn update Output: Updating. : U hello.pl Updated to revision 36. U means that there is a more recent copy in the repository Check again file hello.pl 12-Jan-2018 (1) CSCI 4152/6509 26

Step 7.e: Delete Let us remove a file: rm hello.pl Check that it does not exist: ls (Still in secondary window) Run: svn status Output:! hello.pl! is an indicator that the file is missing Run: svn update The file hello.pl is restored 12-Jan-2018 (1) CSCI 4152/6509 27

Step 7.f: Parallel Changes Let us change hello.pl in both windows: In primary window add a print statement before the loop: print "I am about to start the loop\n"; In secondary window add a print statement after the loop: print "I have finished the loop\n"; In each windows use svn status to verify that the working file is different from the repository copy (indicator M) 12-Jan-2018 (1) CSCI 4152/6509 28

Step 7.g: Merging Changes In primary window commit changes, e.g.: svn commit -mprimary Try to commit changes in secondary window, e.g.: svn commit -msecondary Commit fails since the repository copy changed since our last update Run: svn update Output: G hello.pl Updated to revision 37. G indicates that changes have been merged 12-Jan-2018 (1) CSCI 4152/6509 29

Step 7.g (cont): Merging Changes (Still in secondary window) Edit file hello.pl to make sure you are happy with merged changes Run: svn commit -m"merged changes" This will submit merged changes to repository In both windows run: svn update Now both windows contain the latest copy in repository 12-Jan-2018 (1) CSCI 4152/6509 30

Step 7.h: Conflicting Changes In primary window change hello.pl so that the loop iterates 30 times Commit the change In secondary window change hello.pl so that the loop iterates 5 times Try to commit the change Similarly as before commit fails, so we need to do update first Run svn update However, changes are not merged this time 12-Jan-2018 (1) CSCI 4152/6509 31

We get the following message Conflict discovered in hello.pl. Select: (p) postpone, (df) diff-full, (e) edit, (mc) mine-conflict, (tc) theirs-conflict, (s) show all options: df see differences, or different options of editing or fixing the file Let us choose to postpone, enter: p We can see now several files in secondary window by running: ls The files are (likely with different version numbers): hello.pl the hello.pl file with the diff information embedded hello.pl.mine your modified code hello.pl.r38 the original copy of the code that you modified in this working directory (revision 38) hello.pl.r39 the most recent version of the code in the repository (revision 39) 12-Jan-2018 (1) CSCI 4152/6509 32

Step 7.i: Examining Conflict (Still in secondary window) Run status command Output will include line: C hello.pl C indicates conflict that needs to be resolved Examine the log using log command: svn log hello.pl The output shows log messages (which demonstrate why it is useful to write descriptive log messages) Additional information can be obtained using diff command: svn diff hello.pl A part of the output is: +<<<<<<<.mine +for my $i (1..5) { +======= for my $i (1..30) { +>>>>>>>.r39 12-Jan-2018 (1) CSCI 4152/6509 33

Step 7.j: Resolving Conflict Fix hello.pl file. Usually, you can either: Edit hello.pl directly (delete extra lines, etc.) Choose our version: cp hello.pl.mine hello.pl Choose repository version: cp hello.pl.r39 hello.pl Choose original last updated version: cp hello.pl.r38 hello.pl We can simply choose: cp hello.pl.mine hello.pl To indicate that the conflict has been resolved, and hello.pl is the version that we want submitted to the repository, we issue svn resolved command: svn resolved hello.pl Other files (hello.pl.mine and hello.pl.rx) are removed Finally, we commit the change: svn commit -m"conflict resolved" 12-Jan-2018 (1) CSCI 4152/6509 34

Step 8: Retrieving copies of previous work 8.a: Sometimes we make changes to a program and want to undo them It is useful to make commit each time we reach a stable point Aside: If collaborating with someone, it is useful to do frequent updates and commits In secondary window: Introduce error in file hello.pl; e.g., change word print to pprint Save the file but do not commit Suppose that we want to undo the change to the last saved copy in the repository. We already know three options: make checkout elsewhere and get the fresh copy from there delete hello.pl and run update use diff to identify changes and manually reverse them All these involve unnecessary work; much easier: svn revert hello.pl 12-Jan-2018 (1) CSCI 4152/6509 35

Step 8.b: Retrieving Older Versions How to retrieve older versions of a file? We can use -r option with the update command: svn update -r 34 hello.pl We can use log command (svn log hello.pl) to find interesting revision numbers Check the contents of hello.pl If you change this file and try to commit, it will not work as a newer version is in the repository. You would need to make an update, and likely resolve any conflicts. Instead, simply run: svn update This will get the latest version from the repository 12-Jan-2018 (1) CSCI 4152/6509 36

Step 8.c: Retrieving by Timestamps Sometimes we do not know exact revision number, but we know time when the directory was last stable. We can specify time to retrieve the latest version that existed at this time For example: svn update -r "{2014-01-22 13:00:00}" 12-Jan-2018 (1) CSCI 4152/6509 37

Step 9: End of the Lab After finishing with commits, you can even delete primary and the secondary directory, since all required updates are submitted to the SVN. If you want, you can still keep them until Assignment 1 is marked, just to be sure. To delete the directories, you will need to be in their parent directory, and use the command rm -r primary secondary End of the lab. 12-Jan-2018 (1) CSCI 4152/6509 38