giovedì 19 aprile 2012

Bugzilla

http://www.bugzilla.org/download/

Bugzilla 4.2.1 (2.9M)

Installation

See the Bugzilla Guide's "Installation" and "Configuration" sections for information on how to install Bugzilla and its prerequisites.
Windows users: See the Bugzilla Installation Guide for Windows for installation instructions.

DB schema di Bugzilla

http://www.bugzilla.org/docs/2.16/html/dbschema.html

mercoledì 18 aprile 2012

Accedere a PMD su sourceforge

Link per collegarsi con Tortois:
https://pmd.svn.sourceforge.net/svnroot/pmd

Pagina di help per SourceForge:
http://sourceforge.net/apps/trac/sourceforge/wiki/WikiStart

Qui si dovrebbe trovare la documentazione pubblicata sul sito:
http://pmd.svn.sourceforge.net/viewvc/pmd/trunk/pmd/src/site/xdocs/

Qui si fa riferimento alla classe deprecata:
http://pmd.svn.sourceforge.net/viewvc/pmd/trunk/pmd/src/site/xdocs/howtowritearule.xml?revision=7652&view=markup

Forum:
https://sourceforge.net/projects/pmd/forums/forum/188192/topic/5120216/index/page/1

lunedì 16 aprile 2012

XPath

http://zvon.org/comp/tests/r/test-xlab.html#XPath_1~Expressions
//*[contains(@bbb,'22')]

<AAA>
<BBB aaa="111" bbb="222">
<CCC/>
<CCC xxx="555" yyy="666" zzz="777"/>
</BBB>
<BBB aaa="999">
<CCC xxx="qq"/>
<DDD xxx="ww"/>
<EEE xxx="oo"/>
</BBB>
<BBB>
<DDD xxx="oo"/>
</BBB>
</AAA>

//*[@*='222']

Clover

http://www.atlassian.com/software/clover/overview

Java and Groovy Code Coverage

Clover provides the metrics you need to better balance the effort between writing code that does stuff and code that tests stuff.
Clover runs in your IDE or your continuous integration system, and includes Test Optimization to make your tests run faster and fail more quickly.
Clover Logo
Clover in a Nutshell (1:58)

Esempio Rule per JSP

net.sourceforge.pmd.jsp.rules.NoInlineStyleInformation

package net.sourceforge.pmd.jsp.rules;
import java.util.Set;
import net.sourceforge.pmd.jsp.ast.ASTAttribute;
import net.sourceforge.pmd.jsp.ast.ASTElement;
import net.sourceforge.pmd.util.CollectionUtil;

/**
 * This rule checks that no "style" elements (like <B>, <FONT>, ...) are used, and that no
 * "style" attributes (like "font", "size", "align") are used.
 *
 * @author pieter_van_raemdonck
 */
public class NoInlineStyleInformation extends AbstractJspRule {

    // These lists should probably be extended

    /**
     * List of HTML element-names that define style.
     */
    private static final Set<String> STYLE_ELEMENT_NAMES = CollectionUtil.asSet(
      new String[]{"B", "I", "FONT", "BASEFONT", "U", "CENTER"}
      );

    /**
     * List of HTML element-names that can have attributes defining style.
     */
    private static final Set<String> ELEMENT_NAMES_THAT_CAN_HAVE_STYLE_ATTRIBUTES = CollectionUtil.asSet(
      new String[]{"P", "TABLE", "THEAD", "TBODY", "TFOOT", "TR", "TD", "COL", "COLGROUP"}
      );

    /**
     * List of attributes that define style when they are attributes of HTML elements with
     * names in ELEMENT_NAMES_THAT_CAN_HAVE_STYLE_ATTRIBUTES.
     */
    private static final Set<String> STYLE_ATTRIBUTES = CollectionUtil.asSet(
      new String[]{"STYLE", "FONT", "SIZE", "COLOR", "FACE", "ALIGN", "VALIGN", "BGCOLOR"}
      );
   
    public Object visit(ASTAttribute node, Object data) {
        if (isStyleAttribute(node)) {
            addViolation(data, node);
        }

        return super.visit(node, data);
    }

    public Object visit(ASTElement node, Object data) {
        if (isStyleElement(node)) {
            addViolation(data, node);
        }

        return super.visit(node, data);
    }

    /**
     * Checks whether the name of the elementNode argument is one of STYLE_ELEMENT_NAMES.
     *
     * @param elementNode
     * @return boolean
     */
    private boolean isStyleElement(ASTElement elementNode) {
        return STYLE_ELEMENT_NAMES.contains(elementNode.getName().toUpperCase());
    }

