程序代写 | Assignment 2 – Calendar

本次澳洲作业是使用Python开发日历的程序代写assignment

You are going to be writing a calendar application that will allow the user to send events to the calendar daemon and keep a record of the events.

You will also be required to construct a number of programs using bash and python. This assignment will involve building some basic unix tools and utilising existing unix tools available to you to perform text processing, basic input and output and some system operations.

The assignment has 4 tasks that you will need to thoroughly test and implement successfully. You have been provided a test suite to assist in developing your solutions.

The four tasks are:

1. implement a calendar daemon program in python that interpret commands received on a named pipe

2. implement a calendar command program in python that sends commands to the calendar daemon

3. implement an initialisation bash script that installs your calendar system

4. create an installation package for your system

The following is to assist with reading information in this document:
Arguments in the command and protocol structure will be indicated with a :
prefix.

Arguments enclosed in square brackets [ and ] are optional.

Parameters that are not further specified can be any string. In order to be considered as one single valid parameter, a string that contains whitespace has to be enclosed by double quotation marks.

Example usage of the following:

• ADD :ITEM -> ADD APPLES
• GET :TABLE :KEY -> GET SUBJECTS INFO1112
• PUT :KEY [:ITEMS] -> PUT BASKET APPLES MILK CAKE

Your calendar daemon application must allow for listening to a named pipe for input. Your daemon will accept a number of commands and process them, these will be used to add,remove,update and retrieve events in the calendar.

Your daemon will need to construct a named pipe within /tmp named cald_pipe which will be used for receiving commands from the command application.

The following messages and their arguments can be received by the daemon via a named pipe.

• ADD :DATE :EVENT [:DESCRIPTION]

Adds a new event, into the calendar’s database, the event requires a date and an event name. Optionally a description can be included with the event itself.

• DEL :DATE :EVENT

Removes an event on a given date, if the event does not exist then nothing will happen. If the event exists, then the event will be removed.

• UPD :DATE :OLDEVENT :NEWEVENT [:DESCIPTION]

This will allow for renaming and updating the event name of an existing event.
If the event does not exist, the update should be ignored. If a description has been added to the update, it will update the description to the one specified.
If no description is specified, this will remove the current description and replace it with an empty string.

In the event an error occurs with the data format, the entry should be rejected.
The date format should follow the format DD-MM-YYYY, if the date does not follow the format specified, it should be rejected from being added to the daemon.

All events should be saved to a database that the calendar command can query the data stored.

Your database must be a readable comma separated value (CSV) file. Your database MUST use this format.

Please make sure you structure the fields in the following manner:

:DATE,:EVENT,[:DESCRIPTION]

The calendar database path will be specified by the first argument of the daemon.

If an argument has not been specified, the daemon will create a database file that is in the same directory as the program. For example, if the daemon was executed in the folder /home/user/app/ and no argument was specified initially regarding its location, the database should be create in the directory /home/user/app/.

The default name of the database file (when not specified) is cald_db.csv.

The path of the database should be stored in the temporary index file named
/tmp/calendar_link.