Wednesday, December 14, 2005

Capital Markets - a Fascinating Journey

I'm very fascinated by the Capital Markets and their workings. Incidentally, my current work is developing a wealth management solution product that shall be implemented for major banks in US. The current task is to develop the Portfolio Performance pages. Business knowledge and understanding of the performance measurement techniques were impediments to roll out the task on time. A business analyst from the client was sent to provide inputs on the domain

With client's presence in the office and questions getting answered instantaniously, we are in a pretty good shape now. This was more of a learning exercise than just coding. Reading the book "Pratical Portfolio Performance Measurement & Attribution" helped a lot in getting upto speed. More specifically, it helped me to get a clear understanding of the Dietz's formula.

I'm delighted on hearing that I was nominated for a week long training on Financial Concepts and Capital Markets, starting next week. More inputs on the Finance Domain. But, I'm still not an investor ;-)

Sunday, December 04, 2005

My New Laptop

I bought a new laptop on the weekend. It is Compaq Presario V4000/4103AP make with ubiquitous disk space and RAM. The most impressive features are the wide screen and the TFT display, playing Age of Empires/Kings on the laptop is a delight. Now, I can do some serious programming on the weekend and play my favorite games - The Commandos and Age of Empires. Has been trying from a long time to learn Ruby, but that remained elusive due to the tight work schedules, client visits. I hope with the laptop, I'll be an Rubyist soon. :-D

Tuesday, November 29, 2005

Humor: Knowledge Theorem

This blog entry is for those cribbing about their low salaries and comparing their salaries with their friends in other companies. Not intended to hurt anyone's feelings and opinions.To be taken in a lighter spirit.

I received a mail today about something called as the Knowledge Theorem, that states "An Engineer cannot make as much money as the Politicians, artists". The author used the following "inductive procedure" to substantiate the theorem.

Two adages everyone is aware of - "Knowledge is Power" and "Time is Money". If represented mathematically, these two adages would be

Knowledge = Power
- eqn. 1
Time = Money - eqn. 2

High school physics has taught us that

Power = Work/Time.

From eqn. 2, Time = Money, so

Power = Work/Money

From eqn. 1, Knowledge = Power, so

Knowledge = Work/Money

Rearranging the quotient and the divisor would result in

Money = Work/Knowledge

The lesser the denominator, the more is the fraction. Hence proved!
If a person is earning less, that means he is more knowledgable. The converse of the statement is, however, not true.

Wednesday, November 16, 2005

The best description of OO

Had been reading an article titled "OO in One Sentence: Keep It DRY, Shy, and Tell The Other Guy" from pragmaticprogrammer. A funny sounding title, but the content explains the essence of OO in a more interesting way. I liked a particular paragraph so much that I'll quote it all in verbatim:
"The best code is very shy. Like a four-year old hiding behind a mother’s skirt, code shouldn’t reveal too much of itself and shouldn’t be too nosy into others affairs. But you might find that your shy code grows up too fast, shedding its demure shyness in favor of wild promiscuity. When code isn’t shy, you’ll get unwanted coupling."

This is the best description of OO I've heard of so far.

Wednesday, November 02, 2005

AJAX Mania

Oflate, the "ajax" is in the limelight. The technology has created so much excitement among the web developer community and eventually is conferred with laurels. Some of the accolades received are "The next big thing", "revolutionary web technology", "web2.0", etc. The technology indeed has a potential and some applications have leveraged and demonstrated it. The most famous and often cited are the google maps, gmail, flickr.

Recently, rediffmail rolled out a new version of their web mail that offers some goodies implemented using ajax - mail preview, instant download of attachments, drag drop unwanted mails to trash, auto suggest of email ids while composing a mail, etc. It is now pleasure to use rediffmail with all the ajax goodies.

