Updates

CS 50 Round One

So I picked up my study with CS 50 on week 1 (it starts at 0). I had already watched the previous weeks lectures before and so I picked up where I left off. We covered an introduction to C and how to use and interact with a marvelous creation: VirtualBox.

At Harvard, CS 50 is a massive class. Somewhere around 500 students I think. To ease standardization issues Harvard created an OS that works inside your OS. In short, my Mac OS X is fooled into thinking its running any other program when it’s actually running another OS that thinks it’s the main OS. Quite neat.

The OS that it uses is a Linux derivative (I think Fedora) that Harvard adapted. It comes with an IDE (code editor) that Harvard developed. Here is a view of it as it sits on my laptop: Image

Overall I’m stoked! Harvard’s CS 50 is put together much better. Everyone should check out their website at :

http://cs50.tv/2011/fall/

I also completed the first problems set. I had to use a program called Scratch to create a simple program. Scratch (funny enough for my situation) was created by MIT to help people learn the principals of programming. Its largely intended for elementary, middle, and highschool use. However its pretty fun and it helps get the ideas across. As far as I know, its the only time we actually use Scratch during the course.

Anyway, the first wee program I had to put together had to include:

  1. Your project must have at least two sprites, at least one of which must resemble something other than a cat.
  2. Your project must have at least three scripts total (i.e., not necessarily three per sprite).
  3. Your project must use at least one condition, one loop, and one variable.
  4. Your project must use at least one sound.

I put together a Frogger type game that you can actually play here:

http://scratch.mit.edu/projects/jrdillon/3212796

Lastly, I figured I’d give everyone a view of the actual Scratch program:

Image

So thats the fun I’ve had lately.

ūüôā

Standard
Updates

Rethinking my Strategy

So up to this point I have relied on MIT’s OpenCourseWare for my instruction. On a scale of 1 to 10 I would give it an 8. Its very good instruction and very well put together but it has a rather critical flaw: its from MIT.¬†

I dont personally know what kind of student they think they are recruiting, but they must believe they are some sort of savant genius. They say in the syllabus that this is an introductory course but they do not tell you what other non Comp Sci classes you should take… like copious amounts of math before you begin. But most of all, the biggest flaw in their instructional method is how they assign a problem set and then teach you how to do the problem on the day it is due. Personally, I dont see much of a need to take a class when they obviously think I can learn the material before they teach it to me.¬†

Its incredibly frustrating when they assign a problem set that practically¬†requires one to have access to other students in person in order to solve it. It is a problem when the only way to solve a problem is to collectively bang one’s head against a wall with other tortured souls – especially when the class is given as an online instruction. This problem exponetially increases for me because I am constantly fighting the feeling that I have fallen behind in understanding.¬†

I think one of the core problems in the class lies in that it is intended as an introduction to computer science for computer science majors. They assume a particular level of nerd and the availability to work with other like minded nerds to succeed. 

Were I taking the same class in person I wager my results would be different. Yes, I am a nerd, but I dont have any other nerds doing the exact same course as I. Therefore I have nobody to collectively work through my frustrations with. I do have the secret weapon of a Jedi Master as my guide, but I really dont like running to daddy every time I have a question (which is often). I prefer to figure it out on my own or with a peer. I think a mentor’s job should be to keep me within the bounds of my study and answer the big questions, not to be bothered with every single detail.¬†

So, I think I may have to do something slightly drastic. Pending approval from Dr. Dave, I think I am going to restart my instruction with Harvard’s CS 50 course. I’ve watched a number of the lectures in the past as well as done some of the assignments and they are prepared MUCH better. The problem sets are more regular and more reasonably constructed. They are more of a, “Today we learned about loops. Construct X program with Y number of loops plus A, B, C elements,” vs. “Today we learned about loops. Construct a program to play hangman with the computer using semi advanced calculus skills before we ever teach you how.” CS 50 also has the added benefit of being targeted not only as computer science majors, but to everyone. The majority of students that take CS 50 are not Comp Sci majors and never intend to be. They merely want to know a bit more about computers.¬†

I hate to do this sort of thing because I feel like I am running away from a problem. But I am honestly hitting a wall with the course and its because I feel lost. Not because I havent paid attention, but because they expect me to understand concepts and skills that I have had no exposure to. 

In addition to rethinking my istructional strategy, I need to become more ballanced in my math vs lecture time. I spent all of my study time last week doing math on Khan Academy. It was freaking awesome. But then I realized that I had forgotten about my actual mission: learning to program. 

So I think I’ll break it down as follows: M, W, F mornings, and Calculus on T, TH mornings. I’m not sure how I’ll break things down in the evenings, but most of my study time is in the morning anyway.¬†

