Tuesday, December 11, 2018

Week 16: CST 205

A variety of subjects were learned in this class. We learned how to manipulate photos, and sounds in JES. We also learned about the software development cycle and a few basics on how to use GitHub. After that, we made a few simple games.

This class gave a good rundown of the basics of the Python language. Although it wasn't required or focused on, our team involved a lot of object-oriented programming in our code. We also worked a lot with the PyCharm IDE for its easy to use interface used by professionals and amateurs alike. I would advise a future CSIT-Online student to make sure they do the full 10+ hours of python preparation if they are not familiar with python. I would also advise someone to keep track of the new functions they have learned about and use the existing python 2.7/JES documentation for help learning about new functions. I had the most difficulty with the Labs where there wasn't as much guidance towards the end of the semester. If I got started earlier in the week, I would have done better. I also would have preferred if the TA had a group hangouts like the one we had for CST 300.

In Chapter 15, we learned about Classes and Objects. In Python, points represent a 2D space, they have parenthesis with a comma separating the coordinates. Classes are a programmer-defined type indicated by "class stuff: ". The class object can be used to create more objects. When you create a new object, that is called instantiation. The object is an instance of that class. Dot notation can be used to assign values to an instance. The elements are called attributes. Dot notation objects can be used in print statements to print the value of it. An object can be changed by reassigning one of its attributes or reassigning it with a function. Any object can be copied instead of aliasing. In a shallow copy, the object and reference are copied but not the embedded objects. In a deep copy, the object, the references, and the embedded objects are copied.

Some errors when debugging class issues will be attribute errors. This occurs when you are trying to access an attribute that isn't there. This is fixed by asking type(p); this will return the type of object. This is also fixed by using isinstance(p,Point); if this is is true, p is an instance of the class. The hasattr(p,'x') function will explain if an object p has an attribute 'x' (a string).


Tuesday, December 4, 2018

Week 15: CST 205

This week, we learned about lists. Lists are a sequence of values with elements or items. Lists can be changed so if there are unwanted values, they can be changed. Lists can be added together or concatenated with the '+' operator. Slice can be used on lists to remove values from the first to the last number. Append can be used to add a new element to the end of a list and extend is used to append more than one element. Pop can be used to delete an element if you know the index, and del can be used if you know the element but not the index. Split is used to break a string into words. A delimiter can be used to help split strings. 

A dictionary is like a list, it has keys and values associated with those keys. Its key-value pairs are called items. You can make an empty dictionary and add items to it. 

In the guide to identifying complexity, a few things were mentioned to do in order to increase understanding. Complex problems with sequential execution are probably not solving complex problems. Complex problems require a few self-created functions to be made and require more data variables to be tracked with test cases. They need to be broken down to be understood, then recombined and will take a long time to be completed. 

Code review is a systematic examination of computer code in order to find mistakes and improve the developer's skills. Code review ensures that the final project is good, allows practice in code review as a soft skill, allows team members to learn from each other, learning to read different styles of code, and learning to focus on details. A few tools to check out are Gerrit, Review Board, Rietveld, Codifferous. The best practices: reviewing 200-400 lines at a time at allowing yourself about an hour to do so but not more than 90 minutes. The author should annotate the source code establishing quantifiable goals and metrics to improve the process with a checklist for both parties. Then the reviewer verifies that the defects are fixed. 

Good programming practice is a good skill to learn. Start your journey with a plan which includes the data, functionalities described with pseudocode, communication between functions, and a diagram of the design of the program with the modules and how they connect. The program should be done and tested in small chunks or by lines. Programs should be indented correctly. The variable names should be clear and self-documenting in mixed case. For booleans, the word 'is' should be used to indicate boolean variables and methods. The functions should have a description of the preconditions and postcondition including the acceptable conditions where they will run. The comments should be a complete sentence with a capitalized letter on the first word unless it is the name of a variable. The header comment should be at the top of the file with the filename, author, date, version number and a description of what the file is for and what it contains as well as the course name, number, section, instructor, and assignment number. Testing data and plans should be done in the program and when testing, the boundary values should be indicated. 


Tuesday, November 27, 2018

Week 14: CST 205

This week, we learned about debugging techniques. There are multiple ways to do this such as glass-box, black-box, testing edge conditions, and incremental testing. In glass-box testing, every path through a program is tested as opposed to black-box testing where a range of inputs are tested. In edge conditions, the largest+1 and smallest-1 values are tested. In incremental testing, the code is tested as it is written so errors are found and dealt with as soon as they appear. When debugging with JES or other IDEs,  the debugger can be used to watch variables behavior. The error messages given and printing outputs will help as well.

In software engineering, there are two ways to engineer: top-down (eg waterfall) or bottom up. In top-down design, a list of requirements are made which describe how it should work and what tasks it needs to do. Then the hierarchical design is used to describe the functions that are needed and those are broken down into the helper functions it requires. In bottom-up design, the smallest functions are made before the larger functions.

In debugging, there are 3 types of common errors. Syntax errors are when there is a problem with the structure of the program like a missing colon. Syntax errors are indicated by "SyntaxError:".In order to avoid these, make sure not to use reserved Python keywords, have a colon after headers and loops, use straight quotes, closed multiline strings, closed operators, correct assignments in conditionals, correct indentation, and non-ASCII characters in the code. Runtime errors are made when the program is running which will describe where the error is and that was executing when it happened like an infinite recursion error. A semantic error is where there is a problem with a program that runs without producing errors but doesn't give the correct result.

Tuesday, November 20, 2018

Week 13: CST 205

