User Tools

Site Tools


blog:fall2015:mp010784:journal

Data Structures

Week 1

I think I'm changing formats from writing stuff every single day to just writing a general synopsis for every week for each class to preserve my sanity.

For data structures this week we discussed the general idea of linked lists and looked at our first project (dsi0) which is pertaining to making an array list and having a user driven menu that changes data in the array list. We also talked about pointers and nodes.

“To achieve enlightenment you'll want to draw pictures in each stage.” –Matt Haas

Pointers have:
1) a name
2) an address
3) contents at address

* - means get the contents of what's at address.
& - means give me the address.

“Saving the planet, one keystroke at a time.” –Matt Haas with ending by Zack Golden.

Node code:

struct node    //defining struct node
{
    signed short int value;
    struct node *next;
};

typedef struct node Node;

Node *tmp;         //does the same thing
struct node tmp2;  //does the same thing

Node *tmp=NULL;           //setting both pointers tmp and tmp2 to NULL
struct node *tmp2=NULL;

tmp=(Node*)malloc(sizeof(Node));  //instantiating a node.

tmp->next->NULL;  //pointing back to NULL after the node.

tmp->value=7;  //setting the value in node to 7.

tmp->next=(Node*)malloc(sizeof(Node));    //instantiating 2nd node.
tmp->next->next=NULL;  //setting pointer of 2nd node to NULL.

tmp2=tmp->next; //pointing tmp2 to the second node.

tmp2-value=13;  //setting value in second node to 13. 

Week 2

First day this week we worked on getting accustomed to the pods and logging in and using the X system. On lab46 we set up and clone our mercurial repository on lab46 and ~/src directory if we didn't already have it. I spent most of the class working on my project dsi0, my program called arraylist.c

The other day of class this week week spoke in some depth to linked lists and some of the functions we may need to implement in upcoming programs in regards to linked lists, such as:
1) create()
2) copy()
3) clear()
4) insert()
5) append()
6) obtain()
7) setpos()
8) getpos()
9) find()
10) swap()
11) sort()
12) compare()
13) rmlist() (deallocate list)
14) empty() (empty the list to make an empty list)
15) displayf() (display forwards)
16) displayb() (display backwards)

Week 3

This week we had our first project for this class due on Wednesday, dsi0, which was to create an array program. This is the version of mine that I submitted, despite there being a couple of minor bugs I still wish to fix after the fact, but the core functionality is there:

/**************************************************
 *
 *  Matthew Page
 *  08/29/2015
 *  CSCS2320 - Data Structures
 *  Fall 2015
 *
 *  arraylist.c -   project dsi0 for data structs
 *                  where creating a program that
 *                  presents the user with a menu  
 *                  to build list, display list, 
 *                  insert into list, append into
 *                  list, obtain from list, clear
 *                  list, and quit.  This first 
 *                  project will be using an array
 *                  and functions for each option
 *                  in the menu, in later projects
 *                  we will use linked lists with 
 *                  nodes.
 *
 *************************************************/

#include <stdio.h>

    //Function Prototypes
    void menu();                        
    int buildlist(int, int *, int);     //passing index, array pointer, and buildinput
    void displaylist(int *);            //passing array pointer
    int * insert(int, int, int *);      //passing requested index, new value, and array
    int * append(int, int, int *);      //passing requested index, new value, and array
    int * obtain(int, int *, int*);     //passing index, array, and address of obt_value
    int * clearlist(int *);             //clears out the array, pass array