We have an ajax implementation in our product to retrieve information at lower levels from a hierarchically organized data, on click of expand/collapse (+/-). The existing functionality retrieved all the data at once, dumped the data behind the div tags and the selected div would be made visible using javascript. This worked fine for smaller amounts of data and for large data, apparently, became a bottleneck in terms of retrieval and rendering times. Subsequently, the issue has been resolved by implementing ajax. When someone suggested the ajax solution to our chief architect, he suggested some concerns and asked us to explore more for an optimal solution:

1. Browser compatibility - there should be a utility to check for the compatibility of the browser for ajax to serve the ajaxified and no-ajaxified versions accordingly.

2. Increase in the server hits for every ajax call

3. Feedback mechanisms during ajax calls and appropriate messages on the screen

4. Processing order of the ajax calls

5. The change should have a least impact on the existing functionality/code and should be maintenable.

These concerns were very realistic and very soon we realized that ajax is not a panacea. The final solution used ajax at only certain points where it added value. My request to fellow developers and friends is not to get carried away by the excitement, understand the true potential of the technology and implement it at a place where it makes sense.

Friday, October 21, 2005

Updations on XML

I didn't have much work for today except for attending a series of (boring) meetings and churning out word docs and spreadsheets, the weekly status reports and the rest of the junk, tch!. A friend of mine mailed a problem that triggered a deluge of mails with interesting and impressive ways to solve the problem. The hinge point of the problem relied on a XPath expression that should perform a "reverse search" - retrieve all nodes with any attribute having value "abc". Here is my approach:

1. The attribute can be nested anywhere in the document, so my expression starts with //
2. Should return all matching nodes, //*
3. Th test condition is a predicate, //*[]
4. The tricky one, each is a attribute node and can be any attribute,
//*[@*='abc']

That completed the XPath expression.

The complete solution for the problem was decided to be implemented using XQuery. Awesome! Sometime back, I implemented a basic screen scraper (HTML parsing) using XQuery, but that was stop-gap solution and didnot scale well. I'm still a novice to XQuery and wanted to learn the nitty-grrity of the FLWOR expression. As XQuery relies on XPath, I chose to update on the XPath2.0 first. The new version has added functions to make lives easy. Some of such functions are collection,current-date,current-time,implicit-timezone etc. Ofthese, the collection function, apparantly, was found very useful. It can be used to overcome the memory issues with the doc/document() function. This would not only eliminate a round of looping but also offers a clean solution in terms of performance.

Thanks to my friend, my XML arsenal got enriched with new info.

Monday, October 10, 2005

Program to an Interface or Design Pattern

Nowadays, I often hear people saying I used the X design pattern, Y design pattern giving a lengthy list of all the patterns. But when asked what is the motivation behind using a particluar pattern, there is always a stunning silence. Most of the developers these days want to make their resume impressive, so they use every available api and design patterns. The outcome is code that is not readable, bloated and not maintenable.

This reminds me an incident in a well known Telugu movie - the hero wants to learn the fine points of a martial art and want to avenge the death of his brother. The master asks him to realize that the true meaning of the martial arts is Non Violence. The analogy many not be apt, but sensible developers should realize that the design patterns help in producing code that is adhering to the OO principles and code that is maintenable.

Power of XML Entities

I have been using XML for quite sometime in my projects and was quite comfortable with the semantics and syntax. Today, I added a new tool to my XML arsenal - realized the true power of "entities". So far, my understanding of entities is that Entities are variables used to define shortcuts to common text viz. "& copy ;" for © etc. Now, I would like to paraphrase the statement to Entity references are references to entities. The reason for this ...

My requirement was to copy the contents of two config (XML) files into one single config file. The two files are in different directories. I was evaluating the possible solutions to pick an optimal option. A few lines of code did the work, in a elegant way:



<!ENTITY file1 PUBLIC "path1/file1.xml" "path1/file1.xml">
<!ENTITY file2 PUBLIC "path2/file2.xml" "path2/file2.xml">
<root>
&file1;
&file2;
</root>


