Loading...

Messages

Proposals

Stuck in your homework and missing deadline? Get urgent help in $10/Page with 24 hours deadline

Get Urgent Writing Help In Your Essays, Assignments, Homeworks, Dissertation, Thesis Or Coursework & Achieve A+ Grades.

Privacy Guaranteed - 100% Plagiarism Free Writing - Free Turnitin Report - Professional And Experienced Writers - 24/7 Online Support

Unix timeshare

09/01/2021 Client: saad24vbs Deadline: 10 Days

1


CMPS 12M Data Structures Lab Lab Assignment 1 The purpose of this assignment is threefold: (1) get a basic introduction to the Andrew File System (AFS) which is the file system used by the ITS UNIX timeshare, (2) learn how to create an executable jar file containing a Java program, and (3) learn to automate compilation and other tasks using Makefiles. Part 1: HELLO WORLD Start by creating a directory for this course. Fire up a terminal. (Let % denote the prompt.) Run: % cd ~/Desktop % mkdir CMPS12B % cd CMPS12B % pwd (You should see which directory you’re in. You’re free to create this directory anywhere, but follow the above if you’re not sure.) In this directory, create a file HelloWorld.java with the following text. //----------------------------------------------------- // HelloWorld.java // Prints "Hello world", the first program you should always write //----------------------------------------------------- class HelloWorld { static public void main(String[] args) { System.out.println("Hello world"); } } Go to a terminal, and get into the directory with this file. Run % javac HelloWorld.java % java HelloWorld You should see “Hello World” printed out. If not, you’ll need to install Java on your machine. Or, you can optionally work on the UNIX timeshare. Talk to the lab instructor for more directions. Part 2: AFS Learning a bit about AFS is useful in terms of knowing some typical OS/file-system operations. The UNIX time share systems are also a good option if you are having trouble with compiling and running Java or C programs on your laptop. The UNIX servers have all of the tools you need to complete all assignments for this class, although working on your own laptop can be more convenient and will also allow you to use a modern, graphical IDE. Logon to your ITS UNIX timeshare account at UNIX.ucsc.edu. If you don't know how to do this read the instructions at the URL below. You can also ask for help at a lab session but you should really figure this out on your own if possible. https://its.ucsc.edu/unix-timeshare/tutorials/how-to-connect.html


2


Create a directory cs12b with a subdirectory lab1. From within lab1 create a subdirectory called private, then set access permissions on the new directory so that other users cannot view its contents. Do all this by typing the lines below. The UNIX prompt is depicted here as %, although it may look different in your login session. Those lines without the UNIX prompt are the output of your typed commands. % mkdir cs12b % cd cs12b % mkdir lab1 % cd lab1 % mkdir private % fs setacl private system:authuser none % fs setacl private system:anyuser none % fs listacl private Access list for private is Normal rights: foobar rlidwka Here foobar will be replaced by your own cruzid. The last line of output says that your access rights to directory private are rlidwka which means: read, list, insert, delete, write, lock, and administer. In other words you have all rights in this directory, while other users have none. If you are unfamiliar with any UNIX command, you can view its manual page by typing: man <command name>. (Do not type the angle brackets <>.) For instance man mkdir brings up the man pages for mkdir. Man pages can be very cryptic, especially for beginners, but it is best to get used to reading them as soon as possible. Under AFS, fs denotes a file system command, setacl sets the access control list (ACL) for a specific user or group of users, and listacl displays the access lists for a given directory. The command % fs setacl <some directory> <some user> <some subset of rlidwka or all or none> sets the access rights for a directory and a user. Note that setacl can be abbreviated as sa and listacl can be abbreviated as la. For instance do la on your home directory: % fs la ~ Access list for /afs/cats.ucsc.edu/users/a/foobar is Normal rights: system:authuser l foobar rlidwka The path /afs/cats.ucsc.edu/users/a/foobar will be replaced by the full path to your home directory, and your own username in place of foobar. Note that ~ (tilde) always refers to your home directory, . (dot) always refers to your current working directory (the directory where you are currently located) and .. (dot, dot) refers to the parent of your current working directory. The group system:authuser refers to anyone with an account on the ITS UNIX timeshare. Thus by default, any user on the system can list the contents of your home directory. No other permissions are set for system:authuser however, so again by default, no one else can read, insert, delete, write, lock, or administer your files. Do fs la ~/cs12b and verify that the access rights are the same for the child directory cs12b. Create a subdirectory of private, call it anything you like, and check its access rights are the same as for its parent. Thus we see that child directories inherit their permissions from the parent directory when they are created. To get a more comprehensive list of AFS commands do fs help. For instance you will see that fs lq shows your quota and usage statistics. For more on the Andrew File System go to


