[SOLVED] VE280-Lab 1

30.00 $

Category:

Description

Rate this product

VE 280 Lab 1                                                                  

Ex0. A fun bash game BashCrawl (not mandatory)

Ex1. Hiding Photos

Related Topics: Linux.

Kyon is thinking of moving his favourite Mikuru’s photos from SOS Quantum Library sql/ to his own webserver webserver/ without being noticed.

“If Haruhi knows this, Haruhi will destory the world. We have to avoid this”.

Yuki suggests Kyon to use command lines. So Kyon decides to implement a shell script to automate command line tasks. He may need these tasks:

Create: create the working directory of the database and webserver, and initialize the database;

Dump: dump the data in the database into the webserver;

List: list all the files stored in the webserver;

Display: display the data in the webserver;

Destroy: remove the working directory of database and webserver.

He has already implemented the skeleton of ex1.sh , but now he . There are 5 of such lines in the script that are marked as TODO comments:

Testing

To test the script, please first make it executable by running:

Then, you can test the script by running the following commands and observe the results.

 

Ex2. Validating Password

Related Topics: loops, arrays, boolean, ASCII.

Miyamori Aoi is designing the wbsite for Musani Animation. When designing the register page, she plans to Write a function that checks whether the password that the user type in meets all the requirements below (or say it is valid):

Contains at least 1 alphabetic characters;

Contains at least 1 numerical characters; Contains at least 1 non-alphanumeric characters. The max length of a password is 50 characters.

The function takes a password (an array of chars) as input, returns true if the password is valid and returns false if not.

Miyamori is busy with their new animation. Please help her implement the function.

Note: In fact, when writing a web page, we use Regular Expression to validate whether a password meets our requirement. We do not use C++ but we use JavaScript for web programming. For those interested, you can Google it yourself.

Example

Example input:

Example output:

 

Ex3. Flipping an image

Related Topics: loops, arrays

Description

Here our topic is about the principle behind image processing software, like how to flip an image horizontally and invert it.

Like

Will result in

Of course this image will be too complicated for us to handle here. Let’s simplify the problem.

We are given a  binary matrix as a simple image.

To flip an image horizontally means that each row of the image is reversed.

For example, flipping [1,1,0] horizontally results in [0,1,1] .

To invert an image means that each 0 is replaced by 1 , and each 1 is replaced by 0 .

For example, inverting [1,0,1] results in [0,1,0]