kday


Joined 10 months ago

About Me

I'm mostly interested in computer programming. Python and PHP are what I'm most comfortable with, and I'm looking to expand to other languages also.

I'm starting to play guitar again after a long, multi-year break.

Classes

Guitar for Beginners - Playing Pink Floyd

Class status: Established
Role: Creator
. 50% complete

Bulletproof Web Design

Class status: Established
Role: Creator
. 22% complete

Bash Scripting

Class status: Established
Role: Creator
. 44% complete

Structure and Interpretation of Computer Programs

Class status: Established
Role: Creator
. 15% complete

Beginning German

Class status: Established
Role: Creator
. 100% complete

Submitted Assignments

Bash Scripting: Lesson 8, HW 1

Done. I was somewhat familiar with the find command, but it's a good review.


kday 1 month ago
Guitar for Beginners - Playing Pink Floyd: Lesson 3, HW 1

Done with week three. I think I'm making good progress:


kday 1 month ago
Beginning German: Lesson 6, HW 1

Complete.


kday 1 month ago
Guitar for Beginners - Playing Pink Floyd: Lesson 2, HW 1

Here's my second week's homework:

The noise at the end is some feedback from my amp. I felt this week I made some progress, but I think I can do even better next week. My fingers were pretty sore from playing earlier today so I hope that building up my callouses will help some.


kday 1 month ago
Guitar for Beginners - Playing Pink Floyd: Lesson 1, HW 1

Here's my first attempt:


kday 2 months ago
Beginning German: Lesson 5, HW 1

Complete


kday 2 months ago
Bash Scripting: Lesson 7, HW 1

Done! Pretty easy. Hadn't used sort much before, but it seems pretty useful.


kday 2 months ago
Bash Scripting: Lesson 6, HW 1

Complete. This was a useful lesson.


kday 3 months ago
Bash Scripting: Lesson 5, HW 1

Complete


kday 5 months ago
Beginning German: Lesson 4, HW 1

Complete.


kday 6 months ago
Beginning German: Lesson 3, HW 1

Complete.


kday 6 months ago
Structure and Interpretation of Computer Programs: Lesson 2, HW 1

See below:

;1.9
inc(+ 4 5)
inc(inc(+ 3 5))
inc(inc(inc(+ 2 5)))
inc(inc(inc(inc(+ 1 5))))
inc(inc(inc(inc(inc(0 5)))))
inc(inc(inc(inc(5))))
inc(inc(inc(6)))
inc(inc(7))
inc(8)

;1.11
(define (f n)
  (if (< n 3)
      n
      (+ (f (- n 1))
	 (* 2 (f (- n 2)))
	 (* 3 (f (- n 3))))))

;1.13
;Skipped this one

;1.15, part a
;p will be applied 5 times
(sine 12.15)
(p (sine 4.05))
(p (p (sine 1.35)))
(p (p (p (sine 0.45))))
(p (p (p (p (sine 0.15)))))
(p (p (p (p (p (sine 0.05))))))

;1.15, part b
;Growth in space = a^(1/3)
;Growth in steps = 2*a^(1/3)

;1.17
;Not sure...

;1.19
;Skipped

;1.21
;199: 199
;1999: 1999
;19999: 7

;1.25
;Not sure

;1.27
;Skipped

kday 6 months ago
Bash Scripting: Lesson 4, HW 1

Useful chapter. It's complicated to keep track of the different ways that parameters can be parsed. Now I see why a cookbook is a useful format for bash. Lots of syntax gotchas.

String manipulation operators are cool, but seem hard to remember also.


kday 6 months ago
Bash Scripting: Lesson 3, HW 1

Nice chapter. I've been looking for something similar to nohup for a long time. I've actually resorted to using cron at times for one-off long running tasks. nohup is going to save me a lot of trouble :)


kday 6 months ago
Bash Scripting: Lesson 2, HW 1

Complete. The select function in 3.7 is pretty cool. I didn't know that existed.

I got the following error when I tried 3.6. Not sure how to fix it because they kind of just put a big script in there without much explanation. Otherwise the homework went well.

