Tag Archives: ruby

Ruby 2.0 is out!

mruby – Lightweight Ruby

What is mruby ?

mruby is a light weight implementation of the Ruby programming language.

So if you use ruby then mruby might be useful for you – because it can run ruby program in interpreter form or compile and execute in vm form, probably in less amount of time (faster execution) with less amount of resources (that’s what the light weight indicates) as compared to the standard Ruby (MRI).

Ruby is already popular in web application development (Ruby on Rails framework) but the lightweight and efficient version of ruby would probably explore new domains for ruby – e.g mobile platform (Actually, it has started – checkout the bottom notes), embedded devices etc.ruby-logo


Download mruby

There isn’t any official version of mruby available right now but you can checkout the github page for downloading the initial release.

mruby at github

Notes : Now, Ruby is one of the most popular programming languages, within a few months you might be able to write mobile apps for Android and iPhone, in ruby using mobiruby (built on the top of mruby).

Fecon getting award from Stallman

Free Software Awards for 2011

The Advancement of Free Software Award => Matz (Creator of Ruby)

The advancement of Free Software Award is given(once in a year) to someone who made a great contribution to the progress and development of Free Software. This year, the award has been given to Yukihiro Matsumoto (Matz), the creator of Ruby programming language.

Matz getting Free Software Award
Matz and Stallman

Matz got the award for the advancement of Free Software (by Richard Stallman (aka RMS, St. iGNUcius), founder of FSF) for his contribution to various GNU projects, Ruby (one of the coolest programming language (an scripting language like python), recently it has become much popular in web development due to Ruby on Rails framework) and other free softwares projects.

Know More about

The award for Project of social benefits => Luis for GNU Health

The award for project of social benefits is give to a project or team or the ideas of the free software movements which intentionally or significantly benefits human society in other aspects of life.

Fecon getting award from Stallman
Felcon and Stallman

This year, the award goes to GNU Health, a free software projects that works with health professionals around the world to improve the underprivileged. The president of GNU Solidario (the organization behind the GNU Health project) => Luis Falcon got the award by Richard Stallman for his great contribution to the society (through the free software project).

source : official announcement of 2011 Free Software Awards


gedit plugins for Ruby on Rails

gedit is the default and one of the most popular text/code editor in GNOME based distro such as Ubuntu, Debian, Fedora, Linux Mint etc. It has a lot of cool plugins to add some extra features, some are installed by default while some are available there in package repository, to activate just go to the preferences section and enable it; You don’t even need to restart the gedit application.

gedit is a simple, efficient, easy to use and powerful text editor, it has lot of advanced features that makes it really good for programming (if you’re more hungry for features, then you should try Emacs, although Emacs is little hard to learn but the extra productivity you will gain is incomparable, good for long run). But these features are not enough for a rails developers, so there is a PPA dedicated for rails developers (although it’s for Ubuntu but works well with any debian based distro).

Gedit with GMate Plugin : on Ubuntu 12.04

GMate – The missing Gedit Plugins for Rails Developers

GMate is a set of cool plugins that will add some nice features to gedit text editor – in order to increase the fun with Rails Development (e.g by default gedit can’t highlight the ruby code in .erb.html files but gmate will do it for you!). Since gmate is a PPA for Ubuntu 11.10/12.04/older_versions so it will not work only on Ubuntu but also on other Debian derivatives. If you’re using Fedora or Archlinux then it won’t work, you may have to install it individually, see top 10 gedit plugins for the list of cool plugins.

Install GMate in Ubuntu

sudo apt-add-repository ppa:ubuntu-on-rails/ppa
sudo apt-get update
sudo apt-get install gedit-gmate

You can enable/disable the plugins from Edit -> Preferences -> Plugins.

Recommended Reading(s)

Gedit Shortcuts – Gedit Cheat Sheet for beginner developers, it also contains Gmate shortcuts!

Learning Rails ?

Check out this interactive video course on Ruby on Rails at Treehouse.

ruby program using nano

Ruby Programming with Ubuntu 11.10

Ruby is one of the most popular scripting language. Ruby is an object oriented programming language, it’s open source, dynamic and cross-platform; it is well known for human friendly code. it has gained a lot of popularity (in past few years) in web world, probably due to the web application development framework – Ruby On Rails, that allow developers to build cool web applications very quickly. The same is true with Ubuntu (latest version 11.10 – Oneiric Ocelot) as it is now the most popular Linux distribution for desktop users.

Although this post isn’t going to teach Ruby but it will surely help you in getting started with Ruby, on Ubuntu 11.10 of course. Since Ruby is an interpreted language i.e source code itself is executed – line by line – by Interpreter. So first of all we need to install Ruby Interpreter.  The latest version of Ruby is 1.9.3 p0 (released on Oct 30, 2011), although 1.8.7 is also very popular as a number of applications are based on it.

