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.
Just finished Homework 2 in Python and figured it was time to write another post. I have discovered that I do not like Python very much, while syntactically i like that you don’t need squiggly brackets, and you simply do tab which is what you would normally do any other language anyway; I do not like having a debugger to step through the code. It’s really hard to figure out where an error occurred and which line is causing something to do go wrong. Also not being able to step through and watch the values of variables makes it hard to tell what’s going on. Doing the homework took me quite a while longer than I thought it would, 1. because there is no debugger, and 2. because all the documentation I have found for Python isn’t very useful. While I was trying to look up some of the functions to use they are not very clear how they work. For one function it said it returned a “tuple” which I understood to be three different parts, but I had no idea how to access those three different parts it created…what does it store those parts into? With no useful examples I merely had to search for another way to solve the problem. That’s my work with python so far, but I’ll go ahead and explain a little bit about the qt programming I have been doing in ubuntu as well.
So QtCreator turned out to be more useful than the text editor for python, but its still not nearly as helpful as visual studio. It took me probably a little over an hour just to get things working properly. First off I had to change run settings to output the run to the terminal rather than the rather useful output at the bottom of the screen that takes in no arguments. After figuring out how to pass arguments from the command line to the terminal within QtCreator, I tried to debug it and realized that the debugger had some sort of error which I believe has something to do with outputting to the terminal. After googling some solutions for another half hour, I eventually got it working after modifying a couple files. Once that was out of the way, I was able to get to the heart of the programming and I found that Qt has some nice member function for its types. the QDate type was particularly useful for this assignment which was to create a birthday reminder program. One function which saved me a lot of time was the function for QDate isvalid(). That actually checks the date to see if its an actual date that exists and it saved me a ton of time by not having to write something like that myself. Overall the program turned out to be a little easier than I thought it would be, but it still took a really long time to complete. And that’s about all for this week.