Open Chinstrap

May 3, 2008

Setting up Anjuta on Ubuntu

Filed under: Linux, Programming, Ubuntu — t-roy @ 8:22 pm

A couple of weeks ago I tried a new IDE called Anjuta. I usually use Eclipse which is a great IDE but I wanted a lightweight IDE for writing Perl scripts and learning how to use C++. Using Anjuta for writing perl scripts was straightforward but getting it to work for C++ development was more involved.

First of all you need to add in the following plugins that come with Anjuta. Select Settings>Plugins . Now select the following plugins:

  • Terminal
  • Tools (External Programs)

You will probably have to install g++ compiler. The first time I tried to compile a C++ I discovered that it was not installed on my copy of (Gutsy) Ubuntu. To set up the g++ compiler you need to install the build-essential package. Use the following command to this:

$ sudo aptitude install build-essential

I tried using the Synaptic Package Manager and then apt-get to install the build-essential package but the install failed due to some dependency issues. The aptitude program handled the dependency issue. Next I used the Tools plugin to execute an external command to compile my c++ programs. Select Tools>Configure from the menu:

Add User Tool

 

 

 

 

 

 

 

Click Add:

C++ Compiler Tool

 

 

 

 

In the above example I create an external tool that calls g++ to compile the current source file that I am working on in Anjuta. It saves the executable as the filename without any extension. In the configuration I also setup a Shortcut key for the tool (Ctrl + 1). Setting up my own external tools was more effective than using the Automake build plugin that comes with Anjuta. You can call a simple program or develop you own scripts for more complicated processes.

Troy

April 12, 2008

Installing Google App Engine SDK on Linux

Filed under: Linux, Ubuntu, Web Development — t-roy @ 10:24 am

You will need to have python 2.5 installed on your system but most distros of Linux already have python installed (just verify what version it is) . First download the the SDK from here. Save the zip file to your home directory in my case I saved it to:

/home/scottt

Now you can unzip the file in the home directroy:

$ unzip google_appengine.zip

Go to the google_appengine directory:

$ cd google_appengine

To test out the installation you can start the dev server and run the simple guestbook application that comes with the SDK:

$ ./dev_appserver.py demos/guestbook

By default the app server uses port 8080. You can access the guestbook application from your browser at:

http://localhost:8080

If you are using a linux server with multiple developers you may need to specify a different port in order to run your application:

$ ./dev_appserver.py -p 8090 demos/guestbook

This time the application will run on port 8090. I you want to install google_appengine on Windows check out this post on my other blog .

Troy

April 11, 2008

Error Installing Perl Tk on Ubunutu

Filed under: Linux, Perl, Ubuntu — t-roy @ 11:26 pm

I received the following error installing Tk from CPAN:

CPAN reported “Problem gettimeofday()” which seems to indicate that I was missing some include files. I found the following post which recommended installing the libx11-dev packages which could include the required development header files:

http://www.perlmonks.org/index.pl?node_id=673577

I used the Synaptic Package manager to install libx11-dev. I then tried installing Tk again using CPAN:

$ sudo cpan -i Tk

The install progressed much further than it did the first time but it still ended up failing with the following error:

make[1]: *** [ClientWin.o] Error 1k …

I discovered a Ubuntu post related to this error that recommended installing TK using apt-get:

$ sudo apt-get -install TK

But when I went to install the package from the command line there was no package called TK. Finally I did a search for Tk using the Synaptic Package manager. I found a package called perk-tk and installed it.

 

 

 

 

Run the following “Hello World” test program from this TK User Guide:

#!/usr/bin/perl -w

use Tk;

use strict;

my $mw = MainWindow->new;
$mw->Label(-text => ‘Hello, world!’)->pack;
$mw->Button(
-text => ‘Quit’,
-command => sub { exit },
)->pack;
MainLoop;

Troy

April 10, 2008

How to Reset Video Settings using dpkg-reconfigure

Filed under: Linux, Ubuntu — t-roy @ 11:23 pm

Below is a link to a great HowTo article from the ubuntuforms:

http://ubuntuforums.org/showthread.php?t=83973&highlight=resolution

The other day I was try to use two monitors on my Dell Latitude D600 with a KVM switch. Athough the mouse and keyboard worked fine it changed my video settings of my laptop (primary monitor) and the secondary monitor didn’t work at all. However the real problem began when I tried to change the resolution back to its original configuration (1440 x 900) using the Screen and Graphics Application (System>Administration>Screen and Graphics). I could only get a resolution of 1280 x 1024.

I just walked through the following steps in the HowTo (see the HowTo for details):

  1. Backup the configuration file (xorg.conf)
  2. Stop the Xorg service for auto detection to work properly
  3. Perform the X Configuration using dbkg-reconfigure
  4. Start Xorg again

Troy

April 7, 2008

Configuring Eclipse EPIC on Ubuntu

Filed under: Apache, Linux, Perl, Ubuntu, Web Development — t-roy @ 7:14 pm

E-P-I-C is a good Perl plugin for Eclipse (Version: 3.3.2 Build id: M20080221-1800) . You can use EPIC to develop perl scripts and Perl CGI (Common Gateway Interface) scripts. To install the plugin you can use the update site located here:

http://e-p-i-c.sf.net/updates

Creating a Perl project is very straight forward: File>New>Perl Project

New Perl Project

 

 

 

I will focus on configuring a CGI script since the regular Perl scripts are fairly straight forward . First we need to create our script by right-clicking on the project folder and selecting New>Perl File:

