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 http://www.mysql.com/downloads/connector/j/, 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(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
	at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116)
	at com.mysql.jdbc.MysqlIO.(MysqlIO.java:344)
	at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2333)
	at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2370)
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2154)
	at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:792)
	at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:47)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
	at java.sql.DriverManager.getConnection(DriverManager.java:582)
	at java.sql.DriverManager.getConnection(DriverManager.java:207)
	at de.vogella.mysql.first.MySQLAccess.readDataBase(MySQLAccess.java:22)
	at de.vogella.mysql.first.test.Main.main(Main.java:8)
Caused by: java.net.ConnectException: Connection refused
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
	at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
	at java.net.Socket.connect(Socket.java:529)
	at java.net.Socket.connect(Socket.java:478)
	at java.net.Socket.(Socket.java:375)
	at java.net.Socket.(Socket.java:218)
	at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:257)
	at com.mysql.jdbc.MysqlIO.(MysqlIO.java:294)
	... 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:
http://stackoverflow.com/questions/2983248/jdbc-with-mysql
https://bbs.archlinux.org/viewtopic.php?pid=721345

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
#skip-networking

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

SKIP="--skip-networking"

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: ubuntu_after_install.sh

Download the script, then run it:

sh /path/to/ubuntu_after_install.sh

OR

UPGRADE=1 sh /path/to/ubuntu_after_install.sh

(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
done_fg_color=2
#done_bg_color=3
active_fg_color=1
#active_bg_color=5

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 ,

Follow

Get every new post delivered to your Inbox.