Wednesday, June 25, 2014

Migrating from bash to zsh

These are my steps in migration from bash to zsh. I’m documenting these to keep the future reference for me (and possibly other readers as well).


Check out the Slideshare presentation: Why Zsh is Cooler than Your Shell

Current shell

to find out the current shell:

ps -p $$

it’s useful during migration to make sure the new shell is really in use.


Migration itself included (on my Fedora) reconfiguring:


There exists users’ maintained collection of zsh customizations, that I found useful. Called: oh-my-zsh. (Please note the amazing Github’s - Star count. Once seeing that I didn’t doubt I’ll give it a try.)

For installation I just went for:

curl -L | sh

oh-my-zsh with powerline

I’m used to powerline everywhere ((g)vim/konsole/tmux/bash) already, so let’s keep it working in zsh as well.

I created file: ~/.oh-my-zsh/custom/powerline.zsh with contents:

. ~/.local/lib/python2.7/site-packages/powerline/bindings/zsh/powerline.zsh

Please note: You need to go for the actual location of powerline installation on your system.

and in the file: ~/.zshrc I had to comment out line:

# ZSH_THEME="robbyrussell"

otherwise oh-my-zsh theme seems to conflict with powerline one.

oh-my-zsh plugins

The real benefit of oh-my-zsh commes with plugins, so I went for those I find useful. Via changing the file: ~/.zshrc having:

plugins=(git mvn glassfish yum colored-man vagrant z common-aliases gradle)

oh-my-zsh custom stuff

As my ~/.bashrc held already quite some customizations, I migrated those to:


Even this part was nice, as I could tidy up things a bit and omit unused stuff. Moreover I decided to create multiple *.zsh files (as these are auto-loaded) to achieve modularity.


Honestly in the beginning, I had no clue how much I would enjoy my new shell.

Friday, June 13, 2014

Xfce: How to disable toolbar text in KDE apps

Recently I’ve experienced quite a funny situation. I use Krusader for file browsing that calls Kompare for file comparisons. However I was not able to copy changes from left to right (or vice versa) in the compared files, as I could not see all the toolbar buttons (these were too big). I didn’t even notice for quite some time, that there are others, not displayed on my screen.

But who needs text description in toolbars? Well, I don’t!

I remembered global setting from the Gnome world that it should be possible, so searched from the KDE equivalent.

Found it (in my Fedora + Xfce) in:

Xfce menu button -> Options (hope this one is right, as I have it as Einstellungen) -> KDE SystemOptions (for me KDE SystemEinstellungen) -> Style (Stil) -> Fine Tuning tab -> Toolbars section
where I just chose No Text in the both: Main toolbar text as well as in the Secondary toolbar text.

That did the job for me.

Apache Ant tasks for JMX access

I wanted to invoke JMX operations from the Ant tasks. However finding usable ant tasks library as well as the usage was rather tricky. So let me share my experience to make things easier for others.

Ant tasks for JMX operations

I decided to follow Tomcat documentation and used ant tasks distributed with tomcat.

Just for the record the usage is not restricted to Tomcat deployed JMX mBeans. For me it worked for java process accessible via JConsole via Remote connection.

Retrieving the library

  1. As I wanted to get the latest version I used maven central repository “search by classname” feature and searched for: org.apache.catalina.ant.jmx.JMXAccessorTask (see the query)
  2. afterwards I went for the tomcat 8 jar file (called tomcat-catalina-ant-8.0.8.jar)
  3. and just copyied the latest available to my $ANT_HOME/lib dir.


I didn’t have a chance (or motivation?) to check all the tasks available, the full list of tasks available can be seen in the zipped file: org/apache/catalina/ant/jmx/antlib.xml, following were present for me:

    classname="org.apache.catalina.ant.jmx.JMXAccessorTask" />
    classname="org.apache.catalina.ant.jmx.JMXAccessorSetTask" />
    classname="org.apache.catalina.ant.jmx.JMXAccessorGetTask" />
    classname="org.apache.catalina.ant.jmx.JMXAccessorInvokeTask" />
    classname="org.apache.catalina.ant.jmx.JMXAccessorQueryTask" />
    classname="org.apache.catalina.ant.jmx.JMXAccessorCreateTask" />
    classname="org.apache.catalina.ant.jmx.JMXAccessorUnregisterTask" />
    classname="org.apache.catalina.ant.jmx.JMXAccessorEqualsCondition" />
    classname="org.apache.catalina.ant.jmx.JMXAccessorCondition" />

out of these, I gave following a try:


For the demonstration purposes I’m using Glassfish 4.0.

Example: Listing JMX MBeans

Let’s assume we want to retrieve the MBean by name (namely: java.lang:type=Memory). Please note username and password were not required for access (otherwise they should be specified via respective properties).

Noteworthy here is the resultproperty, which could hold array from which we could get a name. So having in ant build script:

    classname="org.apache.catalina.ant.jmx.JMXAccessorQueryTask" />

    resultproperty="memory" />

<echo>Retrieved MBeans count: ${memory.Length}</echo>
<echo>The one has name: ${memory.0.Name}</echo>

results for me in following output:

 [jmxQuery] memory.Length=1
 [jmxQuery] memory.0.Name=java.lang:type=Memory
     [echo] Retrieved MBeans count: 1
     [echo] The one has name: java.lang:type=Memory

