All posts by admin

Installing PHPDepend

When installing PHPDepend thru PEAR on Ubuntu, I ran into an error caused by a missing MagickWand-config:

$ pear channel-discover pear.pdepend.org
$ pear install --alldeps pdepend/PHP_Depend-beta

checking ImageMagick MagickWand API configuration program…
configure: error: not found. Please provide a path to MagickWand-config or Wand-config program.
ERROR: `/tmp/pear/temp/imagick/configure –with-imagick’ failed

Installing imagick thru PECL results in the same error message:

$ pecl install --alldeps imagick

The MagickWand API provides interfaces between high level programming languages and the ImageMagick image processing libraries.

Install the MagickWand libraries:

$ apt-get install libmagickwand-dev libmagickcore-dev

This finally enables the installation of the aforementioned PEAR & PECL libraries. After that, test the installation:

$ MagickWand-config --version
6.6.0 Q16
$ pdepend --version
PHP_Depend 1.0.7 by Manuel Pichler

Data Exchange between different MySQL Databases

To exchange data between different MySQL databases use the INSERT…SELECT syntax.

If both tables are identical:

INSERT INTO database2.table1
SELECT *
FROM database1.table1
WHERE 1;

To insert the value of selected columns use:

INSERT INTO database2.table1 (column1)
SELECT column1
FROM database1.table1
LIMIT 1;

This only works, if both databases are hosted on the same MySQL server! There is absolutely no way to exchange data between different/remote MySQL servers using standard (My)SQL syntax!

If you intend to access data from different/remote MySQL server, use the FEDERATED storage engine (cf. the MySQL website), which allows you to execute local queries on the remote database.

Install Sun Java under Debian Squeeze

Debian Squeeze for AMD64 comes with OpenJDK Java preinstalled and ready to run. If you, for whatever reason, need to install Sun Java, the Sources list has to be modified:

Edit /etc/apt/sources.list, add “non-free”:

deb http://ftp2.de.debian.org/debian squeeze main non-free

Update:

ron@ron:~$ apt-get update

Check for available Sun Java Packages:

ron@ron:~$ apt-cache search sun-java6

The result may look something like this:

sun-java6-bin - Sun Java(TM) Runtime Environment (JRE) 6 (architecture dependent files)
sun-java6-demo - Sun Java(TM) Development Kit (JDK) 6 demos and examples
sun-java6-doc - Sun JDK(TM) Documention -- integration installer
sun-java6-fonts - Lucida TrueType fonts (from the Sun JRE)
sun-java6-javadb - Java(TM) DB, Sun Microsystems' distribution of Apache Derby
sun-java6-jdk - Sun Java(TM) Development Kit (JDK) 6
sun-java6-jre - Sun Java(TM) Runtime Environment (JRE) 6 (architecture independent files)
sun-java6-plugin - The Java(TM) Plug-in, Java SE 6
sun-java6-source - Sun Java(TM) Development Kit (JDK) 6 source files

Now install what you need, minimum is sun-java6-bin:

ron@ron:~$ apt-get install sun-java6-bin sun-java6-javadb sun-java6-jdk sun-java6-plugin

In order to accept the License Agreement, navigate to the Accept field with TAB.

Make Sun Java the Java runtime of your choice:

ron@ron:~$ update-java-alternatives -s java-6-sun

Check, if Java could be properly installed:

ron@ron:~$ java -version

java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)

Set Environment Variable $JAVA_HOME

Edit file /etc/profile, add:

JAVA_HOME="/usr/lib/jvm/java-6-sun"
export JAVA_HOME

Done!