Monday, 28 November 2011

Spring Roo 1.2.0.RC1 released

New changes are ready for testing in the new Roo release candidate. The most interesting are:
  • Multi-module Maven project support
  • Enhancements in Entity model
See more on: http://blog.springsource.org/2011/11/23/spring-roo-1-2-0-rc1-released/

Sunday, 27 November 2011

ProGuard - obfuscator for Android

How to encode your code written in an Android application?
Use Proguard.

ProGuard is a free Java class file shrinker, optimizer, obfuscator, and preverifier. It detects and removes unused classes, fields, methods, and attributes. It optimizes bytecode and removes unused instructions. It renames the remaining classes, fields, and methods using short meaningless names. Finally, it preverifies the processed code for Java 6 or for Java Micro Edition.

More information on the product page: http://proguard.sourceforge.net/

Wednesday, 16 November 2011

How to change MANIFEST.MF generated by maven?

You have to add plugin configuration in pom.xml in section build/plugins:
Here is an example of configuring default class run when executing generated jar:
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <configuration>
     <archive>
      <manifest>
       <mainClass>package.Class</mainClass>
      </manifest>
     </archive>
    </configuration>
   </plugin>
Here is an example of using already generated MANIFEST.MF file as the manifest file of the jar:
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <configuration>
     <archive>
      <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
     </archive>
    </configuration>
   </plugin>

More info about plugin parameters on: http://maven.apache.org/maven-1.x/plugins/jar/manifest.html

Loading properties file in java

You just have to define Properties variable and then use load method. Load method gets InputStream as a parameter.
Properties properties = new Properties();
properties.load(is);

Linux console tools for measuring performance

We can use following tools:
  • top, htop - processes measurement
  • df - storage space info
  • hdparm - storage performance
  • cat /proc/cpuinfo - CPU info
  • cat /proc/meminfo - RAM info
  • vmstat, dstat - processes, memory, swap, IO, CPU info
  • netstat - network info
  • mpstat - CPU summary
  • iostat - IO info
  • iptraf - many metrics

Latency and Responsiveness

These two measurements are important in Web Development.
  • Latency - a measure of time delay experienced in a system
  • Responsiveness - ability of a functional unit to complete assigned tasks within a given time