Posts in 2017
-
Avoid NullPointerException on Primitive Wrapper Objects
Wednesday, February 22, 2017 in Java
Categories:
5 minute read
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 …
-
Ubuntu Sync Internet Time
Thursday, January 26, 2017 in Ubuntu
less than a minute
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 …
-
Tomcat log backup
Wednesday, January 25, 2017 in Tomcat
Categories:
2 minute read
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 …
-
Android Emulator Startup Issues
Thursday, January 12, 2017 in Android
Categories:
2 minute read
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 …
Posts in 2016
-
Oracle Milliseconds to Date
Monday, November 28, 2016 in Oracle
less than a minute
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, …
-
Access GIT Using SSH Key
Thursday, May 12, 2016 in Git
Categories:
less than a minute
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 …
-
Oracle: Statistics Update
Wednesday, March 30, 2016 in Oracle
less than a minute
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 …
-
Oracle: Get list of connected users
Wednesday, March 30, 2016 in Oracle
less than a minute
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, …
-
Maven Dependency Updates
Friday, March 04, 2016 in Build
Categories:
less than a minute
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] --------------------< …
-
Java random integer in min and max range
Friday, March 04, 2016 in Java
Categories:
less than a minute
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 = …