User Tools

Site Tools


blog:fall2015:nrossi3:journal

Tuesday August 25, 2015

Today was the first day of class. We talked about the Lab46 website http://lab46.corning-cc.edu/haas/fall2015/data/ and about some projects. First off we didn't have any computers because of a backorder (or an order that was placed but never received) so we went old fashioned, Notebooks! We then started talking about nodes (after moving the whiteboard to the front of the room) and reviewed on append, pointers and some coding. To go more into detail we talked about the first project which is to build a list.

This list must have:
Display
Insert
Append
Obtain
Clear
and Quit

Matt showed that the end of the list always needed to point to null for example
MyList → (3) → (1) → NULL

He also talked about doubly linked lists and Temporary (Tmp) pointers

Thursday August 27, 2015

Today we went over some more pointers having do do with the grid-line of memory. We also covered some C which I desperately needed. Starting today I was vigorously going through the c book and programming as much as I could to try and get back into the rhythm of things. Unfortunately it takes longer than 2 weeks to relearn C. Totally should have attended Matt's lab.

Tuesday September 1, 2015

Today coming into the class we had computers!! Some were still having problems but none the less were somewhat functional. Coming into a Linux system for the first time was interesting. Its something I really enjoyed, a nice change from Windows. Firstly we logged onto the system then used “startx” to open and display the desktop. To open a web browser use “firefox&”. Then we opened lab 46 of the command line using “ssh lab46”, then logged in. We created a Data directory and cloned our repository to lab46, no need to spend a week on it. Finally we coded and it was wonderful. I had still been practicing at this time but couldn't get my compiler working on windows so to see my code work was nice. Although it also reminded me how much work I had ahead of me.

Thursday September 3, 2015

Today we covered nodes which started with this crazy thing

Crazy right? That could be a node we use. we also covered a list of the things we could have to make in here which includes:
create
copy
clear
insert
append
obtain
setpos
getpos
find()
swap()
sort()
compare()
empty()
RMlist
display f
and displayb

We talked about how lists are inserted into nodes and how to point pointers at certain nodes without losing other ones.

Tuesday September 8, 2015

Today You could say was a bad day but it wasn't in my eyes. I rode my 1991 Harley-Davidson Sportster up to the college but unfortunately I had gotten a flat front tire on Denison parkway. I pull up to Chemung st. at the bottom of the hill and I'm calling people trying to figure out what to do. This nice man came and helped me. We used his compressor but it didn't work. Eventually he took me up to the college and I made it to class. In the 30 minutes I missed, Matt talked about the next project. I'll have to read up on it later. He then began to show us the de-bugger, and incredible tool fixing program problems. we used “wemux” to see the screen he was using as he was demonstrating.

There are 3 types of errors:
1. Syntax
2. Logic
3. Runtime

runtime errors are caused my things such as divided by zero and can also be caused by segmentation faults. Segmentation faults - Accessing memory that you didn't allocate. Matt likes to state this roughly as, “It's like the Greek god Zeus has zapped you with lightning and your ashed remains create the word 'segmentation fault'”

For syntax errors use the compiler to fix the problem
Use the debugger for Logic and Runtime errors.

To start debugging start compiling with the following: gcc -o {name} {name of program.c} -g
Then to run the De-Bugger type: gdb .name

By typing help you get most of the commands but here are a few simple ones:
List - lists the source code 10 lines at a time
{enter key} - repeats last command
List {Line Number} - Lists the code for that line number as well as a few lines above and below the code.
step - runs one line
display {variable}
continue - resumes execution until break or program failure.
print array - prints address of array print&i - prints address of i

*As for the result of my bike, I took it over to GoodYear with no success. I waited there in the parking lot for 1.5 hrs until my buddy picked me up with his trailer. We took it to the Corning Harley Davidson shop and they replaced the tube. I was at the Harley shop for 1.5 hours. I didn't get home until 5 and hadn't eaten anything since then. Despite that, It was still a good day.

Thursday September 10, 2015

Today we went over more of the functions that the debugger can perform. The debugger is mainly used to backtrace an issue (normally a logic or runtime error) to find the point in which it breaks.

Some controls are as follows:
print - Prints out the line from your program that you are currently on
step - only executes one line, follows to next instruction
next - skips over function
continue - goes until next break point
set var {variable} = {Number}

Tuesday September 15, 2015

Today we went over quite a bit in class so i'm going to start with this crazy picture:

