indiWiz.com

Subhash's Tech Log

OpenSource Font Manager

without comments

Fontmatrix is an excellent Font organizing Software available for Linux, Windows and MacOS.

To install it in all Debian based systems (including Ubuntu):

$ sudo apt-get install fontmatrix

Screenshot of Fontmatrix running in my system:

Fontmatrix

Written by Subhash Chandran

September 23rd, 2009 at 2:40 pm

Posted in Linux,OpenSource

Tagged with , , , ,

Mounting WebDav in Ubuntu

without comments

$ sudo apt-get install davfs2
$ sudo mount -t davfs http://localhost:8080/alfresco/webdav <filesystem_folder>

Written by Subhash Chandran

September 14th, 2009 at 7:33 pm

Posted in Linux

Tagged with , ,

XSL Transform using Java

without comments

import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;

...

// The XSL source:
StreamSource xsl = new StreamSource(...);

// Create the transformer:
TransformerFactory factory = TransformerFactory.newInstance();
Templates template = factory.newTemplates(xsl); // can throw TransformerConfigurationException (parent exception is: TransformerException)
Transformer transformer = template.newTransformer(); // can throw TransformerConfigurationException

// The data XML source
StreamSource data = new StreamSource(...);

// The transformed output:
StreamResult out = new StreamResult(...);

// Transform using the Transformer instance:
transformer.transform(data, out); // can throw TransformerException

Have a look at the StreamSource API and StreamResult API to understand the various ways by which it can be instantiated.

Written by Subhash Chandran

September 14th, 2009 at 4:56 pm

Posted in Java

Tagged with , , , ,

IE 8 features that impressed me

with one comment

I am posting this as a photo-stream in Flickr.

Written by Subhash Chandran

September 14th, 2009 at 2:03 pm

Posted in Uncategorized

Tagged with , ,

Tornado (the Python WebServer/Framework behind FriendFeed) goes OpenSource

without comments

Post acquisition by Facebook, the software behind FriendFeed has been OpenSourced. Tornado is a Python WebServer/Framework. The distinguishing feature of this WebServer is that it is non-blocking and designed for high-scalability.

Facebook in the past has OpenSourced many of their frameworks and tools.

Written by Subhash Chandran

September 11th, 2009 at 11:10 am

Beginner’s article on Liferay Portal Server

without comments

My article Portlet Development with Liferay published in the August 09 edition of Linux for You is available online.

Written by Subhash Chandran

September 4th, 2009 at 9:13 pm

Posted in news

Tagged with ,

Text Transform in CSS

without comments

For one of my blog post, I copied a particular blog author’s name from his blog. The author name was displayed in his blog as TOM BAEYENS. When I copied and pasted it in a text editor, it pasted as: Tom Baeyens. I wondered how did copy-paste change the case of the text.

After little debugging using the Firefox WebDeveloper plugin, I found that the text in the blog had the CSS property text-transform with value uppercase.

After little more study, I learned that text-transform is a CSS2 property which supports the following values:

capitalize Make first character in each word uppercase
uppercase Make all characters uppercase
lowercase Make all characters lowercase
none No transformation

To demonstrate, I write the text with different text-transform values:

none I love JAVA
capitalize I love JAVA
uppercase I love JAVA
lowercase I love JAVA

Written by Subhash Chandran

September 2nd, 2009 at 1:32 pm

Posted in Uncategorized

Tagged with

jBPM 4.1 released

without comments

Tom Baeyens (founder and lead of JBoss jBPM project) has announced the availability of jBPM version 4.1.

Written by Subhash Chandran

September 2nd, 2009 at 11:53 am

Posted in news

Tagged with , , ,

Maven Profiles

without comments

Thanks to Arun Jeganath for making me understand Maven Profiles.

Often we are forced to specify different build parameters in different environments. In the ages of Make, these parameters used to be specified as environment variables. In the world of Maven, we have profiles.

Profiles: Introduction