main()
{
    //variable declarations
    int input = 0;                      //user's choice on menu
    int buildinput = 0;                 //values entered to build list
    int quitflag = 0;                   //quit variable for main program loop
    int index = 0;                      //index associated with build list entries
    int array[21];                      //the array set to a size of 21
    int ins_index = 0;                  //index of desired insertion point for insert() function
    int app_index = 0;                  //index of desired appending point for append() function
    int ins_value = 0;                  //value entered at insertion point for insert() function
    int app_value = 0;                  //value entered at appending point for append() function
    int obt_index = 0;                  //index of desired value to obtain in obtain() function
    int obt_value = 0;                  //obtained and removed value from obtain() function

    clearlist(array);           //calling clearlist passing it the array, to enter all -1's in array

    //main program loop
    while (quitflag != 1)          
    {
        //calling menu function
        menu();               

        //User input
        scanf("%d", &input);

        //case switching statement
        switch(input)
        {
            case 1:         //Build List
                printf("Build List Function:\n");
                printf("Enter values into the list up to 20 values total.\n");  
                printf("Enter a '-1' to signify the end of data.\n");

                while ((buildinput != -1) && (index<20))
                {
                    printf("Enter value: \n");    
                    scanf("%d", &buildinput);
                    index=buildlist(index,array,buildinput);
                }

                if (index == 20)            //Testing for full array
                {
                    printf("Maximum values reached.  Array is full.\n");    //Full array message
                }

                break;
            case 2:         //Display List
                printf("Display List Function\n");
                displaylist(array);
                break;
            case 3:         //Insert into List 
                printf("Insert into List Function\n");
                printf("Enter index of array element to insert before: \n");
                scanf("%d", &ins_index);
                printf("Enter new value to insert before this index: \n");
                scanf("%d", &ins_value);
                insert(ins_index, ins_value, array);
                break;
            case 4:         //Append into List
                printf("Append into List Function\n");
                printf("Enter index of array element to append after: \n");
                scanf("%d", &app_index);
                printf("Enter new value to append after this index: \n");
                scanf("%d", &app_value);
                append(app_index, app_value, array);
                break;     
            case 5:         //Obtain from List
                printf("Obtain from List Function\n");
                printf("Enter index of array element to obtain: \n");
                printf("(This will remove this value from the list)\n");
                scanf("%d", &obt_index);
                obtain(obt_index, array, &obt_value);
                printf("Removing Element #%d : %d from the list. \n", obt_index, obt_value );
                break;
            case 6:         //Clear List         
                printf("Clear List Function\n");
                clearlist(array);                           //calling clearlist passing it the array
                break;
            case 7:         //Quit
                printf("Leaving...Have a Nice Day!! :)\n");
                quitflag = 1;                               //changing quit flag upon quit selection
                break;
            default:
                printf("ERROR: Invalid entry!\n");          //Error message for invalid entry
                break;                                    
        }
    }


    return (0);
}

//User Menu Function
void menu()
{
    //output menu
    printf("---------------------------------------\n");
    printf("Data Structures Array List Program Menu\n");
    printf("---------------------------------------\n");
    printf("Please choose one of the following:\n");
    printf("1 - Build List\n");
    printf("2 - Display List\n");
    printf("3 - Insert into List\n");
    printf("4 - Append into List\n");
    printf("5 - Obtain from List\n");
    printf("6 - Clear List\n");
    printf("7 - Quit\n");
    printf("---------------------------------------\n");

}

//Build List Function
int buildlist(int index, int *array, int buildinput)
{
    array[index]=buildinput;
    printf("Array index %d is %d\n", index, array[index]);
    index++;
    return index;
}

//Display List Function
void displaylist(int *array)
{
    int i = 0;
    printf("The list is: \n");
    while ((array[i] != -1) && (i<20))
    { 
        printf("Element #%d: %d\n", i, array[i]);
        i++;
    }
}


//Insert into List Function
int * insert(int ins_index, int ins_value, int * array)               
{
    int i = ins_index;
    for (i=19;i>=ins_index;i--)
    {
        array[i+1]=array[i];
    }
    array[ins_index]=ins_value;
    return array;
}

//Append into List Function
int * append(int app_index, int app_value, int * array)           
{
    int i = app_index;
    for (i=19;i>=app_index;i--)
    {
        array[i+1]=array[i];
    }
    array[app_index+1]=app_value;
    return array;
}

//Obtain from List Function
int * obtain(int obt_index, int * array, int* obt_value)       
{                                                                      
    int i = obt_index;
    (*obt_value)=array[obt_index];
    for (i=obt_index;i<=19;i++)
    {
        array[i]=array[i+1];
    }
    return array;
}

//Clear List Function
int * clearlist(int *array)
{
    int i;
    for (i=0;i<=20;i++)
    {
        array[i]=-1;
    }
    return array;
}

We have now officially assigned, project sln0, a singly linked list set of pseudocode and pictures based project, due next Wednesday, September 16, 2015.

