Aug 24
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Premiership League LogoWhat happened to Football? Once a working man’s sport, most children dreamed of playing for their team - for the pure pleasure, and pride of playing for the team. Now? It’s all about the money - so much, that in order to watch your favourite Premiership or Champions League team live, you have to pay an extortionate amount to Rupert Murdoch for the privilege.

Champions League LogoWell, despite the fact that I don’t actually like football, I still believe that coverage of Premiership and UEFA Champions League football matches should be free for all to watch. Thankfully, there are ways to watch the matches for free - one is to install Sopcast, and access live Premiership matches, and live Champions League matches online:

Installing Sopcast

First, download Sopcast, from the Sopcast website, then extract the file, and copy the executable to /usr/bin:

cd ~/Desktop
wget http://download.sopcast.cn/download/sp-auth.tgz
tar -zxvf sp-auth.tgz
cd sp-auth
sudo cp sp-sc-auth /usr/bin/sp-sc

the sp-sc executable can be used from the command line, by running sp-sc <sop://url> <localport> <playerport> and openning up the resulting stream in mplayer/vlc, e.g.:

sp-sc sop://sop.sopcast.org:1234/5678 3908 8908 &
mplayer http://localhost:8908/tv.asf

but the CLI involves knowing the broker, channel number and so on. There is also GUI available (actually, 2 GUIs - GTK, and QT, but I’ve only managed to get the GTK GUI working so far), which does all this for you, and makes the process much easier. The GTK Gui can be set up as follows:

cd ~/Desktop
wget http://linuxtoy.org/files/deb/gtk-sopcast_0.2.8-1_i386.deb
sudo dpkg -i --force-architecture gtk-sopcast_0.2.8-1_i386.deb

32 Bit users can omit the –force-architecture option, since this is essentially just telling 64 Bit Ubuntu to shut up and use 32 Bit libraries.

Sopcast will only pull in the stream - a media player is required to actually view the stream. VLC, or mplayer both work - I currently use mplayer with the Sopcast GUI, without problems. gsopcast is actually set up to use mplayer by default, so if you don’t have it, it can be installed by running:

sudo apt-get install mplayer

Once the gsopcast GUI is installed, there should be a new menu item under Applications -> Sound & Video -> Sopcast TV Player. Alternatively, the GUI can be run from the terminal:

gsopcast

Once launched, the GUI will populate the channel list. Double click on the channel you wish to view, and wait for the buffer to reach 90%-100% before clicking the “player” button.

The best way to find out which channel is playing the Premiership, or Champions League match you want to watch is to scan this list and look for the channel playing the match.

References

  1. http://ubuntuforums.org/showthread.php?p=3972647
  2. http://www.myp2p.eu/competition.php?competitionid=&part=sports&discipline=football

Whatever happened to Division 1, Division 2, and so on, by the way? They’ve even had to make the name of the divisions sound financially appealing.


written by Hodge \\ tags:

Jun 16
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

I’ve been wanting to set up a virtual host, with mod_rewrite on my system for a while, so I could have a local copy of my blog with Permalinks, for playing around, and despite a few hiccups, have finally got round to setting it up and implementing it successfully.

Apache Software Foundation Logo

Creating a Virtual Host

Note: The Apache installation in Ubuntu is actually controlled by the file /etc/apache2/apache2.conf with /etc/apache2/httpd.conf being a secondary config file loaded after apache2.conf. It’s advisable to leave apache2.conf alone, and make any server-wide changes to httpd.conf. The Ubuntu Apache installation also goes a step further by allowing site-specific configuration files, which are located in the directory /etc/apache2/sites-available. One already exists, and is called “default”, which controls the web root, /var/www. To activate any new sites created in this directory, we just create new file in this directory, then create a symbolic link to it in the /etc/apache2/sites-enabled directory. When Apache starts, it scans the apache2.conf, httpd.conf files, and also the /etc/apache2/sites-enabled directory for any links to config files in /etc/apache2/sites-available. If the link isn’t there, the configuration isn’t loaded.

For this tutorial, we’ll be creating a new config file in /etc/apache2/sites-available and activating it by creating to it in /etc/apache2/sites-enabled - apache2.conf and httpd.conf will not be touched.

Ok, I wanted to create a Virtual Host called 64bitjungledev.com, and also be able to view the site on my local installation when I point my browser to 64bitjungledev.com. The first thing I did was create a directory for the new Virtual Host to reside in. I was feeling particularly lazy, so just created it in the /var/www directory, and changed the owner of the new directory to my user name and group (so I could add/edit files etc.) I know, I know, I should create it in my home directory - but everything with “/var/www/ can be substituted for “/home/USERNAME/html/”. Anyway, in a Terminal, I executed:

sudo mkdir /var/www/64bitjungledev
sudo chown myuser:mygroup /var/www/64bitjungledev

Then, I created a new config file in the /etc/apache2/sites-available to contain the configuration information for my new Virtual Host. In a Terminal, I executed the following:

cd /etc/apache2/sites-available
gksu gedit 64bitjungledev.com

This creates a new file called 64bitjungledev.com in the directory and opens it in a text editor. In this new file, I dumped:

<VirtualHost *>
ServerName 64bitjungledev.com
ServerAlias www.64bitjungledev.com
DocumentRoot /var/www/64bitjungledev
DirectoryIndex index.php
<Directory /var/www/64bitjungledev>
AllowOverride all
Options Indexes FollowSymLinks MultiViews
Order allow,deny
Allow from 127.0.0.1
</Directory>
CustomLog /var/log/apache2/64bitjungledev.com-access.log combined
</VirtualHost>

This is basically telling Apache that we want it to host a new site, called 64bitjungledev.com, and all it’s files will be located in /var/www/64bitjungledev. “Allow from 127.0.0.1″ tells Apache that only my computer can access it, and “AllowOverride all” tells Apache that the site can use .htaccess files that contain Apache declarations that can override these settings. The CustomLog declaration is telling Apache to create an access log file for this site in /var/log/apache2/64bitjungledev.com-access.log and the “combined” tells it to include two extra fields of information in the log file - The “Referer” (sic) HTTP request header, and The User-Agent HTTP request header. Probably superfluous considering all trafic will be refered from my local machine, and the only agent accessing the site is Firefox! You can change “combined” to “common”, which doesn;t include these two fields.

