Wednesday, May 30, 2007

Twitterize your SunBird (Calendar)

Aren't you tired of typing all the twitter updates? But still want to let your friends know what you are doing? So here you go... I have twitterized your SunBird. SunBird is Mozilla's open source calendar. My code reads the events from the SunBird database every half hour and updates the Twitter with the first upcoming event. So, if you have a meeting at 11PM and Lunch @ 12:30 then this application will update the twitter with Meeting@11PM. So all you have to do is to update your Calendar (SunBird) with the events and Twitter will be your flash screen. Save some typing Guys!

So what do you do?
I have uploaded the entire application at the download section of so go ahead and download it. Cut and paste the link if the href does not work: I have provided the source under the open GPL license, so feel free to enhance it, make it fancier and redistribute it. Just think about me before you do so

How does it work?
SunBird uses the OpenSource SQLite format for its' data storage. So, if you are using any Calendar system which uses the same format, you can use this application against it. Sorry Outlook folks! Microsoft has to open a bit. The application uses the SQLite jdbc driver to connect to the SDB file and selects the future events from the CAL_EVENTS table. It brings the title of the first upcoming calendar event and then connects to the to log you in and publishes the message.

How to run the application?
All you need is Java. The manifest file has already been updated to set the mainClass. Open a terminal/console/command prompt and run the following command:
java -Ddb=<location_of_sdb> -Dun=<twitter_login> -Dpw=<twitter_password> -jar s2t.jar

  • db is the fully qualified location of the SDB file. Usually, Mozilla SunBird saves the calendar in $HOME/.mozilla/sunbird/<id>.default/storage.sdb file on Unix and something similar to "/c:/Documents and Settings/<username>/Application Data/Mozilla/Sunbird/Profiles/<id.default>/storage.sdb" on Windows. Make sure the location of this file is correct. Guys this is your database!

  • un stands for your user name. Usually its' your email address.

  • pw stands for your password. This is legible text. As SunBird runs locally on your system and so is the terminal which you are running this application on, so its not too bad to type this in. If you are geek enough then go ahead and update the code to encode it.

Future Enhancements:
1. Behind a proxy server? its simple to modify but not done in this release. [Done]
2. A properties file to save the input parameters. [Why to complicate]
3. Targetted messaging from Calendar.
4. From Twitter to your Calendar.

Keep reading the comments on this blog for more options and happy Twittering and Calendaring friends!

Saturday, May 26, 2007

[Strictly humor] Man I miss the old days

Was reading this story on Litvinenko murder case. I became a little nostalgic. This current stuff of bombing, chasing terrorists, me will do this and me will do that is not cutting it. What a good old James Bond stories were. When assassins had class and looks. The MI6, the KGB and CIA stuff. Thanks Russia for bringing the days of high adrenaline, black suits and eyes of Daniel Craig back in business. This Islamic terrorism is depressing.

Friday, May 25, 2007

Goodbye Martin!

At Sun I worked for some really good people. One of them was Martin Hardee. He and his team transformed the usability of sites and made it much more user friendly than it was. He is now joining Cisco to take up new challenges. So Good Bye Martin. I know that you don't know who I am. Even though I was not directly affected by the work your team does but I was in the same bigger team and I knew you very well. I had never thought anyone could introduce so much art in the technology. I love Sun, I love the team you were part of, I liked your blogs and I love Cisco and what they do. So keep blogging.

Wednesday, May 23, 2007

The funny thing about American Idol

1. The best singer never wins (No btw it was not Blake).
2. Most of the guest singers sound terrible compared to the contestants.
3. William Hung still sounds stupid.

Simple little things of Programming - How to Toplink?

Here is what I compiled a short high level overview on Toplink:

Object persistence impedence mismatch is one of the most struggled areas of Software development. Using Object Oriented philosophy has become a norm to build scalable and complex systems. Pretty much all the current day applications use databases to store some type of data. The data are usually stored in relational model but the Objects are more hierarichal in structure. Due to the difference of technologies and the perception of the models it becomes harder to map the application with the data schema. The team ownership of the database schema is also usually different from the teams who design and build the application. That makes even harder to control how the internal components of an application are constructed. Using the jdbc drivers directly to retrieve and persist data makes the application harder to scale and manage. It also makes it more error prone and slower. To solve the problem O-R mappers come to rescue.

What is a domain model?
The domain model is a conceptual model of a system that describes the various entities involved in a system and their relationships. The domain model also documents the key concepts and the vacabulary of the system. The model displays the relationships among all major entities within the system and usually identifies their important methods and attributes. This means that the domain model provides a structural view of the system. In most cases the simple Java classes are used to create a domain model. These Java objects contain the attributes that together represent a state of the object. This is the state of the object that is persisted in the database.