We also spent this week talking pretty extensively about the debugger sot hat we can start learning to use it effectively as a tool to help us resolve issues with our code.

GDB - GNU Debugger, cannot rely solely on the debugger. It can only help you to make better decisions in sorting out errors in your code.

3 Types of Errors:
- Syntax Errors
- Logic Errors
- Runtime Errors

  1. dividing by zero (computer cries and the universe explodes)
  2. segmentation fault (SEGFAULT) (tries to access memory that is not yours.) ZEUS Striking down lighting SEGFAULTS

“Mastering the debugger is the type of thing that will get you hired or incarcerated.” –Matt Haas

Using the GDB Debugger

To compile with “-g” to add debugging symbols to the program which for this class we will probably do for all compiling now, but in production code that needs to do intensive work this would have a performance hit:

$ gcc program.c -o program -g


To run the debugger with our program:

$ gdb ./program


This will give us a a gdb prompt that appears as so:

(gdb) 


From here we can enter commands like:

(gdb) help


To display help or:

(gdb) help all


to see all commands and hit ENTER to cycle through them.
You can get help on certain commands by running the help command followed by a command name:

(gdb) help list


which will show the usage of the list command on gdb.

At any point you can exit the debugger with:

(gdb) quit


(gdb) list


This displays the first several lines of code from the program, hitting ENTER will contine to show more lines from the code.

(gdb) list main


This would the main function, a few lines before and a few lines after.

(gdb) list menu


This show's the menu function and a few lines before and after.

You can also show a specific line by number and the preceding and following lines with:

(gdb) list 194


(gdb) run


Runs the program as normal.

(gdb) backtrace


OR:

(gdb) bt


Backtrace command which goes back through function calls to function calls, to go deeper down the rabbit hole.

(gdb) breakpoint 94


OR:

(gdb) break 94


Sets a breakpoint at line 94 so that when the program runs it will stop at line 94, if this is in a loop it will stop at that line every single iteration of the loop at that line.

(gdb) print i


Would print the value of i variable currently.

(gdb) print i+1


Would print the value of (i+1) at the current state.

(gdb) print array[i]


Would print the value at array subscript i at current state.

(gdb) print array[i+1]


Would print the value at array subscript i plus one at current state.

(gdb) step


OR

(gdb) s


Steps through the next line of the program (which includes into function calls)

(gdb) next


OR:

(gdb) n


Does the same thing as step but does NOT go into function calls which include not going into things like the scanf function, which if you step through you end up in library code.

(gdb) continue


OR:

(gdb) c


Continues to the next breakpoint.

(gdb) display i


(gdb) display i+1


(gdb) display array[i]


(gdb) display[i+1]


These are like the print statements earlier, except print only does it once, whereas this will keep showing you the values of these variables as you step through the program or through different iterations. You lose these once you quit the debugger.

(gdb) watch i=139


(gdb) watch i=149


(gdb) watch i>150


Watches the value at the condition. Like a time machine jumping to that iteration or that point in the program running where the value of the variable is at the specified value.

(gdb) x array


Examine array address.

(gdb) delete break 1


Deletes breakpoint #1.

(gdb) set var i=770


Sets the value of variable i to 770.
Tricks it into thinking i is 770, hard wired it to 770.

With this you can put bad data into your variables to stress test your code.

You can also make scratch variables to use solely in debugging:

(gdb) set var j=32


then display it with:

(gdb) print $j


(gdb) help set watchdog


For use with timing based programs.

(gdb) (*int) 0x7ffff03f0


(gdb) (*int) 0x7ffff0310


(gdb) print (array+0)


(gdb) print (array+1)


Forgot what these lines were exactly.

(gdb) x/4 0x7ffff03f1


Gives 4 units of data from the array in this case.

(gdb) x/8 0x7ffff03f1


Gives 8 units of datafromt he array.

(gdb) help x


Shows help page on x for examining contents of memory.
0xffffff is -1 because of Two's compliment.

(gdb) x/20 0xffff03f1


Shows all of the array.

(gdb) x/32d 0xfffff03f1


Converts it to decimal.

(gdb) x/32t 0xfffff03f1


Converts it to binary.

(gdb) x/32o 0xfffff03f1


Converts it to octal.

(gdb) x/32u 0xfffff03f1


