User Tools

Site Tools


blog:fall2015:ahorton8:journal

This is an old revision of the document!


August 30th, 2015

I've begun working on dsi0. So far, all I've done is customized my Opus, connected to irc, and subscribed to the mailing list. Definitely didnt use my @corning-cc.edu email at first. Totally. I wouldnt do that. But right now, I need to go through and review some C/C++ before starting the actual coding portion of dsi0, since, I really dont remember how to do much of anything… My repository should still be set up. Need to double check it at some point.

September 2nd, 2015

I began working on the coding portion of dsi0. I barely remember C, and am not entirely sure how to do an array without a starting size, so I decided to just start small and try to make an array that can fit 20 characters, and see if I could get it to work with stopping at -1. Yeah… instead I got a segmentation fault, woo! I'll look more into it at another time, but I at least wanted to try a little bit of it tonight.

September 9th, 2015

After far too much procrastination and avoiding my work, I've done more with dsi0. Yesterday, I did a little bit of work on it, just creating the menu for the program, and allowing the user to input their choice. Today however, I got a bit farther into it. After many segmentation faults, missing characters (got a segmentation fault because I missed an & somewhere…), and a god knows how many other issues, I've got a build function, display function, and quit working. Only issue at the moment is that its displaying the menu twice after a function is through, when it should only be displaying once. Which is… really weird and I dont understand it, but okay. Ill figure that out later. Point is, build, display, and quit all work aside from the hiccup with the menu. Obtain, insert, append, and clear should be much more interesting though…

The menu appearing twice has been fixed. When scanning for your choice with fscanf, it was picking up something else (an ENTER somewhere maybe?), so all that needed to be done is an fscanf function thatll assign it to some useless variable before the choices function is run. I began making clear, which works, but I cant get it to display correctly. I had to make a different display function for it because the current display function goes until its -1. However, if clear is run, the first element is going to be -1, so thats all that would display, when I wanted it to display the entire array. Soo I made a displayall function that will run instead of display if the first element is -1. It.. works? buut its in an infinite loop, and Im really not sure why. It'll display the entire array correctly, then go back and display it again, and again, and again… Soo that'll need to be fixed.

September 10th, 2015

I finally fixed the loop issues with displayall. I dont remember what the exact cause of it was, but point is I fixed it! At one point I had an issue with it where it wouldnt display all of the array, and was instead only like element [0], [2], [4], [6], so on and so forth. I couldnt figure out for the life of me how I managed to make it count by even numbers, but turned out I had an extra i++ statement in there due to switching from a While to a For loop. So clear and displayall are entirely functional now. I tried working on the append function, and I've.. sort of got it. Not really. It's adding the number in the correct positon, but… then erasing all array elements after it except for -1. So will have to figure that out. I glanced at sln0 as well, and started trying to draw some of the pictures just to kind of see what itll be like. I'll work more on it tomorrow.

September 12th, 2015

Finally got dsi0 done. The append function was a bit of pain, but I did eventually get it to work. Insert was… a bit easier. Kinda just copied the code from the append function and added an index– somewhere in there. Worked perfectly. I was trying to think out how to do the insert function, and I spent too long just thinking “Will… will that work? No, theres no way thatd work. Its way too easy. Or would it work? Noo… Eh, Ill try it.” And somehow it worked perfectly. Ill take it! Obtain wasnt particularly complex, though unfortunately wasnt easy enough that all I needed to do was write one line of code for it. But still, pretty simple.

September 13th, 2015

I've done a little work on sln0. I drew the pictures for building a list, and also did a little with inserting a list. Nothing has been properly typed into the computer yet, but rather I've just got everything on paper for now. I've gotten up to displaying a node, which… I dont really know how to do that, but I suppose Ill find out!

September 16th, 2015

I spent the last few days doing sln0, and finally finishedit (before the deadline, woo!). I messed it up and had to redo it, and I dont think my logic is entirely correct, but eh. It'll be easier to figure out and fix the logic once I get actual code instead of just trying to work through everything on paper. Not that having the time to do this wasnt great, since it gave me a general idea of what I have to do, I just need to fully work with the code now to get the logic more… functioning.

