User Tools

Site Tools


blog:fall2015:bboynton:start

Bryan Boynton's Fall 2015 Opus

Introduction

I am Bryan as you can see above. I am 20 years old. I am a CIS student. This is my second year at at corning.

Week One

the First week of class was interesting. No computers and one small white board. My C is very rusted. I am planning on starting the projects as soon as I can instead of putting them off till the last couple of days before the dead line. I also need to play around with lab46 again since I forgot most of it. I kind of understand the nodes and how to add new ones to the list with the tmps and next. Hopefully I do not forget before we get to them.

Week Three

For the third week of class we looked at the debugger tool for the gcc compiler. This tool will be very valuable to us in are attempts to code programs for data structures. We went over some of the basic options the debugger offers like list that displays the program in blocks, the command display which we can use to check variable at certain spots, step which runs the next line of the program, break which is used to set break points for the program to stop at like a certain line, and next which lets use run past functions that we are not interested in like scanf or printf. The debugger we can use to find run time errors or find why we are getting a segment fault which is a common run time error that I get when trying to use pointers and arrays mainly from simple mistakes that I have a hard time finding since I assume that the problem is larger than a simple mistake. The debugger will make finding this easier especially when we get to larger programs and looking at it line by line in nano or vim will take too long to find the problem. We also looked at the at the next project. This is getting into the data structures that we will be using but the project involves only pseudo code and pictures to help use grasp and understand things like a link list that we will be using in the future in C. The first project was also due on the 9th. That project helped me remember the syntax as my code was full of syntax errors that keep me from running the program or logic errors that I got with my if statements as I only used one = instead of the == that I need to check if it was equal to a certain value so it ran every if statement every time. I still have to get use to coding in C again and need to figure out how to get pictures of my drawings for the project due for week 4 from my phone to my lab46 so they can be submitted with my pseudo code. I think I can email it to my lab46 but I do not know how to get it from there to my src folder. I also believe that I can clone a repo from bit bucket to my lab46.

Week Four

For the fourth week of class week looked at projects. Both the one due the week before and the one due the next week (sln1). For the project dsi0 we looked different ways that people did the project and other ways of doing this. I was glad that my approach while not being the most effective or easiest was also not the most insane way of approaching the project. I understand that I am not as bad as I thought but also that I still have room to improve my coding skills and hope to do so over the course of this course. Along with looking at the last project on tuesday we looked at the sln1 project. We started by grabbing a copy of the project that contained all the files we needed for the project like the test and libraries along with the Makefile. We spent a lot of the time looking at the Makefile and what it does. There are multiple ways to use the make command that compiles the code we wrote along with everything else which I am very glad we have because compiling multiple files together is still confusing to me and I am sure I would make a mistake and overwrite my source file. We can make clean which gets rid of all the already compiled code so we can do a fresh start to make sure there is no problems. We can also make save which will back up our source code. Make submit which will submit the project for us (replacing the submit line). The makefile will help me with the creation saving and submitting of the source code for this project which is kind of some of the most important things. We also talked about some basic stuff for adding in a node to a singly linked list. On wednesday we looked at more of the sln1 project. This time we looked more into the project itself. We looked at the src folder in the project folder which is where the bulk of our coding is going to be done. We looked at the test that we have in the project folder that compile with our code so we can check if the code does what it is suppose to do which I am really glad to have for troubleshooting purposes. We also looked at the function malloc and how we will be using it. I normally mess up when using this function as I have only used it with pointers and pointers are not my strong suit. I have been reading up on pointers and watching videos to help explain it better but I am still having trouble. Since the ideas in this projected are linked to sln0 which I felt good about while doing it I feel like this project is going to easier to grasp then some of the other projects from C/C++. I was able to complete sln0 well before the deadline but I might be pushing the deadline for sln1 due to putting off starting which I need to stop and hope to start week 5s project on that Thursday after my sln1 is turned in.

Week Five

For the fifth week of class we focused mainly on the projects due that week and the one due the next week. On the 22nd we updated are sln1 project which included changes to the makefile to get rid of some bugs and improve the code. Applying the update was easy and took no time at all. Also we talked about using make clean after an update to make sure that the code we wrote still works and we were not getting false positives on the test programs. We also went over stuff about copying a node and having the copy’s after pointer to the same node so:

(2)→(4)tmp→(9)→NULL

tmp2=cpnode(tmp)

(4)tmp2→(9)