A sample profile information:

  <profiles>

    <!-- DEV Profile (Default) -->
    <profile>
      <id>dev-profile</id>
      <activation>
        <property>
          <name>env</name>
          <value>dev</value>
        </property>
        <activeByDefault>true</activeByDefault> <!-- Note this -->
      </activation>
      <!-- Liferay Home in DEV -->
      <properties>
        <liferay-home>${user.home}/apps/liferay-portal-tomcat-6.0-5.1.2</liferay-home>
      </properties>
    </profile>

    <!-- TEST Profile -->
    <profile>
      <id>test-profile</id>
      <activation>
        <property>
          <name>env</name>
          <value>test</value>
        </property>
      </activation>
      <!-- Liferay Home in TEST -->
      <properties>
        <liferay-home>/opt/apps/liferay-portal-tomcat-6.0-5.1.2</liferay-home>
      </properties>
    </profile>
  </profiles>

Quick learning from the above example:

  • There can be number of profiles defined.
  • A profile can be marked as <activeByDefault>. This will enforce the configuration defined in the activated profile to take effect during build.
  • To enable a specific profile during build, the value defined in XPath /profiles/profile/activation/property needs to be passed the Maven as System Property (in our case: -Denv=test).
  • The property defined in the profile (liferay-home) can be referenced elsewhere in the pom.xml as ${liferay-home}.

Placing profile information

Profile information is generally placed in:

  1. In the project POM itself.
  2. Inside {user.home}/.m2/settings.xml.

In the first case (in this particular example), the deployment information is placed in the project’s POM. This, some might feel improper because the module/project build has hardcoded environment dependencies which might not work in other systems. The second option externalizes the platform specific build information. But a new developer checking out the project will not be aware of this external dependency causing his build to fail. Both these problems might be addressed using documentation: some projects have README and BUILD files explaining environment setup for build.

As we saw, both methods have advantages and disadvantages. Choose the method appropriate to your situation.

Parameters that can be overridden in profiles

Note: This list is shamelessly copied from the official Maven profiles guide. Refer to this guide for detailed information.

  • <repositories>
  • <pluginRepositories>
  • <dependencies>
  • <plugins>
  • <properties> (not actually available in the main POM, but used behind the scenes)
  • <modules>
  • <reporting>
  • <dependencyManagement>
  • <distributionManagement>
  • a subset of the <build> element, which consists of:
    • <defaultGoal>
    • <resources>
    • <testResources>
    • <finalName>

Written by Subhash Chandran

September 1st, 2009 at 3:46 pm

Posted in build,Java

Tagged with , ,

Building Alfresco AMPs Using Maven

without comments

[2009-12-03] Updated for new Maven repository.

Thanks to Ganesh Gembali and Velrajan for helping me with this post.

One thing I hate about Alfresco is it’s SDK. I hate to learn new methodologies and configurations specific to new software. When it comes to developing Alfresco modules and extensions, it was difficult to do it without configuring Alfresco SDK. But that is history ;-)

Alfresco Maven Archetypes

I will discuss the steps I followed to configure a new Alfresco module project using Maven Alfresco AMP Archetype.

Step 1: Configuring Alfresco Repositories

Add the following repositories to your Maven configuration:

<repositories>
    <repository>
        <id>alf-public</id>
        <url>http://maven.alfresco.com/nexus/content/repositories/releases</url>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>alf-public-plugin</id>
        <url>http://maven.alfresco.com/nexus/content/repositories/releases</url>
    </pluginRepository>
</pluginRepositories>

Step 2: Using archetype:generate to generate a new project structure

mvn archetype:generate \
  -DarchetypeCatalog=http://maven.alfresco.com/nexus/content/repositories/releases/alfresco-archetype-catalog.xml


Actually the above code did not work in our proxy environment (I have configured Maven for Proxy usage correctly). So I saved the alfresco-archetype-catalog.xml to local filesystem and referenced it thus:

mvn archetype:generate \
  -DarchetypeCatalog=file:///home/subhash/alfresco-archetype-catalog.xml


The application quizzes you about artifactId, groupId, package name and version. Give the details. It will create the project directory.

Step 3: Placement of files