3


http://claymore.rfmh.org/public/computer_resources/AFSinfo.html. While your assignments are solo assignments to be done alone. For this lab you can find another student and as an exercise allow your partner read access to the directory where you are working on a shared assignment, e.g. prog1, do the following: % cd cs12b % mkdir prog1 % fs setacl prog1 system:anyuser none % fs setacl prog1 system:authuser none % fs setacl prog1 partnerID read % fs listacl prog1 Access list for prog1 is Normal rights: system:operator rlidwk system:administrators rlidwka partnerID rl mcdowell rlidwka Of course, using other options with "fs setacl" you could also give your partner write access to the directory, although you should do that with great caution. Try and create some files and see if your partner can access them. Part 3: Jar Files Copy the following file to your lab1 directory. Part of this exercise is to be able to use the text editor. You want to complete Lab1 knowing that you are 100% comfortable that you can edit and compile simple files. //----------------------------------------------------------------------------- // HelloUser.java // This is a really simple program to get you started. // Prints greeting to stdout, then prints out some environment information. //----------------------------------------------------------------------------- class HelloUser{ public static void main( String[] args ){ String userName = System.getProperty("user.name"); /* this should be you! */ String os = System.getProperty("os.name"); String osVer = System.getProperty("os.version"); String jre = System.getProperty("java.runtime.name"); String jreVer = System.getProperty("java.runtime.version"); String jvm = System.getProperty("java.vm.name"); String jvmVer = System.getProperty("java.vm.version"); String javaHome = System.getProperty("java.home"); long freemem = Runtime.getRuntime().freeMemory();/* scary if 0! */ long time = System.currentTimeMillis(); System.out.println("Hello "+userName); System.out.println("Operating system: "+os+" "+osVer); System.out.println("Runtime environment: "+jre+" "+jreVer); System.out.println("Virtual machine: "+jvm+" "+jvmVer); System.out.println("Java home directory: "+javaHome); System.out.println("Free memory: "+freemem+" bytes"); System.out.printf("Time: %tc.%n", time); } }


4


You can compile this in the normal way by doing javac HelloUser.java then run it by doing the command java HelloUser. Java provides a utility called jar for creating compressed archives of executable .class files. This utility can also be used to create an executable jar file that can then be run by just typing its name at the UNIX prompt (with no need to type java first). To do this you must first create a manifest file that specifies the entry point for program execution, i.e. which .class file contains the main() method to be executed. Create a text file called Manifest containing just one line: Main-class: HelloUser If you don’t feel like opening up an editor to do this you can just type % echo Main-class: HelloUser > Manifest The UNIX command echo prints text to stdout, and > redirects the output to a file. Now do % jar cvfm HelloUser Manifest HelloUser.class The first group of characters after jar are options. (c: create a jar file, v: verbose output, f: second argument gives the name of the jar file to be created, m: third argument is a manifest file.) Consult the man pages to see other options to jar. The second argument HelloUser is the name of the executable jar file to be created. The name of this file can be anything you like, i.e. it does not have to be the same as the name of the .class file containing function main(). For that matter, the manifest file need not be called Manifest, but this is the convention. Following the manifest file is the list of .class files to be archived. In our example this list consists of just one file: HelloUser.class. At this point we would like to run the executable jar file HelloUser by just typing its name, but there is one problem. This file is not recognized by UNIX as being executable. To remedy this do %chmod +x HelloUser As usual, consult the man pages to understand what chmod does. Now type HelloUser to run the program. The whole process can be accomplished by typing five lines: % javac –Xlint HelloUser.java % echo Main-class: HelloUser > Manifest % jar cvfm HelloUser Manifest HelloUser.class % rm Manifest % chmod +x HelloUser Notice we have removed the now unneeded manifest file. Note also that the –Xlint option to javac enables recommended warnings. The only problem with the above procedure is that it’s a big hassle to type all those lines. Fortunately there is a UNIX utility that can automate this and other processes. Part 4: Makefiles Large programs are often distributed throughout many files that depend on each other in complex ways. Whenever one file changes all the files depending on it must be recompiled. When working on such a program it can be difficult and tedious to keep track of all the dependencies. The UNIX make utility automates this process. The command make looks at dependency lines in a file named Makefile. The dependency lines indicate relationships between source files, indicating a target file that depends on one or more prerequisite files. If a prerequisite has been modified more recently than its target, make updates the target file based on construction commands that follow the dependency line. make will normally stop if it encounters an error during the construction process. Each dependency line has the following format.


