Posts in 2017

  • JEE Container Managed Transaction

    Monday, December 25, 2017 in Java

    Transaction Attribute Client’s Transaction Business Method’s Transaction Required None T2 T1 T1 RequiresNew None T2 T1 T2 Mandatory None error T1 T1 NotSupported None None T1 None Supports None None T1 T1 Never None None T1 Error Container Manager …

    Read more

  • Java Time Difference

    Sunday, December 24, 2017 in Java

    Time difference can be calculated by subtracting the milliseconds. And then milliseconds can be converted into different Units using TimeUnit. e.g. TimeUnit.MILLISECONDS.toSeconds(1000) will give 1 because 1 second equivalent to 1000 millisecons. …

    Read more

  • JAXRS Rest Client

    Wednesday, December 20, 2017 in Java

    Option 1 : Using interface proxy import javax.ws.rs.FormParam; import javax.ws.rs.HeaderParam; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.core.Response; import org.apache.cxf.jaxrs.client.JAXRSClientFactory; import …

    Read more

  • Java get hostname and IP address

    Tuesday, December 19, 2017 in Java

    Use java.net.InetAddress to get hostname or IP Address To get local hostname or IP import java.net.InetAddress; public class LocalIPGetter { public static void main(String[] args) throws Exception { InetAddress inetAddress = …

    Read more

  • MySQL MariaDB Set utf8mb4 as default charset

    Wednesday, November 22, 2017 in MySQL

    By default charset is set to to latin1 and utf8. This can be checked by executing the following command MariaDB [(none)]> SHOW VARIABLES WHERE Variable_name LIKE 'character_set_%' OR Variable_name LIKE 'collation%'; …

    Read more

  • Install Mariadb in Aws Ec2

    Wednesday, November 22, 2017 in MySQL

    These steps can be used install mariadb on any Ubuntu based Linux system (local desktop, aws ec2, etc.) Install MariaDB Execute the following commands: curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash sudo apt install …

    Read more

  • Git Squash

    Friday, November 10, 2017 in Git

    Option 1 to squash last two commits git rebase -i HEAD~2 This will open editor where you can choose which commit to keep and which to squash. Also you have option to rewrite messages. Option 2 Reset and commit again: git reset --soft HEAD~2 git …

    Read more

  • TomEE datasource password encryption

    Thursday, November 09, 2017 in Tomcat

    Execute the following command to get the cipher: cd <<tomcat_home>>/bin tomee.sh cipher <<orginal password>> e.g. tomee.sh cipher Passw0rd This will give the cipher something like below xMH5uM1V9vQzVUv5LG7YLA== Use this cipher …

    Read more

  • Ubuntu Netbeans.desktop file

    Wednesday, November 08, 2017 in Ubuntu

    File: /usr/share/applications/netbeans.desktop [Desktop Entry] Encoding=UTF-8 Name=NetBeans IDE 8.2 Comment=The Smarter Way to Code Exec=/apps/netbeans-8.2/bin/netbeans Icon=/apps/netbeans-8.2/nb/netbeans.png …

    Read more

  • Google Sign-in Developer Error

    Saturday, May 27, 2017 in Android

    Resolving google sign-in error: Status{statusCode=DEVELOPER_ERROR, resolution=null} Follow these steps: Go to play console: https://play.google.com/apps/publish/ Go to “Release Management” -> “App signing” Copy the SHA1 …

    Read more