# cookbook filename: func_choose
# Let the user make a choice about something and execute code based on
# the answer
# Called like: choose <default (y or n) > <prompt> <yes action> <no action>
# e. g. choose "y" \
#       "Do you want to play a game?" \
#       /usr/games/GlobalThermonucularWar \
#       ' printf "%b" "See you later Professor Falkin. "' >&2
# Returns: nothing
function choose {
    local default="$1"
    local prompt="$2"
    local choice_yes="$3"
    local choice_no="$4"
    local answer
    read -p "$prompt" answer
    [ -z "$answer" ] && answer="$default"
    case "$answer" in
        [ yY1] ) exec "$choice_yes"
            # error check
            ;;
        [ nN0] ) exec "$choice_no"
            # error check
            ;;
        *     ) printf "%b" "Unexpected answer ' $answer' ! "  >&2 ; ;
    esac
} # end of function choose

choose y "choose one" {echo "yes"} {echo "no"}


$./func_choose
$./func_choose: line 19: syntax error near unexpected token `yY1]'

kday 6 months ago
Beginning German: Lesson 2, HW 1

Completed.


kday 6 months ago
Bash Scripting: Lesson 1, HW 1

I couldn't get 2.12 to work, Skipping a Header in a File. tail kept trying to open the file '+2' and gave an error (see below).

I also skipped a couple towards the end like 2.19 and 2.20. The rest of the examples worked well, and I learned more than I expected to given it's the first chapter.

kevin@heater:~/bashtest2$ tail +2 /tmp/ls.out
tail: cannot open `+2' for reading: No such file or directory
==> /tmp/ls.out <==
k
s
a
d
f
g
h
j
k
s
kevin@heater:~/bashtest2$ tail /tmp/ls.out +2
==> /tmp/ls.out <==
k
s
a
d
f
g
h
j
k
s
tail: cannot open `+2' for reading: No such file or directory

kday 6 months ago
Beginning German: Lesson 1, HW 1

Completed


kday 6 months ago
Structure and Interpretation of Computer Programs: Lesson 1, HW 1

1.1 1. 10, 12, 8, 3, 6, "a-->3", "b-->4", 19, #f, 4, 16, 6, 16

1.2. (/ (+ 5 4 (- 2 (- 3 (+ 6 (/ 4 5)))) (* 3 (- 6 2) (- 2 7))

1.4 The operator can be either + or -, depending on the value of b. If b is greater than zero, it's added to a. If b is less than zero, it's subtracted from a. The result is the same as adding the absolute value of b to a.

1.5 If it's applicative order, it will execute the arguments of test first. That means it will execute (p), which will result in an infinite loop. If it's normal order, the if statement will be executed first, and will return zero immediately. (p) will never be executed.

1.6 'new-if' doesn't get a chance to evaluate because its arguments are executed first and hit the max recursion depth before returning a value. That's why if is provided as a special form.

;;;;;;;;;;;;;;;;;;;;;
;;; 1.3:
;;;;;;;;;;;;;;;;;;;;;
(define (ss a b c)
	(cond ((and (< a b) (< a c)) (+ (* b b) (* c c)))
	      ((and (< b a) (< b c)) (+ (* a a) (* c c)))
	      (else (+ (* a a) (* b b)))))
(ss 1 2 3)

;;;;;;;;;;;;;;;;;;;;;;;;
;;; 1.7:
;;;;;;;;;;;;;;;;;;;;;;;;
(define (good-enough? old-guess new-guess)
  (< (abs (/ (- old-guess new-guess) new-guess)) .001))

(define (abs x)
  (if (> x 0)
      x
      (* x -1)))

(define (sqrt x)
  (sqrt-iter 0.1 1.0 x))

;;;;;;;;;;;;;;;;;;;;;
;;; 1.8:
;;;;;;;;;;;;;;;;;;;;
(define (cubert x)
  (cubert-iter 0.1 1.0 x))

(define (cubert-iter old-guess new-guess x)
  (if (good-enough? old-guess new-guess)
      new-guess
      (cubert-iter new-guess (improve-cube new-guess x)
		 x)))

(define (improve-cube guess x)
  (/ (+ (/ x (* guess guess)) (* 2 guess)) 3))

(define (good-enough? old-guess new-guess)
  (< (abs (/ (- old-guess new-guess) new-guess)) .001))

(define (abs x)
  (if (> x 0)
      x
      (* x -1)))
(define (sqrt-iter old-guess new-guess x)
  (if (good-enough? old-guess new-guess)
      new-guess
      (sqrt-iter new-guess (improve new-guess x)
		 x)))

kday 6 months ago