Skip to main content

Posts

Showing posts from 2008

Deploying Web Service in Apache AXIS2

The purpose of this article is to talk about how to write web service and deploy it in Apache AXIS2. First step is downloading and installing apache axis2. There are two ways to use Apache AXIS2. 1. Install AXIS2 as a standalone server using the Standard Binary Distribution. 2. Deploy axis2.war and deploy it in a servlet container. We will be using the 2nd method in the article. To check the installation open the url http://localhost:8080/axis2 and you should be able to see the home page of apache axis2. Please locate the folder axis2\WEB-INF\services in exploded war file of axis2. This is the folder where you will copy the code of your service and it will get deployed in apache axis2. Lets us take a simple example. Write your service class. public class HelloWorld { public String sayHello(String firstName, String lastName) { System.out.println("Hello World Invoked"); MessageContext incomingContext = MessageContext.getCurrentMessageContext(); FileDataSourc

Getting Started with Apache Lucene

Apache Lucene is a high-performance, full-featured text search engine library. The API of lucene is very simple to use. Here is overview of some of the objects required to start using Apache Lucene. Document and Fields The class "org.apache.lucene.document.Document" is necessary container for the index. Lucene requires all indexed objects to provide an instance of Document. Each document defines one or several fields ( (org.apache.lucene.document.Field). Fields contain classified information about the document or metadata related to document. A sample classification is for example the creation date of a file, author of the document etc. These fields allow you to search later for a specific information in this classification. IndexWriter The class org.apache.lucene.index.IndexWriter creates the index. Via the method addDocument you can add an existing Document to the index. The constructor for IndexWriter expects the directory to store the index, and the analyzer f

Calling Struts Action by Javascript

To call a struts action by Javascript on an event, you need to write a function which is invoked when the event occurs and this function makes an AJAX call. The AJAX call can send a request to the same URL which is provided in action attribute of form tag or html:form tag. e.g. In case your action URL is something like "/registerUserAction.do?action=forgetPasswordForward" that you provide in action attribute of html:form, you can pass the same url to the mentioned code snippet below: function makeRequest(url, callbackfunction) { var http_request = getXMLHttpObject(); url = url + "isComingFromAjax=true"; if (url.indexOf('?') != -1) { url = url + "&" ; } else { url = url + "?" ; } url = url + "isComingFromAjax=true"; http_request.onreadystatechange = callbackfunction; http_request.open('POST', url.substring(0, url.indexOf('?')), true); http_request.setRequestHeader('Content-Type'

Choosing a LCD

Well, few months back I got confused when I saw so many LCDs of Sony, Hitachi, Philips, Samsung Sansui. I visited many showrooms and what I discovere that in one showroom I found Samsung as the best and in other Sony was the best, if you get confused obviously most people would end up with Sony. But then I realised dealers promote one or the other brand and they keep that unit in best settings.So, I jumped into a shop and got the remotes of all LCDs and when I set all of them on same brightness, sharpness level, it was a minute job for me to go for hitachi. Shopkeepers will tell you about so many factors, but only two are important Contrast ratio and response time, the time taken between the result on screen and when the button is pressed. This is how I decided and its been six months no problems. Till then there are new models but you can use the same approach to decide about a LCD.

Words for Sounds and Expressions - Hindi Comics

I build up this knowledge during my childhood and I found it very funny and hilarious when I visualize and use them today. Here are a few examples: Chapaak - Sound of falling into water Dhadaak - Sound of being hit by a wooden material, chair etc which broke after you are hit. Dharram - Person falling into some wooden or steel material. Dhaaen - Sound of firing of Gun. Bu. Hu. hu.. hu... - Weeping Subak.. Subak - Sobbing Sarraaat - Motar bike moving. Gulup.. Gulup.. - Drowing in water Dhamaka - Blast, they will just make some clouds and right "Dhamaka" in middle. Sudok.. Sudok.. - Having some liquid with a straw And finally a big fight between two people: Make clouds and write on all directions following words - Mukka, Laat, Thappad, Ghussa. And if the person is being severly beaten write in middle "Dhunae par Dhunae". Hope this is going to remind you of childhood. If I have missed some of them, please let me know.

Old Honda City - Value for Money

I am crazy about cars, I was always a fan of old honda city ever since it was launched. Finally I owned it, got it in 2004, 40K done and I am so satissfied with the ride, handling and comfort I enjoy driving this car. My hometown is in Jammu and twice I have been there in my old honda city. First time I drove it on my own upto Jammu and was so glad with the comfort and fun I had all the way to my hometown. Second time, I hired a driver who drove me to Jammu and then I got the feeling of comfort and luxury that old honda city can provide on back seat. Six months back I went to a marriage, a friend of mine has recently purchased a brand new zen, he asked me for a test drive to know why I didnt purchased a new car, reluctantly I gave him keys, we went for a drive of 2 Kms and when he handed me back the keys, he said "Get me one like this, or give your city to me and take away my new zen and tell me how much more you want". What a compliment man !! But, the compliments keep pouri

Differences between Delete, Drop and Truncate Statements

DELETE, DROP and TRUNCATE statements differ in their nature itself. DELETE statement is a DML (DATA MANIPULATION LANGUAGE) statement. DROP AND TRUNCATE statements are DDL (DATA definition language) statements. A DML action can be rolled back if the data is not committed, but DDL actions cannot be rolled back until Oracle 9i. With Oracle 9i FLASH BACK enabled even some of the DDL statements can be rolled back. Delete A delete statement deletes the data from a table. A delete statement can have a “where” clause, which need to be satisfied for the data to be deleted from the table. Actions of Delete statement Deletes the data from the current table space. Modifies the undo table space with the delete records. Executes all the before / after statement and row level triggers. Updates the indexes (makes the index empty if the where clause is omitted). Constraint checks are performed before deleting the rows Syntax of a delete Statement: DELETE FROM table [WHERE condition] Truncate Truncate d

Oracle - Rank Function Overview

Rank calculates the rank of a value in a group of values. Rows with equal values for the ranking criteria receive the same rank. Oracle then adds the number of tied rows to the tied rank to calculate the next rank. Therefore, the ranks may not be consecutive numbers. Consider the following Schema CREATE TABLE USER_TEST ( user_id numeric(12), first_name varchar2(32), last_name varchar2(32), age numeric(3), salary numeric(7) ); insert into user_test values(1, 'Pardeep', 'Kumar', 26, 20000); insert into user_test values(2, 'Raj', 'Sharma', 23, 15000); insert into user_test values(3, 'Jai', 'Singh', 30, 30000); insert into user_test values(4, 'Rana', 'Pratap', 32, 35000); insert into user_test values(5, 'Nakul', 'Gupta', 23, 16000); insert into user_test values(6, 'Ritu', 'Kumar', 22, 10000); insert into user_test values(7, 'Sita', 'Dikshit', 27, 22000); insert into user_test val

Learn to Play Keyboard

One day I started searching internet about the same thing, how to play keyboard, went through a number of sites, blogs etc.. etc. But finally i learned it on my own, yes dont get surprised this is truth, because most of the sites will just provide you information on keyboard notes etc. But none of them tell you what goes wrong that you dont end up with success in keyboard playing. Well I am sharing my experience here, along with a couple of steps which I hope will be really helpful to you. Please read it like a story not like a lesson about keyboard learning, this will make it easy for you to learn keyboard. Also, this is for those who are busy with their life but still want to lean to play keyboard. First and foremost thing: a) Keep your keyboard at a place, where you can see it, see it in the morning when you get up, see it easily when you go around in your home, dont dump it into an almirah or trunk, this helps, dont get surprised, because everytime you see it at the back of the min

MUSSOORIE - Queen of Hills

Well, it was just 15 days to long weekend of 2nd october 2008 and we started thinking where do we go this time. Tired up of my daily drive to Gurgaon from Delhi, I wanted to go to a relaxing place, after some searching, we freezed mussoorie because of the following reasons. a) Its easy to reach just 300 kms, and their is Dehradun Shatabdi which runs daily, and after dehradun you can get cabs. b) Its queen of hills, now I too beleive it. c) Very good hotels available on all the major sites. You can make a booking before you leave. d) Place to go around are very nearby, that reduces the travel you do on a vacations. These were my priorities and hence i freezed for mussoorie, next difficult question "Where to Say?", yes this was the most difficult, when i started giving thoughts initially, but then it because simpler when i have thought to my reason for the vacation "RELAX", so it became simple look out for a place away from crowds, I listed a few of them: a) Surbhi Re

Creating Image Thumbnails

When I started working on this initially, I started looking into open source tools for this, after spending couple of hours on open source tools I suddenly jumped into oracle site and was pleased to see a good support for image processing in oracle. Oracle provides support to create thumbnail of images stored as blob. Here is simplest way to create image thumbnails. Create a table that will store the original image and the thumbnail image content as blob. CREATE TABLE test_thumbnail ( id NUMERIC(12) PRIMARY KEY, image_content BLOB, thumbnail_content BLOB, ); Create a stored procedure that will update the thumbnail_content field after image is stored in the database. create or replace PROCEDURE IMAGE_THUMB_PROCEDURE (imgId IN NUMBER , imgAttribute IN varchar2) AS imageId integer := 0; verb varchar2(100); src_blob BLOB; dst_blob BLOB; BEGIN imageId := imgId; verb := imgAttribute; update test_thumbnail set thumbnail_content=empty_blob() where id = imageId; select image_content into src_bl