Wednesday, April 21, 2010

release sequence policy and deprecation

Major
Upgrading between major versions will most likely require some data migration and is to be regarded as a major event.
Minor
Will contain feature enhancements. A bigger test cycle of custom code and templates will be required.
Maintenance
Upgrading between maintenance releases should not require a big test cycle. A maintenance release should only contain bug fixes and no changed or added functionality.

As long as you have not used a bug or an undocumented feature as a significant feature in custom extensions, you should be fine in upgrading between maintenance releases.

Deprecation
A maintenance release might deprecate some API features. Deprecated features will not actually be removed until the next major release.

A major release will never remove API features that have not been deprecated in a previous maintenance release.

Monday, April 19, 2010

A look at apache commons lang

ArrayUtils.reverse(starr);
CharUtils.isAsciiAlphaLower('s')
CharUtils.unicodeEscaped('&')
NumberUtils.min(intarr)
NumberUtils.max(intarr)
RandomStringUtils.randomAscii(8) + "\t" +
RandomStringUtils.randomAlphabetic(8) + "\t" +
RandomStringUtils.randomAlphanumeric(8) + "\t" +
RandomStringUtils.randomNumeric(8) + "\t"
RandomStringUtils.random(8, "0123456789ABCDEF")
StringEscapeUtils.escapeHtml("<html><html/>")
StringEscapeUtils.escapeXml("<xml/>")
"name='" + StringEscapeUtils.escapeSql("Peter's store") +"'"
StringEscapeUtils.unescapeHtml("&lt;html&gt;&lt;html/&gt;")
StringUtils.isNumeric("nto")
StringUtils.abbreviate("Apache Commons Lang", 10)
StringUtils.getLevenshteinDistance("Nahian", "nahin")
StringUtils.left("Nahian", 3)
StringUtils.right("Nahian", 3)
StringUtils.leftPad("Nahian", 10)
SystemUtils.IS_OS_UNIX
SystemUtils.getJavaHome()
SystemUtils.getUserDir()
SystemUtils.getUserHome()
SystemUtils.JAVA_VERSION
SystemUtils.JAVA_RUNTIME_NAME
SystemUtils.OS_ARCH + " : " + SystemUtils.OS_NAME + " : " + SystemUtils.OS_VERSION
SystemUtils.USER_COUNTRY + " : " + SystemUtils.USER_LANGUAGE
WordUtils.initials("Apache Commons Lang.Co", new char[] {' ', '.'})
WordUtils.capitalize("This is the title of the sectionn")

Need a closer look at ArrayUtils, DateUtils, DateFormatUtils

Saturday, April 17, 2010

maven pmd plugin and cpd

$ mvn jxr:jxr pmd:pmd pmd:cpd

configuration:
  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <version>2.3</version>
        <configuration>
          <!-- to link to the output of jxr -->
          <linkXref>true</linkXref>
          <!-- if this is the root project -->
          <aggregate>true</aggregate>
          <!-- minimum token to detect duplicate -->
          <minimumTokens>100</minimumTokens>
          <targetJdk>1.5</targetJdk>
          <excludes>
            <exclude>**/*Bean.java</exclude>
          </excludes>
          <excludeRoots>
            <excludeRoot>the_source_dir_to_exclude</excludeRoot>
          </excludeRoots>
        </configuration>
      </plugin>
    </plugins>
  </reporting>

Jtidy

- DOM parser
 : Node node = tidy.parser(IS/reader, OS/writer);
- pretty printer
 : tidy.pprint(dom_Doc/node, OS)
- HTML cleaner, makes well formed HTML

CONFIGURATION
    // make well formed
    tidy.setXHTML(true);
    tidy.setHideComments(true);
    tidy.setIndentContent(true);
    // space for indentation
    tidy.setSpaces(4);
    // whether to add tidy meta content tag
    tidy.setTidyMark(false);

    if (ERROR_PRINT_MODE)
      tidy.setOnlyErrors(true);
    else
      tidy.setQuiet(true);

Other config
    // tidy.setShowWarnings(false);
    //  tidy.setErrout(new PrintWriter(new StringWriter()));
    // shows only <body> tag
    // tidy.setPrintBodyOnly(true);

Friday, April 16, 2010

substring using awk

$ echo "jtidy-r938-sources.jar" | awk '{i=index($0,".jar");print substr($0,1,i-1)}'
> jtidy-r938-sources