Posts

Show GIT branch on CLI

Add the following code in  ~/.bashrc alias ls='ls --color=auto' PS1="\[\e[1;32m\][\u@\h \W]\$(parse_git_branch)\[\e[0m\] " function parse_git_branch () {        git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' } Type the following command to see the GIT branch name. source ~/.bashrc

Parse Bill n Pay Customer Info Json Response

 //{}&&{"biller":{"customerinfo":{"customer":[{"firstname":"S","middlename":"R","lastname":"S","internalid":"502CD927-651E-E67C-A3FD-AABEC48F026B","id":"502CD927-651E-E67C-A3FD-AABEC48F026B"}]}}}                 JSONParser parser = new JSONParser();                 //cut out first 4 characters {}&&         jsonString = jsonString.substring(4);                         Object obj = parser.parse(jsonString);         JSONObject jsonObject = (JSONObject) obj;         JSONObject biller = (JSONObject) jsonObject.get("biller");         JSONObject customerinfo = (JSONObject) bi...

Curiosity Cam

Live streaming by Ustream

Auto Increment Oracle Table Id Mapping With JPA Entity

When you create entities file of the mysql table with JPA, auto increment field 'id' is mapped as follows.     @Id        @GeneratedValue(strategy = GenerationType.IDENTITY)     @Basic(optional = false)     @NotNull     @Column(name = "id")     private Long id; However, Oracle doesn't support auto increment. Hence sequence generator is set up for the field id of table. The respective entity mapping for 'id' should be changed as below.     @Id        @GeneratedValue(strategy = GenerationType.IDENTITY)     @Basic(optional = false)     @NotNull     @Column(name = "id")     private Long id;     @SequenceGenerator(initialValue=1, sequenceName="INVOICE_SEQ",allocationSize=1,name="invoice_seq_name")     @GeneratedValue(generator="invoice_s...

Debug JSF lifecycle

Dynamic Image in Jasper Report

jrxml content <image>                 <reportElement x="5" y="5" width="200" height="90"/>                 <imageExpression class=" java.awt.Image "><![CDATA[$P{logo}]]></imageExpression>             </image> Java Code to convert image from URL into BufferedImage        URL url = new URL("http://localhost/image/image.jpg");         // Read the image ...         InputStream inputStream = url.openStream();         ByteArrayOutputStream baos = new ByteArrayOutputStream();         byte[] buffer = new byte[1024];         int n = 0;        ...

Bill & Pay Web API Call Example

What is Bill & Pay? Businesses of any size can affordably send electronic invoices and receive ACH and credit card payments online from their customers. Bill & Pay is the most comprehensive product of its kind on the market today. It is loaded with features and options, while remaining affordable and easy-to-use . Checkout out Bill & Pay for QuickBooks users or Bill & Pay Easy Invoice for non-QuickBooks users. Benefits of Bill & Pay  Here is sample java code for authentication. String xmlRequestData = "<?xml version=\"1.0\"?><request><response><type>xml</type></response><biller><authenticate><id>1111</id><password>password</password></authenticate></biller></request>"; public String xmlPost(String xmlRequestData) {         String result = "";         OutputStream...