Write a perl script to automate task

Assignment Help Programming Languages
Reference no: EM132268838

Assignment

Task 1: Script programming

Consider the following situation:

You are given a directory from a webserver that contains multiple HTML files as well as multiple files of other types (e.g. images). The directory may contain subdirectories. You are asked to clean up this directory and its subdirectories by removing all unused files. A file is considered unused if it is not linked in any of the HTML files or if it is not specified explicitly that this file is in use. A file can be linked in a HTML file by either a href or img src. It does not matter whether the link is within a commented-out section of the HTML file. Do not remove subdirectories.

The files you remove must be stored in a user-specified directory. You need to maintain the directory structure when storing the removed files (e.g. if you remove two files a/b/a.txt and a/a.txt, both files must be stored under their directories).

You also need to create statistics output for the files that have been removed. The statistics output must be in text form and must contain, for each file ending, the number of files and the overall size of files with that ending. In addition, the number and size of all removed files needs to be reported. For this purpose, file- endings are not case-sensitive (i.e. .gif and .GIF are considered the same for statistics purposes). The statistics must also contain the name of the directory on which the cleanup script has been run.

T1.1: Write a Perl script to automate task. The script must be run as follows: cleanup.pl [CleanupDir] [RubbishBinDir] [ListOfUsedFiles] where

[CleanupDir ] is the name of the directory to clean up.
[RubbishBinDir ] is the name of the directory where removed files are to be stored.
[ListOfUsedFiles ] is a list of 0 or more files that are in use and should not be deleted.

Your script must handle errors such as missing parameters, missing files, missing di- rectories, missing access permissions, or input/output errors gracefully, that is, it must not crash on encountering them. Depending on what is appropriate, your script may handle errors by displaying a warning and continuing, by displaying an error message and aborting, or by taking other actions (e.g. creating a missing directory). Your script should try to fix problems, if this is possible.

T1.2: Discuss, in at most 300 words, why script programming is particularly suited for this problem, and describe two possible extensions of your script and how they could be achieved.

Task 2: Quantum computing

Consider the following (incomplete) quantum circuit:

2041_figure.jpg

M represents the act of making a measurement on the first two qubits. The circuit is sup- posed to transfer the state |ψ) = a |0) + b |1) (a, b ∈ C) from the first qubit to the third qubit, involving a classical operation to select a quantum gate.

Depending on the measurement outcome of the first two qubits, what quantum gate should be applied in place of ‘?', such that the transfer is successful? Provide a table containing the measurement results of M and the quantum gate to be applied in each case. Justify that your answer is correct by showing the operation of the circuit up to the execution of M and the state of the third qubit depending on the result of M .

Also discuss, in at most 300 words, whether it is possible to create a copy of |ψ) without any classical operation or instead with only classical operations.

Attachment:- Script programming and Quantum Computing.rar

Verified Expert

Multiple HTML records just as numerous records of different kinds (for example pictures). The index may contain sub directories. we are approached to tidy up this registry and its sub directories by expelling every single unused record. A document is viewed as unused on the off chance that it isn't connected in any of the HTML records or in the event that it isn't indicated expressly that this document is being used. this is implemented in Perl.

Reference no: EM132268838

Questions Cloud

What mistakes and best practices have you seen : What mistakes and best practices have you seen? What would you change and why?
Techniques are the most valuable for your strategic plan : What forecasting tools and techniques are the most valuable for your Strategic Plan? What assumptions are you making?
Create a Web Application to perform CRUD operations : COMP303 Java EE Programming Assignment - Dynamic Web Application with Servlets, JSP, JSTL and EL, Centennial College, Canada. Create a Web Application
Explain how fixed cost differ from variable cost : Explain how fixed cost differ from a variable cost. Use specific examples to solidify your point of view.
Write a perl script to automate task : CMT304 Programming Paradigms - Cardiff University - Script programming and Quantum Computing - need to maintain the directory structure when storing the removed
Write a memo based upon the hypothetical company : As you know human resources professionals are often required to write memos to express their views on how employees are treated to improve the effectiveness.
Covenant of good faith and fair dealing : The "covenant of good faith and fair dealing" as related to employment-at-will implies that excellent performance over an extended period of time grants
Are they different from what other people do : Discuss why Goldman Sachs was a disciple of Albert Carr's theory of "business is a poker game and we are all bluffing."
Employees are direct function of its MIS infrastructure : The services a firm is capable of providing to its customers, suppliers, and employees are a direct function of its MIS infrastructure.

Reviews

inf2268838

8/29/2019 2:37:53 AM

Such a lovely team and professional service. My experience with you guys is good. I would love to visit the website again foe my next assignment.

len2268838

3/28/2019 10:04:35 PM

Feedback on your coursework will address the above criteria. Feedback and marks will be returned via Learning Central. This will be supplemented with oral feedback on request.

len2268838

3/28/2019 10:04:11 PM

Please note: Your script must not depend on any software not present on the specified machine (lapis.cs.cf.ac.uk). The script will be executed with a Bash shell. If the script does not run, no attempt will be made to make it run. Criteria Range Marks Correct table of quantum gates to execute depending on results of M [0, 12] Justification of correctness, including the operation of the quantum circuit gates and the state of the third qubit given the results of M [0, 24] Clear justifications for why a purely classical and a purely quantum circuit is possible or not [0, 14]

len2268838

3/28/2019 10:03:40 PM

This coursework is worth 25% of the total marks available for this module. The penalty for late or non-submission is an award of zero marks.All submission must be via Learning Central. Upload the following files in a single zip file. Description Type Name Cover Sheet Compulsory One PDF (.pdf) file [student number].pdf Task 1.1 Compulsory One Perl (.pl) source file cleanup.pl Task 1.2 Compulsory One PDF (.pdf) source file task1-[StudentID]- [StudentName].pdf Task 2 Compulsory One PDF (.pdf) file task2.pdf For Task 1: Include your student ID and student name in the name of the PDF file, as shown. Also include your student ID and student name as a comment in the script and in the header or footer of your text in the PDF file. This helps us award marks correctly.

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd