Table of Contents

Hush

be still…..

In this season....

Our antagonist falls deeper into the throws of his pugnacious psychosis. Embodiing the 1st & 3rd person as well as narrator; he creates, is and suffers as the three points of his own hellish plane of existence by experiencing, observing and providing commentary on a stagnant and insular journey.

-a 5am commentary on recursion-

Data Structures Journal

8/28/2013

Morning campers! First day of class even!

  • Got to the syllabus
  • Maybe severely questioning my retention of programming knowledge of prior courses.
  • Logged into Lab46 and had a trip down memory lane and basked in the magnificence of my kick-ass tree from last semester
  • Sat down and reviewed Pointer Fun with Binky
  • Don't remember the values for “int, hhu, etc.” review needed
  • Totally forgot how to get into irc class chat

8/29/2013

Spent preclass time snooping through other students opusssesssss and started customizing my own.

Pointers? BEHOLD…some fo sho useful shizzle http://en.wikipedia.org/wiki/Dereference_operator.

In class ptr1 program complete: note to self refer back to this for simple pointer brain farts.

Contains example of dereferencing pointers within the same program and indirection.

Not feeling very comfortable with my proficiency of the “C” programming-mo-tron.

Learning to play 40 thieves!!!……i suck at it.

Goodies for tonight? screw with the program.

8/30/2013

In class used C to to copy a program outline (numtypes) that displays various data types bit values on a given machine. only currently works for char and unsigned int types will expand in future.

9/1/2013

numtypes expanded to account for

  • decimal
  • char
  • unsigned
  • signed
  • half unsigned
  • half half unsigned
  • long unsigned

src folder is a disaster; fixification of that mess is on top of the todo pile, will sort qat least by class on Weds.

Week 2 Goodies

9/12/2013

Make option to append in linklist program.

9/13/2013

Make link list program menu driven.

9/19/2013

Doubly linked list insertion.

9/22/2013

Have come to the realization that linked lists are structs of structs..Matt probaly said this out loud but now it is starting to make little sense. the structs containg th inputted data in our created linked lists are the nodes which are linked via prev/next tags whose values can be changed to make the nodes modular.

9/23/2013

Had the good Sir Johngalina Vanzile Byrum over and we shared our mutual feelings of coding impotence over some nice warm salty snifters of man tears.

Remove and append for the single link lists are now functional the program itself is not compiling. problems with variable assignment in the printlist function while the entirety of the sort function remains commented out.

I will be seeking the help of the tutors come Wednesday.

Seriously, if you read these OPUS' Matt I think a couple of us could seriously use a straight Mr. Rogers goes the the freaking link-list factory and gently walks us through low lever pointer assignment….again…just venting I know I was a shitty student the first two and am now desparately grasping at concept that we luxuriously given the first week

FIXME

9/25/2013

Breaking doubly linked list into separate function files not working fixing main function file

9/26/2013

http://www.cprogramming.com/tutorial/c/lesson15.html read write sing learn repeat

Slowly working toward the ever present goal of sucking less.

10/16/2013

In fear of entirely neglecting my opus i will type things here now; for sort function use countify() to make linear comparison possible. use remove node function to populate new linked list to start with smallest or greatest value node and instead of numerically incrementing through an array; put the whole damned thing in a loop with tmp=tmp→next and similar logic to construct list. don't forget to make cases for 1st node…list = tmp.

10/17/2013

Severe code crunch day. debugging singly linked list. Found out it totally makes sense, after weeks of floundering the thing compiles. Going into fixing all the seg faults. Sort is coming along and logically sound but doens't work. The idea being to remove and preserve the largest node from a list and insert it into a new list then call the new list the old list and free the old list.

10/29/2013

Coding jam fest, doubly linked list working except for sort/printb/and something I'm forgetting. Recursion are less of a pain than loops…I went there….

10/30/2013

Preorder = Polish notation Post order = Reverse Polish notation Make a binary tree of nodes using recursion.

Idea? Populate an array with values;

