Tuesday, January 29, 2013

சிறு மகிழ்சி, சிறு நம்பிக்கை

0 Comments
பனி காலத்தின் நடுவே
ஒரு வசந்த நாள்,
தேர்வு நாளன்று 
யாரோ இறந்ததால் கிடைத்த 
கல்லுரி விடுமுறை.
 
image





Thursday, January 24, 2013

PowerShell: Listing files/directories only

0 Comments

In DOS, it is always easy to find only directories or only files,

For example,

will display only directories. If you want to display just files, you can do this,

Ironically, PowerShell which is more powerful and modern than DOS, it is not very straightforward to do this.

In PowerShell 2.0 you have couple of not very straightforward options,

Do this no more, PowerShell 3.0 is here with the fix, Now it has two new switches –File,–Directory

PowerShell 3.0 also comes with –Attribute switch to do make it even more powerful.

Tuesday, January 22, 2013

Some “fun” hacks with batch script

0 Comments
  1. Always quote variable or value in “IF” statements.

    This script will return expected results if both var1 and var2 has some value and don't have any spaces in the value

    So, what is the fix here. You can either put quote around the value or variable. If you are checking an environment variable that holds file path like JAVA_HOME, you may not able to put quote around the value. You have to follow the later approach.

  2. Inside an “IF” block, if you want to set some value to a variable and that value contains parentheses, quote the SET statement like below.

    Following script will fail, because it has parentheses and it gets mixed up with IF statement syntax.

    If you can put quote around the value, wrap the value with quotes.

    If you can't put quote around the value, put quote around entire statement excluding SET

Monday, January 7, 2013

Android: How to version command line build?

1 Comments

Philosophy behind Continues Integration is, integrate often, build often, run often and test often. This post is about “build often” part. To build often, you need to have a slick build process. If you have one simple command line to build your entire project that may encourage you and also other developers in your team to build often.

If you are building android project in command line and not sure how to update the version code and version name attributes in AndroidManifest.xml file, this might help.

In your build.xml file, you should see this line.

This custom_rules.xml, helps you to keep your customization in a separate place so when build.xml file is changed by Android Team, you don’t have to worry about merging. If you already have one in place you are good to go, if not create it.

Initially your custom_rules.xml should look like this,

You can pass version info in two ways,

  • Using a property file
  • Using command line arguments

To pass version info using property file,

Create this target in custom_rules.xml file,

And create this version.properties file,

To pass version info using command line arguments,

Create this target in custom_rules.xml file,

In the above target, we are using variable Version.Code and Version.Name. Lets pass these variables from command line,

Now we have the targets to update the version info. This targets needs to be called from somewhere. You could do this in several ways. 1. custom_rules.xml has several hooks such as pre-build, post-build. We can call our desired target in pre-build, so that version info gets updated every time we build it. 2. You can call the target from command line right before you build your app like the code below.

Complete custom_rules.xml file,