5


target: prerequisite-list construction-commands The dependency line is composed of the target and the prerequisite-list separated by a colon. The construction-commands may consist of more than one line, but each line must start with a tab character. Start an editor and copy the following lines into a file called Makefile. # A simple Makefile HelloUser: HelloUser.class echo Main-class: HelloUser > Manifest jar cvfm HelloUser Manifest HelloUser.class rm Manifest chmod +x HelloUser HelloUser.class: HelloUser.java javac -Xlint HelloUser.java clean: rm -f HelloUser HelloUser.class Anything following # on a line is a comment and is ignored by make. The second line says that the target HelloUser depends on HelloUser.class. If HelloUser.class exists and is up to date, then HelloUser can be created by doing the construction commands that follow. Remember that all indentation is accomplished via the tab character. The next target is HelloUser.class which depends on HelloUser.java. The next target clean is what is sometimes called a phony target since it doesn’t depend on anything and just runs a command. Likewise the target submit does not compile anything, but does have some dependencies. Any target can be built (or perhaps executed if it is a phony target) by doing make <target name>. Just typing make creates the first target listed in the Makefile. Try this by doing make clean to get rid of all your previously compiled stuff, then do make again to see it all created again. Your output from make should look something like: % make javac -Xlint HelloUser.java echo Main-class: HelloUser > Manifest jar cvfm HelloUser Manifest HelloUser.class added manifest adding: HelloUser.class(in = 1577) (out= 843)(deflated 46%) rm Manifest chmod +x HelloUser The make utility allows you to create and use macros within a Makefile. The format of a macro definition is ID = list where ID is the name of the macro (by convention all caps) and list is a list of filenames. Then $(list) refers to the list of files. Move your existing Makefile to a temporary file, then start your editor and copy the following lines to a new file called Makefile. #------------------------------------------------------------------------------ # A Makefile with macros #------------------------------------------------------------------------------ JAVASRC = HelloUser.java SOURCES = README Makefile $(JAVASRC) MAINCLASS = HelloUser CLASSES = HelloUser.class JARFILE = HelloUser

Homework is Completed By:

Writer Writer Name Amount Client Comments & Rating
Instant Homework Helper

ONLINE

Instant Homework Helper

$36

She helped me in last minute in a very reasonable price. She is a lifesaver, I got A+ grade in my homework, I will surely hire her again for my next assignments, Thumbs Up!

Order & Get This Solution Within 3 Hours in $25/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 3 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 6 Hours in $20/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 6 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 12 Hours in $15/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 12 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

6 writers have sent their proposals to do this homework:

Best Coursework Help
Top Essay Tutor
University Coursework Help
Helping Hand
Writer Writer Name Offer Chat
Best Coursework Help

ONLINE

Best Coursework Help

I am an Academic writer with 10 years of experience. As an Academic writer, my aim is to generate unique content without Plagiarism as per the client’s requirements.

$60 Chat With Writer
Top Essay Tutor

ONLINE

Top Essay Tutor