The entities would get resolved while parsing the file and the contents get copied dynamically. This is such a useful feature, saved lot of LOC and moreover the bottleneck of "transformation" has been avoided. And to display the code fragment correctly on this page, I had to use "& lt ;" and "& gt ;" :-)

Monday, October 03, 2005

A week full of activity

Last week was full of Activity. on Monday and Tuesday, I worked for 14 hours a day under a "unrealistic" target. Whew! Wednesday and Thursday were bit eased up with 10 hours of work. I had to accede to such unplanned and a work without a process as it was a request from the client. Friday was a day of relaxation with absolutely nothing to work on except going thru the BRD of the work for the subsequent week.

On the weekend, I met some of my colleagues from previous companies and the topic immediately was the burgeoning job market in Bangalore and Hyderabad, and interview (er)s. It seems one of them has attended an interview with a major telecom company in Hyderabad. The first round went off well, both the interviewer and interviewee enjoyed the discussion talking many things about technology, issues faced in the project and how they have been resolved. The next round, it seems, was pathetic.

An (incompetent) interviewer with more than 8 years of experience and miserable communication took the second round. I couldnot help laughing when my friend told that the person literally barged into the room, shook hands and immediately asked about JVM architecture and the difference between "==" and ".equals()". My friend got a shock of his life at the crude behavior and started answering with patience. Soon, he realized that the interviewer is expecting bookish answers and is reluctant to accept any answers other than what he had in the mind. My friend should have known "Telepathy". A couple of funny questions and answers from the interview:

Interviewer: "Which method will you use for file upload, doGet() or doPost() "
My Friend:"doPost(), as multipart requests are supported, explained about multipart requests, form processing of the fileupload, limitations with doGet()"
Interviewer:"Fine, but you didn't tell that doGet() doesn't support transfer of binary content."


A more funny interaction occured at a later stage..

Interviewer:"Do you know design patterns? How did you use them in your projects?"
My Friend;"I know core java patterns and J2EE patterns, but don't use them because they are there. If there is a compelling reason, I use a design pattern. In my projects I used Factory, Visitor, Singleton.. the list went on"
Interviewer:"Hold on.. You said Singleton.. How did you use Singleton, How did you implement a Perfect Singleton?"
My Friend: (Routine Question)..gave the bookish answer the interviewer was expecting and the end added "I prefer using registries instead of singletons as singletons are not interface friendly and pose problem in a clustered application"

Now it was the turn of the interviewer to get shocked and it seems he was reluctant to take the answer and started arguing insensibly. My friend remained silent, nodded his head in agreement to whatever the other person said and finally got an offer from the company and now the interviewer is his project lead..hehehe!
These days it is not uncommon to hear about such incidents.

Wednesday, September 21, 2005

A day with Hibernate

I always felt I had a sound understanding of hibernate and offered "expert" advise to my friends over chat/phone. I chanced to get Hibernate in Action and wanted to try out the traditional "Hello World!" example. Immediately fired up Eclipse and started coding, what a pleasure it is to code! I soon realized that my belief is a fallacy as there were exceptions on the console. The exception was org.hibernate.HibernateException: database product name cannot be null. Wrestled with the exception for a couple of hours but in vain. Upon retrospection, I noticed that there was an unwanted line of code

configure.setProperties(System.getProperties());

This line was overriding the properties already loaded by configure() method. If hibernate.cfg.xml is used to configure hibernate, c3p0 pool then the following lines of code would suffice:

Configuration cfg = new Configuration().configure();
SessionFactory factory = cfg.buildSessionFactory();


My hibernate skills are withering and need updation, more pratice is required to keep up the pace.

Friday, September 16, 2005

Code as Design or ????

An interesting conversation with my friend brought out a point of concern - what exactly is software design? I always advocated that programming is essentially designing software, but most of my colleagues differ. I feel that programming is not just building the software but a more *disciplined* process of writing "meaningful" code. There are (increasing)instances of people trying to keep away from coding after they have been conferred august sounding designations by their employers. Unfortunately, some of friends whom I respected tremendously for their coding ability are following this band wagon concept.

