Wednesday, April 10, 2013

Exam time!

Exam is approaching soon... next week. This is just a mini update during the exam period. I have started going through the past annotated slides, and am done about 40% studying for the course. I have a chemistry exam the day before csc104 exam, so this week I am working double time trying to go through both courses work from the beginning. I will keep you guys updated on how the exam went, so don't stop reading just yet!

EDIT 17th April 2013: EXAM Time is today! (in a couple hours). I am currently reviewing everything and going through lecture notes, etc. Wish you all good luck :)

Wednesday, April 3, 2013

Closing Remarks

I found Project 1 to be one of the most challenging assignments in csc104, and so I figured i’d talk a bit about it here. Going around reading a few slogs from fellow students, I was relieved to know that I was not the only one who had struggled with the first project. There were many problems while trying to solve the code, but in the end when it all worked out without error it was a learning experience!

Let me take a problem me and my group had with the ball program. The key-press function was the reason of many confused looks from my group. The first thing we did was  ask ourselves what the function wants the program to do or accomplish? After understanding the problem, we devised a plan - that plan was to first take a look at the check expect for the up and down keypresses, which we had trouble with.


      (check-expect (key-press (make-ball 0 0 1 1) "down") (make-ball 0 0 1 2))
      (check-expect (key-press (make-ball 0 0 1 1) "up") (make-ball 0 0 1 0))
      (check-expect (key-press (make-ball 0 0 1 1) "left") (make-ball 0 0 0 1))
      (check-expect (key-press (make-ball 0 0 1 1) "right") (make-ball 0 0 2 1))

From the check expect, we got a little relief looking at how the program is supposed to function with an arbitrary input. From the check-expect we observed that pressing the "down" arrow key required adding 1 to the dy value of the function make-ball, and pressing "up" on the arrow key requires the decreasing of  1 in the dy value of the function. 
(meaning that make-ball changed its values from 0 0 1 1 to 0 0 1 0 when the up key was pressed). Key-press "left" and "right" were already given for the project.

The plan was to use the given "left" and "right" conditions as a template, and by doing that  along with the knowledge from check-expect to solve the problem. What was left now was to just carry out the plan and call it a success (or failure, in which case we would have to go backward and make/revise a new plan after seeing why the original didn’t work)

This is the code we wrote following the steps:

   (define (key-press b k)
     (make-ball
        (ball-x b)
        (ball-y b)
        (cond
            [(equal? k "left") (- (ball-dx b) 1)]
            [(equal? k "right") (+ (ball-dx b) 1)]
            [else (ball-dx b)])
        (cond
            [(equal? k "up") (- (ball-dy b) 1)]
            [(equal? k "down") (+ (ball-dy b) 1)]
            [else (ball-dy b)])))
   

This was the result, and the final step that was left was to look back and make sure that the function was... well, “functioning” properly (bad pun). We made sure of that by running the program many times and trying out different keypresses of the arrow keys, making sure they live up to their function/use.

We saw that the function was working properly and had solved the problem. Hooray!, and off to MarkUs the program went.

Tuesday, April 2, 2013

Getting Close

        Seems like the weather is playing april fools with us in Toronto, as we still need a jacket to go outside this week. CSC seems to be nearing its final classes, as with other courses it will be dearly missed. It was one of the very few courses which I enjoyed in my first year, partly because it was a computer course which taught me many basics of computing. Professor Heap is an amazing teacher, and it seldom felt boring being in his lectures.

        Reading other students' slogs, I heard that Anna (annaleecsc104.blogspot.ca) also feels the same about the second term test as me, that it was a bit unexpected of a mark, but the assignments made up for it, equaling them out.

        As I talked about in a past post, I am going to write about a slight photo manipulation problem I had in Dr. Racket. The problem was with how to swap the colour intensity in a image. I was trying to swap the red and green values of a picture of a chameleon, similar to the example Prof. Heap did in class, but then was multiplying the blue value to double, to test its effect on the overall picture. It turned out that the values for red, green, blue and alpha have a upper maximum of 255 or 256, and the doubling of the blue was sometimes causing the blue value to go over the maximum.
  

Monday, March 18, 2013

Oh Aggregates

The aggregates such as list and structs are being literally hard to "map" into my brain! On the more rational thinking side of my brain, I can see how useful and important it is for many things one might be coding a program for.