This week, we started the sound modules.  The sounds we worked with were .wav files, which are not compressed. Sounds travel in compression waves that are created by changes in pressure. It is measured in rarefaction cycles and decibels (dB). The amplitude of the wave is the distance from 0 to the height in the y axis, a large amplitude will have a loud sound. When a full wave occurs, it is the frequency which is related to the pitch. When the frequency increases, the pitch increases.

We learned how to manipulate sound with Python. We increased the volume by getting the sample value of a sound at a specific sample then setting that sample to a larger value. This was done for all for the samples in the sound resulting in an increased volume. We then learned how to increase or decrease the volume in a given range for a sound by varying the lengths involved and varying the value.  We then learned how to combine sounds by making an empty sound and then copying the sounds into it with a for loop in the range of the entire sound clip.

In lab 8, we learned the basics of sound. We learned how to decrease the volume in a sound clip by divinding the value by half. We also learned how to change the volume of a sound by a factor by multiplying that value by a predefined factor variable. Next, we found the maximum number of samples by using the abs() function and setting the largest number it can find to max_value iteratively. Next, we set the samples to its max value using maxSample(sound).

In lab 10, we practiced strings and made a hangman game. In the warmup, we used the requestString(str) to ask for a name in a popup dialogue box. Later, a hangman class was made. This created allowed the computer to ask the user for letter guesses. If it was correct, it would evaluate the letter and add the letter to the word.

Tuesday, November 13, 2018

Week12 CST 205

This week, we made Team Improvement Plans. In my plan, I plan to do the following:

Complete assignments before the Tuesday deadline

Finish attempting group labs before group lab meeting
Either use pycharm to get more helpful errors or learn more about JES errors
Find when office hours are and go to the prof/TA for help before the group lab

Code review is reviewing others' code and having your code reviewed. In code review, code can be discussed in terms of tradeoffs and preference. Questions should be asked and not demands. Good questions are clarifying and not judgemental. Ownership of and namecalling of code should not be done. When you have your code reviewed, don't take things personally and know that the reviewer has your best intentions in mind. You should also respond to every comment. When reviewing code, you should tell which ideas you feel strongly about. You should also find ways to simplify the code and give alternatives.

In the "How to Get a Job at Google" article by Thomas L. Friedman, he mentioned that general cognitive ability or learning ability is very important at Google. Another important aspect to a candidate is leadership: knowing when to lead or to let someone else lead. Humility and ownership are also important in problem-solving because it tells when someone should help solve a problem or to let others fix it.

Wednesday, November 7, 2018

Week11: CST 205

In Lab 4, we learned how to modify pictures pixel by pixel. We started by making a vertical mirror of a picture. We then mirrored a picture horizontally from top-to-bottom and bottom-to-top. After, we made a quadruple mirror. I wanted to use the functions I already created but it wouldn't work out. Then we copied a picture from one file, making another file. After learning how to save to a file, I could have saved it to another file instead of just displaying the result. Next, we rotated a picture by making a blank picture and copying the pixels into it. Finally, we shrunk a picture by sampling every other pixel and copying it to a blank canvas.

             In Lab 5, we learned how to add blank space to images by adding pixels to the image. Then, we rewrote that function to become more reusable using a header. I rewrote my function to put pictures perfectly centered at the target x and y axis. In the end, we had a mini project where we inserted 8 pictures into one picture file and modified them with the functions we created earlier. For my project, I made it 5 x 7 or 1500 x 2100 pixels because it was too large when I examined it in explorer. The photo would update in my computer every time because it was saving it 8 times every time I ran the function. I could open the photo and it would update in real time. I wanted to import the other lab files but I wasn't able to make it work with "from Lab4 import *", I opted for copying the functions directly.


In Lab 6, we removed the red-eye from a picture. Our group exchanged all red with green in attempt to neutralize the red color. It worked but when I tried it on my own, I applied it to the entire picture. I could have applied the green fix to the eyes only and it would have been better. We created a sepia tint using the red and blue value multipliers after converting the picture to black and white. We also made an artify function which made color values in various ranges a single color for R/G/B. Finally, we created a picture using the Chroma-Key technique. It identified the already specified green values in the backdrop and applied the new background. 

Tuesday, October 30, 2018

Week10: CST 205


Jython will be used to manipulate digital images with Python using JES. In digital imaging, there are many components of a picture. The pixel values are assigned a tonal value that can have many values. The bit depth is the number of bits used to define each pixel, for example a 24 bit depth picture is 8/8/8 for r/g/b. The resolution is the ability to see detail in a picture and is related to spatial frequency in DPI/dots per pixel or PPI/pixels per inch.

            There are many types of digital image files such as JPG, TIF, RAW and GIF. In file types there is lossy vs. lossless compression where some or no data is discarded when compressing. TIFF is used as a lossless image format but the files are large. GIF uses only 256 colors and matches similar colors to the ones it uses. It reduces the colors used and replaces common patterns in large areas. JPG is the best for photos and stores them in 24 bit color/16 million colors but discards info the eye can’t see. RAW is lossless and smaller then TIFF files but they vary by manufacturer.

            In pair programming, two programmers work on the same design to make one code product. The driver codes and the navigator finds problems, asks questions, and helps. This leads to better scores, friendships, and understanding allowing each to be both the teacher and the student. It is an Agile software development technique where each line is reviewed as it is typed and improvements are suggested. There can be disengagement if the two have bad teamwork or communication. Online tools can be used to facilitate the pair programming process such as Github, Zoom.us, Hangouts, Slack video chat, and Team Viewer.

cst 499 week 8

This week, we finished writing the paper in order to do the best job possible even if it was a little bit late. Now that everything is done,...