This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('[name=mobilePhone]').on('keyup', function(e){ | |
| var enteredNumberStr=this.$('[name=mobilePhone]').val(), | |
| //Filter only numbers from the input | |
| cleanedStr = (enteredNumberStr).replace(/\D/g, ''), | |
| inputLength=cleanedStr.length, | |
| formattedNumber=cleanedStr; | |
| if(inputLength>3 && inputLength<7) { | |
| formattedNumber= cleanedStr.substr(0,3) + '-' + cleanedStr.substr(3,inputLength-1) ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Read through following links: | |
| ============================= | |
| https://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html | |
| https://dzone.com/articles/solving-dependency-conflicts-in-maven | |
| Now you must have some good idea on how Maven allows you to handle such issues. | |
| Following steps should lead to resolution: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| As standalone appengine sdk based app development and deployment is out of support by 30 July 2010 as per the following notice by GCP. | |
| " [Action Required] Migrate your App Engine projects from the legacy SDK (appcfg) before July 30, 2020" | |
| This gist will walk you through on | |
| --> How to upgrade to cloud sdk | |
| --> How to convert your App engine Java eclipse project into Maven project if needed. | |
| --> If eclipse project uses Data Nucleus plugin to Enhancement of JDO classes, Maven integration is must. | |
| --> Datanucleus Plugin Integration | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package no.nilsapp.someapp.cronjobs; | |
| import com.google.appengine.api.ThreadManager; | |
| import java.io.IOException; | |
| import java.util.List; | |
| import java.util.concurrent.ExecutorService; | |
| import java.util.concurrent.Executors; | |
| import java.util.concurrent.ThreadFactory; | |
| import java.util.concurrent.TimeUnit; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. Get by Keys | |
| ================ | |
| @SuppressWarnings("unchecked") | |
| public List<Message> getByIdList(List keys) { | |
| PersistenceManager pm = PMF.get().getPersistenceManager(); | |
| Query q = pm.newQuery("select from " + Message.class.getName() + " where :keys.contains(key)"); | |
| //Query q = pm.newQuery("select from " + Message.class.getName() + " where key == :keys"); | |
| return (List<Message>) q.execute(keys); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| What is Event Debouncing: | |
| ========================== | |
| There are several situations in UI event paradigm where you want | |
| control to limit/bound an event to fire only once after a specific amount of time has passed or within a given time-interval. | |
| Event listeners bound to the keyup in search boxes, screen resize and scroll events are the typical candidates for debouncing in JAVASCRIPT. | |
| Android has similar issues found with button click. | |
| How to debounce an Button Click event in Android: | |
| ==================================================== | |
| 1. Extend Click Listener with timer to track click events |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SNIPPET 1- Exact match of multiple possible matching word. | |
| POOR CODE: | |
| ========== | |
| isMatchingEventTopic: function(event) { | |
| if (event.eventTopic.indexOf('TASK') != -1 || | |
| event.eventTopic.indexOf('CLAIM') != -1 || | |
| event.eventTopic.indexOf('ORDER') != -1 || e | |
| vent.eventTopic.indexOf('PLAN_ENROLLMENT') != -1 || | |
| event.eventTopic.indexOf('CAMPAIGN_GOAL') != -1 || |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.pratap.utils; | |
| import java.lang.reflect.Field; | |
| import java.util.Arrays; | |
| import java.util.Date; | |
| import java.util.HashMap; | |
| import java.util.Map; | |
| import java.util.logging.Logger; | |
| import org.apache.commons.lang3.ArrayUtils; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <doctype html> | |
| <html><head> | |
| <meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
| <title> Form Sanitizer Demo</title> | |
| <style type="text/css"> | |
| label{min-width:100px;display:block;} | |
| .errorLbl_sanitizer{color:red;font-weight:bold;font-size:0.8em;display:inline-block;padding:4px;} | |
| .errorField{background-color:pink;border:2px solid red;} | |
| </style> | |
| <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script> |