Intro to Unix ECE 2524 Entry #10

Finally getting around to the last blog post on here.  I guess the last assignment I did was implementing the process class. I thought this was a pretty interesting assignment especially since it kind of gave me an idea of how an API such as Qt would implement their QProcess class.  This assignment wasn’t too bad, but figuring out exactly what we needed to do was a little challenging. After getting and understanding of the classes member functions and what they were to do, actually writing the code wasn’t too bad.  Getting all the functionality correct was a little bit challenging like when to close the pipes and what would go into the destructor.

For the write our own assignment, I found this to be more challenging than I initially thought  it would be. After coming up with the idea, it was a lot more difficult to put it into exact words that would describe precisely the assignment that I wanted. Even coming up with an idea that would implement certain commands and ideas was pretty hard.  The grading rubric was probably the hardest of all, as I just wasn’t sure how to give certain points for certain things, a lot of times my mentality is either it works or it doesn’t, and it was hard to come up with point allocations for an in the middle type situation.

For 3574 we got 2 assignments crammed into 2 weeks, thankfully though neither were too difficult.  It was nice to get back into a GUI for homework 8. I got everything up and running pretty quickly but I couldn’t get the GUI to update correctly for the longest time.  Eventually I figured out that i was still using a posix pthread join which blocked the main thread from updating until the other thread was done calculating prime numbers. I found a function, pthread detach, which didn’t block the main thread but also prevented any zombie threads.

Homework 9 was even easier especially being able to use QThread which was nice.  Once I understood how both the semaphores would work and what the mutex would need to lock setting up the consumer/producer threads was easy.  I had a little bit of trouble manipulating the buffer array (it had been a while since I had to work with arrays), but after some careful manipulation of pointers to the buffer I was able to get the circular buffer working properly.

Intro to Unix ECE 2524 Entry #9

I’ve been enjoying the break finishing up all the current unix assignments before the break began. I guess the last thing I did that I haven’t mentioned yet is the future of unix paper.  I thought this was an interesting paper to write about and research as technology in the future has always been an interest of mine. Upon finishing the paper I didn’t realize that part of the submission was creating a makefile to convert the paper to html and pdf. Since I started this paper in Word I wasn’t sure where to go and how to get it in to markdown format. Turns out markdown format is pretty much just plain text, so I was able to take the plain text file and simply add some white space where paragraphs were needed which wasn’t nearly as bad as I thought it would be. After getting the markdown file, converting it using pandoc was as simple as just googling what the command to do so was. Setting up the makefile after this was a piece of cake.

In 3574, we are getting a bunch of homeworks as he is trying to squeeze everything into these last couple of weeks which is really annoying. So we got stuck with an assignment over break. This proved to be pretty tough especially without being able to go see the TA for help.  The homework was on POSIX message queues.  I managed to set up everything necessary for the homework, but was stuck on one of the most trivial parts. The parameter for the message in the send and receive functions is a char*. I didn’t realize how annoying this was to convert my messages between char*s and QStrings.  Turns out everything I was doing wrong had to do with my error in conversion. I was using the same char* as my send and receive message because I didn’t realize how it was really storing the information into the pointer.  By having 2 char*s, one for receiving, and one for sending, this cleared up the issue. Such a small thing for all the debugging I had to do. Debugging for this homework was extremely annoying since you had to run 4 separate processes of the same program, then a fifth process of a different program. All 5 processes had to be run in a certain order, and remade, and reran every time I made a small change. It would take about 30 seconds just to get to the point where I could rerun the program. I finally got it working though after a few emails with the TA,

Intro to Unix ECE 2524 Entry #7

It’s been a while since my last post so need to get back on it to be sure I get 10 in before the end of the semester. Haven’t had any assignments in Unix lately which has been a nice break.  I ended up getting the futures paper done to get me some added points to my total grade. I’ve also gotten a fair amount of work done on our battleship final project.  I’ve gotten most of the text based part of the game done and implemented in Qt; this should give us a good base should we have time and choose to implement a GUI.  Error checking is always one of the things I hate most about programming because there’s just so many stupid things that a user could input that you have to check for and handle.  I think I’ve gotten everything covered in terms of inputting bad coordinates and so on. Currently the ships are only one size big, and they need to be re-implemented to the correct size, and error checking needs to be done in terms of placement, i.e. checking for overlap or run off over the screen.

