Wednesday, December 17, 2008

spam in gmail

I have been using gmail and yahoo mail for over 2 years now and am still wondering why does gmail gets the most spam than any other email server like yahoo or hotmail. It has been only a week and have to again delete about 1000 of my spam emails in gmail and my yahoo mail has about 10 spam emails, when compared to gmail user base being lesser than yahoo( i would say this because most of the spammers would try to spam as many users as they can ). I wonder if google generate all this spam, filters it to show that their email is much better than other email servers, or if gmail is far susceptible to attacks than others..

Thursday, November 20, 2008

ColdFusion string operations

A few string operations in Coldfusion: 1) Mid: determines the subString between the given startindex , and a total of n characters. Mid(String, startindex, n) 2) Left : Substring containing the first n characters Left(String, n) 3) Right : Substring containing the last n characters. Right(String, n) and strings can be concatenated using &

Thursday, November 13, 2008

Adding events to widgets

Well in gxt, if a component or a widget doesnot have an event that is required to handle then the developer can actually add the event to the DOM and then can handle it. The el method of the widget should be called first and then try to add the events to the Events list using the l.el().addEventsSunk(Event.ONCLICK);
The Event class is the one in GWT. 
And then the event handler can be handled for this event as a regular listener.

Tuesday, November 11, 2008


I had the problem of placing a different widgets at the same location with only showing up at a particular time. I was using the cardPanel which is just a layoutContainer with a card layout. The widgets as such cannot be added to the cardPanel but each of them should be placed in a panel and that panel should be added to the cardPanel. cardPanel.add(contentPanel); The user can make the widgets active by using the setActiveItem method in the cardPanel. cardPanel.setActiveItem(contentPanel); Then the widgets should be rendered, using the layout method of the cardPanel, which actually renders all the children of the cardPanel. cardPanel.layout(); It should be understood that the widgets cannot be added to cardPanel as such but they should be placed in another panel

Monday, October 27, 2008


on saturday the 25th i gave the Sun Certified Specialist Netbeans IDE Beta Certification Exam. The exam was pretty cool with all the features that one could find in Netbeans. A guy who had worked in netbeans for an year with all the features of JUnit, using the config of netbeans, setting the properties of a netbeans project. And most importantly, the questions are focused on how to do a particular task in different ways in netbeans and i personally think that taking that people working on netbeans should take the exam to boost their stand.

Friday, October 24, 2008

keyboard events listener gxt

Keyboard events are handled in a different way in gxt than the traditional keyboardListener events. A new keyNav class has to be created with the component that is being handled. And then the key event that the user needs can be handled. Eg: TextField text = new TextField(); // new text field component new KeyNav(text) //new KeyNav class for text component { @override public void onTab(ComponentEvent ce) /overriding the onTab method { super.onTab(ce); // your code } } I still wonder why gxt doesnot provide more specific listeners like the clickListener or KeyboardListener that handles all the events. They do support all the listeners in a generic way.

Thursday, October 23, 2008

submitting data from formPanel gxt

There is always a requirement to get all the data from the forms and have it stored in database or displayed some where else. Instead of actually getting the data component by component gxt can actually get all the data at once using the "getFields" method in FormPanel. This method returns a List of all the fields that are present in the form, and then iterating over the fields we can extract the values based on the way it is rendered on the form. Eg: FormPanel formPanel = new FormPanel(); //creating a formPanel List field = formPanel.getFields(); //getting a list of all the fields in the formpanel for (Field f : field) // Iterating over the list f.getValue(); // value for all components in the formPanel }

Wednesday, October 22, 2008

populating the combo box EXT-GWT

There are only a few samples on ext-gwt. The most recent version being 1.1 released in august. I recently have an issue of populating the combo box before the "down-arrow" in the combo box is clicked. Populating the combo box from the database using cold fusion can be done in the following way
  • Firstly we need to define the ModelType of the data that is being extracted from the CFM file, with the root.
  • Next the JSONReader has to be set to the ModelType which specifies the type of the data that has to be stored in the combo box Store.
  • We then need to set up the HttpProxy for the connection to be established with the database. This proxy contains the requestbuilder which actually builds the request String with a "post" or a "get". The header for the request builder should be set which i am not pretty sure why we are doing it, but if doesnot display the output when it is not set.
  • Then the loader for the combo box has to be set with the proxy which tells about the connections to the database and the JSONReader which talks about the format of the expected text.
  • Finally the store is set with the loader, which is assigned to the combo box.