From there we can change the after to point to something else like the 2 so we can copy and insert a node from a list then back into the list. We also talked about NULL and how we should make sure to set things to NULL because we can check if something is set to NULL. Because it can be checked we can use it for troubleshooting and debugging purposes.

We got the next project sll0 which we could only get after we completed the code for the sln1 since the code in sll0 depends on our code we wrote for mk.c cp.c and rm.c. We also have the option to use the code we wrote or the already compiled code that Matt wrote for it.

The project sll0 is a little confusing to me with how everything works. I understand that “my list” contains all the nodes but putting the nodes into my list is where I am confused. I know that first points to the first node and last points to the one that points to a NULL so we have a start and a end point for the list with just quick reference. I get warnings when I try to make a node at first but the code still works. By works I mean it passes the test so I hope it is not a false positive.

On thursday I found out that other of the students had the a similar problem as I did. While they had a zero at the beginning of their list mine would drop the value from the last list and replace it with a zero. I was able to stop this from happening by removing my rmnode function call from the call. Matt said to someone else that their was caused by a memory leak but I do not know if mine was the same thing. I do not know why the rmnode function would cause a problem since it sets thing to NULL and not zero which are not the same thing.

Thursday was a work in class day so we did not go over anything new. We did go over some cases that we should check for in our code which are:

case 1: a NULL list ex:mylist=NULL;

case 2: empty list ex:mylist[first→NULL/last→NULL]

case 3: list of one ex: mylist[first→(1)/last=NULL]

case 4: list of more than 1 ex: mylist[first→(1)→(2)→(3)→NULL←last]

I did not get very much done during the class. I ended up helping a classmate make improvements to his sln1 so his node-display2.c would work better even though he already submitted sln1 the night before. It was good practice for reading code that is not mine and understanding what is going on and troubleshooting it. He was having a problem with a zero appearing at the start of his list. After playing around for a bit got it to stop giving us the 0 but instead gave us two of the first node. It turned just to be his order for his inputs and his assigning of the input to a node’s info was weird. He was assigning an input into a node before he got the input from the user. simple stuff that took a while. I still need practice troubleshooting and I am not very good with the debugger.

Week Six

Week six of data structures was not full of new stuff. Did look at some grade stuff though. Matt has made a “status” command for use. This command can allow us to see the grades we got on our projects. Along with grades we can see if we have an opus entry for each week also what days we missed if any. This was on tuesday along with review for sln1 mainly the copy node function. We talked about setting our tmps to NULL when we declare them. We also talked about checking for NULL empty or normal list before we continue on with the rest of the code. This prevents problems we could run into like segment faults. After we finished talking about sln1 we looked at sll1. Sll1 had five parts append display backwards search copy and compare. Compare looks to be the hardest of the functions to write. This may just be that we have hexadecimal numbers we have to deal with and i'm not comfortable with hexadecimal numbers in C.

On Thursday we went over something called metrics. This is a graph Matt made based on when the class worked on the projects and for how long we work on it for. It is interesting to see and I am sure I will check it out every week. After we looked at the first metrics we decided to do a work day again. I was able to get all the way through display backwards with no problems. After that I was able to get most of search done. I figured out it had to do with an infinite loop that caused a segment fault. For copy I I also ran into a problem for segment fault. This was because I forgot to check for a NULL list when I started. I checked for an empty list first with myList→first!=NULL and since myList had no first in it, it would seg fault this was fixed by putting an if statement with myList==NULL then a else if for myList→first!=NULL. All my other problems had to do with typing myList→after instead of myList→first or last, or mylist instead of myList. So most of the time it had to do with my own spelling mistakes or misuse of words in the code that caused my problems not that I do not understand the function. I am grasping the concept for linked list and nodes and I am having a good time coding these projects. My work load is starting to fall into a schedule so I hope to get the projects done sooner than the due date.

Week Seven

This is the weeks before break and during break week.

projects due: sll2, sll3, sll4

10/6/15

on Tuesday before break we talked about sll2. We went over the assignment and the functions we had to write. There were obtain clear remove swap and sort. Clear uses the remove node function to make a populated list into an empty list. remove list uses clear to an empty list then makes a NULL list. So it just remove just a larger scale version of remove node. Obtain is just taking a certain node out of a list and reconnect the list. This will be used in swap and sort to make it easier. Swap just switches two nodes in a list which can be used in sort since it has to take the nodes and move them after we obtain the nodes we are switching we just have to reconnect them which is very easy with just a few tmps. Calling swap in the sort function will allow us to move nodes around without having to reconnect them manually each time. Along with talking about the project we also talked more about empty and NULL list. Along with that came with talking about having things like mylist=NULL and mylist2=mylist so meaning that mylist2=NULL. But if we do mylist=mklist() and mylist2=mylist we have mylist2 pointing to the same empty list that mylist is pointing to. We also talked about double node pointers we have to do (*tmp) to use it for after or info. So it stands that for triple pointers it would be (**tmp).