If you want to quickly get started with Ruby then first install ruby 1.8.* or 1.9.* from command line or Ubuntu Software Center. Open a terminal (Ctrl+Alt+t) and execute –

sudo apt-get install ruby1.9.1

Then create a file ‘fun.rb’ and write a simple ruby program to test.

Creating a new file from terminal –

touch fun.rb

Then use a simple command line editor such as nano(or vim) or a gui gedit to put the code.

ruby program using nano

nano fun.rb
# This is a comment in Ruby!
puts "Enter something (Your Name or any number)"
some_thing = gets
puts "You said  #{some_thing}"

Then save the file (Ctrl+X => y => Enter, if you are using nano). Then you can execute the above ruby program (that simply get some input from the user and print it).


ruby fun.rb

Output :

Enter something (Your Name or any number)
just for Fun!
You said  just for Fun!

Recommended Link(s) for Learning Ruby/Ruby on Rails –

If you want to work with multiple versions of Ruby or wanna go ahead with Ruby and its libraries (called as RubyGems)or frameworks such as Ruby on Rails then you are recommended to use RVM (Ruby Version Manager) instead of installing ruby from Ubuntu Package Repository. I’ve already explained about RVM, Rails etc in detail (along with their dependencies) – install ‘Ruby on Rails’ in Ubuntu.

checkout some free Ruby tutorials!

How to install Ruby on Rails in Ubuntu 11.10

Ubuntu (The latest stable version : 11.10(Oneiric Ocelot), released few weeks ago) is one of the most Linux based popular operating system and gradually becoming more popular among programmers and web developers. C/C++/Java programmers and web developers are rocking with the Ubuntu as it has a bunch of open source development tools available to increase the productivity at minimum or zero cost.

Ruby on Rails is one of the most popular framework for developing web applications using Agile approach. Rails (Latest version : 3.1) is based MVC (Model View Framework). Getting started with Rails has been little messy (On Linux platform) for beginners due to its installation/setup errors, probably due to some missing dependencies (e.g gems).Relax, it’s very simple, you just need to understand few basic things. This post has been written for those who want to get started with ‘Ruby On Rails'(commonly called as ROR) on Ubuntu 11.10 or the rails developers who want to develop cool application with Ubuntu 11.10.

To install ruby on rails in Ubuntu 11.10 (or other similar Linux distribution such as Linux Mint, Debian etc), just follow these simple steps. Although RVM is not strictly necessary but it’s strongly recommended – it will allow you to use multiple versions of Ruby, which may be be required in some cases.

step 1. Install dependencies

Install git : Git is the most popular (as well as fast and efficient; Linux kernel uses it; developed by Linux Torwalds, the same guy who developed Linux kernel) open source version control system. You can install it in one simple command to install it from the official package repository –

sudo apt-get install git

[You could also install git from the source (Download the source code, extract it and execute make && sudo make install) ]

Install Curl : Curl is a command line tool to get a file from FTP/HTTP/HTTPS server. To install, open terminal and execute the command –

sudo apt-get install curl

step 2. Install RVM (Ruby Version Manager)

Open terminal and execute the command (I assume you’ve already completed the step 1, otherwise first do that) –

bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)

Now, you might have to edit the bashrc file to load RVM in shell session. To do that type –

gedit ~/.bashrc

and add the following line to the end (and save the file)
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
Then reload the shell session using the command –

source ~/.bashrc

Now you can test whether the RVM has been installed successfully or not. Open terminal and execute the command –

type rvm | head -1

After executing above command you should be getting this output –
rvm is a function
That’s All.. You’ve successfully installed the RVM. Next, you are supposed to install few additional dependencies. To find out those programs type –

rvm requirements

After executing the above command, install the additional packages recommended by RVM –
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion

step 3. Install Ruby

Now, it’s time to install the ruby version you want (you’re recommended to use either 1.8.7 or 1.9.2). The generic syntax is rvm use version_name. It will also install the associated packages such as RubyGems and Bundler.

rvm install 1.9.2

Then select the version, you want to use –

rvm use 1.9.2

If you aren’t sure about the ruby version currently being used, then type –

ruby -v

step 4. install Rails

Finally, you can install the rails gem using a simple command –

gem install rails

That’s All.
Now, create a sample application (just for testing) using Ruby on Rails.

rails new my_app
cd my_app
bundle install
rails server

Then open your browser and type the following address (to see the application running) –

Learning Rails ?

Check out this interactive video course on Ruby on Rails at Treehouse.

Recommended Books/Tutorials for Beginners

Update 1. Fixed some typo in commands! and adds a link in resources!

Update 2. My Rails Application : Railyo – a private job board for rails developers/freelancers.