Installing Eclipse on Ubuntu

An easy way to install Eclipse on Ubuntu is through the Ubuntu repositories. This can be done by opening up the “Ubuntu Software Center” under Applications. Click on Developer Tools -> IDEs. Then look for Eclipse from the list of IDEs that shows up. If you click on Install, you will be asked to enter your user password then it will automatically install Eclipse for you. It should be pretty straight forward here. After installation is complete, you can start Eclipse in Applications -> Programming -> Eclipse.

Another way is to install it manually by downloading the Eclipse files from http://www.eclipse.org/downloads/. You will need to install JRE or JDK first before you can run Eclipse. You can do this by typing this in the terminal.

sudo apt-get install sun-java6-jre

Extract the Eclipse files to the /opt directory so that other users can have access to it.

tar xzf eclipse-SDK-3.5.2-linux-gtk.tar.gz
sudo mv eclipse /opt/eclipse

Then create an eclipse executable in your path.

sudo touch /usr/bin/eclipse
sudo chmod 755 /usr/bin/eclipse
sudo gedit /usr/bin/eclipse

Then type in the followings and save.

#!/bin/sh
#export MOZILLA_FIVE_HOME=”/usr/lib/mozilla/”
export ECLIPSE_HOME=”/opt/eclipse”
$ECLIPSE_HOME/eclipse $*

Then create a gnome menu item.

sudo gedit /usr/share/applications/eclipse.desktop

Enter the following and save.

[Desktop Entry]
Encoding=UTF-8
Name=Eclipse
Comment=Eclipse IDE
Exec=eclipse
Icon=/opt/eclipse/icon.xpm
Terminal=false
Type=Application
Categories=GNOME;Application;Development;
StartupNotify=true

Now you can run Eclipse from Applications -> Programming -> Eclipse. You can also install different Eclipse packages for example the Eclipse + PDT package by using the manual way of installing.

Using Glade for UI development on Gnome

On my post about network traffic monitor project, I said that I will share some details on it here. Well here it is. My application works on a GNOME desktop environment which is the default Ubuntu desktop. Now there are two ways to go about creating GUI application on GNOME. The hard way would be to hardcode the UI from scratch using the GTK libraries or the easier way would be using a tool like Glade that helps to generate the codes for you. Glade is an open source RAD tool.

I used Glade for my project as it is so much easier to use than hardcoding each widget like windows and text boxes. It also saves a lot of time since it is much faster too. With glade you can add any widgets that the GTK library provides into a container. You can then configure the properties of that widget for example the title name, the width and length etc. When saving the project, Glade will create an glade file which is in fact a XML file that describes all the widget and its properties so that you can use it on your application.

The Glade file can be loaded by applications dynamically by using GtkBuilder GTK object. GtkBuilder adds connection between widgets and the application source code. By using GtkBuilder, Glade XML files can be used in numerous programming languages including C, C++, C#, Vala, Java, Perl, Python,and others. Below is the code snippet to add the Glade file using python.

builder = gtk.Builder()
builder.add_from_file(“filename.glade”)

builder will be used as a reference to the Glade file that is added as filename.glade. To interact with a widget on the Glade file you need to reference it first for example:

window = builder.get_object(“main_window”)
combo = builder.get_object(“combobox_interface”)

window is now referencing the widget named “main_window” that is defined in Glade. combo is referencing “combobox_interface” widget. Once you successfully reference the widget, you can interact with them for example connecting signals to it. A signal is used to tell the application that an event has occurred. Examples of events are user clicking a button or resizing the window. Since my application is GUI based, it needs to be event-driven so that it will react whenever a user interacts with it. The codes below is an example of how to connect signals.

window.connect(“delete-event”, destroy_window)
window.connect(“response”, destroy_window)

In the codes above, I’ve connected the “delete-event” and “response” signal to the window widget. The “delete-event” signal will be emitted when the window is closed for example the user clicked to the ‘X’ button on the window. destroy_window is a callback function which is called when the signals are emitted. Callback functions are used to execute codes in response to the events.

Glade can be a pretty neat tool if you ask me especially for developers that uses RAD methodology. You can change the interface easily without changing much of the codes. You can also see the changes nearly instantly after editing the design.

I will post other information of my project soon.

IDE headaches

Since I started using Ubuntu, I still have problems finding the right IDE to use for my programming needs. I went through a few like eclipse, netbeans, komodo edit, gedit + plugins and now geany. Eclipse and netbeans are nice but they are quite heavy. I prefer IDE that runs fast so I don’t have to wait 15 seconds for an IDE to start. Komodo Edit is lighter and served me well for my python project I was doing last year. Recently I tried gedit with configurations to work well for php. Yeah, gedit is the main text editor for Ubuntu but it can be used for programming with a little tweak. But the thing I don’t like about it is the lack of code folding. Now I’m trying out geany, which is in the repositories for Ubuntu. Geany is also light weight and has most IDE functions like:
# Syntax highlighting
# Code folding
# Symbol name auto-completion
# Construct completion/snippets
# Auto-closing of XML and HTML tags
# Call tips
# Many supported filetypes including C, Java, PHP, HTML, Python, Perl, Pascal (full list)
# Symbol lists
# Code navigation
# Build system to compile and execute your code
# Simple project management
# Plugin interface (see Plugins)

