Skip to content

Instantly share code, notes, and snippets.

😀
Working ....

Sampath sampathsl

Block or report user

Report or block sampathsl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View docker-commands
FROM adoptopenjdk/openjdk8-openj9:latest
VOLUME /tmp
ARG JAR_FILE
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-Djava.security.egd+file:/dev/./urandom","-jar","app.jar"]
------------------------------------------------------------------------------
FROM java:8
VOLUME /tmp
View How to maintain multiple Java versions in your Linux machine
# First copy extracted JDK folder to /usr/lib/jvm. (JAVA 7, 8, 9, 10, 11 .tar.gz files)
cd /usr/lib/jvm
ls -al
lrwxrwxrwx 1 root root 25 Jan 28 2018 default-java -> java-1.11.0-openjdk-amd64
lrwxrwxrwx 1 root root 21 Jan 28 2018 java-1.11.0-openjdk-amd64 -> java-11-openjdk-amd64
drwxr-xr-x 7 root root 4096 Jul 17 18:20 java-11-openjdk-amd64
drwxrwxr-x 8 test test 4096 Aug 14 23:50 jdk-10.0.2
@sampathsl
sampathsl / ExceptionResponse.java
Created Sep 24, 2018
Spring boot overriding the default white label error template with custom object
View ExceptionResponse.java
public class ExceptionResponse {
private Integer status;
private String path;
private String errorMessage;
private String timeStamp;
private String trace;
public ExceptionResponse(int status, Map<String, Object> errorAttributes) {
@sampathsl
sampathsl / CommonErrorController.java
Created Sep 24, 2018
Spring boot overriding the white label error template
View CommonErrorController.java
@Controller
public class CommonErrorController implements ErrorController {
@Autowired private ErrorAttributes errorAttributes;
public void setErrorAttributes(ErrorAttributes errorAttributes) {
this.errorAttributes = errorAttributes;
}
@RequestMapping(value = "error")
@sampathsl
sampathsl / CustomErrorController.java
Created Sep 24, 2018
Spring boot overriding the default white label error page
View CustomErrorController.java
@Controller
public class CustomErrorController implements ErrorController {
@RequestMapping("/error")
@ResponseBody
public String handleError(HttpServletRequest request) {
Integer statusCode = (Integer) request.getAttribute("javax.servlet.error.status_code");
Exception exception = (Exception) request.getAttribute("javax.servlet.error.exception");
return String.format("<html><body><h2>Sample Error Page</h2><div>Status code: <b>%s</b></div>"
+ "<div>Exception Message: <b>%s</b></div><body></html>",
@sampathsl
sampathsl / README-Template.md
Created Jul 3, 2017 — forked from PurpleBooth/README-Template.md
A template to make good README.md
View README-Template.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@sampathsl
sampathsl / disable-drop-paste.js
Created Oct 25, 2016
Disable drop and paste in text boxes
View disable-drop-paste.js
function removeDropPaste()
{
jQuery(".numeric").bind("paste", function (e) {
return false;
});
jQuery(".numeric").bind("drop", function (e) {
return false;
});
@sampathsl
sampathsl / currency.html
Created Oct 21, 2016
How to restrict an input field to a numeric input field using JavaScript - implement the HTML input box
View currency.html
<input id="txtCurrency" name="txtCurrency" placeholder="" maxlength="10" class="numeric form-textbox" pattern="^(?:\d*\.\d{1,2}|\d+)" title="Value should be numeric with maximum two decimal points"/>
@sampathsl
sampathsl / numeric-input.js
Last active Oct 21, 2016
How to restrict an input field to a numeric input field using JavaScript
View numeric-input.js
/*
* Avoid the A-Z a-z and special characters in text boxes
*/
jQuery(document).on('keypress', 'input.numeric', function(e) {
/* avoid entering multiple '.' */
if (e.currentTarget.value)
{
var keyCode = e.which ? e.which : e.keyCode;
var c = String.fromCharCode(keyCode);
@sampathsl
sampathsl / check-date.js
Last active Oct 18, 2016
Validate the user entered date using JavaScript
View check-date.js
/*
* Validate the user entered date
* '01/01/1970' -> valid date
* '45/01/1970' -> invalid date
*/
function checkDate(str)
{
var date = null;
var matches = str.match(/(\d{1,2})[\/](\d{1,2})[\/](\d{4})/);
You can’t perform that action at this time.