Most of you would have heard about "Back of the envelope calculation", which stands for what is a rough estimate of a certain thing. It can be the time a certain task will take or how many people or other resources will be needed to accomplish something. We do many kinds of estimation in our daily life both in professional and personal life. For example, how many years I should work and at what level so that I can get my retirement. Unfortunately, that never happens. If you really want to retire it's today or you will be made to retire for some other reason.
Showing posts with label Development Tools. Show all posts
Showing posts with label Development Tools. Show all posts
Saturday, April 11, 2020
Saturday, November 30, 2019
Git Branching
Red dots denote commits. The model can be tuned based on the size of the team. For example, a single developer might just use one dev branch from the master and work on it and keep merging back in the master. However, it's suggested to still cut release branches.
Larger teams would want to use a more elaborate mechanism of tagging and cutting release branches. Versioning of the build can be done as per the blog.
The basic theme that should always be followed is to integrate the code as much as possible to the parent branches and maintain the stability of every code base across all branches. Pull frequently, push early and run integrations as much as needed. Have integration environments where any commit can trigger integration tests.
The basic theme that should always be followed is to integrate the code as much as possible to the parent branches and maintain the stability of every code base across all branches. Pull frequently, push early and run integrations as much as needed. Have integration environments where any commit can trigger integration tests.
Sunday, March 18, 2018
Forking and maintaining a git repository
There are many public repositories which at times we want to fork and continue our path. However, at the same time, we want to keep pulling the changes from the original repository also. In this post, we will look into how to fork a repository and how to pull the changes in the future.
Forking
Let's say we want to fork a repository
Application versioning with Git and Gradle
Please follow Rest API Server to see the big picture and GitHub repo details.
Application versioning in Git is tricky compared to subversion. Subversion commits are in the increasing order of number so it's easy to put them as part of the application version. Being numbers they are easy to comprehend. However, Git commit id's are hash which would frighten any faint-hearted. A typical git commit id may look like
Application versioning in Git is tricky compared to subversion. Subversion commits are in the increasing order of number so it's easy to put them as part of the application version. Being numbers they are easy to comprehend. However, Git commit id's are hash which would frighten any faint-hearted. A typical git commit id may look like
Thursday, February 25, 2016
Git Cheat Sheet
Clone
- Cloning a repository
Commit and Push
- Current status of staged and changed file including new additions
- Add all changed files to staged
- Committing changes
Saturday, September 6, 2014
Software Development Management Tools
Modern day software development is complex not because we have to write more complex logic but more so because of the size of software's and the number of people involved and the increasing amount of integration that is desired between different systems. Also the end users expectations has gone above the roof as more and more people are getting comfortable with the notion of using software's and computers. Smart phones and mobiles has only made it more mandatory, the need of writing great software.
In such large scale complex software development, good tools are mandatory. In spite of all the right
Saturday, August 30, 2014
Spring Hibernate jQuery Tiles Web Application with Source Code
Spring and Hibernate are one of the most favourite frameworks to build web applications in real world. Spring not only provides a mature service layer but also gives good integration with Hibernate. Spring also provides MVC to build front end pieces and Spring security to take care of authentication and authorization. Apart from that on browser side jquery has proven itself with time. I have put together a sample web application, where one can see how the different frameworks are integrated. The web application has a login page and a listing page.
The versions of different frameworks used are:
- Spring version 4.0.5.RELEASE - Tutorials on Spring
Monday, August 18, 2014
Choosing an IDE (Integrated Development Environment)
This is always the most difficult question. Eclipse has been I think the most widely adopted IDE at the moment. It has the maximum support for plugins. In fact at the moment it is the first IDE for which plugin is supported. Netbeans is also fast catching up with its feature list. If you are in the crossroads and wanting to adopt an IDE than look around your peer group. As they can help you out the the IDE that they are working with.Also I think most of the IDE do smell and taste similar once you get into one. Some of the thumb rules that can help you out:
- What features and frameworks you are going to use in your application? Check what is the support for those features in terms of plugins.
- Which server are you adopting? If you are adopting one of the popular servers than most of the IDE has first citizen support for them. However if you are using one of the lesser known servers than you might want to check that.
- Is there plugin support to your Source code control system? I think this is important in terms of productivity.
- The similar question can be asked about Project management environment. If you need such kind of integration and if it is available.
- Check how active is the community around that IDE. You might not want to get into an IDE in which active development is not happening.
Saturday, August 16, 2014
Eclipse IDE Introduction
Eclipse IDE for Java EE Developers can be downloaded from http://www.eclipse.org/downloads/
Please choose the correct flavour as per your operating system and feature list you want. Also install Java by following the Java Installation Procedure.
The steps to install eclipse in windows is as follows. This is quite similar to Linux
- Extract it at a location. Let's assume it is "E:\ProgramFiles\". The extraction will make an eclipse folder there.
- Go to the folder and click on eclipse.exe in windows. In Linux click on eclipse.sh
Adding Java to eclipse.
- Open eclipse by clicking on eclipse.exe inside eclipse folder.
- Go to Window->Preferences->Installed JREs.
- Click on Add
- Select the JVM home directory to the JDK path of your java. In our case it is C:\ProgramFiles\Java. Put Java6 (or whichever version you are working with) in JRE name.
- Click on finish.
- Select it and unselect the older JDK. The selection denotes that this JDK is defualt.
Once you have installed eclipse, please follow the following video to see how you can do development using eclipse.
Friday, August 8, 2014
Setting up debug mode in Maven
Maven invoked the JRE for running. So pass the debug parameters to MAVEN_OPTS in the environment.
MAVEN_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=3998,suspend=n,server=y -Xms256m -Xmx512m -XX:MaxPermSize=128m
With the option set in the cmd/shell, the process spits the debug information at socket 3998. This can be attached from the development environment like eclipse. The Xms, Xmx and XX:MaxPermSize parameter are memory parameters and you can ignore them if you are fine with the defaults.
These are in fact standard Java debugging options and nothing maven about it.
Option Details:
- address - Address of the port where you can attach the debugger
- suspend - Making it 'y' will suspend the java runtime and will wait fora client to listen to the socket for debugging information. Making it n does not suspends the server and will let the debugger to be attached at any time.
Maven Introduction
Maven is a build management tool. Maven works with a declarative paradigm. Maven works with the notion of build lifecycle and a build lifecycle is made up of multiple phases. Before we delve further, let's see how to install Maven. Please follow the steps to do that:
Installing Maven
- Make sure you have java installed. Maven is build using Java.
- Download Maven . Please download the binary zip.
- Extract the zip at a suitable location. Let's say you have extracted it at "D:\programs\apache-maven"
- Add the path to PATH variable of windows. In this case, append to PATH variable "D:\programs\apache-mave\bin"
- Open a Command prompt and if Maven is successfully installed, you should be able to run mvn command.
Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e;
2014-06-17T19:21:42+05:30)
Maven home: D:\programs\apache-maven-3.2.2\bin\..
Java version: 1.8.0_05, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_05\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
- Another thing to take care of is repository location. Maven downloads project dependencies and keeps them at repository location. For that go to apache-maven\conf directory. Open settings.xml and search for localRepository. By default Maven keeps the dependencies in <user.home>/.m2/repository but you can change it to some other location. Maven might land up downloading a huge amount of dependencies based on the kind of projects you are working so it's a good idea to plan for atleast couple of GB space.
Making First Project
Maven comes with many archetypes. Archetypes can be though of a template to make a certain kind of project. For example the default archetype will create a java based project. To make a default project run the following command on and empty directory
mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DgroupId=com.lalit.app -DartifactId=maven-app
If the command is successful, you should see a project created inside maven-app directory. The structure of the project will be as follows:
Note that it has got a java directory and a test directory. Inside Java you will find the package structure as com.lalit.app and in it a Java file calle App.java
App.java will be our age old famous Hello World program
package com.lalit.app;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
The other important file inside maven-app directory is pom.xml, which looks as follows:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.lalit.app</groupId>
<artifactId>maven-app</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>maven-app</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Note the groupId, artifactId as we have mentioned in maven command while building the project. The project has just unit case dependency as for the program to run it does not needs any third party jar.
Run the program
To run the program run the following command
mvn compile exec:java -Dexec.mainClass="com.lalit.app.App"
compile will compile the code and exec:java will execute the main class. If you have to pass some arguments than pass them as -Dexec.args="args0 args1"
Also you will notice that the output of the maven is not a simple Hello World but a bunch of things are printed on the console.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building maven-app 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven-app
---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\Lalit\temp\maven-app\src\mai
n\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ maven-app ---
[INFO] Compiling 1 source file to C:\Users\Lalit\temp\maven-app\target\classes
[INFO]
[INFO] --- exec-maven-plugin:1.3.2:java (default-cli) @ maven-app ---
[WARNING] Warning: killAfter is now deprecated. Do you need it ? Please comment
on MEXEC-6.
Hello World!
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.597 s
[INFO] Finished at: 2014-08-08T17:18:31+05:30
[INFO] Final Memory: 14M/186M
I have highlighted the "Hello World" string in that. Maven executes the commands in the context of a build life-cycle and their are multiple phases to it. You can add more instructions in each phase.
Importing the Project in eclipse
Importing the Project in eclipse
For importing project in eclipse issue the following command
mvn eclipse:eclipse
This will create .project and .classpath file and the project can be imported in eclipse.
mvn eclipse:eclipse
This will create .project and .classpath file and the project can be imported in eclipse.
Monday, August 4, 2014
Jenkins
Jenkins is a continuous integration system which is very easy to setup and quickly comes into action. It has a nice dashboard. Jenkins can be downloaded from http://jenkins-ci.org. Jenkins comes with a set of plugins which can be enabled from the Jenkins dashboard itself.
Continuous Integration system are very important for any Software development environment. They are like running health stats of your various projects. Jenkins supports all major Source code Management tools like CVS, Subversion, Git. The builds can be configured and can run based on cron rules. Jenkins can automatically fetch the source code and than fire the builds. It has integrated support to Ant and Maven. With it's plugin based infrastructure it can handle various kinds of build system.
Some of the important tasks a Continuous Integration system (CI System) does:
Some of the important tasks a Continuous Integration system (CI System) does:
- Check out the source code from given Source Code Control Systems (SCM)
- Build the artifacts based on provided build instructions.
- Run the test cases to determine the sanity of build.
- Archive the artifacts at a configured location.
- Deploys the artifacts on servers.
- Send status mails to various stakeholders
- Maintain the metrics of builds along timeline.
And last but not the least, it will provide you with a sense of quality of software products on continuous basis.
Follow the following video to see Jenkins working.
You might also want to see Tools for Software Development Management
You might also want to see Tools for Software Development Management
Sunday, August 18, 2013
Subversion
Please refer subversion manual for details. This is a simple how to do if you are still doing your code management by copying files among peers, please use subversion.
Install subversion
Download the version for your operating system from
Windows comes with an installer which can be used to install.
Starting subversion
In linux start the subversion using svnserve -d command. In windows it is registered as a service which can be started.
Create a Repository
To store projects in Subversion, first you must create a repository. This must be done to a local drive on a local machine.
svnadmin create /path_to_repository/
Change the path in windows accordingly. If you inspect the directory created, you will find a number of subdirectories. Never work on them directly (except for config file). Use commands provided by subversion to handle your task.
By default subversion uses FSFS and not Berkely database. Keep with the default unless you have a reason to go in the other direction. Keep the default if you do not understand the difference.
It's better to use one of the client tools to handle further tasks. If you are in eclipse there are plugins that can help you out. The popular one is subclipse. See Eclipse Subversion Integration to install it. After installing in eclipse, it will show you a subversion perspective. In the subversion perspective make a connection to the repository.
Create a repository structure. There are again different school of thoughts. If you are dealing with multiple projects each quite separate in nature you might want to go for different repositories itself. If you are dealing with large number of projects related to each than you might want to have single repository and all projects beneath it. Also for each project adopt the convention as prrevalent in the community to have a folder structure like
- trunk - trunk is used for working code
- branches - branches are used keeping a parallel line of development
- tags - tags are used for tags
You can create this directory by using svn add command or to use svn import, if the project is already existing.Subeclipse plugin will provide you better interfaces to handle the task.For basic authentication and authorization look into conf/svnserve.conf
Tuesday, November 8, 2011
Maven Build Number Plugin
For web application usually it's a requirement to pull the latest change set number from source code control and show it up somewhere in application. For the same we can use buildnumber-maven-plugin. To put the plugin in the pom, follow the following XML. Also note that I have tested it with svn only. For others you might want to play with provider implementations.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- do Check and do update actually talk to repository if it's true,
Check would check that there are no local changes. Update would update it -->
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
<!-- This ensures that even if we are not connected to scm than also take
the version from local .svn file -->
<revisionOnScmFailure />
<providerImplementations>
<svn>javasvn</svn>
</providerImplementations>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven.war.plugin.version}</version>
<configuration>
<archive>
<!-- will put the entries into META-INF/MANIFEST.MF file -->
<manifestEntries>
<Implementation-Version>${project.version}</Implementation-Version>
<Implementation-Build>${buildNumber}</Implementation-Build>
</manifestEntries>
</archive>
</configuration>
</plugin>
The above configuration gives an error that "The scm url cannot be null." This comes even after you have given <revisionOnScmFailure />. To workaround this issue, you need to provide an scm entry in pom.xml as follows
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<!-- If you have access to scm then you can place actual url's. Otherwise with
<revisionOnScmFailure /> you can give some false urls as follows. -->
<scm>
<connection>scm:svn:http://none</connection>
<developerConnection>scm:svn:https://none</developerConnection>
<url>scm:svn:https://none</url>
</scm>
Once this is done you will see the MANIFEST.MF file containing two entries as Implementation-Version and Implementation-Build. You can read that from the manifest file and inject that into your pages.
Wednesday, August 17, 2011
Android Maven Integration
Android does not hosts the dependent jars on Maven repositories. There are some very old versions in the repository which are not useful for current android development. The best way to do is to install the dependencies locally. Let's follow the step for the development for maven.
- Make sure the Android SDK is installed locally. Takes the latest stable one.
- Define ANDROID_HOME environment variable pointing to the path of android SDK installation. Do as per your platform. In windows m/c it might look like as follows:
ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk
- Use maven android SDK developer to install the dependencies locally. Follow the link at https://github.com/mosabua/maven-android-sdk-deployer/ to install the dependencies.
- Define the plugin group in settings.xml of maven
<pluginGroups>
<pluginGroup>
com.jayway.maven.plugins.android.generation2
</pluginGroup>
</pluginGroups>
- It's better to create a project of android using android plugin of eclipse. Once the android plugin for eclipse is installed, create a project inside the eclipse.
- Now create a pom.xml in the root directory of the project.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.lalit</groupId>
<artifactId>LalitAndroid</artifactId>
<version>3.0</version>
<packaging>apk</packaging>
<name>LalitAndroid</name>
<dependencies>
<dependency>
<groupId>android</groupId>
<artifactId>android</artifactId>
<version>3.2_r1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.0.0-alpha-13</version>
<configuration>
<sdk>
<!-- platform or api level -->
<platform>13</platform>
</sdk>
<emulator>
<!-- name of avd device, make sure you have created a device -->
<avd>android-emulator</avd>
</emulator>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
</configuration>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
</plugin>
</plugins>
</build>
</project>
Subscribe to:
Posts (Atom)