Converts it to unsigned integer.

(gdb) x/32d 0xfffff03f1


Converts it to signed integer.

$ gdb /bin/ls


Opens ls in gdb.

(gdb) break _start


Breaks just before main function.

(gdb) run


Runs ls, which ended up giving us a memory address.

(gdb) x/20i 0xfffff3310


Dumps the assembly language code for ls.

$ gdb ./debug-sample


rerunning debug-sample in gdb.

(gdb) break main


setting breakpoint at main.

(gdb) print &main


I think that's right, having trouble reading my writing, but should print memory address of main function.

(gdb) x/20 0xffff3310


Examine the memory for your code.

(gdb) x/20i 0xffff3310


Examine the memory to find assembly code of your code.

Week 4

Something something dark side.

We watched a very old and…different video on pointers on youtube this week as part of our project:

Binky Pointer Fun:


Make and Makefiles

We learned about make some this week. This week's project sln1 has a Makefile in it which are instructions to the make command to make compilation and linking multiple files together much easier. on lab46 for sln1, when we type in “make help” we get a list of some usage commands for make:

lab46:~/src/data/cscs2320/sln1$ make help
****************[ Data Structures Node Implementation ]*****************
** make                     - build everything (libs, units, apps)    **
** make debug               - build everything with debug symbols     **
** make check               - check implementation for validity       **
**                                                                    **
** make libs                - build all supporting libraries          **
** make libs-debug          - build all libraries with debug symbols  **
** make apps                - build unit tests                        **
** make apps-debug          - build unit tests with debugging symbols **
** make units               - build unit tests                        **
** make units-debug         - build unit tests with debugging symbols **
**                                                                    **
** make save                - create a backup archive                 **
** make submit              - submit assignment (based on dirname)    **
**                                                                    **
** make update              - check for and apply updates             **
** make reupdate            - re-apply last revision                  **
** make reupdate-all        - re-apply all revisions                  **
**                                                                    **
** make upgrade-sll0        - upgrade to next project (sll0)          **
** make clean               - clean; remove all objects/compiled code **
** make help                - this information                        **
************************************************************************
lab46:~/src/data/cscs2320/sln1$

The Makefile for this project accounts for some extra's but we can use this as a blueprint for future Makefiles:

SHELL = /bin/bash -e
INC = -I inc/
CCFLAGS = -Wall 
OPTS =
CC = gcc $(CCFLAGS) $(OPTS) $(INC)
OBJ = 
AR = ar
DEBUG = 
DESIG = data
SEMESTER = fall2015
PROJ = $(shell /bin/pwd | /bin/sed 's/^.*\///')
NEXTPROJ = $(shell /bin/cat /var/public/$(SEMESTER)/$(DESIG)/projlist | /bin/grep "^$(PROJ):" | /usr/bin/cut -d':' -f2)
OTHER = $(shell /bin/cat /var/public/$(SEMESTER)/$(DESIG)/projlist | /bin/grep "^$(PROJ):" | /usr/bin/cut -d':' -f3)
NEXTPATH = /var/public/$(SEMESTER)/$(DESIG)/$(NEXTPROJ)
OTHERPATH = /var/public/$(SEMESTER)/$(DESIG)/$(OTHER)
LIBS = src
UNIT = unit
APP = app
ALL = $(LIBS) $(UNIT) $(APP)
BIN = 
default: status-begin libs units apps status-end
debug: status-begin libs-debug units-debug apps-debug status-end

libs-debug: CC += -DDEBUG -g
libs-debug: DEBUG = debug
libs-debug: libs

libs:
ifneq ($(MAKECMDGOALS),debug)
	@for i in $(LIBS); do make -sC $$i $(DEBUG); done
else
	@for i in $(LIBS); do make -C $$i $(DEBUG); done
endif

status-begin:
	@if [ `cat .updates/current` -lt `cat /var/public/$(SEMESTER)/$(DESIG)/$(PROJ)/.updates/latest` ]; then echo "*********************************************************"; echo "*** NEW UPDATE AVAILABLE: Type 'make update' to apply ***"; echo "*********************************************************"; fi

