Discussion Groups:

Group 1:
     Amjad
     Brianna
     Dillon

Group 2:
     Isabelle
     James
     Jancel

Group 3:
     Joe 
     John D.
     John R.

Group 4:
     Jonathan E.
     Kelvyn
     Mark

Group 5:
     Massour
     Mo
     Mohammmad A.

Group 6:
     Mohamed R.
     Paulo
     Pedro

Group 7:
     Rachel 
     Sam
     Shaf

In-Class Exercises

Week 1: Introductions

Please write your answers to the following questions on a sheet of lined paper:

  1. What is your major? Why did you choose this field of study? If you are undecided, tell us which subject you are most interested in at the moment.
  2. Why did you register for this course? What do you expect to learn?
  3. Why did you choose to be a student at SCSU?
  4. Are you familiar with any programming languages? If so, list them below.

Week 3a: Basic Bash Commands

  1. Move to the root directory and list its contents.
  2. List the contents of the root directory in long (detailed) reverse chronological order (the most recent file should be listed last).
  3. Change to the home directory and list all files, including hidden files.
  4. In the home directory, create the following subdirectory: rabbit_hole.
  5. Change to the ~/rabbit_hole directory and create the following subdirectories: alice, king, queen.
  6. Change to the alice directory and print the current working directory.
  7. Change to /tmp and create an empty file named white_rabbit using the touch command. Move this file to ~/rabbit_hole.
  8. Change to the rabbit_hole directory and create a subdirectory named rose_garden.
  9. Change to the rose_garden directory and create a subdirectory named roses.
  10. In roses, create the following files: rose1, rose2, rose3.
  11. Return to ~/rabbit_hole. List the directory contents using ls, ls -R, and the tree commands.

Week 3b: Bash Scripting

  1. Move to your home directory and create a subdirectory named week3b. This will be your working directory for today.
  2. Change to your working directory and write a script that does the following:
    1. Using a loop, create 15 subdirectories in ~/week3b named area0 ... area14.
    2. Write a loop that does the following:
        a. Sleep 1 second.
        b. Using $RANDOM and %, create an empty file named white_rabbit in a random area subdirectory.
        c. Run the tree ./ command and append its output in a file named out.
        d. Delete the empty file, and repeat the loop 10 times.

Week 6: I/O Operations in C

Consider the following code from the lecture notes:

$ cat copy.c #include <fcntl.h> #include <unistd.h> int main() { int source = open("alice-ascii.txt", O_RDONLY); int dest = open("alice-ascii-copy.txt", O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); char c; int bytes_read; do { bytes_read = read(source, &c, 1); write(dest, &c, 1); } while (bytes_read != 0); close(source); close(dest); }

Q: How can we modify copy.c so that it inverts the ASCII image by replacing "." with "#" and "#" with "."? Write the inverted image to a file named alice-ascii-inverted.txt. The file alice-ascii.txt is available here.

Week 10a: Threads and Images

Download the following image:

Source: Black Widow: Marvel Comics (1970s)

Using ImageMagick, convert the image into an XPM file. Then, use the resize option to reduce the image to a width of 155 pixels. Convert the resized image into images of five colors, four colors, three colors, and two colors. Use nomacs to display and compare all images in the current directory.

Week 10b: Threads and Images, Part 2

Consider the following image:

Download the XPM version of this image here. The following C program uses threads with the aim of changing the colors of the XPM image, giving Black Widow red hair against a twilit sky: colors-flawed.c.

Download the C program, compile it and run it. Then, try to display the output file. What happened?

Fix the code using a POSIX mutex.