Techminded

Transparent blocks in PlayFramework

Comparing to other comprehensive Web frameworks PlayFramework's tags are not really good to make tranparent site blocks because they force developer to put storage data via renderArgs using controller hook method (annotated with @Before) that is unflexible or include Java code into template that is just worst idea to develop webinterface. Fortunatly framework has a way to implement tags as

Read More »

Tomcat6, Nginx and PHP in one Linux box

Tomcat

You should install tomcat either from packages

$sudo apt-get install tomcat6 tomcat6-admin

or from downloadable bundle and ensure it's running on port 8081 by finding in server configuration file (server.xml) lines similar to the following:

<Connector port="8081" protocol="HTTP/1.1" connectionTimeout="20000"

Read More »

Execute system command from Java

We will take canonical hello world up for demonstration.

import java.util.Scanner; import java.io.*; public class Program { public static void main(String[] args) { try { Process p = Runtime.getRuntime().exec("echo 'hello' > /tmp/hello.txt"); Scanner sc = new Scanner(p.getInputStream()); while (sc.hasNext())

Read More »

Adding Captcha in PlayFramework2

Built-in captcha has been gone in PlayFramework2. But to plug-in reCaptcha you may find even easier. I will try to keep my examples as simple as possible and without unnessasarry option you may plug later to improve this approcach. First of gain public and private keys from http://recaptcha.net/, choose option to generate global key in case you are going

Read More »

Some notes on modularity in PlayFramework2

PlayFramework2 met lots of disapointments from frist release fans. The Internets is full of questions "How to do that I did it in Play 1". People found groovy templates better than Scalate, Jobs more intuitive than Akka and sbt is quite performance eating and upredictable in comparison to previous play python console. Otherwise second version bring really new level of

Read More »

Liferay's Dynamic Query Magic

Intro
 
The common approach to fetch data filtered by criterias is to add finder definitions. When finder possibilities are not fit your requirements you can write custom finder that will use custom s(d)ql query. This seems ok, but writing queries as bindable strings is weak when you what to add or remove sugnificant number of criterias depending e.g. on user input.

Read More »

JSP Custom Functions

We oftern have to add some comprehensive logic to our views so templates may got bloated code or markup structure that is not good for project maintainability and karma. The siplisiest ways to avoid this is to move some reusable parts to functions that can be defined in JSP files with <!% %> tag just like this:

<%!

Read More »

Rapid web development with Liferay, Maven, IntelliJ and JRebel

Some new to java web development folks can get stucked with their productivity and experience growth by unabaliability to setup environment that allows them to develop software just like with dynamic languages: without long time server restarting and project sources rebuilding. In this article I want to describe some techniquies that may help you to make development more cute and

Read More »

Reconnect to DB for Java apps

In case you have service running it may turn into disconnected from database state e.g. with timeout and start generating exceptions when access is needed. To avoid this add this parameters to database connection url:

jdbc:mysql://localhost/database?.....&autoReconnect=true&interactiveClient=true

 

Read More »


© Techminded 2013