    /**
     * Checks whether the attributeNode argument is a style attribute of a HTML element
     * that can have style attributes.
     *
     * @param elementNode
     * @return boolean
     */
    private boolean isStyleAttribute(ASTAttribute attributeNode) {
        if (STYLE_ATTRIBUTES.contains(attributeNode.getName().toUpperCase())) {
            if (attributeNode.jjtGetParent() instanceof ASTElement) {
                ASTElement parent = (ASTElement) attributeNode.jjtGetParent();
                if (ELEMENT_NAMES_THAT_CAN_HAVE_STYLE_ATTRIBUTES.contains(parent
                        .getName().toUpperCase())) {
                    return true;
                }
            }
        }

        return false;
    }
}

Esempio analisi JSP

Funziona anche con file .jspx

C:\PMD\pmd-4.2.5\bin>pmd C:\ANALISI\JAVAX csv C:\pmd\basic-jsp.ruleset -reportfi
le C:\ANALISI\JAVAX\_PMDResults.txt -jsp

Documentation of JSP support in PMD

What is currently supported and what is not

In short, JSP files that are XHTML-compliant, are supported. Except for files that contain inline DTDs; only references to external DTD files are supported (having inline DTD will result in a parsing error).
The XHTML support means that:
  • opening tags must be accompanied by corresponding closing tags (or they must be empty tags). This means that currently a "<HR>" tag without corresponding closing tag will result in a parsing error.
  • attribute values must be surrounded by single or double quotes. This means that the following syntax will result in a parsing error:
    <MyTag myAttr1=true myAttr2=1024/>
  • < and > characters must be escaped, or put inside a CDATA section.
  • PMD creates a "Abstract Syntax Tree" representation of source code; the rules use such a tree as input. For JSP files, the following constructs are parsed into nodes of the tree:
    • XML-elements, XML-attributes, XML-comments, doctype-declarations, CDATA,
    • JSP-directives, JSP-declarations, JSP-comments, JSP-scriptlets, JSP-expressions, Expression Language expressions, JSF value bindings
    • everything else is seen as flat text nodes.
  • Java code (e.g. in JSP-scriptlets) and EL expressions are not parsed or further broken down. If you want to create rules that check the code inside EL expressions or JSP scriptlets (a.o.), you currently would have to do "manual" string manipulation (e.g. using regular expressions).

How to use it

Using the command-line interface, two new options can be used in the arguments string:
  • "-jsp" : this triggers checking JSP files (they are not checked by default)
  • "-nojava" : this tells PMD not to check java source files (they are checked by default)
Using the Ant task, you decide if PMD must check JSP files by choosing what files are given to the PMD task. If you use a fileset that contains only ".java" files, JSP files obviously will not be checked.
If you want to call the PMD API for checking JSP files, you should investigate the javadoc of PMD.

sabato 14 aprile 2012

Nuove rules PMD 4.2.6

Per creare una nuova rule in java, occorre seguire la guida pmd:
http://pmd.sourceforge.net/howtowritearule.html

In pratica la guida dice di scaricare i sorgenti di PMD, aggiungere la nuova classe secondo quanto indicato, e ricompilare il tutto.

