Posts in 2017

  • Avoid NullPointerException on Primitive Wrapper Objects

    Wednesday, February 22, 2017 in Java

    Using the primitive wrapper objects like Boolean, Integer or Long in operators may throw NullPointerException, if the value is null, because the primitive wrapper objects auto unboxed to primitive values when you use java operators like …

    Read more

  • Ubuntu Sync Internet Time

    Thursday, January 26, 2017 in Ubuntu

    Check NTP installed by following command $timedatectl status Output Local time: Thu 2017-01-26 15:14:55 UTC Universal time: Thu 2017-01-26 15:14:55 UTC Timezone: Etc/UTC (UTC, +0000) NTP enabled: yes NTP synchronized: no RTC in local TZ: no DST …

    Read more

  • Tomcat log backup

    Wednesday, January 25, 2017 in Tomcat

    Following script can be used to archive the log files in tomcat log directory. This script… Archives all the files in logs directory to bkup directory Deletes all the files older than ’n’ days in bkup directory #!/bin/bash …

    Read more

  • Android Emulator Startup Issues

    Thursday, January 12, 2017 in Android

    KVM Permission Issue Error Dialog: KVM is required to run this AVD /dev/kvm device: permission denied. Grant current user access to /dev/kvm Do the following: # Check whether the user is root and group is kvm grep kvm /etc/group # if user is root and …

    Read more

Posts in 2016

  • Oracle Milliseconds to Date

    Monday, November 28, 2016 in Oracle

    Seconds to Date: SELECT to_timestamp('1970-01-01','yyyy-mm-dd') + numtodsinterval(<<seconds>>, 'SECOND') FROM dual; e.g. SELECT to_timestamp('1970-01-01','yyyy-mm-dd') + numtodsinterval(1480340561, …

    Read more

  • Access GIT Using SSH Key

    Thursday, May 12, 2016 in Git

    Create SSH Key Create a SSH (private/public) key using the following command ssh-keygen -t rsa -C "somerefname" The above command asks for phase phrase and either enter the pass phrase or press enter for no pass phrase. The above command …

    Read more

  • Oracle: Statistics Update

    Wednesday, March 30, 2016 in Oracle

    Get Last statistics Update SELECT table_name, last_analyzed, sample_size, num_rows sample_pct FROM dba_tables WHERE owner = 'your_schema_name_here' ORDER BY last_analyzed; Note: last_analyzed column shows the last analyzed date sample_size …

    Read more

  • Oracle: Get list of connected users

    Wednesday, March 30, 2016 in Oracle

    Following query returns the list of users who are currently connected to the Oracle database SELECT username, osuser, terminal, utl_inaddr.get_host_address(terminal) ip_address FROM system.v$session WHERE username is not null ORDER BY username, …

    Read more

  • Maven Dependency Updates

    Friday, March 04, 2016 in Build

    Use the following command to find any updates on dependencies mvn versions:display-dependency-updates Sample Output: $ mvn versions:display-dependency-updates [INFO] Scanning for projects... [INFO] [INFO] --------------------< …

    Read more

  • Java random integer in min and max range

    Friday, March 04, 2016 in Java

    Following sample code returns a random integer within the give min and max range (both inclusive) import java.util.Random; public class RandomRange { // Declare as class variable so that it is not re-seeded every call private static Random random = …

    Read more