As for 3574, we had our first test this past Thursday which seemed to go pretty well to me.  Most of the information was easily found in the book or online slides from the book, and  I can’t imagine getting a poor grade on this test.  The past homework has been quite difficult, and it took me awhile to get the thing of moving back and forth between different UI forms via signals/slots, and hiding/showing different widgets.  It has however been a lot more fun to write than previous assignments.  Getting used to QtDesigner took me a few minutes, but it is very intuitive, and makes creating GUI’s so much easier than coding them by hand.  As part of the assignment we had to implement tic-tac-toe and write our own algorithm for the computer. I think I have gotten pretty close to if not an unbeatable computer player.  Hopefully the homeworks will remain interesting, but now that I believe we are done with GUI’s, I’m afraid I will lose a lot of my interest.

Intro to Unix ECE 2524 Entry #6

Had our midterm exam this past Wednesday which went alright.  Just barely got it submitted within the time limit wish I had had another half hour just to work on it without a late penalty.  I think I spent too much time in the beginning trying to get the commands to return what I wanted that I didn’t have enough time for writing/fixing the scripts in one section.  I attempted all 3 of the questions in that section even though we were only required to do 2/3, but after trying question 1, I was pretty sure I did it incorrectly and moved on to questions 2 and 3.  I tried to fix the code on 2, but I didn’t know what the program was supposed to do, and I didn’t have time to look through the code to find out.  I fixed the syntactical errors and hoped that was good enough then moved on to number 3.  I had maybe 10 minutes left to write this script, and I think I got the bulk of it correct, but there were still some errors when I submitted it just because I didn’t have time to debug it. Hopefully it turns out better than I felt after submitting it.

In ECE 3574, we got our first GUI assignment which was kind of cool.  It was rather basic, just setting of some buttons to do some things and display some dialog boxes.  After getting the signal mapper to work properly, it wasn’t too difficult to write the code for each button. I did have one issue with getting the checkbox in the qerrormessage which controls whether to display the message again to work correctly.  From reading through the documentation it seemed that the checkbox should have all the functionality already implemented, but this was not the case for my code.  Whether the box was checked or not, the message was always displayed. Even after working with the TA we couldn’t figure out what was wrong with it.  I ultimately just had to add my own qcheckbox widget to a qmessagebox and writing the functionality of it myself.  Besides that one issue, the rest of the code only took maybe 3 or 4 hours to write everything, so not too bad.

Intro to Unix ECE 2524 Entry #5

So the python homework do this Wednesday has been the toughest python assignment so far. While it was the hardest, I think it was the most useful to implement, and I think learning how to write our own protocol and such was a useful exercise to do.  I found the dictReader and dictWriter functions to be very helpful when working on this assignment as they allowed me to read in data and immediately put it into a dictionary with no parsing and work needed on my part. It even took the first line as field keys for the dictionary.  Writing the dictionary back to the file was just as easy as reading from it was, and, after learning how to do this, the rest of the assignment wasn’t too bad.  I did have some trouble getting the delete command to delete multiple items in the list but with list comprehension this proved to be a fairly easy task. I wasn’t however able to get the sort by quantity to sort by integers rather than strings. I couldn’t figure out how to set types for the dictionary values by the way that I was creating the dictionary from the data read from the file. Nevertheless, I think I got all the necessary pieces of the code working as they should.

As for ECE3574, we had our easiest homework so far which required recursively moving through directories and determining the sizes of those directories. Qt has some very nice classes to help with this task such as QDir and QFileInfo. QDir allowed me to pull everything was in a current directory into a list of QFileInfo objects. QFileInfo has very helpful functions to determine whether the object is a directory or a file, and the size of whatever object it contains. After figuring these things out, it was only a matter of setting up the recursive routine properly. Parsing the arguments passed wasn’t too bad either, although this is a time where I would have liked to use the argparser in Python.  For whatever reason QtCreator did not like the -v argument passed on the command line, and would run nothing when it was passed. I’m still not sure why this is the case.  Besides that though the homework was fairly easy.