Proxy settings for maven

All of a sudden my maven commands started giving errors. I realized that maven was not able to connect to central repository.

I made the following changes to /conf/settings.xml and then it started working fine:


Posted in Maven | Leave a comment

Handling clob variables in plsql

If you are storing more than 4K characters in the database or more than 32K characters in pl/sql, then you are advised to use clob datatype instead of varchar2.

These functions will be very helpful in handling clob variables:

create or replace function CLOB_TO_BLOB (p_clob CLOB) return BLOB
l_blob blob;
l_dest_offset integer := 1;
l_source_offset integer := 1;
l_lang_context integer := DBMS_LOB.DEFAULT_LANG_CTX;

dest_lob =>l_blob,
src_clob =>p_clob,
dest_offset =>l_dest_offset,
src_offset =>l_source_offset,
warning =>l_warning
return l_blob;

create or replace function blob_to_clob(p_blob blob) return CLOB as
l_clob clob;
l_dest_offsset integer := 1;
l_src_offsset integer := 1;
l_lang_context integer := dbms_lob.default_lang_ctx;
l_warning integer;


if p_blob is null then
return null;
end if;

dbms_lob.createTemporary(lob_loc => l_clob
,cache => false);

dbms_lob.converttoclob(dest_lob => l_clob
,src_blob => p_blob
,amount => dbms_lob.lobmaxsize
,dest_offset => l_dest_offsset
,src_offset => l_src_offsset
,blob_csid => dbms_lob.default_csid
,lang_context => l_lang_context
,warning => l_warning);

return l_clob;


Posted in Database | Leave a comment

Rendering a flex widget in Extjs

In the head section include the following:

    extjs/ext-all.js in the script tag with type=”text/javascript” attribute

    swfobject/swfobject.js in the script tag with type=”text/javascript” attribute

    extjs/resources/css/ext-all.css in the link tag with rel=”stylesheet” type=”text/css” attributes

Ext.onReady(function () {
var win = Ext.widget(‘window’, {
title: “Inspections Widget!”,
layout: ‘fit’,
width: 700,
height: 500,
resizable: true,
items: {
xtype: ‘flash’,
url: ‘;,
flashVars: {locale:’en’,dealerCode:’XTIMEMOTORS’,webKey:’xtimemotors’,make:’HYUNDAI’,vin:’5NPEU46FX6H146379′,day:’01/20/2015′,customerName:’DABROWSKI, AMY’,model:’SONATA’,year:’2006′}

Note: You can download swfobject.js from


Posted in Extjs, Flex | Leave a comment

Search for files containing a text on linux

I found this command to be very useful. Often we would like to search for a file containing a text.

$ find /path-here -type f -exec fgrep -l ‘text-to-find-here’ {} \;


$ find /home/venkat -type f -exec fgrep -l ‘foo’ {} \;

Posted in Linux | Leave a comment

Handling non-english characters in .java files

You should save the .java file as “Encode in UTF-8 without BOM” using an editor like Notepad++.
Do not use Notepad. Notepad introduces some special characters because of which the jvm will throw compiling error because of the special characters.

This applies to .properties files also, which will have non-english characters.

Posted in Java | Leave a comment

Handling OutOfMemory problems in Java

I am now dealing with “big data” applications.
I built applications which process large volumes of data and store them in different data stores like Database, Solr etc.

One of the ways to handle OutOfMemory problem would be to specify the min. and max memory that the JVM can use in your program.

By default a jvm of a Java application uses only 64 MB. We can specify the min and max memory that the JVM can use by using following command line options:
1. -Xms specifies the minimum memory
2. -Xmx specifies the maximum memory

You have to specify the memory values in terms of Megabytes as shown in the following Example:

$ java -Xms1024m -Xmx2048m HelloWorld

You can check the total memory available for the JVM in your program by using the following statement:
This will return the total memory in terms of bytes.

You can check the free memory available for the JVM in your program by using the following statement:

Posted in Java | Leave a comment

Couchbase as properties repository

Couchbase is a NOSQL persistent data store. You can store Serializable Java objects in couchbase.
I have used Couchbase extensively to save all the configurations properties. I have saved all the properties as JSON objects. These objects can be created and edited directly using the admin console provided by Couchbase.

You can perform asynchronous get/set operations with couchbase.

I have observed that the get/set operations fail at certain times. Hence, I have also implemented retrying mechanism. In the retry mechanism I add the the failed tasks to a List of pending tasks. I perform the get/set operations of these pending tasks by means of a separate Timer task which is scheduled at a regular interval.

Posted in Java | Leave a comment