What is a data model?
Data model defines how data are structured and used in the database. There are three model elements that a data model defines:

  • Structural:
  • A collection of data structures that are used to create databases representing the entities or objects modeled by the database.
  • Integrity:
  • A collection of rules governing the constraints placed on these data structures to ensure structural integrity.
  • Manipulation:
  • A collection of operators, which are applied to the data structures, to update and query the data contained in the database.

What is a Toplink?
Toplink is at core an O-R mapper, which stands for Object-Relational mapper. Oracle Toplink builds high-performance applications that store persistent object-oriented data in a relational database. It successfully transforms object-oriented data into either relational data or Extensible Markup Language (XML) elements. Using Toplink we can integrate peristence and object-transformation into our application, which staying focussed on our primary domain problem by taking advantage of an efficient, flexible and field proven solution.
Toplink is suitable for use with a wide range of Java 2 Enterprise Edition (J2EE) and Java application architectures. Use Toplink to design, implement, deploy and optimize an advanced, object-persistence and object-transformation layer that supports a variety of data sources and formats including the following:

  • Relational –
  • For transactional persistence of Java objects to a relational database accessed using Java Database Connectivity (JDBC) drivers.
  • Object-Relational –
  • For transactional persistence of Java objects to special purpose structured data source representations optimized for storage in object-relational databases such as Oracle Database.
  • Enterprise Information System (EIS) –
  • For transactional persistence of Java objects to a nonrelational data source accesses using a J2EE Connector Architecture (J2C) adapter, and any supported EIS recore type including indexed, mapped or XML.
  • XML –
  • For non-transactional, non-persistent (in-memory) conversion between Java Objects and XML Schema Document (XSD)-based XML documents using Java Architecture for XML Binding (JAXB).

Toplink includes support for Container-managed persistence (CMP) containers from a variety of vendors including Oracle OC4J, IBM WebSphere and BEA WebLogic Server and support for base classes that simplify the Bean-managed persistence (BMP). The Toplink runtime lets the application exploit the mapping metadata with a simple session façade that provides in-depth support for data-access, queries, transactions (both with or without external transaction controller) and caching.
The following diagram can illustrate the Toplink Runtime :

Toplink Key Features
Toplink provides an extensive and thorough set of features. Java developers can use these features to rapidly build high-performance enterprise applications that are both scalable and maintainable.
Some of the primary features of Toplink are the following:

  • Nonintrusive, flexible, metadata-based architecture.

  • Comprehensive visual Toplink Workbench

  • Advanced mapping support and flexibility (relational, object-relational, EIS and XML)

  • Object caching support

  • Query flexibility

  • Just-in-time reading

  • Caching

  • Object-level transaction support and integration

  • Locking

  • Multiple performance tuning options

  • Architectural flexibility

Getting Started
So, how to start with Toplink? What exactly does it do? How does it create the mappings? Where does the mapping reside? These are the right kind of questions to ask if you are starting or thinking of using Toplink. The goal of any O-R mapping is to create an object graph in memory that represents the Object hierarchy of the domain model and has all the definitions of its relationship to the data model. Oracle Toplink imports the database tables, Java classes and their relationships as a set of XML files. Once these files have been created, the object graph is built either by importing the project as an XML document or a Java class. The XML or the Toplink project Java class contains all the mappings to create the Object graph required to persist or query against the database and is one core artifact required to run a Toplink enabled application. The Toplink runtime uses the XML mapping or the Project Java class to create the Object graph in memory which is accessed by the Toplink session to provide the data access. Toplink makes the application agnostic to the details of the database as it is now managed in one single layer. Toplink also provides a set of Java interfaces (APIs) to access or manipulate its Objectgraph.

Understanding Toplink Metadata
The Toplink metadata is the bridge between the development of an application and its deployed run-time environment. Capture the metadata using Toplink Workbench (or JDeveloper) and pass the metadata to the run-time environment using deployment XML files (such as sessions.xml). We could also code these files using Java and the Toplink API but this approach is more labor-intensive. Toplink Workbench also provides an option to export the mapping as a Java class.
The metadata encapsulated in deployment XML files, lets you pass configuration information into the run-time environment. The run-time environment uses the information in conjunction with the persistent entities and the code written with the Toplink API to complete the application. Here is an example of a simple interface. The illustration shows how Toplink uses metadata (In XML format) to manage the data model, classes and the database table information.

Advantages of Toplink Metadata Architecture
The Toplink metadata architecture provides many important benefits, including the following:

  • Stores mapping information in XML descriptors and not in the domain model objects.

  • By using the metadata, Toplink does not intrude in the object model or the database schema.

  • Allows us to design the object model as needed without forcing any specific design.

  • Allows DBAs to design the database as needed without forcing any specific design.

  • Does not rely on code-generation (which can cause serious design, implementation and maintenance issue).

  • Is unintrusive: Adapts to the object model and database schema rather than requiring you to design their object model or database schema to suite Toplink.