September 21st, 2015

I began working on sln1 a few days ago, but I had no idea where to start/what to do. However, with some help today, I was able to work through and make mknode, cpnode, and rmnode. I still need to go through them more and make sure I fully understand them, but they're done at least, I just need to work on the other programs for the project. And with only a few days left, doing it should be interesting… I understand the concepts, and fully understand whats happening with everything except for rmnode function, but as I said, I need to look into it a bit more before really saying or doing much else.

September 23rd, 2015

So turns out the rmnode function isnt working, thats always a nice thing to discover last minute. Woo! Ive got everything else working thankfully. node-app-arrtolist was surprisingly easy, and in node-app-display, I only had a slight error with my logic (wasnt making my loop quite right), but I got it fixed. I thiiink node-app-display2 works, its just a little glitchy due to the rmnode issue. I think. I hope. The only issue is that when displaying, itll display '0' where the -1 was, and it shouldnt be. Not a HUGE issue, but still annoying, and I'd like to fix it if I can figure out how. If not, at least everything else works!

September 24th, 2015

Turns out the issue in rmnode was extremely simple (missed an if statement…), and the issue in node-app-display2 was a different issue, but it was easy to fix. Just needed to change my while(tmp != NULL) to while(tmp→after != NULL). Soo now everything is done and submitted. I also started sll0 in class, and got the mklist function done, so off to a good start there! Surprisingly it wasnt too hard, once I was on the right track (and realized how similar it is to mknode).

September 27th, 2015

Ive continued working on sll0, and got displayf finished, and get/setpos started. Originally, I kind of threw things together for getpos and setpos, and once compiled and I could see where my errors were, Id go back and fix it (generally how I code these - throw things Im 99% sure are broken together and fix them from there). Well when I ran make check, it said everything was perfect, there were no errors in any of the programs. I was really suspicious, but definitely wanted to believe that I managed to finish the entire project on a Saturday. But no, I couldnt convince myself that was right, so I went back to look at my code. Id forgotten that I hadnt even looked at the insert function… So that dream was crushed! There were issues with setpos and getpos as well, which Im still working on fixing. Displayf had some errors as well, but I believe most of them were it just wasnt displaying correctly - most of the actual logic in the program was fine. So that wasnt too difficult to fix. So Im almost half way done! Thats an odd thing to say on a Sunday. Normally Id be like a quarter of the way done by now, but okay. Ive just got to figure out why both setpos and getpos are segfaulting (doesnt even get through the first part of the unit tests…), and do insert, and Ill be done.

September 28th, 2015

