Technical Stuff

81 posts

Assorted technical stuff of all kind.

Eclipse theme after Linux Mint Upgrade

A while ago I wrote about a theming issue with Linux Mint and Eclipse. It took a while longer than expected, but the change finally made it into Linux Mint in version 17.1.

However, starting with Linux Mint 17, there seems to be a new issue. Not that dramatic like the old one, but still somewhat annoying. The default Linux Mint theme (Mint-X) chooses a light gray base color value as a background. This might look nice in most applications, however the mixture of Eclipses (E4) recent approach to create its own theming over the operating system, somewhat collides with that.

Text editors and the tree view inherit a light gray background from the operating system theme, while other Eclipse background elements stay white.

There seems to be a simple fix for that however. Edit the file /usr/share/themes/Mint-X/gtk-2.0/gtkrc and change the first real line from:

[code]gtk_color_scheme = "bg_color:#d6d6d6\nselected_bg_color:#9ab87c\nbase_color:#F7F7F7" # Background, base.[/code]

to:

[code]gtk_color_scheme = "bg_color:#d6d6d6\nselected_bg_color:#9ab87c\nbase_color:#FFFFFF" # Background, base.[/code]

However, and that is why I stumbled over this after the upgrade to Mint 17.1, this change will be overridden after an upgrade of the theme package. This never happened one in version 17, but you never know.

Note: It is also interesting that Eclipse/SWT seems to use GTK 2 instead of GTK 3. If you have some information in that, please drop me a line!

Package Drone 0.0.3

There is a new version of package drone – 0.0.3!

See the release notes on github for Version 0.0.3

Beside a lot new features, which are described in the release notes, the two most interesting topics are:

Two working workflows

Now depending on the channel configuration it is now possible to run channels either for Maven Tycho or by manually uploading artifacts. The output always can be consumed as P2 repository.

With Maven Tycho the P2 metadata created by Tycho gets uploaded and used by the P2 adapter to create the P2 repository data.

In plain OSGi mode Package Drone extracts the dependency information directly from the uploaded artifacts and uses it in order to create virtual P2 meta data file. In both cases the P2 adapter uses the same way to construct the final repository.

For the plain OSGi mode it is also possible to create a generated P2 feature artifact. For this a new instance of a generated P2 feature is created, the meta data like Feature ID, version, etc are manually provided, and package drone will add all bundles in the channel to the feature automatically, so that there always is a feature available for plain OSGi bundles.

The plain OSGi mode is extremely interesting if you need to consume OSGi bundles which are hosted on Maven Central, but have no P2 repository available.

Which hopefully will also be one of the next features in package drone, a replicated artifacts, from Maven Central (or any other Maven 2 repository).

The replacement of spring

I started with Spring WebMVC in order to have an easy start. The idea always was to have a OSGi style, modular application. And Spring simply can provide the base for that. While Spring might be a nice framework for monolithic web applications, it simply is not modular enough for OSGi. Yes, you head right, Spring is not modular enough. First of all, Spring cannot be brought into the OSGi environment, working between bundles. Having one bundle with all and everything inside is ok. But splitting it up seems impossible.

In the past there was Spring Dynamic Modules (Spring DM), which changed to Eclipse Virgo now. However Spring DM is dead and Eclipse Virgo seems only provides part of what you need, and almost nothing when it comes to the web.

So the solution was to write a small web dispatching layer, use the idea of Spring’s @Controller mechanism and use real OSGi. Controllers now get registered as OSGi service, once they have all their dependencies met. A central dispatcher servlet provides access to all controllers, no matter which bundle registers them. Once the service is gone, the controller is removed. By having real dynamic services it is easily possible to add new functionality, menu entries, resources during runtime, running in the same web context. Install and update plugins, perform a simple setup, things that every PHP web application can do.

Of course the downside is, that part of Spring’s functionality gets replicated, but it simply was to much trouble to split off parts of Spring WebMVC.

Releasing “Package Drone” 0.0.1

A package repository for Maven Tycho, OSGi and all the rest.

Itch: I want to have a software repository where Maven Tycho can deploy to and P2 can read from. Also I would like to re-use this repository as an OBR or OSGi R5 repository, and possibly as Maven repository.

Scratch: Package Drone, version 0.0.1

Now there already is the Nexus Repository and the Nexus Unzip Plugin. However this essentially uploads a full P2 repository ZIP file and uses Nexus as a plain web server, hosting that zipped P2 repository.

Instead I would like to not only have a P2 repository, but also an OSGi R5 repository, based on the same OSGi bundles uploaded. I would also like to upload bundles created by the Maven Bundle Plugin, or BNDtools. Also would I like to make a full, Maven like, release using Tycho and later host this as a Maven 2 repository. Now package drone is not quite there yet, but the basic Tycho Deploy -> P2 Consume workflow already works to some degree.

Package Drone is hosted on github and there is a small readme and wiki.

Be warned, this is alpha quality software. If it works for you, fine. If not please help me fix it!

Google Play Store Forums

Dear Google,

since I did not find a better play to post this idea, I just did it right here ;-)

For openSCADA, the open source project I am working on, we use Google Groups as a communication channel with end users. This works quite fine actually, and I think that Google Groups are a fine instrument for that.