Truthfully, the first time I went to class and learnt about them, define-exhibit and define-struct blew my mind. If that was not enough, in the vicinity, we began learning about breaking up an image into a list of its composing dots, or pixels and their three colour and one alpha values.

Slowly I am recovering from it, and feel less intimated by it as time goes by. One thing that goes in cue with the pixel talk is about Sharp trademarking 4-colour pixel technology they call Quattron. Apart from the Red, Green and Blue, they added a fourth middle colour yellow, with which the overall brightness and vividness of the media is supposed to benefit.



Coincidentally, like Professor Heap, Sharp also seems to use a chameleon in their demonstration images!

Thursday, February 28, 2013

Decimal vs. 1s and 0s


The concept of base 10 and base 2 number system might be the only thing familiar to me from high school related to computer science. I remember learning how to convert between binary and base 10 systems about two years ago in grade 11, so the memory was pretty washed out. However, it gave me a sense of ease knowing that somewhere in the back of my mind, I have done this conversion before. I never did any addition, multiplication or division with binary, so that will be something to look out for.


You know, as the popular saying goes, "There are 10 types of people in the world- those who understand binary, and those who don't. "


I really like the photo manipulation in Dr. Racket, as it goes down to the very basics of how an image is actually processed. Swapping colour intensity in an image was a good example in class on exactly how it works on a low level. I have had some difficulty, with witch upon asking the TA's tomorrow (friday), I will post in my slog about the solution and what steps I took to achieve it.


Ending on a different note, for those who follow my blog must have read my last post about the new Ubuntu Phone OS coming out by Conical. Soon after my post, the released a flashable, very, very early release for my phone. The instructions stated that most of the features such as speakerphone and even using data, or hanging up the phone once dialed does not work yet sometimes, and that I would have to sort of compile the installation file first by entering commands into the terminal of a working Ubuntu computer. Not having Ubuntu installed, I searched on the internet to find people uploading a precompiled version, which I used to test out the first build. It was definitely a refreshing look compared to the stagnant android and ios (apple) mobile systems. Apart from the course work, as the project matures, I will keep you guys updated on its status as well.



Sunday, February 10, 2013

Its that time again...

Its that time of the semester where all the slogs would be filled with paragraphs of how the test went. In short I believe it was fair, and I did reasonably well (atleast I think so). I was shocked that there wasn't a lot of history of computers being tested.



 I'd like to talk about something different today- Ubuntu. It was very cool seeing a different operating system Linux based during Prof. Heap's lectures and while we had our tutorials. I know a little about it only because I once had an open-source phone sized tablet which ran a version of linux. A lot of tinkering around with it involved writing codes in "terminal". It was very cool to increase the maximum volume of my device by typing a bunch of lines in terminal I found searching online. Recently Ubuntu, I believe one of the most common distros people think of when they hear the word "linux", announced an Ubuntu phone OS, and even showed a prototype running on the android phone I currently have. They said it is expected that we can install it on many phones that currently run android today.



It looks awesome, but thats not all. The most useful part of it is that, when you connect the phone to a monitor, it runs the full version of Ubuntu (not a mobile one). So all the applications such as firefox, document editing softwares, even Dr. Racket could be run when connected to an external screen, straight from your phone!

Readers, what do you think about this? If someone is reading this, do leave your thoughts in the comments below..


Friday, February 1, 2013

Haven't Lost Hope Yet!

Okay, I have to admit, I have done many things for the first time by taking the CSC104. Especially this week. Where do i start?  "Wikipedia editor", web "Blogger" and beginner "Dr.  Racket" programmer with a base in computer history have all been added to as achievements in my resume!

Speaking of the course, I am biting my nails as the First Term Test is next week. It's approaching so fast, hope its not too brutal. The tutorial quizzes so far have been very fair, and they seem to test the main part that we should know by every week. The recorded video on the topic actually helps a lot. In the tutorial we did today though (2nd Feb 2013), i'm not fully sure, but I think there is a typo in the last question. It talked of a function rotate6, which was not defined anywhere in the code. I know Prof. Heap reads Slogs sometimes, and if you do read this, it would be really helpful to know the correct answer for the exam.

Readers, I will keep you updated next week after the exam if I think I survived or the low tide carried me into the deep sea.