Anyway, I digress… There are two methods to enabling the new site - create a symbolic link in /etc/apache2/sites-enabled to this new file, or, have Ubuntu do it for us:

cd /etc/apache2/sites-available
sudo a2ensite 64bitjungledev.com

Will do exactly the same as:

sudo ln -s /etc/apache2/sites-available/64bitjungledev.com /etc/apache2/sites-enabled/64bitjungledev.com

To disable the site, we can run:

sudo rm /etc/apache2/sites-enabled/64bitjungledev.com

Or:

sudo a2dissite 64bitjungledev.com

The result is the same. In order for the URL 64bitjungledev.com to work in my browser, I just had to change the hosts file, so my computer looks for 64bitjungledev.com on my machine as opposed to looking it up via DNS:

gksu gedit /etc/hosts

I changed the line

127.0.0.1 localhost

to:

127.0.0.1 localhost 64bitjungledev.com www.64bitjungledev.com

Saved, and closed the file. Now, I had to restart Apache for the new changes to take affect:

sudo /etc/init.d/apache2 reload

I created a test file in the document root:

gedit /var/www/64bitjungledev/index.php

Containing the old faithful:

<?php
phpinfo();
?>

and pointed my browser to www.64bitjungledev.com. Success! Now for mod_rewrite…

Enabling mod_rewrite

First, to enable the Apache module, mod_rewrite (which is disabled on a default Hardy install), I had to create a symbolic link to the module file, so in a Terminal, I ran:

sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load

The Apache installation in Ubuntu has many different configuration files, and uses this modular approach to activae/deactivate them. The rewrite.load file simply contains the load module declaration which would normally be placed in the httpd.conf file:

$more /etc/apache2/mods-available/rewrite.load
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so

When Apache starts in Ubuntu, it checks the /etc/apache2/mods-enabled directory for links to available modules, and loads the modules it finds. Creating the link above can also be achieved by running:

sudo a2enmod rewrite

which is basically a short-cut approach to creating the link in /etc/apache2/mods-enabled, similar to the a2ensite used above - and, similarly:

sudo a2dismod rewrite

will have the same effect as:

sudo rm /etc/apache2/mods-enabled/rewrite.load

That’s pretty much it. The only additional thing I had to do, was make a slight change to the /etc/apache2/sites-available/default file, which, as mentioned above, is the default Apache configuration file for /var/www. So, I opened it up:

gksu gedit /etc/apache2/sites-available/default

And changed the “AllowOverride” declaration to “all” for both the / and /var/www directories. I just needed to restart Apache once again:

sudo /etc/init.d/apache2 reload

Testing mod_rewrite

Before going ahead and installing a local copy of 64bitjungle, I wanted to test if the system was working. I needed two files for this - a .htaccess file, and a PHP file. The .htaccess file contains the test RewriteRule for Apache to process the URL redirection of “clean” URLs to the PHP script, so that www.64bitjungledev.com/xyz/somedata will actually point to www.64bitjungle.com/thescript.php?thevariable=somedata. So, in a Terminal, I created the .htaccess file first:

gedit /var/www/64bitjungledev/.htaccess

And wrote a simple Apache RewriteRule, in addition to telling Apache to switch on the rewrite engine:

<IfModule mod_rewrite.c>
RewriteEngine On
#test rule
RewriteRule ^xyz/([^/\.]+)/?$ thescript.php?thevariable=$1 [L]
</IfModule>

This is basically telling Apache to switch on the RewriteEngine if mod_rewrite is loaded. The rather scrappy-but-suffices-for-testing RewriteRule basically tells Apache to “grab every character in the clean URL after xyz/ and store it in a temporaty variable, then forward it to thescript.php with thevariable set to the stuff just stored”.

A very simple PHP script can be written and used to test if the data is being passed properly:

gedit /var/www/64bitjungledev/thescript.php

which can contain simply:

<?php
echo $_GET['thevariable'];
?>

After restarting Apache, pointing my browser to www.64bitjungledev.com/xyz/DoesItWork now outputs “DoesItWork”, www.64bitjungledev.com/xyz/anything1234 ouputs “anything1234″ etc. The fun just doesn’t stop…!

With mod_rewrite successfully installed, and working for this new domain, I can now install a local version of 64bitjungle.com to play with. I haven’t actually done that yet though…

References:


written by Hodge \\ tags: , , ,

May 31
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Update, 17/08/08: There is no longer any need to switch to the Experimental branch, if you are using the following Microdia cameras:

0c45:6027, 0c45:608f, 0c45:60ec, 0c45:60fe, 0c45:60c0, 0c45:613b, 0c45:613c, 0c45:624e, 0c45:624f, 0c45:6242, 0c45:6253, 0c45:6260, 0c45:6270, 0c45:627b, 0c45:8105

Keep up to date on the current supported webcams: http://groups.google.com/group/microdia/web/project-status?hl=en

The webcam (Acer Orbicam) on my Acer Aspire 5052 has been somewhat of a bane - with no drivers available, it has been one of the last stumbling blocks of getting all of my hardware working in Linux (the Ubuntu 8.04 Distro, Hardy Heron, in my case). That is until I ambled across, quite by accident, the Microdia Google Group. These guys are the epitome of Open Source development in action - a group of widely distributed people who are collaborating to solve a common problem: to get the Microdia webcams supported under Linux. And they’re doing a fantastic job so far.

Note: I should first mention that the drivers are still heavily under development, and although they are not (for some webcams) to the point where they can be used for Skype, for example, major progress has been made, and there is now finally communication with my webcam, to the point where I can successfully output video to mplayer. Therefore, this post is not quite yet a HowTo on getting a Microdia webcam fully function, but a step towards helping people installing and testing the drivers under development.

So, here’s how I’ve got to the stage of seeing myself in mplayer…

Information Gathering