The following table will help you understand where to place your source files. The third column (AMP path) describes the path where the source file will be packaged inside the AMP. The fourth column (Deployment Path) the path where the file will be installed inside Alfresco deployment.

Source Path Description AMP path Deployment Path
src/main/config Place your module configuration files (module-context.xml) here. config/alfresco/module/{groupId}.{artifactId}/ WEB-INF/classes/alfresco/module/{groupId}.{artifactId}/
src/main/java Place your Java source code lib/{artifactId}-{version}.jar WEB-INF/lib/{artifactId}-{version}.jar
src/main/resources All other files like JavaScript, FTL templates, WebScript XMLs, etc. config/ WEB-INF/classes/
module.properties module.properties is stored in the root directory. module.properties WEB-INF/classes/alfresco/module/{artifactId}/module.properties

Step 4: Configuring Alfresco Dependencies

As an example, our module depended on alfresco-webscript-framework and alfresco-core APIs:

<dependency>
        <groupId>org.alfresco</groupId>
        <artifactId>alfresco-webscript-framework</artifactId>
        <version>3.2r</version>
        <classifier>community</classifier>
        <scope>provided</scope>
</dependency>
<dependency>
        <groupId>org.alfresco</groupId>
        <artifactId>alfresco-core</artifactId>
        <version>3.2r</version>
        <classifier>community</classifier>
        <scope>provided</scope>
</dependency>

Two things to note:

  • The <classifier> element is needed. The Jar files in the repository is named as {artifactId}-{version}-{classifier}.jar
  • Always give the scope as provided. This ensures Alfresco Jars do not get bundled with your AMP.

Written by Subhash Chandran

August 25th, 2009 at 9:29 am

Posted in Java

Tagged with

Terracotta Announces Purchase of Ehcache

without comments

What happens when two respectable enterprise Java scalability providers (Ehcache and Terracotta) join together? I am eager to witness the interesting time ahead! Get the news here.

Written by Subhash Chandran

August 19th, 2009 at 7:46 pm

Posted in Java,news

Tagged with

Recruiting programmers in India

with one comment

There are some Cultural differences to consider before recruiting a techie in India. The first thing in the minds of the Indian middle class:

A Job is a labor which is performed to earn a living.

This is different from what a good programmer views his Job as: a passion which he cannot live without.

This attitude of impassionate living without any risk taking ability has generated a generation of civil servants, doctors and software engineers whose lives are not worth living. They are just mechanical money making machines just operating. Not living. When recruiting, beware of this class. Once you recruit them, they will bring duress and boredom into the workplace. They will kill the creativity and innovation that can happen.

Written by Subhash Chandran

August 16th, 2009 at 12:18 pm

Posted in Management

Tagged with ,

Bad policies by Companies wrt QA resources

without comments

Does any of these sound familiar:

  1. Pay less salary than developers
  2. Demote “bad programmers” to QA
  3. Force manual testing
  4. Disallow use of testing software

All these are signs of decay.

Written by Subhash Chandran

August 8th, 2009 at 12:00 pm

Posted in Uncategorized

Tagged with

Best WebDeveloper plugins for Firefox

without comments

I found this interesting link listing the most interesting Firefox plugins.

Written by Subhash Chandran

August 7th, 2009 at 4:56 am

Posted in Uncategorized

Tagged with ,

Statistics are like bikinis. IE statistics.

without comments

Statistics are like bikinis. What they reveal is suggestive, but what they conceal is vital. ~Aaron Levenstein.

Microsoft has released statistical feature-comparison of its browser IE8 with other popular browsers. And guess what, they have exposed only what is interesting to them, concealing vital information. I could only laugh at their wordings (for example, under Manageability: Neither Firefox nor Chrome provide guidance or enterprise tools: my my, please tell me what guidance and enterprise tools do they miss) and wrongful advertising of misinformation.

I was immediately reminded of another joke site where IE6 was compared to other browsers. Microsoft seems to have misunderstood this site: they have missed the sarcasm and copied the concept from it.

This is a much more objective comparison.

Written by Subhash Chandran

July 31st, 2009 at 5:39 pm

Posted in Uncategorized

Tagged with