Fix NetBeans big fonts on Ubuntu

There is a rather annoying issue related with NetBeans displaying large fonts on Ubuntu for menus and panels. There are some suggestions on Ubuntu forums related with java fonts settings, but there are a couple of better solutions which may improve the way NetBeans looks on Ubuntu when it comes to font size.

The default Netbeans look and feel on Ubuntu looks like this:

NetBeans default look and Feel on Ubuntu

The integration with the default theme is great, except for the large fonts.

Lower the application font

The first solution consist in lowering the font used for applications. By default Ubuntu is using for applications the Ubuntu font family with a size of 11. Go to the “Fonts” tab on “Appearance Preferences” window (right-click on Desktop, select “Change Desktop Background”) and set the “Application” font (highlighted in below image) to 10.

Appearance Preferences

The fonts should be better now in NetBeans, but the downside is that all your applications’ fonts will be smaller. If you can live with that, great! If not, here goes another solution.

Use the Nimbus look and feel

The second solution is using the java Nimbus look and feel. Nimbus may be best described as a skin for java applications, thus this tip applies not only to NetBeans, but to other java applications as well.

In order to specify the look and feel, edit the “netbeans.conf” file (usually the file is placed in “<netbeans_installation_directory>/etc/”), find the “netbeans_default_options” option and insert the following values right before the last quote:

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

With the Nimbus skin, Netbeans should look likw this:

Nimbus look and feel tip thanks to Geertjan’s Blog

Fix for Google Chrome crash after startup

The issue with Google Chrome was that it crashed in about 3 seconds after startup. I encountered this problem using Chrome 9 and 10 beta on Ubuntu 10.10, but this fix may apply to other versions and operating systems as well.

I’ve tracked the problem as being related with the account (data) synchronization. After disconnecting my internet connection it did not crashed anymore, so I went to the Preferences page (Wrench -> Preferences -> Personal Stuff) and stopped the account synchronization. Then closed Chrome, restored the Internet connection, restarted Chrome and everything went OK.

Trying to re-enable the account synchronization just caused another crash, thus this is definitely the cause of my Chrome problems. Strangely I was able to re-enable the sync after several days, but the problem also re-appeared after restarting Chrome.

Extract audio from video file

Since there are so many tools (Minitube, youtube-dl) which allows you to download video files from YouTube or other video sharing sites, let’s go one step further and extract the sound from the downloaded video file to a mp3 file.

The FFmpeg tool will do the trick just fine. Thus assuming that you have the video file “My Video File.mp4” and you want to extract  the sound into “My Sound File.mp3 ” use the following command:

ffmpeg -i "My Video File.mp4"  -ab 128 "My Video File.mp3"

With the “-ab 128” parameter you specify that the audio bitrate should be 128k. Additionally the “-ar” parameter may be used for the audio sampling frequency but by default it is set to 44100, which should be ok.

On Ubuntu it may be necessary to add the Medibuntu repository and install the libmp3lame codec. For FFmpeg the audio codec can be specified using the parameter “-acodec”.

Use your browser to decode base64 encoded data

If you are dealing with base64 encoded data you may find useful to know that any modern browser can easily decode it using the Data URI scheme. All you need is pass the encoded data to the browser in the same way as you would enter a regular URL, but of course using the correct structure of the data URI scheme:

The MIME-type and charset parameters are optional, with default values text/plain and US-ASCII but is a good practice to always specify at least the MIME-type.

An example of base64 encoded data is:

which should be decoded to:

Suggested tools for base64 encoding / decoding: