Sunday, September 24, 2017

How to delay Quartz Scheduler startup in a web application

Quartz scheduler startup can be delayed by configuration in web.xml or programmatically.

1. Configuration in web.xml
<context-param>
<param-name>quartz:start-delay-seconds</param-name>
<param-value>DELAY_IN_SECONDS</param-value>
</context-param>

2. Programmatically
    scheduler.startDelayed(DELAY_IN_SECONDS);


Done!!

Saturday, September 23, 2017

How to create angular 4 module

This tutorial assuming all prerequisite to start an Angular 4 application has been properly setup with Angular cli.

To create angular 4 module, follow the steps below.
1. navigate to the root directory of your Angular 4 application.

2. run the following command to generate a new module class
    ng generate module moduleName

    eg. ng generate module ferrari
3. run the following command to generate a new component under the above module
    ng generate component moduleName/componentName

    eg. ng generate component ferrari/ferrari-list
4. create a routing class in the same directory with module class  

    eg. ferrari-routing.module.ts



Wednesday, August 16, 2017

Quick access to httpSession in Liferay

The following syntax can access to Http Session Object in Liferay without going through PortletSession Object.

Setting session object

PortalSessionThreadLocal.getHttpSession().setAttribute("sessionAttributeName", value); 



Retrieving session object by key 

PortalSessionThreadLocal.getHttpSession().getAttribute("sessionAttributeName");




Done!!

Monday, August 7, 2017

How to disable Chrome autofill with jQuery

To disable the Google Chrome autofill,
the solution is to set the autocomplete in the input element to off.
with the following jQuery function, all the input element in the page will be set autocomplete to off.

$(document).ready(function(){ 
    $("input").each(function () {
         $(this).attr("autocomplete", "off");
       })
})



Done!!

Wednesday, July 5, 2017

How to disable browser back behavior with javascript

in certain scenario, we might want to disable the browser back behavior.
eg,
in an ajax application, the application screens changed, but the browser url remains unchanged.
if the user click on the browser back button now
the application is navigate away from what the user doing,
where the user simply wants to navigate to the previous screen.
thus, disable the browser back behavior is very important here.

LinkWithin

Related Posts Plugin for WordPress, Blogger...