This is usually the process that is followed not only for the combo box but also for almost widget that gets data from a database. Combo box usually gets the data dynamically i.e, the load of the loader is called only when the "down arrow" of the combo box is clicked. To over ride that and have the data extracted well before the button is clicked then we can just include loader.load(); after setting the store, which will perform the load operation.

Wednesday, August 27, 2008

Google Web Toolkit (GWT)

It has been quite a while since i posted anything.. Well actually i have not been doing anything much during these days, but i think i will be posting more often now. At my work, i was going through what GWT, and i found out that it is one of the coolest ideas that i have gone through so far. The basic idea being converting the java code to Javascript. There are 2 reasons why this is a good idea: 1) Java is most widely used programming language and so providing a compiler to convert the user written java code to Javascript to work as an AJAX application is very intuitive. 2) Javascript as such does not have a compiler to check for errors, typos etc, and so providing the ability to write the code in java and the ability to use its famous IDEs like Eclipse and Netbeans which helps us to use its efficient debugging capabilities.

Thursday, May 1, 2008

game development

The post is not exclusively on game development but i was going through an interview process and one assignment is to develop a game. I initially thought that working and developing a game is much easier and will be done really good if we are good at math, but ohhh god it was one of my most horrible experiences. My start was good but as time passed it went on really bad. And i finally realized that developing a small game involves a much complex process.

Wednesday, April 30, 2008

wow!! Accepted

huh.. my paper for the IEEE-ICSC 2008 has been accepted. Well we actually sent this paper some where around in the first week of march, and finally got eh results just yesterday. My paper was titled "Optima: Tool for Ontology Alignment with Application to Semantic Reconciliation of Sensor Metadata for publication in SensorMap". Well i mentioned about the tool in the previous post. It was actually accepted in the demo track. I should be going to california to present the demo between 4-7 august 2008. A link to the paper is present in my home page.

Tuesday, April 22, 2008

Optima- An Ontology Alignment Tool

Wow finally,  i am done with my tool Optima. I have been working on this tool for over an year. Well it did take me a long time and the reason for that is, i have been working on 2 large code bases, and the usual the code is not at all commented and it gave a me a really tough time to get through their code.  
My main idea here is to generate an automated visualized ontology alignment tool, where a user can enter a couple of ontologies to be matched and thus generate a final alignment between the ontologies.  There are no alignment visualization tools so far, that gives a beautiful and easy to use interface, and a powerful underlying algorithm that performs the alignment. The first code base is of the interface and the second one is of the ontology alignment.
The interface is actually a change to the open source ontology visualization tool welkin developed as a part of MIT -simile project. The interface is pretty cool, but the usual the documentation is really bad. 
The second code base is of ontology alignment. This algorithm is developed as a part of the research conducted by my professor Dr.Prashant Doshi. I later enhanced the algorithm to work for larger sets of ontologies (well not so big but usually in the range of about 300-500 nodes per ontology). I enhanced it by providing an ability to partition the ontology automatically internally, to work on smaller sets and the final result that corresponds to the complete ontology is generated. 
I finally integrated both the tools, the visualization tool, the alignment algorithm , to generate the final tool optima, the alignment visualization tool. 
So far just the basic version is released as a webstart and i expect to release the documentation for the tool within week from now.  I finally decided to have my code to be completely documented and commented. I am actually planning to have the tool an open source, and i want the others who are later working on the code to understand it clearly. 
A screen cast for the tool is present at Optima
A demo version of the tool Optima
A few papers are also available at my research home page Optima
(Yes you are right!! i have the same page references in all the 3 cases. i was just trying to increase my home page rank to advertise my tool) 
Thanks guys, any questions will be greatly appreciated.

Wednesday, April 2, 2008

jnlp and web start