Creating Project Metadata
A Toplink project contains the mapping metadata that the Toplink runtime uses to map objects to a data source. The project is the primary object used by the Toplink runtime. This section describes the principal contents of project metadata including Descriptors and mappings and Data source login information.
1. Descriptors and Mappings: The Toplink maps persistent entities to the database in the application using the descriptors and mappings we build with Toplink Workbench. Toplink workbench supports several approaches to project development including the following:

  • Importing classes and tables for mapping

  • Importing classes and generating tables and mappings

  • Importing tables and generating classes and mappings

  • Creating both classes and table definitions

Toplink Workbench supports all these options. The most common solution is to develop the persistent entities using a development tool such as an IDE like Oracle JDeveloper or a modeling tool and to develop a relational model through appropriate relational design tools. You then use Toplink Workbench to construct mappings that relate these two models. Although Toplink workbench does offer the ability to generate persistent entities or the relational model components for an application, these utilities are intended only to assist in rapid initial development strategies not to complete a round trip application development.
2. Amending Descriptors: An amendment method lets you implement a Toplink feature that is not currently supported by Toplink workbench. We would need to write a Java method to amend the descriptor after it is loaded and specify the method in the Toplink workbench for inclusion in the project metadata.

Data Sourch Login Information
For non-CMP projects we need to configure a session login in the session metadata that specifies the information required to access the data source. For CMP projects, the project contains a deployment login that specifies the information required to access the data source.
There are three ways to create Toplink mapping artificate: Toplink Workbench, JDeveloper or Using Toplink Java APIs to create the mapping directly. The two more frequently used IDEs are Toplink Workbench and the Integrated Toplink component for JDeveloper:
Toplink Workbench
Toplink Workbench is a standalone development environment that allows users to import Java classes or domain objects created externally in form of a jar or compiled classes in a directory. The workbench also allows creating and testing a Database connection using JDBC drivers. The workbench provides an option to use either of the development, testing or production database credentials for logging in to the database. The users can then import a set of database tables for which the mapping is required. Any classes that are in the workbench classpath can be imported into the workbench project and mapped to the database tables imported earlier. Once imported, the Workbench can recreate the database tables in a defined schema on any other database or schema. This provides a flexibility of code and mapping mobility. Once the mapping is completed, the project can be exported to an XML document or a Jav aclass whose package and path can be defined in the project properties.
Oracle JDeveloper
Oracle JDeveloper is an Integrated Development Environment that provides an ability to create multiple types of projects. The IDE also has a Toplink component that can be used to map the Java classes in the jDev project. The flexibility that the JDeveloper provides is that the toplink mapping can be done on the Java source itself anddoes not require the classes to be compiled. It provides one development interface for a complete application development.

Supporting Information




Tuesday, May 22, 2007

Is Kalam not running for another term?

For the God sake let the common Indians choose at least one leader directly. The news came in that NDA has officially pulled off President Kalam's candidature for another term. Did any body care asking the masses what they want? We choose parliament but not its' leader. At least let us have a say in for the Presidentship - A one non-political position. So the "chosen jerks" have determined to snatch our beloved president from us too. May be President Kalam did not belong there anyway. He has better things to do. Either way we are waiting for you Sir. Long live our President!

Saturday, May 19, 2007

People who make me uncomfortable...

01. Who are insensitive and talk in their native language which I can not understand.
02. Who feels challenged in a constructive conversation.
03. Who talks less.
04. Who are scared of sending emails.
05. Who hides and lies.
06. Who does not share.
07. Who comes to you with a problem and never apprises you back if it got resolved.
08. Who makes personal comments.
09. Who are unethical in their professional practice.

Wednesday, May 16, 2007

Am I an Indian?

I have been watching CNN's episode on the Asian Americans. What they are discussing is how the Asian Americans are very educated, do well in schools, very sincere, higher average salary, may be biologically genius and blah blah. So if I make these parameters to scale myself, I don't think I am an Asian or more so like Indian.

1. I tried to go to school here and faired very badly.
2. What high average salary? May be the average of mine and that of "Tusarkanth Dinanath Digambarnath sumitprasad Srinivas Krishnamurthy"'s salary raises the average higher. Speaking of average.
3. I just keep dreaming of completing a Masters degree from a decent University. MIT and Ivy league are the farthest dreams. Will even any community college take me?
4. And what sincerity? I don't even know what I would like to be in 5 years.

Monday, May 14, 2007

World's democracy

Its just feels moving
[Downloaded from]