10/8/15

We started talking about projects sll2 and sll4 which are due 2 weeks after break. Sll3 is a smaller project. It just has use put a qty to insert, append,obtain, and mklist. Now sll4 is very interesting. We are moving from looking at a list as a bunch of nodes and are now looking at lists of list or groups. We are adding another level to the programs. I do not think we will go pass making groups of list and manipulating them. For sll4 we have to write a make group, remove group, list append, list obtain,list display,list get pos and list set pos. Now this I am guessing are very similar to the ones we use for nodes and the lists but now the list are the nodes. Now we have list pointers for after. I have not spent much time working on these as I was focus on sll2 and getting my ideas about those functions but I am very excited to try these.

I wish i could say I worked on the projects all week over break but sadly I did not. I spent sometime doing some work on paper and bouncing ideas around but could not find time to sit down at my computer and type up some real C code for them. I have a pretty good idea about how these functions work. Im sure I can get them done before the due date.

Week Eight

Week eight was not filled with a lot of new skill learning or learning new forms of list.

sll2 recap: Working through sll2 which I thought was going to be easy turned into problem after problem sort and swap were where most of the problems happened. I am not sure if it was my logic that was causing things to break but I had segment faults occurring in my other programs like insert or copy list. The insert was due to the fact that in swap node it would swap nodes that were right next to each other but since the nodes were obtained then inserted at at a tmp that was not in the list anymore. Copy list I am still a little confused why it was segfaulting. I was able to get all but sort list to pass all the unit test. I will be working on trying to get the copy list working the way it should when I find the time.

10/20/15

Tuesday we looked at some drawings to help understand the obtain. Basically all it is, is the setting of a nodes after to tmp then linking the list so the node we want is no longer any other node’s after. This is really easy to understand in picture form and I am glad that we can draw them.

After it was a work on in class day. This gave me time to work and finding all the conditions I had to look for when calling obtain and get some basic structure for the logic in place.

Swap list took a little more work doing. I had to check for: Either being first or last both of them being first and last (ie item1=first item2=last/item2=first item1=last) if they were next to each other(reason why insert was seg faulting / had to be checked in each other check)

if they were not at the first or last

Sll3 and sll4 are due on at the end of the 28th. I have been trying to get sll3 done but am getting trouble with qty only returning 0. I have not had to the time to spend a lot of time looking as why but hopefully I will find it soon. I think it has something to do with how I am using the qty in the functions. Hopefully it will be easy to find cause staying up all night coding leads to a lot mistakes that takes a long time to correct.

Week Nine

This week marked the end for the singly linked list and the start of the doubly linked list and nodes. We started class on tuesday by talking about the doubly linked list. The code for them seems very straightforward. The biggest difference was the prior pointer that the nodes now have. With this new pointer we have to make sure we set it to the correct place otherwise the list would not be right. Also this removes a need for a get pos and set pos function as we just have to reference the after and prior pointers to do things like append and insert. One of the biggest problems I am going to face is the use of return codes instead of a list pointer. Setting up the checking statements for each condition will take some time and planning. After those it will be very similar to the code for the old singly linked lists. For thursday we worked on so code for the doubly linked list. We found we can do things like nodes prior after = newnode and that would insert a new node at the current nodes spot without having to set tmps everywhere. After we looked at code and drawings we had a worki in class day. I was able to get most of the checking statements set up for make during that time. I had to put off working on it over the weekend due to some test I had to study for and hopefully it goes smoothly and I meet the deadline.

Sll4 caused some big problems for me. I had trouble with the insert append and obtain. I am still lost in why I was getting these problems. I think it has something to do with my code from before was broken. I could not really figure it. I am excited to start over for these new projects and getting to make better code instead of the mess I had before.

Week Ten