Set pointer to first array element i;

first array element is first node;

check i→prev<i<i→next;

if prev V next = NULL newnode(create(value))

i++;

10/31/2013

#include <stdio.h>
#include <stdlib.h>

struct node {
        int value;
        struct node *next;
        struct node *prev;
        };

typedef struct node Node;

struct tree {
        Node * root;
        };
typedef struct tree Tree;

Tree * btree(Tree *, int, Node *);
Node * create();
main()
{
int input;
Tree *tree = NULL;
Node *newNode;
Node *place = NULL;
        while(input != -1)
        {
                printf("Enter a value to enter into the tree\n");
                printf("Or -1 a baby harbor seal cry\n");
                scanf("%d",&input);

                if(tree == NULL)
                {
                        newNode=create();
                        tree = (Tree *)malloc(sizeof(Tree));
                        tree->root = newNode;
                        tree->root->value = input;
                }
                place = tree->root;
                tree = btree(tree, input, place);
        }
return(0);
}

Tree *btree(Tree *tree, int input, Node *place)
{
        if(input < place->value)
        {
                if(place->prev == NULL)
                {
                        Node *newNode = create();
                        newNode->value = input;
                        printf("PLACEMENT!\n");
                        place -> prev = newNode;
                }
                else
                {
                        place = place->prev;
                        printf("LEFT!\n");
                        btree(tree, input,place);

                }
        }
        else
        {
                if(place->next == NULL)
                {
                        Node *newNode = create();
                        newNode->value = input;
                        printf("PLACEMENT!\n");
                        place -> next = newNode;
                }
                else
                {
                        place = place->next;
                        printf("RIGHT!\n");
                        btree(tree, input,place);

                }
        }
return(tree);
}

Node *create()
{
        Node *newNode = (struct node *) malloc (sizeof(struct node));
        newNode -> prev = newNode -> next = NULL;
        return(newNode);
}

Call function again;

11/2/2013

Thinking the best way to go about the sort function is to create a new list

11/6/2013

sort function seg faults have given way to it clearing the list entirely.

11/9/2013

Ambitious plans for the sort fuction crashed ino flames like the end of my youth. idea was to create new list and have a seeker find, incrementally the smallest value in the list and put it into a shiney new list. Once the new list is completed, free the old list and name the new list…capital gains.

11/11/2013

you know what doesn't work!?!?! Glad you asked!!

               Node *place=myList->start;
                myList->start=myList->start->next;
                myList->start->prev=NULL;
                place->next=NULL;

                List *newList=(List*)malloc(sizeof(List));
                newList->start= place;

                Node *bubble=myList->start;
                myList->start=myList->start->next;
                myList->start->prev=NULL;
                bubble->next=NULL;
                if(bubble->value < place->value)

                while(myList->start->next != NULL)
                {
                        myList->start=myList->start->next;
                        myList->start->prev=NULL;
                        bubble->next=NULL;
                        if(bubble->value < place->value)
                        {
                                place=place->next;
                                bubble=newList->start;
                                place->prev=bubble;
                                bubble->next=place;
                        }
                        else if(bubble->value==place->value)
                        {
                                place=place->next;
                                bubble=newList->start;
                                place->prev=bubble;
                                bubble->next=place;
                        }
                        else if(bubble->value > place->value)
                        {
                                while(bubble->value > place->value)
                                {
                                        if(place->next == NULL)
                                        {
                                                place->next=bubble;
                                                bubble->prev=place;
                                                         bubble->next=NULL;
                                        }
                                        if(bubble->value==place->value)
                                        {
                                                place=place->next;
                                                bubble=newList->start;
                                                place->prev=bubble;
                                                bubble->next=place;
                                        }
                                        place=place->next;
                                }
                                place->next=bubble;
                                bubble->prev=place;
                                bubble->next=place->next->next;
                        }
                }
                myList=newList;
                free(newList);
                displayf(myList);
return(myList);

That does not work!!!!

might try again to get it done recursively.

