Showing posts with label ruby. Show all posts
Showing posts with label ruby. Show all posts

Friday, July 1, 2016

Signed up for a coding school

Well, I signed up for an online coding school that's going to take me roughly 2 years to get through. Hopefully I get through it faster than that.  =)

I'm going to be learning Ruby on Rails, JavaScript, Angular and a few others. After my conference call with my instructor last night, I am now charged with creating a blog post once a week. The topics will be either a few notes I took going over the material or anything new that I've learned. The first module from what I can tell so far, covers Ruby, Markdown, Rails, Git, command line concepts and I just forked my first repository (a Jekyll template) 2 days ago and created a blogging application. Once I get more confident in knowing what I'm doing, I might move this blog over to the app that I created (well, forked, modified etc).

As far as my first post is concerned, I thought I'd give just the basic information of what I've gone over for the past 3 weeks.

I signed up with an online school called Bloc. The tuition isn't cheap by any means but so far I think it's worth it.

I'm signed up for the Software Engineering track which currently is divided up into 4 sections.

  1. Rails Web Development
  2. Front End Development
  3. Software Engineering Principles
  4. Open Source Apprenticeship

The first 2 are probably self explanatory. Number 3 entails learning more computer science type topics like data structures, algorithms, databases and SQL and design patterns. Number 4 basically has 2 sections...creating an open source project and then contributing to an existing open source project.

From what I can tell, I'm going to learn about the topics in the order that they appear in list above.

I'll post more detail about what I'm learning in my next blog entry which will probably be this weekend or if I get stuck on one of the exercises or assignments that I'm going back to now.

Cheers!

Sunday, November 30, 2014

Ruby naming

Following along with the online LRTHW exercises and lesson 25. I copied the code as it was stated from the web page. Well, I typed it in manually rather than doing a copy and paste. Just to take a shortcut to type it in as fast as possible, I didn't capitalize the module name and I got the following error...

2.1.3 :001 > require "./ex25.rb"
SyntaxError: /home/.../ruby/ex25.rb:1: class/module name must be CONSTANT
from /home/.../.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/.../.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from (irb):1
from /home/.../.rvm/rubies/ruby-2.1.3/bin/irb:11:in `<main>'

After going back and capitalizing the module name, function names and references to the functions, I was able to get it run without error.

2.1.3 :001 > require "./ex25.rb"
 => true 

Found official documentation that discusses naming.  The exercise didn't cover the topic of naming...

http://www.ruby-doc.org/docs/ruby-doc-bundle/UsersGuide/rg/constants.html

Friday, November 28, 2014

Escape sequence r

While trying out the escape sequence 'r', I again didn't get the results I expected.

I thought that there would be a blank line after the word return when keying this in...

2.1.3 :001 > puts "return\r"
return
 => nil

After finding out about \b, I decided to put a space after \r and the double quotation mark and this was what I got...

2.1.3 :002 > puts "return\r "
 eturn
 => nil

This confused me even more until a few minutes later when I remembered that a carriage return was not what I thought it was.  I remembered reading some documentation some time ago that \r returned the "focus", if you will, to the beginning of the line and that the line feed was a separate escape sequence altogether.  That wasn't the terminology I read but that's how I remembered it.

2.1.3 :003 > puts "return\f"
return

 => nil

This is what I was expecting at first when using \r.  I do know that the \f switch/option just moves the "focus" down a line in the same spot...kind of like using a typewriter and moving the page up one line.  The type writer is going to type right where it's at unless it's moved to the beginning of that line.  Necessary to know if using Ruby to look through strings or text files etc.

Starting at the beginning of the next line (just like you would with a typewriter), I'd need to use \r\f options like so...

2.1.3 :004 > puts "return\r\f"
return

 => nil

Escape sequence b

I'm currently reading the website (online e-book) Learn Ruby the Hard Way and I'm on exercise 10.

It covers using the escape sequence with the various options.

I was stuck for a moment on why it wasn't working like I thought it should.

2.1.3 :001 > puts "backspace\b"
backspace
 => nil

I felt the entry should have removed the 'e' but the 'e' still showed up.  On another attempt, I got the result I was looking for.

2.1.3 :002 > puts "backspace\b "
backspac
 => nil

Putting a space between the letter 'b' and the double quote worked.  I have no technical explanation for this. My guess is that the backslash b is not given any space to "do it's thing".  I've googled but couldn't find anything on this topic.  Any comments welcome.  If I do find the explanation, I'll post what I find.