Firstly, I had to determine i) whether or not my Webcam was in fact a Microdia camera, and ii) the model number, so in a Terminan, I ran:

lsusb

Which output, amongst other information about the rest of my USB devices:

Bus 003 Device 002: ID 0c45:6260 Microdia

confirming that my Acer Orbicam is a Microdia device. The two hex values 0c45:6260 represent the Vendor ID and Product ID respectively - 0c45 being Microdia, and 6260 the Product itself. In order to create my meagre contribution to the Microdia Group, I had to gather some more information about the device’s bridge and sensor. Firstly, I needed the USB Device Descriptors, which were obtained by running:

sudo lsusb -d 0c45:6260 -v > ~/Desktop/0c45_6260_device_descriptors.txt

I then needed to discover the Bridge and Sensor types, which thankfully could be found in the Windows driver file, snp2std.inf:

%USBPCamDesc% = SN.USBPCamVGA,USB\VID_0c45&PID_6260 ; SN9C201 + OV7670ISP

Which tells me:
Bridge: SN9C201
Sensor: OV7670

The full guide to gathering information for your webcam can be found at the Microdia group, here.

Driver Compiling and Installing

The driver code is controlled by git, which I installed by running:

sudo apt-get install git-core gitk git-gui git-doc curl

Also, before downloading and installing the drivers, I ran:

sudo apt-get install kernel-package linux-source build-essential

To grab the Linux source etc. Once finished, I created a directory to set up my local git repository and downloaded the driver code:

cd ~/Documents
mkdir webcam
cd webcam
git clone http://repo.or.cz/r/microdia.git

The final command executes git, and tells it to clone the remote repository. The files are downloaded to a sub directory called microdia, from which I ran the rest of the commands:

cd microdia

Note: If you have any of the following Microdia cameras, you’ll need to switch to the Experimental branch:

6242, 624e, 624f, 6270, 627b, 62bb, 145f:013d, 045e:00f4

Switch to the Experimental branch by running:

git checkout --track -b v4l2-experimental origin/v4l2-experimental

I then compiled the code:

make

and received this error, but it’s not important:

make: ctags: Command not found
make: *** [ctags] Error 127

Once compiled, the module can be inserted to the kernel for testing:

sudo insmod ./microdia.ko

I also received the following error:

insmod: error inserting ‘microdia.ko’: -1 Unknown symbol in module

so had to run the following first:

sudo modprobe videodev
sudo modprobe compat-ioctl32

and then I could insert the module:

sudo insmod ./microdia.ko

Finally, to test, I ran:

mplayer tv:// -tv noaudio:driver=v4l2:width=640:height=480:outfmt=yuy2:device=/dev/video0:fps=30

you may need to change /dev/video0 to /dev/video1 - also, if you don’t have mplayer, it needs installing:

sudo apt-get install mplayer

The only thing is… it’s currently a mirror image, hehehe:

References

  1. Microdia, Google Group
  2. Full list of currently supported (and unsupported) Microdia Webcams
  3. How to gather information on your webcam
  4. Using git with Microdia
  5. Testing the Microdia driver
  6. PATCH: v4l-experimental support for 6260 (3rd try) Thread

written by Hodge \\ tags: , , ,

Apr 21
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

I love Photography, and any oportunity I get, I try and take photos. I have a great camera, and living in the jungle, fantastic surroundings and photo oportunites everywhere I look. The only thing I’ve been lacking is a digital darkroom for Linux. OK, so we Linux users have GIMP, CinePaint (a fork from GIMP 1.0.4 specifically for photo/movie frame editing), and ufraw - a RAW digital image processor, along with a bunch of other great tools for image processing, but I just wanted to try something more. I’ve tried installing the trial version of Adobe Photoshop Lightroom with wine, but with no success, and as such, have continued my search for a viable Linux based digital darkroom…

A couple of days ago, I set up a makeshift studio at home so I could do a photoshoot of my wife and new baby (well, I say studio - it was in fact a couple of dark blankets I found about the house, no lighting, reflectors, or any of the expensive professional gear!). Once finished, I really wanted to process some of the better shots to send to my family, and so was determined to find something I could install and use on Linux.

Tenacity prevailed, and I finally discovered Lightcraft’s Lightzone - a Java based digital darkroom, with versions available for Mac, Windows and Linux! The Linux version is currently in Beta, but in all honesty, having used it for the past few days, I couldn’t tell. Installation is as simple as you can get - download the archive (registration is required, but it’s worth it), extract the files, enter the new directory, and run the LightZone executable:

tar -zxvf LightZone-3.4.tar.gz
cd LightZone
./Lightzone

After a dialog appears informing how many days of the trial are left, the splash screen displays as the program loads. The GUI is incredibly intuitive, and within minutes, I managed to process a couple of pictures worth sending to my family. When the application first opens, it’s a simple case of using the pane on the left to navigate to a directory containing photos. LightZone automatically generates thumbnails, and a larger preview of the chosen thumbnail with an option to edit. A single click on “Edit” brings up a whole array of processing options to play with.

After a few clicks, and mainly fumbling around the system, I managed to turn this raw image:

into a Black and White 10×8 Portrait that my Mum will love:

I’m incredibly happy with the results of a few minutes clicking and fumbling around an unfamiliar system! If this is what can be achieved by doing so, I’m really looking forward to getting my teeth into the system, and learning it’s many features - HDR (High Dynamic Range) support, Zone Systems, and many more.

Unfortunately however, I only have 9 days left on the Trial, since the Linux version is still in Beta, and therefore not available for purchase. I have no idea how much the Linux version will be when it’s finally released, but the Windows and Mac versions retail at $129.95 for the Basic version, and $199.95 for the Pro version. Unfortunately, both out of my price range for the time being (that’s a hell of a lot of money where I live!), but I’m certainly going to enjoy the Beta version while I can, and dream of when I can afford to buy the Pro version! Still, I’ll see if I can make some time to write a couple of tutorials and post them.

LightZone is a fantastic product. The only thing extra I would like to see, is a 64 Bit version.


written by Hodge \\ tags: , ,

