Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
ComputerSystemsOrganizationRecitation
CSCI-UA0201-007
R01:Introduction&EnvironmentSetup
ManyslidesarebasedonJohnWesthoff’s Fall2019CSOrecitation
Beforewegetstarted
• Gotohttps://nyu-cso.github.io/labs/ andstartthedownloadfortheversionofVirtualBox relevanttoyou• StartthedownloadfortheclassVMimage
2
LogisticsImportantthingsyoushouldknow
3
Whatisthisrecitationfor?
• Helpyoubetterunderstandthecoursecontents,includingbutnotlimitedto:- Reinforcethisweek’slecturecontent- Reviewpreviousweek’sassessment- Someexercisesmeanttohelpwiththelabs/assessments
• Makeusallsufferbyforcingusoutofbedearly
4
Wherewereleasecoursematerials
• Coursewebsite- https://nyu-cso.github.io/- Recitationslidesalsoonthecourseschedulepage
• NYUClasses- Zoomlinks/recording
• CampusWire- It’syourresponsibilitytoreadInstructor’sNoteonCampuswire- YouareencouragedtoaskquestionsonCampuswire
• GitHub- AlllabsarereleasedonGitHub- YouwillsubmitalllabsonbothGitHubandGradescope
• Gradescope- Weeklymini-quizonGradescope
5
Howtocontactus
• Don’tbeafraidtoaskquestions!• Ifyouhavegeneralquestionsaboutcoursecontentsorlabs
- AskonCampuswire- Cometoofficehours- Registerthein-personrecitation
• Ifyouwanttosendusaprivatemessage- [email protected]
- Includeyourname,yourGitHubusername,andyourNYUNetID
Ifyouwantmorepersonaltutorialorquestionanswering
6
Howarewegoingtoproceed?
• Forthefirsttwoweeks,wewillfocusonenvironmentsetups,usageofbasictools,etc.- Todaywewillcoverenvironmentrelatedsetups- Nextrecitationwillcoverprogrammingtools(6labs,bonus)
• Fromthethirdweek- Wewillreviewweeklyassessment,reinforcesomecoursecontents,exercisestoprepareforyourlabs
• WeeklyassessmentswillbedueFriday9pmEST- DoneonGradescope,doitearly- Nolatesubmission
7
AcademicIntegrity
• Allworkmustbeyourown– donotcopyorevenlookatassignmentsdonebyothers- Don’taskStackOverflow orChegg forhelp- ifyouneedit,askus!- Don’thiresomeonetodoyourworkforyou
• WereservetherighttousesoftwareplagiarismdetectiontoolssuchasMoss• It’snotworththerisk,justdon’tcheatandmakeussad
8
GettingStartedImportantthingsyoumustdo
9
Today’sTopics
• Settingupyourvirtualmachine• Settingupyourgit repositories• BasicUnixcommands• Programdevelopment• Editor(Sublime)• Versioncontrol(Git)
10
Today’sGoal
• Bytheendoftoday’srecitation,yourshould• Havetheclassvirtualmachineinstalled• HaveGitHubreadyforyoutosubmitwork
• Anaccount• Lab-1repository• Knowhowtosubmitassignments
11
Basicvirtualmachinesetup
• Followhttps://nyu-cso.github.io/labs/ instructionsto• DownloadVirtualBox 6.0.10• DownloadourVirtualBox image• LaunchVirtualBox andimporttheimage• LaunchLubuntu Linux
• Username“lab”,password“lab12345”
12
AdvancedVMsetup
• Afterfinishingthebasicsetup,youaregoodtogo• Butifyouwantto• ResizetheVMwindowtofullscreennicely• CopyandpastebetweentheVMandyourlaptop• MovefilesbetweenyourlaptopandtheVM
• ThencheckourtheLabinstructionpage!• https://nyu-cso.github.io/labs/• Recommendit!
13
Attention: YouMUST testyourcodeinyourclassvirtualmachine• Werecommendyoutodoyourlabsinyourvirtualmachineweprovidetoyou,andtestitbeforesubmission• MoretoolsareavailablefordebugginginVM(gdb etc.)• Gradescope runsthesametestscript• Ingeneral,thereshouldbenosurprises
• Ifyouchoosetodoyourlabsoutsideoftheclassvirtualmachine,wewillnotprovideanytechnicalsupportshouldyouencounteranyOS-relatedissuesindoingthelabs
14
Openupaterminal
• Clickthe“LXterminal”icononthedesktop• ORclickstarticon(thebottomlefticon)• Click“SystemTools”andthen“LXterminal”
• ORusethekeyboardshortcut• Ctrl+Alt+T
• Tocopypasteinaterminal,youneedtouse• Ctrl+Shift+Ctocopy• Ctrl+Shift+Vtopaste• Orjustrightclick
15
BasicCommands
• Someusefulcommandstoknow:• man• ls,cd,pwd,mkdir• cp,mv,rm• echo,cat• wc• grep• ctrl-c,ctrl-d,ctrl-z,fg,bg• |,>,<,>>• aptinstall/search• history,ctrl-r
16
BasicCommands
• Wheneveryouwanttofindouthowtodosomethingusingcommandline,askGooglefirst• Hereisalinkcontainsusefulcommand,forbothbeginnersandexperiencedusers:• https://github.com/jlevy/the-art-of-command-line
17
Editor
• Youneedagoodeditortocodewithforproductivity• Populareditorsusedbyprogrammers:• vim• emacs• vscode• sublime
• WerecommendyouuseSublimeText• WhichshouldbealreadyinstalledontheVMimage
18
SetupGitHub/lab1repo
• CreateaGitHubaccountifyoudon’thaveone• WehavecreatedforyouacorrespondingprivatelabrepositoryonGithub.com• EnrollyourselfintheGitHubclassroom• Createyourlab-1repositorybyclickingthelinkbelow
• https://classroom.github.com/a/RvmnAdGI• SelectyourNYUNetID
• Veryimportant!• Don’tselectsomeoneelse’sNetID!
• IfyoucannotfindyourNetID,letmeknow!
19
Git Overview
• Distributedversioncontrol system• Whatisversioncontrol?• Manageschanges todocuments,sourcefilesandothercollectionsofinformation
• Whyisversioncontrolindispensable?• Historytracking:trackcodechanges• Rollbacktoolderversion• Collaborate withothers(collaborativehistorytracking)
• Wearegoingtousethepopular“Git”asourversioncontrolsystem
Create things
Save things
Edit things
Savethethingagain
20
Youneedtoconfig git first!
• git config --globaluser.email “<YourEmail>”• git config --globaluser.name “<YourName>”• Youcanissue“git config --list”tocheckyourconfiguration• Here,the<YourEmail> shouldbetheoneassociatedwithyourGitHubaccount
21
Alistofgit commandsyouneed
• git clone• git status• git remote• git add<filename>• git commit-m<commitmessages>• git pushoriginmaster• git pullupstreammaster
22
Git Overview
• GitHub:• provideshostingforsoftwaredevelopmentandversioncontrolusingGit.
YourVM
Makechangeslocally
SubmitassignmentstoGitHub
PullassignmentsfromGitHub(clonelabrepo)
GitHub
23
Cloneyourlabrepolocally
• Incommandline,type:• mkdir cso-labs• cdcso-labs• git clonehttps://github.com/nyu-cso-fa20/clab-part1-<YourGithubUsername>.git lab1• Ifyoucopytheabovecommandtocommandline,don’tletthelinebreak• Replace<YourGitHubUsername>(includingtheanglebrackets)withyourGitHubusername.
• cdlab1
24
Git SetupTheremotecopyisstoredinsomeefficientformat
25
Acloserlookatyourlocalrepository
Localrepository26
HowtointeractwithGit
• git addhello_world.c• Tellgit totrackchangestohello_world.c
• git commit• Storetrackedfileto.git
• git pushoriginmaster• Submitcommitstoyourremoterepository
27
Foreachnewassignment
• CreatelabrepoonGitHub(clicklink,selectyourself)• Cloneyourlabrepolocally
• cdcso-labs• git clonehttps://github.com/nyu-cso-fa20/clab-part1-<YourGithubUsername>.git lab1
• ThenmakechangeslocallyintheVM• Tellgit totrackchanges
• git addfilenames
• Commityourchanges• git commit-m“commitmessages”
• Pushtoyourremoterepository(onGitHub)• git pushoriginmaster
28
Git commit
• Whenyouissue“git commit”,youneedtoprovideamessagewhichisashortdescriptionofthechangesyoumade• Youcanuse“-m”optiontoprovidethecommitmessage• E.g.:git commit-m“myfirstcommit”
• Ifyoudon’tuse“-m”option,ancommandlineeditorwillpopupforyoutoeditthecommitmessage• Bydefault,nano
29
HowtogetoutofNanoEditor
• ThedefaulteditoriscalledNano
• Toaddacommitmessagefromnano• Firsttypeinsomecommitmessage• HitCtrl+O tosaveyourcommitmessage(^meansCtrl)• HitCtrl+X toexit
30
Doublecheckwith“git status”
• Sometimes,youmightforgettodosome(orall)of• git add,git commit,git push
• It’salwaysgoodtocheckthestatusofyourrepository• git statustellsyou• Whatfilesaregoingtocommit• Whatfilesarenottracked• Whetheryouforgettopushcommitstoremote
31
TriplecheckwithGitHub
• Stillnotsure/confidentaboutwhetherassignmentwassubmittedproperly?• Gotogithub.com,thengotoyourrepo• Manuallycheckifeveryfilecontainstheup-to-dateinformation
32
Git ismuchpowerfulthanthat
• Ourgit introductiononlycoversasmallpartofGit• Git tutorial:• https://www.atlassian.com/git/tutorials/what-is-versioncontrol• https://try.github.io/levels/1/challenges/1
33
Allthegit commandsyouneedforCSO
• Forbeginners,it’ssupereasytomessupGit• Aftersettinglabrepository,youONLYneedtousethefollwing gitcommands:• git addfilenames• git commit-m“commitmessage”• git pushoriginmaster• git cloneyour-lab-repolab• git status
Warning:unlessyouknowwhatyouaredoing,donotuseanyothergit commandsorgit commandflags
34
Askthestaffforhelp
• Ifyoureallycannotfixconflictsorothergit problems,youshouldaskcoursestaffforhelp• Youneedtoemailthestafforattendofficehours
• Onlinemakesthingsharder..• Youshouldstartyourlabearlier
• Don’trandomlyissuecommandstofurthermessthingsup
35
ThingsyoushouldNEVER do
• Don’tusegit add*,git add.• Instead,youshouldalwaysspecifythefilenamesyouwanttocommit• Pleasedon’taddcompliedprogramstogit
• Don’tmodifyanyfileusingGitHubwebsite• Instead,youshouldalwaysmakechangeslocallyonyourlaptopandthenpushcommitstoGitHub• Otherwise,therewillbeconflicts,whichwillleadtosadness
36