Massively behind, going to try to juggernaut through it all and work on stacks.

11/15/2013

Queues?!!? Ok, express your feelings like an adult Jason… I remember stacks and get how they work, making one from a stack is new, should not be a problem. Getting really sick of being behind, everytime I try to do something cute or cool with code I seem to fall deeper into my own grave. queues are pretty much cows. crunching on some datacomm stuff.

Data Communications Juju

8/28/2013

First day of class, super duper excited about using the raspberry pi's! spent the day taping off areas of the cases to drill out to be able to access the communications pins. Also applied the heat the tiny itty bitty heat syncs to the pi's… adorable even.

8/29/2013

Week 2

  • We now know what we will be working on'
  • Raspberry Pi's are here
  • Taped off Pi cases for dremel material removal
  • Sorted through the misc piles in the new liar looking for goodies
  • Learned why we need resistors
  • We don't have the resistor that we need
  • We don't have the comm ribbons we need
  • Put the pi's together including installing heat syncs
  • Spent Data structures setting up the pi table
  • read bout i/o pins
  • Made sure and installed Rasobian Wheezy distribution on all lab owned Pi's and set them to boot to GUI interface to make browsing whilst coding feasable
  • switched the keyboard layout to 'Murican

Week Three

Raspberry Pi was all like:

Then I was all like:

9/21/2013

Got around to creating project page for raspberry pi build, in the proccess of uploading build images.

9/22/2013

LEDs are all functional and firing sequentially. everything is pretty secure but still finicky than I'd care for. confused about how to get around the whole sequential firing and delay thing. thinking of using a switch to trigger lights from user inputs by setting cases for integers divisible by 1,2,4,8 but am crazy sketchy on how to implement this and don't know how to set case to fire least significant LED equivenlent only in odd cases.

9/25/2013

After some work and wine spillage I am still unable to get the binary flashy ligh-mo-tron up an going. I got close using a system of sqaure roots but coundn't fully account for all instances divisible ny one.

right now the major setback is little syntax not being understood, full conceptualization of operators would be swell but that is not the nature of the universe.

Lastly, Not fully wrapping my brain around what is actually firing the pins and how to circumvent the problem of firing leds in sequence of programheirarchy on an annoying level. Thinking a switch or series of switches may be in order.

9/26/2013

 #include "RPI.h"

int count;
int a,b,c,d,e,f,g,y;

