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

Saturday, April 18

toghq: extensible open source social networking platform


It was couple of back in January, I decided to write  on the RoR based social networking applications.  And I had taken the widely accepted bunch of apps and made a nice and useful doc out of it here.  I have been getting pretty good response on this post @ Scribd & slideshare.

  To continue with my exploration, from couple of weeks I was playing with toghq.  A beautiful one and easy to extend.  I thought I would share my thoughts on this.  

  The beauty of toghq is in it's extendability and agility.  Tog, contains set of plug-ins that are very easy to integrate and easy to use.  One such plug-in's that impressed me that I would talk today is tog_picto.














top_picto, is the photo management plug-in with tog.  What impressed me is:
1. Easy to manage
2. Photoset creation, manage, delete
3. simple drag drop to create/delete photosets
4. multiple image uploads
5. taggable, commentable, rateable...
6. mulitsized photos

Thanks to Haritha, for her help with screenshots.

Thursday, January 10

Ruby Classes - 1

Ever since the languages have come up with approach of problem centric not just the system centric, we have been hearing about these Objects. Since our daily life is around, with objects this would ease our understanding the problems, solving the problems.
As we know Ruby is pure object oriented language (no datatypes, all are treated as objects), and the Object Oriented paradigm very well fits with Ruby too!

* Abstraction
* Encapsulation
* Inheritance
* Polymorphism

So how the classes come into picture ?
Well a category(group) of objects like (similar) is called a class
Classes hold the properties, characteristics and the actions that are done by objects. This acts as constructor to create more such objects. And we all know that the objects in the real world communicate with each other, similarly here we have the actions/methods doing the job of communication across objects of different classes.

In ruby the class will look like this:

Download Examples on Classes
Example 1: Classes.

class ClassOne

def do_something

puts ("I am displayed")

end


end



c1 = ClassOne.new
c1.do_something


# Observe:
# --> The class starts with "class" (all lower case) keyword and concludes with "end" keyword.
# --> The class name starts with Capital/Multi-word written using CamelCase (ClassOne)
# --> The (.new) is the method that would create multiple copies of objects belongs to a class.
# --> Once the object is created(c1), it gain access to all the methods(dosomething) defined within the class.
# --> The method name starts with lowercase (just convention) and multi-word separated with 'underscore'.

Download Examples on Classes
Example 2: Shows passing parameters to methods.

# Class is like a blueprint from which individual objects are constructed.
# Methods/Definitions/Actions are the means of communication between the objects.

class ClassOne

def do_something(doing)
puts ("I am #{doing}")
end

def someone

puts "I am not public but private"
end

end


c1 = ClassOne.new
c1.do_something("singing")
c1.do_something("listening")
c1.someone

# Observe:
# Passing parameters across objects to actions
# --> The class starts with "class" (all lower case) keyword and "end" is the end of the class.
# --> The class name starts with Capital/Multi-word written using camelcase
# --> The (.new) is one of the methods that would create multiple copies of objects belongs to a class.
# --> Once the object is created(c1), it gain access to all the methods(dosomething) defined within the class.
# --> The method name starts with lowercase (just convention) and multi-word separated with 'underscore'.

Download Examples on Classes

Web Application resources required Ruby vs Java

David Heinemeier Hansson says,
"Once you've tried developing a substantial application in Java or PHP or C# or whatever, the difference in Rails will be readily apparent. You gotta feel the hurt before you can appreciate the cure."


Who is David Heinemeier Hansson? David is...
What else he said about Ruby on Rails? Interview with David...
How popular he is? Well he ranked ...

Tuesday, December 11

Ruby on Rails Installing Ruby

Though you continue to work/experiment more on the online ruby editor, today we see how we would install the ruby on windows OS.
Recollect "Ruby is portable, which means can be installed on all OS's possible"

Ruby Installer for Windows. Download the executable ruby186-25.exe and double-click this file to install Ruby on your PC. (Accept all the defaults.)
Once you have installed your Ruby software, the System Environment Variable path is already set to point to the bin folder of Ruby. The installation also includes the First Edition of Programming Ruby book and the SciTE editor.

Just recollect what we had done and what's the Ruby Environment looks like.

Assuming that you installed Ruby in the folder c:/ruby, then the installation creates a number of sub-folders. See the list below.

c:/ruby/bin : Here the Ruby executables (including ruby and irb) have been installed.
c:/ruby/src : Here you get the Ruby source code.
c:/ruby/lib/ruby/gems : Here are the Ruby-Gems.
c:/ruby/lib/ruby/1.8 : Here you'll find program files written in Ruby. These files provide standard library facilities, which you can require from your own programs if you need the functionality they provide.
c:/ruby/lib/ruby/1.8/i386-mswin32 : Here you find architecture-specific extensions and libraries. These files are C-language extensions to Ruby; or, more precisely, they are the binary, runtime-loadable files generated from Ruby's C-language extension code, compiled into binary form as part of the Ruby installation process.
c:/ruby/lib/ruby/site_ruby : Here you store third-party extensions and libraries. This include your own code or some third party.
c:/ruby/samples/RubySrc-1.8.6/sample : Well, here you will find some sample Ruby programs.

From now we can also execute ruby snippets on the locally installed SciTE editor.
Open the Editor: start/Programs/Ruby-186-25/SciTE.
Press F8 to open an output window.

Create a folder named, say. rubyexamples on your C:\ and will keep all our programs in this folder. Let us repeat the our first program, that we had done yesterday online. That is

puts "Hello World!"

Now save the file as "hello.rb" under c:\rubyexamples folder. Note all ruby source files have the .rb extension.

Pressing on F5 would execute the program and outputs the string "Hello World!" on right side window.

  1. # hello.rb
  2. puts 'Hello'

Alternatively you can also type command "ruby hello.rb" to execute the hello.rb file.

Having installed the ruby on local system now repeat the yesterdays examples and practice more for better understanding.

Download the pdf version of Installing Ruby post.