Table of Contents

Doug's Opus, Spring 2014

A Tale of Two CompSci Classes

Introduction

Much like the past two semesters, I'm still working full-time at Trayer, a somewhat small and extremely boring king-pin factory on Elmira's north-ish, east-ish, possibly somewhat central-ish side, as a cycle counter; I get to count inventory all night. Obviously, my major is in computer science, and I'd like to pursue a career in artificial intelligence research; plans may change, however. I was programming in C++ long before I came to CCC, mostly little bits and pieces of video games that were never finished though. Still, I have a pretty strong understanding of it, even if I haven't taken C/C++ yet or Structured/Object-Oriented.

HPC Fundamentals Journal

23. January 2014

We began work on setting up our Debian Boxen for our virtual machine clusters.

21. January 2014

In addition to the usual first day activities, we discussed the importance of log files and using the tail command to help us view them more easily, and we briefly talked about kernel messages after viewing the messages log. The command “tail -f” will allow us to view the last few lines of whichever file we're viewing; enabling the monitoring of recent user activity more easily, such as failed log-in attempts or programme crashes.

Systems Programming Journal

12. February -> 19. February 2014

Two revisions of the matrix multiplier programme have been written; the initial one with hard-coded values was finished 13. February. The second revision was finished 19. February. The differences are the initial one is a single file file project, while the second version has been split into multiple files and functions, and a Makefile has been written for it; however, the principle change has been allowing the user to define the matrices at run-time through a series of prompts.

6. February 2014

I have completed my version of chown. Some constraints that prevent it from being a drop-in replacement for a typical chown include a lack of support for user:group semantics and is restricted to changing ownership for only one file at a time. The latter of these is rather trivial to fix; all I need to do is write a loop to cycle through all argv[]s after argv[1].

The former, however, would require a bit more work (and I may get to supporting it at some point). What needs to be done is parsing argv[1] and storing all characters before the colon in a string, skip over the colon, and store the rest in another string. In addition, I would need to convert the group name to a gid_t using getpwnam_r (as I did to get the uid_t I need for chown(2)), which would instantiate a passwd struct with the data I need. The passwd struct is included in <pwd.h>, as is getpwnam_r().

Admittedly, I did use Google to help find the information to get me on the right track. The page I referenced (in addition to the manual) is on Stack Overflow: http://stackoverflow.com/questions/3836365/how-can-i-get-the-user-id-associated-with-a-login-on-linux

23. January 2013

We worked on our programme from the first day some more, finishing it up with sorting the array and adding command line arguments. We did learn an impressive way to swap the values in two variables without using a third one: triple XOR. Let's say we had two variables a & b:

a = a^b
b = a^b
a = a^b

21. January 2014

In addition to the usual first day activities, we discussed file I/O in C at the system level, discussing the fopen function and its arguments a bit and file pointers. We filled a text file with some numbers and wrote a programme to read them from the text file and store them in an array to display them at the user's terminal, with the final goal to be sorting before display. I am also currently in the process of rewriting it to support my List<T> class from Data Structures. Edit (23. January 2013): Actually I've decided to re-implement list in C. It seems more appropriate that way.

Portfolio

Systems Programming

HPC Fundamentals