Month: March 2015

Making Ubuntu and Unity faster

2015-03-28 Linux, Ubuntu No comments

Unity desktop environment consumes lot of computer’s memory. I’ve recently found good article about
4 simple tweaks to improve Unity performance on Ubuntu.

Here is the short summary of that tweaks:

Remove Unwanted Lenses

It will speed up loading data under “Super” button.

sudo apt-get autoremove unity-lens-music unity-lens-photos unity-lens-gwibber unity-lens-shopping unity-lens-video

Install Compiz Config Settings Manager

sudo apt-get install compizconfig-settings-manager

In Compiz Config Settings Manager perform the following operations:

  • Disable Animations and Fading windows
  • Set the Texture Filter to “Fast”

After that OS won’t use additional resources for performing animations.

Install Preload

sudo apt-get install preload

Preload analyzes applications, which are currently used and predicts, which applications might be used. After proper analysis, it loads to memory commonly used software. That process can drastically boost speed of loading programs and overall Ubuntu performance.

Adjusting Look & Feel of IntelliJ IDEA and Android Studio on Ubuntu

2015-03-28 Linux, Tools, Ubuntu 5 comments


In contrast to MS Windows, default installation of IntelliJ IDEA, Android Studio and other JetBrains IDEs, in my opinion, doesn’t look good in Ubuntu with Unity. Unfortunately, adjusting look of my favorite IDE is a common problem right now and it was reported to JetBrains issue tracker. Luckily, we can perform a few tweaks, to improve its look & feel ourselves.

Enabling HUD

Some Java applications don’t have Head Up Display (HUD) enabled by default. The same problem occurs in IntelliJ IDEA. I’ve described that in article about software for common users on Ubuntu. HUD is characteristic element for Unity environment and it’s similar to Apple OS X. I think, it’s useful and allows to have more space on the screen. In addition, I wanted my IDE to behave in the same way as other applications. In order to enable HUD, we have to install additional software:

sudo add-apt-repository ppa:danjaredg/jayatana
sudo apt-get update
sudo apt-get install jayatana

Hint: We can skip this step if we’re using different Windows Manager than Unity (e.g. Gnome).

Font fix

IntelliJ IDEA has problem with font anti-aliasing on Ubuntu. In order to resolve that problem, we need to install Font Fix for Open JDK.

sudo add-apt-repository ppa:no1wantdthisname/openjdk-fontfix
sudo apt-get update
sudo apt-get install openjdk-7-jdk

Preparing run script

To finalize font fixing process, we need to prepare additional shell script, place it in the bin/ directory with the IDE and run IntelliJ IDEA with that script. Below, I present source of my scripts for IntelliJ IDEA and Android Studio. We can create scripts for other JetBrains IDEs (e.g. PyCharm) in the same way.

# change to your location
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64

# Note: Can modify $IDEA_HOME/bin/idea{,64}.vmoptions
# instead of setting here.
# "-Dawt.useSystemAAFontSettings=on" seems worse to me
# "-Dsun.java2d.xrender=true" makes fonts darker
export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=lcd \
                      -Dsun.java2d.xrender=true \
                      -Dswing.aatext=true \
# Having this set makes menu font size smaller (wtf?)
export GNOME_DESKTOP_SESSION_ID=this-is-deprecated
exec $IDEA_HOME/bin/ "$@"

# change to your location
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64

# Note: Can modify $ANDROID_STUDIO_HOME/bin/studio{,64}.vmoptions
# instead of setting here.
# "-Dawt.useSystemAAFontSettings=on" seems worse to me
# "-Dsun.java2d.xrender=true" makes fonts darker
export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=lcd \
                      -Dsun.java2d.xrender=true \
                      -Dswing.aatext=true \
# Having this set makes menu font size smaller (wtf?)
export GNOME_DESKTOP_SESSION_ID=this-is-deprecated
exec $ANDROID_STUDIO_HOME/bin/ "$@" 

Configuring fonts & appearance

I wasn’t satisfied by default font configuration of IntelliJ IDEA and Android Studio, so I updated it a little. In my opinion, it looks better after such operation. You can see my configuration on the screenshots below. Screenshots are from Android Studio, but configuration can be the same for all JetBrains IDEs. Of course, I also prefer Darcula theme.



Finishing configuration & system reboot

When we performed all of the tasks mentioned in the steps above, we need to perform reboot of the system. After that, our IDE and its fonts should look fine. That’s it. I hope it will be helpful for you.

Static Code Analysis in Android project

2015-03-26 Android, Continuous Integration, Static Code Analysis, Unit Tests No comments


I’ve recently read great article telling how to improve quality and syntax of your Android code by Vincent Brison. It presents how to use tools like Checkstyle, Findbugs, PMD, and Android Lint for Static Code Analysis in Android project. Static Code Analysis allows us to keep consistency of the source code style and helps us to find errors, warnings, possible bugs, bottlenecks and ways to improve the projects. I highly recommend to use tools like those mentioned.


Visit repository at:
The most important files are:

We can run analysis by executing the following command:

./gradlew check