Apr 13
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Xdebug LogoOK, so I have x64 Eclipse successfully installed and running with all the plugins I use for Web Application Development. But what about debugging? Sure, var_dump(), echo, print and so on are all valuable to me when debugging a script, but it’s always good to have more information.

Xdebug is a fantastic PHP extension, which is written by one of the PHP Core Developers, Derick Rethans. The current version is 2.0.3, and I set about installing it on my system, and integrating it into Eclipse PDT today.

Xdebug can be installed in a few different ways - by downloading the binaries from the site, compiling the source, or via PECL:

sudo pecl install xdebug

Some days, I just prefer to download compile the source, as it gives me more of an understanding of what is being installed and where, and this is one of those days:

cd ~/
mkdir xdebug
cd xdebug
wget http://www.xdebug.org/link.php?url=xdebug203
tar -zxvf xdebug-2.0.3.tgz
cd xdebug-2.0.3

The packages phpize and php-config are required to install Xdebug, and can be obtained by installing the relevant PHP development packages:

sudo apt-get install php4-dev

or

sudo apt-get install php5-dev

depending on the PHP version installed. After unzipping the Xdebug source, I ran

phpize

which output:

PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519

I then checked this against the table at http://www.xdebug.org/docs/install#phpize to see if my PHP version (5.2.3) was compatible with Xdebug - it matched up to the table’s 5.2.x PHP version row, so I went ahead and installed:

./configure --enable-xdebug --with-php-config=/usr/bin/php-config
make

which created a file xdebug.so in the modules subdirectory. This file needs to be copied (or moved) to the PHP Extension directory, which on my system is in /usr/lib/php5/20060613/. An easy way to find the PHP extension directory is to run:

locate mysql.so

ok, so I copied the xdebug.so to the extension directory:

sudo cp modules/xdebug.so /usr/lib/php5/20060613/

So far so good. Now PHP needs to be told about the extension, and to load it. This can be done by adding

zend_extension="/usr/lib/php5/20060613/xdebug.so"

to the php.ini file. However, on my Ubuntu system, the PHP extensions are activated by adding an .ini file to the /etc/php5/apache2/conf.d directory, for each extension installed. The .ini file is the extension_name.ini, so I created a file called xdebug.ini:

cd /etc/php5/apache2/conf.d
gksu gedit xdebug.ini

which for now, contains a single line:

zend_extension="/usr/lib/php5/20060613/xdebug.so"

After restarting the Apache server

sudo /etc/init.d/apache2 restart

I created a file called test.php in my Web Root directory, containing a call to the phpinfo() function:

<?php
phpinfo();
?>

and pointed my browser to http://localhost/test.php. Just before the “PHP Credits” section, is a small box containing information on Zend - and now, with a successful Xdebug installation, additional information on Xdebug:

Xdebug information output by phpinfo()

The same information can be found by opening a Terminal and running

php -m

to output the loaded modules, and towards the end of the output, you should see

[Zend Modules]
Xdebug

alternatively, run

php -i | grep Xdebug

and if Xdebug has been installed successfully, you should see

with Xdebug v2.0.3, Copyright (c) 2002-2007, by Derick Rethans

Now, Xdebug needs to be enabled before any scripts can be debugged! So, in the php.ini file (or in my case, the newly created /etc/php5/apache2/conf.d/xdebug.ini file) I added the lines:

xdebug.remote_enable=On
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"

and restarted Apache again:

sudo /etc/init.d/apache2 restart

running

php -i | grep xdebug

in the Terminal, or using the test.php file containing phpinfo() shows that the new settings are being used, and Xdebug is active and running.

Configuring Eclipse PDT:

Setting up Eclipse PDT to use the Xdebug extension is pretty simple. In Eclipse PDT, I opened Window -> Preferences, then clicked on PHP, expanded the tree, and selected Debug. I Chose Xdebug from the pull down menu for the PHP Debugger, the “Default PHP Server” (should already be set to localhost), and then created a new PHP Executable option by clicking on the PHP Executables link next to the PHP Executable pull down menu.

XDebug and Eclipse PDT

In the PHP Executables dialog, I Clicked Add, filled in the name (PHP with XDebug), and entered the path to the PHP executable - on my system this is /usr/bin/php but if you don’t know, then in a terminal, run

which php

to find out where the php command is run from. I also entered the location of php.ini - again, on my system, this is /etc/php5/apache2/php.ini - and selected XDebug as the PHP debugger:

Xdebug - set up PHP Executable in Eclipse PDT

Clicked OK, then went back to the PHP -> Debug preferences screen, and selected the PHP Executable just created in the PHP Executable pull down. Finally, in the Debug -> Workbench Options option in the left, I selected “Never” for the “allow multiple debug sessions” option, since Xdebug does not support them.

Finally, I needed to set the Default Web Browser in Eclipse, to that when I debug a script, the output is sent to Firefox. Again in Preferences, I navigated to General -> Web Browser, and clicked “New”. It’s pretty straight forward stuff - entering a name and location - Firefox, and /usr/bin/firefox. Again, if you don’t know the location of the firefox binary, in a terminal run:

which firefox

With this done, and the preferences saved, I can now debug my scripts using Xdebug!

Using Xdebug in PDT

References:

http://www.xdebug.org/docs/install
http://www.eclipse.org/pdt/documents/XDebugGuide.pdf
http://devzone.zend.com/article/2803-Introducing-xdebug


written by Hodge \\ tags: , ,

Apr 12
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5 out of 5)
Loading ... Loading ...

Eclipse SDKNOTE, 04/08/08: This tutorial covers Eclipse Europa. If you would like to install the latest version of Eclipse 3.4 Ganymede, with PDT and SQL Explorer, take a look at my latest Tutorial: “64 Bit Eclipse 3.4 (Ganymede) IDE with PDT and SQL Explorer - Full PHP/MySQL Web Application IDE“.

I had tried once before to install the x64 (64 Bit) version of Eclipse IDE, about 8 months ago, but found it to be somewhat buggy and unstable. In the interim, I’ve been using the 32 Bit version of Eclipse PDT for my development stuff. Earlier this year (21/02/08) a new version of Eclipse 64 Bit was released, so I gave it a go today. So far, so good!

