Thursday, October 26, 2017

How to transform Play project as Eclipse project

To transform a new Play project into Eclipse workspace.
the following steps can be followed.

1. navigate into the play project root directory. eg. C:\my-play-project

2. add the following plugin into the end of project/plugins.sbt

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.2.2")



3. add the following configuration into the end of build.sbt

EclipseKeys.preTasks := Seq(compile in Compile, compile in Test)
EclipseKeys.projectFlavor := EclipseProjectFlavor.Java  
EclipseKeys.createSrc := EclipseCreateSrc.ValueSet(EclipseCreateSrc.ManagedClasses, EclipseCreateSrc.ManagedResources) 


Wednesday, October 25, 2017

How to create new Play Java project

1. make sure sbt is installed in your OS
2. create a new folder, eg. "my-play-project"
3. open command prompt, and navigate to the newly create folder
4. in the command prompt, type "sbt new playframework/play-java-seed.g8"
  a) enter project name
  b) enter organization
  c) enter scala version
  d) enter play version
  e) enter sbt version

Wednesday, October 18, 2017

How to easily get logged in user in Liferay.



ServiceContextThreadLocal.getServiceContext().getUserId();


reference:
http://liferay-hacks.blogspot.my/2014/01/get-current-logged-in-user-easily-in.html

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



LinkWithin

Related Posts Plugin for WordPress, Blogger...