Skip to main content

Posts

Base64 Variants in Java 8

You most likely used Base64 encoding. It’s about encoding any sequence of data as a printable string (digits, lower case and upper case letters). But Base64 has variations. E.g., not every Base64 variant allows safe transfer of any data as URL parameters. For that purpose there is a special dialect of Base64: Url-safe encoding.

The Essential Plugins for JetBrains Idea

JetBrains Idea is my favorite IDE and I love it! It has allthe necessary features for java/kotlin developer out-of-the-box. Even in Community Edition you’ll find a lot of them! Difference between Community and Ultimate editions is with a set of plugins from JetBrains available. Native plugins are well tested and work like a charm, in contrast with Eclipse, where you have to do install/configure some extra plugins before you can start coding. I mean maven integrations (.m2eclipse).

For commercial plugins there are some free alternatives e.g. Database Navigator for database support. There are some more free plugins useful both for Community and Ultimate editions.

Here is my list:

There are hundreds of plugin for IDEA_Community Edition and IDEA Ultimate available in the plugin repository. I am sure you can add some plugins you love to this list.

Conditional Java Configurations in Spring Framework

Spring Framework offers very flexible means for binding application components. Externalizable properties, composite configuration, nested application contexts and profiles.

Sometimes, it is necessary to control whether particular beans or @Configuration will be loaded or not. Spring Framework v.4.1.x does not provide that feature out of the box. But, hopefully, Spring allows conditional bean initialization (see @Profile implementation and @Configurable). So, I created the annotation @Enabled which allows me to control bean instantiation via properties.

@Enabled indicates that a component is eligible for registration when evaluated expression is true. This annotation should be used in conjunction with Configuration and Bean annotations.

JDBC Driver Settings for Oracle RAC

If you are modifying your java application to use Oracle Real Application Clustered (RAC) Database instead of standard single-node database server (Express or Standard edition), then you need to modify settings of your JDBC driver.

Useful Code Templates for Jetbrains Idea

Jetbrains Idea is a perfect IDE (sorry, Eclipse fans). But, like every tool, sometimes it needs some customization to fit your needs. Today I want to show how to adjust it’s code-generation templates.

When you generates a new class or method using Idea, it creates one using predefined templates. You may modify that template in “Settings -> File and Code templates” section.

Modifying file

WebJars: Easy Packaging Client Libraries

When developing java web application it is often annoying to manage third-party javascript libraries. Especially, when it is necessary to upgrade some of them.

The project “WebJars” makes a life easier for such lazyefficient developers, like me :-)

There is a wide range of popular javascript libraries packaged int Jar archives and ready to be included as a dependencies into your project. It is described in the documentation how to configure resource mapping in a web framework of your choice.

Jolokia: HTTP/JSON bridge for JMX

Very often there is a need to monitor the Java application server. For example, external monitoring tool, like Nagious/Zenoss/Zabbix needs to get some metrics, like heap memory usage or thread count.

Usual way to get that metrics is to setup access to application server via JMX.

But, sometimes, it is not possible to leave some other port opened for JMX and the only port available is HTTP(80 or 8080) or HTTPS(443 or 8443).

Here the Jolokia comes to rescue!