Category Archives: Ubuntu 12.04

Ruby 2.0 is out!

How to execute/run Ruby program/script on Ubuntu [12.04/12.10]

Ruby is one of the most popular programming language, it’s a scripting language – like Perl, Python or PHP. Ruby is very easy to learn, it’s also very Human Friendly – so for beginners – it’s a good one to begin with. Ruby has become very popular, mostly in web development, with the Rails framework (most popular and easy to learn web application development framework for ruby).

If you want to learn ruby or may be just started, with Ubuntu (most probably – 12.04 LTS, if you prefer latest stable release), then this post may help you in setting up the ruby environment (on Ubuntu/Linux Mint/other_similar_distributions) and running your first ruby program; you should also checkout the recommended links section for some best free online tutorials (for ruby).

Install Ruby : Getting Ready for Fun

You can install ruby from the system package – using the apt-get or from Synaptic Package Manager but you’re recommended to use RVM (Ruby Version Manager) for installing ruby( instead of  apt-get install ruby1.9.1). RVM is a great tool that allows you to manage multiple versions of ruby – without any hassle, so the rvm way may seems unnecessary at this point but it’s better in long run.

I’ve already explained about installing ruby on Ubuntu/Linux Mint and I’m not going to repeat that again, Just go through this link – installing ruby on rails in Ubuntu 12.04 and follow the steps 1-3 (leave the 4th step because you just want the ruby right now).

Write your first Ruby program

Open the gedit and write the following lines of code

#! /usr/bin/env ruby
puts "Hello, Ruby"
# it just prints Hello, Ruby on the screen (comment)

Now, save the file as hello_world.rb (Ruby source code has the extension .rb ) in your Home directory (~).

Run/Execute Your first ruby program

Open a terminal and type the commands –

cd ~
chmod +x hello_world.rb
ruby hello_world.rb

This video might give you some additional hints if you need.

Recommended Link(s) for Learning Ruby (Free Online Resources)

Learning Rails ?

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

compiling-executing-c-program

How to Compile ‘n’ Execute/Run C/C++ program in Ubuntu 12.04

Now a Days, Ubuntu is one of the most popular OS among programmers (not only nerds but also the beginners who just entered into the programming world) but for a beginner Ubuntu user coming from Windows may feel some problem in programming with Ubuntu.

On Windows they use nice GUI based IDE, but in Ubuntu things are little different. In Ubuntu it’s better to use Terminal (specially for the beginners), instead of GUI based IDEs such as Eclipse, Netbeans etc for compiling programs. In fact, the command line approach is much easier and efficient, due to the powerful shell such as bash, zsh etc.

So, in this post – you will learn – how to compile and execute (run) C/C++ programs in Ubuntu 12.04 (Precise Pangolin)/12.10(Quantal Quetzal) or other Linux distributions such as Linux Mint 13 (Maya). You don’t need to install any extra applications or tools other than the compiler. The default text editor – gedit will work fine for source code editing (unless you have a preferred source editor such as Emacs, Vim, Nano, Kate or something else).

#1. Install the C/C++ Compiler

First make sure that you have GCC (GNU Compiler Collection, for C language) and G++ (for C++ language) installed on your system. If not, then install it by typing the following commands on Terminal –

For C

sudo apt-get install gcc

For C++

sudo apt-get install g++

#2. Write the Program (Source Code)

Open gedit and write the following lines of code (it’s a simple program that contains one print line and one comment, just for explanation purpose) –

#include<stdio.h>

void main()
{
	printf("Hello! Human!\n");
	/* Do something more if you want */
}

Then save the file as hello_human.c on your Home Directory (~). If you ae writing a c++ program, then give it the extension as .cpp (and of course you will also have to change the command accordingly during compilation)

#3. Compile it

The command structure is :

gcc source_file_name.c -o executable_file_name

if leave the -o option (name of the output file) then by default a.out will be created as the executable output file.

To execute the above example program, open a terminal and type –

cd ~
gcc hello_human.c -o hello_human

[In case of C++, just replace gcc with g++, rest of the things are same, e.g g++ source_file.cpp -o executable_file]

#4. Execute It

On Terminal, type (from the same directory where you have the executable file, in this case, it’s Home Directory(~) ) –

First make the script executable (sometimes, it may not be necessary)

chmod +x hello_human

Then run the program using the command –

./hello_human

Now you should get the output –

Hello! Human!
expo effect in cinnamon

How to Install Cinnamon Desktop on Ubuntu 12.04

Cinnamon is a new Desktop, based on Gnome shell. It looks pretty cool and comes by default in Linux Mint 13 (maya) – Cinnamon edition. Cinnamon is recommended for specially the users who are not happy with Unity, the default desktop environment in Ubuntu 12.04 (Precise Pangolin) LTS, or the new version of GNOME – The GNOME Shell.