Wow!! finally after all the hard time i am able to get JNLP and web start running for my application. There are no editors available for jnlp to create, check for errors or verify it. We can create a JNLP file in netbeans but validation is not provided, which is the major drawback. And the other way is to create it using a text editor itself. JNLP stands for Java Network Launching Protocol. It is a protocol that specifies how applications are launched using web start. JNLP need a web server to launch the application. Some times the most common problem that is faced with the JNLP is that it displays the plain JNLP file with out launching the application. This is because the mime-type for the JNLP file is not added into the web servers mime types. to have it working we can have this added into the mime-types of the server. application/x-java-jnlp-file jnlp
Now lets see the outline of a simple jnlp and the way it is used to load application that can be easily accessed off the web using a java web start. As the jnlp is an xml file we do have the xml tag defined in the very beginning.
  • jnlp tag is used to specify that this is a jnlp file along with the version. The default version is 1.0.
  • codebase within the jnlp tag contains information about the base url that forms a basis for all the hrefs used in the file. So base url forms the base directory for all the files.
  • The href within the tag contains a reference to the jnlp file.
The information section which contains information about the application.
  • First tag is the title tag which contains the name of the application
  • Vendor tag contains the information about the vendor for the application.
  • homepage refers to a home page that is related to the application or has information about the application.
  • The description field is used for a brief description about the application.
Resource section is one of the most important sections in the jnlp.
  • Starts with the version of java the application can start running fine.
  • The next jar specification tells us about the application jar that contains the main class and is used to load and run the application. This also contains a main attributes, specifying that to true helps web start to identify that this jar contains the main class.
  • All the subsequent jar contains information about the libraries that needs to be included.
Please note that all the references here are in reference to the url at the code base. The final statement here is the one that specifies the main class that is used to start the application. This main class should be present in the jar that is specified as main = true in the jars. Another most important point to be noted is that the application is run only when all the jars are signed using an RSA signature. so before creating a JNLP file first we need to sign the application jars using the same signature. If using external libraries and it contains its own signature then a new jnlp file is created for that library and have this jnlp embedded into the application jnlp

Monday, March 17, 2008

JFileChooser setLocation

I was working on my project and my requirement was to have my openDialog set to a location based on the location of another frame. There is a method called setLocation in JFileChooser that should do, but it doesnot do what it is supposed to do and thus reported as a bug at Sun Bug Database There was an alternate solution that was proposed. the solution is to extend the JFileChooser class and create a class that overrides the createDialog method of the JFileChooser Class. Here we should create a dialog and set the properties to this dialog like the resizing, locations etc. and later use this dialog in showOpenDialog method that we use to start the dialog. The extended class overview is present at javadoc- JFileChooser Recaping it again.
  • Creating the class as specified in the documentation with all the required properties set to the dialog within the createDialog method.
  • creating the object of this class and calling the createDialog method
  • Using the showOpenDialog of JFileChooser using the syntax
int returnVal = openWin.showOpenDialog(dialog);
Where dialog is the JDialog that is returned from the createDialog method.

Sunday, March 9, 2008

GridBag Layout

My actual requirement is the figure shown. I am not really good at swings and was learning it with this application. I was trying various layouts, but none of them helped me to actually get good results for my application, then finally came across grid layout. It has some of the wonderful features like it divides the frame into grids in which it is similar to the grid layout but can also add features like setting the location of the component, filling the component horizontally in the grid or vertically, we can set up the grid width and height. We can change the properties of the grid using the GridBagConstraints class. And later using this object when we are actually adding components to the frame or panel. I am new to swings, this is just a way to share my experiences, any suggestions and changes would be greatly appreciated.

Wednesday, February 13, 2008

Generics in Java

I have been working on collections for over an year now and have no idea of what generics are. Today I was going through the release notes of tiger java and I found out about them.

Generics are the type specification included in collections to get rid of unsafe code.

Prior to generics, compiler has no idea about what kinds of objects are stored in the collections and thus a runtime error is generated instead of a compile time error.

Generics are provided so that the collections can be checked by the compiler and reports errors for any inconsistencies in the code.

Prior to the introduction of generics ArrayList are used as

ArrayList list = new ArrayList();

This makes the code unclear as what is stored in ArrayList

To access the list each time the object has to be cast to a specified type and then consumed.

Whereas from java 1.5 ArrayList can be defined as

ArrayList list = new ArrayList();

This specifies that the list defined stores only values of type String. Thus making the code much more readable.Explicit casting is also not required as the compiler understands that the list contains

objects of type String.

courtesy: Generics

Help in identifying changes, corrections and violations would be greatly appreciated.