<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <!-- The Basics --> <groupId>...</groupId> <artifactId>...</artifactId> <version>...</version> <packaging>...</packaging> <dependencies>...</dependencies> <parent>...</parent> <dependencyManagement>...</dependencyManagement> <modules>...</modules> <<b>properties</b>>...</properties> <!-- Build Settings --> <build>...</build> <reporting>...</reporting> <!-- More Project Information --> <name>...</name> <description>...</description> <url>...</url> <inceptionYear>...</inceptionYear> <licenses>...</licenses> <organization>...</organization> <developers>...</developers> <contributors>...</contributors> <!-- Environment Settings --> <issueManagement>...</issueManagement> <ciManagement>...</ciManagement> <mailingLists>...</mailingLists> <scm>...</scm> <prerequisites>...</prerequisites> <repositories>...</repositories> <pluginRepositories>...</pluginRepositories> <distributionManagement>...</distributionManagement> <profiles>...</profiles> </project>scope:
Saturday, May 15, 2010
maven pom, scope
maven release plugin
mvn release:prepare
Cleaning
mvn release:clean - for cleaning resourced created by prepare
mvn release:rollback - for half done
Additional goals and release goals
update version of all projects

Preparing a release goes through the following release phases:
- Check that there are no uncommitted changes in the sources
- Check that there are no SNAPSHOT dependencies
- Change the version in the POMs from x-SNAPSHOT to a new version (you will be prompted for the versions to use)
- Transform the SCM information in the POM to include the final destination of the tag
- Run the project tests against the modified POMs to confirm everything is in working order
- Commit the modified POMs
- Tag the code in the SCM with a version name (this will be prompted for)
- Bump the version in the POMs to a new value y-SNAPSHOT (these values will also be prompted for)
- Commit the modified POMs
scm URL will be taken from <scm> or <meta http-equiv="content-type" content="text/html; charset=utf-8">-DconnectionUrl<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span class="Apple-style-span" style="font-family: Verdana,Helvetica,Arial,sans-serif; font-size: 16px;"></span></span> <b>mvn release:</b><b>perform</b>
Performing a release runs the following release phases:
- Checkout from an SCM URL with optional tag
- Run the predefined Maven goals to release the project (by default, deploy site-deploy
mvn --batch-mode -<i>Dtag</i>=my-proj-1.2 <b>release:prepare</b> \<br /> -<i>DreleaseVersion</i>=1.2 \<br /> -<i>DdevelopmentVersion</i>=2.0-SNAPSHOT** There properties can be inside release.properties file
Cleaning
mvn release:clean - for cleaning resourced created by prepare
mvn release:rollback - for half done
Additional goals and release goals
<configuration> <preparationGoals>clean install verify</preparationGoals> <goals>deploy</goals><br /></configuration>
update version of all projects
mvn release:<i><b>update-versions</b></i> -DautoVersionSubmodules=true
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.
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("<html><html/>")
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
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("<html><html/>")
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>
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);
: 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
> jtidy-r938-sources
Tuesday, March 23, 2010
AWK basics
command: awk 'pattern {expression} [; ptrn {exp}]'
default-pattern: 1
default expression: print
hence,
'1' ~ '{print}' ~ '{print $0}' ~ '1 {print $0}
patterns:
BEGIN at file begin
END at file end
/match-pattern/ for string matching
Default vars:
NF: nOf fields
NR: nOf record so far
FNR: file's nOf record so far
length(): nOf letters
FS & OFS: field separator
RS & ORS: record separator
FILENAME
c-like code:
default-pattern: 1
default expression: print
hence,
'1' ~ '{print}' ~ '{print $0}' ~ '1 {print $0}
patterns:
BEGIN at file begin
END at file end
/match-pattern/ for string matching
Default vars:
NF: nOf fields
NR: nOf record so far
FNR: file's nOf record so far
length(): nOf letters
FS & OFS: field separator
RS & ORS: record separator
FILENAME
c-like code:
'{ s = 0; for (i = 1; i <= NF; i++) s = s+$i; print s }''{ printf("%5d : %s\n", NR, $0) }' for(i=1;i<=NF;i++) if($i~/[0-9]+/) $i="";
String utility:
substitute: '{ sub(/pattern/, "replacement'); print }'
or gsub for substitute all
shell $ variable
# ./getlyrics dhur valo "lage na"
$1: dhur
$3: lage na
$#: 3
$0: ./getlyrics
$@: dhur valo lage na
$*: dhur valo lage na
$1: dhur
$3: lage na
$#: 3
$0: ./getlyrics
$@: dhur valo lage na
$*: dhur valo lage na
maven-jxr-plugin
- can generate HTML pages with project source
mvn jxr:jxr
- can generate HTML pages with project test source
mvn jxr:test-jxr
- can link the source HTML file with Javadoc if configured
mvn jxr:jxr
- can generate HTML pages with project test source
mvn jxr:test-jxr
- can link the source HTML file with Javadoc if configured
Monday, March 22, 2010
How Pingback work
First = receptor
Second = originator<br><br />Pingback:
-> First blog exposes a ping back server
X-Pingback header or,
<link rel="pingback" href="([^"]+)" ?/?>
-> Second blog put a <a href> to First blog
-> Second pingback client will discover First pingback server from HTTP header or <link>
-> Second pingback client sends a xml-rpc request to First server with:
method: pingback.ping
param: sourceURI, targetURI
-> First pingback server now can do anything
. check whether targetURI exits?
. check whether srouceURI exits and has the link
. record the pingback
. change model so site page contains a link to source URI
Refback:
Nothing special required at Second end.
When browser loads url from First blog URL, it sends 'Referer' header with value Second blog URL
Trackback:
-> Trackback URI is RESTful .
Second = originator<br><br />Pingback:
-> First blog exposes a ping back server
X-Pingback header or,
<link rel="pingback" href="([^"]+)" ?/?>
-> Second blog put a <a href> to First blog
-> Second pingback client will discover First pingback server from HTTP header or <link>
-> Second pingback client sends a xml-rpc request to First server with:
method: pingback.ping
param: sourceURI, targetURI
-> First pingback server now can do anything
. check whether targetURI exits?
. check whether srouceURI exits and has the link
. record the pingback
. change model so site page contains a link to source URI
Refback:
Nothing special required at Second end.
When browser loads url from First blog URL, it sends 'Referer' header with value Second blog URL
Trackback:
-> Trackback URI is RESTful .
-> service discovery with RDF xmlSunday, March 21, 2010
System boot and linux boot
System boot
BIOS - checks memory and runs MBR
MBR - checks partition table and loads BootLoader(grub)
BootLoader - on OS selection, loads kernel
kernel starts the init process
// now booting is done
RUN LEVEL
0 - system halt(shutdown)
1 - single user
2-5 - multi-user
6 - restart
S - transitional run level
$ runlevel
Typical sysvinit startup
$ /etc/init.d/rc RL
runs the srcitsp in /etc/rc$RL.d
this is how sysvinit init worked
How upstart works
upstart jobs are defined in /etc/init/*.conf
hence, /etc/init/rc.conf loads /etc/init.d/rc $RL this way sysvinit functionality served.
Technorati Tags: linux
BIOS - checks memory and runs MBR
MBR - checks partition table and loads BootLoader(grub)
BootLoader - on OS selection, loads kernel
kernel starts the init process
// now booting is done
RUN LEVEL
0 - system halt(shutdown)
1 - single user
2-5 - multi-user
6 - restart
S - transitional run level
$ runlevel
Typical sysvinit startup
$ /etc/init.d/rc RL
runs the srcitsp in /etc/rc$RL.d
this is how sysvinit init worked
How upstart works
upstart jobs are defined in /etc/init/*.conf
hence, /etc/init/rc.conf loads /etc/init.d/rc $RL this way sysvinit functionality served.
Technorati Tags: linux
Create a upstart Task(9.10)
JOB
-> Task ( ends by themeselves)
-> Services (supervised by init)
http://www.linux.com/archive/feature/125977
$vim /etc/init/fun.conf
start on dofun
#stop on runlevel 016[]
script
echo "i am having fine now:" >> /tmp/funny.txt
echo `date` >> /tmp/funnyt.txt
end script
$ initctl emit dofun
other use of initctl for upstart init daemon
$initctl list
$initctl start/stop/status/restart/reload
Technorati Tags: linux, ubuntu, daemon
-> Task ( ends by themeselves)
-> Services (supervised by init)
http://www.linux.com/archive/feature/125977
$vim /etc/init/fun.conf
start on dofun
#stop on runlevel 016[]
script
echo "i am having fine now:" >> /tmp/funny.txt
echo `date` >> /tmp/funnyt.txt
end script
$ initctl emit dofun
other use of initctl for upstart init daemon
$initctl list
$initctl start/stop/status/restart/reload
Technorati Tags: linux, ubuntu, daemon
using xmms2
run xmms2 server
$ xmms2-launcher
play songs
$ xmms2 add FILE
$ xmms2 radd DIR
$ xmms2 play/stop/pause/list/status
media library
$ xmms2 mlib addpath PATH
$ xmms2 mlib search artist:"SDFSDFSF"
$ xmms2 mlib searchadd
$ xmms2 mlib loadall
$ xmms2-launcher
play songs
$ xmms2 add FILE
$ xmms2 radd DIR
$ xmms2 play/stop/pause/list/status
media library
$ xmms2 mlib addpath PATH
$ xmms2 mlib search artist:"SDFSDFSF"
$ xmms2 mlib searchadd
$ xmms2 mlib loadall
Thursday, March 18, 2010
maven enforcer plugin
Checking a system property

<executions>more rules
<execution>
<id>enforce-property</id>
<goals>
<goal>enforce</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
<configuration>
<rules>
<<b>requireProperty</b>>
<property>java7.home</property>
<message>"You must set a property java7.home!"</message>
</requireProperty>
</rules>
</configuration>
- bannedDependencies - enforces that excluded dependencies aren't included.
- evaluateBeanshell - evaluates a beanshell script.
- requireReleaseDeps - enforces that no snapshots are included as dependencies.
- requireMavenVersion - enforces the Maven version.
- requireJavaVersion - enforces the JDK version.
- requireProperty - enforces the existence and values of properties.
- requireFilesExist - enforces that the list of files do exist.
Subscribe to:
Comments (Atom)