These are the 2 ways you could move values to place another number in the node marked for 10. We talked wuite a bit about different levels of programming based on the results of dsi0 (unfortunately the program i didn't finish due to extreme lack of c knowledge). He categorized these different programs into 5 categories starting with -1 being the messiest and ending with 3 the cleanest. It really helped me learn more C and I would absolutely sit it on his C class to get more experience but with it being at 2:30ish and me getting a job real soon it doesn't help my case. non the less i'm trying to program often in my spare time (In which I have very little).

Some extra C knowledge:
break; - Breaks out of a loop

The cleanest version of his array looked as follows:

for( i = 19; i = pos; i– ) make room
array[ i ] = array[ i-1 ];
array[ pos ] = input
place the value we wish to have

Sln1:

make -c /var/public/fall2015/data/sln1/ copy (creates the sln1 files) /src/data/sln1$ ls … updates makefile app bin inc lib src unit

note: I really should try harder to start coding earlier. Problem is all my stuff is due on Wednesdays. data project, Physics lab, Physics Homework, all due Wednesday. I try to relax on Thursday and Friday then my weekend becomes super busy and i'm screwed on Monday… Hmmm I'll have to work on that.

Thursday September 17, 2015

Today we went through the sln1 file we created on Tuesday. this included going through node, unit, and others (Node is located in sln1/app/node).

Sln1 contains these 6 mini programs:
1. mknode()
2. cpnode()
3. rmnode()
4. node-app-arrtolist.c
5. node-app-display.c
6. node-app-display2.c

Tuesday September 22, 2015

Today we first talked about sln1. Many people were under the impression that cpnode, rmnode, and mknode needed loops. these three function only use a single node so no looping is necessary. he explained cpnode as such.

all of these functions only have one return statement. This is so because of a couple reasons
1. Most code found on the internet has more than 1 return statement. this help to prevent people from copying code from outside sources.
2. To give us a challenge. Coding is no fun unless you put limits on it right?

Next he showed us how to upgrade to the new project, sll0.
its as simple as typing:

make upgrade-sll0

The project sll0 includes:
1. displayf.c - which displays the contents of your list
2. insert.c - which is a function that will insert a node
3. mk.c - which is the function to create a list
4. pos.c - This holds the getpos and setpos function getpos() - this will get the position of a given node setpos() - this will set a pointer to a node you tell it to point at

after we finished with that we talked about the insert function we would have to make. Insert is a function that “inserts” before a node. This can be used to initially put nodes into an empty list, or add nodes to a list. The only thing insert cannot do is place a node after the last value and before NULL.

The insert function will look like such:

myList = insert(myList, Tmp, Tmp2)

myList - The list the node will be inserted in.
Tmp - the position of the node after where you want the node inserted
Tmp2 - the node you want inserted

Displayf is to be displayed as such:

List: 2 -> 3 -> 4 -> 6 -> NULL
List: [0] 2 -> [1] 3 -> [2] 4 -> [3] 6 -> NULL

Thursday September 24, 2015

Today not much was discussed. Because we had talked about sll0 on Tuesday, Matt made today a work day. Unfortunatly I didn't get much accomplished because my node-app-arrtolist was having some trouble. Even though I already had submitted it, I wanted to fix it and make sure I understood what I did wrong or mainly so, what I could improve upon.

We did talk a little about what we were to check for with the next project

We are to check for the following:
- NULL list
- List of 1
- List of many
- Empty list

These are the possibility's we will encounter as we start these programs.

Tuesday September 29, 2015

Today we talked about the next project, sll1.

sll1 contains:
1. append.c - this function is able to add a node after another node
2. cp.c - this function copys a list and returns a duplicate list
3. search.c - this function searches for the node with a given value.
4. displayb.c - this function displays the list backwards. What fun!!!
5. compare.c - this function compares 2 lists to see if they are similar.

The only function I'm worried about is compare. Matt was saying in class that compare is close to insert in difficulty and well, I haven't started insert yet. I'm not too worried. My coding has come a long way from where it was when I started the class. I felt as if I didn't even know how to start programs where as now, I can at least start them and get the logic completed. I still need to brush up on all my syntax and work on the little things. I tend to forget semicolons and I always forget the signs when I do if statements or loops, for example 1 v 2:

1. if( tmp = NULL)
2. if( tmp == NULL)

in 1 I only use one = sign which tries to set tmp equal to NULL where as in 2 I'm checking to see in tmp has the value of NULL. These little mistakes cause all sorts of errors and I need to get on top of them so I can speed up my time working on projects and not spend hours upon hours trying to fix my little problems. Although its good for me and keeps me aware…

Thursday October 1, 2015

Trouble hit the homefront, my insert function was not working before it became Thursday. I was working on it last night and was coding for a good 3 hours. It seemed to be working. I spend at least 45 minutes trying to figure out why it was seg faulting to no avail. Then suddenly it worked perfectly and passed every test (I had tested it using bin/unit-insert). I was so relieved as I had about 20 minutes to spare. I added it, committed it and pushed it. Then I went back in to comment it all. After I had finished commenting it, I thought I'd check one more time (I love to see my code pass), but unfortunately it seg faulted again. NO CODE WAS CHANGED!!! I had even checked my repository character for character and nothing had changed. At about 23:59 I was considering whether it would be better to send it in broken and fix it later or wait and get 25% off. I chose the 25% off and I chose it for this reason, It's not right to submit broken code. It is never alright to submit broken code and I would have rather waited and gotten more points off than to submit code that doesn't work. This problem struck me hard though. Starting now, I'm going to start my coding early. Try to do a program every day. That will help me get these projects done.

Other than that it was a work day in class and like normal I wasted my time (well you might think I wasted it). I was asking Matt about vim and he told me there was a game to help teach you (BIG GAME FAN RIGHT HERE!!) so of course I had to check it out. It is a fun little game and I enjoyed playing it. Although I could have been more productive in class code wise, I still think learning vim (even in a little game) will help my substantially in coding and other uses.

blog/fall2015/nrossi3/journal.txt · Last modified: 2015/12/07 16:29 by 127.0.0.1