Configuring PulseAudio with Jack Audio Connection Kit (DBus)

Configuring PulseAudio with Jack Audio Connection Kit running via DBus is pretty easy nowadays. Following procedure was tested on Gentoo Linux but it should probably apply to other Linux distributions too. Used versions of packages were media-sound/pulseaudio-2.1-r1 and media-sound/jack-audio-connection-kit-2.9999 (from pro-audio overlay).

First you should check the name of the sound card you want Jack to play sound via. Use command aplay -l to get the name of the sound card. Then run following command to set the card for Jack:

jack_control dps device hw:DX

Replace DX with the name of your sound card.

Second, we’ll make sure Jack will use Alsa for output. Following command will set Jack output to Alsa:

jack_control ds alsa

If this command fails, make sure you have Python 2.7 selected as the active Python version. jack_control does not work with Python 3.2 because new Python changed print from statement to function and Jack Python scripts are not updated yet.

Last step is to start Jack and optionally configure PulseAudio. Issue the following command:

pulseaudio -k && jack_control start && pacmd set-default-sink jack_out && pacmd set-default-source jack_in

This command line first kills PulseAudio, then it starts Jack and tells PulseAudio to use Jack by default both for input and output.

If you do not get sound from sound applications that play sound via PulseAudio, use pavucontrol to check that the sound output for given application is directed to Jack sink.

ERROR: type “hstore” does not exist

I was getting this error though I issued CREATE EXTENSION hstore;. When I used \dx+ in psql to see installed extensions, I found out that extensions are installed into schemas instead of being installed globally in the database. So the reason I got this error was that the schema in which I installed hstore was not on my search path. If you have a database with more than one schema and you want to use hstore extension, you can either put on search path the schema in which you installed hstore or you can reference hstore using schema in your SQL statements.

SET search_path = primary_schema, schema_with_hstore;

or

CREATE TABLE test (col1 schema_with_hstore.hstore);

Tags:

PostgreSQL Unix Socket vs TCP/IP Performance

I just finish a test that compares PostgreSQL speed using Unix socket and TCP/IP connection to localhost with SSL enabled. The test was performed on import on OpenStreetMap PBF file (around 17GB of binary data). The result is that loading the data via TCP/IP connection with SSL enabled was about 17% slower than loading data via Unix socket.

Unix socket:
Processing: Node(1542670k 261.2k/s) Way(146203k 26.07k/s) Relation(1518310 44.75/s)  parse time: 45446s

TCP/IP:
Processing: Node(1542670k 257.1k/s) Way(146203k 18.02k/s) Relation(1518310 38.92/s)  parse time: 53122s

Tags: ,

Configuring GNU Screen Status Bar

With default GNU Screen configuration in Gentoo (I have no experience with other Linux distributions) you get no visible user interface for the tool. To get a status bar that displays host name, list of screen windows with some usability information, system load and current date and time, you can put following line in file ~/.screenrc:

hardstatus alwayslastline '%{= G}[ %{G}%H %{g}][%= %{= w}%?%-Lw%?%{= R}%n*%f %t%?%{= R}(%u)%?%{= w}%+Lw%?%= %{= g}][ %{y}Load: %l %{g}][%{B}%Y-%m-%d %{W}%c:%s %{g}]'

You can find more information about status configuration in GNU Screen Manual.

Tags:

Running your own OpenStreetMap maps (and more)

This post collects useful links when you want to use OpenStreetMap (OSM), being it using the maps, data services or running your OSM own server. There is a lot of OSM documentation on the net which is both good and bad. Some of the documentation is already obsolete so finding the right documentation might be challenging.

General Links:

Links for using OSM:

Contributing to OSM:

Interesting Android applications:

Tags:

SSL in Apache with Intermediate Certificate

For configuration you need these files: domain.tld.key (your private key), domain.tld.crt (your public certificate) and intermediate.crt (intermediate certificate of your certificate authority).

The configuration is pretty easy. Just put these lines in your virtual server configuration:

...
SSLEngine On
SSLProtocol All
SSLCipherSuite HIGH:MEDIUM
SSLCertificateFile /path/to/domain.tld.crt
SSLCertificateKeyFile /path/to/domain.tld.key
SSLCertificateChainFile /path/to/intermediate.crt
<Files ~ "\.(phtml|php?)$">
        SSLOptions +StdEnvVars
