Tuesday, January 25, 2011

Virtualization with VirtualBox


VirtualBox is an open source software virtualization system. For those not really familiarized with virtualization technologies I will say that basically it is a program that allows you to run an operative system inside another operative system.

For instance you could run a Windows XP inside our brand new Ubuntu 10.04 (See fig.1). Of course you may wonder why the hell would you even want to have a Windows XP running in your computer, but this is a complete different history.

Fig.1 Windows XP running inside Ubuntu 10.04

In today's domestic world there are plenty of professional applications like Oracle that could be interesting to have and install but that it takes a lot of resources from the machine, here we can find a good usage of a virtual machine. You can create your virtual machine, install Oracle and have it ready to be used whenever you need it.

In professional world virtualized environment are really in trend. You can find a lot of different architectures (Several virtual machines running in the same computer at the same time working as a replication of a real distributed system, the same architecture serving as Testing environment in the different testing phases, virtualized platforms as development environment, integration environment etc).

Maybe the most famous commercial tool for virtualization is VMware, VirtualBox as far as I tested offers almost the same but for free. Here you can find an interesting comparative done by a blogger.

A. Installing VirtualBox

VirtualBox is included in the Ubuntu repository so you just need to open Synaptic (System --> Administration --> Synaptic Package Manager) and look for virtualbox-ose package. Once installed you can find it under Applications --> Accessories

B. Creating New Virtual Machine

VirtualBox is provided with a quite intuitive graphical interface, to create a new Virtual Machine just click on the wheel at the top left of the interface.
A wizard will (See fig.2) guide you all over the installation, asking you for the name and type of the virtual machine, the amount of ram that you want to dedicate for it and if you want to create a new Virtual hard disk or use an existing one.

Fig.2 New virtual machine wizard

If you want to create a new Virtual hard disk I highly recommend you to select the "Dinamically expanding storage" so the file in your computer associated to this Virtual hard disk will grow as far as you store information inside the virtual machine.


C. Configuring a Virtual Machine
If you want to access to your virtual machine in a easy way from your main Operative System (Host operative system) you need to configure the virtual machine network as a bridged adapter. To do so, select you virtual machine (Ensure that is powered off because otherwise you will not be able to modify any parameter) click on network and set it up as in Fig.3



Fig.3 Configuring the Network


D. Troubleshooting

If you retrieve an error like "  * modprobe vboxnetflt failed. Please use 'dmesg' to find out why [fail]" when you try to run the virtual machine with a bridged connection, try to remove the package virtualbox-ose-guest-dkms. You can find a better explanation for this issue here.



Monday, January 24, 2011

C Development Tools

C Development Tools

Life changed for C and C++ Developers with the arrival of CDT for Eclipse. Eclipse is one of the most famous IDEs (Integrated development environments) based in plugin approach architecture allowing to program in different technologies and languages under the same graphical framework.

CDT is an open source plugin that enhance Eclipse with the needed features to develop in C and C++ both large and small projects. It brings all the typical characteristics of an IDE (Syntax highlighting, Code completion etc) and it can be of course combined with other external tools like control version systems (CVS, SVN etc).

A. Installing Eclipse.

You have basically two ways to install Eclipse:

The classical one (Synaptic → Eclipse) and

Directly downloading from Eclipse download page (Eclipse for C/C++ Developers).

If you choose the second option, you can download the version that includes CDT from the Eclipse download page (See Fig.1) and therefore you can avoid the “Installing CDT” step, but if you are planning on download a whole Eclipse for each feature that you need you will probably waste a lot of space in your hard disk. Therefore I recommend you to choose the first option.

Fig.1 Eclipse download page

B. Installing CDT.

If you choose the first option, you need to follow a couple of extra steps to install an run CDT:

1. Go to the download main page of the CDT Project and log the repository version that you need. In my case I am going to install it on a Eclipse Galileo (Is the one that is installed by default in Ubuntu 10.04) so my repository is http://download.eclipse.org/tools/cdt/releases/galileo

2. Open Eclipse and click on Help –> Install New Software. A new windows is opened, just paste the repository address in the first text box (See fig.2) and wait until the CDT Installation packages appears.

Fig.2 Adding CDT to Eclipse

3. Select both installation packages (CDT Main Features and CDT Optional Features) and click Next. Leave the next screens as it appears and if you do not receive any error message it means that CDT is now installed and integrated in your Eclipse.

Sunday, December 12, 2010

Configuring Ubuntu on my new HP G62-a55SF

As usual, after the Operative System installation, there are some drivers to configure and some programs and features to install.


Comparing to previous releases of Ubuntu an impressive progress has been done on the version 10.04, all the hardware (except the sound card) was recognized after the installation and I only added some plugging to create a better feel-looking.


A. Installing the sound card

To make our sound card works we need to upgrade the Alsa driver from 1.0.21 to 1.0.23 (you can check your current version with the command cat /proc/asound/version)

