======PROJECT======
PROJECT: Introductory Activities and Getting Started (ntr0)
=====Objective=====
In this project, we get started with some course initialization activities.
The aim is to:
* get you settled and configured with pertinent class resources
* test your ability to parse and proceed through linear, top-down documentation
* generate contextual awareness of your place within the computing environment
* start to acclimate to variables and conditions of abstraction
All of which will be important, ongoing skills to possess and continue to strengthen as we proceed through the course.
=====How to proceed through this project=====
There has been some unexpected confusion by some on how to glean information and make progress through this project (ie the information contained within this document and the necessary actions and awareness of what is going on).
The following advice, when genuinely followed, seems to remedy any initial confusion:
* read through this document, starting at its very top, and working your way down, line by line to the bottom (it is generally linear, with contextual clues sprinkled in)
* as you read through, comprehend and strive to understand what is happening. The supporting text, often surrounding any example or model commands to run, will tend to fill in the crucial backstory and connections. If further clarification is needed, please ask questions! Just running the commands in this document and have ZERO clue of what you are doing isn't going to help you in the long run.
* have a contextual/locational awareness of where you are (there are 2 different computing systems you are to perform work on, and there are two different means of accessing one of the systems- via command line, and via the web)
* we will be making heavy use of abstraction in this course. We start off with some simple exercises, providing you with model commands you need to adjust to fit your reality (ie commands that won't work as literally shown, but when pertinent meanings are substituted in and followed, will result in success: this is a common theme throughout the course).
* remember (for the duration of the course) the important concepts presented: for this project will NOT be the last time you see them. Starting from a clean slate each project, retaining NOTHING from your prior experiences will make things unnecessarily difficult for you.
* be sure to spend some time experimenting and playing, so as to gain an even deeper understanding and familiarity with these concepts. We will encounter and use many tools that facilitate our means of accomplishing various tasks. Their application isn't necessarily limited to the current activity of the project or the subject matter of the course. There are a wealth of productivity treasures to be encountered (both tangible and intangible) that can supercharge your educational journey.
As many of my graduated and subsequently employed alumni have relayed to me, many of these activities and behaviours I have highlighted have been quite influential in their success at their various jobs.
Say some of my former students now employed as engineers: "Reading is 90%+ of the job"
=====Abstraction=====
{{page>haas:fall2020:common:projects:abstraction&noheader}}
=====Locational Awareness=====
{{page>haas:fall2020:common:projects:location&noheader}}
=====Part 1: Getting started with course resources=====
Be sure to have a handle on these things before proceeding on:
====Reading====
Please be sure to read through, play with, and comprehend the material in the PDF "UNIX for the Beginning Mage":
* https://lab46.g7n.org/_media/haas/ufbm.pdf
This will introduce you to some important computing tools which we will be using to facilitate our class activities this semester. Especially if you haven't had much exposure to "files" on the computer and their organization and manipulation. You really need to have this material down.
====Course Homepage/Syllabus====
You're reading this, so you've likely already found your way to the course homepage. It consists of the syllabus plus additional course resources.
Please familiarize yourself with it, bookmarking important resources as appropriate, so that you can refer back when needed.
I'd recommend knowing how to get to the projects page (where you found the link for this project), as new content will be posted there. Note the due dates and identify the current and upcoming projects.
Be sure to read through and over the syllabus, ensuring there are no questions on the material and organization of the course.
=====Part 2: logging onto Lab46 command-line=====
====Lab46 Shell====
For many of you, this will be your first experience logging onto Lab46 and working within a command-line environment.
To access lab46, you will need to SSH or MOSH into **lab46.g7n.org**; here is a document that provides some further information on the correct login process (and some troubleshooting steps):
* [[/haas/fall2020/common/helpances/loginissues|Logging into Lab46]]
Your clearest indication you are on lab46 will likely be in the display of the prompt, resembling (in whole or in part) the following:
lab46:~$
====Clone your Lab46 Mercurial Repository on lab46====
**__NOTE:__** If you have already done this in a prior semester, you do NOT need to do it again.
To both aid you and help you develop better development skills, I'd like for you to make regular commits and pushes to your Lab46 mercurial repository.
This way, you can have a regular snapshot of your work as you go along, plus have the ability to grab an older copy should something go wrong.
Like the Journal, I will be looking for a minimal amount of repository-related activity PER WEEK.
To set up your repository, run the "fixrepo" script:
lab46:~$ fixrepo
NOTE: you ONLY want to run 'fixrepo' the one time, to take you from a state of not having an established repository on lab46, to the state of having a cloned and readied repository on lab46. Running it again will "refresh" things to this state, potentially moving unadded/uncommitted/unpushed somewhere else and causing you confusion.
For basic repository operation, when you make new files you'd like to track, or see the status of any tracked files that have changed:
lab46:~$ cd src
lab46:~/src$ hg status
A .hgignore
lab46:~/src$
Once cloned (to your ~/src directory), you will be able to add, commit, and push changes made:
lab46:~/src$ hg add
lab46:~/src$ hg commit -m "brief message describing the changes"
lab46:~/src$ hg push
On the push, you will be prompted to provide your lab46 password.
And that's it! Repeat this process (NOT the 'fixrepo'; only do that once) for any changes you make to your repository.
=====Part 3: Getting started on the Raspberry Pi=====
The pi-related activities on this project require you to have a Raspberry Pi single board computer, assembled and operational, running the 32-bit Raspberry Pi OS (aka raspbian).
The aim is that you will use your pi, your personal linux box, for working on coursework.
NOTE: on your pi, your default username and password are:
* username: **pi**
* password: **raspberry**
====The Shell (command-line) on the pi====
For many of you, this will be your first experience logging onto a Raspberry Pi and working within a command-line environment. You're taking your first steps into a much larger world.
Your clearest indication you are on your Raspberry Pi will likely be in the display of the prompt, resembling the following (in whole or in part):
pi@raspberry:~$
For the purposes of instruction, I will represent this prompt as:
yourpi:~$
====Change your pi password====
It might be a prudent idea to change the password for your **pi** user. You can do that with the **passwd** command, run at your pi prompt:
yourpi:~$ passwd
NOTE: you will NOT see ANYTHING when you type in your password.
====Manage Packages====
Through various course activities, you may need to install additional software on your Raspberry Pi. Here are some instructions on how to do that.
===Step One: Update your package database===
yourpi:~$ sudo apt-get update
===Step Two: Apply any updates===
yourpi:~$ sudo apt-get upgrade
NOTE: As a good general practice, you may want to perform the "update" and "upgrade" steps on a somewhat regular basis.
===Step Three: Search for packages===
If you do not know the exact name of a given package, you can attempt to search for it.
For example, if you've heard about a really neat terminal-based frontend to apt-get/apt-cache called "aptitude", and want to know the correct package name so you can install it:
yourpi:~$ apt-cache search aptit
aptitude - terminal-based package manager
aptitude-common - architecture independent files for the aptitude package manager
aptitude-doc-en - English manual for aptitude, a terminal-based package manager
libcwidget-dev - high-level terminal interface library for C++ (development files)
apt-cacher - Caching proxy server for Debian/Ubuntu software repositories
apticron - Simple tool to mail about pending package updates - cron version
apticron-systemd - Simple tool to mail about pending package updates - systemd version
aptitude-doc-cs - Czech manual for aptitude, a terminal-based package manager
aptitude-doc-es - Spanish manual for aptitude, a terminal-based package manager
aptitude-doc-fi - Finnish manual for aptitude, a terminal-based package manager
aptitude-doc-fr - French manual for aptitude, a terminal-based package manager
aptitude-doc-it - Italian manual for aptitude, a terminal-based package manager
aptitude-doc-ja - Japanese manual for aptitude, a terminal-based package manager
aptitude-doc-nl - Dutch manual for aptitude, a terminal-based package manager
aptitude-doc-ru - Russian manual for aptitude, a terminal-based package manager
aptitude-robot - Automate package choice management
cron-apt - automatic update of packages using apt-get
cupt - flexible package manager -- console interface
gbrainy - brain teaser game and trainer to have fun and to keep your brain trained
pkgsync - automated package list synchronization
wajig - unified package management front-end for Debian
You may get a lot of packages listed. Read through the output (package name on left, brief description on right). Turns out, in this case, the very package we want is the first one listed: **aptitude**
===Step Four: install specified packages===
yourpi:~$ sudo apt-get install aptitude
NOTE: With the installation of **aptitude**, you can use it in place of apt-get/apt-cache:
* update: **sudo aptitude update**
* upgrade: **sudo aptitude upgrade**
* search: **aptitude search __TOKEN__**
* install: **sudo aptitude install __PACKAGE__**
Where **__TOKEN__** is some substring of the thing you are looking for, and **__PACKAGE__** is the name of the installable package.
Some other packages (substitute in place of **__PACKAGE__** above) you might want to install (some might already be installed):
* bc
* screen
* wget
* less
* mosh
* file
Be on the lookout for other packages to install in this project (often embedded in the reading or unhighlighted on various lists of actions to take).
====Clone your Lab46 Mercurial Repository on your raspberry pi====
**__NOTE:__** If you have already done this on your pi, you do NOT need to do it again.
Because we will be juggling our activities between lab46 and your raspberry pi (ideally doing the bulk of the work on the pi, then transferring it to lab46 to submit), you will also want to clone your repository on your pi:
* make sure you have the "mercurial" package installed
* my example will have you cloning it into ~/src (NOTE: ~ below the escape key; it is not -)
* be sure to replace "yourusername" with your actual lab46 username
* do NOT change tokens of "user" or "username"
yourpi:~$ hg clone https://lab46.g7n.org/hg/user/yourusername ~/src
NOTE: The above snippet scrolls to the right. Make sure you type in everything.
You may be prompted for authentication. It is your lab46 account and password.
Next, we will configure the repository (using nano to edit the appropriate file):
yourpi:~$ nano ~/src/.hg/hgrc
And you will want to input the following (any existing, default content can be eliminated):
[paths]
default = https://lab46.g7n.org/hg/user/yourusername
[ui]
username = yourusername
[web]
push_ssl = False
allow_push = *
[auth]
lab46.prefix = https://lab46.g7n.org/hg/user/yourusername
lab46.username = yourusername
lab46.schemes = https
====Program to Implement====
As a first week exercise, I would like you to implement, successfully compile, and verify correct execution of the best first program every great programmer writes: **Hello World**
* You will want to ensure a compiler is installed on your raspberry pi. Install the "build-essential" package to accomplish this.
Code will be as follows:
/*
* hello.c - the first best C program ever
*
* written by: your name
*/
#include
int main() // every program needs a start, main() is ours
{
fprintf(stdout, "Hello, World!\n"); // display a message to STDOUT
return (0); // return a success status to OS
}
Your task will be to transcribe this code into a source file (call it **hello.c** for simplicity), within some subdirectory of your lab46 account (**~/src/cprog/ntr0/** may be a good choice).
yourpi:~$ mkdir -p ~/src/desig/ntr0
yourpi:~$ cd ~/src/desig/ntr0
yourpi:~/src/desig/ntr0$
NOTE: "desig" is your class designation ("cprog", "unix", "data", "discrete", "c4eng", etc.) Do NOT literally type "desig"
You may want to use the **nano** text editor for this:
yourpi:~/src/desig/ntr0$ nano hello.c
The **nano** text editor is a simple editor that provides basic functionality (commands listed at the bottom of the screen. You press the CONTROL key in combination with whatever letter invokes the desired functionality).
To save the file: CTRL+o (and hit ENTER to save the file with its current name)
To save and exit (or exit if there are no unsaved changes): CTRL+x
Note that if there are any changes, you will be prompted whether or not you'd like to save them (the changes are in memory (aka the buffer), and nano will prompt if you'd like to save the modified buffer). You will then be prompted for the filename (filling in the current filename, if there is one). Just press enter to accept these changes.
Whenever you make a new file you wish for mercurial to track, you will first need to "add" it:
yourpi:~/src/desig/ntr0$ hg add hello.c
You can then commit the current snapshot of it:
yourpi:~/src/desig/ntr0$ hg commit -m "adding hello.c"
And finally, pushing it to the server:
yourpi:~/src/desig/ntr0$ hg push
Verify you typed in everything correctly by compiling it; you want no warnings or errors:
yourpi:~/src/desig/ntr0$ gcc -Wall --std=gnu99 -o hello hello.c
yourpi:~/src/desig/ntr0$
If there are any errors or additional changes to be made, make them, and then do a follow-up "commit" and "push". Ideally you will want to make several commits per file per project, capturing your implementation progress (the more snapshots you make, the more points of restoration will exist to you should you need to backtrack).
Get to know/ask questions about that **gcc** line... this will not be the only time you see it.
Finally, verify the program runs as anticipated:
yourpi:~/src/desig/ntr0$ ./hello
Hello, World!
yourpi:~/src/desig/ntr0$
Once satisfied, be sure to submit the program source code as indicated below.
====Information====
As part of routine housekeeping tasks to kick off the course, I would like for you to provide me (ie submit) a text file (called **info.text**) that contains the following information (each on a line by itself, shared only with its heading):
* Your preferred name or nickname (after the heading "name: ")
* Your preferred (and frequently checked) e-mail (after the heading "email: ")
* Your discord screen name (they aren't always easy to intuit, after the heading "discord: ")
* Your matriculated program of study (after the heading "program: ")
* Any other information you feel pertinent to tell me (after the heading "other: ")
yourpi:~$ mkdir -p ~/src/desig/ntr0
yourpi:~$ cd ~/src/desig/ntr0
yourpi:~/src/desig/ntr0$
You may want to use the **nano** text editor for this:
yourpi:~/src/desig/ntr0$ nano info.text
The **nano** text editor is a simple editor that provides basic functionality (commands listed at the bottom of the screen. You press the CONTROL key in combination with whatever letter invokes the desired functionality).
To save the file: CTRL+o
To save and exit (or exit if there are no changes made): CTRL+x
Note that if there are any changes, you will be prompted whether or not you'd like to save them (the changes are in memory (aka the buffer), and nano will prompt if you'd like to save the modified buffer). You will then be prompted for the filename (filling in the current filename, if there is one). Just press enter to accept these changes.
Whenever you make a new file you wish for mercurial to track, you will first need to "add" it:
yourpi:~/src/desig/ntr0$ hg add info.text
You can then commit the current snapshot of it:
yourpi:~/src/desig/ntr0$ hg commit -m "adding info.txt for ntr0"
And finally, pushing it to the server:
yourpi:~/src/desig/ntr0$ hg push
=====Part 4: Accessing your website-based class resources=====
====Wiki====
The course homepage/syllabus, your journal, and other resources are made available to you via the lab46 wiki. In order to better access your web resources for the course, you must log in:
* top right of this page, notice the "login" button
* sign in with your wiki username (should be same as lab46 login) and password
* your wiki password should be in an e-mail to you on lab46
* use the 'alpine' command when logged into lab46 to retrieve your wiki password (you can ask for help about this in the class discord)
* once logged in, note the left sidebar has been updated with some custom (to you) content
* links to the course homepages of the classes you are taking with me
* a link to your journal
Go ahead and familiarize yourself with these resources.
====Journal Intro====
When Clicking on your journal link:
Familiarize yourself with your Journal, and once there:
* customize it (title/subtitle, as you feel fitting. Change "YOUR NAME" to your actual name, etc.)
* add an introduction (tell us a little something about yourself)
* create your first week content
=====Part 5: Getting data from your pi to lab46=====
So, you've written a C program and a text file. Both of which need to be submitted on lab46. How do we get data from your pi to lab46? If you've added it to your repository, we use that!
lab46:~/src$ hg pull; hg update
Similarly, if you want to get something originally on lab46 to your pi, add/commit/push it to your repository, then on your pi, do the same pull/update command.
Make sure you've pushed any and all commits before you do this, though!
=====Part 6: Submission of the project=====
To be successful in this project, the following criteria must be met:
* Project must be submit on time, by the posted deadline to be eligible for full credit.
* Late submissions will lose 33% credit per day, with the submission window closing on the 3rd day following the deadline.
* Early submissions can earn 1 bonus point per day in advance of the posted due date.
* All code must compile cleanly (no warnings or errors)
* all requested functions must be implemented in the related library or program
* all requested functionality must conform to stated requirements (either on this project page or in comment banner in source code files themselves).
* Executed programs must display in a manner similar to provided output
* output formatted, where applicable, must match that of project requirements
* Processing must be correct based on input given and output requested
* Output, if applicable, must be correct based on values input
* Code must be commented
* Any "to be implemented" comments **MUST** be removed
* these "to be implemented" comments, if still present at evaluation time, will result in points being deducted.
* Sufficient comments explaining the point of provided logic **MUST** be present
* Track/version the source code in a repository
* Submit a copy of your source code to me using the **submit** tool by the deadline.
* Make sure your submitted source code is in a file called **hello.c**
* Make sure it outputs exactly like the sample output above.
* Create and submit a text file called **info.text** that contains the requested information
====Submit Tool Usage====
Let's say you have completed work on the project, and are ready to submit, hop over to lab46, do any needed repository retrieval, navigate to your project directory, and (exercising appropriate substitution), do the following:
lab46:~/src/desig/ntr0$ submit desig ntr0 hello.c info.text
Submitting desig project "ntr0":
-> hello.c(OK)
-> info.text(OK)
SUCCESSFULLY SUBMITTED
lab46:~/src/desig/ntr0$
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.
I'll be evaluating the project based on the following criteria:
13:ntr0:final tally of results (13/13)
*:ntr0:customized journal (title and intro) [1/1]
*:ntr0:joined discord chat [1/1]
*:ntr0:submitted proper info.text file [1/1]
*:ntr0:cloned lab46 mercurial repository into ~/src [1/1]
*:ntr0:submitted file called hello.c [1/1]
*:ntr0:committed and pushed hello.c to repository [1/1]
*:ntr0:adequate and consistent indentation in hello.c [1/1]
*:ntr0:sufficient comments in hello.c [1/1]
*:ntr0:executable runs without issue [1/1]
*:ntr0:output conforms to project specifications [1/1]
*:ntr0:adequate modifications in hello.c [1/1]
*:ntr0:no compiler warnings for hello.c [1/1]
*:ntr0:no compiler errors for hello.c [1/1]
Additionally:
* Solutions not abiding by spirit of project will be subject to a 25% 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 (assume a terminal at least 90 characters wide, 40 characters tall) are subject to a 25% overall deduction