Week 2

What did you do this past week

This past week, I started working on the collatz project. I had a hard time with the set up because there are so many new tools that I haven’t used and I was afraid that I was going to mess up something big. Thankfully, nothing bad happened that caused major issues. The only ‘bad’ thing that happened was my git repo for my private repo was messed up with the two branches I had. Otherwise, the tools and software setup and usage went smooth.

In the beginning of the week, I implemented a simple collatz_eval() solution with a simple cache. I then created a solution using a meta cache that already had all the pre-determined max cycle lengths from intervals 0-1000,1000-2000, 2000-3000, etc. all the way to 1000000. However, my solution was still too slow for spoj. In class this week, I learned some optimization tricks including using bitwise operations and the interval trick from quiz 2. Finally, with those optimization tricks from class and fixing my meta cache calculations, I was able to pass spoj.

What’s in your way?

CS373S: Software Design. On my last blog post, I said that this semester was going to be lightweight with only Software Engineering being my only hard class. Wrong. Software Design took up too much of my time last week. Project 1 for Software Design took me about 10 hours to finish because of the project specs being ambiguous and hard to understand. I was constantly checking piazza for that class to seeing any updates for the project. This week, I have another project due for that class.

What will you do next week

This week, I plan to finish the collatz project. This include refactoring my code, writing comments, following the requirements, writing more tests, and pushing my test files to the public test repo. I hope the next project is released soon so that I can get started on it. I also need to catch up on my readings for this class. I skipped the JavaScript reading from last week because I knew a bit about JavaScript beforehand.

This class

This week’s lecturse were good. On Tuesday, it was cool to see the prime solution being implemented in python. The end of theclass about python’s type and object explanation was pretty confusing for me because I couldn’t see the right side of the whiteboard. However, the piazza post that Dr. Fraij posted made the topic much clearer to me and now I think I fully understand it.

Thursday, we went over exception handling. It is similar to that in Java with a try, catch, and finally block. We also went over a factorial solution. We wrote our own factorial solutions. I wrote a simple recursive one and I learned that there is a tail recusrive version as well. I also learned that the built in python factorial function uses C which makes it very faster, which is pretty cool. I’ll remind myself to use the built in python version if I ever need a factorial function.

Tip of the week

Buy a battery for your laptop either as a replacement or as a backup. My laptop is over 5 years old and before I bought a new battery for it, it would run for about ~2 hours max of me working on it. I went ahead and bought a new battery for it during black friday for $25. Since then, my laptop has lasted for ~5 hours now on average and has made my quality of life much better. It is hard to find a place that isn’t the GDC to charge your laptop battery on campus. I was planning on buying a new laptop (one with long battery life), but I didn’t have the money for one so I bought a new battery for mine. I have now kept my old battery as a backup in my battery incase something happens.

Written on January 29, 2017