My Journey Learning Ruby on Rails

My journey in learning Ruby on Rails
-I have zero experience in programming
-Purely science focus since high school
-Always wanted to combine science + technology

Immediate Goals: Get into App Academy to jump start my career in Software DEV
Short Term Goals: Learn more real world programming habits at a driven start up
Long Term Goal: Build foundation and eventually develop iOS software dev skills

Work Station

Work Station

Always been intrigued by how  writing a few lines of code on a computer can achieve the same amount of work as hard-wiring a breadboard.
See: Steady Hand Game
Heard about Software Development BootCamp:

Slight interest.
Applied to App Academy
Kush Patel sent me a prep-package

Visiting a friend from college got me intrigued in learning more programming as the field is booming.  And the stuff they do for work requires you actively think about what you’re doing.

Started Ruby on

Finished up to ~hashes/iterations
Started prep-work provided by AppAcademy

Chris Pine’s Learn to Program, chapters 1-8
-a computer is fairly ‘dumb’ [make a sandwich]
-Tell the computer everything you want it to do

Visited Eric in San Jose to study together
-Tic-Tac-Toe Game
-No idea how to do it, soo lost @_@

Started iTunes University
-Programming Methodology – Mehran Sahami

Started Ruby Monk Primer

More studying with Eric

Finished Ruby Monk Primer:
Intro to Ruby Objects
Intro to Strings
Conditions and Loops: Control Structures in Ruby
Arrays in Ruby

Why are for-loops so confusing?

Want to attend App Academy 6/02 cohort

Stumbled upon Ben’s Tumblr:
-this program is serious!
-you have to maintain your motivation, your drive, your perseverance

Quora/GitHu: after acceptance, there’s post-acceptance prep-work
-App Academy is super selective.
**They will only give you one chance to interview.  If you don’t meet their requirements…  you don’t get a second chance to apply again..  omg..  So much pressure…
I’m scared, yet I want to go forward.

I really have to be prepared!!
Read more stuff about what AppAcademy is looking for in a student:
-Eagerness to learn
-Ability to be taught
-Thought Process

Included in the post-acceptance prep-work is Homework that has to be completed 3-weeks pre-bootcamp.

I’m getting scared..  Slightly discouraged, but I want this.
Just need to study and practice until Example Problems are easier.
Nothing in life worth having came easy!

For-loops can be written so many different ways!

Screen Shot 2014-05-09 at 9.45.00 PM


Re-viewed all the syntax I’ve learned by re-doing Ruby on
This time it only took 2~3 hours to cover the same amount of material

Starting to realize that it’s not about the Syntax
It’s about combining the Syntax in clear well-thought-out manner to perform an action!
Lets do it!

Review of Chris Pine’s Learn to Program
Realizing that studying, truly studying involves going over foundational steps to reinforce what you’ve learned.

Understanding the power of the the .each method

Screen Shot 2014-05-09 at 9.50.54 PM

The power of the for-loop is immense!
Starting to see how programming makes repetitive work a lot easier!

When things work, it’s freaking AMAZING!!!

Using the syntax I’ve learned up to now to do what I want my program to do!

Screen Shot 2014-05-09 at 9.59.45 PM

another to write it:

loop do
puts “what else would you like to add to your array?”
say = gets.chomp
array << say if say.length >= 1
break if say.length == 0


puts “Any last words?”
else_say = gets.chomp

array.push else_say

puts array.sort.join(‘, ‘)


Also learned that “!” (bang) is pretty important
ie: i + 3         # i + 3
i += 3    # i = i + 3
a.downcase   #   .downcase on variable a
a.downcase!      # s = s.downcase
These mean modify in place of, and then replace the value.

Given an

input: hello
output: elhol

#give an input, i want you to shuffle the words and print it back out in it’s place
#so i want to Shuffle the word: shuffle
#and then i have to keep it together: join
#then print it out, return a value: otherwise later print/puts won’t return anything

ie: def string_shuffle(s)
return s

Just learned some cool tricks
Ruby converts lower precision to higher precision

Was working on Q1 of the prep material App Academy provides

Q1: Write a method, pow, that takes two (non-negative, integer) numbers, base and exponent and returns base raised to theexponent power. (No fair using Ruby’s base ** exponent notation!).

Got stumped…
Easiest answer:

def pow(base, exponent)
base ** exponent

