binhng's blog

There's no certainty, only opportunity.

LibreOffice 3.3.2 compiled from source for Slackware 13.0

leave a comment »

I’ve just completed the compilation for LibreOffice 3.3.2 using the SlackBuild from Alien Bob (source). The box used for this task is running Slackware 13.0 and is a rather powerful machine with a Core i3 CPU and 2 GB of RAM. Still, it takes 5 hours of time and requires 9 GB of space to complete.

Strangely, the package from RPM binary only occupies ~370 MB of disk space after installed while the package compiled from source takes up to ~425 MB.

The additional languages I built alongside the default US English are: German, UK English, Esperanto, Spanish, French, Japanese, Korean, Portuguese, Brazilian Portuguese, Vietnamese, Simplified Chinese, Traditional Chinese.

Anyone interested in using this package, leave a comment here.

Written by binhng

May 3, 2011 at 12:02 am

Posted in Uncategorized

Tagged with

JDBC Commnunications link failure

leave a comment »

This is a post about how to install the JDBC driver for MySQL and how I resolved the error "CommunicationsException: Communications link failure".

To create a Java program that make use of a MySQL database, first you have to install Connector/J — JDBC driver for MySQL.

After download the file mysql-connector-java-5.1.16.tar.gz (5.1.16 is the version as of this writing) from, extract it and copy the file mysql-connector-java-5.1.16-bin.jar to /usr/lib/java/jre/lib/ext/

You can pick any simple Java app using Google. The following is the full Java error from the commandline (the Java app was compiled successfully):