One item from such species drew an illustration of Turbine Production. What an example, Duh! His argument was that there will be a separate design team (sitting in plush air conditioned rooms gazing at their monitors and building models, and doing all sorts of simulations) responsible for coming up with design documents and the shop floor uses these designs for production. This model is convincing as long as it is the production of tangible stuff. But, when it comes to software development, the model completely fails. Can Oceanography be applied in the space?

I firmly believe a well written code is a testimonial for good software design. Many seem to differ and vote for designing as an abstract intellectual exercise. I don't want to impose my belief and conclude this entry, I'll update this entry with opinions from my friends and fellow developers.

Tuesday, September 13, 2005

A thought about Spring

I started reading the book "J2EE Design and Development" by Rod Johnson. I should have read this much earlier. It is very interesting and thought provoking book. Intrigued by the reading, I wanted to try out Spring and feel the "IoC". Downloaded the spring framework and started coding my first bean. After gettimg my feet wet, I realized the power of IoC. A very cool concept. Hail Spring!!!

Friday, September 09, 2005

Role of an System Analyst

I have an impressive designation with my employer - System Analyst. Had been chatting with a friend about the roles and responsibilites of a System Analyst, the topic somehow spurred interest and we decided to come up with a summary on what is expected of a (true) System Analyst and later juxtapose it with our current roles.


We chose to explore the job sites and identify the requirements specified by the companies for a System Analyst profile. The following is the (exhaustive)summary we have come up with:
1. Domain
------------
a) Filtering final system requirements, from a free flowing discussion in business terminology.
b) Explaining constraints of technologies chosen to Business Analysts/Domainexperts.
c) Explaining constraints of business requirements to Development team.
d) Conducting process facilitation with clients to identify
organizational,information and integration requirements.
e) Capturing pertinent problem domain information from domain Expert review
sessions.
f) Reviewing system requirements for problem domain completeness.
g) Promoting interoperability of business and technology. Acts as the bridge
between the understanding of the problem domain and the technology requirements.

2. Technical
-------------
a) Developing standards, templates, and procedures to expedite the development
b) Contributing to company wide methodologies.
c) Responsibility for a collection of Use Cases.
d) Disseminating system requirements to the development team.
e) Monitoring the activity within the Online Communities, asking questions
where necessary to support the needs of the project.
f) Assisting the test team to develop test plans and test cases.
g) Has worked extensively as a developer.

3. Management
--------------
a) Assisting in developing project proposals and comprehensive project budgets.
b) Working with Technical Architect and Project Manager to balance business
requirements, technical requirements, and costs.
c) Assisting project management in the understanding and control of Scope.
d) Working independently on strategic issues with client.

Additional good to have Qualities:
----------------------------------
Broad knowledge of business issues and processes such as Strategic Planning, Business Re-Engineering as well as IT resources and enabling technologies.

After reviewing the notes, I wondered if any company hiring system analysts really provides the chaps with good challenging work or is it just an august sounding title.
I must admit that my (little) experience doesn't match the above requirements. Way to go along the long road, buddy!

Thursday, August 11, 2005

SQL for Java Objects

I googled for something and (fortunately) hit upon this. They claim that this library enables querying objects in a collection using a syntax similar to SQL syntax. I tried a few examples and found it living upto the claim. There is another similar open source product from Apache by name JXPath, that uses XPATH syntax instead of SQL. Hmmmm.. some pabulum (atlast!)

Tuesday, July 12, 2005

Importance of equals() and hashCode() ...

An interesting point has been blogged on my friend's blog. It indeed gave some insight into using the equals() and hasCode() methods for objects used in HashMap and the rest java.util.Hash* Collections. One related link in this regard:
http://www.mindprod.com/jgloss/hashtable.html

Tuesday, July 05, 2005

Reading... Reading... and Reading...