int main()
{
        if(map_peripheral(&gpio) == -1)
        {
                fprintf(stdout, "Failed to map the physical GPIO registers into the virtual memory space. \n");
                return(-1);
        }

        //Define pins as output
        INP_GPIO(7);
        OUT_GPIO(7);

        INP_GPIO(9);
        OUT_GPIO(9);

        INP_GPIO(17);
        OUT_GPIO(17);

        INP_GPIO(10);
        OUT_GPIO(10);



        for(count=0;count<16;count++)
        {
                y = count/2;            //using modulus on the incrementing count
                a = count%2;
                b = y/2;                        //odd numbers produce a remainder triggering the LED's
                c = y%2;
                d = b/2;
                e = b%2;
                f = d/2;
                g = d%2;

                GPIO_SET = a << 17;          //setting LED's to trigger when the value of the variable = 1
                GPIO_SET = c << 10;
                GPIO_SET = e << 9;
                GPIO_SET = g << 7;
                sleep(1);
                GPIO_CLR = a << 17;
                GPIO_CLR = c << 10;
                GPIO_CLR = e << 9;
                GPIO_CLR = g << 7;
                sleep(.5);

        }

10/16/2013 and prior

  • cleaned up the massive mess.
  • made the cables all fancy and crap.
  • organized the work stations.
  • plugged the pi's into each other.
  • reassigned the pins.
  • studied the RPI header files.
  • got the blinkulator working using the new pins.
  • much gnashing of teeth.

10/17/2013

getting false read in pins using the red function.

fail fail fail fail.

fixed infinite loops.

all attempts to clear the pins are having a dunken bender on the fail boat.

FML

10/20/2013

UPDATE

Was not a pin clearing issue! tThat is some heart-of-darkness-just-made-it-out-of-the-jungle-goodness rah ther meow.

labeling diagram was upsidizzle, check them physical layers tater & little tots!

The correct pin was clearing but the conduit wire was on a pin receive constant current.

Never going to make it into Mensa this way.

10/25/2013

#include <stdio.h>
#include <stdlib.h>
#include "rpi.h"
int main()

{

if(map_peripheral(&gpio) == -1)
  {
    printf("Failed to map the physical GPIO registers into the virtual memory space.\n");
    return -1;
  }

 INP_GPIO(23);
  OUT_GPIO(23);





char morse;

printf("type a string: \n");
scanf( "%c", &morse );

while( morse != '#' )
{

if( morse  == 'A' )

    {
        GPIO_SET = 1 << 23;
        usleep(125000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
        GPIO_SET = 1 << 23;
        usleep(375000);
        GPIO_CLR = 1 << 23;
        usleep(600000);
        printf( ".- " ) ;
    }

    else if( morse == 'B' )

    {
        GPIO_SET = 1 << 23;
        usleep(375000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
        GPIO_SET = 1 << 23;
        usleep(125000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
        GPIO_SET = 1 << 23;
        usleep(125000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
        GPIO_SET = 1 << 23;
        usleep(125000);
        GPIO_CLR = 1 << 23;
        usleep(600000);
        printf( "-... " ) ;
    }

    else if( morse == 'C' )

    {
        GPIO_SET = 1 << 23;
        usleep(375000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
        GPIO_SET = 1 << 23;
        usleep(125000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
        GPIO_SET = 1 << 23;
        usleep(375000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
        GPIO_SET = 1 << 23;
        usleep(125000);
        GPIO_CLR = 1 << 23;
        usleep(600000);

        printf( "-.-. " ) ;
    }

    else if( morse == 'D' )

    {
        GPIO_SET = 1 << 23;
        usleep(375000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
        GPIO_SET = 1 << 23;
        usleep(125000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
        GPIO_SET = 1 << 23;
        usleep(125000);
        GPIO_CLR = 1 << 23;
        usleep(600000);

        printf( "-.. " ) ;
    }

    else if( morse == 'E' )

    {
        GPIO_SET = 1 << 23;
        usleep(125000);
        GPIO_CLR = 1 << 23;
        usleep(600000);

        printf( ". " ) ;
    }

    else if( morse == 'F' )

    {
        GPIO_SET = 1 << 23;
        usleep(125000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
        GPIO_SET = 1 << 23;
        usleep(125000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
        GPIO_SET = 1 << 23;
        usleep(375000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
        GPIO_SET = 1 << 23;
        usleep(125000);
        GPIO_CLR = 1 << 23;
        usleep(600000);
        printf( "..-. " ) ;
    }

    else if( morse == 'G' )

    {
        GPIO_SET = 1 << 23;
        usleep(375000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
        GPIO_SET = 1 << 23;
        usleep(375000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
        GPIO_SET = 1 << 23;
        usleep(125000);
        GPIO_CLR = 1 << 23;
        usleep(600000);
        printf( "--. " ) ;
    }

    else if( morse == 'H' )

    {
         GPIO_SET = 1 << 23;
        usleep(125000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
         GPIO_SET = 1 << 23;
        usleep(125000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
         GPIO_SET = 1 << 23;
        usleep(125000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
         GPIO_SET = 1 << 23;
        usleep(125000);
        GPIO_CLR = 1 << 23;
        usleep(600000);
        printf( ".... " ) ;
    }

    else if( morse == 'I' )

    {
         GPIO_SET = 1 << 23;
        usleep(125000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
         GPIO_SET = 1 << 23;
        usleep(125000);
        GPIO_CLR = 1 << 23;
        usleep(600000);
        printf( ".. " ) ;
    }

    else if( morse == 'J' )

    {
         GPIO_SET = 1 << 23;
        usleep(125000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
         GPIO_SET = 1 << 23;
        usleep(375000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
         GPIO_SET = 1 << 23;
        usleep(375000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
         GPIO_SET = 1 << 23;
        usleep(375000);
        GPIO_CLR = 1 << 23;
        usleep(600000);

        printf( ".--- " ) ;
    }

    else if( morse == 'K' )

    {
         GPIO_SET = 1 << 23;
        usleep(375000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
         GPIO_SET = 1 << 23;
        usleep(125000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
        GPIO_SET = 1 << 23;
        usleep(375000);
        GPIO_CLR = 1 << 23;
        usleep(600000);

        printf( "-.- " ) ;
    }

    else if( morse == 'L' )

    {
        GPIO_SET = 1 << 23;
        usleep(125000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
        GPIO_SET = 1 << 23;
        usleep(375000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
        GPIO_SET = 1 << 23;
        usleep(125000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
        GPIO_SET = 1 << 23;
        usleep(125000);
        GPIO_CLR = 1 << 23;
        usleep(600000);

        printf( ".-.. " ) ;
    }

    else if( morse == 'M' )

    {
        GPIO_SET = 1 << 23;
        usleep(375000);
        GPIO_CLR = 1 << 23;
        usleep(200000);
        GPIO_SET = 1 << 23;
        usleep(375000);
        GPIO_CLR = 1 << 23;
        usleep(200000);

        printf( "-- " ) ;
    }

    else if( morse == 'N' )

    {
        printf( "-. " ) ;
    }

    else if( morse == 'O' )

    {
        printf( "--- " ) ;
    }

    else if( morse == 'P' )

    {
        printf( ".--. " ) ;
    }

    else if( morse == 'Q' )

    {
        printf( "--.- " ) ;
    }

    else if( morse == 'R' )

    {
        printf( ".-. " ) ;
    }

    else if( morse == 'S' )

    {
        printf( "... " ) ;
    }

    else if( morse == 'T' )

    {
        printf( "- " ) ;
    }

    else if( morse == 'U' )

    {
        printf( "..- " ) ;
    }

    else if( morse == 'V' )

    {
        printf( "...- " ) ;
    }

    else if( morse == 'W' )

    {
        printf( ".-- " ) ;
    }

    else if( morse == 'X' )

    {
        printf( "-..- " ) ;
    }

    else if( morse == 'Y' )

    {
        printf( "-.-- " ) ;
    }

    else if( morse == 'Z' )

    {
        printf( "--.. " ) ;
    }

    scanf( "%c", &morse );

}

printf( "\n" );

return 0;

}

11/4/2013

genius idea to use a second wire are a character terminating ping to make life much much easier.

add the number collected for the two different lengths, collect and compare against the mean.

this gives buffer room if a human wants to play.

11/6/2013

two wire idea shot down…is now crashing into flames….like the end of my youth….

11/14/2013

Buffer? to be explained via project page.

11/22/2013

#include<stdio.h>
#include<stdlib.h>
#include"rpi.h"

INP_GPIO(8);
OUT_GPIO(8);

int y;
void check();
void main()
{
        while(1)
        {
                y = INP_GPIO(8);
                if(y !==0)
                {
                        check();
                        usleep(2800);
                }
        }
}

void check()
{
        usleep(7000);
        if(y !==0)
        {
                printf("-/n");
        }
        else
        {
                printf("./n");
        }
}

12/6/2013

After much gnashing of teeth and Pages of paper mapping the idea of using a binary tree as a means of dicphering the incoming message I think i've to the realization that I may have bitten off more than I can chew currently. Even if that were not the case; it is going to be very very impossible too (maybe just dumb) get it to work without having a stable signal read to calibrate the parameters for.

12/12/2013

All nighter, currently 2:26am and I'm stressing because I can't find one o the peices of code I worked really hard on this semester. Recursive switch with in line function definitions, will post if I find it later.

Portfolio

Data Communications

cprog

unix