Gentoo Linux: Ugly fonts in NetBeans and how to fix them

I recently installed Gentoo GNU/Linux + KDE 5 on my dev machine. One thing that was bugging me was the crappy font rendering in NetBeans.

To relolve the problem, locate your netbeans.conf file. Usually under /etc in your NetBeans installation folder, and append to netbeans_default_options the follwing:

-J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=lcd --laf Metal

This will enable font smoothing in SWING and use default system settings for font smoothing. The last entry –laf Metal sets the preferred UI theme for the IDE, it should be Swing based theme such as Metal or Numbus.

Happy coding 🙂

ERROR: dev-python/cryptography-1.1.2::gentoo failed (compile phase)

Latest

emerge --sync
emerge --update --deep --newuse @world

broke “dev-python/cryptography” on my development “server”. By server I mean Intel Celeron at 400Mhz with 768Mb of RAM. Currently running MySQL, Apache, Apache Tomcat, Samba and Deluge.

i686-pc-linux-gnu-gcc -O2 -march=pentium2 -pipe -fomit-frame-pointer -fno-ident -fPIC -I/usr/include/python2.7 -c /var/tmp/portage/dev-python/cryptography-1.1.2/work/cryptography-1.1.2-python2_7/temp.linux-i686-2.7/_openssl.c -o /var/tmp/portage/dev-python/cryptography-1.1.2/work/cryptography-1.1.2-python2_7/temp.linux-i686-2.7/var/tmp/portage/dev-python/cryptography-1.1.2/work/cryptography-1.1.2-python2_7/temp.linux-i686-2.7/_openssl.o
/var/tmp/portage/dev-python/cryptography-1.1.2/work/cryptography-1.1.2-python2_7/temp.linux-i686-2.7/_openssl.c:2096:15: error: ‘SSLv2_method’ redeclared as different kind of symbol
 SSL_METHOD* (*SSLv2_method)(void) = NULL;

As the build error says dev-python/cryptography is looking for SSLv2. Doing

equery u openssl
[ Legend : U - final flag setting for installation]
[        : I - package is installed with flag     ]
[ Colors : set, unset                             ]
 * Found these USE flags for dev-libs/openssl-1.0.2h-r2:
 U I
 + + asm                : Support assembly hand optimized crypto functions (i.e. faster run time)
 + + bindist            : Disable EC algorithms (as they seem to be patented) -- note: changes the ABI
 - - cpu_flags_x86_sse2 : Use the SSE2 instruction set
 - - gmp                : Add support for dev-libs/gmp (GNU MP library)
 - - kerberos           : Add kerberos support
 - - rfc3779            : Enable support for RFC 3779 (X.509 Extensions for IP Addresses and AS Identifiers)
 - - sctp               : Support for Stream Control Transmission Protocol
 - - sslv2              : Support for the old/insecure SSLv2 protocol -- note: not required for TLS/https
 + + sslv3              : Support for the old/insecure SSLv3 protocol -- note: not required for TLS/https
 - - static-libs        : Build static versions of dynamic libraries as well
 - - test               : Workaround to pull in packages needed to run with FEATURES=test. Portage-2.1.2 handles this internally, so don't set it in
                          make.conf/package.use anymore
 + + tls-heartbeat      : Enable the Heartbeat Extension in TLS and DTLS
 - - vanilla            : Do not add extra patches which change default behaviour; DO NOT USE THIS ON A GLOBAL SCALE as the severity of the meaning changes
                          drastically
 + + zlib               : Add support for zlib (de)compression

Reveled that OpenSSL is build with ought SSLv2 suport. Adding sslv2 use flag for OpenSSL and rebuilding resolved the problem.

echo "dev-libs/openssl sslv2" > /etc/portage/package.use/openssl

According to me, this is a bug in “dev-python/cryptography“. The ebuild should do some kind of checking if sslv2 use flag is enabled, or it should introduce use flags controlling the version of ssl used.

Hyper-V: How to change screen resolution in CentOS / Red Hat Enterprice Linux virtual machine

I’m thinking of doing a switch to GNU/Linux as my desktop OS yet again! (My last GNU/Linux desktop experience lasted for 5 years, then back to Windows.) This time giving CentOS 7 a try.

Why CentOS? I particularly like that, it’s one of the few GNU/Linux distributions out there providing LTS, which means I will have a stable development machine for at least 2 – 3 more years.

Making a decision to migrate or stay with Windows among other things is testing various aspects of the distribution such as how things works out of the box, installing various development tools / applications required for my area of work, etc..

For testing, CentOS 7 was installed on Hyper-V virtual machine. What I didn’t liked after the installation was the screen resolution that the machine was set to (1152×864) with now way of chaining it either from KDE System Settings or Hyper-V virtual machine properties.

After a bit of digging I learned that there is a frame buffer driver for Hyper-V and that CentOS unlike other distributions I have worked with, provides a tool called grubby for managing grub.cfg. It’s way easy to work with grubby than editing “/etc/default/grub” for example and running update-grub.

To set the desired screen resolution under Hyper-V. Open a terminal, and su. Then execute:

grubby --update-kernel=ALL --args="video=hyperv_fb:1280x1024"

and reboot the system.

NOTE: Replace 1280×1024 with the desired screen resolution.

See grubby man page if you need further info on what the a bought line does.

Eclipse Hotkeys Fix

Eclipse, IDE, Java

Eclipse on GNU/Linux has an annoying bug with hotkeys for users with multiply keyboard layouts.

For example when the user is working with the English keyboard layout, hotkeys such as “Ctrl-C”, “Ctrl-V” will work as expected, but when switched to different layout (ex: Bulgarian) the keys will no longer work.

After a bit of searching I found a fix for this inconvenience at GitHub.

Thank you “amozzhuhin“!

Console screen resolution (frame buffer) with NVIDIA drivers on Ubuntu, Debian or Linux Mint

After the installation of the proprietary NVidia graphics drivers on Ubuntu, Debian or Linux Mint your console screen resolution will be messed up. As a developer I use the frame buffer console from time to time and I need it at the resolution of my primary monitor (1680×1050). To address the problem (as it’s almost always with GNU/Linux) we need to edit some configuration files and issue some commands.

First start Konsole or other terminal emulator, login as root by typing:

su

and enter your password when prompted.

Using vim, nano or your favourite command line text editor, open /etc/grub.d/00_header. In the example below we are using Vim.

vim /etc/grub.d/00_header

Search for “set gfxmode=${GRUB_GFXMODE}” and below that line add

set gfxpayload=keep

Save and close the file.

Reboot your system and at the Grub2 screen press ‘C’ and type ‘vbeinfo‘. Take a note on the supported frame buffer resolution and choose the one you like. In my case the chosen resolution was 1680x1050x32. Type ‘exit‘ or reboot your system from the restart button.

Start GNU/Linux again, start a terminal emulator, login as root (by typing su) and open “/etc/default/grub“. Uncomment the line “GRUB_GFXMODE=640×480“, change the value after the = sign to the previously chosen screen resolution. In my case:

GRUB_GFXMODE=1680x1050x32

and add the following line below:

GRUB_GFXPAYLOAD_LINUX=keep

Save and close the file.

Still logged as ‘root’ execute the following commands:

update-grub2
update-initramfs -u

Reboot your system. You should now have a frame buffer console with a decent screen resolution.