You can find below the set of commands that you need to enter in order to perform the mentioned update (This tutorial is inspired in the following blog: http://monespaceperso.org/blog-en/2010/05/02/upgrade-alsa-1-0-23-on-ubuntu-lucid-lynx-10-04/):


1. Stop the current Alsa service:

sudo /sbin/alsa-utils stop


2. Install the needed tools to compile and run the further binary packages

sudo apt-get -y install build-essential ncurses-dev gettext xmlto libasound2-dev
sudo apt-get -y install linux-headers-`uname -r` libncursesw5-dev



3. Download the source code of the last Alsa version

cd ~
rm -rf ~/alsa* ~/.pulse*
wget ftp://ftp.alsa-project.org/pub/driver/alsa-driver-1.0.23.tar.bz2
wget ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.23.tar.bz2
wget ftp://ftp.alsa-project.org/pub/utils/alsa-utils-1.0.23.tar.bz2



4. Create a new folder for the compilation and installation of the previous files

sudo rm -rf /usr/src/alsa
sudo mkdir -p /usr/src/alsa
cd /usr/src/alsa
sudo cp ~/alsa* .


5. Unpack the .tar files

sudo tar xjf alsa-driver*
sudo tar xjf alsa-lib*
sudo tar xjf alsa-utils*



6. Compile and install alsa-driver

cd alsa-driver*
sudo ./configure
sudo make
sudo make install


7. Compile and install alsa-lib

cd ../alsa-lib*
sudo ./configure
sudo make
sudo make install


8. Compile and install alsa-utils

cd ../alsa-utils*
sudo ./configure
sudo make
sudo make install


9. Remove the 3 tar files in our personal folder

rm -f ~/alsa-driver*
rm -f ~/alsa-lib*
rm -f ~/alsa-utils*


10. Reboot your computer


B. Installing the printer Drivers


A good work has been done regarding the integration of HP printers in Ubuntu. If you are lucky and decided to bought a HP Deskjet F4500 Series, the only thing you need to install are the following packages:

hplip
hplip-gui


To do that I highly recommend to use the Synaptic Package Manager. (This tutorial is based on the following blog: http://www.issux.com/2010/06/27/configurar-impresora-hp-en-ubuntu/ )

After installation you can access to the HPLIP Toolbox (System → Preferences → HPLIP Toolbox) and add a new printer, following the detailed steps (See Fig.1)

Fig.1 Adding a new printer from HPLIP Toolbox


C. Installing Cairo Dock

Cairo dock is a Apple-like-dock available for Ubuntu. The only thing you need to do is to download and install the following packages:

cairo-dock
cairo-dock-plug-ins


After installation you can run it from Applications → Accessories → GLX-Dock (This one with OpenGL enabled is much more funny)


D. Installing Compiz

By installing the whole Compiz package you will be able to enjoy a lot of desktop graphic effects like 3D cube and much more. To do that you only need to install the following packages:

compizconfig-settings-manager
compiz-fusion-plugins-extra


After doing that you can access to the Compiz configuration manager (System → Preferences → CompizConfig Settings Manager) and include the effects wished (You can enable the 3D Cube under the “Desktop” tab).


APENDIX
Here I will leave some useful and tested links if you want to install and configure Debian (Squeeze) on the machine:

*****Wireless*****
http://wiki.debian.org/wl
647970686F676862616E6E6174

*****Sound Card*****
http://www.esdebian.org/wiki/intel-corporation-5-series3400-series-chipset-high-definition-audio-rev-05

*****Touch Pad*****
Config on System/Preferences/Mouse

*****HDMI*****
https://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture#Using_udev_to_automatically_turn_HDMI_audio_on_or_off

aplay -l

/etc/alsa/hdmi-switch

*****Chrome*****
dpkg -i google google-chrome-stable_current_i386.deb
cp /opt/google/chrome/google-chrome.desktop /usr/share/applications

In case you installed Debian mint and you want to activate both cores:
sudo cat /proc/cpuinfo
sudo aptitude install linux-image-686-pae linux-headers-686-pae


Wednesday, December 8, 2010

Installing Ubuntu on my new HP G62-a55SF


I recently bought a new laptop (see Fig.1) and of course, the first thing I did when I just arrived home was to format it and install a Ubuntu. I tried to perform this process even before to run Windows 7 for the first time but unfortunately it was not possible. Why? Because HP G62 series has an incompatibility with the Linux power administration, making the installation fails (black screen) even before the first welcome screen.

Fig.1 My new laptop

Because of that, in order to discard possible manufacture defects, I needed to run the pre-installed Windows OS and check that the laptop was ok.

To avoid the mentioned problem we need to install our Linux distribution with the option “ACPI=off” checked. But... If the installation fails even before of the first welcome screen, How could we mark this option?

Well, that is exactly what this post aims to explain so let's go!!

A. Prerequisites

An Ubuntu Distribution. With 4Gb RAM and a microprocessor I choose Ubuntu 10.04 LTS and 64-bit you can find the latest versions here: http://www.ubuntu.com/desktop/get-ubuntu/download

B. Proccess

    1. Run your computer with the bootable Linux distribution inserted on the CD/USB

    2. Press F6 several times until the following screen appears (Fig.2):

      Fig.2 Screen After F6

    3. Press ESC, It will bring you to the main screen (Fig.3):

       Fig.3 Screen After ESC


    4. Press F6 and the “Other Options” combo will expand. Then press ENTER over the “acpi=off” line. The result should looks like this (Fig.4):

      Fig.4 Check acpi=off

    5. Finally press ESC (main screen) and select “Install Ubuntu”. An interactive, guided, and extremely intuitive process will guide you over the Installation.

Tuesday, December 7, 2010

Hello World!!

Hi everybody,

Today at work I have been trying to develop a little application with the idea of generating a simple xml including a set of data retrieved from from an Oracle data base.

For someone with some knowledge on computer science it could look like not a big deal.

I have been developing for almost five years on C# and recently I decided to move into a Linux/C++ development team in my new company (the last year I've worked as a “Product Definition”).

Linux and C++ is another world, that is a fact, but feeling like a complete newcomer after a wide programming experience is something difficult to explain (I spent almost a whole journey to develop the above application).

Through this blog, I will try to share my experience, avoiding people in my same situation to suffer as I am (understanding suffering as a positive way to grow) and, on the top of everything by creating a source of useful knowledge for anybody interested on have a contact with Linux and C++ world.

I will not only limit the content of my blog to C++, If I have an interesting experience with other technology or environment (Python, Eclipse CDT, Virtualization, Project Management, Java, etc) of course it will be included.