Jun 08

How to install zeromq (0MQ) in Ubuntu with Java bindings

403 Forbidden

Forbidden

You don't have permission to access /devformatter/branches/langs/autoconf.php on this server.


Apache Server at svn.wp-plugins.org Port 80
403 Forbidden

Forbidden

You don't have permission to access /devformatter/branches/langs/autoconf.php on this server.


Apache Server at svn.wp-plugins.org Port 80
403 Forbidden

Forbidden

You don't have permission to access /devformatter/branches/langs/autoconf.php on this server.


Apache Server at svn.wp-plugins.org Port 80
403 Forbidden

Forbidden

You don't have permission to access /devformatter/branches/langs/autoconf.php on this server.


Apache Server at svn.wp-plugins.org Port 80
403 Forbidden

Forbidden

You don't have permission to access /devformatter/branches/langs/autoconf.php on this server.


Apache Server at svn.wp-plugins.org Port 80
403 Forbidden

Forbidden

You don't have permission to access /devformatter/branches/langs/autoconf.php on this server.


Apache Server at svn.wp-plugins.org Port 80
403 Forbidden

Forbidden

You don't have permission to access /devformatter/branches/langs/autoconf.php on this server.


Apache Server at svn.wp-plugins.org Port 80
403 Forbidden

Forbidden

You don't have permission to access /devformatter/branches/langs/autoconf.php on this server.


Apache Server at svn.wp-plugins.org Port 80
403 Forbidden

Forbidden

You don't have permission to access /devformatter/branches/langs/autoconf.php on this server.


Apache Server at svn.wp-plugins.org Port 80
403 Forbidden

Forbidden

You don't have permission to access /devformatter/branches/langs/autoconf.php on this server.


Apache Server at svn.wp-plugins.org Port 80
403 Forbidden

Forbidden

You don't have permission to access /devformatter/branches/langs/autoconf.php on this server.


Apache Server at svn.wp-plugins.org Port 80
403 Forbidden

Forbidden

You don't have permission to access /devformatter/branches/langs/autoconf.php on this server.


Apache Server at svn.wp-plugins.org Port 80
403 Forbidden

Forbidden

You don't have permission to access /devformatter/branches/langs/autoconf.php on this server.


Apache Server at svn.wp-plugins.org Port 80

I tested this in Ubuntu 13.04, but essentially this should work in any Ubuntu distribution. First install the libtool, autoconf, automake, uuid-dev, e2fsprogs packages.

  |  copy code |? 
1
sudo apt-get install libtool autoconf automake uuid-dev e2fsprogs

Then clone the 0mq source using,

  |  copy code |? 
1
git clone git://github.com/zeromq/libzmq.git

Then go in to the libzmq directory and run the following commands in order.

  |  copy code |? 
1
./autogen.sh
2
./configure
3
make
4
sudo make install
5
ldconfig -v

Then run the following command and check the output.

  |  copy code |? 
1
ls -al /usr/local/lib/libzmq.*

The output should be similar to,

  |  copy code |? 
1
-rw-r--r-- 1 root root 7082022 ජූනි 7 14:16 /usr/local/lib/libzmq.a
2
-rwxr-xr-x 1 root root 947 ජූනි 7 14:16 /usr/local/lib/libzmq.la
3
lrwxrwxrwx 1 root root 15 ජූනි 7 14:16 /usr/local/lib/libzmq.so -> libzmq.so.3.0.0
4
lrwxrwxrwx 1 root root 15 ජූනි 7 14:16 /usr/local/lib/libzmq.so.3 -> libzmq.so.3.0.0
5
-rwxr-xr-x 1 root root 2876918 ජූනි 7 14:16 /usr/local/lib/libzmq.so.3.0.0

Now you should install the Java bindings for 0mq (in order to use omq from Java of course!). First check whether the JAVA_HOME environment variable is correctly set using,

  |  copy code |? 
1
echo $JAVA_HOME

This should output the location that you have installed Java. If it’s giving an empty output, then set it manually using

  |  copy code |? 
1
export JAVA_HOME=/<!--DVFMTSC-->location/to/your/java/installation<!--DVFMTSC-->
2

In my case the command is,

export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_17

Then clone the java bindings for 0mq using,

  |  copy code |? 
1
git clone https://github.com/zeromq/jzmq.git

now go inside the jzmq folder. Now same as before, run the following commands in order.

  |  copy code |? 