So lets see how long Geany will last.

VLC in 2 separate windows

A few days back I had VLC player version 0.9 on my Ubuntu OS. One thing I didn’t like about it is that it had 2 separate windows which is the video output and the control window. I have VLC on my XP and both of these windows are integrated as one where the video output is placed at the top and the controls at the bottom. It was quite frustrating to keep looking for the control window to navigate through a video I was watching on the VLC player.

So I googled a bit and found that VLC version 0.9 had a problem working on one window on the GNOME desktop. The users can however change the settings so that it would work on one window but the player seems crash most of the time if done so.

So the best solution I found was to upgrade the VLC player to 1.0 RC which is not in the Ubuntu repositories yet. I had to add the repositories myself. Below are the repositories:

deb http://ppa.launchpad.net/kow/ppa/ubuntu jaunty main
deb-src http://ppa.launchpad.net/kow/ppa/ubuntu jaunty main

The repositories needs to be added though the software sources (System > Administration > Software Sources), thanks to Andrew

Network traffic monitor for Ubuntu

I am currently working on my Python project as a requirement of my final year project. The project is a small application that works on the panel applet of the Ubuntu OS. It monitors network traffic by different application layer protocols for example http, ftp, smtp and telnet and displays any network activity for that particular protocol in a graphical view.

I have always wanted to build an application with Python since its widely used in open source operating systems. This will give me an opportunity to work in an open source environment. Python by the way is an open source programming language.

I am a big fan of the Ubuntu operating system ever since I installed it on my computer for the first time in 2007. My first Ubuntu distribution was 7.04: Feisty Fawn and I was captivated by its beauty and it opened my eyes to the world of open source. And that is the reason why I wanted to work in an open source environment.

My project is still in its initial stages and I hope that the prototype will be up and running somewhere around August this year. Will be submitting my project on sourceforge.net so that I could get some feedbacks from the community. Well, I hope that this project will go well as planed.

My Ubuntu experience

I have installed Linux: Ubuntu a month back on my laptop and to my astonishment, the open source operating system is astounding. It is something I have been wanting to do for the past decade but never had the guts to do so. I am a person who is constantly haunted by the hunger to try something new which most of the time ends up in a terrible disaster. I get bored easily and that is why I always need to seek something fresh to fulfill my satisfaction. So I got confident enough to take it one step further into the typical dual-boot setup.

Installing Linux on my system was a breeze. I’ve downloaded the Ubuntu 7.04 Feisty Fawn ISO file and burned it on a CD. It took around 40 minutes for Ubuntu to be fully installed but I am guessing that it would take even less if it was installed on a faster computer. Ubuntu 7.04 starts up with a login screen which I am required to insert my username and password. After getting through the login screen, I am presented with the GNOME desktop environment. GNOME is the graphical user interface which sits on top of a computer operating system. Most of Linux distribution are based on the GNOME.

The user interface is pretty similar to the one of Window’s, not that I know of any other operating systems other than Windows. Like Microsoft Windows, GNOME also have horizontal menu bars. But instead of just one horizontal bar at the bottom, GNOME has two. One at the top and one at the bottom of the desktop. The top menu bar shows the different application and function that you can interact with just like Microsoft Windows Start button. The date and time is also displayed on the top right menu bar. The bottom menu bar shows currently active programs which when clicked will maximize onto the desktop. The trash can is also displayed on the bottom right corner of the menu bar. I find It rather easy to navigate through the applications from the menu.

Although at first I had some difficulties with connecting to the internet, I still managed to solve the problem with a little bit of googling and configuring. I even managed to install the latest driver for my ATI graphic card by using Envy. Envy is an application that detects the model of your graphic card (only ATI and Nvidia cards are supported) and install the appropriate driver. After successfully installing the driver, I am able to add extra visual effects to my working environment using Compiz Fusion. The extra visual effects gives a wobble effect to windows when they are dragged. A really slick effect for a desktop environment I would say. I can actually have more effects on Ubuntu desktop by installing the Advance Desktop Effect such as the Desktop Cube, Viewport Switcher, ADD Helper and Motion Blur.

To play my mp3s I need to use the Rhythmbox Music Player. I had to install the appropriate codex package first so that I can play most of the common music formats. With the default installation of Ubuntu, I would not be able to play music with .mp3 file extension or play movies with .avi file extension because they are restricted formats. So I need to install the w32codecs package to play them.

Updating Ubuntu is also very easy as I can do it over the network. All I need to do is go to Systems -> Administration -> Update Manager and click install update. I can also Upgrade to the latest version of Ubuntu. For example I want to upgrade my Ubuntu 7.04 Feisty Fawn to Ubuntu 7.10 Gutsy Gibbon. All of that can be done in Update Manager.

Ubuntu is a new experience for me but I am starting to love every part of it. For a Ubuntu beginner, I would say that I am very pleased with it. Very easy installation and updates and user friendly. And the best part of all Ubuntu is FREE.