We started working with doubly linked list and nodes. I am feeling very good about these. The big difference is the prior pointer each nodes have. dll0 turned out very well. I only had problems with time and find. Find did what it was suppose to do but I had trouble finding how to make it keep its spot in the list for a resume function. I was able to get dln0 working completely with few problems. The biggest problem I have is the return statements. I am not sure why but it does not sit well with me. I am able to work through them it just takes alittle bit of work. Tuesday we talked about dll1. This is just making more list functions for doubly linked list. Thursday was a work on stuff day. I was able to get most of the obtain done in that time. So far since then I was able to get obtain 100 percent empty 100 percent and remove 100%. I think I have compare almost completely. The only problem I am facing is setting deference is to a value. I am sure this is a very simple problem to fix but I am just over looking. I am not looking forward to sort as I was not able to complete that one before on the singly list projects. I feel like this time might be different as my main problem before was with other code that I wrote for other functions breaking and seg faulting. Fallout 4 is coming in an hour so hopefully my grades do not drop. Fallout hype.

Week 11

Coding has been going well for the most part. Not finishing display before is coming back to haunt me as I have to code it again with new functions. The idea of printing out ascii characters instead of the number values seems like it would be easy to but in. Have a if statement for forward and backwards/with or without spacing then a if for ascii or number values. No problem. Putting qty into the old code gave me some trouble as I forgot that it is →qty=*number* and not just qty=*number*. This took me way longer to figure out then I would like. Always for getting the same things. I feel like I am doing solid work on these projects as far as the list and nodes are concerned. We are started to work on stacks now along with the list and nodes. I am scared of these as the are confusing. I think a stack is a similar to a list but we can only access it in a backwards order. I have not really had a good look at the functions that use the stacks but I am pretty sure that we can use list functions on them. Obtain insert and append all went very well for the doubly linked list. It went a lot smother then the singly list versions. This mainly do to the fact that they are like the same code. This time the I just had to worry about the priors pointing in the right place. I also ran into a slight problem with my code in that the unit test would give the functions the wrong list and then compare it to a result that was based on the right list. I do not know if this is because of my old code I did not finish.

Week 12

Data structures has been going well. I am quite surprised at how well really. The last couple of projects have been iffy. I think mainly because I did not give myself enough time to really work out the code step by step. I feel like my code could be a lot shorter but I understand the basics of each. Since we are nearing the end of the semester we have not really covered new topics in class. We talked about queues which I got really easy once I understood that the list was already there so I did not need to create the list each time just simply give it a pointer name. I was even able to get it done early since the due date was moved till after break. Speaking of break I wish I could say that I coded the whole time and finished the next project. I really wish I could but I can not. So hopefully I can start and finish it before the this Thursday. I feel pretty good about stacks. My understand is that it is like a opposite to queues. So instead of changing the last of the under laying list we are looking at the first then we want to add things we have to append them at the last of list and when we grab we grab from the start of the list.

Week something

PHP has been going well. Its been fun to play around with all the graphical stuff we can. All the different colors and shapes really catching my interest. The best part is that we can make our pictures we make dynamic with the html get variables. I have some ideas for something I want to work on. Once I finish making a star that does not look like something made by a one year old I want to write code that will make a original 13 colony USA flag. The hardest part I feel will be the circle of stars in the top left corner. I do not want to code each star individually but make loop that will make each one. I am thinking one each point in the stars will be its own circle. So the top points will all be in a circle and so on and so on. I am not too sure how to make this. Another idea for the ring of stars would be writing a function that takes on point and makes and calculates all other points for the star. This seems like the easier approach since I would only need to code one circle to find the 13 points, one for each star. Once that is finished I would like to upgrade it to make use of the html get.

Week Something +1

Still have no idea which week this is of class but it is feb 29 right now so there is that. PHP is going well for me. Some of the stuff we type in our programs in class confuse me but I understand the logic and most of the syntax of most of them. The form we made was pretty fun and it kinda gives me an idea for a web based chess game using a image that gets updated based on a piece movement form a user input. I think I would have some problems with making a turn system so white or black does not move twice in a row. The flag is going well. I have all the stripes and the spot for the stars made. I ended up so far with two loops. One for the red stripes and one for the white stripes. I could have of made a color array then do one loop and make the color switch each time but I had already made the two loops and they worked. It would not have save me very many lines so I did not worry about it. I have all the spacing out for the stars. I just have to scale my star down and then write a function that will make a star from one point and call it each time through the loop but I am going to need to set a condition because the stars are off set on each line so they do not touch. So I might use two loops again. Once I get the star scaled to the right size and write the function to make them I will be able to decide.

Week something +2