Does the job, wrong answer because question explicitly states it’s not fair to use.
So, had to think about what exactly is happening with the math in base^exponent

ie: 2^4 = 2 * 2 * 2 * 2
What I want to do is, base * base, exponent number of times

Which got me to thinking, maybe I could use “exponent.times do”
So that takes care of the exponent number of times do, {something}

now for the base*base part
exponent.times do
value = 1  (have to define the value)
I could do: value *= base
(value = value * base, which is value = 1 * base)
value *= base, modifies the value in place of, so variable “value” will have a new value

so now the method looks like:

Screen Shot 2014-05-09 at 10.22.49 PM

and it works!!!

But what if I have a negative exponent, 0?

a negative exponent, is just the division of (1/base) exponent number of times
value /= base
but i can’t do “-exponent.times do”
But I can change the exponent to the absolute value
exponent = exponent.abs

So now to separate the positive/negative/0-exponents, the method looks like

Screen Shot 2014-05-09 at 10.24.55 PM

aww yeah!!
the “.to_f” needs to be there otherwise the negative exponent scope would return a 0 in terminal
It took me a while to figure it out, and then I asked a friend
I learned that Ruby, if you give it a Float +-*/ integer, it will return a Float
It uses the higher precision value


Screen Shot 2014-05-09 at 10.27.56 PM

Wooo!!  So much thinking.  But thanks to my friends I’ve figured out some new stuff!


Practice problem #2
Q2: Write a method, sum which takes an array of numbers and returns the sum of the numbers.

Write Method “SUM”
given an array of numbers, add them together and return the Sum

Screen Shot 2014-05-12 at 11.04.23 PM

Solution #1
if given Array is all Integers
We just need to keep adding the first array index to the next
How do we do that?
Well, we’re looking for a total of what we’re adding up, the total.  In the beginning, it’s 0.
Now how do we loop through the next index of the array?
Wouldn’t a counter work?  After the first addition, I could increase it by one: counter += 1
When do we stop looping?
So we begin at array[0], and it should loop through until the last index
We know that there are 5 items in the array with array.length
We also know that array’s begin with a 0th index
So if we set the counter == array.length in an Until loop
We’ll have the loop, loop until the 5th index, which doesn’t exist.  So it’ll break
So, Until kind of works like an n-1 array

Solution #2
What if we have a string in our array?
So we just have to iterate through each item in the array: array.each
And we have to check if the item in our array is an Integer/Fixnum
So we have a for-loop, and it should only execute the loop if it is a Integer
array.each do |x|
if x.class == Fixnum

05.17.2014 (weekly)
Came down to San Jose on the weekend to study with Eric again
Finished def is_prime?(number)
Finished def primes(max)
Finished def fizz_buzz(array)

Project Euler’s:
-Sum of multiple’s 3 or 5 below 1000  (Solved)
-Fibonacci’s Number                              (Solved)
-Largest Prime Factor of 600851475143  (Need Better Method, number is too large.  Eric showed me a method of crossing the multiple’s of largest prime out of a grid, but I lack the knowledge in data structures to continue with this method of tackling the problem.  I’ll have to think of another clever way to answer this problem)

messed with the terminal’s colors, haha

New Friend: Fred Lo
Contacted me through email from seeing this web-page and would like to work together on problems.  A friendly exchange of pointers and guidance.
Just made a new friend!!
I’m pretty stoked to work with more people with similar situations.
Fred has an interview with Dev Boot Camp this week, so I wish him good luck!!

At this point in time I do not believe I am ready to present myself in an interview in the best light possible.
Until I’m better able to clearly communicate my thought process, and finish a problem in a short amount of time I’ll keep practicing.
I really want to put my best foot forward for App Academy!

def primes(max)

Screen Shot 2014-05-18 at 10.12.19 PMbetter check of methods

Screen Shot 2014-05-18 at 10.16.18 PM

def fizz_buzz(array)

Screen Shot 2014-05-18 at 10.23.28 PM

Sum of multiples of 3 or 5 below 1000

Screen Shot 2014-05-18 at 10.25.59 PM

Fibonacci’s Number

Screen Shot 2014-05-18 at 10.27.49 PMLargest Prime Factor of: 600851475143
-still working on it, but here’s a crude way of doing it
-it’s not solving because there are too many numbers to iterate through

Screen Shot 2014-05-18 at 10.50.07 PM

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>