So both setpos and getpos work now. With setpos, I was forgetting to check to see if myList was equal to NULL. I actually originally had it testing that, but wasnt in the wrong place, so while trying to bug fix I removed it and forgot about it… I had a few issues with getpos as well, involving an off-by-one error, and an infinite loop (blame the semicolon….). I also had some difficulty getting the program to give a -2 if the given wasnt in the list. I couldnt figure out how to write the if statement, but I got it in the end (was just… if(tmp != NULL)… Its always the overly easy solution. Now I just need to do insert and Ill be done!

September 30th, 2015

After a little procrastinating on insert since I didnt have any idea how to start it, along with a few issues (including semicolons after if statements……), I finally got insert to work. I originally had an issue where the insert function would insert the node, but then remove everything before it in the list. Worked great if the node was going to the beginning of the list at least! I had the code checking to see if the node was null before checking to see if myList was null, which caused a few issues. However, I got it working finally and sll0 is completed and submitted.

October 3rd, 2015

So Im having some issues with append. Which sucks because thats the first thing we're supposed to do in this project, but still. Originally I was trying to overcomplicate it with setpos and getpos, which apparently I didnt need (phew!), then I forgot to check for whether not myList was empty. Ive had quite a few issues with segfaults, and append just nuking the list (only output was a “→ NULL”) Right now, after some work, its no longer segfaulting or completely nuking the list, but still not entirely functional. It looks like what its doing is always putting newNode at the beginning of the list, and, I think nuking a few nodes in the process. Not entirely sure what its doing honestly. But Im getting there, slowly! Oh wait, okay whenever its “Appending # after start of list”, it nukes the list, which causes the entire thing to be a mess by the time it gets to test 10. Okay well, thats lovely. Gonna have to fix that…

October 4th, 2015

Okay well, I completely forgot that myList→last was a thing, and wasnt really adjusting that. Or checking for it. Or acknowledging it in the slightest possible way. All I really needed to do was add a check for it, and have it do something slightly different for appending newNode in, but nothing extremely complicated. So append is done at least!

I.. I just finished searchlist within 20 minutes. What. I went from 5 days on append to 20 minutes on searchlist. Well, alrighty then. I had a few issues with segfaults, but I realized it was just because Id initially forgot to check to see if myList was NULL. Once I added that in, it worked perfectly. Okay then.

October 6th, 2015

Unfortunately, copy isnt turning out quite as easy as searchlist. Not quite as hard as append either (Im close, and not 5 days in like with append!), but still not as easy. Shame. I had an issue with it for a while where my loop for building the list was an infinite loop, and I couldnt understand why. Turns out just, just all kinds of messed up logic. Normally its just one or two small things, but nope… I also wasnt thinking that I had to set myList equal to append(), since myList was in the function call, but I didnt consider myList→first and myList→last needing to be updated. Also thinking that it didnt need to be set to anything is just plain dumb, since just about everything but the display functions have needed to be set to SOMETHING. But whatever, got that figured out at least. My issue now is that its running, no segfaults or infinite loops, but the nodes arent copied, theyre identical. I tried setting tmp2 to a copied version of tmp, but it didnt seem to help (assuming thats why its doing it anyways). Now Ive still got to finish that, start displayb, and start compare, all before tomorrow night. Hooray.

October 7th, 2015

So I did get cplist working. There was actually an issue in my append function (it wasnt checking to see if myList→last was updated), and I also had a wonky if statement that screwed some things over. I ended up screwing up so badly that the list ended up building backwards, then forwards, and just… it was a mess. But anyways, I got it fixed! I also started on displayb, and managed to finish it within half an hour. Wouldve been less, but Im slightly distracted at the moment. My only issues with it were that I put “/n” at some point instead of “\n”, and my while loop was off by one (like it was while(pos != 0) when it shouldve been while(pos != -1). But thats functional, so all thats left is compare, whiich I probably wont get done in time. At least everything else is done!

October 12th, 2015

After a small, much needed break, I started working on sll2 a day or two ago. Havent really made much of any progress, but I've started at least! With obtain, its just, horribly broken. It does that thing when you get stuck in an infinite loop where you have to kind of kill the process with ctrl C, yeah its doing that but there… isnt actually a loop in there… Thats how you know you truly messed up. Soo thats a work in progress - slow, but progress! I started on clearlist today, just to try and get some stuff done while I procrastinated on trying to figure out obtain (hey, at least Im honest). I mean it, almost works. Almost. Im 99% sure I overcomplicated it, but whatever, its fiiine. Its working for the most part (I.. I think..), but its leaving the second to the last node in the list and Im not sure why. I dont think Im removing it at the correct time, so I need to try and figure out the best way to go about that without losing my place in the list, since I'm going backwards and starting from myList→last. No idea whether or not I actually NEEDED to do it that way, but sure. We'll go with that. But I even tried setting an extra node to it and doing nothing with that, then just removing it once all of the other aspects of the program were done. But nope, its a resilient little bugger. So thats a problem for tomorrow. Just like obtain, and you know, starting everything else. Yay.

October 15, 2015

Its always the small things. Always. Once in a great while I have some big screw up and need to completely redo my code because its so broken it does some incomprehensible thing. But nope - this time it was tiny. A tiny insignificant mix up. For some reason, I started putting =='s where ='s shouldve been in both clearlist and obtain. Fixed the errors and they worked perfectly fine. I almost wish it was something more complex than that. Clearlist can and should be coded better than it is, and depending on how Im doing time-wise with the rest of this project (Ive got a week, so I should be fine, but Id like to get sll3 done before wednesday as well), I might go back and make it better. But hey, at least it passes the tests!

I just finished rmlist in like, 5 minutes. Its literally 6 lines of codes. Dear god. Not 100% convinced it doesnt have a memory leak somewhere - and actually it might since clearlist is a little off. But the actual rmlist part works apparently! Just need to make sure to fix clearlist for it.

October 20th, 2015

Soo I took a small break… Small… I started working on swap, and Im… not even close. Actually, I dont even know how I close I am. Its segfaulting before it even does anything. The first two tests that check for a null list and an empty list work fine, but once it gets to the populated list, it doesnt. Specifically, it segfaults when I try obtaining item1 and item2. So like, the majority of my logic and code doesnt even get to run, so I have no idea if its correct or not (probably not to be honest). Soo I need to get that sorted, then add in a few things to swap (like checking to see if theres only one or two nodes and such), then I just need to get at least SOME of sort done. Wish me luck.

October 21st, 2015

I got swap done. I dont even remember most of the errors I had with it, a few of them were me not having the right syntax for using obtain with the double pointer (and I messed up calling append as well, oops), which was why it was segfaulting. There was also a small error in my obtain function that needed to be fixed, but it was only one line. So swap works! As for sort, I was able to get up to test 15 (where it actually has the full list…) until itd segfault. So issue with my logic somewhere (that I couldnt find). I had swap kind of going in like a nested loop, and a few iterations in the loop, it would segfault. But, I knew I wasnt going to find the problem tonight, and I already had 58/70 of the tests passing, so I decided to just submit as it is, since thats better than losing the 25% for the late grade. Now onto sll3, oh boy!

October 25th, 2015

Oh, apparently its been a little while since I updated this… Sll3 took less than an hour. Two lines of code (same two lines) in every function, plus one or two extra in two of the functions. I want more projects like that! I started on sll4, and I've done a little bit here and there in the functions. I finished mkgroup pretty quickly, and Ive done a little with rm, display, and append. Unfortunately, none of these actually work entirely - but Ive at least attempted them! display doesnt do anything with displaying just one of the lists out of the group (Ill need to do getpos/setpos for that), but otherwise I think its working okay. Though, I need to add in a check for an invalid position as well. AS for append, it doesnt work… like at all. It runs through okay, doesnt technically have an errors, just… doesnt do anything. To be fair, I didnt logically think anything through yet. I just kind of copied everything over from list's append and changed the names to see what would happen (knew it wouldnt work, just wanted to see how close I could get). With rmgroup, its not emptying the list properly. Technically I cooouuullld just set the group to NULL, but thats bad and I want to know why, so its not setting it to NULL at all yet. What it should be currently is EMPTY, but the populated group isn't emptying, so Ill have to fix that (and everything else…).

October 26th, 2015

So in rmgroup, my issue was I was forgetting about free (forgot it in rmlist too actually…). Adding that in fixed my issue with it. As for display, I have it almost working completely. I didnt end up needing getpos/setpos for it at least, which was nice. Only issues is its off a little with the qty. You know, 0 instead of 1, 3 instead of 4, 18446744073709551614 instead of 6. Tiny things. But the qty is the only issue left with it. So thats like 2.8/3 functions done, woo!

October 27th, 2015

Okay, got the off-by-one (mostly) error sorted. Basically, in the append function (and insert and obtain, but those are irrelevant here), I was redoing the getpos function, when all I really needed to do was change qty as needed (add 1 in insert and append, subtract 1 in obtain). But I got it to work, so I'm about half way through sll4. With you know, less than two days left to do the rest of it. Oh boy.

Ive gotten the majority of setpos/getpos done. Aside from one mismatch in each of them. In getpos, the test thats processing on an empty group and empty list is returning a -1, when it should be returning a -2. And in setpos, the test thats [8/7] is returning nothing. Like, not even an <ERROR> like its supposed to, theres just nothing. However, the test thats [9/7] works perfectly fine. So off-by-one error somewhere most likely? [7/7] also works perfectly, so Im assuming it is the off-by-one thing. So I just need to fix those errors (though quite honestly Im not that worried about them, its only two mismatches), do obtain, append, and insert.

blog/fall2015/ahorton8/journal.1445981479.txt.gz · Last modified: 2015/10/27 21:31 by ahorton8