status-end:
	@if [ `cat .updates/current` -lt `cat /var/public/$(SEMESTER)/$(DESIG)/$(PROJ)/.updates/latest` ]; then echo "*********************************************************"; echo "*** NEW UPDATE AVAILABLE: Type 'make update' to apply ***"; echo "*********************************************************"; fi

status-quit:
	@if [ `cat .updates/current` -lt `cat /var/public/$(SEMESTER)/$(DESIG)/$(PROJ)/.updates/latest` ]; then echo "*********************************************************"; echo "*** NEW UPDATE AVAILABLE: Type 'make update' to apply ***"; echo "*********************************************************"; /bin/false; fi

units-debug: CC += -DDEBUG -g
units-debug: DEBUG = debug
units-debug: units

units:
ifneq ($(MAKECMDGOALS),debug)
	@for i in $(UNIT); do make -sC $$i $(DEBUG); done
else
	@for i in $(UNIT); do make -C $$i $(DEBUG); done
endif

apps-debug: CC += -DDEBUG -g
apps-debug: DEBUG = debug
apps-debug: apps

apps:
ifneq ($(MAKECMDGOALS),debug)
	@for i in $(APP); do make -sC $$i $(DEBUG); done
else
	@for i in $(APP); do make -C $$i $(DEBUG); done
endif

check: status-begin
	@/var/public/${SEMESTER}/${DESIG}/.eval/verify-$(PROJ).sh

