Getting abbreviated name with daylight saving of a timezone in Java 8

Recently I wanted to get the timezone abbreviation of a timezone as a string. There are many tutorials which cover that. But in all those, timezone is given in one of the following formats. "America/Los-Angeles" or "PT".

But I needed to get the abbreviation with the daylight saving such as "PST" or "PDT". Finally, I was able to get it using the following method.

ZonedDateTime currentTime;
boolean isDayLightSavingEnabled =currentTime.getZone().getRules().isDaylightSavings(currentTime.toInstant());
TimeZone timeZone = TimeZone.getTimeZone(currentTime.getZone());
String timeZoneName = timeZone.getDisplayName(isDayLightSavingEnabled, TimeZone.SHORT);

Output will be

Fix issues in upgrading Ubuntu 14.04 to 16.04

When I upgraded my Ubuntu 14.04 PC to 16.04 it restarted and terminal screen was loaded without any GUI. I fixed this by doing following steps.

First login with by entering login name(this is your username) and passwordRun sudo apt-get updateIf above step fails run the command which is given in the error. Usually this is something related to dpkg.Run sudo apt-get upgrade -fIf confirmations occurs while upgrading accept all After upgrading is done restart the computer.
If it still goes to terminal run sudo do-release-upgrade

Accessing all highcharts in a page at once

Recently I needed to call a reflow method of all hi-charts in the page for a particular event. I used following method for that.

function redrawHighcharts() {
    for (var i = 0; i < Highcharts.charts.length; i++) {

Fixing Unicode issues in Pentaho CDA

Recently I encountered problem when sending a query parameter with unicode text to Pentaho CDA. For these type of queries CDA returns an empty result set although there are matching items. After some research I fixed this issue by adding an additional parameter to the JDBC connection url. Now JDBC connection is like below.

        <Connection id="1" type="sql.jdbc">

Creating a Pentaho BI server cluster

Note - This is applicable to Pentaho BI server community edition 5.x only.

Pentaho BI server provides a large set of features which are essential for  BI applications. To use this in production we might need to create a CDA cluster to maintain high availability as well as load balancing.
To create a cluster we need to configure BI server instances to use a common data source to store configurations. I configured the following setup for this.

Follow these steps to create the cluster.

Install MySQL servers and setup master master replication.Make sure you have installed Oracle Java 7 in all nodes. Using other java versions will cause runtime errors.Follow this document to to install a CDA instance. Make sure to follow the document named "Install with Your Own BA Repository" and follow the configurations related to MySQL. Start the server and install all the components needed.Modify the cluster documentation as mentioned in this document.…

Deploying a HA Redis setup

Sentinel process takes the responsibility of electing a slave as master if a failure occurs. For more information refer  this. Install Redis in each node. Following methods can be used to install Redis.Using Ubuntu repositories. sudo apt-get install redis-serverManual installationYou can download a Redis distribution from this page Follow the instructions on this page to setup Redis using the downloaded setup requirepass property to set the password in the configuration file in /etc/redis. Note that this should be same in all nodes.Set Up replicationSet the following properties to set replication on slaves.slaveof <masterip> <masterport>masterauth <master-password> //The same password we used previouslySet masterauth property also in the master in case of master goes down and later joins as a slave (Once a slave is elected as a master). To test whether the …

Bind a remote server's port to a local port

If you have a remote server (say in Amazon EC2) you might want to access a particular port of that server. But there can be situations where it is not that port is not globally open. If you do not want to bother making it globally open you can use it by binding it to a local port of your workstation via ssh. Following command will bind port 9000 of remote machine to your local port 8000.  As an example if it is web server you can easily access it by typing localhost:8000 in your web browser. ssh -L 8000:localhost:9000 username@host