December 1, 2014

Gradle script to list xml files recursively from specified directory

In the previous article, we saw how to list xml files recursively from the specified directory using Ant Script.

Here is the code snippet to do the same in Gradle script.

import groovy.io.FileType

// defining defaulttasks
defaultTasks 'listfile'

task listfile ()<< {
// user defined property - srcdir
ext.srcdir = "D:\Src"
println ' '
}
listfile.doFirst {
    print '-----------------------------------------'
}

listfile << {
def list = []
def dir = new File(listfile.srcdir)
dir.eachFileRecurse (FileType.FILES) { file ->
  if(file.name.endsWith('.xml')) {
    list << file
}
}
println 'List of xml files: \n-----------------------------------------'
list.each {
  println it.path
}
 println '-----------------------------------------'
}

November 30, 2014

Ant Script to list xml files recursively from specified directory

Here is the code-snippet to list the files recursively in the specified directory using <foreach>, <path> &  <fileset>

<project name="ListFilesProject" default="listfiles" basedir=".">
    <description>
           List Files recursively
    </description>
  <!-- set global properties for this build -->
  <property name="src.dir" value="D:\src" />
 
  <target name="listfiles" description="list the files" >
   <echo message="listfiles xml files in the given directory"/>
   <taskdef resource="net/sf/antcontrib/antlib.xml"/>
   <foreach target="list_xml_file" param="xml_File" >
         <path>
             <fileset dir="${src.dir}" casesensitive="yes" includes="**/*.xml" />
         </path>
    </foreach>
  </target>
 
  <target name="list_xml_file">
          <echo message="${xml_File}"/>
  </target>
 
</project


Note:

Usage of <foreach> requires ant-contrib-1.0b2.jar. Download it from http://mirrors.ibiblio.org/maven/ant-contrib/jars/ant-contrib-1.0b2.jar place it under <Ant Installation Dir>\ant\lib

*.xml       ->  lists all the xml files from the specified directory
**/*.xml  - > lists all the xml files from all the sub-directories under specified directory

The * matches all files in the directory while ** matches the all the files in the entire directory tree.

November 9, 2014

BIT Alumnae Grand Reunion @ Bangalore

BIT started taking initiatives to inaugurate Alumnae chapter in different cities to lay a platform for fellow Alumnae to network and I am glad to be nominated as a Secretory for Bangalore Chapter.
Here is the picture from Bangalore Chapter Inauguration and also spoke on my experience from College to Corporate along with our responsibilities of  giving back to the family, environment, society & college.

Proud to be a BITian! and this is my first non-techical lecture :) 




The central theme of the talk:


“Return Gift”
Parents with school going kids might be familiar with the term and how do we relate that to ourselves..
We are indebted to many people in our life like our family members, our college, mother earth, society etc. on various grounds. By all means we continue to support our family but now it’s our turn to pause, turn back and see, how we can pay back. 
1.       Giving back to the earth:
Let’s preserve the natural resources for our own kith n kin and set an example for our next generation. This will imbibe the principals of conservation to our kids.

2.       Giving back to the society:
We can certainly associate ourselves with one of the trust worthy NGOs to lend a helping hand to the needy.
Two of the BIT Alumni – 1st batch textile students – Murugesh & Rajkumar have formed a group named SWASAM in the year April 2009 with our college mates and their colleagues contributing only 100/- per month and these two persons have been instrumental in routing that money to couple of ashrams in Avinashi, Coimbatore & Pollachi. Now there are 177 members in the group and in the past 6 years, these two people have never missed or delayed to send even a single monthly report. That’s the power of the Alumni & the power of networking. 
So it doesn’t mean that some of you should coin an impressive name like SWASAM and start collecting moneyJ. It is just an example and there are ‘n’ no. of ways to give back to the society.

3.       Giving back to the college:
I personally feel there is a Void in the path from College to Corporate i.e. the transition of a student to an employee or an entrepreneur. Alumni can play a vital Role to mend the gap
·         Emphasising the value of Communication & Presentation Skills, creating an awareness on corporate Etiquette etc. 
College authorities have been doing this but when we talk, the impact & influence will be manifold.
·         We can be a mentor for a student
·         And even committing yourselves for a “Guest Lecture”.
For various reasons, you may not be able to travel down to the college but the technology advancements like video conferencing can tie the knot to mend the gap.

I would like to end with a note from The Alchemist by Paulo Coelho "When you wanted to achieve something, the whole world conspires to help you achieve the same".

Wish you all a very great success in life.


Recording: https://www.youtube.com/watch?v=kgUrYYqc59o from 16th to 25th minute.


October 20, 2014

JENKINS ISSUE: Illegal Argument exception

This article talks about Illegal Argument Exception occuring in Jenkins v1.559 during build time.

After migrating from SVN to Git, java.lang.IllegalArgumentException started to occur atleast couple of times a week on daily build, while checking out the source code. Re-starting the Jenkins Slave on the build server, helped us to go past the issue temporarily and root cause exploration continued.

Earlier the assumtions & focus was to rule out options around issues with Git installation / configuration but later narrowed down that the incorrect version of Jenkins Slave installed was the causing IllegalArgumentException.

Solution:
Updating the Jenkins slave from v2.2.x to  2.37 resolved the issue.

July 30, 2014

To launch PDF as ReadMe file on the Installation Success using InstallShield



This will guide you to how to open a PDF at the end of the installation if the read me check box is selected by the user. To achieve these are the steps needs to be followed
1.      Registry search for adobe reader location
2.      Create a custom action to launch readme file
3.      Modify the SetupCompleteSucess Dialog
4.      Add some properties to Property Manager

Registry search for adobe reader location
·         Open InstallShield and go to Behavior and Logics & System search
·         Now right click and add a new system search
·         Click and choose for registry entry and enter the following values
o   Registry root: HKEY_LOCAL_MACHINE
o   Registry path: SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AcroRd32.exe
o   Registry value: path
·         Click next and Store the value in this property, in that field enter ADOBEPATH. Just leave the option "Store the value in the property".

Custom Action
·         Go to custom actions and create "New EXE" -> "Path referencing a directory" and name it as LaunchReadMePDF.
·         Set the "Working Directory" to documents folder path(In my case it is INSTALLDIR).
·         Set the "Filename & Command line" to "[ADOBEPATH]AcroRd32.exe" "[INSTALLDIR]ReadMe.pdf"
·         Set "Return Processing" to "Asynchronous (No wait for completion)"

SetupCompleteSuccess Dialog
·         Go to Dialogs & SetupCompleteSuccess Behavior
·         In the Controls go to OK and add an event and  enter the following
Event = DoAction
Argument = LaunchReadMePDF
Condition = LAUNCHREADME

Property Manager
Go to Property Manager and add the following Properties
·       ·           SHOWLAUNCHREADME and set it to -1
·       ·           READMEFILETOLAUNCHATEND and set to 1

For this process to work Readme.pdf file should be deployed to INSTALLDIR as part of file copy or you can change the path accordingly.