Sadly, when I browse through the Play Store, reading comments on apps, very often I find comments like “How can I…”. The comments, and also the possible replies are misused a form of forum, or back and forth communication channel. The next this is that the original comment gets updated to reflect a reply. All this is quite irrelevant, when I want to check if the app is worth a download or not.

On the other hand, my experience with Google Groups is, that very often users already help each other, and only when the question remains open for some time, or the question is rather specific we answer it ourselves.

I why don’t you just allow an automatic “per-app” Google Group, integrated into the Play Store App (but also accessible using the normal Google Group Website), to let users write about the app, provide self support, and provide a support forum for the application developer.

Well, I hope you read it some time.

You know were to find me ;-)

OSGi EE – Modular Web Applications

Creating a modular web application in Java still is a tricky task. While there has been some improvement with web fragments, this still is far away from what you actually want.

But what is it that you (or better I) want:

  • Modularity – Make the application extensible using plugins. Not just one big block. Install additional functionality with a few clicks
  • Easy setup – Setting up a JEE server like JBoss can be a pain in the ass. First you have to configure your datasource with some obscure XML file. It would be way better to be directed to some sort of setup screen, asking for all database (etc.) information first. Guiding you through a setup process. With JEE your web application won’t even start if your JPA data source cannot be loaded since the driver is not specified.

Now there are a lot of applications which provide this flexibility. Atlassian, Jenkins, and a few more, all do a great job. Most PHP web applications guide you through a web setup when you first install the software. So why can’t Java do this out of the box?

When you think of modularity and services, OSGi immediately comes into my mind. However “the Web” still is a strange place for OSGi setups. Yes you can register a servlet with OSGi and access it through “http”. But that is just the start. You want JSP, Form Validation, maybe even Spring WebMVC.

There are a few setups I stumbled over, pax runner with pax web. However they bring in a pretty old jetty 7, when there is jetty 9.2.x with Servlet 3.1 support. There are some Apache Karaf tutorials, however there is also no JSP support, just a custom Vaadin bridge.

Jetty 9.2.x claims to have OSGi support out of the box. In combination with Eclipse Equinox this should be an easy setup. And although it really works, you know what you have to do. I got it working in the Eclipse IDE, but it still provides most things you really want.

In order to be able to reproduce it myself, I made a few ant script and sample projects out of what I learned and decided to put them up on github.

So if you want to build modular web applications with Jetty, Equinox, Eclipse, Hibernate Validation, Spring WebMV and more (with a recent version of all components) you can have a look at https://github.com/ctron/osgiee.

If you have more examples working or find a bug, please let me know ;-)

IEC 60870 Explorer

Finally we put a few functions and classes together that we already had, and made a simple, easy to use and jet powerful tool which we would liked to have ourselves ;-) Sadly it did not exist when we would have needed it, so we had to make it ourselves.

A simple tool to access data from an IEC 60870-5-104 device. Just browse the values and send some commands.

There are already a few products out there in this area, but either are they expensive and very complex applications that provide a lot more than you actually need. And are nearly unusable if you don’t know what it is all about. Or they are simply crap.

Here is our approach to this problem: The IEC 60870-5-104 Explorer.

Creating Mac OS X Icons (icns) on Linux

Time again for some new icons for an Eclipse RCP launcher. While The Gimp can easily create XPM and Windows ICO files, when it comes to Mac OS “icns” format, you won’t have any built in support.

There are some fine tools out there for Mac OS, but if you are running Linux and don’t want to buy a Mac just for creating some icon files, png2icns comes to the rescue. It is a small command line tool which simply creates an “icns” files from some “png” files.

Create your icon files as “png” in multiple resolutions. If you are creating an Eclipse RCP launcher, you will, most likely, have them anyway for creating your Windows “ico” file. Place them in any folder you like:

-rwxr-xr-x 0 jens jens   1427 Feb 24 10:49 icon_16px.png
-rwxr-xr-x 0 jens jens   2003 Feb 24 10:49 icon_32px.png
-rwxr-xr-x 0 jens jens   2560 Feb 24 10:48 icon_48px.png
-rwxr-xr-x 0 jens jens   5304 Feb 24 10:48 icon_128px.png
-rwxr-xr-x 0 jens jens   9883 Feb 24 10:47 icon_256px.png

Ensure that you have the “png2icns” application installed. On Ubuntu it comes with the package “icnsutils”, which can simply be installed by executing:

sudo apt-get install icnsutils

Now call “png2icns”. As the man page suggest you need to provide all PNG files, that you want to be part of the icon, as argument. The first argument is the output filename. Also you can let the shell find the correct PNG file by using the wildcard (*):

png2icns icon.icns icon_*px.png

Easy! ;-)

PS: If anything goes wrong, “png2icns” will complain at the command line (e.g. due to some wrong resolution).

Fixing the Mint-X theme for Eclipse/SWT

If you are running Mint, Eclipse and you like the Mint-X theme, you might be a bit frustrated every time you open up Eclipse. Especially with Eclipse 4.2 the design of the toolbars is pretty messed up. See the launchpad bug entry: https://bugs.launchpad.net/linuxmint/+bug/1168281

eclipse1

Gladly this is only a minor glitch which can be fixed easily. Hopefully the change of the github pull request will find its way into Mint.