Although, Cinnamon is based on Gnome Shell, it’s easy to use and most importantly, it follows the conventional Desktop layout. So you can feel efficient with cinnamon in no time. It also has some nice suite of tools such as Cinnamon Settings that makes customization a lot easier for beginner users. Workspace management in Cinnamon is really great, with the nice expo effect.

cinnamon on ubuntu 12.04

For Ubuntu 12.04 Users, there are lot of desktop environment they can try but Cinnamon is probably the best option (at least for me, I love Cinnamon), even if you like Unity or Gnome Shell or KDE,  you must give Cinnamon a try – just for fun :)

Installing Cinnamon Desktop Environment in Ubuntu 12.04/11.10

Cinnamon 1.4 is the latest stable version available for Ubuntu 12.04, so first add the PPA, then update the repository and install it. Just open a terminal and execute the command(s) –

sudo add-apt-repository ppa:gwendal-lebihan-dev/cinnamon-stable
sudo apt-get update
sudo apt-get install cinnamon

Expo View of Workspace (Ctrl+Alt+Up or move the mouse to hot corner(top-left))

expo effect in cinnamon

Cinnamon Desktop : with fully customizable panels/applets

cinnamon-desktop-ubuntu

Have Fun with the Cool Desktop :)

docky

What is Your Favorite Dock in Ubuntu 12.04 ?

There are lot of Dock Apps available for GNU/Linux distributions such as Ubuntu, Linux Mint 13. Some of the most popular dock Apps are – GLX-Dock (Cairo Dock with OpenGL), Docky and AWN (Avant Window Navigator).

Dock App is not just an eye candy app, it also makes lot of things much easier (such as multiple window/app management, easy shortcuts for complex and repetitive tasks etc). If you have tried these apps then consider sharing your favorite one.

Dock – it’s a Dock – that just works! It’s the most simple, elegant, and fast dock apps out there in Ubuntu Software Center.

Cairo Dock (GLX) – it’s the most advanced dock, with lots of cool features (plugins, themes, etc), and it also uses OpenGL for nice graphics animations/effects.

AWN – It’s a Mac OS X like Dock app for Ubuntu (or other Linux distro). So, it looks cool and it also has some nice features and graphics effects.

So,

What’s Your Favorite Dock Application in Ubuntu /Linux Mint/other_Linux_distro ?

 


app-menu in cairo Dock

“COOL” Dock Applications for Ubuntu 12.04

Dock  is Cool, specially if you don’t like the default panel in your desktop (or if you just want an eye candy desktop).

In Ubuntu 12.04 (Precise Pangolin), a lot of users complained about the Unity Desktop (which is the default one) –  the loss of productivity due to sudden changes, ease of use etc. In that case, you may try some other desktop or try using Dock as a substitute for panel. It looks beautiful – and of course it would be more easy to start/find apps and manage windows using this dock app.

Best Dock Apps for Ubuntu 12.04 LTS

1. GLX Dock (Cairo Dock + OpenGL)

GLX Dock

GLX-Dock  is nothing but the Cairo Dock, mixed with some other plugins and components so that it can use your computer’s graphics capabilities in better way (hardware acceleration). Cairo Dock is a light-weight, simple and easy to use dock application.

It has lot of cool features – taskbars, launchers, shortcuts, GNOME 2 style application menu, plugins (to extend the default features), workspace switcher, themes etc. You can easily customize cairo dock – the look, animation, effects, features, shortcuts, applet/plugins and default apps for Music, Mail, Chat etc.

Gnome 2 style App Menu

app-menu in cairo Dock

 

Shortcuts in Cairo Dock

glx-shortcuts

Install Cairo Dock/GLX-Dock in Ubuntu 12.04
It’s there in Software Center – so just search there and install in few clicks or use terminal –

sudo apt-get install cairo-dock

 Customizing Cairo Dock with Cairo Configuration Manager

applets-in-cairo

For advanced customization, go to  Help -> Cairo Dock -> Configure. Then a Cairo Dock Configuration Window will appear (above snapshot) – where you can customize everything such as Appearance, Add-ons and Keyboard Shortcuts.

Don’t forget to checkout the Add-On section – it contains a lot of useful and funny applets. Some of the most useful plug-ins are – Clipboard History, Drop to Share, Messaging Menu, RSS Reader, Switcher, Slider, Stack, Power Manager etc. Just select the plug-ins you want to try and click Apply to get the immediate effect.

2. Docky – A Dock that just works!

Docky is another elegant, cool and powerful Dock application. It’s very fast and easy to use. By default, it looks very simple – in 2D mode but you can enable 3D mode from settings to make it more cooler.

docky

Docky doesn’t uses OpenGL but it works out of box, in GNOME Desktop environment (without any unnecessary configurations). So if you want a Dock that just works – then Docky is best for you.

Install Docky in Ubuntu 12.04 LTS

sudo apt-get install docky