still no idea about the week. The math for scaling the stars for my flag is still throwing me off. The bottom parts look really funking even though they have the same points in relation to the center. Maybe its just me. I dont know. My doctor draw thing is works for all but filled circle which I do not know why. It worked last week but not now. We had a nice talk about computers friday. It was nice to get some insight on this stuff. We talked about some exploits that are known in hardware like the row hammer in ddr 3 RAM. I heard about it but never saw to much about it. It was a good day over all.

Week something +3

I think it's the eight of classes? Still lost on that end. I have not really worked on my flag anymore. I have not really had the time to sit down and work through it. The data base stuff we did was really cool. I have not really worked with data bases in that sense. The most I have done is just searched a library database for a book. They seem really cool but I have no idea they are made and they seem really hard to do. The modifying part was my favorite. It was fun to mess around with the mysql stuff. On friday we looked at the other image stuff for php. I Think it was called image magick not really sure. It seems to be really fun and I would love to play with it more. Maybe when I get my flag done I can run the image through some of those functions it. The mudkip turned out great so what could go wrong with it.

Week something +4

Pi day was Monday so we look at coding some php that would approximate pi for us. We tried two different ways. One was just alternating adding and subtracting numbers for a set number of times. The longer we did it the closer we got to pi. The second method we tried was called the monte carlo algorithm which uses the number of random points that fall into a circle with a radius of 1. This gives us a number close to pi but each time it is ran the pi approximate we get is random. After we successfully coded the monte carlo algorithm “Johnny no fingers” asked if it was possible to represent it graphically. That was then assigned as the first project. The project is coming along well. I have the points show up on screen along with a wedge of the circle and the square. The points are two different colors. My main problem now is finding a good color scheme for it. I want something that looks nice but also screams pie.

Week something +6/+7

Spring break was nice. I really liked the part when it snowed at the end. The week before spring break we were working on our graphic monte carlo pi program. I made some great head way it during the week. Once I finished I added some on screen text to the image for stats like the pi we have with the repetition number and the total of dots in the circle. I also added in a get stuff into my function. The get for the number of times it looped through the program. This lets the user set the total number of times they wanted it to run with a default value in case they did not want to enter a value. I also changed the color scheme for the image to make it easier to look at. I also chose to do the wedge instead of a whole circle. After I finished I decided to try out some transparent circles instead of dots for my points. They did not really turn out the way I wanted them to. They really do not look that transparent but it still looks nice. Switching from dots to circles greatly decreased the number of times I could run the program before getting a time out from the web server so pi is not as close as it once was but it is still pretty close to the real number. Over all I am happy how it turned out. On Wednesday before break we looked at on screen text and how to load our own fonts into the function which was the only part I was lost on for the on screen text function. Can not wait to get some comic sans in there.

Week Something +8

The pi project turned out pretty well. Our next assignment is to make anything we want and present it. At first I struggled with this since I had no idea what to make. I was thinking about finishing my flag project that I've been working on but I have been doing a lot of graphic stuff and wanted to look at something else. While looking at the php man pages I saw some stuff about encryption and that sounded interesting so I gave a shot at it. Turns out that php has a few functions for encryption. I designed a page to ask for a user name and password and pass that info to a new page that will send the user back to the first page if either is wrong. At first I had some trouble with it. I tried to hash the right password and the user given password and then compare them but this resulted in a mismatched hash each time. It turns out that php has a verify password function that will compare a string to a hash to see if it matches. That made it easier. I also added in a hyperlink to a cool fun place. I was given the idea of making it to play sound when the user enters the right password/username. I looked into it and html supports it I have not been able to add it yet. I have to find the mp3 file of the sound I want then add the code in an echo statement and should be boom pow blam.

Week Something +9

This week was a good week. I feel like I improved my little project by 10000000000000000%. I was able to make my webpage play some secret music. I was also able to get it to loop till the user leaves the page. The audio controls have been removed from the screen so there is no way to pause it. I also added more than one user to login into the page. The passwords are now just stored as the hash and not the plain text that is hashed each time. Each hash is assigned to a user and is received by a function call that searches for the user and passes back the hash. The entered password is then verify against the hash if the hash is not equal to “no user”. The page the user login into changes based on the username.Tyler's raptor that he is using on his project gave me an idea. That was to switch the image out for something else. I am glad he went for the idea and now we have the rare trump. I also tried to get him to change the sound but I am glad now that he did not. I am not sure what to add to my page now but I am sure I will think of something. Bad news is that I forgot the password for the John Cena account.

cprog

blog/fall2015/bboynton/start.txt · Last modified: 2015/08/27 09:44 by 127.0.0.1