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

Friday, March 7

RoR Workshop @ Hyderabad - Twincling

I am planning for a workshop on Ruby on Rails introductory level. The agenda of the workshop is

  • to introduce the Ruby on Rails
  • MVC Architecture
  • ActiveRecord
  • ActionController
  • ActionView
  • ActionMailer
  • Pagination
  • Ajax
  • Rails demo with project
For more details about the venue and organisation details, visit Twincling.
More about the workshop will be updated through the posts, keep watching :-)

Monday, January 7

Ruby on Rails Arrays and Hashes

Download the Examples
Arrays

Ruby has Arrays and Hashes to store/collect the objects.
And these objects are accessed using an index.

Array:
1. It is an ordered collection of objects.
2. Indexed with integers.

How to create an Array?
Answer is there are three different ways to create an array.
# Way 1 :
a1 = []

# Crosscheck whether we created the array "a1".
puts "a1 is an #{a1.class}"

# Way 2 :
a2 = [1,2,3]

# Crosscheck whether we created the array "a2".
puts "a2 is an #{a2.class}"

# Way 3 :
a3 = Array.new

# Crosscheck whether we created the array "a3".
puts "a3 is an #{a3.class}"


# Note:
# --> The array holds the objects within square brackets.
# --> The multiple objects separated with commas.
# --> The array holds different objects (int, float, string...).
# --> Way 1, creates an empty array.
# --> Way 2, creates an array with few objects defined/collected.
# --> Way 3, creates an empty array using ".new" operator/method.
# --> At any point to check whether we created array's or not, we can use ".class".

Exercise:
Well following are the built in methods that we can apply on to arrays.
&, *, +, -, <<, <=> , ==, [], [], []=, abbrev, assoc, at, clear, collect, collect!, compact , compact!, concat , dclone , delete, delete_at, delete_if, each, each_index, empty? , eql?, fetch , fill, first, flatten , flatten!, frozen? , hash include?, index , indexes, indices, initialize_copy , insert, inspect , join, last, length, map , map!, new, nitems , pack , pop, pretty_print, pretty_print_cycle, push , quote, rassoc, reject , reject!, replace, reverse, reverse! , reverse_each , rindex , select, shift, size , slice, slice!, sort , sort!, to_a , to_ary , to_s , to_yaml, transpose, uniq , uniq! , unshift, values_at, yaml_initialize, zip , .

Download the Examples

Hashes :


Ruby has Arrays and Hashes to store/collect the objects.
And these objects are accessed using an index.


# How to create an Hash?
# Answer is there are three different ways to create an Hash.
# Way 1 :
h1 = {}

# Crosscheck whether we created the Hash "h1".
puts "h1 is a #{h1.class}"

# Way 2 :
h2 = {
"Object1"=>"First Object",
"Object2"=>"Second Object"
}

# Crosscheck whether we created the Hash "h2".
puts "h2 is a #{h2.class}"

# Way 3 :
h3 = Hash.new

# Crosscheck whether we created the Hash "h3".
puts "h3 is a #{h3.class}"


# Note:
# --> The hash hold objects within curly braces.
# --> The Key and Value pair forms an object in Hash.
# --> The multiple objects separated with commas.
# --> The hash holds different data types.
# --> Way 1, creates an empty Hash.
# --> Way 2, creates an Hash with few objects defined/collected.
# --> Way 3, creates an empty Hash using ".new" operator/method.
# --> At any point to check whether we created Hash or not, we can use ".class".

Exercise on Hashes:

==, [], [], []=, clear, default, default=, default_proc, delete, delete_if, each, each_key, each_pair, each_value, empty?, fetch, has_key?, has_value?, include?, index, indexes, indices, initialize_copy, inspect, invert, key?, keys, length, member?, merge, merge!, new, pretty_print , pretty_print_cycle, rehash, reject, reject!, replace, select, shift, size, sort, store, to_a, to_hash, to_s, to_yaml, update, value?, values, values_at, yaml_initialize

Download the Examples
The zip file contains examples on Creating Arrays and Hashes, Methods implemented on arrays.
Note:
  1. Please comment/un comment the wanted/un necessary puts, for better understanding.

Friday, December 7

Ruby on Rails - What is Ruby?

So, I am not just going to stop by providing the Ruby on Rails course structure.
I am here to start sharing the concepts what I understood about Ruby on Rails.
A gentle disclaimer, Nobody is perfect and in my attempt to become close to perfection I relied on world wide web to learn better and to understand the concepts clearly.

So let's start today with Introduction topic and discuss more on What is Ruby? If you are in hurry you can download What is Ruby?


Initially Some History about Ruby:

The language was created by Yukihiro "Matz" Matsumoto, who started working on Ruby on February 24, 1993, and released it to the public in 1995. "Ruby" was named as a gemstone because of a joke within Matsumoto's circle of friends alluding to Perl's name.

Some useful links that come handy when you are going through the course material:

Scripting Language : http://en.wikipedia.org/wiki/Scripting_language

Compiled Language : http://en.wikipedia.org/wiki/Compiled_language

Compilers : http://en.wikipedia.org/wiki/Compiler

Interpreters : http://en.wikipedia.org/wiki/Interpreter_%28computing%29

Object Oriented Programming : http://en.wikipedia.org/wiki/Object-oriented

Jargon to watch out:
Ruby, Interpreters, Compilers, Scripting Language, Compiled Language, Mixins, Operating System, Unix, Linux, Modules, Closures, Threads, Exceptions, Garbage Collectors,

Download the detailed Ruby on Rails Course contents.

Reach me @ tosumanthkrishnaATgmailDOTcom for more discussions.

Ruby is "an interpreted scripting language for quick and easy object-oriented programming".

Don’t be alarmed. We will take one by one:

Interpreted Scripting Language:

  • Ability to make operating system calls directly
  • Powerful string operations and regular expressions
  • Immediate feedback during development
  • Ruby programs can be executed from source code.(means to say need not be compiled)
Object Oriented Programming:
  • Everything is an object
  • Classes, inheritance, methods, etc.
  • Singleton methods
  • Mixin by module
  • Iterators and closures

Portable:

  • Runs on many different operating systems.
  • Windows 95 through XP, Linux, UNIX...

Simple and Fast:

  • Variable declarations are unnecessary (remember: everything is an object... including primitives)
  • Variables are not typed
  • Syntax is simple and consistent (like you are expressing something)
  • Automatic memory allocation and garbage collection

More...

  • Exception processing model
  • Dynamic loading
  • Threads


Download the detailed Ruby on Rails Course contents.

Download What is Ruby?

Reach me @ tosumanthkrishnaATgmailDOTcom for more discussions/tips/suggestions.