Exception in thread "main" com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
	at java.lang.reflect.Constructor.newInstance(
	at com.mysql.jdbc.Util.handleNewInstance(
	at com.mysql.jdbc.SQLError.createCommunicationsException(
	at com.mysql.jdbc.MysqlIO.(
	at com.mysql.jdbc.ConnectionImpl.coreConnect(
	at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(
	at com.mysql.jdbc.ConnectionImpl.createNewIO(
	at com.mysql.jdbc.ConnectionImpl.(
	at com.mysql.jdbc.JDBC4Connection.(
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
	at java.lang.reflect.Constructor.newInstance(
	at com.mysql.jdbc.Util.handleNewInstance(
	at com.mysql.jdbc.ConnectionImpl.getInstance(
	at com.mysql.jdbc.NonRegisteringDriver.connect(
	at java.sql.DriverManager.getConnection(
	at java.sql.DriverManager.getConnection(
	at de.vogella.mysql.first.MySQLAccess.readDataBase(
	at de.vogella.mysql.first.test.Main.main(
Caused by: Connection refused
	at Method)
	at com.mysql.jdbc.StandardSocketFactory.connect(
	at com.mysql.jdbc.MysqlIO.(
	... 16 more

There’s load of solutions floating on the Internet and these two provide me a good understanding and also a solution to the issue:

Briefly said, the error was due to mysqld was started with the option "--skip-networking", so outside connections to the database were disabled.

On my Slackware box, although this option is commented out in /etc/my.cnf

grep 'skip-networking' /etc/my.cnf

this is also an option in /etc/rc.d/rc.mysqld. So we have to comment out the following line in that file:


Now JDBC with MySQL works beautifully.

Of course this is specific to Slackware. On other distributions, I believe there’s a similar way to disable the option "--skip-networking".

Written by binhng

May 1, 2011 at 9:08 pm

Posted in Uncategorized

Tagged with , , ,

Make Ubuntu 10.04 (Lucid) a complete system after fresh install

with one comment

Though Ubuntu is not my OS of choice (well at least for now), it is the distro i recommend for linux beginners. However, the system after fresh install is far from perfect. Default system fonts are rather large (and ugly), no flash, no capable of playing mp3, mkv, avi… Since all these features are not there out-of-the-box in a fresh system, it must be easily added so that users, especially beginners do not have to spend hours hunting solutions for these rather common problems.

Now that an LTS (Long Term Support) version of Ubuntu has been released, I spend some time to make Ubuntu 10.04 become a more efficient system.

The process should be easily employed by a linux beginner, so i think the best solution is to write a bash script to automatically run some commands to get what i want.

The script would do the following tasks:

  • Move window buttons to the right.
  • Make the system fonts more shiny and more readable. In this script, i set all fonts to size 9, except for title bar that is 8. Also, the default fonts of choice are droid fonts (they’re fonts on Google’s Android phones) which i think are the best free fonts collection out there. I set sub-pixel mode (useful for lcd screen) then i set font hinting to full level, these last two settings make firefox fonts much more readable.
  • Add computer icon to desktop, also remove volume icons from it.
  • Choose oslosl as default repo. This is one of the best repo for linux distributions i know. Also enable canonical’s partner repo.
  • Choose whether to upgrade the system to latest packages or not (default set to not).
  • Install Microsort core fonts (for web).
  • Install Adobe Flash Player.
  • Install some codecs for playing multimedia out-of-the-box.
  • Install some additional useful packages: unrar, p7zip, tree, curl, hwinfo.

Well, that’s all. I will update the script if something useful for an everyday system that i forget to add right now.

Here is the script:

Download the script, then run it:

sh /path/to/


UPGRADE=1 sh /path/to/

(will also upgrade packages to latest versions, longer to complete).

A screenshot to get the idea how it will look like
lucid screenshot

Written by binhng

May 3, 2010 at 11:55 pm

Posted in Uncategorized

Tagged with

Rebuilding rtorrent with color patch on debian/ubuntu

with 3 comments

Note: Although the following was done on Debian Squeeze, the process should be the same on Ubuntu, as long as the rtorrent/libtorrent version is 0.8.6/0.12.6

Since i use Slackware as my main os, building packages is one of the thing in the linux world that i am familiar with. On Slackware it’s just creating/modifying a SlackBuild file, downloading source, running the SlackBuild and the binary is there for you.

Now that i want to be more familiar with a deb system, i try to apply color patch for rtorrent on Debian. After googling a while, it seems that the process of building pkgs on a deb system is rather more complicated than on Slackware. You need to create many files and folders rather than just a SlackBuild on Slack.

Anyway, since rtorrent is present on Debian repos, the rebuilding of it is simpler than i thought at first. Now the steps:

1- Get the source from a Debian repo, so you can then have a building structure adhering to Debian standard

mkdir rtorrent-color && cd rtorrent-color
apt-get source rtorrent

Since apt-get source will get the sources and put them in pwd, the first command is for avoiding the messed-up.

2- Now you need to install dependencies for building. Debian has a method for this

 aptitude build-dep rtorrent

3- Get the color patch here. I got it from AUR’s rtorrent-color. At the time of this writing, the patch is for rtorrent 0.8.6, which is the version i used on Slackware/Arch/Debian Squeeze.

Put that patch into the patches folder in the Debian’s build tree

 mv rtorrent-0.8.6-canvas-fix.patch rtorrent-0.8.6/debian/patches/

4- Finally go to the extraced source folder and rebuild it

 cd rtorrent-0.8.6
 debuild -us -uc

The two flags is to tell the building process not to sign the package.

After the rebuilding is finish, the deb file is waiting for you in the parent folder rtorrent-color. Just go up and install/upgrade it

 cd ..
 dpkg -i rtorrent_0.8.6-1_i386.deb

To prevent this modified version to be upgraded to the original version in Debian’s repo, ‘hold’ it so APT will ignore each time we upgrade our machine.

 aptitude hold rtorrent

For rtorrent to show colors, some color configurations must be put into ~/.rtorrent.rc. This is from mine

 The configuration for color patch

Nice, isn’t it?
rtorrent-color in action
(Image borrowed from howtoforge).

See here if you wish to use other colors.

Written by binhng

April 16, 2010 at 3:20 pm

Posted in Uncategorized

Tagged with ,

SlackBuild for xvnkb

leave a comment »

Edit: This SlackBuild for xvnkb is now on SBo

This is the SlackBuild file for building xvnkb (A Vietnamese input keyboard for X-Window) package on Slackware.

3 patches for issues from xvnkb’s author were applied — kdeinit error on KDE3, GIMP segfault, and power overuse.

Written by binhng

March 28, 2010 at 3:27 pm

Posted in Uncategorized

Tagged with ,


Get every new post delivered to your Inbox.