Skip to main content


Showing posts from 2011

Swimming the Corporate Ocean -3 : Sleeping with a Moron

Hi to all my corporate friends !!! Hope you are all enjoying your existence in this corporate domain. I was at peace over the past few months and due to my work, could not concentrate on what others are doing around. But over the past month, I have had enough content to write. I was thinking whether disclosing those would be professionally correct as it might hurt the sentiments of many like it did hurt mine, but then decided not disclosing and warning each one of you would be well, ethically wrong.

In the run for power and money, there is one aspect of life that we almost shred together. We have almost forgot the word Compassion. Just think through this, you are hurrying in your vehicle to an all important meeting with a big client. Just along the road, you see someone tripping over their bike and falling right before your eyes. How many of you can say from your heart that you will go and lift that guy up even if it means missing/delaying your all important meet? I was thinking abou…

How to create a java SOAP Client to test a .Net web service

This is how you can test your web service in Java without creating any SOAP Client. Using this you can access Web Services created using any technology, in specific .Net.

 * To change this template, choose Tools | Templates
 * and open the template in the editor.

package com.fugoconsulting;


 * @author pandi
public class sendRequest {

    public String sendRequestToIRDA(String request) {

    String response = "";
    try {
            String soapXml = request;
            URL url = new URL(""); //for testing .Net Service
   conn = ( url.openConnection();
            conn.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
   conn.setRequestProperty("SOAPAction", "http://test/Service/Test");

Automating Attachments process in Openbravo and the Newton's third law of Motion

Newton at times gets it right. I love his third law of motion. It’s the Newton’s third law that inspired to do something about which I am posting now. I had to work on a Excel processing scenario where data in the form of excel was to be transmitted between Openbravo and another legacy System (I prefer to call .N**  applications legacy systems). Filling the * is left to your imagination.

For data import, I first thought to create an import process like this, but then it was a day to day transaction, so thought it was not so efficient for auditing process. So I decided to use the Openbravo Attachments. So the user uploads an excels and saves the record and I process it accordingly. Part 1 complete. The next stage was creating a report for legacy system and providing it to the user. First I generated it in a particular drive and then users would access it. That was not proving to be good due to many access issues. Then I tried to create a File Dialog reference that would sa…

Creation and Deletion of folders in Java

Think the program is self-explanatory. Please write to me if I have missed anything or if you have any more doubts.

 * @author shankar
//This Program will illustrate how to create and delete folders using Java code
public class JavaApplication1 {

    public static void main(String[] args) {
            //Mention the folder to be created in the constructor
            //The entire file structure will be created
            File folder = new File("G:/tempfolder/temp1");
            folder.mkdirs(); //this will create the entire File structure if it does not exists

            File folder1= new File("G:/tempfolder/temp1/temp2"); 
            folder1.mkdir(); //this will create the last folder alone if the corresponding path exists

            boolean value = folder1.delete(); // this will delete the temp2 folder alone
                System.out.println("File Deleted");

How to process XML File in java

I had an requirement to parse an incoming SOAP Message object and do certain manipulations over it. I had to do it outside the web service route, so there was no SOAP related process methods available for me. All I had was a xml file in the Input Stream.

I searched a lots of link for xml processing, used many libraries most of which I do not even remember the  name. Then my colleague and another contributor to these blogs suggested to use the DOM Parser provided by default in java. Though it was little confusing in the beginning, with the help of couple of other blogs, we managed to complete it without any external libraries. I have attached the code and the xml file content for your reference.

XML File
Name : test.xml

<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="">
        <ns2:RegisterComplaint xmlns:ns2="http://webservice/">

Using shell script for day today functions

Yesterday I wrote a post about creating a basic shell script. Today I will present a sample file that I use daily and how it could be more useful. As soon as I open my system, these are the applications that I start.
1. Google Chrome : First Gmail, cricinfo and then hootsuite (my social network client)
2. Thunderbird : My Email Client for official mails
3. Apcahe Tomcat
4. Folders

I use my shell script to do all these tasks at a single command (or even double-click which I usually do not prefer..;) )
This is how my shell script looks:

echo "Starting Apps"
google-chrome &
echo "Chrome Started"
thunderbird &
echo "Thunderbird Started"
sudo /home/shaan/apache/bin/
echo "Tomcat Started"
Note after google-chrome i use space separator for opening multiple tabs in chrome.  Cool isn't it? Write back to me what all shell scripts you use in your daily life.


How to write a simple shell script file

A shell script is the windows equivalent for a batch file. Script files are mainly used to automate tasks or run a series of command with out constant user interaction. There were once really famous way to run automated tasks. There are many GUI based applications that have replaced them, but they have still not lost their charm. Let us see here how to write a simple shell script file. As in all cases, let us say hello to the world..;)

1. Open a simple editor. Create a new file . "sh" is the extension for shell scripts.
2. The first line in any shell script should be, #!/bin/sh . This is used to indicate to the Operating System the type of the file to be processed.
3.  "echo" is a simple command that is used to print values of variables or static content on the console as output. As we wanted to say hello to the world, our second line will be echo "Hello World".

Done. Yes. We are done with our first shell script code. If I was not wrong, th…

Retrieving Openbravo properties in DAL code is the configuration page in which we specify the source folder, the database configuration and many other configuration parameters. For more information on configuration, refer here.

There will be many cases where we will need the values of the parameters configured in the Few cases are.
When you have a native jdbc connectivity code and you do not want to change that, but bring that under a DAL code.When you have attached a file to a record and want to process that using the actual file path.When you need your current database name. When you need your current database parameters like URL, username,password, etcWhen you want the current context name using which the instance will be accessed.Now lets see how we can access the in DAL code.
Import the package  org.openbravo.base.session.OBPropertiesProvider.Use thegetProperty(property name) method on the OBPropertiesProviderPass the name of the parameter w…

உன் வாழ்க்கை உன் கையில்

நான் ஒரு பதிவு எழுதி நீண்ட நாட்கள் ஆகிவிட்டது, ஏதாவது எழுதலாம் என்றால்  பல முனைகளிலிருந்து பலத்த எதிர்ப்புகள். ஆகையால் இன்று என்னை மிகவும் பாதித்த ஒரு பாடலை இங்கு பதிவு செய்கிறேன். நீங்கள் வாழ்க்கையை வெறுக்கும் பொழுது, இதை கேட்டால் உற்சாகம் பிறக்கும், நீங்கள் உச்சத்தில் இருக்கும் பொழுது இந்த பாடலை கேட்டால் ஒரு நிதானம் பிறக்கும். இந்த பாடல் "புதுப்பேட்டை" என்ற படத்தில் உள்ள ஒரு பாடல். என் நெஞ்சில் நீங்கா இடம் பிடித்த ஒரு பாடல். இதோ உங்களுக்காக...
ஒரு நாளில் வாழ்க்கை இங்கே எங்கும் ஓடிப்போகாது, மறுநாளும் வந்துவிட்டால் துன்பம் தேயும் தொடராது... எத்தனைக் கோடி கண்ணீர் மண் மீது விழுந்திருக்கும், அத்தனை கண்ட பின்பும், பூமி இன்றும் பூ பூக்கும்... கருவாசல் விட்டு வந்த நாள் தொட்டு, ஒரு வாசல் தேடியே விளையாட்டு, கண் திறந்து பார்த்தால் பல கூத்து, கண் மூடிக்கொண்டால்...
போர்க்களத்தில் பிறந்துவிட்டோம், வந்தவை போனவை வருத்தமில்லை, காட்டினிலே வாழ்கின்றோம்,  முட்களின் வலி ஒன்றும் மரணமில்லை, இருட்டினிலே நீ நடக்கையிலே, உன் நிழலும் உன்னை விட்டு விலகிவிடும்... நீ மட்டும் தான் இந்த உலகத்திலே, உனக்கு துணை என்ற…

A Touching Poem...

A Touching Poem......

I went to a party Mom,
I remembered what you said.
You told me not to drink, Mom,
So I drank soda instead.

I really felt proud inside, Mom,
The way you said I would.
I didn't drink and drive, Mom,
Even though the others said I should.

I know I did the right thing, Mom,
I know you are always right.
Now the party is finally ending, Mom,
As everyone is driving out of sight.

As I got into my car, Mom,
I knew I'd get home in one piece.
Because of the way you raised me,
So responsible and sweet..

I started to drive away, Mom,
But as I pulled out into the road,
The other car didn't see me, Mom,
And hit me like a load.

As I lay there on the pavement, Mom,
I hear the policeman say,
"The other guy is drunk," Mom,
And now I'm the one who will pay.

I'm lying here dying, Mom....
I wish you'd get here soon.
How could this happen to me, Mom?
My life just burst like a balloon..

There is blood all around me, Mom,
And most of it is mine.
I hear the medic say, Mom,
I'll die i…

Setting Date field in Openbravo Callout

Callout in Openbravo is the feature that enables us to do runtime operations with the data. Callout is generally attached to a field and triggered in the onchange event. Openbravo has implemented a java class file called, that we can extend and use it for implementing Callouts. For more information on implementing callouts, refer here and here. To get lastchanged value, referhere. When manipulating data values, I found it little tough when setting date values. So I have provided the code that I used to set date values in Openbravo Callout.
package org.openbravo.erpCommon.ad_callouts; import javax.servlet.ServletException; import*; import java.util.*; import java.text.*; import java.lang.*; import org.openbravo.utils.FormatUtilities; import org.apache.log4j.Logger; import org.hibernate.criterion.Expression; import org.openbravo.erpCommon.ad_callouts.SimpleCallout; import org.openbravo.base.secureApp.VariablesSecureApp; import org.openbravo.dal.service.OBDal; …

Love “Redefined”

Love “Redefined”
I was born in a secluded village on a mountain.  Day by day, my parents  plowed the yellow dry soil   with their backs towards the sky.

I have a brother who is 3 years younger than me.  I wanted to buy a
handkerchief, which all girls   around me seemed to have. So, one day I
stole  50 cents from my father's drawer.  Father had discovered about the stolen money right away.

He made me and my younger brother kneel against the wall as he held a
bamboo   stick in his hand.

'Who stole the money?' he asked.

I was stunned, too afraid to talk. Neither of us admitted to the fault, so he said, 'Fine, if nobody wants to admit, you two should be beaten!'

He lifted up the bamboo stick.

Suddenly, my younger brother gripped father's hand and said, Dad, I was the one who did it!'

The long stick smacked my brother's back repeatedly.  Father was so angry that he kept on  whipping my brother until he lost his breath.

After that, he sat down on our stone bed and scolded…

Retrieving last changed value in Openbravo Callout

Callout in Openbravo is the feature that enables us to do runtime operations with the data. Callout is generally attached to a field and triggered in the onchange event. Openbravo has implemented a java class file called, that we can extend and use it for implementing Callouts. For more information on implementing callouts, refer here and here. As Callouts are attached to a field, you can use the field name with the prefix 'inp' to retrieve the run time value. Based upon that, you can do manipulations. But using this method, restrict the usage of that callout to a particular field. Say for instance I have a same logic to be implemented across five different fields, then I have to write 5 different callout, as we are hard coding the field names. But there is also a method provided to retrieve the last changed field and then using that, you can retrieve that value. I have provided below the code, that retrieves the name of the last changed field and then the v…

Changing Timezone in Postgresql, Ubuntu

Timezone and locale are integral concepts that one should be aware of when implementing a System. For example. if you create a database in PostgreSql, it will use the default System settings for the database. Lets say you have a server in UK and your client is US. If the client tries to retrieve the current date or time, it is going to show the UK time and not the US one.
Today I encountered a different issue in our client place where the Ubuntu timezone and PostgreSql timezone were showing a incorrect values. Instead of Indian Standard Time (IST) it was showing Pacific Daylight Time(PDT). These are the steps that I followed to change the timezone to IST in PostgreSql and Ubuntu.
Changing timezone in Ubuntu:
sudo dpkg-reconfigure tzdataYou will be prompted to choose the continent and then the area. Provided screen shots where we configure the location.
Use TAB key to navigate to the OK button and then press Enter.

The changes will get reflected immediately. To check it you can open a n…

HTMLArea in Openbravo

References are a key feature that one should be aware of in OpenbravoERP. References provides us options to change the way a field is displayed in the Application. There are many standard reference types like, Table, TableDir, Date, Integer, ImageBlob, etc. These are mainly bundled inside the WAD. In addition to the existing list of references listed here, one can add more references like RadioButton, FileDialog, etc. For more information on how to extend a base reference to your module, refer here.

HtmlArea Reference:
The use of this reference type  it to display the value based on the html code provided. It can be used in many scenarios. I have provided a basic few scenarios here.
To display different colour on the field based on the condition.To display remote content in the field.To embed HTML code available elsewhere.Used when you want to have a link to any other openbravo window or process. This is can done by using <a href="link"/> where link is the url of that c…

Ubuntu General Tips - 1

I have been using Ubuntu for almost two years and having faced few issues, I planned to write a series on the steps I followed to resolve it.
1. Append date into to log in Ubuntu:
When we use commands in log, we write the output to some file, that will make debugging easier. Say for instance, we run an ant script and want to write the log to a file. In normal case, we would give the following command,
ant command > filename
But in cases where we need to take periodic backup or log the output, its better to append date with the log. You can assign the date to the log dynamically using the date property  of Ubuntu. The Syntax for appending/setting date to a log dynamically is by using  `date +"%F"`
Eg., When you want to take backup of postgres database daily, you can use this command in the terminal.
[sourcecode] pg_dump -U postgres databasename  > bkp-`date +"%F"`.out [/sourcecode]2. Command to Compress and Extract files in Ubuntu:
Compress and Decompress using…

Creating Charts in Openbravo Reports

Reporting is a decisive factor that determines the reach of an ERP among the Users. OpenbravoERP in particular have laid a lot of emphasis on the reporting structures. iReport is the tool officially supported by Openbravo for generating reports within Openbravo.For basic on developing reports in iReport, referhere. You can download iReporthere.

                   iReport is an opensource java based reporting tool. iReport provides lots of features like sub-reports,crosstab references, and various presentation gadgets like charts, bar graph, plotted line, etc. I have provided the steps for creating charts in reports in Openbravo.

Lets see an example. I have 10 product categories and 500 products. I want to see which products fall under which category and how much is the stock available. Lets see how this could look.
 If you have not worked in iReports before, you can take a look atthis. You can download iReport here. To add a chart to a window, use the chart tool icon in t…