User Tools

Site Tools


haas:spring2023:unix:projects:dap0

Corning Community College

CSCS1730 UNIX/Linux Fundamentals

PROJECT

PROJECT: Design A Picture (dap0)

Objective

To adapt and experiment with a program that generates an image.

Also to start some time-sensitive activities to ensure ground is broken on the project before the day it is due (see submission rubric below)

Abstraction

As an exercise in toning your abstraction abilities (literally seeing one thing, but understanding and using it as something else), there will be a number of 'generic' terms used throughout this (and other) documents throughout the course, requiring you to substitute in the pertinent information (else face confusion or error).

Some examples:

  • yourusername - where you see this (likely in a config file or command-line argument), you are NOT to literally type in y-o-u-r-u-s-e-r-n-a-m-e, but instead, substitute in YOUR lab46 username.
  • desig - different classes have different class designations. To make one universal document pertinent to ALL classes, specific examples will instead use 'desig', where you must substitute in the class desig of the class YOU are taking and acting upon in that moment. Example class desigs:
    • c4eng - ENGR1050 “C for Engineers”
    • cprog - CSCS1320 “C/C++ Programming”
    • unix - CSCS1730 “UNIX/Linux Fundamentals”
    • data - CSCS2320 “Data Structures”
    • discrete - CSCS2330 “Discrete Structures”
    • comporg - CSCS2650 “Computer Organization”
    • sysprog - CSCS2730 “Systems Programming”

This sort of abstraction is very similar to that we will find in our utilization of variables in programming, where we can have a “name”, but the data associated with it can change based on various conditions.

Do not be a literalist computer! Start to exercise your abstraction abilities.

2023/01/18 06:37

Locational Awareness

This document is written with TWO locations in mind:

  • lab46 (the system you may retrieve resources and SUBMIT projects)
    • identified in examples with the use of the lab46:~$ prompt
  • your pi (the system you will transfer resources to/from, and WORK ON/COMPLETE projects)
    • identified in examples with the use of the yourpi:~$ prompt

There are commands you can ONLY run on one system or the other. Pay attention to any prompt cues in the given examples (or section headings, context of language leading up to any examples).

For example:

  • YOU cannot install software on lab46. You don't have access.
  • projects CANNOT be SUBMITTED on your pi.

Please pay attention to your prompt, so you can perform the needed activity on the correct system.

2023/01/18 06:37

Background

For this project, you will be using a graphics design library to render the indicated image.

Program

It is your task to write a program that generates an image according to the following specifications:

  • has and utilizes at least EIGHT (8) colors.
  • image dimensions are no smaller than 1000 pixels on either axis.
  • picture utilizes the bulk of the canvas
  • uses at least 3 instances of each of:
    • circle/ellipse
    • line
    • rectangle

The program will be an exercise in exploration: you will be given some example code that does something. You should poke at it to gain deeper understanding. Then you will, taking out the demo graphics, implement the needed steps to generate your intended picture.

On your pi/system

Develop and test this program on your pi. Only when done, verify that it compiles on lab46.

To utilize the needed functionality for this project, you will need to ensure you have the following packages installed:

  • build-essential (hopefully you took care of this in ntr0)
  • libgd-dev
  • libgd-tools
  • libgd3

And any related packages that may be needed to support this endeavour.

Specifications

Your program should:

  • have valid, descriptive variable names of length no shorter than 3 symbols
  • have consistent, well-defined indentation (no less than 4 spaces per level of indentation)
    • all code within the same scope aligned to its indentation level
  • have proximal comments explaining your rationale and what is going on, throughout your code
  • perform the intended operation, outputting the correct/accurate information in indicated format

Grabbing project resources

I have prepared a grabit for resources related to this project. To obtain:

lab46:~/src/SEMESTER/desig$ grabit desig dap0
make: Entering directory '/var/public/SEMESTER/desig/dap0'
'/var/public/SEMESTER/desig/dap0/Makefile' -> '/home/user/src/SEMESTER/desig/dap0/Makefile'
'/var/public/SEMESTER/desig/dap0/dap0.c|py' -> '/home/user/src/SEMESTER/desig/dap0/dap0.c|py'
make: Leaving directory '/var/public/SEMESTER/desig/dap0'
lab46:~/src/SEMESTER/desig$ 

At which point you can change into the newly created and populated dap0 directory.

Be sure to add, commit, and push this to your lab46 clone of your repository.

Then, on your pi/system, pull and update to get the files available there.

Compiling

Since the grabit brought in a Makefile, if your code needs compiling you can compile your code simply by typing: make

You can run the program with: make run

If on lab46, you can get the image copied into your web space (under the dap0/ subdirectory) by running: make install