I have more than 12 years of experience in managing online classes, exams, and quizzes on different websites like; Connect, McGraw-Hill, and Blackboard. I always provide a guarantee to my clients for their grades.

$65 Chat With Writer
University Coursework Help

ONLINE

University Coursework Help

Hi dear, I am ready to do your homework in a reasonable price.

$62 Chat With Writer
Helping Hand

ONLINE

Helping Hand

I am an Academic writer with 10 years of experience. As an Academic writer, my aim is to generate unique content without Plagiarism as per the client’s requirements.

$60 Chat With Writer

Let our expert academic writers to help you in achieving a+ grades in your homework, assignment, quiz or exam.

Similar Homework Questions

What is a variogram - Interpersonal communication everyday encounters 8th edition apa citation - Attention getter for diabetes speech - COMM THEORY - ATTRIBUTION THEORY/CRISIS/COVID - Explain the trend in atomic radius - Act 4 scene 3 - 9 4 skills practice proportional parts and triangles answers - Www findaninsurer com au - Reflection of lecture - If dna triplets are atg cgt the mrna codons are - Power dissipation in ideal inductor - Saturated water properties calculator - Lab report - Organ decision - Audit scope and objectives example - Graphing a function rule worksheet - 179 little bourke street - Functional requirements for online banking system - Food and nutrition a level syllabus - Pope and vasquez 2007 competence - Birkbeck postgraduate degree classification - Cognitive Behavioral Theory Versus Rational Emotive Behavioral Theory - 10 seconds of math - Paper 10 for Jennifer - Starplex el paso tx lee trevino - Isaiah 65 17 25 - Nursing change agent paper - 1002 3 - Discussion - Case 18 ford motor company new strategies for international growth - Certificate of insurance aami - He ain t even stretch tho - 1 3 cyclopentadiene diels alder - Onegeology org extra kids earth processes - Econ 213 problem set 4 - How deserts were formed - The most loneliest day of my life grammar - Web design - Tina jones musculoskeletal - Outcome measurement strategies for organizational change - Mcent unable to process your request - Cowra freight sydney depot - Colorism essay examples - Nurs 6512 final exam - Gomi run sweat eat repeat - 6 strip h method - Study Of A Life Journey due in 24 hours - Mcconnell brue flynn economics 21th edition pdf - 904 n grand ave waxahachie tx 75165 - Managerial Economics - Panasonic kx-t7630 change extension name - Computer science project proposal - Mimic pro landing page - Who can complete this assignment by Sunday, October 11th by 5pm? - Laaperi v sears - Longest word with no vowels - Quantative Methods/MAT105 - The major product formed in the following reaction is - Html to ppt php - The human experience worksheet - Characteristics of public management - City of stirling food permit - When you were processing the USB drive belonging to a Triton Corporation employee for potential child pornography, you recieved a phone call from the Grantham Police Department advising you that they have an active criminal investiagation on the employee. - Https www youtube com watch v evtxpuf4oz4 - Penner medical products case study solution - Business ETHICS(Research Paper) - Shadow health esther park answer key - Flinders medical centre map - Practical Connection EP - ENTR150-55678 This assignment will be submitted to Turnitin® - Molar mass of cl2 - Aqa gcse exam dates 2014 - Cynthia jesus died for our sin thias - Uncertainty of 150 ml beaker - Defining research with human subjects sbe id 491 - Leadership style of mary barra - How to find markdown percent - Practice questions - Journal entry for warranty expense - What is the overhead cost per unit for rings - Dq - Who has benefited more from globalisation - developing countries or developed nations? - Super's archway model - Michelle fleshner worked for pepose vision institute - Andrew carnegie wealth north american review june 1889 - Ee cummings poems leaf - Spartiate training - Theories to determine moral status of a fetus - Does Buddhism have more or less conflict with science than Christianity? - System specification document template - 10k annual report for coca cola - Dell sc420 spec sheetdell sc420 spec sheet - Craig weatherup net worth - Sss sas asa rhs - Summary of leviticus 9 - Ann balon stockists australia - The hidden face cda - Lanarkshire racing pigeon federation - Fluke 5500a calibrator price - What is the purpose of a windshield survey