Friday, May 11, 2007

Expectations from Mayawati

**On some local political changes in India. I am using words like upper/lower castes just to represent a section of the society. I, like many others don't believe in these concepts.**

I recently visited UP, India's most populous state when the state elections were just announced. I had a chance to informally chat with many point of views and surprisingly the common voice was in support of BSP - A party run by Mayawati, one of the younger political leaders in India. Journalists made cautious fun about how once the basher of upper caste Hindus has fielded more candidtates from that section of the society this elections. How the Brahmins and Kayasthas are openely supporting Mayawati who are disenchanted by BJP's bloody religious politics, SP's corruption and Congress's inexistence. The results are out and the first time in the history of UP has BSP gained a clear majority ending the recent coalition regimes. One of the reasons for her success has been due to the expansion of her vote bank into the upper caste hindus, muslims and her strong support base of the lower caste hindus. The social web has changed in UP.
I also talk to many of my friends here. One common sentiments I find is "For India to make real progress, the caste system has to go". The sentiment is shared across the people from all sections of the society. This aspiration in a very remote manner has been reflected in Mayawati's victory.
So whats expected from her? You got support and you got the majority in the assembly. In recent times UP has even slipped down below Bihar - once known for its mismanagement and corruption. No industrial development has taken place in years now. Cities have been sold to a few Industrial houses. Corruption is rampaging and the people's emotions have been constantly misused for the political reasons. With Mayawati's victory the people of the state have said loud and clear a positive "NO". Is it a coincidence that the country is celebrating the 150th year of 1857 - The First war of Independence?

Wednesday, May 09, 2007

Simple little things in programming (Part-II) - make configure

In my short span of programming life I have done quite a few "make configure (or ./configure)". Thanks to The concept is simple. You get a package and you configure it for your environment. Then came ANT and we forgot about the power of 'configure'. Its not ANT's problem but we as developers don't bother to create any such targets. Ah.. may be I am generalizing my own habit. Anyway, we always have at least three platforms in any serious programming project. dev, test and prod. I have seen numerous teams building three deployment packages - one for dev, one for test and one for prod. Usually the problem is solved by putting the platform specific values in a properties or a config xml. The solution? You don't have to be a configuration management expert. If you are ANTing you can use the replace tag. The Ant replace tag allows certain tokens to be replaced at the deployment time. Remember make configure? Instead of multiple builds, use the Ant replace and ship the package to the deployment folks to run "ant configure" instead. I think make configure (or just configure) still sound sexier but who listens to me?

# A very simple build.xml
<target name="configure">
<replace dir="${dir}" value="{val}">
<include name="**/*.properties"/>

Assuming you have @val@ in the platform specific files as tokens which you need to replace.
$ ant configure -Dval=p_value

... And the old days will be back.

Monday, May 07, 2007

Dangerous desensitization

Three news which at one time used to invoke serious emotional outburst now passes through our eyes with very little notice. "Soldiers killed by a road-side bomb", "Bomb blast kills scores in Iraq" and "Civilians killed in bombing in Afghanistan". Is it the hopelessnesses which is making us forget all the human values? Or are we winning with weapons but losing the war with our own values? A dangerous desensitization.

Friday, May 04, 2007

The lost hobbies

I was talking to one of my good friends today and realized later that I had so many hobbies before. Somehow it all got lost and I am no where close to recuperate them no more. Believe me I was not this bore before, I had skills.

1. Chess - This was my first serious hobby. I started playing when I was 6 yrs old and once (at 8) almost defeated one of the well known player of the town. May be he was testing me but he did pass on some very good words and wanted me to join the local tournament. End result? If you play chess all day long, how will you pass your high school? 20 yrs on I am even afraid of looking at the chess board.

2. Cartoons - I started drawing when I was may be 12? My cartoon was even published in the local edition of the timesofindia. Now? I am afraid of even writing with a pen :(

3. Drum - Don't laugh. I could have matched every beats of pretty much any bollywood song then. Still the beats of dhol (One Indian drum) makes me religiously ecstatic. My evil relative's "You would become a drummer when you grow up" comment made it sure that I should concentrate on my studies otherwise...

Now where do I stand? It is anybody's guess if you see a blog written at 8PM on Friday night.

Tuesday, May 01, 2007

Go Ubuntu

So Dell has decided to use Ubuntu for its' Linux PC/Laptop series. A little story to tell... My Sis has a laptop whose hard-disk failed. She ordered the Ubuntu CDs online which arrived in just 5 days. She is not a computer programmer but an avid user of the computers. With the help of a wireless router she loves to take the laptop with her with a Ubuntu CD in the CD-drive and work on her emails and online documents while watching her favorite cartoon show. A simple feature but works wonders. Go Ubuntu Go!