Tips & Tricks, Summaries, Check Lists, Do’s & Don’ts, Reminders, Stuff that works…

  • Calling Javascript From Java (Example)

    Calling Javascript From Java (Example)

    This post explains how to call Javascript from Java. The code example is available at GitHub in the Java-Javascript-Calling directory. Code Example We create some small Javascript code in a string. This code dumps "Hello World!" and defines a function called myFunction() adding 3 to the provided value: public class JavascriptCalling { public static final […]

  • Creating A Customized Spring User & Persistence

    Creating A Customized Spring User & Persistence

    This post explains how to create a customized Spring user and persistence mechanism for authentication. The code is available at GitHub in the Spring-MVC-Customized-User directory. Things To Take Into Consideration Before creating a customized user, we need to remind what a user is in Spring. We know from here that a user is an implementation […]

  • Execute Spring ACL SQL Script In Memory

    Execute Spring ACL SQL Script In Memory

    This post describes how to execute the Spring ACL script to create ACL tables in an in-memory HSQL database instance. The code is available at GitHub in the Execute-ACL-SQL-Scripts-In-Memory directory. In-Memory DataSource We are using a configuration classe implementing the DisposableBean interface to shut down the created HSQL embedded database nicely. @Configuration public class

  • Centering An Image Or Text Within A Div

    This post explains how to center an image or text in HTML using CSS. The code example is available on GitHub in the Center-Image-Text-Div directory. Centering An Image Vertically And Horizontally Within A Div The method described here requires to know the size of the image. The HTML is the following: <div id="myDiv"> <img id="myImg" […]

  • Java ServiceLoader Example

    Java ServiceLoader Example

    Defining an API and developing the corresponding implementation has become an uber mainstream practice when developing large Java applications. Modularization is such an useful design principle, especially to avoid spaghetti code, for testing and debugging, and for re-implementation of old code. Many developers seek to separate API interfaces and abstract classes from their implementation in

  • Java TestNG Example

    This post illustrates some of the feature of TestNG. The code example is available at GitHub in the Java-TestNG directory. We use maven. Therefore, the configuration will located in the pom.xml. Source Code We use a very simple class returning integers for testing purposes: public class Generate { private Generate() { } public static int […]

  • ‘package javax.servlet.http does not exist’ Solution

    This is a common error which occurs when trying to compile a web project. This package is usually provided by the container. However, it is not (always) available at compile time and one should not include it in the final .war too. If you are using Maven, the solution is simple. Add the following dependency […]

  • Exiting From Google’s Sandbox In A Week

    Exiting From Google’s Sandbox In A Week

    Sharing the experience acquired while trying to get a keyword-stuffed site out of Google’s sandbox. I explain how I succeeded faster than methods described on the net so far. Not a silver bullet, but surely a boost. In less than a week, I got my site at search result position number 3 for its title […]

  • Spring JpaRepository Example (In-Memory)

    Spring JpaRepository Example (In-Memory)

    This post describes a simple Spring JpaRepository example using an in memory HSQL database. The code example is available from GitHub in the Spring-JpaRepository directory. It is based on the Spring-MVC-With-Annotations example and information available here. JPA Repository We implement a dummy bean for this example: @Entity @AutoProperty public class SomeItem { @Id @GeneratedValue(

  • Dealing With Google Webmaster Tools Frustrations

    If you don’t understand the mechanics behind Google Webmaster Tool (GWT, not to be confused with Google’s Web-Toolkit framework) and of page indexing, trying to obtain valid information about your website can be a very frustrating experience, especially if it is a new website. This has even led me to take counter-productive actions in order […]

Got any book recommendations?