Oflate, I've been reading a lot of stuff mostly articles written by Martin Fowler and the nice work on the Thoughtworks website. I chanced to read the article OO Principles and Patterns by Robert C Martin and I liked it very much.
There is a nice book by name "Refactoring to Pattenrs" by Joshua Kerievsky that explains how design patterns can be used to refactor code. I believe that people in the roles of software designers and architects must have a look at these articles.
An interesting quote from one of the Martin Fowler's articles:
"When you no longer code not just can you miss out on changes that occur with this technological flux, you also lose the respect of those who do code."

Tuesday, June 28, 2005

Dynamic Proxies...

A thought about alternatives to AOP drove me towards exploring the little known (atleast to me)dynamic proxies that are in java landscape since JDK1.3. I tried a couple of examples and although it was a good feature, I felt it was narrow in scope. Perhaps, I should have tried the dynamic proxies before starting with AOP.

Friday, May 27, 2005

Code compliance checker with AspectJ

My First application with AspectJ.. I developed a code compliance checker that checks for System.out.println in the code and reports itz usage. Can you believe that the following few lines of code did the magic, indeed they did!

public aspect Checker
{
pointcut sopReporter() :
call(void java.io.PrintStream.print*(..)) &&
within(com.trial03.*) && !within(Checker);


before() : sopReporter()
{
System.out.println("!!!!! STOP USINg System.out.println() !!!");
}

}

AspectJ is really cool and I'm lovin it !!!

Monday, May 23, 2005

My Initial Experience with AspectJ

I felt lucky when my manager told me that I need to design and develop a state-of-the art reporting framework for our product, while on my assignment in California. Upon protracted discussions with the product architect, we arrived at an architecture that required numerous patterns and AspectJ. I'm excited on listening AspectJ ;-). I downloaded the required libraries and plugins and started learning AspectJ. Itz fully fun filled experience. Keep watching my blogs as I surge ahead with AspectJ z :-)

Tuesday, May 17, 2005

An Amazing commons lib...

I came across this wonderful library from jakarta commons. It is called as the JXPath. This allows querying object graphs from the collection using a XPath Query syntax. Really amazing. I remeber writing a search component for a paginated list for which I had to cook up a custom query syntax. If I had used JXPath, my task would have been very simple.

Monday, May 16, 2005

My Eclipse is Heavy

Over time, I installed so many plugins that my Eclipse started cribbing despite a 1.2 GB RAM. Today I came across a code review plugin by name Jupiter. It is very good.

I also tried out the XMLHttpRequest object, itz cool.

Thursday, May 12, 2005

Demystified the Black-Scholes Model

A very interesting presentation on the financial services offered by my current employer, made me nostalgic of the Financial concepts I studied while pursuing MBA. I'm highly motivated to do something and decided to demystify the very famous Black-Scholes formula. I must admit, it wasn't a smooth sail. First, I had to brush my understanding of mathematics and relate it to understand the Black-Scholes formula, it was fun filled experience. Today, I learnt a valuable lesson - Technology is an enabler, when coupled with domain expertise, the combination has the maximum value. I've decided to dedicate some time everyday to gain domain expertise.

Tuesday, May 10, 2005

Will be an MS Excel guru soon

Oflate, I'm churning out more spreadsheets and documents than LOC. I've already gained enough expertise with MS Excel and using it for all my planning activities. Perhaps, I'm doing justice to my MBA degree. My professors will be delighted to know about this development. Again, to quench my thirst for coding, I developed a pagination component using Tiles. Anyone interested in trying out this component can mail me ravisk@gmail.com

Thursday, May 05, 2005

Change in Attitude

I was asked by a colleague for some help in implementing a feature of a product. Upon probing, we found that the feature doesn't exist in the product. If such a thing ever happened, I'd have immediately googled for the thing and tried some open source stuff. But now surprisingly I sat down to develop it myself. Change in attitude.. :-)

Monday, May 02, 2005

XDoclet is cool..

Today I tried my hands at the XDoclet using JBossIDE as Eclipse plugin. It has been a very smooth ride and I'm amazed at the calibre of XDoclet. Although, I have heard of XDoclet earlier, I didn't get a chance to work with it.