Example: Invoking operation via JMX

Here is a 2 step approach required:

  1. connect to remote server via JMX and afterwards
  2. invoke the operation on the particular MBean.

For demonstration purposes, let’s assume we want to call garbage collection (via invoking operation: gc() on MBean named: java.lang:type=Memory)

Sample ant build file chunk does the job (please note ref property value that has to be the same across these 2 tasks):

    classname="org.apache.catalina.ant.jmx.JMXAccessorTask" />

    classname="org.apache.catalina.ant.jmx.JMXAccessorInvokeTask" />

    failOnError="true" />

    delimiter=" "
    ref="glassfish" />

Further information

For more details, I recommend reading the official Tomcat documentation as well as Javadocs.

Thursday, June 12, 2014

Using Genius TVGo DVB-T03 on Fedora

My other laptop was not available and the start of Football WM 2014 was just less than 30 minutes away. Let’s see if I can watch it on my laptop with Fedora (16) with my Genius TVGo DVB-T03 device.

The most of the steps were inspired by fedora wiki:

DVB-T required package

I installed dvb-apps package via:

sudo yum install dvb-apps

Afterwards checked the file list in package via:

rpm -q --fileprovide dvb-apps

which contained also:


(please note we’ll need this one later).


I plugged in my dvb-t usb and seen after running dmesg:

[11140.318728] usb 2-1.2: new high-speed USB device number 6 using ehci-pci
[11140.397936] usb 2-1.2: New USB device found, idVendor=0458, idProduct=4012
[11140.397946] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[11140.397952] usb 2-1.2: Product: DVB-T 2
[11140.397956] usb 2-1.2: Manufacturer: Afatech
[11140.557325] usbcore: registered new interface driver dvb_usb_af9015
[11140.557753] usb 2-1.2: dvb_usb_v2: found a 'Genius TVGo DVB-T03' in cold state
[11140.557900] usb 2-1.2: dvb_usb_v2: Did not find the firmware file 'dvb-usb-af9015.fw'. Please see linux/Documentation/dvb/ for more details on firmware-problems. Status -2
[11140.557905] usb 2-1.2: dvb_usb_v2: 'Genius TVGo DVB-T03' error while loading driver (-2)

so searched a bit and found + downloaded rpm from:

Afterwards installed the downloaded firmware via:

sudo rpm -ivh dvb-usb-af9015-fw-4.95.0-1.noarch.rpm

And finally unplugged and plugged to usb again to see:

[11796.948500] usb 2-1.1: new high-speed USB device number 7 using ehci-pci
[11797.038703] usb 2-1.1: New USB device found, idVendor=0458, idProduct=4012
[11797.038714] usb 2-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[11797.038720] usb 2-1.1: Product: DVB-T 2
[11797.038725] usb 2-1.1: Manufacturer: Afatech
[11797.041521] usb 2-1.1: dvb_usb_v2: found a 'Genius TVGo DVB-T03' in cold state
[11797.042331] usb 2-1.1: dvb_usb_v2: downloading firmware from file 'dvb-usb-af9015.fw'
[11797.119176] usb 2-1.1: dvb_usb_v2: found a 'Genius TVGo DVB-T03' in warm state
[11797.542424] usb 2-1.1: dvb_usb_v2: will pass the complete MPEG2 transport stream to the software demuxer
[11797.542542] DVB: registering new adapter (Genius TVGo DVB-T03)
[11797.575204] i2c i2c-7: af9013: firmware version
[11797.578207] usb 2-1.1: DVB: registering adapter 0 frontend 0 (Afatech AF9013)...
[11797.589973] tda18271 7-00c0: creating new instance
[11797.597341] TDA18271HD/C1 detected @ 7-00c0
[11797.802656] Registered IR keymap rc-empty
[11797.802848] input: Genius TVGo DVB-T03 as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/rc/rc0/input12
[11797.803814] rc0: Genius TVGo DVB-T03 as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/rc/rc0
[11797.803825] usb 2-1.1: dvb_usb_v2: schedule remote query interval to 500 msecs
[11797.803832] usb 2-1.1: dvb_usb_v2: 'Genius TVGo DVB-T03' successfully initialized and connected

so firmware seems to work now.

Generating channels.conf

Following command did the job for me (as I’m located in Bayern):

scandvb /usr/share/dvb/dvb-t/de-Bayern  > channels.conf

Enjoying the broadcasts

There is no me-tv (that I’m used to it from Ubuntu world), still, there is a vlc, that does the job for me quite well. Just running:

vlc channels.conf

made it and I could watch the game!

Friday, June 6, 2014

Eclipse plugin for svn integration

I’ve found it tricky to install Eclipse plugin providing svn integration.

The problem is:

  • which plugin to choose,
  • which version of the plugin to choose as well as
  • which packages to install.

I’m running latest Eclipse (Kepler SR2) and plugin of my choice is subclipse.

The Eclipse plugin update site has to be chosen based on the svn version installed on the machine (check it running svn --version):

Following packages were required for installation (for me):

  • Subclipse (Required)
  • SVNKit Client Adapter (Not Required)
  • SVNKit Library

That’s it! As it covers my Eclipse/svn day-to-day workflow.