Ruby Update Part 1.

February 15th, 2009 § 1 comment § permalink

I’m walking myself through the Ruby Course, by Brian Schroder, and using SciTE as my temporary IDE. Here are a few things that made me scratch me head.

Single and double quotation marks matter a lot:

puts #{multi_foo(2)} #outputs just text
puts #{multi_foo(2)} #outputs results of function ‘multi_foo(2)’

Stacks and queues can be implemented two ways to get the same behavior, but the container (array) is way different.

Stack as I know it:

stack =
puts stack.pop until stack.empty?
Queue as I know it:

queue =
puts queue.shift until queue.empty?
No-no stack:

stack =
puts stack.shift until stack.empty?
No-no queue:

queue =
puts queue.pop until queue.empty?

I also came across some funky data type, the DEQUE/DEQUEUE” – a double-ended queue. I’m not sure how to use this in real life, can anyone give me a good example? I’m still trying to get me head wrapped around this data structure…

Deque 1:

deque =
puts deque.shift until deque.empty?
Deque 2:

deque =
puts deque.pop until deque.empty?

Right now, I’m trying to get a good understanding of the hashes, iterators and blocks. It’s not new to me, but the syntax hurts. After a few exercises, hopefully I’ll get it.

Oh yeah, and Happy Valentine’s Day.

Learning Again.

February 6th, 2009 § 0 comments § permalink

Do you ever find yourself learning only what you need to learn for work?

About a week ago, I found myself at the point where I’m not learning anything new. Don’t get me wrong though: I’m not tired of my job whatsoever. I just want to learn something outside C# and Object Oriented programming like Ruby, Functional Programming, or even learn to play some musical instrument.

Since I’m kind of ADD at times, I need to isolate some time for myself to focus on what I want to learn. So, I’m going to have myself Musical Mondays (piano? guitar hero? haha) and Technical Tuesdays (Ruby).

I spent about an hour to crack open some stuff on Ruby. I tried a few IDEs (RubyMine, Aptana, and directly online), but I wanted to get away from that so I’m using the “fxri” after installing the one-click-installer. I read up on the differences since I come from a C# background. I’ve already completed the quickstart, yay me!

My brother is back in town this weekend, so he should let me use his keyboard for the musical side of me. He never really uses it, so I might will borrow it from him, set it up in my room. My first task is to learn how to read notes and how they’re mapped to the keys. Maybe I’ll be able to identify this “middle-C” everyone talks about by the end of the first lesson. Or maybe I’ll crank up Guitar Hero what-ever-version-we-have on the PS2.

Where am I?

You are currently viewing the archives for February, 2009 at thomas nguyen.