I sorgenti di PMD si scaricano da qui (scaricando la alpha 5.o non c'è il file build.xml necessario per compilare con ANT):
http://sourceforge.net/projects/pmd/files/pmd/4.2.6/pmd-src-4.2.6.zip/download
Una volta scaricato lo zip, si decomprime in una cartella, ad es. C:\Users\Duccio\Lavori\pmd-src-4.2.6

Occorre aggiungere il jar di Junit al classpath (JUnit: download)
Occorre quindi scaricare e configurare ANT per compilare.
Da qui si scarica ANT: http://ant.apache.org/bindownload.cgi
Qui è descritto come installarlo: http://ant.apache.org/manual/install.html#installing in particoalre fare attenzione a configurare el seguenti variabili di ambiente:

set ANT_HOME=c:\ant
set JAVA_HOME=c:\jdk-1.5.0.05
set PATH=%PATH%;%ANT_HOME%\bin

Nonostante questo, quando ho eseguito la verifica di installazione come indicato nella guida, su Windows7 ho incontrato questo problema:
Unable to locate tools.jar
risolto grazie a questo post:
http://stackoverflow.com/questions/2619584/how-to-set-java-home-on-windows-7
in cui si suggerisce:
What worked for me was adding the %JAVA_HOME%\bin to Path environment variable with the JAVA_HOME environment variable pointing to the jdk folder
A questo punto la verifica ha funzionato.
A questo punto, da cmd ci si sposta in:
cd C:\Users\Duccio\Lavori\pmd-src-4.2.6
e semplicemente si esegue:
ant
se nel folder è presente un file build.xml corretto il risultato dovrebbe essere:

jar:
      [jar] Building jar: C:\Users\Duccio\Lavori\pmd-src-4.2.6\lib\pmd-4.2.6.jar

      [jar] Building jar: C:\Users\Duccio\Lavori\pmd-src-4.2.6\lib\pmd-test-4.2.
6.jar

BUILD SUCCESSFUL
Total time: 31 seconds

A questo punto si può importare il progetto in un workspace Eclipse e seguire la guida di pmd.
Attenzione: la guida dice di derivare una classe da AbstractRule (), ma in realtà questo metodo è deprecato e si deve derivare da AbstractJavaRule come indicato in 
http://pmd.sourceforge.net/apidocs/net/sourceforge/pmd/AbstractRule.html e in http://sourceforge.net/projects/pmd/forums/forum/188192/topic/5120216

Per scrivere una rule con xpath fare riferimento all'articolo:
http://onjava.com/pub/a/onjava/2003/04/09/pmd_rules.html

da cui si vede che basta agire sul ruleset.xml:
XPath is a new language, though, so why write PMD rules using XPath when you're already a whiz-bang Java programmer? The reason is that it's a whole lot easier to write simple rules using XPath. To illustrate, here's the "DontCreateThreadsRule" written as an XPath expression:
//AllocationExpression[Name/@Image='Thread'][not(ArrayDimsAndInits)]
Concise, eh? There's no Java class to track--you don't have to compile anything or put anything else on your CLASSPATH. Just add the XPath expression to your rule definition like this:
<?xml version="1.0"?>
<ruleset name="My company's EJB checker rules">
  <description>
The Design Ruleset contains a collection of rules that find questionable designs.
  </description>
  <rule name="DontCreateThreadsRule"
        message="Don't create threads, use the MyCompanyThreadService instead"
        class="org.mycompany.util.pmd.DontCreateThreadsRule">
    <description>
Don't create Threads, use the MyCompanyThreadService instead.
    </description>
    <properties>
    <property name="xpath">
        <value>
        <![CDATA[
            //AllocationExpression[Name/@Image='Thread'][not(ArrayDimsAndInits)]>
        ]]>
        </value>
    </property>
    </properties>
    <example>
<![CDATA[
 Thread t = new Thread(); // don't do this!
]]>
    </example>
  </rule>
</ruleset>
Refer to the rule as usual to run it on your source code.

martedì 3 aprile 2012

Apache Tomcat 7_ Documentazione base

http://tomcat.apache.org/tomcat-7.0-doc/appdev/

Preface
This manual includes contributions from many members of the Tomcat Project developer community. The following authors have provided significant content:
Table of Contents
The information presented is divided into the following sections:
  • Introduction - Briefly describes the information covered here, with links and references to other sources of information.
  • Installation - Covers acquiring and installing the required software components to use Tomcat for web application development.
  • Deployment Organization - Discusses the standard directory layout for a web application (defined in the Servlet API Specification), the Web Application Deployment Descriptor, and options for integration with Tomcat in your development environment.
  • Source Organization - Describes a useful approach to organizing the source code directories for your project, and introduces the build.xml used by Ant to manage compilation.
  • Development Processes - Provides brief descriptions of typical development processes utilizing the recommended deployment and source organizations.
  • Example Application - This directory contains a very simple, but functionally complete, "Hello, World" application built according to the principles described in this manual. You can use this application to practice using the described techniques.

lunedì 2 aprile 2012

Apache Tomcat/7.0.26

http://tomcat.apache.org/download-70.cgi#7.0.26
C:\Program Files\apache-tomcat-7.0.26\RUNNING.txt

Apache Tomcat/7.0.26

http://tomcat.apache.org/download-70.cgi#7.0.26
C:\Program Files\apache-tomcat-7.0.26\RUNNING.txt

NoDataInRoaming: DISABLE AUTOMATICALLY internet in roaming, RE-ENABLE in home network

Thumbs up NoDataInRoaming: DISABLE AUTOMATICALLY internet in roaming, RE-ENABLE in home network

Sorry.
This project has been abandoned.
Is NO longer supported nor will be updated.
----------------------------------------------------------------

DETTAGLI PER GLI UTENTI ITALIANI
  • Cos'è NoDataInRoaming?
    E' un programma per i palmari con Windows Mobile 5.0 / 6.0 / 6.5
    che serve per inibire automaticamente la connessione dati quando si
    è in roaming nazionale o internazione.
  • Non c'è già Modaco NoData?
    Questo è diverso: con Modaco NoData, le connessioni sono impedite
    sempre e comunque manualmente. In questo caso, invece, le
    connessioni sono abilitate e disabilite automaticamente
     per farvi
    navigare solo con l'operatore di casa, mai in roaming, così non c'è
    il rischio di abbebiti pazzi o di andare sotto credito.
  • Funziona solo con H3G / TRE?
    No. Funziona con qualsiasi operatore telefonico. Può essere utile
    se si abita vicino ad una zona di confine per prevenire le connessioni
    di operatori del paese adiacente.
  • Perchè è utile con H3G / TRE?
    In Italia H3G ha il roaming nazionale con TIM il quale non include
    le soglie internet, quindi si paga salato a consumo più lo scatto di
    inizio navigazione. Se, quindi avete Naviga3, o qualasiasi
    abbonamento flat o semi-flat per non rischiare di pagare oltre, se per
    errore vi connette con TIM è indispensabile.
  • Una volta installato cosa devo fare?
    Niente. Farà tutto da solo. Voi non dovete preoccuparvi di nulla.
    Quando sarete sotto operatore di casa potrete connettervi,
    altrimenti no. Non ci saranno addebiti strani.
  • Non basta semplicemente bloccare il telefono in UMTS con H3G?
    Se si blocca il telefono in UMTS (WCDMA), quando si è fuori
    copertura H3G, non disponendo più del roaming TIM (che così è
    stato inibito) si perderanno tutte le chiamate vocali, gli SMS/MMS.
    Oltretutto se si vive vicino al confine è possibile agganciare una rete
    in roaming che funziona sulla rete UMTS consentevi quindi l'accesso
    ad internet a pagamento con tariffe esoribitanti internazionali.
  • Impedisce la ricezione di SMS/MMS, il WiFi o il BlueTooth?
    Questo programma inibisce solo le connessioni dati / internet via
    rete telefonica (GPRS/UMTS/HDSPA) senza intaccare la ricezione
    di chiamate, la possibilità di ricevere SMS/MMS o collegarsi ad
    internet usando un hot-spot WiFi.
  • Quali telefoni sono supportati?
    Qualsiasi telefono o palmare sia dotato di Windows Mobile che
    supporti l'interfaccia RIL oppure SNAPI. Ad esempio tutti modelli
    di telefoni HTC (touch, pro, ecc...) i vari SAMSUNG (omnia), i palmari
    LG, E-TEN, HP...
  • Come si installa questo programma?
    Scaricare il CAB dal link fornito in questo post, cliccare
    sul CAB nel palamre e riavviare il dispositivo. Tutto qua.
  • E' possibile connettersi forzatamente in roaming?
    Si. Basta cliccare sull'icona del programma per disattivarlo, previa
    richiesta, così a vostro rischio e pericolo vi potrete connettere
    in roaming. Personalmente lo sconsiglio.
  • Come faccio a sapere se il programma fa il suo dovere?
    Basta, per esempio, connettersi forzatamente con TIM e provare
    a navigare e vedrete che nessuna applicazione (browser, posta, msn)
    funzionerà e vi dirà che non è disponibile alcuna connessione (a meno
    che non abbiate abilitato il WiFi e siete connessi ad un hot-spot).
  • Dove posso scaricare il programma?
    Da questo link: in allegato a questo post
  • E se qualcosa non dovesse funzionare?
    Bhe, chiede consiglio su questo forum (in lingua inglese). 
  • Ci sono dei tips & tricks?
    Si. Esisono varie opzioni di configurazione del programma.
    Guardate questo thread e avrete modo di conoscere le chiavi di
    configurazione del registro di sistema (REGEDIT).
    Tuttavia non è necessario intervenire, in quanto l'installazione
    esegue una configurazione ottimale utile alla maggior parte degli
    utenti.

    Questi vari settagi li potete trovare sopra, nella sezione
    Registry Configuration & Hacks
  • Qual è l'ultima versione del programma?La 0.9.2, rilasciata il 6 gennaio 2010
  • Posso distribuire questa applicazione?
    Sì. Puoi anche includerla nelle tue ROM customizzate,
    senza chiedere alcun permesso oppure consigliarla ad amici.
  • Quanto costa il programma?
    Niente. E' completamente gratis.

Current version: 0.9.2 (last / abandoned)
Release date: 06-JAN-2010 (there will be no updates)
Download: post attachment
Source: post attachment

Bugzilla

Installazione:
http://www.bugzilla.org/download/
Installazione Winwos:
https://wiki.mozilla.org/Bugzilla:Win32Install
 Bugzilla:Win32InstallPackages:
https://wiki.mozilla.org/Bugzilla:Win32InstallPackages