Tuesday, 26 March 2013

Project2

I saw Tori's slog and she felt one week was too short for her because of long weekend. I thought this week would also be very short because good Friday is approaching.

Since project#2 has already been posted on our course website, professor Heap referred to it in the very beginning of the class. He explained what we should change in the project and showed us what would the image be like  if we fix them. I did not digest those information because I hasn't downloaded the code yet and did not have the chance to read the instruction. I felt I still had a lot of time to work on this project since it would be due on next week. I thought other people may also leave it until next week but I was wrong. Professor said there were some people who had already submitted this assignment. Those people finishing project so early really motivated me to some extent. I decided to look at the project and try to fix it this week.

In terms of the contents of the class, professor first showed a picture of internet map. I felt this picture looks really like fireworks display. It is beautiful. In this internet map, there are many lines with different colors and they are all meaningful. I just knew the Length of lines reveals how long a pack of information take to get in and get back through wires. I did not hear what the colors represent. After that, professor talked about the connection between machines, browsers and database. I did not quite understand when he introduced these stuff. I planned to read the long notes that he posted on the course website to figure it out.

Thursday, 21 March 2013

recursion and operating system

From my perspective, recursion is easy to understand. As long as we know what will be produced if the placeholder is 0, we can use (g 0) to get (g 1) and use (g 1) to get (g 2). The first question in the recursion sheet is to produce a green outline square with the size of 10 when placeholder "d" is 0. Then, if "d" is 1, we need to use the other condition:

[(> d 0)
(overlay
(beside (g (- d 1)) (g (- d 1)))
(square (* 2 (image-width (g (- d 1)))) "outline" "green"))]

Then it will produce that two green outline squares with the size of 10 are on a big green outline square with the size of 20.


The second class in this week was an introduction of operating system and the connection between machines in a network. I felt I did not know much about the operating system like how it works and how it relates to CPU. In terms of the fixed procedures to choreograph cooperation, I learned three types of connections: roundly connected, all connected, and centrally connected. The problem in roundly connected example is that the whole network will fail if the network in one of computers fails. All connected cooperation is like human communication because someone waits for the other talks first and then he or she talks. For the centrally connected example, the sender sends out the information to the hub and the rest of receivers can get information from the hub. Only of the hub is broken, the whole network will be broken. 

I think I will be fine if the tomorrow's quiz is about recursion.

Sunday, 17 March 2013

Sierpinski and Palimdrone

The first class of this week, I learned how to define "sierpinski triangle" in the Dr.Racket. However, I could not see any difference between the use of "sierp_0" and the use of "(sierp 0)". We just replace "sierp_0" with "(sierp 0)" and keep other things the same to make a definition of "(sierp 0)".

To make the picture beautiful, we could replace "green" with "(make-color (random 256) (random 256) (random 256) 255)" to let the computer choose random colors for us.

 The content of "sierpinki" won't be covered in test 2. In order to be well-prepared for test2, I did the sample test2. I was interested in the last question which is about palimdrone. I tried to figure out the definition of "palimdrone" and I made it. I thought the main idea was similar to the reverse-string which I learned in the last week. The first condition is that when the string-length of a string is less than 2, it must be a palimdrone because it is just one single character. If the string-length is greater than 2, then there will be a another condition: the first character of the string is equal to the last character of the string and the characters between the first and the last also form a "palimdrone". Then I copied the whole definition and wrote a check-expect for "palimdrone" in the Dr.Racket :
(check-expect (palindrome? "rot") false)

It passed the test! I felt so happy that I could do it on my own and succeed.

Tuesday, 5 March 2013

Rot13

Last week, I learned "ROT13". When a character is between A and M, we just achieve a new character that has a position by adding 13 of it in alphabet. If the character is between N and Z, we can subtract it. Likewise, if the character is not capital but lower-case character, the basic idea is still adding 13 when the character is in-between "a" and "m" or subtracting 13 when it is in-between "n" and "z".  In today's class, we use Dr. Racket to operate the rule by using "cond." What is given is a string and what is produced is a new string that is "rotated" by 13. It is easy to write the rule of "ROT13", but how about reversing characters? This is not simple. Reverse-string needs to combine "string append,""sub-string," and even "reverse-string" itself. At first, we take the first left character and put it on the right by using "sub-string", then we can reverse the rest characters and put them together by using "string-append".  I thought we could also reverse a list having individual characters and then use "string-append" to put them together to achieve a new string. I haven't tried this method and I am not so sure about it.

Monday, 4 March 2013

Big Bang and Binary System

 Last week, I spent many hours on how to make an image spin at a certain speed by using "Big Bang."
 I felt the basic use of "Big Bang" is difficult. This week, it was getting harder, though. I was so confused about the contents of the first class after reading week, which introduced "timer", "on-key", and "struct." It was not like previous class which uses only one model. This time, I was told to combine three models to spin together at different speed by using "struct." Having done this, the background of one model was still not very clear and the professor taught us to use "make-color." The steps were so complex that I did not figure them out. For example, how to make different speed for each model. I remembered  there was a function like:

(Rotate (* -1 MH-speed 210) MH)

The second day, binary system was introduced. Compared to "Big Bang", binary was easier to understand. If I want to write 37 in the binary system on base 2, then I just divide the number by 2 every time. However, I was not sure when I should carry "1" in the multiplication of binary.

I learned many new things in this week and it would take some time for me to digest them.