Besides that, we can run each command like checkstyle, findbugs, pmd or lint separately if we want to.
In addition, when we build the project with command:

./gradlew build

check command will be executed as well, because of the following line in quality.gradle file:

check.dependsOn 'checkstyle', 'findbugs', 'pmd', 'lint'

After that, we can find output with our reports in directory: app/build/reports/. Of course, we can customize output directory and names of the report files. In default configuration, check command with generate reports in HTML format. Only output from the checkstyle operation will be generated in XML format. We can customize findbugs, pmd and lint, to generate XML reports instead of HTML reports in quality.gradle file.

Sensitivity of the build

We can customize rules of the Static Code Analysis tools in restrictive and non-restrictive way.
In findbugs and pmd task, we can set ignoreFailures attribute as follows:

ignoreFailures = false

When it’s set to false, tasks will only generate reports, but when we set it to true, build will fail, when at least one error will be found.
In lint task, we can customize attribute abortOnError as follows:

abortOnError true

It will literally abort the build, when any lint error occur. Warnings will be ignored. When we want to ignore errors, we can set this attribute to false.

Static Code Analysis on CI server

When we want to perform Static Code Analysis on CI server, we can do it easily from the command line interface. If we want to automatically collect and analyze reports generated by mentioned tools, we should generate them in XML format instead of HTML, so they can be parsed by appropriate plugins. Mentioned tools can be easily integrated with Jenkins CI server.
We need the following plugins:

After installing those plugins, we can define post-build actions in our Jenkins Job, provide paths to the appropriate XML reports and then we can view results of the reports and trend graphs directly from web panel of our Jenkins server.

Exemplary trend graphs looks as follows:


If we have unit tests in our project, we can also generate test reports and monitor test trend.
In the chart below, failed build don’t have generated test reports that’s why chart may look strange. In addition, number of tests was decreased, because they were migrated from JUnit3 to JUnit4. In JUnit3 for some reason each test case is treated as an additional unit test. JUnit4 report shows real number of tests.


In every build, we can browse generated reports and their details.


I really recommend to use Static Code Analysis tools and reporting plugins on CI in the projects, because they will increase quality of the code really fast and will allow to eliminate many errors before shipping the application.

The One Hacker Way – a rational alternative to Agile

2015-03-22 Agile, Software Development, Video Talks No comments

Recently, I’ve seen an unusual talk about The One Hacker Way – a rational alternative to Agile by Erik Meijer.
It’s really interesting point of view. I recommend to see it.

One Hacker Way – Erik Meijer from Reaktor on Vimeo.

Mockito on Android

2015-03-15 Android, Unit Tests No comments


When we write unit tests for an Android application, sometimes there’s a necessity to mock some classes or interfaces. Instead of writing implementations dedicated for unit tests by hand, we can use Mockito library. We can read article about Mockito on Android on Square’s blog. Mockito can make our tests cleaner and better. It can be used both in classic Java projects and Android projects. It’s one of the most popular mocking framework in Java and if you’re a Java developer who writes unit tests and tries to apply TDD approach, you should be familiar with it.

Sample configuration

When we want to use Mockito on Android, we have to remember to add dependency to dexmaker 1.0 and dexmaker-mockito 1.0.

Sample test configuration in build.gradle file can look as follows (I’ve added more comments to clarify optional doubts):

dependencies {
    // our project dependencies go here...

    androidTestCompile '' // Android testing support library
    androidTestCompile('') { // Google's library for assertions (not required by Mockito)
        exclude group: 'junit' // Android has JUnit built in
    androidTestCompile '' // required by Mockito
    androidTestCompile '' // required by Mockito
    androidTestCompile 'org.mockito:mockito-core:1.9.5'

We should also add information about tesInstrumentationRunner to build.gradle file when we are using it.
When we have problems with running our tests, we should configure packagingOptions properly.

android {
    defaultConfig {
        testInstrumentationRunner ""
    packagingOptions {
        exclude 'LICENSE.txt'
        exclude 'META-INF/LICENSE.txt'


Quotation from Mockito website:

  • Do not mock types you don’t own
  • Don’t mock value objects
  • Don’t mock everything
  • Show love with your tests!


Quality Excites 2015 – Call For Papers

2015-03-12 Conferences No comments

Quality Excites (QE) is a Polish nationwide conference on software quality dedicated to the professionals who use the newest technologies and the best practices. It’s dedicated to people who want to exchange knowledge and experience in order learn about innovative concepts that could improve the quality of developed products.

If you want to become a speaker at Quality Excites, you can send your application by April 10, 2015.

Conference will take place in Gliwice, Poland on 30th of May 2015.


Start Bootstrap – clean open-source website templates

2015-03-08 UI, Web Development No comments

I recently found Start Bootstrap website. It contains free, elegant & simple open-source website templates, which can be used in any web project. E.g. private site, blog, company website, website of a product, admin panel, dashboard or web interface for a specific back-end.

What I like most is the fact that these templates are hosted as open-source repositories on GitHub at: and are continuously maintained. In addition, every template has its own repository. Links to these repositories are provided in file in mentioned main repository and on the website. Nicely done.