clean: status-begin
	@printf  "Cleaning out object code    ... "
	@for i in $(ALL); do make -sC $$i clean; done
	@rm -f errors bin/* lib/*
	@printf  "OK\n\n"

copy:
	@echo    "Commencing copy process for project $(PROJ)"
	@echo
	@echo -n "Creating project $(PROJ) directory tree           ... "
	@mkdir -p ~/src/$(DESIG)/$(PROJ) ~/src/$(DESIG)/$(PROJ)/.updates && echo "OK" || echo "error"
	@echo -n "Copying $(PROJ) files into project directory  ... "
	@cp -av /var/public/$(SEMESTER)/$(DESIG)/$(PROJ)/* ~/src/$(DESIG)/$(PROJ)/ && echo "OK" || echo "error"
	@echo -n "Synchronizing $(PROJ) project revision level      ... "
	@cp -f /var/public/$(SEMESTER)/$(DESIG)/$(PROJ)/.updates/current ~/src/$(DESIG)/$(PROJ)/.updates/ && echo "OK" || echo "error"
	@echo -n "Establishing sane file permissions for $(PROJ)    ... "
	@chmod -R u=rwX,go= ~/src/$(DESIG)/$(PROJ) && echo "OK" || echo "error"
	@echo
	@echo "Copy Complete! You may now switch to the ~/src/$(DESIG)/$(PROJ) directory"
	@echo
	@echo "[${USER}] obtaining project '$(PROJ)' (revision `cat /var/public/$(SEMESTER)/$(DESIG)/$(PROJ)/.updates/latest`) in `pwd` (`date +\"%Y%m%d%H%M\"`)" >> /var/public/$(SEMESTER)/$(DESIG)/$(PROJ)/.updates/log

save: clean
	@echo
	@echo    "Project backup process commencing"
	@echo
	@echo -n "Taking snapshot of current project ($(PROJ))      ... "
	@(cd ..; tar cf $(PROJ)-`date +%Y%m%d-%H`.tar $(PROJ) && echo "OK" || echo "error")
	@echo -n "Compressing snapshot of $(PROJ) project archive   ... "
	@gzip -f -9 ../$(PROJ)-*.tar && echo "OK" || echo "error"
	@echo -n "Setting secure permissions on $(PROJ) archive     ... "
	@chmod 600 ../$(PROJ)-*.gz && echo "OK" || echo "error"
	@echo
	@echo    "Project backup process complete"
	@echo

submit: save
	@submit $(DESIG) $(PROJ) `/bin/ls -1 ../$(PROJ)*gz | tail -1`
	@echo "[${USER}] submitting project '$(PROJ)' in `pwd` (`date +\"%Y%m%d%H%M\"`)" >> /var/public/$(SEMESTER)/$(DESIG)/$(PROJ)/.updates/log

use-test-reference: clean
	@if [ -f "/var/public/$(SEMESTER)/$(DESIG)/$(PROJ)/.datastore/refimp.sh" ]; then sh /var/public/$(SEMESTER)/$(DESIG)/$(PROJ)/.datastore/refimp.sh `pwd` "$(SEMESTER)/$(DESIG)/$(PROJ)"; fi
	@echo "NODE reference implementation in place, run 'make' to build everything."

use-your-own-code:
	@if [ -f "/var/public/$(SEMESTER)/$(DESIG)/$(PROJ)/.datastore/locimp.sh" ]; then sh /var/public/$(SEMESTER)/$(DESIG)/$(PROJ)/.datastore/locimp.sh `pwd` "$(SEMESTER)/$(DESIG)/$(PROJ)"; fi
	@echo "Local node implementation restored, run 'make clean; make' to build everything."

update:
	@for((i=`cat .updates/current`+1; i<=`cat /var/public/$(SEMESTER)/$(DESIG)/$(PROJ)/.updates/latest`; i++)); do sh /var/public/$(SEMESTER)/$(DESIG)/$(PROJ)/.updates/$$i $(SEMESTER) $(DESIG) $(PROJ); echo "[${USER}] applying revision $$i of '$(PROJ)' in `pwd` (`date +\"%Y%m%d%H%M\"`)" >> /var/public/$(SEMESTER)/$(DESIG)/$(PROJ)/.updates/log; done
	@chmod -R u=rwX,go= .
	@echo "Updated from revision `cat .updates/current` to revision `cat /var/public/$(SEMESTER)/$(DESIG)/$(PROJ)/.updates/latest`"
	@cat /var/public/$(SEMESTER)/$(DESIG)/$(PROJ)/.updates/latest > .updates/current

reupdate:
	@for((i=`cat .updates/current`; i<=`cat .updates/current`; i++)); do sh /var/public/$(SEMESTER)/$(DESIG)/$(PROJ)/.updates/$$i $(SEMESTER) $(DESIG) $(PROJ); echo "[${USER}] re-applying revision $$i of '$(PROJ)' in `pwd` (`date +\"%Y%m%d%H%M\"`)" >> /var/public/$(SEMESTER)/$(DESIG)/$(PROJ)/.updates/log; done
	@chmod -R u=rwX,go= .
	@echo "Re-applying revision `cat .updates/current`"

reupdate-all:
	@for((i=1; i<=`cat .updates/current`; i++)); do sh /var/public/$(SEMESTER)/$(DESIG)/$(PROJ)/.updates/$$i $(SEMESTER) $(DESIG) $(PROJ); echo "[${USER}] re-applying revision $$i of '$(PROJ)' in `pwd` (`date +\"%Y%m%d%H%M\"`)" >> /var/public/$(SEMESTER)/$(DESIG)/$(PROJ)/.updates/log; done
	@chmod -R u=rwX,go= .
	@echo "Re-applied updates from revision 1 to revision `cat .updates/current`"

upgrade-$(NEXTPROJ): status-quit clean save
	@echo    "Commencing upgrade process from $(PROJ) to $(NEXTPROJ)"
	@echo
	@echo -n "Creating project $(NEXTPROJ) directory tree           ... "
	@mkdir -p ../$(NEXTPROJ) ../$(NEXTPROJ)/.updates && echo "OK" || echo "error"
	@echo -n "Copying your code to $(NEXTPROJ) project directory    ... "
	@cp -a * ../$(NEXTPROJ) && echo "OK" || echo "error"
	@echo -n "Copying new $(NEXTPROJ) files into project directory  ... "
	@cp -a /var/public/$(SEMESTER)/$(DESIG)/$(NEXTPROJ)/* ../$(NEXTPROJ)/ && echo "OK" || echo "error"
	@echo -n "Synchronizing $(NEXTPROJ) project revision level      ... "
	@cp -f /var/public/$(SEMESTER)/$(DESIG)/$(NEXTPROJ)/.updates/current ../$(NEXTPROJ)/.updates/ && echo "OK" || echo "error"
	@if [ -f "/var/public/$(SEMESTER)/$(DESIG)/$(NEXTPROJ)/.updates/prune" ]; then echo -n "Pruning obsoleted files from $(NEXTPROJ) project tree ... "; sh /var/public/$(SEMESTER)/$(DESIG)/$(NEXTPROJ)/.updates/prune ../$(NEXTPROJ) && echo "OK" || echo "error"; fi
	@echo -n "Establishing sane file permissions for $(NEXTPROJ)    ... "
	@chmod -R u=rwX,go= ../$(NEXTPROJ) && echo "OK" || echo "error"
	@echo
	@echo "Upgrade Complete! You may now switch to the ../$(NEXTPROJ) directory"
	@echo
	@echo "[${USER}] upgrading to project '$(NEXTPROJ)' (revision `cat /var/public/$(SEMESTER)/$(DESIG)/$(NEXTPROJ)/.updates/latest`) in `pwd` (`date +\"%Y%m%d%H%M\"`)" >> /var/public/$(SEMESTER)/$(DESIG)/$(NEXTPROJ)/.updates/log

get-$(OTHER): status-quit clean save
	@make -C /var/public/$(SEMESTER)/$(DESIG)/$(OTHER) copy

help: status-begin
	@if [ "`echo $(PROJ) | cut -c3`" = "s" ]; then echo "****************[ Data Structures Stack Implementation ]****************"; elif [ "`echo $(PROJ) | cut -c3`" = "q" ]; then echo "****************[ Data Structures Queue Implementation ]****************"; elif [ "`echo $(PROJ) | cut -c3`" = "l" ]; then echo "****************[ Data Structures List Implementation ]*****************"; elif [ "`echo $(PROJ) | cut -c3`" = "n" ]; then echo "****************[ Data Structures Node Implementation ]*****************"; elif [ "`echo $(PROJ) | cut -c3`" = "t" ]; then echo "****************[ Data Structures Tree Implementation ]*****************"; else echo "****************[ Data Structures Code Implementation ]*****************"; fi
	@echo "** make                     - build everything (libs, units, apps)    **"
	@echo "** make debug               - build everything with debug symbols     **"
	@echo "** make check               - check implementation for validity       **"
	@echo "**                                                                    **"
	@echo "** make libs                - build all supporting libraries          **"
	@echo "** make libs-debug          - build all libraries with debug symbols  **"
	@if [ -d "app/" ]; then echo "** make apps                - build unit tests                        **"; echo "** make apps-debug          - build unit tests with debugging symbols **"; fi
	@echo "** make units               - build unit tests                        **"
	@echo "** make units-debug         - build unit tests with debugging symbols **"
	@if [ -f "/var/public/$(SEMESTER)/$(DESIG)/$(PROJ)/.datastore/refimp.sh" ]; then echo "**                                                                    **"; echo "** make use-test-reference  - use working implementation object files **"; echo "** make use-your-own-code   - use your own implementation code        **"; fi
	@echo "**                                                                    **"
	@echo "** make save                - create a backup archive                 **"
	@echo "** make submit              - submit assignment (based on dirname)    **"
	@echo "**                                                                    **"
	@echo "** make update              - check for and apply updates             **"
	@echo "** make reupdate            - re-apply last revision                  **"
	@echo "** make reupdate-all        - re-apply all revisions                  **"
	@echo "**                                                                    **"
	@if [ -r $(NEXTPATH) ]; then /usr/bin/printf "** %-24s " "make upgrade-$(NEXTPROJ)"; /usr/bin/printf "- %-39s **\n" "upgrade to next project ($(NEXTPROJ))"; fi
	@if [ ! -z "$(OTHER)" ] && [ -r $(OTHERPATH) ]; then /usr/bin/printf "** %-24s " "make get-$(OTHER)"; /usr/bin/printf "- %-39s **\n" "obtain new project ($(OTHER))"; echo "**                                                                    **"; fi
	@echo "** make clean               - clean; remove all objects/compiled code **"
	@echo "** make help                - this information                        **"
	@echo "************************************************************************"

Week 5

This week we talked about the sll0 project, our first singly linked list project, after the previous project of working on singly linked nodes (sln1). But on the current project (sll0) we were given some class time to work on this project. This project includes writing code for the functions mklist(), displayf(), getpos(), setpos(), and insert().

Week 6

I finished sll0 by the skin of my teeth in the last hours. I almost submitted it broken the other night as time was winding down and I figured I'd submit mostly functioning code on time over being late with finished code. But it bugged me that I couldn't complete it all on time and have it 100% functional. But with some assistance from wedge over IRC I was able to finish it and have everything working, namely the insert() function, but previously I had an infinite loop in my insert() function that showed “0 → 1 →” repeating over and over.

This week sll1 was unveiled and I decided to start working on the displayb() function first, displaying backwards. I already have an infinite loop in this one also, where it displays “← 4” repeating. I have a screenshot off my laptop of this behavior for fun:

Infinite Looping

Week 7

This week I worked on sll1 and got everything working correctly except for the compare function. I think the problem became that I started writing that function to the test instead of thinking out the logic of what I had to do to make it do what it needed to do. After turning in sll1 with still failing 3 of its tests I lost some points on it, but its probably a drop in the bucket in the grand scheme of things. Now sll2, sll3 and sll4 have been revealed. Through break week I did literally nothing. I had a lot of personal stuff going on. First day back from break we also have Richard Stallman on campus. And I'm gonna have to work around that and for the next three days trying to do the entirety of sll2 in three days. I probably can do it, but I'm gonna have to bust my ass for 3 solid days.

Week 8

Will continue after the Richard Stallman Experience…

The Richard Stallman Experience

This week started off with the “Richard Stallman Experience.” We had Richard Stallman from the GNU Project and the Free Software Foundation at our little podunk redneck college, Corning Community College. He spoke fo Free Software and Your Freedoms. Which is what he always talks about really. Its not anything I haven;t heard 100 times before in things I've seen of Dr. Stallman online, but it definitely was cool to be able to experience the man before he dies. We got to actually hear the man fart so loud that it came through the microphone. He was selling merch too, but we also got a metric ton of free stickers to plaster in the bathrooms or or laptops or where ever.

So for future reference, Dr. Richard Stallman was at CCC on Monday, October 19th, 2015.

Week 8 continued

This week as I did literally ZERO school work over break I came into school on Monday with the entirety of the sll2 project still to do. I worked on and completed 3 of the 5 functions: obtain(), clearlist(), and rmlist() all before going to see Richard Stallman's presentation on Monday. I started to work on the swap() function but I still need to get that one functional and then work on my sort() function in these next two days. Hopefully i can complete all that in the limited time I have left.

Week 9

This is the last week to drop and I'm in a bad place. Depression has sweeped over me and I can't break free. I sleep all the time. I hate my life. I just don;t care about anything anymore. I want to care but I don't have anything left. My psychiatrist says I check myself into the hospital. I am resisting solely because I know it will mean the end of this semester if I do.

At this point I missed Tuesdays class, I've got about 24 hours until sll3 (which was suppose to be the quick easy one) and sll4 are due. I'm still stuck on sll3 and my mind is a fog. at some point I'm just gonna have to do the submit and upgrade from sll3 and see if I can get anything functioning in sll4 in the next day and submit that. But if I could have done that I already would have. We'll see if I'm still here next week.

Week 10

This week we moved on to doubly linked lists from singly linked lists. We are finishing up dln0 and dll0 and then moving on to dll1.

Week 11

I've fallen out of the cycle of working on the projects as of late, I'm trying to jump back into it working on dll2 project due next week on Wednesday, November 18, 2015. However with this particular project I've discovered a potential issue or complication. The dll2 project should be a fairly simple one as we are only adding functionality for a qty (quantity) in our list functions. However since I'm currently using the test reference code as I haven;t been keeping up, this leaves me having to fully implement those functions, making dll2 a much larger project if I do in fact do dll2. I'm tempted to just skip dll2 and start on the stack project as at least it would be working with all new code.

Week 12

This week started working on the stack project dls0. I finished the mkstack(), rmstack(), and isempty() functions for dls0 project. This project is due on Wednesday. After that we have dsq0 which has 2 weeks to work on through our Thanksgiving break.

Week 13

This week is our last week of official classes for data structures. We are working on trees and finishing up our stack and queues projects before starting on our eoce, which will take the rest of our time the rest of this week, all of next week and possibly into finals week working on our end of course experience.

EOCE Work and Rick and Morty Pic

ricknmorty.jpg

Been working on the EOCE for data structures right up until the end…it's almost over…

blog/fall2015/mp010784/journal.txt · Last modified: 2015/12/15 20:37 by mp010784