Unfortunately, there’s no 64 Bit PDT all-in-one, but I managed to install a 64 Bit equivalent by cobbling together the relevant packages available by using the Eclipse Update Manager system, after initially installing the latest version of Eclipse Classic 3.3.2 64 Bit.

I wanted to keep everything (or as much as possible) 64 Bit, so I also download and installed the 64 Bit JRE, which can be downloaded here (or use the direct link to the bin file). The method for installing the 64 Bit JRE is the same as the 32 Bit version - after the file downloaded to my desktop, I opened up a new Terminal Window (Applications -> Accessories -> Terminal), traversed to the directory I wanted to install it into, moved the file, made it executable, and ran it to install:

cd /usr/java
sudo mkdir 64
cd 64
sudo mv ~/Desktop/jdk-6u5-linux-x64.bin /usr/java/64/
sudo chmod a+x jdk-6u5-linux-x64.bin
sudo ./jdk-6u5-linux-x64.bin

If the “java” directory doesn’t exist, it needs to be created first:

sudo mkdir /usr/java

listing the directory

ls

should return

jre1.6.0_05

which is the directory containing the necessary Java binaries.

As with my previous 32 Bit installation, I wanted Eclipse to be installed in the /opt directory:

cd /opt
sudo mv ~/Desktop/eclipse-SDK-3.3.2-linux-gtk-x86_64.tar.gz /opt
sudo tar -zxvf eclipse-SDK-3.3.2-linux-gtk-x86_64.tar.gz

then rename the eclipse directory:

sudo mv eclipse eclipse64

I also needed to get the newly installed Eclipse to run with the newly installed JRE - by default, the eclipse executable in the directory will try and detect Java and use whatever it finds, so I created a shell script:

cd eclipse64
sudo gksu gedit eclipse.sh

containing the following:

#!/bin/bash
PATH=/usr/java/64/jre1.6.0_05/bin:$PATH
/opt/eclipse64/eclipse

Now instead of running the eclipse executable, I run eclipse.sh (make sure it’s executable)

sudo chmod 755 eclipse.sh

before running

/opt/eclipse64/eclipse.sh

PDT and WTP Plugins

The first time I ran the new 64 Bit version, everything went well - it was fast, and seemed stable, so I went ahead and started installing all the additional plugins I needed (and still need…). Goto Help -> Software Updates -> Find and Install, and select “Search for new features to install”.Click on “New Remote Site” for each of the following:

  • Name: PDT, URL: http://download.eclipse.org/tools/pdt/updates/
  • Name: WTP, URL: http://download.eclipse.org/webtools/updates/
  • Name: GEF, URL: http://www.eclipse.org/gef/updates/
  • Name: EMF, IRL: http://www.eclipse.org/modeling/emf/updates/

Eclipse Update Manager Add Remote Site

Actually, there are only a couple of components required from the GEF (Graphical Editing Framework) and EMF (Eclipse Modeling Framework) packages to satisfy dependencies - WTP (Web Tools Platform) requires a package from GEF, and GEF from EMF…

After adding these, click on Finish - the Update Manager will then query any mirrors for the latest versions of the plugins. Once it has finished, a dialog appears, where it is possible to select the plugins to download and install. First, I selected PDT - the Update Manager then informed me that PDT requires files from WTP, so I tried clicking the “Select Requires” button, hoping that it would sort out the dependencies on my behalf. Unfortunately, nothing happened… So, I selected WTP manually, then expanded GEF -> Eclipse SDK R3.3.1 and Selected Graphical Editing Framework 3.3.1v20070814, then expanded EMF -> EMF SDK 2.3.2 and selected Eclipse Modeling Framework (EMF) - org.eclipse.emf.ecore 2.3.2v200802051830… I could then click “Select Required” to get the last few residual required dependencies… Phew…

Eclipse Update Manager Select Updates

Actualy, it still bugged me for dependencies for Java Persistence API contained in WTP, but by that stage I really couldn’t be arsed going through the process of adding more stuff to the Update Manager and potentially having to search for further dependencies, so I just deselected the three Java Persistence API files contained in WTP.

OK, with the dependencies sorted, I clicked Next, accepted the agreements, finished, and went to make, and drink a brew (that’s Tea) while the Update Manager downloaded and installed the requested stuff.

MySQL: SQL Explorer Plugin

Eclipse SQL Explorer LogoOnce everything had downloaded and installed, I restarted Eclipse. Everything looked good! Great, in fact. But I also wanted to install a few more plugins, including the MySQL SQL Explorer Plugin - which additionally requires, and depends on Eclipse DTP (Data Tools Project). Eclipse DTP has to be downloaded and installed manually, since there is no automated Update Site. So, I downloaded dtp_1.5.2_022008.zip to my Desktop, and set about extracting and installing the files:

cd ~/Desktop
mkdir DTP
mv dtp_1.5.2_022008.zip DTP
cd DTP
unzip dtp_1.5.2_022008.zip
cd eclipse
sudo cp -R features plugins /opt/eclipse64

If Eclipse is open, restart it. With the DTP installed, I could set about installing the SQL Explorer Plugin. The instructions for installing and configuring the SQL Explorer Plugin can be found in my previous article - Eclipse PDT and MySQL - SQL Explorer Plugin, since I don’t want to regurgitate information, just follow the link if you need to install it, and come back when it’s done.

Note: Actually, now I had the DTP installed, I could download and install the additional Java Persistence API in WTP! Same method: Update Manager, select WTP etcetera, etcetera…

ATF: AJAX Framework Toolkit