New Perl File

 

 

 

Name the file test.cgi and copy and paste the following simple CGI script:

#! /usr/bin/perl

print “Content-type: text/plain \n\n”;
print “Hello World!\n”;
print “Script Name: $ENV{SCRIPT_NAME}”;

Save the file (CTRL-s) and now we are ready to set up the Perl CGI Configuration. But before we do that it is important to record the full path of the Perl Eclipse project and remember the name of the script you want to run. Eclipse usually creates a workspace directory in your home directory unless you specify otherwise. In my case my workspace is located in:

/home/scottt/workspace

Therefore my Perl project is located in:

/home/scottt/workspace/perlwebscripts/

And the path to my CGI script is:

/home/scottt/workspace/perlwebscripts/test.cgi

Now that we have this information we can configure our CGI script. Right-click on the project folder or any file in the project and select Run As>Open Run Dialog…. :

Perl CGI Configuration

 

 

 

 

In the Main tab you need to select the project folder name in my case it would be perlwebscripts. The Web Server tab (shown above) contains the following information:

  • HTML Root Directory: /home/scottt/workspace/perlwebscripts
  • HTML Startup File: /home/scottt/workspace/perlwebscripts/test.cgi
  • CGI Root Directory: /home/scottt/workspace/perlwebscripts

All paths are related to your Eclipse CGI project. The final thing to configure is the browser tab which is where the result of the CGI Script is displayed. I used the Firefox adapter. I was not able to get the Internal Perl Browser to work. The Firefox browser works fine but it is a bit of a pain to Alt-Tab between Eclipse and Firefox while you are developing. Hit apply once the configuration is finished and then you can click Run As. Here is a screenshot of the test.cgi script :

CGI Test Script

 

 

 

 

EPIC also provides a good user guide which you can download from here.

Troy

April 5, 2008

Installing Eclipse IDE on Ubuntu

Filed under: Linux, Ubuntu — t-roy @ 9:39 pm

98% of the time when you try to install something on Ubuntu it works very well either by using the Add/Remove Application (has a similar look and feel to the Windows Add/Remove control) or the Synaptic Package Manager.  But when I tried to install the Ubuntu version of Eclipse it didn’t go to well.

However, the Ubuntu documentation provides a good walk through on how to install Eclipse:

https://help.ubuntu.com/community/EclipseIDE

I ended up installing Eclipse  manually be referring to section 5 of the documentation (User Installation).

Troy

March 26, 2008

Installing perldoc on Ubuntu from the Command Line

Filed under: Linux, Perl, Ubuntu — t-roy @ 10:29 pm

perldoc is not installed in Unbuntu 7.10 or at least it is not completely installed.  When I typed:

$ perldoc

I recieved the following message:

You need to install the perl-doc package to run this program.

However, when I type whereis perldoc the system does return the path of the perldoc program.  To install the perldoc package from the command line type:

$ sudo apt-get install perl-doc

perldoc install

Now perldoc should work.

Troy

March 21, 2008

Video Problems with FireFox Plugins

Filed under: Firefox, Linux, Ubuntu — t-roy @ 5:40 pm

The first time I tried to viewing a video using Firefox 2.0.0.12 (on Unbuntu 7.10)I was prompted to install a plugin.  My choices were the Adobe Flash Player and Gnash .  I decided to use the Gnash Player.  Unfortunately I was then not able to play any videos.  The video control was blank.  I could right click on the video control and click play but nothing would happen.

I thought this would be simple enough to fix.  I would simply go into the fire fox addins and remove the gnash player.  The only way I could remove the Gnash player was to uninstall it using the Synaptic Package Manager.  You can find this by select System>Administration>Synaptic Package Manager.  Once you do this just do a search for gnash :

Search for Gnash in the Synaptic Package Manger

Then click on gnash-common package and select Mark for complete removal:

Remove Gnash

Now that Gnash is uninstalled you can open up FireFox and browse to a site that contains a video (e.g. You Tube) .  When you try to view the video you will be prompted to install a flash player.  Chose the Adobe Flash Player and wait for it to install.

Troy

Running Ubuntu on Dell D600

Filed under: Linux, Ubuntu — t-roy @ 6:46 am

I have been running Ubuntu 7.10 (Gutsy Gibbon) for just over 2 months on my Dell D600. The laptop has 1.5 GB of RAM, 1.6 GHz processor and uses a wireless network card. This is one of the few Linux distros where I had no problem connecting to my wireless network (at least a problem on my Dell). I simply downloaded the ISO from the Ubuntu site and burned it onto CD. The only issue I had was setting up printing. My printer is attached to a Windows XP machine so I needed to setup printing to a share.

I just connected to the local CUPS server (http://localhost:631) that installed with Ubunutu and added the printer from their. To add a shared printer first you need to share the printer on the Windows machine. In my case I named the share HPC4100 for my HP printer. I then used the CUPS Interface to set up the printer:

CUPS Setup

Make sure you enter the correct URI. For a windows share using Samba it looks like this:

smb://servername /sharename

In my case it was http://myserver/HPC4100

If the server name does not work you can also try entering the ip address for example: smb://192.168.1.100/HPC4100. However this will cause problems if your printer server’s IP is dynamically assigned. I also recommend printing a test page from cups to make sure it works. If you are prompted for authentication during the setup just enter your username and password or root and the root password.

Troy

Blog at WordPress.com.