Sunday, May 01, 2005

My Fingers are itching for code...

Last week has been too boring for me with no major activity. I've been asked to estimate the effort required for customizing a feature for a well-known client. And believe me guys, coding is far better than better than going thru the requirements doc and churning scores of spread sheets. To quench my thirst for code, I developed a small scale web based xml navigator using struts, jdom and JS. Surprisingly, it became instantly popular among my colleagues. Anyone interested in trying this out can mail me at ravisk@gmail.com. Your suggestions/comments shall definitely add value to it.

I expect to do some interesting stuff this week..

Thursday, April 21, 2005

Lifez chugging along...

Today I didn't have anything "nutritious" on my plate. I was asked to take a session on Tiles (again!) tomorrow that would be recorded for new joinees in the future. This time I want to experiment with the "metacognition" approach I learnt from reading the Heaf First series books, made a PPT. Letz see how it goes.
I accidently hit upon Amit Rathore's site, he is just amazing.

Wednesday, April 20, 2005

File Attachments using Axis

Another small but interesting problem. My colleague agained stumbled upon a problem - sending files as attachments using webservices. Although, I knew that SAAJ is used for attachments, I was looking for a good example to speed up my friend's work. I found a very simple yet exhaustive example at this link http://www.bii.a-star.edu.sg/infoscience/seg/fileTransfer.asp. Thanks to Azmi Bin Mohamed Ridwan, who shared this excellent example.

Monday, April 18, 2005

POI is tres cool

Today, my task was to parse an XML file and generate a Excel file out of it. I was trying various available alternatives like Gnumeric format, SpreadsheetML and jakarta POI. POI is tres cool.It saved lot of lines of code and most interestingly a very narrow learning curve.

Friday, April 15, 2005

Publishing an EJB as WS


To expose an EJB as an endpoint, there are two ways - if the container supports EJB2.1 spec, a stateless session bean can be exposed as a web service or use Axis Platform to publish an EJB as a WS. I preferred the latter for some project reasons. I'm using WLS8.1 SP2.
The process doesn't require more than 3-4 lines in the deploy.wsdd file.
The following is a copy paste from the deploy.wsdd:





<parameter name="beanJndiName" value="HelloBean"/>
<parameter name="homeInterfaceName" value="demo.HelloHome"/>
<parameter name="remoteInterfaceName" value="demo.Hello"/>
<parameter name="allowedMethods" value="*"/>
<parameter name="jndiURL" value="t3://localhost:7001"/>
<parameter name="jndiContextClass" value="weblogic.jndi.WLInitialContextFactory"/>


And Bingo! I executed published and consumed the WS at the first go without any errors. whew! what a relief.
The next step was to send and receive arrays of VOs from the WS. This requried some fiddling of the wsdd file again. This line did the magic:



<beanMapping qname="myNS:VO" xmlns:myNS="urn:ravi" languageSpecificType="java:ravi.MyVO"/>



and the extra lines in the client program>



call.registerTypeMapping(MyVO.class, qn,
new org.apache.axis.encoding.ser.BeanSerializerFactory(MyVO.class, qn),
new org.apache.axis.encoding.ser.BeanDeserializerFactory(MyVO.class, qn));
call.setReturnType( qn );




This solved 80% of my problem. The next step was to return an array of VOs. This required just one change in the above code
call.setReturnType(XMLType.SOAP_ARRAY);
I'm delighted on publishing and consuming the WS. I'm still excited, thought I would write a Eclipse plugin that uses axis and generates stubs for static invocation.. Hmm not a bad idea....

Wednesday, April 13, 2005

Back to Web Services

One of my colleagues has stumbled upon webservices and asked for help. The problem was intriguing and spurred interest. The scope of the problem was to pass an object (VO) as in put argument to an EJB published as a web service and get another VO as a return from the method call. This was interesting indeed and I jumped onto it immediately....