2014/09/19

Vintage photo style in Gimp

I was seeking for some way how to make a vintage effect to photos in Gimp. I discovered several tutorials and combined them together to something that works for me. Here is the recipe mainly for me not to forget it.

  1. Create three layers in the picture and fill them with colors. Listing their attributes from top to bottom in the Layers window:
    • Some "computer" blue color, the one like in old Dos times. I used 0949e9, Opacity around 17. Layer mode Screen.
    • Some pink color around e865b3, opacity 20, layer mode Screen.
    • Light yellow, like yellow paper for taking notes. My color is fbf2a3, opacity around 60, layer mode Multiply.
    • Now goes the original layer.
  2. Increase contrast to something around 21 in the original layer.
  3. Slightly decrease Hue (-9), increase Lightness (+9), and lower Saturation (-30).
  4. You can further add dark corners. Create a new layer right above the original picture. Use Eclipse selection tool to select the whole picture. Feather selection by reasonable amount of pixels (depends on the photo size, I use 150-400px). Invert selection and fill the corners with black. Set the layer opacity as desired.

More glares can be added by a separate multiplied layer with white and yellow color paintings.

2013/08/26

JBoss Developer Studio freezes with XSD, WSDL, SwitchYard editors

Recently I started facing a strange issue on my ArchLinux boxes with JBoss Developer Studio (which is an enriched Eclipse under the covers). I was not able to open XSD, WSDL or SwitchYard visual editors. Part of the GUI just froze. Clicking on the close button opened the close dialog which allowed part of the interface to be redrawn.

I was quite desperate about it. It only affected my ArchLinux x86_64 boxes. I used multiple JVMs (Oracle, OpenJDK), different window managers (Fluxbox, Openbox, Gnome Shell). I verified the same Linux kernel in Fedora does not cause the issue. So what now?

What gave me some guidance was this command I found on StackOverflow (you must provide your own process number):

cat /proc/803/maps | awk '{print $6}' | grep '\.so' | sort | uniq

I compared the libraries before and after opening the problematic editor.

39a41,42
> /usr/lib/gtk-2.0/2.10.0/printbackends/libprintbackend-cups.so
> /usr/lib/gtk-2.0/2.10.0/printbackends/libprintbackend-file.so
50a54,56
> /usr/lib/libcom_err.so.2.1
> /usr/lib/libcrypt-2.18.so
> /usr/lib/libcups.so.2

This was a trace of a pretty old Eclipse bug. Surprisingly, the bug is still present in Eclipse Kepler with Gtk 2.24.20.

I tried the suggested workarounds by disabling CUPS server in /etc/cups/client.conf and passing -vmargs -Dorg.eclipse.swt.internal.gtk.disablePrinting to Eclipse. Both helped a little, but did not make Eclipse completely usable.

What really helped me was installing cups-pdf package, enabling CUPS via

systemctl enable cups.service

Then I started the service with

systemctl start cups.service

And configured a PDF printer at localhost:631.

I cannot express my happines about running CUPS on my machine :-(

2013/05/17

Book review: Well-grounded Java developer

Vital techniques of Java 7 and polyglot programming

  • Publisher: Manning
  • Authors: Benjamin J. Evans and Martijn Verburg
  • Ranking: I would definitely recommend this book

Originally, I wanted to write a complete review of this book but I found some really good reviews already available on the internet. What I would like to say is that this book is exactly what the title reads. If you want to be a good Java developer and you mean it, you should know all the information in this book. A great thing about it is that it has a very balanced level of details. The information are presented in a compact well understandable form without wasting the reader's time. So if you did not read it yet, go to the nearest book store or library.

2013/01/03

HashMap serialization issue

Today, we discovered an interesting behaviour in Oracle JDK 7 with my colleague. This also affects OpenJDK 7. There is a change in the implementation of the HashMap serialization. If you serialize and then deserialize a HashMap, two private fields are changed. The first is threshold and the second is table. While these changes do not seem to have any effect on the public behaviour of the class, it makes various testing a little bit harder.

For example, you developed a client/server application that exchanges some objects. These objects might hold some properties in a HashMap. To test the correctness of the communication channel, you send a serialized object from the client to the server. The server deserializes the object, changes an attribute and sends the serialized version back to the client. The client performs the same changes to its version of the object and serializes it too. Then the client compares the serialized byte arrays. With JDK 7 it finds them different and this is a problem in my opinion. Or do you find it a completely insane integration test scenario? I already found it in many projects so I suppose it is not that uncommon and bad.

A reproducer can be found at GitHub. I also logged an issue with Oracle. They are now about to review it. However, I suppose they are not going to fix the issue since it does not influence the public API. Who cares about testers...

2012/09/05

How to really delete a commit from Git

I really wanted to remove a huge binary file from a Git repository that has been committed by mistake. I found a bash script on the internet but the data still remained in the .git directory.

After some changes I came to this solution that really worked for me. But do not try that at home, it might corrupt your data!

#!/bin/bash
set -o errexit

if [ $# -eq 0 ]; then
    exit 0
fi

if [ ! -d .git ]; then
    echo "Error: must run this script from the root of a git repository"
    exit 1
fi

files=$@
git filter-branch --prune-empty --index-filter "git rm -rf --cached --ignore-unmatch $files" HEAD

rm -rf .git/refs/original/ && git reflog expire --expire=now --all &&  git gc --aggressive --prune=now && git repack -a -d -l

2012/07/20

JBoss Technologies 1 in Czech

I would just like to bring your attention to my recent blog post on JBoss. The target audience is the Czech JBoss Community, so the article is in Czech only.
. .