2013-03-15

CSC 104 Slog-Week Nine (Mar 11th - Mar 17th)

CSC 104 Slog-Week Nine (Mar 11th - Mar 17th)
Something new learned in the class:
[Computer system]
We took the test this Thursday    so we didn’t take the class and learn anything about the computer system.
[Dr.Racket]
  sierpinski: produce triangles
(define (sierpinski d)
(cond
[(zero? d) (triangle 10 "solid" "green")]
[else
    (above (sierpinski (- d 1))
     (beside (sierpinski (- d 1)) (sierpinski (- d 1))))]

-----While when I was looking for the image of sierpinski I found an interesting one which uses the same theory :D



Challenges I met this week
  Preparing the test is a really hard task for me since I have a lot of activities to do recently. I woke up at 7 that morning and finished my sheet. Fortunately I reviewed the reverse-string function at that time and we had it tested on the test paper lol.


The test/quiz/assignment
We took the test this Thursday, feeling that it wasn’t hard lol. 

But I am not sure about the long-term questions. Maybe I should work more on the computer system part next time :)


❤Feedback to other's blogs

I found a really funny and good-looking slog this week! It is from http://virumandi2004.blogspot.ca/ I can't find his/her profile though :( Anyway I left a message "Your slog looks really good? How did you make your background be like this? :D" to he/she to ask about how to change the background. But I found the way to change it myself before he/she reply, which is good. :)

Yeahhhh! I got a beautiful background for my slog too!

CSC 104 Slog-Week Eight (Mar 4th – Mar 10th)

CSC 104 Slog-Week Eight (Mar 4th – Mar 10th)
Something new learned in the class:
[Computer system]
Major features:
Disc Drive
Monitor

CPU

-A Central Processing Unit (CPU)
--A control unit.
-Main memory
-Peripheral devices
--Keyboards
--Monitors
--Disc drives
--etc
  Arithmetic/Logical unit (ALU)
Basic arithmetic and logical operations that computer circuits can carry out on sequences of bits: addition, subtraction, multiplication, division, and the logical operations AND, OR, and NOT.
  Control unit:
Sequencing of operations (determining what happens when)
  The choice of instruction set
Whether to use a relatively small set of simple instructions (requiring each program to use a larger number of relatively fast instructions) or a larger set of more complex instructions (requiring fewer, but slower, instructions to implement a program).
  Program counter (PC): The register that the control unit uses to keep track of which instruction to carry out next. It is used to hold addresses (locations) in the main memory. Once the next instruction has been fetched and placed into the instruction register, it increments (increases) the PC to the location of the next instruction.
  The sort of instructions that are available can be grouped into three broad categories are:
-Arithmetic/logical operations.
-Data transfer (load or store in main memory)
-Program control (branch or halt).
  The process of adding two numbers stored in main memory and storing the sum in a third location
LOAD A1 R1
LOAD A2 R2
ADD R1 R2 R3
STORE R3 A3
HALT

[Dr.Racket]
   string-reverse : Produce string with characters in opposite order from s
 (define (string-reverse s)
  (cond
    [(zero? (string-length s)) s]
    [else (string-append (string-reverse (substring s 1)) (substring s 0 1))]))
(check-expect (string-reverse "string") "gnirts")
String Reverse

  palindrome? : To judge whether the s is a palindrome?
  (define (palindrome? s)
   (cond
     [(< (string-length s) 2) true]
     [else
      (and
       (palindrome? (substring s 1 (sub1 (string-length s))))
       (equal? (string-ref s 0) (string-ref s (sub1 (string-length s)))))]))
(check-expect (palindrome? "aa") true)
(check-expect (palindrome? "ab") false)
Palindrome

 Challenges I met this week
  
We met a really big problem when we were doing the project1 ecosystem. After w
e had done it, we clicked run and we found that the size of the image doesnt change and also, it said that function call: expected a function after the open parenthesis, but received 1000. Finally we changed
(ecosystem-mice eco (MICE-START FOXES-START))(+ (- MICE-START eaten-mice) new-mice))
 to
(+ (- MICE-START (eaten-mice (ecosystem-mice eco) (ecosystem-foxes eco))) (new-mice (ecosystem-mice eco))))
And it made the images change their sizes, seems that it works.

The test/quiz/assignment
The quiz this week is almost the same as last week’s test content. So hopefully I did a good job =D Although I still didn’t get the quiz paper till now lol.
This week I finished my project1 with my friend – another Emily. We started to do it on Wednesday and edited it over and over and over, since there were always some problems. Anyway it turned out to run really successfully at last. And hopefully we did everything right.

❤Feedback to other's slogs

I read 's blog this week. She wrote a lot about her problems of doing project1. Indeed, practicing is always harder than just saying. I left the comment:"Totally understood your feeling. Programming drives people to be crazy!" to her.

CSC 104 Slog-Week Seven (Feb 25th - Mar 3rd)



CSC 104 Slog-Week Seven (Feb 25th - Mar 3rd)
Something new learned in the class:
[Computer system]
  Sound can be represented by sampling the amplitude (strength) of the sound wave at regular intervals, and storing the strengths as numbers.

  Images can be represented as a grid of numbers, with each number representing the strength of a particular color in one pixel (picture element) of the image. Since a detailed picture contains a large number of pixels, a great deal of storage is needed. Different image formats make different choices about how many different colours to encode for each pixel.

Computer Designers are so awesome!

[Dr.Racket]
  rot13: produces character 13 places (cyclic) ahead
(define (rot13 c)
  (cond
    [(char<=? #\A c #\M) (integer->char (+ 13 (char->integer c)))]
 [(char<=? #\a c #\m) (integer->char (+ 13 (char->integer c)))]
 [(char<=? #\N c #\Z) (integer->char (- (char->integer c) 13))]
 [(char<=? #\n c #\z) (integer->char (- (char->integer c) 13))]
[else c]))
(check-expect (rot13 #\5) #\5)
(check-expect (rot13 #\A) #\N)
(check-expect (rot13 #\N) #\A)
(check-expect (rot13 #\a) #\n)
(check-expect (rot13 #\n) #\a)

rot13string: produce new string by applying rot13 to each character of s
(define (rot13string s)
  (list->string
   (map rot13
        (string->list s))))
(check-expect (rot13string "Hello!")
              (list->string (map rot13 (string->list "Hello!"))))
ROT13


Challenges I met this week
  I didnt know that every time we apply rot13 we have to type in #/before the number, so I failed to run the function correctly every time. I believe that next time I ll pay more attention to the definition of the function into details.




The test/quiz/assignment
The quiz this week is not about the content we learned this week. It’s still about the racket aggregate: how to decompose and reconstruct images. And I think that I did perfect in it.
The Wikipedia assignment is kind of hard for me, and it actually took me nearly two days to finish the “3-hour assignment” in part 2. Since reading the instructions of editing articles on the website and also looking for materials about the article are actually not easy for me as a result of my poor English. Feeling like the standard of judging whether we spent long enough time on the assignment is not that fair. But to get a good mark, what I can do is only to spend another two days to finish the next “4-hour assignment” for wiki3.
Yeah, csc104 requires a lot of reading and writing which makes it not like a computer science class to some extent. But maybe that is a good way for me to improve my English. Sigh anyway.

❤Feedback to others blogs
I read 's blog again this week lol. She stated what she had learned this week and it was a really long blog. So I left a comment: 
"Seems that you have learned a lot from this week lectures :D"