Utilizzare entity JPA in Grails

Grails permette di utilizzare entity con annotazioni JPA invece delle classiche domain class in Groovy; vediamo come.

Grails proxy

grails -Dhttp.proxyHost=your.proxy.host.tld -Dhttp.proxyPort=3128 -Dhttp.proxyUserName=me -Dhttp.proxyPassword=*** set-proxy 

Integration test

Appunti per la creazione di integration test usando Selenium, HtmlUnit, Maven e Cargo.

Spring HTTP remoting

Questo tutorial spiega come far comunicare due applicazioni attraverso il modulo Http Remoting di Spring.

Commons VFS

Utilizzo di Apache Commons VFS

Dipendenza nel pom.xml

<dependency>
   <groupId>commons-vfs</groupId>
   <artifactId>commons-vfs</artifactId>
   <version>1.0</version>
</dependency>

Import:

import org.apache.commons.vfs.FileObject;
import org.apache.commons.vfs.FileSystemManager;
import org.apache.commons.vfs.VFS;

URI e' una stringa:

    protected String fileUri;

File da URL

  /**
   *
   * @see: http://weblogs.java.net/blog/kohsuke/archive/2007/04/how_to_convert.html
   * @param url
   * @return
   */
  public static File fileFromUrl(URL url)
  {
    if (url == null) throw new IllegalArgumentException("Null url object");
    File f;
    try
    {
      f = new File(url.toURI());
    }
    catch (URISyntaxException e)
    {
      f = new File(url.getPath());
    }
    return f;
  }

Utilizzare Jetty sulla porta 80 (senza diritti di root)

Questo tutorial spiega come eseguire Jetty sulla porta 80, senza che debba operare con privilegi di root.
Il codice di esempio è inteso per un primo test delle potenzialità di Jetty, e certo non può definirsi "production ready": utilizza una distribuzione pulita di Jetty, non prevede alcuna verifica di sicurezza e utilizza script bash eseguiti come cgi.

HTTP response code

Lista dei codice di response http

Report del database di un progetto Maven

Per documentare la struttura del database utilizzato in un progetto Maven si utilizza il reporting plugin per Schemaspy.

SchemaSpy is a Java-based tool (requires Java 5 or higher) that analyzes the metadata of a schema in a database and generates a visual representation of it [...]

Tutto quello che dovrebbe servire è reperibile a questo indirizzo:
maven.wakaleo.com
Il plugin per SchemaSpy è ospitato nella repository Wakaleo.

Form focus con JQuery

Aggiungere una classe css all'elemento al quale fare puntare il focus (esempio, aggiungiamo la classe focus

    <input name="theinput" 
    class="layoutclass otherclass focus" type="text">

Poi con la sintassi JQuery:

    $("input.focus:last").focus();

Condividi contenuti