Blue Green Deployment

Posted: September 16, 2013 in Best Practices

This is something I learnt today.


The above article, explains how to do a automated deployment. Its great article. It takes the software from final stages of testing to live production with great confidence. Read on to enjoy/appreciate this strategy

I read something new this morning, and came across; how to run Maven tests in parallel.

mvn -T 1 clean install -DcheckCoverage=true -Djunit.maxMemory=2048m

Parallel Test Execution

Run maven tests in parallel execution. Requires to a parallel configuration in pom.xml for the artifact maven-surefire-plugin.












Parallel Surefire Execution in Multi-Module Maven Parallel Build

mvn -T 1 clean install -DcheckCoverage=true -Djunit.maxMemory=2048m

There are many more useful features; need to read about them.

Forked Test Execution

Combining forkCount and parallel

Migrating the Deprecated forkMode Parameter to forkCount and reuseForks

Reference link:

This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of information, viruses, confidentiality, legal privilege, and legal entity disclaimers, available at

I read something new this morning, and came across; how to run Maven tests in parallel.

mvn -T 1 clean install -DcheckCoverage=true -Djunit.maxMemory=2048m

Parallel Test Execution

Maven Command Line Options

Posted: February 4, 2013 in Uncategorized

ISO 8601 Date and Time Format

Posted: October 12, 2012 in Uncategorized

ISO 8601 Date and Time Format – International standard for dates and times representation.



YYYY (eg 1997)

Year and month:

YYYY-MM (eg 1997-07)

Complete date:

YYYY-MM-DD (eg 1997-07-16)

Complete date plus hours and minutes:

YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00)

Complete date plus hours, minutes and seconds:

YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)

Complete date plus hours, minutes, seconds and a decimal fraction of a


YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00)


YYYY = four-digit year

MM = two-digit month (01=January, etc.)

DD = two-digit day of month (01 through 31)

hh = two digits of hour (00 through 23) (am/pm NOT allowed)

mm = two digits of minute (00 through 59)

ss = two digits of second (00 through 59)

s = one or more digits representing a decimal fraction of a second

TZD = time zone designator (Z or +hh:mm or -hh:mm)

T = Denotes the start of time

1994-11-05T08:15:30-05:00 corresponds to November 5, 1994, 8:15:30 am, US Eastern Standard Time.

1994-11-05T13:15:30Z corresponds to the same instant.

SQL to create Oracle Sql Array. Input and output array.


Stored procedure which receives array from java and returns sql array to java.

CREATE OR REPLACE PROCEDURE arraydescriptorproc (p_array_in IN array_input, p_arr_out OUT array_output)AS v_count NUMBER;BEGIN

p_arr_out := NEW array_output ();

FOR i IN 1 .. p_array_in.COUNT



DBMS_OUTPUT.put_line (p_array_in (i));

p_arr_out (i) := p_array_in (i);




Java Program to pass java array to sql array which is used in oracle stored procedure. This program also fetches the value from oracle sql array to java array.

package pradeep;

import java.sql.CallableStatement;import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.SQLException;

import oracle.jdbc.OracleCallableStatement;

import oracle.jdbc.internal.OracleTypes;

import oracle.sql.ARRAY;

import oracle.sql.ArrayDescriptor;

public class TestArrayDescriptor {

public static void main(String args[]) {

try {

Connection connection = getConnection();

String inputArray[] = { “APPLE”, “MANGO”, “WINE”, “BEER” };

CallableStatement st = executeStoredProcedure(connection, inputArray);


} catch (Exception e) {




private static Connection getConnection() throws ClassNotFoundException, SQLException {


Connection connection = DriverManager.getConnection(“jdbc:oracle:thin:url “, “SCPP”, “Password11g”);

return connection;


private static void printOutputArrayFromStoreProcedure(CallableStatement st) throws SQLException {

ARRAY arr = ((OracleCallableStatement) st).getARRAY(2);

String[] outputArray = (String[]) (arr.getArray());

for (String str : outputArray) {

System.out.println(“Output: ” + str);



private static CallableStatement executeStoredProcedure(Connection connection, String[] inputArray) throws SQLException {

ArrayDescriptor des = ArrayDescriptor.createDescriptor(“ARRAY_INPUT”, connection);

ARRAY array_input = new ARRAY(des, connection, inputArray);

CallableStatement st = connection.prepareCall(“call arraydescriptorproc(?,?)”);

st.setArray(1, array_input);

st.registerOutParameter(2, OracleTypes.ARRAY, “ARRAY_OUTPUT”);


return st;



An ExecutorService that can schedule commands to run after a given delay, or to execute periodically.

Below is a Java program to schedule a service which periodically beeps every 10seconds for one hour.

import static java.util.concurrent.TimeUnit.SECONDS;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;

class BeeperControl {
private final static ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);

public static void main(String[] args){

public static void beepForAnHour() {
final Runnable beeper = new Runnable() {
public void run() {
final ScheduledFuture beeperHandle = scheduler.scheduleAtFixedRate(beeper, 10, 10, SECONDS);

scheduler.schedule(new Runnable() {
public void run() {
}, 60 * 60, SECONDS);

Java Decompiler

Posted: February 13, 2012 in Uncategorized

Click the above link.

It’s a easy to use eclipse Plugin Java Decompiler.

Life Cycle of a Trade/End-to-End

Posted: January 11, 2012 in Financials

1. Client Onboarding:
– Sign ISDA Master agreement and CSA Credit support annex.
– Collect Clients data and store in reference data.
– KYC, SPN is created.
– Collateral agreements and margins are agreed.
– Credit Rating checks are performed.
2. Trade Execution: Occurs when traders buy or sell a financial product. This may/may not involve a exchange.
3. Trade Capture/Support: The trades are input into a relevant risk management system.
4. Profile & Loss/Risk Reporting: How much money we made or lost. Realized and Unrealized profit/loss are calculated.
5. Confirmation: The details of trade are sent to clients for confirmation. It may electronic email/phone confirmations.
6. Settlement: Involes pre/actual/post settlement activities.
7. Accounting: GLRS general ledger reconcilation process is the process of reconciliating the month end ledger balances to the sub-ledger and source transaction system.