I really dont like the idea of stepping away from Python because I’ve grown to like the language, but I will endure.¬†

Any thoughts out there? 

Standard
Musings, Updates

Tired.

I’ve been keeping up my habit of waking at around 0430 to read my bible and study before the day begins. I’ve been reading a chapter in Proverbs and one chapter in a New Testament book a day. Right now I’m in James. I finished 1 Peter. I think I need to start taking notes on my bible readings as well because I cant recall anything specific about my reading that I’d care to share. I feel like Dr. Jones (Indiana Jones’ father) when speaking of the clues to find the Holy Grail, “I wrote them in my journal so that I wouldn’t have to remember them.”

For about a week I’ve done nothing but math. I hit a wee wall in programming when one of the assignments required me to use a number of calculus skills (that I lacked). Once again, I have an incredibly hard time letting my self just “move on and come back” to a problem that I currently dont understand. So I’ve been hitting the Khan Academy pretty hard in order to close the understanding gap a bit (regardless, this is a segment I’ll probably have Jedi Dave debrief me on when I finish Unit 1).

But all is not lost! I found out that I love studying math. I believe that mathematicians are probably the greatest and most useful explorers in human history. They dedicate their entire lives and mental capacity to discovering the order in what seems like chaos. The Lord is a god of order and creation. He did not shake up a bunch of dirt and let it float in space. He declared that everything in existence would be ordered – one way or another. Mathematicians exert the short span of their lives to discover this order. To learn about creation and, intentionally or not, worship the Creator.

Therefore, I believe without reservation, that to study math is one of the single greatest acts of worship – because you seek the face of God. We study His creation so that we might know Him more.

Math has also taught me another wee idea: everything creation has its place, its fit, in order to function properly.

This last weekend was great because I was able to spend a great amount of time with my wife and kids. It has been a number of weeks since we had dedicated time together. I had lost sight of how far we had drifted away from “fitting” together. We were not in harmony and we were just getting by. Sometimes, I wonder if my sons forget who I am during the week because I’m gone so much. My wife sleeps alone in a cold bed (pending our fat cat doesnt want to snuggle). Sometimes I feel as if I’m dividing my family life by zero.


import NerdyMathmaticalReference
print machineLaugh

"11001011100000111010100101100011101010100!"

When I read the scriptures I see that, like math, everything has order. When it comes to my family, I must never forget to study my children, to study my wife and learn how well we are “fitting”. I have a terrible tendency to laser focus on a single thing and forget the rest.

May the Lord never let me forget them.

Standard
Musings, Updates

Continuing with the Star Wars theme…

import nerd_reference

So I’ve flown to my own little Degobah. And like Luke Skywalker, I’ve found that becoming a Jedi requires a bit more sweat equity… and less sleep.

This last week I have been at home every night instead of on the road. This is a blessing and a curse. I love being with my family and helping out with the house but when I get home between 5 – 6:30 on average I have enough time for dinner with everybody, clean up the kids, put the kids to bed at 7:30, clean up the mess the kids created, done by 8:15, and then I have maybe an hour and a half to spend with the wife before I need to start heading to bed. I have so little time at home that its coveted pretty badly.

So my solution?

I’ve started waking up two hours before I have to leave for work every morning in order to study and work. My lectures are about an hour long so that gives me time to study, eat breakfast, read the bible, and do a bit of math via Khan Academy. I also spend a lot of time riding around in work trucks. That gives me time to read the “further reading” posted on my course’s web site.

Speaking of further reading, I realized I was dropping the ball big time by ignoring them. I went back and began reading them and realized something: programming is an extremely vast science… extremely vast. Its similar to trying to build a life size castle out of legos. You take thousands of very small pieces and methodically put them together, one after another, until it builds into a massive and awesome creation.

I have a lot to learn. Time to get on it.

Standard
Musings, Updates

I’m looking for a great warrior…

“Oh but wars not make one great.”
“I’m looking for a Jedi master.”
“Ohhh, Yoda, you seek Yoda!”

Degobah is a bit foggy and overwhelming. However, similar to Luke Skywalker, my own Degobah offers a wealth of opportunities.

Math.

I’ve never been poor at math. Most of what I lack in knowledge and skill can be attributed to the fact that I was either never offered the chance and/or I never had the interest. I now realize that whatever the reason, I was an idiot.

Over the past year or two I’ve started developing a sincere fascination with math. It is in many ways the purest of sciences. Mathematics is the lens that we are able to see the artwork behind God’s creation. Every time I learn something new I marvel at how anyone could choose to believe that the universe around us could arrange itself by pure accidental randomness.