1
./autogen.sh
2
./configure
3
make
4
sudo make install

Now run the following command to verify the installation.

  |  copy code |? 
1
ls -al /usr/local/lib/*jzmq* /usr/local/share/java/*zmq*

The output should be like the following.

  |  copy code |? 
1
-rw-r--r-- 1 root root 535266 ජූනි 7 14:40 /usr/local/lib/libjzmq.a
2
-rwxr-xr-x 1 root root 998 ජූනි 7 14:40 /usr/local/lib/libjzmq.la
3
lrwxrwxrwx 1 root root 16 ජූනි 7 14:40 /usr/local/lib/libjzmq.so -> libjzmq.so.0.0.0
4
lrwxrwxrwx 1 root root 16 ජූනි 7 14:40 /usr/local/lib/libjzmq.so.0 -> libjzmq.so.0.0.0
5
-rwxr-xr-x 1 root root 242784 ජූනි 7 14:40 /usr/local/lib/libjzmq.so.0.0.0
6
-rw-r--r-- 1 root root 40618 ජූනි 7 14:40 /usr/local/share/java/zmq.jar

Notice the last line, that’s the newly created jar that connects to 0mq. Now you can use 0mq inside a Java programme.

Troubleshooting

If you get any of the following errors (which I got) when building the jar, export the mentioned system variables in the terminal to resolve them.

error

checking for javah… no

configure: error: cannot find javah

solution

  |  copy code |? 
1
export JAVAH=/<!--DVFMTSC-->location/to/your/java/installation/bin/javah

ex – export JAVAH=/usr/lib/jvm/jdk1.7.0_17/bin/javah

error

checking for jar… no

configure: error: cannot find jar

solution

  |  copy code |? 
1
export JAR=/location/to/your/java/installation/bin/jar
2

ex – export JAR=/usr/lib/jvm/jdk1.7.0_17/bin/jar

(Most of the content of this guide is based up on https://github.com/mslinn/zeromq-demo#ubuntu )

Share Button
Jan 19

saveMyStatus – A script to manage the chat statuses in a better way in Empathy

This is a script I wrote long time ago.It will load the last used status when Empathy restarts or when one of the accounts of the user comes online. This functionality was not available in Empathy at the time I wrote this script. Every time I restart Empathy, its chat status was reset to “Available”. But now it seems that the new Empathy versions has the capability to remember the last used chat status (whether it was “Available”, “Busy”, “Away”, or “Invisible”).  But still Empathy cannot remember the chat status message that was used in the last time. This script adds all this functionality to Empathy.

How to use this:


(These guidelines are for Ubuntu 11.04 . But procedure will be lot common
in other Linux flavours too)

0) Get the code from https://github.com/ishanthilina/saveMyStatus

1).Create a folder named “.scripts” in the home directory. Copy this script to that folder.
2).Go to Startup Application Preferences (search for “startup” in dashboard).
3).Click Add.
4).Give any Name you like.
5).In Command, click on Browse and select your script from the file browser (which is in
/home//.scripts)
6).Add a comment if you like.

Now the script will run from the next time you login to the computer. Have fun. And don’t forget to give me feedback 🙂

Share Button
May 09

mod_rewrite problems in Apache2 + Ubuntu ?

How to check whether mod_rewrite is installed?

Create a text file named check.php in the www folder and insert the following code to it.

<?php phpinfo(); ?>

Then go to the web page in your browser using the url “localhost/check.php”. Then you’ll see information about the php version of the system. Under the “Configuration” title there’s another title called “apache2handler”. In that table there’ll be a entry named “Loaded Modules”. Check to see if it contains the name “mod_rewrite “.If you can see that name then mod_rewrite is installed to apache.

If mod_rewrite is not installed?

mod_rewrite can be installed using the “sudo a2enmod rewrite” command in the terminal.

How to check whether mod_rewrite is working properly?

A good tutorial on this can be found in http://www.webune.com/forums/how-to-test-check-if-mod-rewrite-is-enabled-t40.html.

mod_rewrite is not working even though it is installed?

Navigate to /etc/apache2/sites-enabled as root and open the text file “000-default”. Then replace all the “AllowOverride None” with “AllowOverride All”( There’ll be 3 entries ). Then restart apache using sudo /etc/init.d/apache2 restart .

This should solve the problems.

Share Button