Monday, June 3, 2013

MacOSX Quick Look Plugin to view Zip files - This is Kewl

I always wanted to see whats inside the zip without really extracting it, which was pretty simple and straight forward with all the tools that I used on Windows (yea those days :-)) but somehow after I switched to Mac (as part of job, but am loving it) I really missed that feature of just peeking into the zip without extracting it, somehow there isnt any (or i dont know off) way to peek into the zip files on the Mac when you double click the Archive (utility) just extracts it, I was always annoyed about it, and today that is gone. Thanks to BetterZip QuickLook plugin




Thursday, May 30, 2013

Things I did not know before


1. To change to US keyboard in linux you can type the following command (make sure you are logged in as root, or do switch to root user if you have the auth)

loadkeys us

Monday, May 27, 2013

Finally got Acrobat Reader back on my Mac

Preview had been the defacto PDF / Image viewer for me after I started using my mac. I remember having an Acrobat reader installed sometime initially but never used it as Preview is open most of the time on my Mac and I did not want to burden my CPU with one more Application. But suddenly a few days back when I tried to open a PDF on my Preview it showed nothing but a small PDF watermark on all the pages and nothing else. I tried opening the PDF in Google Chrome and Firefox using the Acrobat plugin and they just display the contents with no problem, thats when I wanted the Acrobat Reader back on my Mac. I never thought it would be so difficult to get it back. I kept trying to download the Acrobat Reader from Adobe site and got nothing but a switch off your Antivirus message but nothing else. I couldnt get through that - neither the Apple communites nor the Adobe forums could be of any help and finally Google came to the rescue by showing me this site - http://www.oldapps.com/mac/adobe_reader.php. I am now back with the reader, even though I am still continuing to have Preview as my default PDF viewer :-) Thanks OldApps

Saturday, January 7, 2012

Java - Adding references to Framework API Documentation (docs) while generating Javadocs

In continuation to my earlier posts about using Maven to generate Javadocs for your project source code, I want to provide some inputs on how you can link your project's generated apiDocs to the apiDocs of the framework it is dependent on. In my case, I was working on an ATG project and used Maven javadoc plugin to generate javadocs for my project source code, the apiDocs got generated successfully but all the ATG Framework classes that my project source code referred to were linked to the Oracle java documentation. This was because the javadoc plugin assumes that any class thats not defined in the project source code is actually a java class. To avoid this from happening, you can add links/link tag combination (as given in the snippet below) and point the same to the folder/URL which contains the apiDocs/package-list (in my case this file was inside the folder mentioned in the link tag) file. This file helps the javadoc utility understand as to which packages are covered by the docs provided by the folder in the link tag. This way if your project is referring to multiple frameworks you can download the framework documentation to a folder and add the offline links to the javadoc plugin configuration section and rerun the maven command to regenerate the apiDocs with the updated links.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <version>2.8</version>
    <configuration>
        <reportOutputDirectory>C:/Project/apiDocs</reportOutputDirectory>
        <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
        <docletArtifact>
            <groupId>org.umlgraph</groupId>
            <artifactId>doclet</artifactId>
            <version>5.1</version>
        </docletArtifact>
        <additionalparam>-views</additionalparam>
        <useStandardDocletOptions>true</useStandardDocletOptions>
        <links>
            <link>file:///C:/Users/nseshadr/Downloads/E22630_01/Platform.1002/apidoc</link>
        </links>

    </configuration>
    <executions>
        <execution>
            <id>aggregate</id>
            <goals>
                <goal>aggregate</goal>
            </goals>
        </execution>
    </executions>
</plugin>

You can always refer to the Maven Javadoc Plugin page for more information and options.

Note: Also you can download the Oracle Sun Java API documentation and add information about the same to the links/link section and that will make all your java class references point to the local API folder as against the internet URL. 

Monday, January 2, 2012

Java - Generating code coverage reports using Cobertura with Maven

If you have a requirement or a plan to generate test code coverage reports for your project using Cobertura and you are using Maven as your build tool, copy the following onto your pom.xml in the build/plugins section.

<plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>cobertura-maven-plugin</artifactId>
      <version>2.5.1</version>
       <configuration>
      <instrumentation>
        <includes>
          <include>com/company/**/*Manage*.class</include>
          <include>com/company/**/*Tool*.class</include>
        </includes>
      </instrumentation>
      <aggregate>true</aggregate>
      <outputDirectory>C:/Project/TestCoverageReports</outputDirectory>
    </configuration>
    <executions>
      <execution>
          <phase>package</phase>
          <goals>
              <goal>cobertura</goal>
          </goals>
      </execution>
    </executions>
</plugin>

Make sure that your maven doesnt skip tests - i.e., -Dmaven.test.skip is set to false.

Note that the test coverage report will be generated in the configured outputDirectory. If you are working on a project that has a parent POM which invokes multiple child POMs, add this to the parent POM, the aggregate option will generate one code coverage report for all the set of modules invoked from inside the parent without any changes to the child POMs. You can always refer to the Maven Cobertura Plugin page for more information and options.

Sunday, January 1, 2012

Java - Generating javadocs for your source code with Maven using Custom Doclet (GraphViz)

Its always good to have a visual representation rather than a text based representation for us to understand things better. This concept works well for the javadocs that we generate as well. As mentioned in one of my other blogs - Software Tools - I managed to use GraphViz and UmlGraph to generate javadocs with ClassDiagrams. You can also automate this by integrating all this into your Maven POM.

So if you are using Maven as the build tool on your project and you want to generate javadocs for all your source files with the UML classdiagram embedded on them, please add the following to your POM inside the build/plugins section.
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <version>2.8</version>
    <configuration>
        <reportOutputDirectory>C:/Project/apiDocs</reportOutputDirectory>
        <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
        <docletArtifact>
            <groupId>org.umlgraph</groupId>
            <artifactId>doclet</artifactId>
            <version>5.1</version>
        </docletArtifact>
        <additionalparam>-views</additionalparam>
        <useStandardDocletOptions>true</useStandardDocletOptions>

    </configuration>
    <executions>
        <execution>
            <id>aggregate</id>
            <goals>
                <goal>aggregate</goal>
            </goals>
        </execution>
    </executions>
</plugin>

As mentioned in my other post on javadoc generation using Maven please make necessary changes to your mvn command. Also make sure you download GraphViz, install the same and add its bin folder to the PATH environment variable before running the mvn command or executing the script that runs the mvn command otherwise you would see issues about "dot" not being recognized as a commnd or some error of that kind.

Java - Generating javadocs for your source code with Maven

If you have a requirement or a plan to generate javadocs for your project source code and you are using Maven as your build tool, copy the following onto your pom.xml in the build/plugins section.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <version>2.8</version>
    <configuration>
        <reportOutputDirectory>C:/Project/apiDocs</reportOutputDirectory>
    </configuration>
    <executions>
        <execution>
        <id>aggregate</id>
        <goals>
            <goal>aggregate</goal>
        </goals>
        </execution>
    </executions>
</plugin>

Also dont forget to add javadoc:aggregate to the mvn goal/tasks list for the javadocs to get generated. 

mvn -e -s application\settings.xml -Denvironment=development -Dmaven.test.skip=false clean install javadoc:aggregate

Note that the javadocs will be generated in the configured reportOutputDirectory. If you are working on a project that has a parent POM which invokes multiple child POMs, add this to the parent POM, the aggregate option will generate one javadoc for all the set of modules invoked from inside the parent without any changes to the child POMs. You can always refer to the Maven Javadoc Plugin page for more information and options.