But I digress.

The downside to math is the considerable discipline required to study it.

Alas one of my weaknesses.

So I guess the best way to combat this is to formulate a plan, tell the world about it, and then stick to it to avoid public lashings.

My plan (currently, but subject to revision) is to tackle the Khan Academy at least three days a week and work my way through calculus eventually. I want to also read my way through a book called The Calculus Direct ( http://www.amazon.com/The-Calculus-Direct-Understanding-ebook/dp/B002V1I4FY ). I’ve read part of it and its a great read.

I figure that until I get a better hang of math I’ll continually be hamstrung in my programming adventures. And that ladies and gentlemen, will not do.

Standard
Updates

Bisection… Insert algorithm

I’ve been a bit distracted lately.

I didn’t accomplish much in the way of studying this weekend due to my National Guard commitments. Coupled with that is the fact that I’ve hit a bit of the lecture / code that stumps(ed) me a bit. I have this really interesting mindset that wont allow me to go on unless I actually understand 100% what is happening. I’ll obsess over a particular bit of logic until I find the answer.

The problem set I’ve been toiling over is three part:

1) I had to write a program that computed what would happen if we only paid the minimum amount on our credit card debt. The problem I encountered here was that I didn’t know the ” += ” and ” -= ” operators. I couldn’t figure out how to take a new value for a variable and have that value carried through the next loop. So those operators solved that and gave me a wee high.

2) This problem called for what it took to pay off my credit card in one year. I really had to learn how to implement loops in order to find a value that met the requirements. The problem I had here was that my answers never equaled the instructor’s examples. I wracked my brains on this until this weekend when I had the chance to sit and chat with a few soldiers in my unit with coding experience.

We compared my program with the instructors and tried to work out the logic gaps in mine. I started copying over different variables and then my program worked. I couldn’t figure out the “why” though. Then one of my sargents suggested having it Print back to me the value of that particular variable each time it looped. Long story short, that simple trick helped me recognize what was happening in the program as far as its logic is concerned.

+ 10 coding experience gained —- 3,046 needed to level up.

3) Now for the wall. Bisection search is a bit of a bear for me. I understand the idea behind it. Its rather simple. However, implement it has been a bit confusing.¬†Especially the algorithm. I posted a question on OpenStudy for the course and somebody explained the math behind it. However I’m left wondering if I should have known the formula already or I should have just taken the prof at his word (it was provided in the problem set).

So being stuck on understanding HOW to do this at all I took at look at the instructors answers (not something I’m want to do). For reference, here is what he provided:

# 6.00 PS1-C Solution
# Uses bisection search to find the fixed minimum monthly payment needed
# to finish paying off credit card debt within a year

# Retrieve input
original_balance = float(raw_input("Enter the outstanding balance on your credit card: "))
interest_rate = float(raw_input("Enter the annual credit card interest rate as a decimal: "))

# Initialize state variables
balance = original_balance
low_payment = balance/12
high_payment = (balance*(1+(interest_rate/12))**12)/12

# Use bisection search until the search space is sufficiently small
while True:
    balance = original_balance
    monthly_payment = (low_payment + high_payment)/2

    # Simulate passage of time until outstanding balance is paid off
    # Each iteration represents 1 month
    for month in range(1,13):
        interest = round(balance*interest_rate/12, 2)
        balance += interest - monthly_payment
        if balance <= 0:
            break
        
    if (high_payment - low_payment < 0.005):
        # Bisection search space is small enough
        # Print result
        print "RESULT"

        # Round monthly payment up to the nearest cent
        monthly_payment = round(monthly_payment + 0.004999, 2)
        print "Monthly payment to pay off debt in 1 year:", round(monthly_payment,2)

        # Recompute remaining balance and the number of months needed
        balance = original_balance
        for month in range(1,13):
            interest = round(balance*interest_rate/12, 2)
            balance += interest - monthly_payment
            if balance <= 0:
                break
        print "Number of months needed:", month
        print "Balance:", round(balance,2)
        break
    elif balance < 0:
        #Paying too much
        high_payment = monthly_payment
    else:
        #Paying too little
        low_payment = monthly_payment


The biggest thing I don’t get is why it recomputes the balance and the number of months needed when it was done earlier in the script. Needless to say, this one is causing me a bit of a brain jam.

I think this is one I’ll actually have to sit down with Jedi Dave and discuss here in the future. In the mean time, I’m going to put it in my “to-solve-later-and-use-to-take-over-the-world” folder.

Time to watch part of a lecture before bed. Onward!

Standard