When done and ready to submit, on lab46: make submit

Restrictions

To ensure a level playing field (should some happen to have some programming experience), I would like to restrict you from using:

  • selection statements of any kind (you're just manually placing a bunch of differently colored blocks)
  • loops of any kind (place everything manually, the benefit is exposing yourself to the problem)

Strategy

As with any process you are looking to describe or automate (in this case, both), if YOU do not personally understand or appreciate the steps involved, you are going to have a hard time communicating a proficient list of instructions to the computer to carry out.

So, the FIRST order of business would be to, BY HAND, ON A SHEET OF GRAPH PAPER (consider this your PROTOTYPE):

  • START EARLY: perhaps even while you are working on week 2's “pct2” project. Don't WASTE the abundance of time made available to you. Waiting until the last minute will only preserve frustration and confusion.
  • decide what sort of picture you would like to “render”
  • practice plotting the elements out, figuring out how to best represent and fill the graph paper
  • determine what a good ratio of blocks to screen size would be (holding a 11“x8.5” sheet of graph paper in landscape orientation would be a good fit for the resolution of 1280×1024, for example.
  • mark up your appropriately sized and filled out prototype with the different colors the project calls for
  • ONCE you have worked out your scheme by hand, you can THEN proceed to start playing with the provided code
    • determine what shapes are being rendered (view it in a web browser or image viewer)
    • make changes to the shapes. Experiment and develop an understanding of the coordinate system and how you can predictably impact the shape as it is rendered in the image
    • once you understand how to manipulate the shapes, remove the demo shapes/comments and start laying down your own
  • the provided code infrastructure may not be adequate for the demands of the project, and will need to be expanded in some areas
    • see if you understand the patterns of the existing infrastructure, and explore attempts to expand it to support your project aims
    • ASK QUESTIONS so as to maintain an understanding of what is going on

How to view the picture

Depending on your computing setup, choose the most practical means of viewing your program's image output:

Raspberry Pi/system desktop

You've got a monitor and keyboard hooked up to your pi/system that you are using (preferred method for class).

Open a file browser, web browser, or image viewer and navigate to/open up your dap0.png image in your ~/src/SEMESTER/desig/dap0/ directory.

Rinse and repeat as you go through revisions.

Raspberry Pi/system command-line via SSH/MOSH

You don't have a monitor, so you are logging into your pi/system remotely (doable, and good intra-system practice)

We start by running a successfully-compiled dap0:

yourpi:~/src/SEMESTER/desig/dap0$ make run

… which will produce an image (dap0.png); You want to put this in your web space (with the proper permissions set), so you can view it in a web browser:

yourpi:~/src/SEMESTER/desig/dap0$ ssh yourusername@lab46.g7n.org "mkdir -p ~/public_html/dap0"
yourpi:~/src/SEMESTER/desig/dap0$ scp dap0.png yourusername@lab46.g7n.org:public_html/dap0/

Note that you will be prompted for your lab46 password.

Then over on lab46, run this:

lab46:~$ chmod 0644 ~/public_html/dap0/dap0.png

Then, point a web browser at the following URL:

NOTE: sometimes the web browser caches previous results, you may have to refresh a few times on revisions to get changes to manifest.

Submission

To successfully complete this project, the following criteria must be met:

  • Code must compile/execute cleanly (no notes, warnings, nor errors)
  • Code must be nicely and consistently indented
  • Code must be well commented
  • Do NOT double space your code. Group like statements together.
  • Track/version the source code in your lab46 semester repository
  • Submit a copy of your source code to me using the submit tool

To submit this program to me using the submit tool, run the following command at your lab46 prompt:

lab46:~/src/SEMESTER/desig/dap0$ make submit

You should get some sort of confirmation indicating successful submission if all went according to plan. If not, check for typos and or locational mismatches.

What I'll be looking for:

26:dap0:final tally of results (26/26)
*:dap0:post picture of prototype to #desig discord channel [6/6] 
*:dap0:grabit the code on lab46 by Sunday before deadline [4/4]
*:dap0:code is pushed to lab46 semester repository [6/6]
*:dap0:no negative compiler/interpreter messages for program [4/4]
*:dap0:proper output formatting per specifications [6/6]

Additionally:

  • Solutions not abiding by spirit of project will be subject to a 50% overall deduction
  • Solutions not utilizing descriptive why and how comments will be subject to a 25% overall deduction
  • Solutions not utilizing indentation to promote scope and clarity will be subject to a 25% overall deduction
  • Solutions not organized and easy to read are subject to a 25% overall deduction
2023/01/21 06:37
haas/spring2023/unix/projects/dap0.txt · Last modified: 2023/01/18 10:00 by 127.0.0.1