</Files>
<IfModule mod_setenvif.c>
        SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown \
                downgrade-1.0 force-response-1.0
</IfModule>
...

Now just restart apache daemon and you’re done :-)

Tags:

SSL in Postfix with Intermediate Certificate

This article describes just how to install certificates with intermediate certificate in Postfix, it does not describe how to configure Postfix for SSL as that is pretty complex topic.

For configuration you need these files: domain.tld.key (your private key), domain.tld.crt (your public certificate) and intermediate.crt (intermediate certificate of your certificate authority).

The configuration is pretty easy (once you know the steps). First you need to create combined PEM file:

cat domain.tld.key domain.tld.crt intermediate.crt > domain.tld.pem

Next you need to change two variables in Postfix main.cf configuration file:

...
smtpd_tls_cert_file = /path/to/domain.tld.pem
smtpd_tls_key_file = /path/to/domain.tld.pem
...

Now just restart postfix daemon and you’re done :-)

Tags:

Development Version of Netbeans in Gentoo

Today I just found some time to ask for Gentoo overlay to put there my latest ebuilds for development version of Netbeans, that is for nightly builds of Netbeans 7.0. You can find the overlay at http://git.overlays.gentoo.org/gitweb/?p=dev/fordfrog.git. If you do not know how to use Gentoo overlays, you can find needed information in Overlay guide.

It is safe to give Netbeans 7.0 development a try on Gentoo as Netbeans 7.0 installs in separate slot so you can have in your system both Netbeans 7.0 and 6.9.1 and even older versions. Up to that, though it is still development version, it is pretty stable and I use it myself for my work for several weeks (maybe even months, my poor memory) already.

You might also notice that I have split the single ebuild into several ebuilds, one ebuild for each Netbeans cluster plus one for Netbeans JavaDoc. I decided to do so for several reasons.

First, for me, it’s much easier to manage Netbeans ebuilds when I can rebuild just single cluster instead of whole Netbeans on each change in ebuilds etc. I can also emerge several clusters in parallel using emerge --jobs switch. That saves some time and does not load my laptop much anyway as javac does not utilize parallel compilation.

Second, for users adding/removing clusters to/from current installation does not require complete rebuild of Netbeans anymore but you emerge or unmerge just the cluster(s) that you want, so you save some time on this. Also, the same as above applies, you can emerge several clusters in parallel and save some time.

And third, there are some applications that are built on top of Netbeans Platform, like VisualVM, so these can easily reuse dev-java/netbeans-platform package without need to pull in whole Netbeans with its huge list of dependencies.

This set of ebuilds supports applying custom patches to the Netbeans sources as the previous ebuild does. You just have to set up NETBEANS70_PATCHES_DIR variable so that it points to directory where you have the patches that you want to apply. I have this line in /etc/make.conf:

...
NETBEANS70_PATCHES_DIR="/root/patches/netbeans70"
...

If you like to tweak Netbeans to your needs, you might also want to read my article on .

Tags: ,

SSL in Courier IMAP with Intermediate Certificate

For configuration you need these files: domain.tld.key (your private key), domain.tld.crt (your public certificate) and intermediate.crt (intermediate certificate of your certificate authority).

The configuration is pretty easy (once you know the steps). First you need to create combined PEM file:

cat domain.tld.key domain.tld.crt intermediate.crt > domain.tld.pem

Next you need to change TLS_CERTFILE variable in Courier IMAP pop3d-ssl and imapd-ssl configuration files:

...
TLS_CERTFILE=/path/to/domain.tld.pem
...

Now just restart courier-imapd-ssl and courier-pop3d-ssl daemons and you’re done :-)

Tags:

NetBeans, Maven and Code Coverage

I just came across Maven Test Coverage plugin for Netbeans. It is available for Netbeans 7.0 builds. It is really useful when you write tests for your code and want to make sure your tests cover all important execution paths.

The plugin runs for you Cobertura test coverage goals and displays coverage report for the tests. It also provides higlights of code lines according to your tests code coverage.

You can find more information (installation, how to use it, …) about the plugin at MavenCodeCoverage website.

Tags: , ,