Script.aculo.usOnce the SQL Explorer Plugin was installed, I had one final plugin - ATF (the AJAX Toolkit Framework). This can be downloaded as a Site Archive, and the zip file added to Eclipse’s Update Manager. Once downloaded, I opened the Update Manager in Eclipse (Help -> Software Updates -> Find and Install), and clicked on “New Archived Site”, to add a new locally archived site, calling it ATF, and pointing it to the freshly downloaded atf-incubation-SiteArchive-0.2.3M4-v200709141050.zip file. I discovered, however, that the site.xml file contained within the zipped site archive is somewhat out of date and the pointers within are directed to the wrong download locations, so I had to manually locate the additional dependent plugins - Mozilla XULRunner, and Mozilla JS. They can both be added as New Remote Sites to the Update Manager, by clicking on the “New Remote Site” button, and adding the following information:

  • Name: Mozilla JS, URL: http://ftp.mozilla.org/pub/mozilla.org/js/eclipse/
  • Name: XULRunner, URL: http://releases.mozilla.org/pub/mozilla.org/xulrunner/releases/1.8.1.3/contrib/eclipse/

The previously used EMF plugin is also required to satisfy a couple of dependencies, so I selected the ATF, Mozilla JS, XULRunner, and EMF plugins from the list, and clicked Finish. Once the “updates” were found, I selected XULRunner, Mozilla JS, ATF (I deselected the ATF -> Mozilla JS component though, since an updated version was to be downloaded and installed from the Mozilla Server), and also selected the required EMF components. Click through Next etc. to download and install. Once completed, I restarted Eclipse.

In the Window -> Preferences menu by the way, AJAX toolkits such as Script.aculo.us can be added to the ATF module.

Et Voila! I now have a working Eclipse 64 Bit version up and running! Finally!

Oh, if you want a desktop icon, just create a file on your Desktop called Eclipse.desktop,

cd ~/Desktop
gedit Eclipse.desktop

and add the following:

[Desktop Entry]
Categories=;
Encoding=UTF-8
Exec=/opt/eclipse32/eclipse.sh
Hidden=false
Icon=/opt/eclipse64/icon.xpm
Icon[en_US]=/opt/eclipse64/icon.xpm
Name=Eclipse
Name[en_US]=Eclipse
Terminal=false
Type=Application
Version=1.0


written by Hodge \\ tags: , , , , , , ,

Apr 11
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Firestarter LogoI recently installed Firestarter (a Firewall GUI for Linux - sometimes I just cant be arsed using CLI to configure iptables etc!), but I’ve noticed that when my system boots, it throws up the following error:

invoke-rc.d: initscript firestarter, action "restart" failed
run-parts: /etc/network/if-up.d/50firestarter exited with return code 2

This is actually a bug with version 1.0.3-5, and the solution is pretty simple - to upgrade to version 1.0.3-6. However, I have Ubuntu 64 Bit installed, and unfortunately, 1.0.3-6 is not yet available in the repositories. Not worries - just a simple case of downloading the source tar ball, compiling, and installing.

First, I removed the currently installed version:

sudo apt-get remove firestarter

and downloaded the latest tar ball. Once this had downloaded to my desktop, I went through my usual routine of creating a new directory, moving the file, extracting… and so on:

cd ~/Desktop
mkdir firestarter
mv firestarter-1.0.3.tar.gz firestarter
cd firestarter
tar -zxvf firestarter-1.0.3.tar.gz
cd firestarter-1.0.3

Installation is pretty straightforward - although it’s always good to read the README and INSTALL files!

more INSTALL

So, configure, make, and install:

./configure --sysconfdir=/etc
make
sudo make install

However, the configure step threw out a few errors for me:

Package libgnome-2.0 was not found in the pkg-config search path. Perhaps you should add the directory containing `libgnome-2.0.pc' to the PKG_CONFIG_PATH environment variable No package 'libgnome-2.0' found Package libgnomeui-2.0 was not found in the pkg-config search path. Perhaps you should add the directory containing `libgnomeui-2.0.pc' to the PKG_CONFIG_PATH environment variable No package 'libgnomeui-2.0' found Package gnome-vfs-2.0 was not found in the pkg-config search path. Perhaps you should add the directory containing `gnome-vfs-2.0.pc' to the PKG_CONFIG_PATH environment variable No package 'gnome-vfs-2.0' found Package libglade-2.0 was not found in the pkg-config search path. Perhaps you should add the directory containing `libglade-2.0.pc' to the PKG_CONFIG_PATH environment variable No package 'libglade-2.0' found
configure: error: Library requirements (libgnome-2.0 >= 2.0.0
libgnomeui-2.0 >= 2.0.0
gtk+-2.0 >= 2.4.0
gnome-vfs-2.0 >= 2.6.0
libglade-2.0 >= 2.3.6)

which basically means that I didn’t have some of the necessary development libraries installed required to compile the binaries. No real problem, and easy enough to solve by, well, installed in the required packages:

sudo apt-get install libgnome-dev libgnomeui-dev libgnome-vfs-dev libglade2-dev

This process also had to download an additional 50 packages to meet the dependencies of the above four packages (and there were probably some sub dependencies there too…)

Anyway, the configure process ran smoothly after installing the required dev libraries, so I could then run

make
sudo make install

to compile and install the new binaries.

It’s possible to have Firestarter run as a system service, by copying the fedora.init file from the install directory to /etc/init.d and renaming the file to firestarter, then enabling the script:

sudo cp fedora.init /etc/init.d/firestarter
sudo chkconfig firestarter reset

However, since I had previously installed Firestarter, all the relevant scripts and symbolic links were already in place. All I had to do was make a minor change to the /etc/init.d/firestarter script:

cd /etc/init.d
cp firestarter firestarter.old
gksu gedit firestarter

and changed the line

[ -x /usr/sbin/firestarter ] || exit 0

to

[ -x /usr/local/bin/firestarter ] || exit 0

so that the script would point to the new installed binary. That’s it.


written by Hodge \\ tags: ,

Apr 07
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

I’m just playing around with a new theme for the site at the moment. I like this i3Theme, since I can split the side bar up into two sections - makes organising the side content a little easier - just need to design some kind of logo to go with the new theme :)


written by Hodge \\ tags:

Mar 27
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5 out of 5)
Loading ... Loading ...

OK, this is a bit of a cheeky post, since I’m merely extending a previous post “Conky on Ubuntu 64 Bit - .conkyrc” - or elaborating on it - to clarify setting up .conkyrc for Dual Core Processors - specifically for my AMD Turion 64 X2. I’ve had a few requests specifically about this, so here goes…

Now, the part of my .conkyrc file that deals with my Dual Core looks like this:

${color #42AE4A}Usage (Avg):${color #42AE4A} ${freq_dyn_g}Ghz ${color lightgrey}${cpu cpu0}% ${alignr}${color #42AE4A}${cpubar cpu0 5,80}
${color #42AE4A}Usage (Core 1):${color #42AE4A} ${freq_dyn_g cpu1}Ghz ${color lightgrey}${cpu cpu1}% ${alignr}${color #42AE4A}${cpubar cpu1 5,80}
${color #42AE4A}Usage (Core 2):${color #42AE4A} ${freq_dyn_g cpu2}Ghz ${color lightgrey}${cpu cpu2}% ${alignr}${color #42AE4A}${cpubar cpu2 5,80}
${color #42AE4A}Average
${cpugraph cpu0 42AE4A eeeeee}
${color #42AE4A}Core 1 $alignr Core 2
${color #42AE4A}${cpugraph cpu1 25,120 42AE4A eeeeee} ${color #42AE4A} $alignr${color #42AE4A}${cpugraph cpu2 25,120 42AE4A eeeeee}
${color #42AE4A}Processes:${color lightgrey} $processes ${color #42AE4A}Run:${color lightgrey} $running_processes ${color #42AE4A}CPU Temp:${color lightgrey} ${execi 1100 cat /proc/acpi/thermal_zone/THRM/temperature | grep -o “[0-9]* C”}
${color #42AE4A}Core 1 Temp: ${color lightgrey}${execi 8 sensors | grep -A 1 ‘Core0′ | cut -c13-16 | sed ‘/^$/d’} C ${color #42AE4A}Core 2 Temp: ${color lightgrey}${execi 8 sensors | grep -A 1 ‘Core1′ | cut -c13-16 | sed ‘/^$/d’} C

This outputs the following to Conky:

Conky Dual Core CPU Output

Stripping out all the formatting, and colouring gives this:

Usage (Avg): ${freq_dyn_g}Ghz ${cpu cpu0}% ${alignr}${cpubar cpu0 5,80}
Usage (Core 1): ${freq_dyn_g cpu1}Ghz ${cpu cpu1}% ${alignr}${cpubar cpu1 5,80}
Usage (Core 2): ${freq_dyn_g cpu2}Ghz ${cpu cpu2}% ${alignr}${cpubar cpu2 5,80}
Average
${cpugraph cpu0 42AE4A eeeeee}
Core 1 $alignr Core 2
${cpugraph cpu1 25,120 42AE4A eeeeee} $alignr${cpugraph cpu2 25,120 42AE4A eeeeee}
Processes: $processes Run: $running_processes CPU Temp: ${execi 1100 cat /proc/acpi/thermal_zone/THRM/temperature | grep -o “[0-9]* C”}
Core 1 Temp: ${execi 8 sensors | grep -A 1 ‘Core0′ | cut -c13-16 | sed ‘/^$/d’} C Core 2 Temp: ${execi 8 sensors | grep -A 1 ‘Core1′ | cut -c13-16 | sed ‘/^$/d’} C

Now the walk through. The first line, Usage (Avg): ${freq_dyn_g}Ghz ${cpu cpu0}% ${alignr}${cpubar cpu0 5,80} gives the Average clock speed usage for both cores - ${freq_dyn_g} with no parameters, will output the current clock speed usage for the CPU as a whole. Passing cpu0 as a parameter to ${cpu} will output the overall CPU % used, and similarly, passing cpu0 to ${cpubar} will draw the overall % used graph (the parameters 5,80 are just for the height and width.

Now, by passing cpu1 or cpu2 to ${freq_dny_g}, ${cpu} and ${cpubar} Conky will output the same data but for each individual core. This can be extended by passing cpuN where N is the core number, for quad core etc. this could be cpu3 cpu4. So, the first three lines:

Usage (Avg): ${freq_dyn_g}Ghz ${cpu cpu0}% ${alignr}${cpubar cpu0 5,80}
Usage (Core 1): ${freq_dyn_g cpu1}Ghz ${cpu cpu1}% ${alignr}${cpubar cpu1 5,80}
Usage (Core 2): ${freq_dyn_g cpu2}Ghz ${cpu cpu2}% ${alignr}${cpubar cpu2 5,80}

Outputs:

Conky Dual Core CPU Usage

The next lines of the file deal with throughput/usage graphs, ${cpugraph cpu0 42AE4A eeeeee} being the average for the CPU as a whole, since cpu0 is passed as a parameter. 42AE4A and eeeeee are just colour parameters to create a gradient overlay on the graph. As before, passing cpu1 and cpu2 will draw the graphs for the individual cores. The additional parameters, 25,120 are again just height and width parameters.

So, the lines

Average
${cpugraph cpu0 42AE4A eeeeee}
Core 1 $alignr Core 2
${cpugraph cpu1 25,120 42AE4A eeeeee} $alignr${cpugraph cpu2 25,120 42AE4A eeeeee}

Will output:

Conky Dual Core CPU Throughput Graphs

Finally, I have a bunch of other data output, such as total processes, processes running, and CPU temperature. The first line outputs general information about the CPU as a whole:

Processes: $processes Run: $running_processes CPU Temp: ${execi 1100 cat /proc/acpi/thermal_zone/THRM/temperature | grep -o "[0-9]* C”}

$processes outputs the total number of processes, while $running_processes outputs the number of currently running processes on the CPU. To output the overall temperature, I had to call the execi function, and do some tweaking of the output to get the number, so ${execi 1100 cat /proc/acpi/thermal_zone/THRM/temperature | grep -o “[0-9]* C”} basically outputs /proc/acpi/thermal_zone/THRM/temperature, pipes the output through grep which searches for the regular expression ‘[0-9]* C’ (which matches a string of numbers followed by a space followed by an upper-case C), and thus outputs just the temperature value - e.g. “45 C”.

To output the temperature of each Core, I once again run the execi function on a couple of piped shell commands, and pipe the output through other shell commands to get the number I want:

Core 1 Temp: ${execi 8 sensors | grep -A 1 'Core0' | cut -c13-16 | sed '/^$/d'} C Core 2 Temp: ${execi 8 sensors | grep -A 1 'Core1' | cut -c13-16 | sed '/^$/d'} C

Basically what is happening here is I’m running the shell command sensors, piping to grep to search for the string “Core0“, piing this output to cut to trim it, and finally editing out some of the crap I don’t want by piping to sed. This is just repeated for Core1. You may need to customise the output from sensors, by greping, cutting and seding different stuff - experiment by opening a terminal, and running sensors, then just pipe it through the grep, cut, and sed commands until you get the data you want.

So, the final lines together:

Processes: $processes Run: $running_processes CPU Temp: ${execi 1100 cat /proc/acpi/thermal_zone/THRM/temperature | grep -o "[0-9]* C”}
Core 1 Temp: ${execi 8 sensors | grep -A 1 ‘Core0′ | cut -c13-16 | sed ‘/^$/d’} C Core 2 Temp: ${execi 8 sensors | grep -A 1 ‘Core1′ | cut -c13-16 | sed ‘/^$/d’} C

Output:

Conky Dual Core CPU Misc Info

Of course, this should work on any Linux distro with Conky installed.

Hope that helps someone.


written by Hodge \\ tags: , , , , ,

Mar 27
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Eclipse SQL Explorer LogoI’ve been using Eclipse PDT for some time now, and since PHP programming invariably involves connecting to a database at some point or another, I wanted to be able to access my MySQL databases from within the Eclipse IDE - even if only to quickly debug SQL statements. I generally use a combination of a locally installed phpMyAdmin, MySQL Administrator, MySQL Query Browser, and now the Eclipse SQL Explorer Plugin, which give me all the functionality I need for Web Application development.

phpMyAdmin, MySQL Administrator and MySQL Query Browser can be installed as follows, by the way:

sudo apt-get install phpmyadmin mysql-admin mysql-query-browser

Installing Eclipse SQL Explorer was pretty straight forward - I simply downloaded the archive package from Sourceforge, saved it to a directory in on my desktop (there is also a standalone client available, so be sure to download “Eclipse SQL Explorer [RCP/Plugin]” if you’re setting it up as an Eclipse plugin - here’s a direct link to the latest plugin file), and extracted the files:

cd ~/Desktop/sqlexplorer
unzip sqlexplorer_plugin-3.5.0.RC5.zip

This created two directories (features and plugins) along with two text files. To install the plugin, I just copied the two directories to my Eclipse root installation directory (see my previous post “Eclipse PDT IDE for PHP MySQL 32 Bit install on 64 Bit Ubuntu“), which is /opt/eclipse32

cp -R features plugins /opt/eclipse32/

Notice there was no need to use the sudo command before copying, since my user owns the eclipse32 folder.

Configuring SQL Explorer

Once installed, I also had to do some additional setup before I could configure SQL Explorer to connect to my local MySQL databases via Eclipse - namely, download and install the Java Connector for MySQL (MySQL JDBC Driver), to enable JDBC connections. The latest driver (5.1 at the time of writing) tar.gz file can be downloaded from the MySQL site here.

Once downloaded, I just extracted the files, and entered the new directory:

cd ~/Desktop/mysqljdbc
tar -zxvf mysql-connector-java-5.1.6.tar.gz
cd mysql-connector-java-5.1.6

The important file here (along with the documentation, of course) is the mysql-connector-java-5.1.6-bin.jar file, which is the driver itself. I guess this could be placed anywhere, since we just need to point the SQL Explorer plugin to it when setting it up in Eclipse, but for convenience and tidiness, I moved it to the /usr/share/mysql directory:

sudo cp mysql-connector-java-5.1.6-bin.jar /usr/share/mysql

With the JDBC driver installed, I could set up the Eclipse SQL Explorer plugin. In Eclipse, I went to Window->Preferences and expanded the new SQL Explorer section, highlighting “JDBC Drivers”, then double clicking on “MySQL Driver” to open the MySQL setup dialog:

Eclipse SQL Explorer Setup

In the MySQL Driver setup, I had to point the plugin to the MySQL JDBC Driver, by clicking on the “Extra Class Path” tab, and then clicking “Add” to point it to /usr/share/mysql/mysql-connector-java-5.1.6-bin.jar. Once added, clicking on “List Drivers” will bring up the list of available drivers in the “Driver Class Name” pull down menu. Only one is listed, and it just so happens to be the one we need - com.mysql.jdbc.Driver:

Eclipse SQL Explorer Setup

Click OK, and the driver is set up! I also clicked the “Set Default” button, since MySQL is currently the only database I connect to. With the Driver set up, I could then set up a connection to my database system. If the “Connections” view is not already available, it has to be selected via the Window->Show View->Other menu, and clicking on the “Connections” view within the “SQL Explorer” folder in this dialog.

With the Connections View available, I could set up the new connection profile, by right clicking in the view and selecting “New Connection Profile”, which opens up a new dialog, in which the new connection data is input:

Eclipse SQL Explorer Setup

It was a pretty simple process to create the connection - I just needed to replace the relevant parameters in the JDBC connections string with my connection details, so

jdbc:mysql://<hostname>[<:3306:>]/<dbname>

became

jdbc:mysql://localhost:3306/mydatabase

Entered the DB username and password, gave the connection a name, selected the newly created MySQL Driver, and clicked OK to save the connection. Double clicking the connection name in the Connections View connects to the DB and brings up an SQL window form which Queries may be run. By default, the results are displayed in a small view at the bottom of the main Eclipse IDE window - although, this can be dragged and placed anywhere. There are also several other views available via the Window->Show View->Other menu within the SQL Explorer section to peruse.

The Eclipse SQL Explorer homepage has extensive documentation available, including a cool section on extending the plugin. Maybe I should learn Java too?

That’s all Folks.


written by Hodge \\ tags: , , , ,